| 2.1.17.6.4 ocmath_lu_solve
 DescriptionSolves a real system of linear equations with multiple right-hand sides.
 Syntaxint ocmath_lu_solve( double * pA, double * pB, long * pIpiv, int n, int nRhs = 1 ) Parameters pA[modify](input)pointer to matrix A, of size n by n(output)overwritten by the factors L and U; the unit diagonal elements ofL are not stored. pB[modify](input)pointer to right-hand side matrix B, of size n by r(output)pointer to n by r solution matrix pIpiv[output]pointer to the pivot indices of size n by 1. Row i of the originalmatrix is interchanged	with row mIpiv[i - 1] for i = 1,2, ..., n. n[input] order the matrix A nRhs[input] The number of right hand sides, i.e., the number of columns of the matrix B
 Return= OE_NOERROR:  successful exit
 = OE_INT_ARG_LT:  n or nRhs is less than 1
 = NE_SINGULAR: u(<value>, <value>) is exactly zero. The factorization has been completed but the factor U is exactly singular, and division by zero will occur if it is subsequently used to solve a system of linear equations or to invert A.
 = NE_ALLOC_FAIL: Memory allocation failed.
 = NE_BAD_PARAM: On entry, parameter had an illegal value.
 = NE_INTERNAL_ERROR: An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
 ExamplesEX1
 //Assume Matrix1 and Matrix2 contain data
void ocmath_lu_solve_ex1()
{
    Matrix    matA("MBook1");
    Matrix    matB("MBook2");
    matrix<long> matIPIV;
    int m = matB.GetNumRows();
    int n = matB.GetNumCols();
    matIPIV.SetSize(m, 1);
    ocmath_lu_solve(matA, matB, matIPIV, m , n);
}RemarkSolves a real system of linear equations with multiple right-hand sides, Ax = B, using LU decomposition.
 Then, the equation Ax = B can be transformed to two equations Ly = B and Ux = y. First, from solving the equation Ly = B, get y, and then from Ux = y, gain roots of the equation Ax = B.
 See AlsoHeader to Includeorigin.h
 Referencenag_dgetrf(f07adc)nag_dgetrf(f07adc), nag_dgetrs(f07aec)nag_dgetrf(f07adc)nag_dgetrf(f07adc), nag_dgetrs(f07aec), Nag Manual
 |