cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
nmrLSqLinSolutionDynamic Class Reference

#include <nmrLSqLin.h>

Classes

class  Friend
 

Public Member Functions

 nmrLSqLinSolutionDynamic ()
 
 nmrLSqLinSolutionDynamic (size_t ma, size_t n)
 
 nmrLSqLinSolutionDynamic (size_t ma, size_t mg, size_t n)
 
 nmrLSqLinSolutionDynamic (size_t ma, size_t me, size_t mg, size_t n)
 
template<typename _matrixOwnerTypeA >
 nmrLSqLinSolutionDynamic (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
 
template<typename _matrixOwnerTypeA , typename _vectorOwnerTypeWork >
 nmrLSqLinSolutionDynamic (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
 
template<typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork >
 nmrLSqLinSolutionDynamic (size_t ma, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
 
template<typename _vectorOwnerTypeX >
 nmrLSqLinSolutionDynamic (size_t ma, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
 
template<typename _matrixOwnerTypeA , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork >
 nmrLSqLinSolutionDynamic (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
 nmrLSqLinSolutionDynamic (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
 nmrLSqLinSolutionDynamic (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &inIWork)
 
template<typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
 nmrLSqLinSolutionDynamic (size_t ma, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &inIWork)
 
template<typename _vectorOwnerTypeX >
 nmrLSqLinSolutionDynamic (size_t ma, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
 nmrLSqLinSolutionDynamic (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &inIWork)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
 nmrLSqLinSolutionDynamic (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &E, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
 nmrLSqLinSolutionDynamic (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &E, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &inIWork)
 
template<typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
 nmrLSqLinSolutionDynamic (size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &inIWork)
 
template<typename _vectorOwnerTypeX >
 nmrLSqLinSolutionDynamic (size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
 nmrLSqLinSolutionDynamic (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &inIWork)
 
template<typename _matrixOwnerTypeA >
void Allocate (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
 
template<typename _matrixOwnerTypeA , typename _vectorOwnerTypeWork >
void Allocate (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
 
template<typename _matrixOwnerTypeA , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork >
void SetRef (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
 
template<typename _matrixOwnerTypeA , typename _vectorOwnerTypeX >
void SetRef (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
void Allocate (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void Allocate (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inIWork)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void SetRef (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inIWork)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX >
void SetRef (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
void Allocate (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &E, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void Allocate (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &E, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_DOUBLE > &inIWork)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void SetRef (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_DOUBLE > &inIWork)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX >
void SetRef (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
 
void Allocate (size_t ma, size_t me, size_t mg, size_t n)
 
template<typename _vectorOwnerTypeWork >
void Allocate (size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
 
template<typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void Allocate (size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inIWork)
 
template<typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork >
void SetRef (size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
 
template<typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void SetRef (size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_DOUBLE > &inIWork)
 
template<typename _vectorOwnerTypeX >
void SetRef (size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
 
const vctDynamicVectorRef
< CISSTNETLIB_DOUBLE > & 
GetX (void) const
 
const vctDynamicVectorRef
< CISSTNETLIB_DOUBLE > & 
GetRNorm (void) const
 
const vctDynamicVectorRef
< CISSTNETLIB_DOUBLE > & 
GetRNormE (void) const
 

Static Public Member Functions

static CISSTNETLIB_INTEGER GetWorkspaceSize (size_t ma, size_t me, size_t mg, size_t n)
 
static CISSTNETLIB_INTEGER GetIWorkspaceSize (size_t CMN_UNUSED(ma), size_t me, size_t mg, size_t n)
 
static CISSTNETLIB_INTEGER QueryWorkspaceSize_LS (size_t ma, size_t n)
 
template<typename _matrixOwnerTypeA >
static CISSTNETLIB_INTEGER GetWorkspaceSize (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
static CISSTNETLIB_INTEGER GetWorkspaceSize (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
static CISSTNETLIB_INTEGER GetIWorkspaceSize (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
static CISSTNETLIB_INTEGER GetWorkspaceSize (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
static CISSTNETLIB_INTEGER GetIWorkspaceSize (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG)
 
static void AllocateWorkspace (CISSTNETLIB_INTEGER ma, CISSTNETLIB_INTEGER me, CISSTNETLIB_INTEGER mg, CISSTNETLIB_INTEGER n, vctDynamicVector< CISSTNETLIB_DOUBLE > &inWork)
 
static void AllocateIWorkspace (CISSTNETLIB_INTEGER ma, CISSTNETLIB_INTEGER me, CISSTNETLIB_INTEGER mg, CISSTNETLIB_INTEGER n, vctDynamicVector< CISSTNETLIB_INTEGER > &inIWork)
 
template<typename _matrixOwnerTypeA >
static void AllocateWorkspace (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicVector< CISSTNETLIB_DOUBLE > &inWork)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
static void AllocateWorkspace (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVector< CISSTNETLIB_DOUBLE > &inWork)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
static void AllocateIWorkspace (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVector< CISSTNETLIB_INTEGER > &inIWork)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
static void AllocateWorkspace (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVector< CISSTNETLIB_DOUBLE > &inWork)
 
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
static void AllocateIWorkspace (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVector< CISSTNETLIB_INTEGER > &inIWork)
 

Protected Member Functions

void Malloc (size_t ma, size_t me, size_t mg, size_t n, bool allocateWorkspace, bool allocateInput, bool allocateOutput)
 
template<typename _vectorOwnerTypeWork , typename _matrixOwnerTypeI , typename _vectorOwnerTypeX >
void SetRef (size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &work, vctDynamicMatrixBase< _matrixOwnerTypeI, CISSTNETLIB_DOUBLE > &input, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &x)
 

Protected Attributes

vctDynamicVector
< CISSTNETLIB_DOUBLE > 
WorkspaceMemory
 
vctDynamicVector
< CISSTNETLIB_INTEGER > 
IWorkspaceMemory
 
vctDynamicVector
< CISSTNETLIB_DOUBLE > 
OutputMemory
 
vctDynamicVector
< CISSTNETLIB_DOUBLE > 
RNorm
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
InputMemory
 
vctDynamicMatrixRef
< CISSTNETLIB_DOUBLE > 
A
 
vctDynamicMatrixRef
< CISSTNETLIB_DOUBLE > 
E
 
vctDynamicMatrixRef
< CISSTNETLIB_DOUBLE > 
G
 
vctDynamicVectorRef
< CISSTNETLIB_DOUBLE > 
b
 
vctDynamicVectorRef
< CISSTNETLIB_DOUBLE > 
f
 
vctDynamicVectorRef
< CISSTNETLIB_DOUBLE > 
h
 
vctDynamicVectorRef
< CISSTNETLIB_DOUBLE > 
X
 
vctDynamicVectorRef
< CISSTNETLIB_DOUBLE > 
RNormL
 
vctDynamicVectorRef
< CISSTNETLIB_DOUBLE > 
RNormE
 
vctDynamicVectorRef
< CISSTNETLIB_DOUBLE > 
Work
 
vctDynamicVectorRef
< CISSTNETLIB_INTEGER > 
IWork
 
size_t m_Ma
 
size_t m_Me
 
size_t m_Mg
 
size_t m_N
 

Friends

class Friend
 

Detailed Description

Note
On exit, the contents of A and b are altered.

There are three ways to call this method to solve the least-squares problem Ax = b, possibly subject to constraints. LS: Solves Ax = b LSI: Solves Ax = b, subject to Gx >= h (inequality constraint) LSEI: Solves Ax = b, subject to Ex = f and Gx >= h (inequality and equality constraints) Following examples illustrate the LS solution.

METHOD 1: User provides input and output matrices/vectors 1) The User allocates memory for these matrices and vectors. vctDynamicMatrix<CISSTNETLIB_DOUBLE> A(5, 4, VCT_COL_MAJOR); vctDynamicVector<CISSTNETLIB_DOUBLE> b(5); vctDynamicVector<CISSTNETLIB_DOUBLE> x(4); 2) The user calls the LS routine nmrLSqLin(A, b, x); The LSqLin method verifies that the size of the solution object matches the input, and allocates workspace memory, which is deallocated when the function ends. The LSqLin function alters the contents of matrix A and vector b. For fixed size the function call is templated by size, e.g. nmrLSqLin<4, 3>(A, b, x);

METHOD 2: Using a preallocated solution object 1) The user creates the input matrix/vector vctDynamicMatrix<CISSTNETLIB_DOUBLE> A(rows, cols, VCT_COL_MAJOR); vctDynamicVector<CISSTNETLIB_DOUBLE> b(rows); 2) The user allocates a solution object which could be of type nmrLSqLinSolutionFixedSize, nmrLSqLinSolutionDynamic and nmrLSqLinSolutionDynamicRef corresponding to fixed size, dynamic matrix or dynamic matrix reference. nmrLSqLinSolutionDynamic solution(A); 3) Call the nmrLSqLin function nmrLSqLin(A, b, solution); The contents of the input matrix A and vector b are modified by this routine. The output vector is available through solution.GetX().

METHOD 3: User provides input and output matrices/vectors and workspace required by LAPACK routine. 1) User creates input and output matrices and vector vctDynamicMatrix<CISSTNETLIB_DOUBLE> A(5, 4, VCT_COL_MAJOR); vctDynamicVector<CISSTNETLIB_DOUBLE> b(5); vctDynamicVector<CISSTNETLIB_DOUBLE> x(4); 2) User also needs to allocate memory for the workspace. This method is particularly useful when the user is using more than one numerical method from the library and is willing to share the workspace between them. In such a case, the user can allocate memory greater than the maximum required by the different methods. To aid the user to determine the minimum workspace required (and not spend time digging into LAPACK documentation) the library provides helper function nmrLSqLinSolutionDynamic::GetWorkspaceSize(input) vctDynamicVector<CISSTNETLIB_DOUBLE> Work(nmrLSqLinSolutionDynamic::GetWorkspaceSize(A)); 3) Call the LS function nmrLSqLin(A, b, x, Work); or For fixed size the above two steps are replaced by nmrLSqLinSolutionFixedSize<5, 0, 0, 4>::TypeWork Work; nmrLSqLin<5, 4>(A, b, x, Work);

Note
The LSqLin functions make use of LAPACK routines. To activate this code, set the CISST_HAS_CISSTNETLIB flag to ON during the configuration with CMake.
The general rule for numerical functions which depend on LAPACK is that column-major matrices should be used everywhere, and that all matrices should be compact.

This is the class for the composite solution container of LSqLin.

Constructor & Destructor Documentation

nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( )
inline

The default constuctor. For dynamic size, there are assigned default values, which MUST be changed by calling appropriate methods. (See nmrLSqLinSolutionDynamic::Allocate and nmrLSqLinSolutionDynamic::SetRef)

nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( size_t  ma,
size_t  n 
)
inline

constructor to use with LS

nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( size_t  ma,
size_t  mg,
size_t  n 
)
inline

constructor to use with LSI

nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n 
)
inline

constructor to use with LSEI

template<typename _matrixOwnerTypeA >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A)
inline

Constructor where user provides the input matrix to specify size. Memory allocation is done for output vector as well as for the Workspace used by LAPACK. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections.

Parameters
Ainput matrix
template<typename _matrixOwnerTypeA , typename _vectorOwnerTypeWork >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork 
)
inline

Constructor where user provides the input matrix to specify size. Memory allocation is done for the workspace, inWork. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using more than one numerical method in the same thread, allowing him/her to share the workspace for LAPACK.

Parameters
Ainput matrix inWork workspace for LS
template<typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( size_t  ma,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork 
)
inline

Constructor where user provides the size of the input matrix, along with the output vector X and workspace. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSqLin algorithm. Checks are made on the validity of the input and its consistency with the size of the input matrix.

Parameters
ma,nThe size of input matrix
inXThe output vector for LSqLin
inWorkThe workspace for LAPACK.
template<typename _vectorOwnerTypeX >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( size_t  ma,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX 
)
inline

Constructor where user provides the size of the input matrix, along with vector X. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LS algorithm. Checks are made on the validity of the input and its consistency with the size of input matrix. Memory allocation for the workspace is done by the method. This case covers the scenario where user wants to make all system calls for memory allocation before entering time critical code sections and might be using the LS matrix elsewhere in the same thread.

Parameters
ma,nThe size of input matrix
inXThe output vector for LSqLin
template<typename _matrixOwnerTypeA , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork 
)
inline

Constructor where user provides the input matrix to specify size, along with vector X and workspace. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LS algorithm. Checks are made on the validity of the input and its consistency with the size of input matrix.

Parameters
inAThe input matrix
inXThe output vector for LSqLin
inWorkThe workspace for LAPACK.
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  G 
)
inline

Constructor where user provides the input matrices to specify size. Memory allocation is done for the output vector as well as for the Workspace used by LAPACK. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections.

Parameters
A,Ginput matrices
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  G,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &  inIWork 
)
inline

Constructor where user provides the input matrices to specify size and the workspaces. Memory allocation is done for the output vectors. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using more than one numerical method in the same thread, allowing him/her to share the workspace for LAPACK.

Parameters
A,Ginput matrices inWork, inIWork workspace for LSI
template<typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( size_t  ma,
size_t  mg,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &  inIWork 
)
inline

Constructor where user provides the size of the input matrices along with output X and workspaces. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSqLin algorithm. Checks are made on the validity of the input and its consistency with the size of the input matrices.

Parameters
ma,mg,nThe size of input matrices
inXThe output vector for LSqLin inWork, inIWork workspace for LSI
template<typename _vectorOwnerTypeX >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( size_t  ma,
size_t  mg,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX 
)
inline

Constructor where user provides the size and storage order of the input matrices, along with vector X. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSI algorithm. Checks are made on the validity of the input and its consistency with the size of input matrices. Memory allocation for the workspace is done by the method. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using the LSI matrix elsewhere in the same thread.

Parameters
ma,mg,nThe size of input matrices
inXThe output vector for LSqLin
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &  inIWork 
)
inline

Constructor where user provides the input matrices to specify size, along with vector X. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSI algorithm. Checks are made on the validity of the input and its consistency with the size of the input matrix.

Parameters
inA,inGThe input matrices
inXThe output vector for LSqLin inWork, inIWork workspace for LSI
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  E,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  G 
)
inline

Constructor where user provides the input matrices to specify size. Memory allocation is done for the output vector as well as the Workspace used by LAPACK. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections.

Parameters
A,E,Ginput matrices
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  E,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  G,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &  inIWork 
)
inline

Constructor where user provides the input matrices to specify size and the workspaces. Memory allocation is done for the output vector. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using more than one numerical method in the same thread, allowing him/her to share the workspace for LAPACK.

Parameters
A,E,Ginput matrices inWork, inIWork workspace for LSI
template<typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &  inIWork 
)
inline

Constructor where user provides the size of the input matrices, the output vector X, and the workspaces. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSqLin algorithm. Checks are made on the validity of the input and its consistency with the sizes of the input matrices.

Parameters
ma,me,mg,nThe sizes of input matrices
inXThe output vector for LSqLin inWork, inIWork workspace for LSI
template<typename _vectorOwnerTypeX >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX 
)
inline

Constructor where user provides the size of the input matrices, along with vector X. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSEI algorithm. Checks are made on the validity of the input and its consistency with the size of input matrices. Memory allocation for the workspace is done by the method. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using the LSEI matrix elsewhere in the same thread.

Parameters
ma,me,mg,nThe size of input matrices
inXThe output vector for LSqLin
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
nmrLSqLinSolutionDynamic::nmrLSqLinSolutionDynamic ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  inE,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &  inIWork 
)
inline

Constructor where user provides the input matrices to specify size, along with vector X and the workspaces The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSEI algorithm. Checks are made on the validity of the input and its consistency with the sizes of input matrices.

Parameters
inA,inE,inGThe input matrices
inXThe output vector for LSqLin inWork, inIWork workspace for LSI

Member Function Documentation

template<typename _matrixOwnerTypeA >
void nmrLSqLinSolutionDynamic::Allocate ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A)
inline

This method allocates memory of the output vector as well as the workspace. This method should be called before the nmrLSqLinSolutionDynamic object is passed to the nmrLSqLin function, as the memory required for the output matrices and workspace are allocated here or to reallocate memory previously allocated by the constructor. Typically, this method is called from a code segment where it is safe to allocate memory and use the solution and workspace later.

Parameters
AThe matrix for which LS needs to be computed, size MxN
template<typename _matrixOwnerTypeA , typename _vectorOwnerTypeWork >
void nmrLSqLinSolutionDynamic::Allocate ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork 
)
inline

This method allocates memory of the output vector and uses the memory provided by the user for the workspace. Check is made to ensure that memory provided by user is sufficient for LS routine of LAPACK. This method should be called before the nmrLSqLinSolutionDynamic object is passed on to the nmrLSqLin function, as the memory required for the output vector and workspace are allocated here or to reallocate memory previously allocated by the constructor. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using more than one numerical method in the same thread, allowing him/her to share the workspace for LAPACK. Typically this method is called from a code segment where it is safe to allocate memory and use the solution and workspace later.

Parameters
AThe matrix for which LS needs to be computed, size MxN
inWorkThe vector used for workspace by LS.
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
void nmrLSqLinSolutionDynamic::Allocate ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  G 
)
inline

This method allocates memory of the output vector as well as the workspace. This method should be called before the nmrLSqLinSolutionDynamic object is passed to the nmrLSqLin function, as the memory required for the output vector and workspace are allocated here or to reallocate memory previously allocated by the constructor. Typically, this method is called from a code segment where it is safe to allocate memory and use the solution and workspace later.

Parameters
AThe matrix for which LSI needs to be computed, size Ma x N
GThe constraints matrix for LSI, size Mg x N
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void nmrLSqLinSolutionDynamic::Allocate ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  G,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inIWork 
)
inline

