Actually, the compiler can't do the dispatch correctly.

For instance, given the following approximately real code:

     Matrix a = new SparseMatrix(...);
     Matrix b = new DiagonalMatrix(...);

This line will not dispatch to a special case method for either SparseMatrix
or DiagonalMatrix:

     MatrixOperator.times(a, b)

This is because a and b are just Matrix objects according to the compiler.

You have to invent a way to do runtime dispatching.

On Fri, Jul 1, 2011 at 4:45 PM, Greg Sterijevski <gsterijev...@gmail.com>wrote:

> There is no magic which will remove the elemental complexity of these
> things. However, the complexity would be concentrated in the operator
> classes, where it probably should be. Furthermore, the type matching would
> be handled by compiler. Finally, the multiplication routines would grow as
> a
> need for those operations arises.
>

Reply via email to