BandMatrix.cpp
1 #include "SeldonFlag.hxx"
2 
3 #include "SeldonSolverHeader.hxx"
4 #include "SeldonSolverInline.hxx"
5 
6 #include "matrix_sparse/BandMatrix.hxx"
7 #include "matrix_sparse/BandMatrixInline.cxx"
8 
9 #ifndef SELDON_WITH_COMPILED_LIBRARY
10 #include "matrix_sparse/BandMatrix.cxx"
11 #include "computation/basic_functions/Functions_Base.cxx"
12 #include "computation/basic_functions/Functions_MatVect.cxx"
13 #endif
14 
15 namespace Seldon
16 {
17  /* BandedCol */
18 
19  SELDON_EXTERN template class Matrix_Band<Real_wp, General, BandedCol>;
20  SELDON_EXTERN template class Matrix_Band<Complex_wp, General, BandedCol>;
21 
22  SELDON_EXTERN template class Matrix<Real_wp, General, BandedCol>;
23  SELDON_EXTERN template class Matrix<Complex_wp, General, BandedCol>;
24 
25  SELDON_EXTERN template void Matrix_Band<Real_wp, General, BandedCol>::Fill(const int&);
26  SELDON_EXTERN template void Matrix_Band<Real_wp, General, BandedCol>::Fill(const Real_wp&);
27  SELDON_EXTERN template void Matrix_Band<Real_wp, General, BandedCol>::Solve(Vector<Real_wp>&) const;
28  SELDON_EXTERN template void Matrix_Band<Real_wp, General, BandedCol>::Solve(Vector<Complex_wp>&) const;
29  SELDON_EXTERN template void Matrix_Band<Complex_wp, General, BandedCol>::Solve(Vector<Complex_wp>&) const;
30  SELDON_EXTERN template void Matrix_Band<Real_wp, General, BandedCol>::Solve(const Vector<int>&, Vector<Real_wp>&) const;
31  SELDON_EXTERN template void Matrix_Band<Real_wp, General, BandedCol>::Solve(const Vector<int>&, Vector<Complex_wp>&) const;
32  SELDON_EXTERN template void Matrix_Band<Complex_wp, General, BandedCol>::Solve(const Vector<int>&, Vector<Complex_wp>&) const;
33  SELDON_EXTERN template void Matrix_Band<Real_wp, General, BandedCol>::Add_(const Real_wp&, const Matrix<Real_wp, General, BandedCol>&);
34 
35 
36  SELDON_EXTERN template void Matrix_Band<Complex_wp, General, BandedCol>::Fill(const int&);
37  SELDON_EXTERN template void Matrix_Band<Complex_wp, General, BandedCol>::Fill(const Real_wp&);
38  SELDON_EXTERN template void Matrix_Band<Complex_wp, General, BandedCol>::Fill(const Complex_wp&);
39  SELDON_EXTERN template void Matrix_Band<Complex_wp, General, BandedCol>::Add_(const Complex_wp&, const Matrix<Complex_wp, General, BandedCol>&);
40 
41  SELDON_EXTERN template void GetLU(Matrix<Real_wp, General, BandedCol>&, Matrix<Real_wp, General, BandedCol>&, bool);
42  SELDON_EXTERN template void GetLU(Matrix<Real_wp, General, BandedCol>&);
43  SELDON_EXTERN template void GetLU(Matrix<Complex_wp, General, BandedCol>&, Matrix<Complex_wp, General, BandedCol>&, bool);
44  SELDON_EXTERN template void GetLU(Matrix<Complex_wp, General, BandedCol>&);
45 
46  SELDON_EXTERN template void GetLU(Matrix<Real_wp, General, BandedCol>&, Vector<int>&, LapackInfo&);
47  SELDON_EXTERN template void SolveLU(const Matrix<Real_wp, General, BandedCol>&, const Vector<int>&, Vector<Real_wp>&, LapackInfo&);
48  SELDON_EXTERN template void SolveLU(const Matrix<Real_wp, General, BandedCol>&, const Vector<int>&, Vector<Complex_wp>&, LapackInfo&);
49 
50  SELDON_EXTERN template void GetLU(Matrix<Complex_wp, General, BandedCol>&, Vector<int>&, LapackInfo&);
51  SELDON_EXTERN template void SolveLU(const Matrix<Complex_wp, General, BandedCol>&, const Vector<int>&, Vector<Complex_wp>&, LapackInfo&);
52 
53  SELDON_EXTERN template void Copy(const Matrix<Real_wp, General, ArrayRowSparse>&, Matrix<Real_wp, General, BandedCol>&);
54  SELDON_EXTERN template void Copy(const Matrix<Complex_wp, General, ArrayRowSparse>&, Matrix<Complex_wp, General, BandedCol>&);
55 
56  SELDON_EXTERN template void AddMatrix(const Real_wp&, const Matrix<Real_wp, General, BandedCol>&, Matrix<Real_wp, General, BandedCol>&);
57  SELDON_EXTERN template void AddMatrix(const Complex_wp&, const Matrix<Complex_wp, General, BandedCol>&, Matrix<Complex_wp, General, BandedCol>&);
58 
59  SELDON_EXTERN template void MltAddVector(const Real_wp&, const Matrix<Real_wp, General, BandedCol>&, const Vector<Real_wp>&, const Real_wp&, Vector<Real_wp>&);
60  SELDON_EXTERN template void MltAddVector(const Complex_wp&, const Matrix<Complex_wp, General, BandedCol>&, const Vector<Complex_wp>&, const Complex_wp&, Vector<Complex_wp>&);
61  SELDON_EXTERN template void MltAddVector(const Real_wp&, const SeldonTranspose&, const Matrix<Real_wp, General, BandedCol>&, const Vector<Real_wp>&, const Real_wp&, Vector<Real_wp>&);
62  SELDON_EXTERN template void MltAddVector(const Real_wp&, const SeldonTranspose&, const Matrix<Real_wp, General, BandedCol>&, const Vector<Complex_wp>&, const Real_wp&, Vector<Complex_wp>&);
63  SELDON_EXTERN template void MltAddVector(const Complex_wp&, const SeldonTranspose&, const Matrix<Complex_wp, General, BandedCol>&, const Vector<Complex_wp>&, const Complex_wp&, Vector<Complex_wp>&);
64 
65  SELDON_EXTERN template void MltVector(const Matrix<Real_wp, General, BandedCol>&, const Vector<Real_wp>&, Vector<Real_wp>&);
66  SELDON_EXTERN template void MltVector(const SeldonTranspose&, const Matrix<Real_wp, General, BandedCol>&, const Vector<Real_wp>&, Vector<Real_wp>&);
67  SELDON_EXTERN template void MltVector(const Matrix<Complex_wp, General, BandedCol>&, const Vector<Complex_wp>&, Vector<Complex_wp>&);
68  SELDON_EXTERN template void MltVector(const SeldonTranspose&, const Matrix<Complex_wp, General, BandedCol>&, const Vector<Complex_wp>&, Vector<Complex_wp>&);
69 
70  SELDON_EXTERN template void MltScalar(const Real_wp&, Matrix<Real_wp, General, BandedCol>&);
71  SELDON_EXTERN template void MltScalar(const Complex_wp&, Matrix<Complex_wp, General, BandedCol>&);
72 
73  SELDON_EXTERN template void ScaleMatrix(Matrix<Real_wp, General, BandedCol>&, const Vector<Real_wp>&, const Vector<Real_wp>&);
74  SELDON_EXTERN template void ScaleMatrix(Matrix<Complex_wp, General, BandedCol>&, const Vector<Real_wp>&, const Vector<Real_wp>&);
75 
76  SELDON_EXTERN template void SorVector(const Matrix<Complex_wp, General, BandedCol>&, Vector<Complex_wp>&, const Vector<Complex_wp>&, const Real_wp&, int, int);
77  SELDON_EXTERN template void SorVector(const SeldonTranspose&, const Matrix<Complex_wp, General, BandedCol>&, Vector<Complex_wp>&, const Vector<Complex_wp>&, const Real_wp&, int, int);
78 
79  SELDON_EXTERN template void SorVector(const Matrix<Real_wp, General, BandedCol>&, Vector<Real_wp>&, const Vector<Real_wp>&, const Real_wp&, int, int);
80  SELDON_EXTERN template void SorVector(const SeldonTranspose&, const Matrix<Real_wp, General, BandedCol>&, Vector<Real_wp>&, const Vector<Real_wp>&, const Real_wp&, int, int);
81  SELDON_EXTERN template void SorVector(const Matrix<Real_wp, General, BandedCol>&, Vector<Complex_wp>&, const Vector<Complex_wp>&, const Real_wp&, int, int);
82  SELDON_EXTERN template void SorVector(const SeldonTranspose&, const Matrix<Real_wp, General, BandedCol>&, Vector<Complex_wp>&, const Vector<Complex_wp>&, const Real_wp&, int, int);
83 
84  /* ArrowCol */
85 
86  SELDON_EXTERN template class Matrix_Band<Real_wp, General, ArrowCol>;
87  SELDON_EXTERN template class Matrix_Band<Complex_wp, General, ArrowCol>;
88 
89  SELDON_EXTERN template class Matrix_Arrow<Real_wp, General, ArrowCol>;
90  SELDON_EXTERN template class Matrix_Arrow<Complex_wp, General, ArrowCol>;
91 
92  SELDON_EXTERN template class Matrix<Real_wp, General, ArrowCol>;
93  SELDON_EXTERN template class Matrix<Complex_wp, General, ArrowCol>;
94 
95  SELDON_EXTERN template void Matrix_Band<Real_wp, General, ArrowCol>::Fill(const int&);
96  SELDON_EXTERN template void Matrix_Band<Real_wp, General, ArrowCol>::Fill(const Real_wp&);
97 
98  SELDON_EXTERN template void Matrix_Band<Complex_wp, General, ArrowCol>::Fill(const int&);
99  SELDON_EXTERN template void Matrix_Band<Complex_wp, General, ArrowCol>::Fill(const Real_wp&);
100  SELDON_EXTERN template void Matrix_Band<Complex_wp, General, ArrowCol>::Fill(const Complex_wp&);
101 
102  SELDON_EXTERN template void Matrix_Arrow<Real_wp, General, ArrowCol>::Fill(const int&);
103  SELDON_EXTERN template void Matrix_Arrow<Real_wp, General, ArrowCol>::Fill(const Real_wp&);
104 
105  SELDON_EXTERN template void Matrix_Arrow<Complex_wp, General, ArrowCol>::Fill(const int&);
106  SELDON_EXTERN template void Matrix_Arrow<Complex_wp, General, ArrowCol>::Fill(const Real_wp&);
107  SELDON_EXTERN template void Matrix_Arrow<Complex_wp, General, ArrowCol>::Fill(const Complex_wp&);
108  SELDON_EXTERN template void Matrix_Arrow<Real_wp, General, ArrowCol>::Solve(Vector<Real_wp>&) const;
109  SELDON_EXTERN template void Matrix_Arrow<Real_wp, General, ArrowCol>::Solve(Vector<Complex_wp>&) const;
110  SELDON_EXTERN template void Matrix_Arrow<Complex_wp, General, ArrowCol>::Solve(Vector<Complex_wp>&) const;
111 
112  SELDON_EXTERN template void GetLU(Matrix<Real_wp, General, ArrowCol>&, Matrix<Real_wp, General, ArrowCol>&, bool);
113  SELDON_EXTERN template void GetLU(Matrix<Complex_wp, General, ArrowCol>&, Matrix<Complex_wp, General, ArrowCol>&, bool);
114  SELDON_EXTERN template void GetLU(Matrix<Real_wp, General, ArrowCol>&);
115  SELDON_EXTERN template void GetLU(Matrix<Complex_wp, General, ArrowCol>&);
116 
117  SELDON_EXTERN template void AddMatrix(const Real_wp&, const Matrix<Real_wp, General, ArrowCol>&, Matrix<Real_wp, General, ArrowCol>&);
118  SELDON_EXTERN template void AddMatrix(const Complex_wp&, const Matrix<Complex_wp, General, ArrowCol>&, Matrix<Complex_wp, General, ArrowCol>&);
119 
120  SELDON_EXTERN template void Matrix_Arrow<Real_wp, General, ArrowCol>::MltAdd(const Real_wp&, const SeldonTranspose&, const Vector<Real_wp>&, Vector<Real_wp>&) const;
121  SELDON_EXTERN template void Matrix_Arrow<Real_wp, General, ArrowCol>::MltAdd(const Complex_wp&, const SeldonTranspose&, const Vector<Complex_wp>&, Vector<Complex_wp>&) const;
122  SELDON_EXTERN template void Matrix_Arrow<Complex_wp, General, ArrowCol>::MltAdd(const Complex_wp&, const SeldonTranspose&, const Vector<Complex_wp>&, Vector<Complex_wp>&) const;
123 
124  SELDON_EXTERN template void MltAddVector(const Real_wp&, const Matrix<Real_wp, General, ArrowCol>&, const Vector<Real_wp>&, const Real_wp&, Vector<Real_wp>&);
125  SELDON_EXTERN template void MltAddVector(const Complex_wp&, const Matrix<Complex_wp, General, ArrowCol>&, const Vector<Complex_wp>&, const Complex_wp&, Vector<Complex_wp>&);
126  SELDON_EXTERN template void MltAddVector(const Real_wp&, const SeldonTranspose&, const Matrix<Real_wp, General, ArrowCol>&, const Vector<Real_wp>&, const Real_wp&, Vector<Real_wp>&);
127  SELDON_EXTERN template void MltAddVector(const Complex_wp&, const SeldonTranspose&, const Matrix<Complex_wp, General, ArrowCol>&, const Vector<Complex_wp>&, const Complex_wp&, Vector<Complex_wp>&);
128 
129  SELDON_EXTERN template void MltVector(const Matrix<Real_wp, General, ArrowCol>&, const Vector<Real_wp>&, Vector<Real_wp>&);
130  SELDON_EXTERN template void MltVector(const SeldonTranspose&, const Matrix<Real_wp, General, ArrowCol>&, const Vector<Real_wp>&, Vector<Real_wp>&);
131  SELDON_EXTERN template void MltVector(const Matrix<Complex_wp, General, ArrowCol>&, const Vector<Complex_wp>&, Vector<Complex_wp>&);
132  SELDON_EXTERN template void MltVector(const SeldonTranspose&, const Matrix<Complex_wp, General, ArrowCol>&, const Vector<Complex_wp>&, Vector<Complex_wp>&);
133 
134  SELDON_EXTERN template void MltScalar(const Real_wp&, Matrix<Real_wp, General, ArrowCol>&);
135  SELDON_EXTERN template void MltScalar(const Complex_wp&, Matrix<Complex_wp, General, ArrowCol>&);
136 
137  SELDON_EXTERN template void SorVector(const Matrix<Complex_wp, General, ArrowCol>&, Vector<Complex_wp>&, const Vector<Complex_wp>&, const Real_wp&, int, int);
138  SELDON_EXTERN template void SorVector(const SeldonTranspose&, const Matrix<Complex_wp, General, ArrowCol>&, Vector<Complex_wp>&, const Vector<Complex_wp>&, const Real_wp&, int, int);
139 
140  SELDON_EXTERN template void SorVector(const Matrix<Real_wp, General, ArrowCol>&, Vector<Real_wp>&, const Vector<Real_wp>&, const Real_wp&, int, int);
141  SELDON_EXTERN template void SorVector(const SeldonTranspose&, const Matrix<Real_wp, General, ArrowCol>&, Vector<Real_wp>&, const Vector<Real_wp>&, const Real_wp&, int, int);
142 
143 }
Seldon::Matrix_Band::Add_
void Add_(const T0 &alpha, const Matrix< T, General, BandedCol, Allocator > &A)
performs the operation *this = *this + alpha A
Definition: BandMatrix.cxx:311
Seldon::Matrix_Arrow::Fill
void Fill(const T0 &x)
sets all non-zero entries to a same value
Definition: BandMatrix.cxx:720
Seldon::MltScalar
void MltScalar(const T0 &alpha, Array3D< T, Allocator > &A)
Multiplication of all elements of a 3D array by a scalar.
Definition: Array3D.cxx:539
Seldon::Matrix_Band::Solve
void Solve(Vector< T1 > &x) const
solves A x = b, assuming that Factorize has been previously called
Definition: BandMatrix.cxx:384
Seldon::Matrix_Arrow::Solve
void Solve(Vector< T1 > &x) const
solves A x = b, assuming that Factorize has been previously called
Definition: BandMatrix.cxx:983
Seldon::GetLU
void GetLU(Matrix< T0, Prop0, Storage0, Allocator0 > &A)
Returns the LU factorization of a matrix.
Definition: Functions_Matrix.cxx:2073
Seldon::Matrix_Band::Fill
void Fill(const T0 &x)
sets all non-zero entries to a same value
Definition: BandMatrix.cxx:178
Seldon::SorVector
void SorVector(const Matrix< T0, Prop0, Storage0, Allocator0 > &M, Vector< T2, Storage2, Allocator2 > &Y, const Vector< T1, Storage1, Allocator1 > &X, const T3 &omega, int iter, int type_ssor)
Solve M Y = X with S.O.R. method.
Definition: Functions_MatVect.cxx:1638
Seldon
Seldon namespace.
Definition: Array.cxx:24
Seldon::AddMatrix
void AddMatrix(const T0 &alpha, const Matrix< T1, Prop1, Storage1, Allocator1 > &A, Matrix< T2, Prop2, Storage2, Allocator2 > &B)
Adds two matrices.
Definition: Functions_Matrix.cxx:1619
Seldon::Matrix_Arrow::MltAdd
void MltAdd(const T0 &alpha, const SeldonTranspose &trans, const Vector< T1 > &x, Vector< T1 > &y) const
performs matrix-vector product y = y + alpha A x
Definition: BandMatrix.cxx:884