This method allocates memory of the output vector and uses the memory provided by the user for the workspace. Check is made to ensure that memory provided by user is sufficient for LSI routine of LAPACK. This method should be called before the nmrLSqLinSolutionDynamic object is passed to the nmrLSqLin function, as the memory required for the output vector and workspace are allocated here or to reallocate memory previously allocated by the constructor. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using more than one numerical method in the same thread, allowing him/her to share the workspace for LAPACK. Typically this method is called from a code segment where it is safe to allocate memory and use the solution and workspace later.

Parameters
AThe matrix for which LSI needs to be computed, size Ma x N
GThe constraints matrix for LSI, size Mg x N
inWork,inIWorkThe workspace for LSI.
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
void nmrLSqLinSolutionDynamic::Allocate ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  E,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  G 
)
inline

This method allocates memory of output vector as well as the workspace. This method should be called before the nmrLSqLinSolutionDynamic object is passed to the nmrLSqLin function, as the memory required for the output vector and workspace are allocated here or to reallocate memory previously allocated by the constructor. Typically, this method is called from a code segment where it is safe to allocate memory and use the solution and workspace later.

Parameters
AThe matrix for which LSEI needs to be computed, size MxN
EThe equality constraints matrix for LSEI, size Me x N
GThe inequality constraints matrix for LSEI, size Mg x N
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void nmrLSqLinSolutionDynamic::Allocate ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  E,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  G,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_DOUBLE > &  inIWork 
)
inline

