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(), eVECTOR_WRAPPER), 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(), eVECTOR_WRAPPER), 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
446 {
447 }
448
449 // In the following calls to Solve, VectorType must be a NekVector.
450 // Anything else won't compile.
451 template <typename VectorType>
452 RawType_t<VectorType> Solve(const VectorType &b)
453 {
460 return x;
461 }
462
463 template <typename BType, typename XType>
464 void Solve(const BType &b, XType &x) const
465 {
471 }
472
473 // Transpose variant of solve
474 template <typename VectorType>
476 {
483 return x;
484 }
485
486 template <typename BType, typename XType>
487 void SolveTranspose(const BType &b, XType &x) const
488 {
494 }
495
496 unsigned int GetRows() const
497 {
498 return n;
499 }
500 unsigned int GetColumns() const
501 {
502 return n;
503 }
504
505private:
506 template <typename MatrixType> void FactorMatrix(const MatrixType &theA)
507 {
508 switch (m_matrixType)
509 {
510 case eFULL:
511 {
512 int m = theA.GetRows();
513 int n = theA.GetColumns();
514
515 int pivotSize = std::max(1, std::min(m, n));
516 int info = 0;
517 m_ipivot = Array<OneD, int>(pivotSize);
518
519 Lapack::Dgetrf(m, n, A.get(), m, m_ipivot.get(), info);
520
521 if (info < 0)
522 {
523 std::string message =
524 "ERROR: The " + std::to_string(-info) +
525 "th parameter had an illegal parameter for dgetrf";
526 ASSERTL0(false, message.c_str());
527 }
528 else if (info > 0)
529 {
530 std::string message =
531 "ERROR: Element u_" + std::to_string(info) +
532 std::to_string(info) + " is 0 from dgetrf";
533 ASSERTL0(false, message.c_str());
534 }
535 }
536 break;
537 case eDIAGONAL:
538 for (unsigned int i = 0; i < theA.GetColumns(); ++i)
539 {
540 A[i] = 1.0 / theA(i, i);
541 }
542 break;
545 break;
546 case eSYMMETRIC:
547 {
548 int info = 0;
549 int pivotSize = theA.GetRows();
550 m_ipivot = Array<OneD, int>(pivotSize);
551
552 Lapack::Dsptrf('U', theA.GetRows(), A.get(), m_ipivot.get(),
553 info);
554
555 if (info < 0)
556 {
557 std::string message =
558 "ERROR: The " + std::to_string(-info) +
559 "th parameter had an illegal parameter for dsptrf";
560 NEKERROR(ErrorUtil::efatal, message.c_str());
561 }
562 else if (info > 0)
563 {
564 std::string message =
565 "ERROR: Element u_" + std::to_string(info) +
566 std::to_string(info) + " is 0 from dsptrf";
567 NEKERROR(ErrorUtil::efatal, message.c_str());
568 }
569 }
570 break;
572 {
573 int info = 0;
574 Lapack::Dpptrf('U', theA.GetRows(), A.get(), info);
575
576 if (info < 0)
577 {
578 std::string message =
579 "ERROR: The " + std::to_string(-info) +
580 "th parameter had an illegal parameter for dpptrf";
581 NEKERROR(ErrorUtil::efatal, message.c_str());
582 }
583 else if (info > 0)
584 {
585 std::string message =
586 "ERROR: The leading minor of order " +
587 std::to_string(info) +
588 " is not positive definite from dpptrf";
589 NEKERROR(ErrorUtil::efatal, message.c_str());
590 }
591 }
592 break;
593 case eBANDED:
594 {
595 int M = n;
596 int N = n;
597 int KL = m_numberOfSubDiagonals;
599
600 // The array we pass in to dgbtrf must have enough space for KL
601 // subdiagonals and KL+KU superdiagonals (see lapack users
602 // guide, in the section discussing band storage.
603 unsigned int requiredStorageSize =
605 KL + KU);
606
607 unsigned int rawRows = KL + KU + 1;
608 A = Array<OneD, double>(requiredStorageSize);
609
610 // Put the extra elements up front.
611 for (unsigned int i = 0; i < theA.GetColumns(); ++i)
612 {
613 std::copy(theA.GetRawPtr() + i * rawRows,
614 theA.GetRawPtr() + (i + 1) * rawRows,
615 A.get() + (i + 1) * KL + i * rawRows);
616 }
617
618 int info = 0;
619 int pivotSize = theA.GetRows();
620 m_ipivot = Array<OneD, int>(pivotSize);
621
622 Lapack::Dgbtrf(M, N, KL, KU, A.get(), 2 * KL + KU + 1,
623 m_ipivot.get(), info);
624
625 if (info < 0)
626 {
627 std::string message =
628 "ERROR: The " + std::to_string(-info) +
629 "th parameter had an illegal parameter for dgbtrf";
630 NEKERROR(ErrorUtil::efatal, message.c_str());
631 }
632 else if (info > 0)
633 {
634 std::string message =
635 "ERROR: Element u_" + std::to_string(info) +
636 std::to_string(info) + " is 0 from dgbtrf";
637 NEKERROR(ErrorUtil::efatal, message.c_str());
638 }
639 }
640 break;
642 {
643 ASSERTL1(
645 std::string("Number of sub- and superdiagonals should ") +
646 std::string("be equal for a symmetric banded matrix"));
647
649 int info = 0;
650 Lapack::Dpbtrf('U', theA.GetRows(), KU, A.get(), KU + 1, info);
651
652 if (info < 0)
653 {
654 std::string message =
655 "ERROR: The " + std::to_string(-info) +
656 "th parameter had an illegal parameter for dpbtrf";
657 NEKERROR(ErrorUtil::efatal, message.c_str());
658 }
659 else if (info > 0)
660 {
661 std::string message =
662 "ERROR: The leading minor of order " +
663 std::to_string(info) +
664 " is not positive definite from dpbtrf";
665 NEKERROR(ErrorUtil::efatal, message.c_str());
666 }
667 }
668 break;
670 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
671 break;
673 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
674 break;
676 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
677 break;
678
679 default:
680 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
681 }
682 }
683
685 {
686 std::swap(n, rhs.n);
687 std::swap(A, rhs.A);
688 std::swap(m_ipivot, rhs.m_ipivot);
691 std::swap(m_matrixType, rhs.m_matrixType);
692 std::swap(m_transposeFlag, rhs.m_transposeFlag);
693 }
694
695 unsigned int n;
702};
703} // namespace Nektar
704
705#endif // NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_LINSYS_HPP
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:249
unsigned int GetColumns() const
Definition: NekLinSys.hpp:500
Array< OneD, double > A
Definition: NekLinSys.hpp:696
LinearSystem(const MatrixType &theA, PointerWrapper wrapperType=eCopy)
Definition: NekLinSys.hpp:406
void swap(LinearSystem &rhs)
Definition: NekLinSys.hpp:684
void Solve(const BType &b, XType &x) const
Definition: NekLinSys.hpp:464
LinearSystem(const std::shared_ptr< MatrixType > &theA, PointerWrapper wrapperType=eCopy)
Definition: NekLinSys.hpp:380
Array< OneD, int > m_ipivot
Definition: NekLinSys.hpp:697
void FactorMatrix(const MatrixType &theA)
Definition: NekLinSys.hpp:506
void SolveTranspose(const BType &b, XType &x) const
Definition: NekLinSys.hpp:487
RawType_t< VectorType > SolveTranspose(const VectorType &b)
Definition: NekLinSys.hpp:475
RawType_t< VectorType > Solve(const VectorType &b)
Definition: NekLinSys.hpp:452
LinearSystem & operator=(const LinearSystem &rhs)
Definition: NekLinSys.hpp:438
LinearSystem(const LinearSystem &rhs)
Definition: NekLinSys.hpp:430
unsigned int m_numberOfSuperDiagonals
Definition: NekLinSys.hpp:699
unsigned int m_numberOfSubDiagonals
Definition: NekLinSys.hpp:698
MatrixStorage m_matrixType
Definition: NekLinSys.hpp:700
unsigned int GetRows() const
Definition: NekLinSys.hpp:496
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
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
@ eVECTOR_WRAPPER
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)
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:44
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