What returns lu_factorize?

boost::number::ublascontains function M::size_type lu_factorize(M& m). Its name suggests that it performs LU decomposition of a given matrix m, i.e. Must create two matrices that m = L * U. It seems there is no documentation for this function.

It is easy to infer that it returns 0 to indicate a successful decomposition, and a nonzero value when the matrix is ​​singular. However, it is completely unclear where the result is. Taking a matrix by reference suggests that it works in place, however, it must create two matrices (L and U) not one . So what is he doing?

+4
source share
1 answer

boost , , SciPy lu_factor, , LU.

, LU- L , , , .

, L, U , L , ( ) U . , 3x3 :

    u11 u12 u13
m = l21 u22 u23
    l31 l32 u33

:

     1    0   0
L =  l21  1   0
     l31  l32 1

    u11 u12 u13
U = 0   u22 u23
    0   0   u33

boost void lu_substitute(const M& m, vector_expression<E>& e), , , . LUx = e, L U m .

Lz = e z, z = Ux, m:

inplace_solve(m, e, unit_lower_tag ());

, z = Ux ( e), Ux = e , m:

inplace_solve(m, e, upper_tag ());

inplace_solve , :

, .. .

, .

+5