This method allocates memory of output vector and uses the memory provided by user for workspace. Check is made to ensure that memory provided by user is sufficient for LSEI routine of LAPACK. This method should be called before the nmrLSqLinSolutionDynamic object is passed to the nmrLSqLin function, as the memory required for the output vector and workspace are allocated here or to reallocate memory previously allocated by the constructor. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using more than one numerical method in the same thread, allowing him/her to share the workspace for LAPACK. Typically this method is called from a code segment where it is safe to allocate memory and use the solution and workspace later.

Parameters
AThe matrix for which LSEI needs to be computed, size MxN
EThe equality constraints matrix for LSEI, size Me x N
GThe inequality constraints matrix for LSEI, size Mg x N
inWork,inIWorkThe vector used for workspace by LSEI.
void nmrLSqLinSolutionDynamic::Allocate ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n 
)
inline

This method allocates memory of the output vector and optionally for the workspace required by LS/LSI/LSEI. This method is not meant to be a top-level user API, but is used by other overloaded Allocate methods.

Parameters
maNumber of rows of input matrix A (objective)
meNumber of rows of input matrix E (equality constraints)
mgNumber of rows of input matrix G (inequality constraints)
nNumber of cols of input matrix A
template<typename _vectorOwnerTypeWork >
void nmrLSqLinSolutionDynamic::Allocate ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork 
)
inline

