36 #ifdef DEAL_II_WITH_UMFPACK 53 #ifdef DEAL_II_WITH_UMFPACK 62 umfpack_dl_defaults(
control.data());
84 std::vector<long int> tmp;
89 std::vector<long int> tmp;
94 std::vector<double> tmp;
99 std::vector<double> tmp;
103 umfpack_dl_defaults(
control.data());
108 template <
typename number>
119 for (
size_type row = 0; row < matrix.
m(); ++row)
132 long int cursor =
Ap[row];
133 while ((cursor <
Ap[row + 1] - 1) && (
Ai[cursor] >
Ai[cursor + 1]))
148 template <
typename number>
153 for (
size_type row = 0; row < matrix.
m(); ++row)
155 long int cursor =
Ap[row];
156 while ((cursor <
Ap[row + 1] - 1) && (
Ai[cursor] >
Ai[cursor + 1]))
171 template <
typename number>
180 for (
size_type row = 0; row < matrix.
m(); ++row)
182 long int cursor =
Ap[row];
186 while ((cursor <
Ap[row + 1] - 1) && (
Ai[cursor] <
Ai[cursor + 1]))
190 if (cursor ==
Ap[row + 1] - 1)
195 long int element = cursor;
196 while ((element <
Ap[row + 1] - 1) && (
Ai[element] >
Ai[element + 1]))
212 template <
class Matrix>
220 using number =
typename Matrix::value_type;
246 Ai.resize(matrix.n_nonzero_elements());
247 Ax.resize(matrix.n_nonzero_elements());
249 Az.resize(matrix.n_nonzero_elements());
254 Ap[row] =
Ap[row - 1] + matrix.get_row_length(row - 1);
264 std::vector<long int> row_pointers =
Ap;
268 for (
size_type row = 0; row < matrix.m(); ++row)
270 for (
typename Matrix::const_iterator p = matrix.begin(row);
271 p != matrix.end(row);
275 Ai[row_pointers[row]] = p->column();
276 Ax[row_pointers[row]] = std::real(p->value());
278 Az[row_pointers[row]] = std::imag(p->value());
297 status = umfpack_dl_symbolic(N,
306 status = umfpack_zl_symbolic(N,
319 status = umfpack_dl_numeric(
Ap.data(),
327 status = umfpack_zl_numeric(
Ap.data(),
353 ExcMessage(
"You have previously factored a matrix using this class " 354 "that had complex-valued entries. This then requires " 355 "applying the factored matrix to a complex-valued " 356 "vector, but you are only providing a real-valued vector " 360 rhs = rhs_and_solution;
368 const int status = umfpack_dl_solve(transpose ? UMFPACK_A : UMFPACK_At,
372 rhs_and_solution.
begin(),
387 # ifdef DEAL_II_WITH_COMPLEX_VALUES 417 for (
unsigned int i = 0; i < rhs_and_solution.size(); ++i)
419 rhs_re(i) = std::real(rhs_and_solution(i));
420 rhs_im(i) = std::imag(rhs_and_solution(i));
435 const int status = umfpack_zl_solve(transpose ? UMFPACK_A : UMFPACK_Aat,
451 for (
unsigned int i = 0; i < rhs_and_solution.size(); ++i)
452 rhs_and_solution(i) = {solution_re(i), solution_im(i)};
460 const Vector<std::complex<double>> rhs = rhs_and_solution;
467 for (
unsigned int i = 0; i < rhs.size(); ++i)
468 rhs_real_or_imag(i) = std::real(rhs(i));
470 solve(rhs_real_or_imag, transpose);
472 rhs_and_solution = rhs_real_or_imag;
477 for (
unsigned int i = 0; i < rhs.size(); ++i)
478 rhs_real_or_imag(i) = std::imag(rhs(i));
480 solve(rhs_real_or_imag, transpose);
482 for (
unsigned int i = 0; i < rhs.size(); ++i)
483 rhs_and_solution(i).imag(rhs_real_or_imag(i));
488 (void)rhs_and_solution;
492 "This function can't be called if deal.II has been configured " 493 "with DEAL_II_WITH_COMPLEX_VALUES=FALSE."));
506 tmp = rhs_and_solution;
507 solve(tmp, transpose);
508 rhs_and_solution = tmp;
517 # ifdef DEAL_II_WITH_COMPLEX_VALUES 521 Vector<std::complex<double>> tmp(rhs_and_solution.size());
522 tmp = rhs_and_solution;
523 solve(tmp, transpose);
524 rhs_and_solution = tmp;
527 (void)rhs_and_solution;
531 "This function can't be called if deal.II has been configured " 532 "with DEAL_II_WITH_COMPLEX_VALUES=FALSE."));
538 template <
class Matrix>
545 solve(rhs_and_solution, transpose);
550 template <
class Matrix>
553 Vector<std::complex<double>> &rhs_and_solution,
556 # ifdef DEAL_II_WITH_COMPLEX_VALUES 558 solve(rhs_and_solution, transpose);
563 (void)rhs_and_solution;
567 "This function can't be called if deal.II has been configured " 568 "with DEAL_II_WITH_COMPLEX_VALUES=FALSE."));
574 template <
class Matrix>
581 solve(rhs_and_solution, transpose);
586 template <
class Matrix>
589 BlockVector<std::complex<double>> &rhs_and_solution,
592 # ifdef DEAL_II_WITH_COMPLEX_VALUES 594 solve(rhs_and_solution, transpose);
599 (void)rhs_and_solution;
603 "This function can't be called if deal.II has been configured " 604 "with DEAL_II_WITH_COMPLEX_VALUES=FALSE."));
626 template <
class Matrix>
633 "To call this function you need UMFPACK, but you configured deal.II " 634 "without passing the necessary switch to 'cmake'. Please consult the " 635 "installation instructions in doc/readme.html."));
645 "To call this function you need UMFPACK, but you configured deal.II " 646 "without passing the necessary switch to 'cmake'. Please consult the " 647 "installation instructions in doc/readme.html."));
658 "To call this function you need UMFPACK, but you configured deal.II " 659 "without passing the necessary switch to 'cmake'. Please consult the " 660 "installation instructions in doc/readme.html."));
671 "To call this function you need UMFPACK, but you configured deal.II " 672 "without passing the necessary switch to 'cmake'. Please consult the " 673 "installation instructions in doc/readme.html."));
685 "To call this function you need UMFPACK, but you configured deal.II " 686 "without passing the necessary switch to 'cmake'. Please consult the " 687 "installation instructions in doc/readme.html."));
692 template <
class Matrix>
699 "To call this function you need UMFPACK, but you configured deal.II " 700 "without passing the necessary switch to 'cmake'. Please consult the " 701 "installation instructions in doc/readme.html."));
706 template <
class Matrix>
709 Vector<std::complex<double>> &,
715 "To call this function you need UMFPACK, but you configured deal.II " 716 "without passing the necessary switch to 'cmake'. Please consult the " 717 "installation instructions in doc/readme.html."));
722 template <
class Matrix>
729 "To call this function you need UMFPACK, but you configured deal.II " 730 "without passing the necessary switch to 'cmake'. Please consult the " 731 "installation instructions in doc/readme.html."));
736 template <
class Matrix>
745 "To call this function you need UMFPACK, but you configured deal.II " 746 "without passing the necessary switch to 'cmake'. Please consult the " 747 "installation instructions in doc/readme.html."));
753 template <
class Matrix>
784 this->
solve(dst,
true);
794 this->
solve(dst,
true);
813 #define InstantiateUMFPACK(MatrixType) \ 814 template void SparseDirectUMFPACK::factorize(const MatrixType &); \ 815 template void SparseDirectUMFPACK::solve(const MatrixType &, \ 818 template void SparseDirectUMFPACK::solve(const MatrixType &, \ 819 Vector<std::complex<double>> &, \ 821 template void SparseDirectUMFPACK::solve(const MatrixType &, \ 822 BlockVector<double> &, \ 824 template void SparseDirectUMFPACK::solve( \ 825 const MatrixType &, BlockVector<std::complex<double>> &, const bool); \ 826 template void SparseDirectUMFPACK::initialize(const MatrixType &, \ 827 const AdditionalData) 838 #ifdef DEAL_II_WITH_COMPLEX_VALUES static ::ExceptionBase & ExcUMFPACKError(std::string arg1, int arg2)
void * symbolic_decomposition
Contents is actually a matrix.
std::vector< types::suitesparse_index > Ai
static ::ExceptionBase & ExcNotInitialized()
#define AssertThrow(cond, exc)
void factorize(const Matrix &matrix)
#define InstantiateUMFPACK(MatrixType)
void vmult(Vector< double > &dst, const Vector< double > &src) const
unsigned int n_block_cols() const
static ::ExceptionBase & ExcMessage(std::string arg1)
void solve(Vector< double > &rhs_and_solution, const bool transpose=false) const
#define Assert(cond, exc)
#define DEAL_II_NAMESPACE_CLOSE
void * numeric_decomposition
std::vector< double > control
static ::ExceptionBase & ExcNotQuadratic()
void swap(MemorySpaceData< Number, MemorySpace > &, MemorySpaceData< Number, MemorySpace > &)
void initialize(const SparsityPattern &sparsity_pattern)
#define DEAL_II_NAMESPACE_OPEN
std::vector< types::suitesparse_index > Ap
~SparseDirectUMFPACK() override
void Tvmult(Vector< double > &dst, const Vector< double > &src) const
void sort_arrays(const SparseMatrixEZ< number > &)
static ::ExceptionBase & ExcInternalError()