173 static inline CISSTNETLIB_INTEGER
GetWorkspaceSize(
size_t ma,
size_t me,
size_t mg,
size_t n)
175 CISSTNETLIB_INTEGER lwork;
176 if ((me == 0) && (mg ==0)) {
178 CISSTNETLIB_INTEGER minmn =
static_cast<CISSTNETLIB_INTEGER
>(std::max(std::min(ma,n),
static_cast<size_t>(1)));
180 }
else if (me == 0) {
181 size_t k = std::max(ma+mg,n);
182 lwork =
static_cast<CISSTNETLIB_INTEGER
>(k+n+(mg+2)*(n+7));
184 size_t k = std::max(ma+mg,n);
185 lwork =
static_cast<CISSTNETLIB_INTEGER
>(2*(me+n)+k+(mg+2)*(n+7));
192 if ((me == 0) && (mg ==0)) {
194 }
else if (me == 0) {
195 return static_cast<CISSTNETLIB_INTEGER
>(mg+2*n+1);
197 return static_cast<CISSTNETLIB_INTEGER
>(mg+2*n+2);
209 CISSTNETLIB_INTEGER Mrows =
static_cast<CISSTNETLIB_INTEGER
>(ma);
210 CISSTNETLIB_INTEGER Ncols =
static_cast<CISSTNETLIB_INTEGER
>(n);
211 CISSTNETLIB_INTEGER nrhs = 1;
212 CISSTNETLIB_INTEGER lda =
static_cast<CISSTNETLIB_INTEGER
>(std::max(ma,
static_cast<size_t>(1)));
213 CISSTNETLIB_INTEGER ldb =
static_cast<CISSTNETLIB_INTEGER
>(std::max(std::max(
static_cast<size_t>(1),ma),n));
214 CISSTNETLIB_INTEGER lwork = -1;
215 CISSTNETLIB_INTEGER info;
216 CISSTNETLIB_DOUBLE work;
218#if defined(CISSTNETLIB_VERSION_MAJOR)
219#if (CISSTNETLIB_VERSION_MAJOR >= 3)
220 cisstNetlib_dgels_(&trans, &Mrows, &Ncols, &nrhs,
223 &work, &lwork, &info);
226 dgels_(&trans, &Mrows, &Ncols, &nrhs,
229 &work, &lwork, &info);
233 return static_cast<CISSTNETLIB_INTEGER
>(work);
239 template <
typename _matrixOwnerTypeA>
247 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG>
253 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG>
262 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
typename _matrixOwnerTypeG>
269 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
typename _matrixOwnerTypeG>
295 template <
typename _matrixOwnerTypeA>
305 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG>
312 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG>
324 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
typename _matrixOwnerTypeG>
332 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
typename _matrixOwnerTypeG>
381 return solution.RNorm;
384 return solution.InputMemory;
387 return solution.Work;
390 return solution.IWork;
392 inline CISSTNETLIB_INTEGER
GetMa(
void) {
393 return static_cast<CISSTNETLIB_INTEGER
>(solution.m_Ma);
395 inline CISSTNETLIB_INTEGER
GetMe(
void) {
396 return static_cast<CISSTNETLIB_INTEGER
>(solution.m_Me);
398 inline CISSTNETLIB_INTEGER
GetMg(
void) {
399 return static_cast<CISSTNETLIB_INTEGER
>(solution.m_Mg);
401 inline CISSTNETLIB_INTEGER
GetN(
void) {
402 return static_cast<CISSTNETLIB_INTEGER
>(solution.m_N);
446 template <
typename _matrixOwnerTypeA>
460 template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeWork>
464 this->
Allocate(
A.rows(), 0, 0,
A.cols(), inWork);
475 template <
typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork>
480 this->
SetRef(ma, 0, 0, n, inX, inWork);
494 template <
typename _vectorOwnerTypeX>
498 this->
SetRef(ma, 0, 0, n, inX);
509 template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork>
514 this->
SetRef(inA.rows(), 0, 0, inA.cols(), inX, inWork);
528 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG>
543 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG,
544 typename _vectorOwnerTypeWork,
typename _vectorOwnerTypeIWork>
550 this->
Allocate(
A.rows(), 0,
G.rows(),
A.cols(), inWork, inIWork);
561 template <
typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork,
typename _vectorOwnerTypeIWork>
567 this->
SetRef(ma, 0, mg, n, inX, inWork, inIWork);
581 template <
typename _vectorOwnerTypeX>
585 this->
SetRef(ma, 0, mg, n, inX);
596 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG,
597 typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork,
598 typename _vectorOwnerTypeIWork>
605 this->
SetRef(inA.rows(), 0, inG.rows(), inA.cols(), inX, inWork, inIWork);
619 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
typename _matrixOwnerTypeG>
636 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
637 typename _matrixOwnerTypeG,
typename _vectorOwnerTypeWork,
638 typename _vectorOwnerTypeIWork>
645 this->
Allocate(
A.rows(),
E.rows(),
G.rows(),
A.cols(), inWork, inIWork);
656 template <
typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork,
typename _vectorOwnerTypeIWork>
662 this->
SetRef(ma, me, mg, n, inX, inWork, inIWork);
676 template <
typename _vectorOwnerTypeX>
680 this->
SetRef(ma, me, mg, n, inX);
691 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
692 typename _matrixOwnerTypeG,
typename _vectorOwnerTypeX,
693 typename _vectorOwnerTypeWork,
typename _vectorOwnerTypeIWork>
701 this->
SetRef(inA.rows(), inE.rows(), inG.rows(), inA.cols(), inX, inWork, inIWork);
719 template <
typename _matrixOwnerTypeA>
742 template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeWork>
746 this->
Allocate(
A.rows(), 0, 0,
A.cols(), inWork);
764 template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork>
769 this->
SetRef(inA.rows(), 0, 0, inA.cols(), inX, inWork);
785 template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeX>
789 this->
SetRef(inA.rows(), 0, 0, inA.cols(), inX, this->WorkspaceMemory);
808 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG>
833 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG,
834 typename _vectorOwnerTypeWork,
typename _vectorOwnerTypeIWork>
840 this->
Allocate(
A.rows(), 0,
G.rows(),
A.cols(), inWork, inIWork);
858 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG,
859 typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork,
860 typename _vectorOwnerTypeIWork>
867 this->
SetRef(inA.rows(), 0, inG.rows(), inA.cols(), inX, inWork, inIWork);
883 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeG,
typename _vectorOwnerTypeX>
888 this->
SetRef(inA.rows(), 0, inG.rows(), inA.cols(), inX);
908 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
typename _matrixOwnerTypeG>
935 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
936 typename _matrixOwnerTypeG,
typename _vectorOwnerTypeWork,
typename _vectorOwnerTypeIWork>
943 this->
Allocate(
A.rows(),
E.rows(),
G.rows(),
A.cols(), inWork, inIWork);
961 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
typename _matrixOwnerTypeG,
962 typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork,
963 typename _vectorOwnerTypeIWork>
971 this->
SetRef(inA.rows(), inE.rows(), inG.rows(), inA.cols(), inX, inWork, inIWork);
987 template <
typename _matrixOwnerTypeA,
typename _matrixOwnerTypeE,
988 typename _matrixOwnerTypeG,
typename _vectorOwnerTypeX>
994 this->
SetRef(inA.rows(), inE.rows(), inG.rows(), inA.cols(), inX, this->WorkspaceMemory);
1010 inline void Allocate(
size_t ma,
size_t me,
size_t mg,
size_t n)
1012 this->
Malloc(ma, me, mg, n,
true,
true,
true);
1013 this->
SetRef(ma, me, mg, n, this->WorkspaceMemory, this->InputMemory, this->OutputMemory);
1014 (this->IWork).
SetRef((this->IWorkspaceMemory));
1026 template <
typename _vectorOwnerTypeWork>
1027 inline void Allocate(
size_t ma,
size_t me,
size_t mg,
size_t n,
1031 if (lwork >
static_cast<CISSTNETLIB_INTEGER
>(inWork.size())) {
1032 cmnThrow(std::runtime_error(
"nmrLSqLin: Incorrect size for Work"));
1034 this->
Malloc(ma, me, mg, n,
false,
true,
true);
1035 this->
SetRef(ma, me, mg, n, inWork, this->InputMemory, this->OutputMemory);
1047 template <
typename _vectorOwnerTypeWork,
typename _vectorOwnerTypeIWork>
1048 inline void Allocate(
size_t ma,
size_t me,
size_t mg,
size_t n,
1053 if (lwork >
static_cast<CISSTNETLIB_INTEGER
>(inWork.size())) {
1054 cmnThrow(std::runtime_error(
"nmrLSqLin: Incorrect size for Work"));
1057 if (liwork >
static_cast<CISSTNETLIB_INTEGER
>(inIWork.size())) {
1058 cmnThrow(std::runtime_error(
"nmrLSqLin: Incorrect size for IWork"));
1060 this->
Malloc(ma, me, mg, n,
false,
true,
true);
1061 this->
SetRef(ma, me, mg, n, inWork, this->InputMemory, this->OutputMemory);
1062 (this->IWork).
SetRef(inIWork);
1078 template <
typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork>
1079 void SetRef(
size_t ma,
size_t me,
size_t mg,
size_t n,
1083 if (lwork >
static_cast<CISSTNETLIB_INTEGER
>(inWork.size())) {
1084 cmnThrow(std::runtime_error(
"nmrLSqLin: Incorrect size for Work"));
1086 if (n >
static_cast<CISSTNETLIB_INTEGER
>(inX.size())) {
1087 cmnThrow(std::runtime_error(
"nmrLSqLin: Incorrect size for X"));
1089 this->
Malloc(ma, me, mg, n,
false,
true,
false);
1090 this->
SetRef(ma, me, mg, n, inWork, this->InputMemory, inX);
1101 template <
typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork,
typename _vectorOwnerTypeIWork>
1102 void SetRef(
size_t ma,
size_t me,
size_t mg,
size_t n,
1108 if (lwork >
static_cast<CISSTNETLIB_INTEGER
>(inWork.size())) {
1109 cmnThrow(std::runtime_error(
"nmrLSqLin: Incorrect size for Work"));
1112 if (liwork >
static_cast<CISSTNETLIB_INTEGER
>(inIWork.size())) {
1113 cmnThrow(std::runtime_error(
"nmrLSqLin: Incorrect size for IWork"));
1115 if (n > inX.size()) {
1116 cmnThrow(std::runtime_error(
"nmrLSqLin: Incorrect size for X"));
1118 this->
Malloc(ma, me, mg, n,
false,
true,
false);
1119 this->
SetRef(ma, me, mg, n, inWork, this->InputMemory, inX);
1120 (this->IWork).
SetRef(inIWork);
1131 template <
typename _vectorOwnerTypeX>
1132 void SetRef(
size_t ma,
size_t me,
size_t mg,
size_t n,
1135 if (n > inX.size()) {
1136 cmnThrow(std::runtime_error(
"nmrLSqLin: Incorrect size for X"));
1138 this->
Malloc(ma, me, mg, n,
true,
true,
false);
1139 this->
SetRef(ma, me, mg, n, this->WorkspaceMemory, this->InputMemory, inX);
1140 (this->IWork).
SetRef((this->IWorkspaceMemory));
1157 void Malloc(
size_t ma,
size_t me,
size_t mg,
size_t n,
bool allocateWorkspace,
bool allocateInput,
bool allocateOutput)
1161 if (allocateWorkspace) {
1166 if (mg > 0 && allocateInput) {
1169 if (allocateOutput) {
1170 (this->OutputMemory).
SetSize(n);
1176 template <
typename _vectorOwnerTypeWork,
typename _matrixOwnerTypeI,
typename _vectorOwnerTypeX>
1177 void SetRef(
size_t ma,
size_t me,
size_t mg,
size_t n,
1183 (this->Work).
SetRef(work);
1189 (this->E).
SetRef(input, 0, 0, me, n);
1191 (this->A).
SetRef(input, me, 0, ma, n);
1193 (this->G).
SetRef(input, ma + me, 0, mg, n);
1194 (this->h).
SetRef(mg, input.
Column(n).Pointer(ma + me), 1);
1196 (this->A).
SetRef(input, 0, 0, ma, n);
1198 (this->G).
SetRef(input, ma, 0, mg, n);
1242template <
typename _matrixOwnerType,
typename _vectorOwnerType>
1248 CISSTNETLIB_INTEGER ret_value;
1251 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Input must be in Column Major format"));
1253 CISSTNETLIB_INTEGER Mrows =
static_cast<CISSTNETLIB_INTEGER
>(A.rows());
1254 CISSTNETLIB_INTEGER Ncols =
static_cast<CISSTNETLIB_INTEGER
>(A.cols());
1255 if ((Mrows != solutionFriend.
GetMa()) || (Ncols != solutionFriend.
GetN())) {
1256 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Size used for Allocate was different"));
1258 if (Mrows !=
static_cast<CISSTNETLIB_INTEGER
>(b.size())) {
1259 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Size of b must be same as number of rows of A"));
1262 CISSTNETLIB_INTEGER nrhs = 1;
1263 CISSTNETLIB_INTEGER lda = std::max(Mrows,
static_cast<CISSTNETLIB_INTEGER
>(1));
1264 CISSTNETLIB_INTEGER ldb = std::max(std::max(
static_cast<CISSTNETLIB_INTEGER
>(1),Mrows),Ncols);
1267 CISSTNETLIB_DOUBLE *b_ptr = b.
Pointer();
1268 if (Mrows < Ncols) {
1276#if defined(CISSTNETLIB_VERSION_MAJOR)
1277#if (CISSTNETLIB_VERSION_MAJOR >= 3)
1278 cisstNetlib_dgels_(&trans, &Mrows, &Ncols, &nrhs,
1284 dgels_(&trans, &Mrows, &Ncols, &nrhs,
1290 if (Mrows >= Ncols) {
1322template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeb,
1323 typename _matrixOwnerTypeG,
typename _vectorOwnerTypeh>
1333 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Input must be in Column Major format"));
1335 CISSTNETLIB_INTEGER ma =
static_cast<CISSTNETLIB_INTEGER
>(A.rows());
1336 CISSTNETLIB_INTEGER mg =
static_cast<CISSTNETLIB_INTEGER
>(G.rows());
1337 CISSTNETLIB_INTEGER na =
static_cast<CISSTNETLIB_INTEGER
>(A.cols());
1338 CISSTNETLIB_INTEGER ng =
static_cast<CISSTNETLIB_INTEGER
>(G.cols());
1339 if ((ma != solutionFriend.
GetMa()) || (mg != solutionFriend.
GetMg())
1340 || (na != solutionFriend.
GetN()) || (ng != solutionFriend.
GetN())) {
1341 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Size used for Allocate was different"));
1343 if (ma !=
static_cast<CISSTNETLIB_INTEGER
>(b.size())) {
1344 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Size of b must be same as number of rows of A"));
1346 if (mg !=
static_cast<CISSTNETLIB_INTEGER
>(h.size())) {
1347 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Size of h must be same as number of rows of G"));
1354 CISSTNETLIB_INTEGER mdw = ma + mg;
1355 CISSTNETLIB_INTEGER mode = 0;
1356 CISSTNETLIB_DOUBLE prgopt = 1.;
1360#if defined(CISSTNETLIB_VERSION_MAJOR)
1361#if (CISSTNETLIB_VERSION_MAJOR >= 3)
1362 cisstNetlib_lsi_(solutionFriend.
GetInput().Pointer(), &mdw, &ma, &mg, &na,
1367 lsi_(solutionFriend.
GetInput().Pointer(), &mdw, &ma, &mg, &na,
1398template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeb,
1399 typename _matrixOwnerTypeE,
typename _vectorOwnerTypef,
1400 typename _matrixOwnerTypeG,
typename _vectorOwnerTypeh>
1412 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Input must be in Column Major format"));
1414 CISSTNETLIB_INTEGER ma =
static_cast<CISSTNETLIB_INTEGER
>(A.rows());
1415 CISSTNETLIB_INTEGER me =
static_cast<CISSTNETLIB_INTEGER
>(E.rows());
1416 CISSTNETLIB_INTEGER mg =
static_cast<CISSTNETLIB_INTEGER
>(G.rows());
1417 CISSTNETLIB_INTEGER na =
static_cast<CISSTNETLIB_INTEGER
>(A.cols());
1418 CISSTNETLIB_INTEGER ne =
static_cast<CISSTNETLIB_INTEGER
>(E.cols());
1419 CISSTNETLIB_INTEGER ng =
static_cast<CISSTNETLIB_INTEGER
>(G.cols());
1420 if ((ma != solutionFriend.
GetMa()) || (mg != solutionFriend.
GetMg()) || (me != solutionFriend.
GetMe())
1421 || (na != solutionFriend.
GetN()) || (ng != solutionFriend.
GetN() || (ne != solutionFriend.
GetN()))
1423 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Size used for Allocate was different"));
1425 if (ma !=
static_cast<CISSTNETLIB_INTEGER
>(b.size())) {
1426 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Size of b must be same as number of rows of A"));
1428 if (mg !=
static_cast<CISSTNETLIB_INTEGER
>(h.size())) {
1429 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Size of h must be same as number of rows of G"));
1431 if (me !=
static_cast<CISSTNETLIB_INTEGER
>(f.size())) {
1432 cmnThrow(std::runtime_error(
"nmrLSqLinSolver Solve: Size of f must be same as number of rows of E"));
1441 CISSTNETLIB_INTEGER mdw = ma + mg + me;
1442 CISSTNETLIB_INTEGER mode = 0;
1443 CISSTNETLIB_DOUBLE prgopt = 1.;
1446#if defined(CISSTNETLIB_VERSION_MAJOR)
1447#if (CISSTNETLIB_VERSION_MAJOR >= 3)
1448 cisstNetlib_lsei_(solutionFriend.
GetInput().Pointer(), &mdw, &me, &ma, &mg, &na,
1450 solutionFriend.
GetRNorm().Pointer(), &mode,
1454 lsei_(solutionFriend.
GetInput().Pointer(), &mdw, &me, &ma, &mg, &na,
1456 solutionFriend.
GetRNorm().Pointer(), &mode,
1480template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeb,
typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork>
1487 CISSTNETLIB_INTEGER ret_value =
nmrLSqLin(A, b, lsqLinSolution);
1506template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeb,
typename _vectorOwnerTypeX>
1512 CISSTNETLIB_INTEGER ret_value =
nmrLSqLin(A, b, lsqLinSolution);
1534template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeb,
1535 typename _matrixOwnerTypeG,
typename _vectorOwnerTypeh,
typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork>
1544 CISSTNETLIB_INTEGER ret_value =
nmrLSqLin(A, b, G, h, lsqLinSolution);
1565template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeb,
1566 typename _matrixOwnerTypeG,
typename _vectorOwnerTypeh,
typename _vectorOwnerTypeX>
1574 CISSTNETLIB_INTEGER ret_value =
nmrLSqLin(A, b, G, h, lsqLinSolution);
1598template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeb,
1599 typename _matrixOwnerTypeE,
typename _vectorOwnerTypef,
1600 typename _matrixOwnerTypeG,
typename _vectorOwnerTypeh,
1601 typename _vectorOwnerTypeX,
typename _vectorOwnerTypeWork>
1612 CISSTNETLIB_INTEGER ret_value =
nmrLSqLin(A, b, E, f, G, h, lsqLinSolution);
1635template <
typename _matrixOwnerTypeA,
typename _vectorOwnerTypeb,
1636 typename _matrixOwnerTypeE,
typename _vectorOwnerTypef,
1637 typename _matrixOwnerTypeG,
typename _vectorOwnerTypeh,
1638 typename _vectorOwnerTypeX>
1648 CISSTNETLIB_INTEGER ret_value =
nmrLSqLin(A, b, E, f, G, h, lsqLinSolution);
1664template <vct::
size_type _ma, vct::
size_type _me, vct::
size_type _mg, vct::
size_type _n>
1669 enum {
K = (_ma + _mg > _n)?(_ma + _mg) : _n};
1744 return solution.RNorm;
1747 return solution.InputMemory;
1750 return solution.WorkspaceMemory;
1753 return solution.IWorkspaceMemory;
1783template <vct::
size_type _ma, vct::
size_type _n, vct::
size_type _work>
1789 CISSTNETLIB_INTEGER ret_value;
1791 CISSTNETLIB_INTEGER Mrows =
static_cast<CISSTNETLIB_INTEGER
>(_ma);
1792 CISSTNETLIB_INTEGER Ncols =
static_cast<CISSTNETLIB_INTEGER
>(_n);
1793 CISSTNETLIB_INTEGER nrhs = 1;
1794 CISSTNETLIB_INTEGER lda = std::max(Mrows,
static_cast<CISSTNETLIB_INTEGER
>(1));
1795 CISSTNETLIB_INTEGER ldb = std::max(std::max(
static_cast<CISSTNETLIB_INTEGER
>(1),Mrows),Ncols);
1797 CMN_ASSERT(lwork <=
static_cast<CISSTNETLIB_INTEGER
>(_work));
1798 CISSTNETLIB_DOUBLE *b_ptr = b.
Pointer();
1799 if (Mrows < Ncols) {
1804 memcpy(x.
Pointer(), b.
Pointer(), Mrows*
sizeof(CISSTNETLIB_DOUBLE));
1808#if defined(CISSTNETLIB_VERSION_MAJOR)
1809#if (CISSTNETLIB_VERSION_MAJOR >= 3)
1810 cisstNetlib_dgels_(&trans, &Mrows, &Ncols, &nrhs,
1813 Work.
Pointer(), &lwork, &ret_value);
1816 dgels_(&trans, &Mrows, &Ncols, &nrhs,
1819 Work.
Pointer(), &lwork, &ret_value);
1822 if (Mrows >= Ncols) {
1832template <vct::
size_type _ma, vct::
size_type _n>
1838 CISSTNETLIB_INTEGER ret_value =
nmrLSqLin(A, b, x, work);
1842template <vct::
size_type _ma, vct::
size_type _n>
1848 CISSTNETLIB_INTEGER ret_value =
nmrLSqLin(A, b, solutionFriend.
GetX(), solutionFriend.
GetWork());
1856template <vct::
size_type _ma, vct::
size_type _mg, vct::
size_type _n, vct::
size_type _work, vct::
size_type _iwork>
1864 CISSTNETLIB_INTEGER ma =
static_cast<CISSTNETLIB_INTEGER
>(_ma);
1865 CISSTNETLIB_INTEGER mg =
static_cast<CISSTNETLIB_INTEGER
>(_mg);
1866 CISSTNETLIB_INTEGER na =
static_cast<CISSTNETLIB_INTEGER
>(_n);
1876 CISSTNETLIB_INTEGER mdw = ma + mg;
1877 CISSTNETLIB_INTEGER mode = 0;
1878 CISSTNETLIB_DOUBLE prgopt = 1.;
1881#if defined(CISSTNETLIB_VERSION_MAJOR)
1882#if (CISSTNETLIB_VERSION_MAJOR >= 3)
1883 cisstNetlib_lsi_(
W.Pointer(), &mdw, &ma, &mg, &na,
1888 lsi_(
W.Pointer(), &mdw, &ma, &mg, &na,
1895template <vct::
size_type _ma, vct::
size_type _mg, vct::
size_type _n>
1906 CISSTNETLIB_INTEGER ret_value;
1911 (A, b, G, h, x, w, rNorm, work, iwork);
1915template <vct::
size_type _ma, vct::
size_type _mg, vct::
size_type _n>
1923 CISSTNETLIB_INTEGER ret_value;
1948 CISSTNETLIB_INTEGER me =
static_cast<CISSTNETLIB_INTEGER
>(_me);
1949 CISSTNETLIB_INTEGER ma =
static_cast<CISSTNETLIB_INTEGER
>(_ma);
1950 CISSTNETLIB_INTEGER mg =
static_cast<CISSTNETLIB_INTEGER
>(_mg);
1951 CISSTNETLIB_INTEGER na =
static_cast<CISSTNETLIB_INTEGER
>(_n);
1965 CISSTNETLIB_INTEGER mdw = ma + me + mg;
1966 CISSTNETLIB_INTEGER mode = 0;
1967 CISSTNETLIB_DOUBLE prgopt = 1.;
1970#if defined(CISSTNETLIB_VERSION_MAJOR)
1971#if (CISSTNETLIB_VERSION_MAJOR >= 3)
1972 cisstNetlib_lsei_(
W.Pointer(), &mdw, &me, &ma, &mg, &na,
1977 lsei_(
W.Pointer(), &mdw, &me, &ma, &mg, &na,
1984template <vct::
size_type _ma, vct::
size_type _me, vct::
size_type _mg, vct::
size_type _n>
1994 CISSTNETLIB_INTEGER ret_value;
1999 (A, b, E, f, G, h, x, w, rNorm, work, iwork);
2003template <vct::
size_type _ma, vct::
size_type _me, vct::
size_type _mg, vct::
size_type _n>
2010 CISSTNETLIB_INTEGER ret_value;
Definition nmrLSqLin.h:353
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & Geth(void)
Definition nmrLSqLin.h:374
vctDynamicVector< CISSTNETLIB_DOUBLE > & GetRNorm(void)
Definition nmrLSqLin.h:380
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > & GetG(void)
Definition nmrLSqLin.h:365
vctDynamicMatrix< CISSTNETLIB_DOUBLE > & GetInput(void)
Definition nmrLSqLin.h:383
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > & GetA(void)
Definition nmrLSqLin.h:359
CISSTNETLIB_INTEGER GetN(void)
Definition nmrLSqLin.h:401
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & Getf(void)
Definition nmrLSqLin.h:371
vctDynamicVectorRef< CISSTNETLIB_INTEGER > & GetIWork(void)
Definition nmrLSqLin.h:389
CISSTNETLIB_INTEGER GetMe(void)
Definition nmrLSqLin.h:395
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & Getb(void)
Definition nmrLSqLin.h:368
CISSTNETLIB_INTEGER GetMa(void)
Definition nmrLSqLin.h:392
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & GetWork(void)
Definition nmrLSqLin.h:386
Friend(nmrLSqLinSolutionDynamic &insolution)
Definition nmrLSqLin.h:357
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > & GetE(void)
Definition nmrLSqLin.h:362
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & GetX(void)
Definition nmrLSqLin.h:377
CISSTNETLIB_INTEGER GetMg(void)
Definition nmrLSqLin.h:398
Definition nmrLSqLin.h:114
nmrLSqLinSolutionDynamic(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:461
void Allocate(size_t ma, size_t me, size_t mg, size_t n)
Definition nmrLSqLin.h:1010
nmrLSqLinSolutionDynamic(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:510
static void AllocateIWorkspace(CISSTNETLIB_INTEGER ma, CISSTNETLIB_INTEGER me, CISSTNETLIB_INTEGER mg, CISSTNETLIB_INTEGER n, vctDynamicVector< CISSTNETLIB_INTEGER > &inIWork)
Definition nmrLSqLin.h:286
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > X
Definition nmrLSqLin.h:149
vctDynamicVectorRef< CISSTNETLIB_INTEGER > IWork
Definition nmrLSqLin.h:153
vctDynamicVector< CISSTNETLIB_DOUBLE > OutputMemory
Definition nmrLSqLin.h:124
void Allocate(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition nmrLSqLin.h:720
nmrLSqLinSolutionDynamic(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeIWork, CISSTNETLIB_INTEGER > &inIWork)
Definition nmrLSqLin.h:545
void SetRef(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
Definition nmrLSqLin.h:884
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > f
Definition nmrLSqLin.h:147
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > RNormL
Definition nmrLSqLin.h:150
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)
Definition nmrLSqLin.h:639
void Allocate(size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:1027
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)
Definition nmrLSqLin.h:694
const vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & GetX(void) const
Definition nmrLSqLin.h:1211
void Allocate(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inIWork)
Definition nmrLSqLin.h:835
static void AllocateIWorkspace(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVector< CISSTNETLIB_INTEGER > &inIWork)
Definition nmrLSqLin.h:333
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)
Definition nmrLSqLin.h:937
static CISSTNETLIB_INTEGER GetIWorkspaceSize(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG)
Definition nmrLSqLin.h:254
static void AllocateWorkspace(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVector< CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:306
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > b
Definition nmrLSqLin.h:146
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > G
Definition nmrLSqLin.h:145
size_t m_N
Definition nmrLSqLin.h:165
static CISSTNETLIB_INTEGER GetWorkspaceSize(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG)
Definition nmrLSqLin.h:248
nmrLSqLinSolutionDynamic(size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
Definition nmrLSqLin.h:677
static CISSTNETLIB_INTEGER GetIWorkspaceSize(size_t CMN_UNUSED(ma), size_t me, size_t mg, size_t n)
Definition nmrLSqLin.h:190
static void AllocateWorkspace(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVector< CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:325
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)
Definition nmrLSqLin.h:562
nmrLSqLinSolutionDynamic(size_t ma, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:476
vctDynamicVector< CISSTNETLIB_DOUBLE > RNorm
Definition nmrLSqLin.h:125
void SetRef(size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
Definition nmrLSqLin.h:1132
vctDynamicVector< CISSTNETLIB_INTEGER > IWorkspaceMemory
Definition nmrLSqLin.h:120
void Allocate(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:743
void SetRef(size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:1079
nmrLSqLinSolutionDynamic(size_t ma, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
Definition nmrLSqLin.h:495
nmrLSqLinSolutionDynamic(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition nmrLSqLin.h:447
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > E
Definition nmrLSqLin.h:144
static void AllocateIWorkspace(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVector< CISSTNETLIB_INTEGER > &inIWork)
Definition nmrLSqLin.h:313
void SetRef(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:765
nmrLSqLinSolutionDynamic(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G)
Definition nmrLSqLin.h:529
nmrLSqLinSolutionDynamic(size_t ma, size_t n)
Definition nmrLSqLin.h:420
static CISSTNETLIB_INTEGER GetWorkspaceSize(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG)
Definition nmrLSqLin.h:263
void Allocate(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &E, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G)
Definition nmrLSqLin.h:909
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)
Definition nmrLSqLin.h:1177
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > RNormE
Definition nmrLSqLin.h:151
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > h
Definition nmrLSqLin.h:148
void Allocate(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G)
Definition nmrLSqLin.h:809
size_t m_Mg
Definition nmrLSqLin.h:164
nmrLSqLinSolutionDynamic(size_t ma, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
Definition nmrLSqLin.h:582
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)
Definition nmrLSqLin.h:1102
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > A
Definition nmrLSqLin.h:143
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)
Definition nmrLSqLin.h:861
static CISSTNETLIB_INTEGER GetIWorkspaceSize(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG)
Definition nmrLSqLin.h:270
void SetRef(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
Definition nmrLSqLin.h:786
nmrLSqLinSolutionDynamic(size_t ma, size_t me, size_t mg, size_t n)
Definition nmrLSqLin.h:430
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)
Definition nmrLSqLin.h:964
static CISSTNETLIB_INTEGER GetWorkspaceSize(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA)
Definition nmrLSqLin.h:240
size_t m_Me
Definition nmrLSqLin.h:163
vctDynamicMatrix< CISSTNETLIB_DOUBLE > InputMemory
Definition nmrLSqLin.h:138
static void AllocateWorkspace(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicVector< CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:296
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)
Definition nmrLSqLin.h:599
const vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & GetRNorm(void) const
Definition nmrLSqLin.h:1214
static void AllocateWorkspace(CISSTNETLIB_INTEGER ma, CISSTNETLIB_INTEGER me, CISSTNETLIB_INTEGER mg, CISSTNETLIB_INTEGER n, vctDynamicVector< CISSTNETLIB_DOUBLE > &inWork)
Definition nmrLSqLin.h:282
void Malloc(size_t ma, size_t me, size_t mg, size_t n, bool allocateWorkspace, bool allocateInput, bool allocateOutput)
Definition nmrLSqLin.h:1157
static CISSTNETLIB_INTEGER GetWorkspaceSize(size_t ma, size_t me, size_t mg, size_t n)
Definition nmrLSqLin.h:173
void SetRef(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &inA, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &inE, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &inG, vctDynamicVectorBase< _vectorOwnerTypeX, CISSTNETLIB_DOUBLE > &inX)
Definition nmrLSqLin.h:989
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)
Definition nmrLSqLin.h:657
nmrLSqLinSolutionDynamic()
Definition nmrLSqLin.h:413
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > Work
Definition nmrLSqLin.h:152
static CISSTNETLIB_INTEGER QueryWorkspaceSize_LS(size_t ma, size_t n)
Definition nmrLSqLin.h:203
void Allocate(size_t ma, size_t me, size_t mg, size_t n, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inWork, vctDynamicVectorBase< _vectorOwnerTypeWork, CISSTNETLIB_DOUBLE > &inIWork)
Definition nmrLSqLin.h:1048
const vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & GetRNormE(void) const
Definition nmrLSqLin.h:1217
size_t m_Ma
Definition nmrLSqLin.h:162
vctDynamicVector< CISSTNETLIB_DOUBLE > WorkspaceMemory
Definition nmrLSqLin.h:119
nmrLSqLinSolutionDynamic(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeE, CISSTNETLIB_DOUBLE > &E, vctDynamicMatrixBase< _matrixOwnerTypeG, CISSTNETLIB_DOUBLE > &G)
Definition nmrLSqLin.h:620
nmrLSqLinSolutionDynamic(size_t ma, size_t mg, size_t n)
Definition nmrLSqLin.h:425
Definition nmrLSqLin.h:1734
Friend(nmrLSqLinSolutionFixedSize< _ma, _me, _mg, _n > &insolution)
Definition nmrLSqLin.h:1738
TypeRNorm & GetRNorm(void)
Definition nmrLSqLin.h:1743
TypeIWork & GetIWork(void)
Definition nmrLSqLin.h:1752
TypeWork & GetWork(void)
Definition nmrLSqLin.h:1749
TypeInput & GetInput(void)
Definition nmrLSqLin.h:1746
TypeX & GetX(void)
Definition nmrLSqLin.h:1740
Definition nmrLSqLin.h:1666
@ LWORK
Definition nmrLSqLin.h:1674
vctFixedSizeMatrixRef< CISSTNETLIB_DOUBLE,(_mg==0)?1:_mg, _n, 1,(_mg==0)?1:_mg > TypeG
Definition nmrLSqLin.h:1679
@ K
Definition nmrLSqLin.h:1669
vctFixedSizeVector< CISSTNETLIB_INTEGER, LIWORK > TypeIWork
Definition nmrLSqLin.h:1687
vctFixedSizeVector< CISSTNETLIB_DOUBLE, LWORK > TypeWork
Definition nmrLSqLin.h:1686
nmrLSqLinSolutionFixedSize()
Definition nmrLSqLin.h:1760
TypeWork WorkspaceMemory
Definition nmrLSqLin.h:1695
vctFixedSizeVector< CISSTNETLIB_DOUBLE, _ma+_me > TypeRNorm
Definition nmrLSqLin.h:1689
@ MIN_MN
Definition nmrLSqLin.h:1668
@ LWORK_LS
Definition nmrLSqLin.h:1670
vctFixedSizeVectorRef< CISSTNETLIB_DOUBLE, _ma, 1 > TypeRNormL
Definition nmrLSqLin.h:1684
TypeIWork IWorkspaceMemory
Definition nmrLSqLin.h:1696
vctFixedSizeMatrixRef< CISSTNETLIB_DOUBLE,(_me==0)?1:_me, _n, 1,(_me==0)?1:_me > TypeE
Definition nmrLSqLin.h:1678
vctFixedSizeMatrixRef< CISSTNETLIB_DOUBLE, _ma, _n, 1, _ma > TypeA
Definition nmrLSqLin.h:1676
TypeRNormE RNormE
Definition nmrLSqLin.h:1719
vctFixedSizeVectorRef< CISSTNETLIB_DOUBLE,(_me==0)?1:_me, 1 > TypeRNormE
Definition nmrLSqLin.h:1683
vctFixedSizeVectorRef< CISSTNETLIB_DOUBLE, _ma, 1 > Typeb
Definition nmrLSqLin.h:1680
vctFixedSizeVector< CISSTNETLIB_DOUBLE, _n > TypeX
Definition nmrLSqLin.h:1688
vctFixedSizeVectorRef< CISSTNETLIB_DOUBLE,(_mg==0)?1:_mg, 1 > Typeh
Definition nmrLSqLin.h:1682
TypeInput InputMemory
Definition nmrLSqLin.h:1713
@ LIWORK
Definition nmrLSqLin.h:1675
const TypeRNormE & GetRNormE(void) const
Definition nmrLSqLin.h:1774
@ LWORK_LSI
Definition nmrLSqLin.h:1671
TypeRNorm RNorm
Definition nmrLSqLin.h:1700
@ LWORK_TMP
Definition nmrLSqLin.h:1673
@ LWORK_LSEI
Definition nmrLSqLin.h:1672
const TypeRNormL & GetRNorm(void) const
Definition nmrLSqLin.h:1771
vctFixedSizeVectorRef< CISSTNETLIB_DOUBLE,(_me==0)?1:_me, 1 > Typef
Definition nmrLSqLin.h:1681
vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _ma+_me+_mg, _n+1, VCT_COL_MAJOR > TypeInput
Definition nmrLSqLin.h:1690
TypeX X
Definition nmrLSqLin.h:1717
TypeRNormL RNormL
Definition nmrLSqLin.h:1718
const TypeX & GetX(void) const
Definition nmrLSqLin.h:1768
Definition vctDynamicMatrixBase.h:43
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition vctDynamicMatrixBase.h:143
ThisType & Assign(const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &other)
Definition vctDynamicMatrixBase.h:509
ColumnRefType Column(size_type index) CISST_THROW(std
Definition vctDynamicMatrixBase.h:233
Definition vctForwardDeclarations.h:157
Dynamic matrix referencing existing memory.
Definition vctDynamicMatrixRef.h:75
Definition vctDynamicVectorBase.h:62
pointer Pointer(index_type index=0)
Definition vctDynamicVectorBase.h:155
value_type & X(void)
Definition vctDynamicVectorBase.h:497
ThisType & Assign(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &other)
Definition vctDynamicVectorBase.h:242
Definition vctForwardDeclarations.h:131
Dynamic vector referencing existing memory.
Definition vctDynamicVectorRef.h:78
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition vctFixedSizeMatrixBase.h:161
Implementation of a fixed-size matrix using template metaprogramming.
Definition vctFixedSizeMatrix.h:54
Definition vctForwardDeclarations.h:110
ThisType & Assign(const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &other)
Definition vctFixedSizeVectorBase.h:274
pointer Pointer(size_type index=0)
Definition vctFixedSizeVectorBase.h:226
value_type & X(void)
Definition vctFixedSizeVectorBase.h:559
Implementation of a fixed-size vector using template metaprogramming.
Definition vctFixedSizeVector.h:54
Definition vctForwardDeclarations.h:89
#define CMN_ASSERT(expr)
Definition cmnAssert.h:97
#define CMN_UNUSED(argument)
Definition cmnPortability.h:497
#define CISST_THROW(exceptionParameter)
Somewhat portable compilation warning message. This works with very recent versions of gcc (4....
Definition cmnPortability.h:559
Declaration of the template function cmnThrow.
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition cmnThrow.h:76
size_t size_type
Definition vctContainerTraits.h:35
CISSTNETLIB_INTEGER nmrLSqLin(vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerType, CISSTNETLIB_DOUBLE > &b, nmrLSqLinSolutionDynamic &solution) CISST_THROW(std
Definition nmrLSqLin.h:1243
const_pointer Pointer(index_type rowIndex, index_type colIndex) const
Definition vctDynamicConstMatrixBase.h:306
const value_type & W(void) const
Definition vctDynamicConstVectorBase.h:286
const value_type & X(void) const
Definition vctDynamicConstVectorBase.h:263
Declaration of vctDynamicMatrix.
void SetSize(size_type rows, size_type cols, bool storageOrder)
Definition vctDynamicMatrix.h:364
Declaration of vctFixedSizeMatrix.
const bool VCT_COL_MAJOR
Definition vctForwardDeclarations.h:44