This method allocates memory of the output vector and optionally for the workspace required by LS/LSI/LSEI. This method is not meant to be a top-level user API, but is used by other overloaded Allocate methods.

Parameters
maNumber of rows of input matrix A (objective)
meNumber of rows of input matrix E (equality constraints)
mgNumber of rows of input matrix G (inequality constraints)
nNumber of cols of input matrix A
inWorkWorkspace provided by user
template<typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void nmrLSqLinSolutionDynamic::Allocate ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inIWork 
)
inline

This method allocates memory of the output vector and optionally for the workspace required by LS/LSI/LSEI. This method is not meant to be a top-level user API, but is used by other overloaded Allocate methods.

Parameters
maNumber of rows of input matrix A (objective)
meNumber of rows of input matrix E (equality constraints)
mgNumber of rows of input matrix G (inequality constraints)
nNumber of cols of input matrix A
inWork,inIWorkWorkspace provided by user
static void nmrLSqLinSolutionDynamic::AllocateIWorkspace ( CISSTNETLIB_INTEGER  ma,
CISSTNETLIB_INTEGER  me,
CISSTNETLIB_INTEGER  mg,
CISSTNETLIB_INTEGER  n,
vctDynamicVector< CISSTNETLIB_INTEGER > &  inIWork 
)
inlinestatic
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
static void nmrLSqLinSolutionDynamic::AllocateIWorkspace ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG,
vctDynamicVector< CISSTNETLIB_INTEGER > &  inIWork 
)
inlinestatic
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
static void nmrLSqLinSolutionDynamic::AllocateIWorkspace ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  inE,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG,
vctDynamicVector< CISSTNETLIB_INTEGER > &  inIWork 
)
inlinestatic
static void nmrLSqLinSolutionDynamic::AllocateWorkspace ( CISSTNETLIB_INTEGER  ma,
CISSTNETLIB_INTEGER  me,
CISSTNETLIB_INTEGER  mg,
CISSTNETLIB_INTEGER  n,
vctDynamicVector< CISSTNETLIB_DOUBLE > &  inWork 
)
inlinestatic

