Jelle Herold a écrit :
> Hi there,
>
> A question on extending commonsmath.
>
> I'm missing a couple of (basic) functions on the RealMatrix class;
> for example,
>
> void identity(); // set to identity matrix
There is a MatrixUtil.createRealIdentityMatrix(int dimension) method.
This method will also probably be rewritten some day when diagonal
matrices (or at least band matrices) will be supported.
> boolean isIdentity() // check if this is an identity matrix
This makes sense, with an epsilon threshold argument. For now, you cando
something like the following, but this is a clear memory hog since it
creates two temporary matrices:
RealMatrix id =
MatrixUtil.createRealIdentityMatrix(m.getRowDimension());
return m.subtract(id).getNorm() < epsilon;
>
> Also I'm using them as affine transformations, so I'd like to see generic
>
> RealVector getTranslation()
> void translate(RealVector v);
> void setTranslation(RealVector v);
>
> etc. (this works for arbitrary dimensions, matrix must be square though)
I think I miss something obvious here.
For me, generic translations are affine transforms, not vector
transforms. They can be computed by additive vector operations, not by
nxn matrix operations without extension. Do you intend to use the
operate() method from RealMatrix with extended vectors (i.e. by
appending a virtual +1 component after the ncomponents vector) and a
(n+1)x(n+1) or nx(n+1) matrix as done in computer graphics ?
>
> So wrote a helper class that works on RealMatrix objects treating them
> as transformations, but I'd prefer to have those methods directly on
> RealMatrix.
> (Extending RealMatrix is not practical as methods such as multiply(..)
> don't return the derived class)
>
> Better suggestions are welcome.
I'm not sure I understood well, so cannot suggest anything yet.
Luc
>
>
> Are you interested in implementations of these methods? They might be
> out of scope?
>
>
> Regards,
> Jelle.
>
> 
> To unsubscribe, email: userunsubscribe@commons.apache.org
> For additional commands, email: userhelp@commons.apache.org
>

To unsubscribe, email: userunsubscribe@commons.apache.org
For additional commands, email: userhelp@commons.apache.org
