KASKADE 7 development version
linalg/pardiso_solve.hh
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the library KASKADE 7 */
4/* https://www.zib.de/research/projects/kaskade7-finite-element-toolbox */
5/* */
6/* Copyright (C) 2002-2018 Zuse Institute Berlin */
7/* */
8/* KASKADE 7 is distributed under the terms of the ZIB Academic License. */
9/* see $KASKADE/academic.txt */
10/* */
11/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12
13#ifndef PARDISO_SOLVE_HH
14#define PARDISO_SOLVE_HH
15
16
17#include <vector>
18#include <memory>
19
21
22namespace Kaskade
23{
24
30template <class Scalar,class SparseIndexInt=int, class DIL=int>
31class PardisoFactorization: public Factorization<Scalar,SparseIndexInt>
32{
33public:
34
43 PardisoFactorization(SparseIndexInt n,
44 std::vector<SparseIndexInt>const & ridx,
45 std::vector<SparseIndexInt>const & cidx,
46 std::vector<Scalar>const & values,
48
50
52
54
59 virtual void solve(std::vector<Scalar> const& b,
60 std::vector<Scalar>& x, int n, bool transposed=false) const;
61
62 virtual void solve(std::vector<Scalar> const& b,
63 std::vector<Scalar>& x, bool transpose=false) const { solve(b,x,1,false); }
64
65 void solve(std::vector<Scalar>& b) const { solve(b,1,false); }
66
67 void solve(std::vector<Scalar>& b, int n, bool transposed=false) const
68 {
69 std::vector<Scalar> x(b.size());
70 solve(b,x,n,transposed);
71 std::swap(b,x);
72 }
73private:
74 int n;
75 std::vector<SparseIndexInt> ap, ai;
76 std::vector<Scalar> az;
77
78 int maxfct = 1;
79 int mnum = 1;
80 int mtype = 0;
81 mutable int phase = 11;
82 int nrhs = 1;
83 int msglvl = 0;
84 mutable int error = 0;
85 mutable int idum = 0;
86 mutable Scalar ddum = 0.0;
87 mutable std::array<int, 64> iparm {};
88 mutable std::array<void *, 64> pt {};
89};
90} // namespace Kaskade
91
92#endif
Abstract base class for matrix factorizations.
Factorization with DirectType::PARDISO.
PardisoFactorization(SparseIndexInt n, std::vector< SparseIndexInt >const &ridx, std::vector< SparseIndexInt >const &cidx, std::vector< Scalar >const &values, MatrixProperties property=MatrixProperties::GENERAL)
virtual void solve(std::vector< Scalar > const &b, std::vector< Scalar > &x, int n, bool transposed=false) const
void swap(PardisoFactorization &other)
virtual void solve(std::vector< Scalar > const &b, std::vector< Scalar > &x, bool transpose=false) const
Solves the system for the given right hand side .
void solve(std::vector< Scalar > &b, int n, bool transposed=false) const
void solve(std::vector< Scalar > &b) const
Solves the system for the given right hand side .
PardisoFactorization & operator=(PardisoFactorization &&other)
MatrixProperties
Characterizations of sparse matrix properties.
Definition: enums.hh:76
T transpose(T x)