Helper methods for user to set min working space required by LAPACK LS/LSI/LSEI routine.

Parameters
ma,me,mg,nThe size of matrix whose LS/LSI/LSEI needs to be computed
inWorkA vector that would be resized to meet the requirements of LAPACK LS/LSI/LSEI routine.
template<typename _matrixOwnerTypeA >
static void nmrLSqLinSolutionDynamic::AllocateWorkspace ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicVector< CISSTNETLIB_DOUBLE > &  inWork 
)
inlinestatic

Helper methods for user to set min working space required by LAPACK LS routine.

Parameters
inAThe matrix whose LS needs to be computed
inWorkA vector that would be resized to meet the requirements of LAPACK LS routine.
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
static void nmrLSqLinSolutionDynamic::AllocateWorkspace ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG,
vctDynamicVector< CISSTNETLIB_DOUBLE > &  inWork 
)
inlinestatic

Helper methods for user to set min working space required by LAPACK LSI routine.

Parameters
inA,inGThe input matrices for LSI.
inWorkA vector that would be resized to meet the requirements of LAPACK LSI routine.
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
static void nmrLSqLinSolutionDynamic::AllocateWorkspace ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  inE,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG,
vctDynamicVector< CISSTNETLIB_DOUBLE > &  inWork 
)
inlinestatic

