home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18301 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.6 KB  |  72 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!pipex!warwick!sunserver1.aston.ac.uk!ipx1!priceje
  3. From: priceje@cs.aston.ac.uk (Jason Price)
  4. Subject: Request: Templates & Matrix classes
  5. Message-ID: <1992Dec22.112348.18156@aston.ac.uk>
  6. Sender: usenet@aston.ac.uk (Usenet administrator)
  7. Nntp-Posting-Host: ipx1
  8. Reply-To: priceje@cs.aston.ac.uk
  9. Organization: Aston University (Comp Sci)
  10. Date: Tue, 22 Dec 1992 11:23:48 GMT
  11. Lines: 59
  12.  
  13. (Saw a memo here by Mitch Dernis (below) to which this is specifically addressed, but any information or help would be very useful.  Many thanks)\
  14.  
  15. > In article 4904@news.cs.brandeis.edu, dernis@binah.cc.brandeis.edu () writes:
  16. > >Hi,
  17. > >  This is a fairly simple template question, I hope.
  18. > >I have written a template class, which has been tested and
  19. > >appears to work (mostly at least).  Now I tried to use and I 
  20. > >have found a problem.
  21. > >
  22. > >The class is a matrix class, and works with all numerical types
  23. > >(I have only tested the two that I need - but presumably).
  24. > >
  25. > >Now I want to declare a function which returns a complex Matrix.
  26. > >
  27. > >So I wrote,
  28. > >
  29. > >Matrix<complex> function();
  30. > >
  31. > >But I discovered a problem immediately, that this interprets this
  32. > >as instance of Matrix<complex>, not a function declaration.  It now
  33. > >occurs to me that indeed that is exactly what I have written, and
  34. > >it rightfully complains that I left out the arguments.
  35. > >
  36. > >Does this mean at that I have to template this function too, and do 
  37. > >something like:
  38. > >
  39. > >template <class T>
  40. > >void function(Matrix<T>& ref_to_value);
  41. > >
  42. > >Is there a way I can write a function that will return a complex
  43. > >instance of my matrix class without writing the function as a template.
  44. > >The above my be acceptable, even better as it does not generate a 
  45. > >temporary, but still. . .
  46. > >
  47. > >Thanks,
  48. > >Mitch Dernis
  49.  
  50.  
  51. There's a group of research students here at Aston University who are trying to write C++ matrix classes for use in Neural Networks applications.  Do you have any examples of code you have written for operations on matrix classes that we might be able to use?
  52.  
  53. Also, we haven't yet used templates to pass in items of any type to our matrix classes and we do not at present have a c++ compiler to support this.
  54.  
  55. Could you supply details of compilers for SUN systems which meet the requirements of passing any type into a class?  (our systems administrator asked me to mention compilers for Solaris 2.1)
  56.  
  57. Many thanks,
  58.  
  59. Jason Price.
  60. Neural Computing Research Group
  61. Computer Science & Applied Mathematics
  62. Aston University, U.K.
  63.  
  64. email: priceje@cs.aston.ac.uk
  65.  
  66.  
  67.