Solves for a matrix.
MDIV(A, b)
A |
- |
A non-singular, usually square matrix. |
b |
- |
A matrix |
A matrix that produces b when multiplied by A.
W1: {{1, 4, 7},
{2, 5, 8},
{3, 6, 0}}
W2: {1,
2,
3}
W3: W1 *^ W2
{30,
36,
15}
W4: mdiv(W1, W3)
{1,
2,
3}
W5: inv(W1)
{{-1.78, 1.56, -0.11},
{ 0.89, -0.78, 0.22},
{-0.11, 0.22, -0.11}}
W6: W5 *^ W3
{1,
2,
3}
If A, b, and x are matrices, and A *^ x = b, then mdiv(A, b) returns the matrix x.
mdiv(A, b) is equivalent to A \^ b.
MDIV uses LU decomposition to solve for matrix x and is usually more numerically stable than directly calculating the inverse matrix, i.e.
x = inv(A) *^ b
If matrix A is not square, the system is considered a least squares problem and is solved by QR decomposition. The resulting matrix is the best solution in the least squares sense.
See DADiSP/MatrixXL to significantly optimize MDIV.