Helper methods for user to set min working space required by LAPACK LSEI routine.

Parameters
inA,inE,inGThe input matrices for LSEI.
inWorkA vector that would be resized to meet the requirements of LAPACK LSEI routine.
static CISSTNETLIB_INTEGER nmrLSqLinSolutionDynamic::GetIWorkspaceSize ( size_t   CMN_UNUSEDma,
size_t  me,
size_t  mg,
size_t  n 
)
inlinestatic
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
static CISSTNETLIB_INTEGER nmrLSqLinSolutionDynamic::GetIWorkspaceSize ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG 
)
inlinestatic
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
static CISSTNETLIB_INTEGER nmrLSqLinSolutionDynamic::GetIWorkspaceSize ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  inE,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG 
)
inlinestatic
const vctDynamicVectorRef<CISSTNETLIB_DOUBLE>& nmrLSqLinSolutionDynamic::GetRNorm ( void  ) const
inline
const vctDynamicVectorRef<CISSTNETLIB_DOUBLE>& nmrLSqLinSolutionDynamic::GetRNormE ( void  ) const
inline
static CISSTNETLIB_INTEGER nmrLSqLinSolutionDynamic::GetWorkspaceSize ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n 
)
inlinestatic

Helper methods for user to set min working space required by LAPACK LS routine.

Parameters
ma,me,mg,nThe size of matrix whose LS/LSI/LSEI needs to be computed
template<typename _matrixOwnerTypeA >
static CISSTNETLIB_INTEGER nmrLSqLinSolutionDynamic::GetWorkspaceSize ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA)
inlinestatic

Helper method to determine the min working space required by LAPACK LS (dgels) routine.

Parameters
inAThe matrix whose LS needs to be computed
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG >
static CISSTNETLIB_INTEGER nmrLSqLinSolutionDynamic::GetWorkspaceSize ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG 
)
inlinestatic

