For example, I want to multiply the scalar, Gamma, by the NxN matrix, A, and return the result as the NxN matrix, B, i.e. B = Gamma * A.
First, I create DenseMatrix64F A, DenseMatrix64F B and double Gamma. Then, I would like to use the method:
org.ejml.ops.CommonOps.mult(Gamma, A, B);
I get a compiler error that Gamma is double that cannot be applied to mult() in CommonOps. The webpage for the mult method is here.
I don't know where I am going wrong. Please could you help me solve the problem?
To perform element-by-element scalar multiplication, use
org.ejml.CommonOps.scale.In your case, try:
In your example, the error arises because the three-argument form of
org.ejml.CommonOps.multexpects the first argument to be of typeDenseMatrix64F, as in:As such, when you pass in a
doubleas the first argument you will get a compiler error. Moreover,multperforms matrix multiplication c = a * b, which is not necessary for your example.