Prev | Next |
Syntax
int lu_vec_ad(
size_t n,
size_t m,
VecAD<double> &Matrix,
VecAD<double> &Rhs,
VecAD<double> &Result,
AD<double> &logdet)
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 lu_vec_ad
solution
will change to be optimal for the matrix being factored.
It is often the case that
LuSolve
is faster than lu_vec_ad
when LuSolve
uses a simple vector class with
elements of type double
,
but the corresponding ADFun
objects have a fixed
set of pivoting operations.
Matrix
,
Rhs
,
and
Result
.
Rhs
and
Result
.
It is ok for
m
to be zero which is reasonable when
you are only interested in the determinant of
Matrix
.
Matrix
have been overwritten
and are not specified.
Rhs
have been overwritten
and are not specified.
If
m
is zero,
Rhs
is not used.
Rhs
contain the solution
of the equation we wish to solve
(unless the value returned by lu_vec_ad
is equal to zero).
If
m
is zero,
Result
is not used.
logdet
does not matter.
On output, it has been set to the
log of the determinant of
Matrix
(but not quite).
To be more specific,
if
signdet
is the value returned by lu_vec_ad
,
the determinant of
Matrix
is given by the formula
@[@
det = signdet \exp( logdet )
@]@
This enables lu_vec_ad
to use logs of absolute values.
lu_vec_ad
.