Helper method to determine the min working space required by LAPACK LSI routine.

Parameters
inA,inGThe input matrices for LSI.
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG >
static CISSTNETLIB_INTEGER nmrLSqLinSolutionDynamic::GetWorkspaceSize ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  inE,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG 
)
inlinestatic

Helper method to determine the min working space required by LAPACK LSEI routine.

Parameters
inA,inE,inGThe input matrices for LSEI.
const vctDynamicVectorRef<CISSTNETLIB_DOUBLE>& nmrLSqLinSolutionDynamic::GetX ( void  ) const
inline

In order to get access to X, after it has been computed by calling the nmrLSqLin function, use the following methods.

void nmrLSqLinSolutionDynamic::Malloc ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n,
bool  allocateWorkspace,
bool  allocateInput,
bool  allocateOutput 
)
inlineprotected

This method allocates memory of the output vector and optionally for the workspace required by LS/LSI/LSEI. This method is not meant to be a top-level user API, but is used by other overloaded Allocate methods.

Parameters
maNumber of rows of input matrix A (objective)
meNumber of rows of input matrix E (equality constraints)
mgNumber of rows of input matrix G (inequality constraints)
nNumber of cols of input matrix A
allocateWorkspaceIf true, allocate memory of workspace as well.
allocateInputIf true, allocate memory of input as well.
allocateOutputIf true, allocate memory of output as well.
static CISSTNETLIB_INTEGER nmrLSqLinSolutionDynamic::QueryWorkspaceSize_LS ( size_t  ma,
size_t  n 
)
inlinestatic

Method to query LAPACK routine for optimal workspace size. So far, only implemented for LS (dgels). Not needed because result is same as GetWorkspaceSize() above.

<

Todo:
can we assume nhrs=1?
template<typename _matrixOwnerTypeA , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork >
void nmrLSqLinSolutionDynamic::SetRef ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork 
)
inline

This method must be called before the solution object is passed to the nmrLSqLin function. The user provides the input matrix to specify size, along with vector X and workspace. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSqLin algorithm. Checks are made on the validity of the input and its consistency with the size of the input matrix.

Parameters
inAThe input matrix
inXThe output vector for LSqLin
inWorkThe workspace for LS.
template<typename _matrixOwnerTypeA , typename _vectorOwnerTypeX >
void nmrLSqLinSolutionDynamic::SetRef ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX 
)
inline

This method must be called before the solution object is passed to the nmrLSqLin function. The user provides the input matrix to specify size, along with vector X. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSqLin algorithm. Checks are made on the validity of the input and its consistency with the size of the input matrix. Memory allocation for the workspace is done by the method. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using the LS matrix elsewhere in the same thread.

Parameters
inAThe input matrix
inXThe output matrix for LSqLin
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void nmrLSqLinSolutionDynamic::SetRef ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inIWork 
)
inline

This method must be called before the solution object is passed to the nmrLSqLin function. The user provides the input matrices to specify size, along with vector X and workspace. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSqLin algorithm. Checks are made on the validity of the input and its consistency with the size of input matrices.

Parameters
inA,inGThe input matrices
inXThe output vector for LSqLin
inWork,inIWorkThe workspace for LSI.
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX >
void nmrLSqLinSolutionDynamic::SetRef ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX 
)
inline

This method must be called before the solution object is passed to the nmrLSqLin function. The user provides the input matrices to specify size, along with vector X. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSqLin algorithm. Checks are made on the validity of the input and its consistency with the size of the input matrices. Memory allocation for the workspace is done by the method. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using the LS matrix elsewhere in the same thread.

Parameters
inA,inGThe input matrices
inXThe output matrix for LSqLin
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void nmrLSqLinSolutionDynamic::SetRef ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  inE,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_DOUBLE > &  inIWork 
)
inline

This method must be called before the solution object is passed to the nmrLSqLin function. The user provides the input matrices to specify size, along with vector X and workspace. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSqLin algorithm. Checks are made on the validity of the input and its consistency with the size of the input matrices.

Parameters
inA,inE,inGThe input matrices
inXThe output vector for LSqLin
inWork,inIWorkThe workspace for LSI.
template<typename _matrixOwnerTypeA , typename _matrixOwnerTypeE , typename _matrixOwnerTypeG , typename _vectorOwnerTypeX >
void nmrLSqLinSolutionDynamic::SetRef ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  inA,
vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &  inE,
vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &  inG,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX 
)
inline

