![]() |
Prev | Next |
Syntax
int LuVecAD(
size_t
n,
size_t
m,
VecAD<
double> &
Matrix,
VecAD<
double> &
Rhs,
VecAD<
double> &
Result,
AD<
double> &
logdet)
\[
Matrix * Result = Rhs
\]
where Matrix is an
n \times n
matrix,
Rhs is an
n x m
matrix, and
Result is an
n x m
matrix.
The routine LuSolve
uses an arbitrary vector type,
instead of VecAD
,
to hold its elements.
The pivoting operations for a ADFun
object
corresponding to an LuVecAD
solution
will change to be optimal for the matrix being factored.
It is often the case that
LuSolve
is faster than LuVecAD
when LuSolve
uses a simple vector class with
elements of type double
,
but the corresponding ADFun
objects have a fixed
set of pivoting operations.
A
contains the vector storage for an
n x m
matrix,
i
is between zero and
n-1
,
and
j
is between zero and
m-1
,
\[
A_{i,j} = A[ i * m + j ]
\]
(The length of
A
must be equal to
n * m
.)
n \times n
matrix containing the variable coefficients for
the equation we wish to solve.
On output, the elements of Matrix have been overwritten
and are not specified.
n \times m
matrix containing the right hand side
for the equation we wish to solve.
On output, the elements of Rhs have been overwritten
and are not specified.
If m is zero, Rhs is not used.
n \times m
matrix and the value of its elements do not matter.
On output, the elements of Rhs contain the solution
of the equation we wish to solve
(unless the value returned by LuVecAD
is equal to zero).
If m is zero, Result is not used.
LuVecAD
,
the determinant of Matrix is given by the formula
\[
det = signdet \exp( logdet )
\]
This enables LuVecAD
to use logs of absolute values.
LuVecAD
.
It returns true if it succeeds and false otherwise.