Boost logo

Boost :

From: Kevin Lynch (krlynch_at_[hidden])
Date: 2007-12-17 13:50:24

Andreas Harnack wrote:
> If you think that this doesn't belong to the standard, then
> please allow me to ask one question: Why is there a complex
> number class in the standard and what does it actually do?

There are a number of fundamental differences: the operations on
complex numbers provided for in the standard covers exactly the same
domain of tasks as are covered by the built-in floating point types.
Standardization is possible because implementing those operations for
complex in a numerically stable and efficient way is relatively simple
(although even that can go astray pretty rapidly), and the "best"
storage format of complex numbers on the hardware has long been well
understood and agreed upon. Even the class interface can be agreed upon
pretty trivially, and with minimal impact on implementation flexibility.

For matrices, none of that is the case. Implementing even the simplest
operations efficiently (addition, inner multiplies, subtraction) and
correctly is exceedingly non-trivial, and the next simplest (but much
much larger) class of operations is dramatically more complicated
(inverses, strides, permutations, etc) with a vastly larger set of
special cases. The minimally useful set of operations that _must be in
the public interface_ to be used as building blocks for more complicated
user defined operations are hard to list because they are so long.
Unlike complex, the interface here will have an enormous impact on the
underlying implementation choices. Heck, there is even continued debate
on issues so trivial as the best _memory layouts_ (column major? row
major? arcane subblock storage formats?).

If that doesn't sway you, then by all means, you should consider trying
to define a minimal interface for what you need, and see if you can get
the standards committee to bite. I think you have a very hard uphill
slog ahead of you, with a nearly certain rejection at the other end, but
I wish you luck :-)

Kevin Lynch				voice:	(617) 353-6025
Physics Department			Fax: (617) 353-9393
Boston University			office:	 PRB-361
590 Commonwealth Ave.			e-mail:	 krlynch_at_[hidden]
Boston, MA 02215 USA

Boost list run by bdawes at, gregod at, cpdaniel at, john at