Nektar++
NekLinSys.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: NekLinSys.hpp
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description:
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_LINSYS_HPP
36#define NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_LINSYS_HPP
37
46#include <iostream>
47
48#include <type_traits>
49
50#ifdef max
51#undef max
52#endif
53
54#ifdef min
55#undef min
56#endif
57
58namespace Nektar
59{
60template <typename DataType> struct IsSharedPointer : public std::false_type
61{
62};
63
64template <typename DataType>
65struct IsSharedPointer<std::shared_ptr<DataType>> : public std::true_type
66{
67};
68
69// The solving of the linear system is located in this class instead of in the
70// LinearSystem class because XCode gcc 4.2 didn't compile it correctly when it
71// was moved to the LinearSystem class.
73{
74 template <typename BVectorType, typename XVectorType>
75 static void Solve(const BVectorType &b, XVectorType &x,
76 MatrixStorage m_matrixType,
77 const Array<OneD, const int> &m_ipivot, unsigned int n,
78 const Array<OneD, const double> &A, char m_transposeFlag,
79 unsigned int m_numberOfSubDiagonals,
80 unsigned int m_numberOfSuperDiagonals)
81 {
82 switch (m_matrixType)
83 {
84 case eFULL:
85 {
86 x = b;
87 int info = 0;
88 Lapack::Dgetrs('N', n, 1, A.get(), n, (int *)m_ipivot.get(),
89 x.GetRawPtr(), n, info);
90 if (info < 0)
91 {
92 std::string message =
93 "ERROR: The " + std::to_string(-info) +
94 "th parameter had an illegal parameter for dgetrs";
95 ASSERTL0(false, message.c_str());
96 }
97 }
98 break;
99 case eDIAGONAL:
100 for (unsigned int i = 0; i < A.size(); ++i)
101 {
102 x[i] = b[i] * A[i];
103 }
104 break;
106 {
107 x = b;
108 int info = 0;
109 Lapack::Dtptrs('U', m_transposeFlag, 'N', n, 1, A.get(),
110 x.GetRawPtr(), n, info);
111
112 if (info < 0)
113 {
114 std::string message =
115 "ERROR: The " + std::to_string(-info) +
116 "th parameter had an illegal parameter for dtptrs";
117 ASSERTL0(false, message.c_str());
118 }
119 else if (info > 0)
120 {
121 std::string message =
122 "ERROR: The " + std::to_string(-info) +
123 "th diagonal element of A is 0 for dtptrs";
124 ASSERTL0(false, message.c_str());
125 }
126 }
127 break;
129 {
130 x = b;
131 int info = 0;
132 Lapack::Dtptrs('L', m_transposeFlag, 'N', n, 1, A.get(),
133 x.GetRawPtr(), n, info);
134
135 if (info < 0)
136 {
137 std::string message =
138 "ERROR: The " + std::to_string(-info) +
139 "th parameter had an illegal parameter for dtptrs";
140 ASSERTL0(false, message.c_str());
141 }
142 else if (info > 0)
143 {
144 std::string message =
145 "ERROR: The " + std::to_string(-info) +
146 "th diagonal element of A is 0 for dtptrs";
147 ASSERTL0(false, message.c_str());
148 }
149 }
150 break;
151 case eSYMMETRIC:
152 {
153 x = b;
154 int info = 0;
155 Lapack::Dsptrs('U', n, 1, A.get(), m_ipivot.get(),
156 x.GetRawPtr(), x.GetRows(), info);
157 if (info < 0)
158 {
159 std::string message =
160 "ERROR: The " + std::to_string(-info) +
161 "th parameter had an illegal parameter for dsptrs";
162 ASSERTL0(false, message.c_str());
163 }
164 }
165 break;
167 {
168 x = b;
169 int info = 0;
170 Lapack::Dpptrs('U', n, 1, A.get(), x.GetRawPtr(), x.GetRows(),
171 info);
172 if (info < 0)
173 {
174 std::string message =
175 "ERROR: The " + std::to_string(-info) +
176 "th parameter had an illegal parameter for dpptrs";
177 ASSERTL0(false, message.c_str());
178 }
179 }
180 break;
181 case eBANDED:
182 {
183 x = b;
184 int KL = m_numberOfSubDiagonals;
185 int KU = m_numberOfSuperDiagonals;
186 int info = 0;
187
188 Lapack::Dgbtrs(m_transposeFlag, n, KL, KU, 1, A.get(),
189 2 * KL + KU + 1, m_ipivot.get(), x.GetRawPtr(),
190 n, info);
191
192 if (info < 0)
193 {
194 std::string message =
195 "ERROR: The " + std::to_string(-info) +
196 "th parameter had an illegal parameter for dgbtrs";
197 ASSERTL0(false, message.c_str());
198 }
199 }
200 break;
202 {
203 x = b;
204 int KU = m_numberOfSuperDiagonals;
205 int info = 0;
206
207 Lapack::Dpbtrs('U', n, KU, 1, A.get(), KU + 1, x.GetRawPtr(), n,
208 info);
209
210 if (info < 0)
211 {
212 std::string message =
213 "ERROR: The " + std::to_string(-info) +
214 "th parameter had an illegal parameter for dpbtrs";
215 ASSERTL0(false, message.c_str());
216 }
217 }
218 break;
220 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
221 break;
223 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
224 break;
226 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
227 break;
228
229 default:
230 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
231 }
232 }
233
234 template <typename BVectorType, typename XVectorType>
235 static void SolveTranspose(const BVectorType &b, XVectorType &x,
236 MatrixStorage m_matrixType,
237 const Array<OneD, const int> &m_ipivot,
238 unsigned int n,
240 char m_transposeFlag,
241 unsigned int m_numberOfSubDiagonals,
242 unsigned int m_numberOfSuperDiagonals)
243 {
244 switch (m_matrixType)
245 {
246 case eFULL:
247 {
248 x = b;
249 int info = 0;
250 Lapack::Dgetrs('T', n, 1, A.get(), n, (int *)m_ipivot.get(),
251 x.GetRawPtr(), n, info);
252
253 if (info < 0)
254 {
255 std::string message =
256 "ERROR: The " + std::to_string(-info) +
257 "th parameter had an illegal parameter for dgetrs";
258 ASSERTL0(false, message.c_str());
259 }
260 }
261
262 break;
263 case eDIAGONAL:
264 Solve(b, x, m_matrixType, m_ipivot, n, A, m_transposeFlag,
265 m_numberOfSubDiagonals, m_numberOfSuperDiagonals);
266 break;
268 {
269 char trans = m_transposeFlag;
270 if (trans == 'N')
271 {
272 trans = 'T';
273 }
274 else
275 {
276 trans = 'N';
277 }
278
279 x = b;
280 int info = 0;
281 Lapack::Dtptrs('U', trans, 'N', n, 1, A.get(), x.GetRawPtr(), n,
282 info);
283
284 if (info < 0)
285 {
286 std::string message =
287 "ERROR: The " + std::to_string(-info) +
288 "th parameter had an illegal parameter for dtptrs";
289 ASSERTL0(false, message.c_str());
290 }
291 else if (info > 0)
292 {
293 std::string message =
294 "ERROR: The " + std::to_string(-info) +
295 "th diagonal element of A is 0 for dtptrs";
296 ASSERTL0(false, message.c_str());
297 }
298 }
299
300 break;
302 {
303 char trans = m_transposeFlag;
304 if (trans == 'N')
305 {
306 trans = 'T';
307 }
308 else
309 {
310 trans = 'N';
311 }
312
313 x = b;
314 int info = 0;
315 Lapack::Dtptrs('L', trans, 'N', n, 1, A.get(), x.GetRawPtr(), n,
316 info);
317
318 if (info < 0)
319 {
320 std::string message =
321 "ERROR: The " + std::to_string(-info) +
322 "th parameter had an illegal parameter for dtptrs";
323 ASSERTL0(false, message.c_str());
324 }
325 else if (info > 0)
326 {
327 std::string message =
328 "ERROR: The " + std::to_string(-info) +
329 "th diagonal element of A is 0 for dtptrs";
330 ASSERTL0(false, message.c_str());
331 }
332 }
333 break;
334 case eSYMMETRIC:
337 Solve(b, x, m_matrixType, m_ipivot, n, A, m_transposeFlag,
338 m_numberOfSubDiagonals, m_numberOfSuperDiagonals);
339 break;
340 case eBANDED:
341 {
342 x = b;
343 int KL = m_numberOfSubDiagonals;
344 int KU = m_numberOfSuperDiagonals;
345 int info = 0;
346
347 Lapack::Dgbtrs(m_transposeFlag, n, KL, KU, 1, A.get(),
348 2 * KL + KU + 1, m_ipivot.get(), x.GetRawPtr(),
349 n, info);
350
351 if (info < 0)
352 {
353 std::string message =
354 "ERROR: The " + std::to_string(-info) +
355 "th parameter had an illegal parameter for dgbtrs";
356 ASSERTL0(false, message.c_str());
357 }
358 }
359 break;
361 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
362 break;
364 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
365 break;
367 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
368 break;
369
370 default:
371 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
372 }
373 }
374};
375
377{
378public:
379 template <typename MatrixType>
380 explicit LinearSystem(const std::shared_ptr<MatrixType> &theA,
381 PointerWrapper wrapperType = eCopy)
382 : n(theA->GetRows()), A(theA->GetPtr()), m_ipivot(),
383 m_numberOfSubDiagonals(theA->GetNumberOfSubDiagonals()),
384 m_numberOfSuperDiagonals(theA->GetNumberOfSuperDiagonals()),
385 m_matrixType(theA->GetType()),
386 m_transposeFlag(theA->GetTransposeFlag())
387 {
388 // At some point we should fix this. We should upate the copy of
389 // A to be transposd for this to work.
390 ASSERTL0(theA->GetTransposeFlag() == 'N',
391 "LinearSystem requires a non-transposed matrix.");
392 ASSERTL0((wrapperType == eWrapper && theA->GetType() != eBANDED) ||
393 wrapperType == eCopy,
394 "Banded matrices can't be wrapped");
395
396 if (wrapperType == eCopy)
397 {
398 A = Array<OneD, double>(theA->GetPtr().size());
399 CopyArray(theA->GetPtr(), A);
400 }
401
402 FactorMatrix(*theA);
403 }
404
405 template <typename MatrixType>
406 explicit LinearSystem(const MatrixType &theA,
407 PointerWrapper wrapperType = eCopy)
408 : n(theA.GetRows()), A(theA.GetPtr()), m_ipivot(),
409 m_numberOfSubDiagonals(theA.GetNumberOfSubDiagonals()),
410 m_numberOfSuperDiagonals(theA.GetNumberOfSuperDiagonals()),
411 m_matrixType(theA.GetType()), m_transposeFlag(theA.GetTransposeFlag())
412 {
413 // At some point we should fix this. We should upate the copy of
414 // A to be transposd for this to work.
415 ASSERTL0(theA.GetTransposeFlag() == 'N',
416 "LinearSystem requires a non-transposed matrix.");
417 ASSERTL0((wrapperType == eWrapper && theA.GetType() != eBANDED) ||
418 wrapperType == eCopy,
419 "Banded matrices can't be wrapped");
420
421 if (wrapperType == eCopy)
422 {
423 A = Array<OneD, double>(theA.GetPtr().size());
424 CopyArray(theA.GetPtr(), A);
425 }
426
427 FactorMatrix(theA);
428 }
429
431 : n(rhs.n), A(rhs.A), m_ipivot(rhs.m_ipivot),
435 {
436 }
437
439 {
440 LinearSystem temp(rhs);
441 swap(temp);
442 return *this;
443 }
444
445 // In the following calls to Solve, VectorType must be a NekVector.
446 // Anything else won't compile.
447 template <typename VectorType>
448 RawType_t<VectorType> Solve(const VectorType &b)
449 {
456 return x;
457 }
458
459 template <typename BType, typename XType>
460 void Solve(const BType &b, XType &x) const
461 {
467 }
468
469 // Transpose variant of solve
470 template <typename VectorType>
472 {
479 return x;
480 }
481
482 template <typename BType, typename XType>
483 void SolveTranspose(const BType &b, XType &x) const
484 {
490 }
491
492 unsigned int GetRows() const
493 {
494 return n;
495 }
496 unsigned int GetColumns() const
497 {
498 return n;
499 }
500
501private:
502 template <typename MatrixType> void FactorMatrix(const MatrixType &theA)
503 {
504 switch (m_matrixType)
505 {
506 case eFULL:
507 {
508 int m = theA.GetRows();
509 int n = theA.GetColumns();
510
511 int pivotSize = std::max(1, std::min(m, n));
512 int info = 0;
513 m_ipivot = Array<OneD, int>(pivotSize);
514
515 Lapack::Dgetrf(m, n, A.get(), m, m_ipivot.get(), info);
516
517 if (info < 0)
518 {
519 std::string message =
520 "ERROR: The " + std::to_string(-info) +
521 "th parameter had an illegal parameter for dgetrf";
522 ASSERTL0(false, message.c_str());
523 }
524 else if (info > 0)
525 {
526 std::string message =
527 "ERROR: Element u_" + std::to_string(info) +
528 std::to_string(info) + " is 0 from dgetrf";
529 ASSERTL0(false, message.c_str());
530 }
531 }
532 break;
533 case eDIAGONAL:
534 for (unsigned int i = 0; i < theA.GetColumns(); ++i)
535 {
536 A[i] = 1.0 / theA(i, i);
537 }
538 break;
541 break;
542 case eSYMMETRIC:
543 {
544 int info = 0;
545 int pivotSize = theA.GetRows();
546 m_ipivot = Array<OneD, int>(pivotSize);
547
548 Lapack::Dsptrf('U', theA.GetRows(), A.get(), m_ipivot.get(),
549 info);
550
551 if (info < 0)
552 {
553 std::string message =
554 "ERROR: The " + std::to_string(-info) +
555 "th parameter had an illegal parameter for dsptrf";
556 NEKERROR(ErrorUtil::efatal, message.c_str());
557 }
558 else if (info > 0)
559 {
560 std::string message =
561 "ERROR: Element u_" + std::to_string(info) +
562 std::to_string(info) + " is 0 from dsptrf";
563 NEKERROR(ErrorUtil::efatal, message.c_str());
564 }
565 }
566 break;
568 {
569 int info = 0;
570 Lapack::Dpptrf('U', theA.GetRows(), A.get(), info);
571
572 if (info < 0)
573 {
574 std::string message =
575 "ERROR: The " + std::to_string(-info) +
576 "th parameter had an illegal parameter for dpptrf";
577 NEKERROR(ErrorUtil::efatal, message.c_str());
578 }
579 else if (info > 0)
580 {
581 std::string message =
582 "ERROR: The leading minor of order " +
583 std::to_string(info) +
584 " is not positive definite from dpptrf";
585 NEKERROR(ErrorUtil::efatal, message.c_str());
586 }
587 }
588 break;
589 case eBANDED:
590 {
591 int M = n;
592 int N = n;
593 int KL = m_numberOfSubDiagonals;
595
596 // The array we pass in to dgbtrf must have enough space for KL
597 // subdiagonals and KL+KU superdiagonals (see lapack users
598 // guide, in the section discussing band storage.
599 unsigned int requiredStorageSize =
601 KL + KU);
602
603 unsigned int rawRows = KL + KU + 1;
604 A = Array<OneD, double>(requiredStorageSize);
605
606 // Put the extra elements up front.
607 for (unsigned int i = 0; i < theA.GetColumns(); ++i)
608 {
609 std::copy(theA.GetRawPtr() + i * rawRows,
610 theA.GetRawPtr() + (i + 1) * rawRows,
611 A.get() + (i + 1) * KL + i * rawRows);
612 }
613
614 int info = 0;
615 int pivotSize = theA.GetRows();
616 m_ipivot = Array<OneD, int>(pivotSize);
617
618 Lapack::Dgbtrf(M, N, KL, KU, A.get(), 2 * KL + KU + 1,
619 m_ipivot.get(), info);
620
621 if (info < 0)
622 {
623 std::string message =
624 "ERROR: The " + std::to_string(-info) +
625 "th parameter had an illegal parameter for dgbtrf";
626 NEKERROR(ErrorUtil::efatal, message.c_str());
627 }
628 else if (info > 0)
629 {
630 std::string message =
631 "ERROR: Element u_" + std::to_string(info) +
632 std::to_string(info) + " is 0 from dgbtrf";
633 NEKERROR(ErrorUtil::efatal, message.c_str());
634 }
635 }
636 break;
638 {
639 ASSERTL1(
641 std::string("Number of sub- and superdiagonals should ") +
642 std::string("be equal for a symmetric banded matrix"));
643
645 int info = 0;
646 Lapack::Dpbtrf('U', theA.GetRows(), KU, A.get(), KU + 1, info);
647
648 if (info < 0)
649 {
650 std::string message =
651 "ERROR: The " + std::to_string(-info) +
652 "th parameter had an illegal parameter for dpbtrf";
653 NEKERROR(ErrorUtil::efatal, message.c_str());
654 }
655 else if (info > 0)
656 {
657 std::string message =
658 "ERROR: The leading minor of order " +
659 std::to_string(info) +
660 " is not positive definite from dpbtrf";
661 NEKERROR(ErrorUtil::efatal, message.c_str());
662 }
663 }
664 break;
666 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
667 break;
669 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
670 break;
672 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
673 break;
674
675 default:
676 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
677 }
678 }
679
681 {
682 std::swap(n, rhs.n);
683 std::swap(A, rhs.A);
684 std::swap(m_ipivot, rhs.m_ipivot);
687 std::swap(m_matrixType, rhs.m_matrixType);
688 std::swap(m_transposeFlag, rhs.m_transposeFlag);
689 }
690
691 unsigned int n;
698};
699} // namespace Nektar
700
701#endif // NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_LINSYS_HPP
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
unsigned int GetColumns() const
Definition: NekLinSys.hpp:496
Array< OneD, double > A
Definition: NekLinSys.hpp:692
LinearSystem(const MatrixType &theA, PointerWrapper wrapperType=eCopy)
Definition: NekLinSys.hpp:406
void swap(LinearSystem &rhs)
Definition: NekLinSys.hpp:680
void Solve(const BType &b, XType &x) const
Definition: NekLinSys.hpp:460
LinearSystem(const std::shared_ptr< MatrixType > &theA, PointerWrapper wrapperType=eCopy)
Definition: NekLinSys.hpp:380
Array< OneD, int > m_ipivot
Definition: NekLinSys.hpp:693
void FactorMatrix(const MatrixType &theA)
Definition: NekLinSys.hpp:502
void SolveTranspose(const BType &b, XType &x) const
Definition: NekLinSys.hpp:483
RawType_t< VectorType > SolveTranspose(const VectorType &b)
Definition: NekLinSys.hpp:471
RawType_t< VectorType > Solve(const VectorType &b)
Definition: NekLinSys.hpp:448
LinearSystem & operator=(const LinearSystem &rhs)
Definition: NekLinSys.hpp:438
LinearSystem(const LinearSystem &rhs)
Definition: NekLinSys.hpp:430
unsigned int m_numberOfSuperDiagonals
Definition: NekLinSys.hpp:695
unsigned int m_numberOfSubDiagonals
Definition: NekLinSys.hpp:694
MatrixStorage m_matrixType
Definition: NekLinSys.hpp:696
unsigned int GetRows() const
Definition: NekLinSys.hpp:492
def copy(self)
Definition: pycml.py:2663
static void Dpptrs(const char &uplo, const int &n, const int &nrhs, const double *ap, double *b, const int &ldb, int &info)
Solve a real positive definite symmetric matrix problem using Cholesky factorization.
Definition: Lapack.hpp:206
static void Dgbtrf(const int &m, const int &n, const int &kl, const int &ku, double *a, const int &lda, int *ipiv, int &info)
General banded matrix LU factorisation.
Definition: Lapack.hpp:231
static void Dsptrs(const char &uplo, const int &n, const int &nrhs, const double *ap, const int *ipiv, double *b, const int &ldb, int &info)
Solve a real packed-symmetric matrix problem using Bunch-Kaufman pivoting.
Definition: Lapack.hpp:154
static void Dgetrf(const int &m, const int &n, double *a, const int &lda, int *ipiv, int &info)
General matrix LU factorisation.
Definition: Lapack.hpp:262
static void Dpptrf(const char &uplo, const int &n, double *ap, int &info)
Cholesky factor a real positive definite packed-symmetric matrix.
Definition: Lapack.hpp:199
static void Dgetrs(const char &trans, const int &n, const int &nrhs, const double *a, const int &lda, int *ipiv, double *b, const int &ldb, int &info)
General matrix LU backsolve.
Definition: Lapack.hpp:269
static void Dsptrf(const char &uplo, const int &n, double *ap, int *ipiv, int &info)
factor a real packed-symmetric matrix using Bunch-Kaufman pivoting.
Definition: Lapack.hpp:128
static void Dpbtrf(const char &uplo, const int &n, const int &kd, double *ab, const int &ldab, int &info)
Cholesky factorize a real positive definite banded-symmetric matrix.
Definition: Lapack.hpp:215
static void Dgbtrs(const char &trans, const int &n, const int &kl, const int &ku, const int &nrhs, const double *a, const int &lda, const int *ipiv, double *b, const int &ldb, int &info)
Solve general banded matrix using LU factorisation.
Definition: Lapack.hpp:239
static void Dtptrs(const char &uplo, const char &trans, const char &diag, const int &n, const int &nrhs, const double *a, double *b, const int &ldb, int &info)
Solve a triangular system.
Definition: Lapack.hpp:184
static void Dpbtrs(const char &uplo, const int &n, const int &kd, const int &nrhs, const double *ab, const int &ldab, double *b, const int &ldb, int &info)
Solve a real, positive definite banded-symmetric matrix problem using Cholesky factorization.
Definition: Lapack.hpp:223
typename RawType< T >::type RawType_t
Definition: RawType.hpp:70
@ eLOWER_TRIANGULAR_BANDED
@ ePOSITIVE_DEFINITE_SYMMETRIC_BANDED
@ ePOSITIVE_DEFINITE_SYMMETRIC
@ eUPPER_TRIANGULAR_BANDED
PointerWrapper
Specifies if the pointer passed to a NekMatrix or NekVector is copied into an internal representation...
void CopyArray(const Array< OneD, ConstDataType > &source, Array< OneD, DataType > &dest)
STL namespace.
static unsigned int GetRequiredStorageSize(unsigned int totalRows, unsigned int totalColumns, unsigned int subDiags, unsigned int superDiags)
Calculates and returns the storage size required.
Definition: MatrixFuncs.cpp:42
static void SolveTranspose(const BVectorType &b, XVectorType &x, MatrixStorage m_matrixType, const Array< OneD, const int > &m_ipivot, unsigned int n, const Array< OneD, const double > &A, char m_transposeFlag, unsigned int m_numberOfSubDiagonals, unsigned int m_numberOfSuperDiagonals)
Definition: NekLinSys.hpp:235
static void Solve(const BVectorType &b, XVectorType &x, MatrixStorage m_matrixType, const Array< OneD, const int > &m_ipivot, unsigned int n, const Array< OneD, const double > &A, char m_transposeFlag, unsigned int m_numberOfSubDiagonals, unsigned int m_numberOfSuperDiagonals)
Definition: NekLinSys.hpp:75