This method must be called before the solution object is passed to the nmrLSqLin function. The user provides the input matrices to specify size, along with vector X. The solution object now acts as a composite container to hold, pass and manipulate a convenient storage for the LSqLin algorithm. Checks are made on the validity of the input and its consistency with the sizes of the input matrices. Memory allocation for the workspace is done by the method. This case covers the scenario where the user wants to make all system calls for memory allocation before entering time critical code sections and might be using the LSEI matrix elsewhere in the same thread.

Parameters
inA,inE,inGThe input matrices
inXThe output matrix for LSqLin
template<typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork >
void nmrLSqLinSolutionDynamic::SetRef ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork 
)
inline

This method sets memory references of the output vector and for the workspace required by LS/LSI/LSEI. This method is not meant to be a top-level user API, but is used by other overloaded SetRef methods.

Parameters
ma,me,mgNumber of rows of input matrix A, E and G respectively
nNumber of cols of input matrix A
inXThe output matrix for LSqLin
inWorkThe workspace for LS.
template<typename _vectorOwnerTypeX , typename _vectorOwnerTypeWork , typename _vectorOwnerTypeIWork >
void nmrLSqLinSolutionDynamic::SetRef ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  inWork,
vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_DOUBLE > &  inIWork 
)
inline

This method sets memory references of the output vector and for the workspace required by LS/LSI/LSEI. This method is not meant to be a top-level user API, but is used by other overloaded SetRef methods.

Parameters
ma,me,mgNumber of rows of input matrix A, E and G respectively
nNumber of cols of input matrix A
inXThe output matrix for LSqLin
inWork/inIWorkThe workspace for LSI/LSEI.
template<typename _vectorOwnerTypeX >
void nmrLSqLinSolutionDynamic::SetRef ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  inX 
)
inline

This method sets memory references of the output vector and for the workspace required by LS/LSI/LSEI. This method is not meant to be a top-level user API, but is used by other overloaded SetRef methods.

Parameters
ma,me,mgNumber of rows of input matrix A, E and G respectively
nNumber of cols of input matrix A
inXThe output matrix for LSqLin
template<typename _vectorOwnerTypeWork , typename _matrixOwnerTypeI , typename _vectorOwnerTypeX >
void nmrLSqLinSolutionDynamic::SetRef ( size_t  ma,
size_t  me,
size_t  mg,
size_t  n,
vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &  work,
vctDynamicMatrixBase< _matrixOwnerTypeI, CISSTNETLIB_DOUBLE > &  input,
vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &  x 
)
inlineprotected

Friends And Related Function Documentation

friend class Friend
friend

Member Data Documentation

vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::A
protected

References to work or return or input types, these point either to user allocated memory or our memory chunks if needed

vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::b
protected
vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::E
protected
vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::f
protected
vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::G
protected
vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::h
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::InputMemory
protected

Memory allocated for input if needed The LSEI (constrained least squares) requires that the input matrices be in one continuous memory block ordered according to fortran order (Column Major format), such that first Mc rows and N columns represent A, Ma rows and N+1 th column represent b, next Me rows represent (E, f) and last Mg rows represent (G, h) where the original LSEI problem is arg min || A x - b ||, s.t. E x = f and G x >= h. The input for LSI is similar other than Me == 0.

vctDynamicVectorRef<CISSTNETLIB_INTEGER> nmrLSqLinSolutionDynamic::IWork
protected
vctDynamicVector<CISSTNETLIB_INTEGER> nmrLSqLinSolutionDynamic::IWorkspaceMemory
protected
size_t nmrLSqLinSolutionDynamic::m_Ma
protected
size_t nmrLSqLinSolutionDynamic::m_Me
protected
size_t nmrLSqLinSolutionDynamic::m_Mg
protected
size_t nmrLSqLinSolutionDynamic::m_N
protected
vctDynamicVector<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::OutputMemory
protected

Memory allocated for output X if needed.

vctDynamicVector<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::RNorm
protected
vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::RNormE
protected
vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::RNormL
protected
vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::Work
protected
vctDynamicVector<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::WorkspaceMemory
protected

Memory allocated for Workspace matrices if needed

vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrLSqLinSolutionDynamic::X
protected

The documentation for this class was generated from the following file: