Closed co-ord closed 3 years ago
Hi,
I am desperately trying to solve a linear matrix equation using EJML
In Python I used to call the np.linalg.solve() function with 2 matrices A and B as parameters.
np.linalg.solve()
A
B
Example:
A = np.array([[3.001, 0.0, -1.0, -1.0, 0.0, 0.0, -1.0], [0.0, 3.001, 0.0, -1.0, -1.0, -1.0, 0.0], [-1.0, 0.0, 4.001, -1.0, -1.0, 0.0, -1.0], [-1.0, -1.0, -1.0, 5.001, -1.0, -1.0, 0.0], [ 0.0, -1.0, -1.0, -1.0, 3.001, 0.0, 0], [ 0.0, -1.0, 0.0, -1.0, 0.0, 2.001, 0], [-1.0, 0.0, -1.0, 0, 0, 0, 2.001]]) B = np.array([2.0, 0.0, 0.0, 0.0, -2.0, 0.0, 0.0]) solution = np.linalg.solve(A, B) print(solution) --> array([ 0.837, -0.357, 0.115, -0.079, -0.773, -0.218, 0.476])
However with EJML, SimpleMatrix solution = A.solve(B); returns the following message Unexpected dimensions for X: X rows = 7 expected = 7
SimpleMatrix solution = A.solve(B);
Unexpected dimensions for X: X rows = 7 expected = 7
Am I forgetting something ?
Hi,
I am desperately trying to solve a linear matrix equation using EJML
In Python I used to call the
np.linalg.solve()
function with 2 matricesA
andB
as parameters.Example:
However with EJML,
SimpleMatrix solution = A.solve(B);
returns the following messageUnexpected dimensions for X: X rows = 7 expected = 7
Am I forgetting something ?