91 CISSTNETLIB_INTEGER
M;
92 CISSTNETLIB_INTEGER
N;
93 CISSTNETLIB_INTEGER
Lda;
116 L.Diagonal().SetAll(1.0);
122 template <
class _matrixOwnerType>
124 const unsigned int rows = A.rows();
125 const unsigned int cols = A.cols();
126 unsigned int rowIndex, colIndex;
127 for (rowIndex = 0; rowIndex <
rows; ++rowIndex) {
128 for (colIndex = 0; colIndex <
cols; ++colIndex) {
129 if (rowIndex > colIndex) {
130 L.Element(rowIndex, colIndex) = A[rowIndex][colIndex];
132 U.Element(rowIndex, colIndex) = A[rowIndex][colIndex];
142 P.Diagonal().SetAll(1.0);
143 CISSTNETLIB_INTEGER rowIndex, colIndex;
144 for (rowIndex = 0; rowIndex <
MinMN; ++rowIndex) {
145 colIndex =
Ipiv[rowIndex] - 1;
146 P.ExchangeColumns(rowIndex, colIndex);
177 bool allocateLU =
false,
178 bool allocateP =
false) {
197 bool allocateLU =
false,
bool allocateP =
false) {
201 template <vct::
size_type _rows, vct::
size_type _cols>
203 bool allocateLU =
false,
bool allocateP =
false) {
219 inline void Allocate(CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n,
220 bool allocateLU =
false,
bool allocateP =
false) {
221 const CISSTNETLIB_INTEGER one = 1;
224 Lda = std::max(one,
M);
249 bool allocateLU =
false,
bool allocateP =
false) {
250 Allocate(A.rows(), A.cols(), allocateLU, allocateP);
253 template <vct::
size_type _rows, vct::
size_type _cols>
255 bool allocateLU =
false,
bool allocateP =
false) {
256 Allocate(_rows, _cols, allocateLU, allocateP);
278 template <
class _matrixOwnerType>
281 if (! A.IsColMajor()) {
282 cmnThrow(std::runtime_error(
"nmrLUSolver Solve: The input must be column major"));
286 if ((
M !=
static_cast<CISSTNETLIB_INTEGER
>(A.rows())) || (
N !=
static_cast<CISSTNETLIB_INTEGER
>(A.cols()))) {
287 cmnThrow(std::runtime_error(
"nmrLUSolver Solve: Size used for Allocate was different"));
291 if (! A.IsCompact()) {
292 cmnThrow(std::runtime_error(
"nmrLUSolver Solve: Requires a compact matrix"));
305 template <vct::
size_type _rows, vct::
size_type _cols>
321 inline CISSTNETLIB_INTEGER
GetInfo(
void)
const {
328 cmnThrow(std::runtime_error(
"nmrLUSolver GetP: P was not calculated since allocateP is not set"));
336 cmnThrow(std::runtime_error(
"nmrLUSolver GetL: L was not calculated since allocateLU is not set"));
344 cmnThrow(std::runtime_error(
"nmrLUSolver GetU: U was not calculated since allocateLU is not set"));
351#ifdef CISST_COMPILER_IS_MSVC
Definition nmrLUSolver.h:85
vctDynamicMatrix< CISSTNETLIB_DOUBLE > U
Definition nmrLUSolver.h:99
nmrLUSolver(const vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, VCT_COL_MAJOR > &A, bool allocateLU=false, bool allocateP=false)
Definition nmrLUSolver.h:202
CISSTNETLIB_INTEGER Lda
Definition nmrLUSolver.h:93
void Solve(vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, VCT_COL_MAJOR > &A)
Definition nmrLUSolver.h:306
vctDynamicMatrix< CISSTNETLIB_DOUBLE > P
Definition nmrLUSolver.h:99
nmrLUSolver(CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n, bool allocateLU=false, bool allocateP=false)
Definition nmrLUSolver.h:176
bool AllocateLUFlag
Definition nmrLUSolver.h:98
void Allocate(CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n, bool allocateLU=false, bool allocateP=false)
Definition nmrLUSolver.h:219
nmrLUSolver(void)
Definition nmrLUSolver.h:156
const vctDynamicMatrix< CISSTNETLIB_DOUBLE > & GetP(void) const
Definition nmrLUSolver.h:326
void Allocate(const vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, VCT_COL_MAJOR > &A, bool allocateLU=false, bool allocateP=false)
Definition nmrLUSolver.h:254
void AllocateLU(void)
Definition nmrLUSolver.h:111
const vctDynamicMatrix< CISSTNETLIB_DOUBLE > & GetU(void) const
Definition nmrLUSolver.h:342
void UpdateP(void)
Definition nmrLUSolver.h:140
CISSTNETLIB_INTEGER Info
Definition nmrLUSolver.h:97
nmrLUSolver(const vctDynamicMatrix< CISSTNETLIB_DOUBLE > &A, bool allocateLU=false, bool allocateP=false)
Definition nmrLUSolver.h:196
CISSTNETLIB_INTEGER GetInfo(void) const
Definition nmrLUSolver.h:321
void Allocate(const vctDynamicMatrix< CISSTNETLIB_DOUBLE > &A, bool allocateLU=false, bool allocateP=false)
Definition nmrLUSolver.h:248
void AllocateP(void)
Definition nmrLUSolver.h:102
vctDynamicMatrix< CISSTNETLIB_DOUBLE > L
Definition nmrLUSolver.h:99
void Solve(vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A)
Definition nmrLUSolver.h:279
const vctDynamicVector< CISSTNETLIB_INTEGER > & GetIpiv(void) const
Definition nmrLUSolver.h:316
const vctDynamicMatrix< CISSTNETLIB_DOUBLE > & GetL(void) const
Definition nmrLUSolver.h:334
CISSTNETLIB_INTEGER MaxMN
Definition nmrLUSolver.h:94
CISSTNETLIB_INTEGER M
Definition nmrLUSolver.h:91
vctDynamicVector< CISSTNETLIB_INTEGER > Ipiv
Definition nmrLUSolver.h:96
void UpdateLU(const vctDynamicConstMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A)
Definition nmrLUSolver.h:123
CISSTNETLIB_INTEGER N
Definition nmrLUSolver.h:92
bool AllocatePFlag
Definition nmrLUSolver.h:98
CISSTNETLIB_INTEGER MinMN
Definition nmrLUSolver.h:94
Definition vctForwardDeclarations.h:145
Definition vctDynamicMatrixBase.h:43
Definition vctForwardDeclarations.h:157
Dynamic matrix referencing existing memory.
Definition vctDynamicMatrixRef.h:75
Definition vctForwardDeclarations.h:131
Implementation of a fixed-size matrix using template metaprogramming.
Definition vctFixedSizeMatrix.h:54
#define CISST_DEPRECATED
Definition cmnPortability.h:314
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition cmnThrow.h:76
size_type cols() const
Definition vctDynamicConstMatrixBase.h:243
size_type rows() const
Definition vctDynamicConstMatrixBase.h:238
Declaration of vctDynamicMatrix.
Declaration of vctDynamicVector.
Declaration of vctFixedSizeMatrix.
Declaration of vctFixedSizeVector.
const bool VCT_COL_MAJOR
Definition vctForwardDeclarations.h:44