![]() |
Prev | Next |
Syntax
# include <cppad/lu_factor.hpp>
sign = LuFactor(
ip,
jp,
LU)
cppad/lu_factor.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 ]
\]
int
sign
If A is invertible, sign is plus or minus one
and is the sign of the permutation corresponding to the row ordering
ip and column ordering jp.
If A is not invertible, sign is zero.
SizeVector &
ip
(see description of SizeVector
below).
The size of ip is referred to as n in the
specifications below.
The input value of the elements of ip does not matter.
The output value of the elements of ip determine
the order of the rows in the permuted matrix.
SizeVector &
jp
(see description of SizeVector
below).
The size of jp must be equal to n.
The input value of the elements of jp does not matter.
The output value of the elements of jp determine
the order of the columns in the permuted matrix.
FloatVector &
LU
and the size of LU must equal
n * n
(see description of FloatVector
below).
P(
i,
j) =
A[
ip[
i] *
n +
jp[
j] ]
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
.
L *
U =
P
If the return value of sign is zero,
the contents of L and U are not defined.
sign *
LU[
ip[0],
jp[0]] *
... *
LU[
ip[
n-1],
jp[
n-1]]
Operation | Description |
log( x) | returns the logarithm of x as a Float object |
lu_factor.hpp
defines the template function
template <typename
Float>
bool AbsGeq<
Float>(const
Float &
x, const
Float &
y)
in the CppAD
namespace.
This function returns true if the absolute value of
x is greater than or equal the absolute value of y.
It is used by LuFactor
to choose the pivot elements.
This template function definition uses the operator
<=
to obtain the absolute value for Float objects.
If this operator is not defined for your use of Float,
you will need to specialize this template so that it works for your
use of LuFactor
.
Complex numbers do not have the operation <=
defined.
The specializations
bool AbsGeq< std::complex<float> >
(const std::complex<float> &
x, const std::complex<float> &
y)
bool AbsGeq< std::complex<double> >
(const std::complex<double> &
x, const std::complex<double> &
y)
are define by including lu_factor.hpp
These return true if the sum of the square of the real and imaginary parts
of x is greater than or equal the
sum of the square of the real and imaginary parts of y.
LuFactor
by itself.
It returns true if it succeeds and false otherwise.
The file lu_solve.hpp
provides a useful example usage of
LuFactor
with LuInvert
.