I think I like this approach a lot more.

One thing that is left out, and we discussed a lot, is the need to
support vector operations. This can also be done as an additional
interface. This is critical since it forms the basic building block
upon which all higher level matrix operations rely on. I think if we
do it right, it would allow users to implement a GPU version as well.

>From usability point of view, the matrix class is kind of useless
without vector oeprations, since no important higher level operation,
other than multiplying, can be done with without copying it over to a
double array.

So maybe first we make a class

public interface RealVector extends RealMatrix

//code to implement a simple Nx1 matrix

Now in order not to reinvent the wheel, we will model the operations
based on the BLAS library. We can have two versions, one for the
immutable classes and another for mutable.

Then the vector operations can be expressed as in a immutable class

something like

//perform output = a*x+b*v, where x is row of current object
RealVector rowOperation(int row, double a, double b, RealVector v)

//perform output = a*x+b*v, where x is column of current object
RealVector columnOperation(int column, double a, double b, RealVector v)


for mutable it can be basically same interface except no object is returned

//perform output = a*x+b*v, where x is row of current object, and puts
it in row rowResult of this matrix
void rowOperationInPlace(int row, double a, double b, RealVector v,
int rowResult)

//perform output = a*x+b*v, where x is column of current object, and
puts it in column columnResult of this matrix
void columnOperationInPlace(int column, double a, double b, RealVector
v, int columnResult)

What do you think?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to