[comp.lang.c++] Matrix class request and efficiency questions

ssr@taylor.Princeton.EDU (Steve S. Roy) (06/28/90)

Has anybody out there got a good double precision Matrix package
available for ftp?

I know, I know.  There are millions of Matrix classes out there.
Its the first thing everyone does.  I'm looking for one that's as fast
as Fortran.

It should add, subtract, multiply, take sub-matricies, extract rows,
extract columns, extract a reference to sub-matricies, rows, and
columns, etc.

It should check bounds on the arguments the user supplies, but once
they are verified then the actual computation should proceed without
checks.

It should use as few temporary arrays as possible, but still hide the
user from the details of them. And it should do no spurious copying of
data.

Why do I ask for this?

	1) I need it for a variety of simulations I will run, and I
	   expect that there are many others who would benefit from
	   such a class.

	2) I want to bring up performance issues with regard to C++.

There are two aspects to the charictaristic speed you get for numeric
computations using a particular language.  The quality of the compiler
obviously influences how well it translates your specification into
machine code, and some languages make this more difficult than others.
But there is also the fact that a language encourages a particular
writing style, and that style can make it difficult for the compiler
to generate wicked fast machine language.

As far as I can tell, the language spec for C++ allows you to write
fairly "close to the machine" to get speed when you need it, though
I'm also interested in how good a job the various compilers do at
generating machine code.  Cfront, of course, loads the code generation
on whatever C compiler you have, but there is still the issue of how
easy it is to optimize the code cfront produces, especially with
regard to indirecting thru multiple levels of classes.  This is
something I don't know much about, and I would appreciate it if
someone could enlighten me.

As far as the encouraged programming style, I'm not so sure.  Now,
before anyone flames me about the virtues of data hiding and abstract
specifications, I assure you I'm aware of that.  But I do want to
point out that there are times when speed doesn't just matter, but it
REALLY MATTERS, and when I look at sample matrix multiply routines in
books and in (for example) NIH, it becomes clear that efficiency was
not a consideration.  Granted, computers are getting fast enough that
many of the tasks we ask them to do are limited by programming time
rather than execution time, but that is often not the case.
Scientific programming, graphics, and matrix manipulations in
particular, are quite often compute bound, and I really haven't seen
any emphasis on that in the C++ books and examples I've seen.

Steve Roy