det_by_lu

View page source

Determinant Using Expansion by Lu Factorization

Syntax

# include <cppad/speed/det_by_lu.hpp>
det_by_lu < Scalar > det ( n )
d = det ( a )

Inclusion

The template class det_by_lu is defined in the CppAD namespace by including the file cppad/speed/det_by_lu.hpp (relative to the CppAD distribution directory).

Constructor

The syntax

det_by_lu < Scalar > det ( n )

constructs the object det which can be used for evaluating the determinant of n by n matrices using LU factorization.

Scalar

The type Scalar can be any NumericType

n

The argument n has prototype

size_t n

det

The syntax

d = det ( a )

returns the determinant of the matrix \(A\) using LU factorization.

a

The argument a has prototype

const Vector & a

It must be a Vector with length \(n * n\) and with It must be a Vector with length \(n * n\) and with elements of type Scalar . The elements of the \(n \times n\) matrix \(A\) are defined, for \(i = 0 , \ldots , n-1\) and \(j = 0 , \ldots , n-1\), by

\[A_{i,j} = a[ i * m + j]\]

d

The return value d has prototype

Scalar d

Vector

If y is a Vector object, it must support the syntax

y [ i ]

where i has type size_t with value less than \(n * n\). This must return a Scalar value corresponding to the i-th element of the vector y . This is the only requirement of the type Vector .

Example

The file det_by_lu.cpp contains an example and test of det_by_lu.hpp .

Source Code

The file det_by_lu.hpp contains the source for this template function.