![]() |
Prev | Next |
Syntax
# include <cppad/lu_invert.hpp>
LuInvert(
ip,
jp,
LU,
X)
A *
X =
B
using an LU factorization computed by LuFactor
.
cppad/lu_invert.hpp
is included by cppad/cppad.hpp
but it can also be included separately with out the rest of
the CppAD
routines.
Y
is a vector
that contains a
p
by
q
matrix,
the size of
Y
must be equal to
p * q
and for
i = 0 , \ldots , p-1
,
j = 0 , \ldots , q-1
,
\[
Y_{i,j} = Y[ i * q + j ]
\]
const
SizeVector &
ip
(see description for SizeVector in
LuFactor
specifications).
The size of ip is referred to as n in the
specifications below.
The elements of ip determine
the order of the rows in the permuted matrix.
const
SizeVector &
jp
(see description for SizeVector in
LuFactor
specifications).
The size of jp must be equal to n.
The elements of jp determine
the order of the columns in the permuted matrix.
const
FloatVector &
LU
and the size of LU must equal
n * n
(see description for FloatVector in
LuFactor
specifications).
L(
i,
j) =
LU[
ip[
i] *
n +
jp[
j] ]
for
i = 0 , \ldots , n-1
and
j = 0 , \ldots , i
.
U(
i,
j) =
LU[
ip[
i] *
n +
jp[
j] ]
for
i = 0 , \ldots , n-2
and
j = i+1 , \ldots , n-1
.
P =
L *
U.
P(
i,
j) =
A[
ip[
i] *
n +
jp[
j] ]
(Hence
LU contains a permuted factorization of the matrix A.)
FloatVector &
X
(see description for FloatVector in
LuFactor
specifications).
The matrix X
must have the same number of rows as the matrix A.
The input value of X is the matrix B and the
output value solves the matrix equation
A *
X =
B.
LuFactor
with LuInvert
.
The file
LuInvert.cpp
contains an example and test of using LuInvert
by itself.
It returns true if it succeeds and false otherwise.