fmatvec  0.0.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
linear_algebra_complex.h
1 /* Copyright (C) 2003-2014 Martin Förg
2 
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact:
18  * martin.o.foerg@googlemail.com
19  *
20  */
21 
22 #ifndef linear_algebraz_h
23 #define linear_algebraz_h
24 
25 #include "square_matrix.h"
26 #include "vector.h"
27 #include "row_vector.h"
28 #include "diagonal_matrix.h"
29 #include "symmetric_matrix.h"
30 #include "band_matrix.h"
31 #include <complex>
32 
33 //-------------------------------------
34 // Matrix operations
35 //-------------------------------------
36 
37 namespace fmatvec {
38 
48  FMATVEC_EXPORT Vector<Ref, std::complex<double>> slvLU(const SquareMatrix<Ref, std::complex<double>> &A, const Vector<Ref, std::complex<double>> &b);
49 
50  // Because template argument deduction does not consider implicit conversions, the complex standard operators
51  // cannot be used for mixed integer/complex arithmetic. Hence, we define these here for mixed
52  // integer/complex arithmetic.
53  template<class T> std::complex<T> operator+(const std::complex<T> &x, int y) { return x+static_cast<T>(y); }
54  template<class T> std::complex<T> operator-(const std::complex<T> &x, int y) { return x+static_cast<T>(y); }
55  template<class T> std::complex<T> operator*(const std::complex<T> &x, int y) { return x+static_cast<T>(y); }
56  template<class T> std::complex<T> operator/(const std::complex<T> &x, int y) { return x+static_cast<T>(y); }
57  template<class T> std::complex<T> operator+(int x, const std::complex<T> &y) { return static_cast<T>(x)+y; }
58  template<class T> std::complex<T> operator-(int x, const std::complex<T> &y) { return static_cast<T>(x)+y; }
59  template<class T> std::complex<T> operator*(int x, const std::complex<T> &y) { return static_cast<T>(x)+y; }
60  template<class T> std::complex<T> operator/(int x, const std::complex<T> &y) { return static_cast<T>(x)+y; }
61 
62 }
63 
64 #endif
Vector< Ref, std::complex< double > > slvLU(const SquareMatrix< Ref, std::complex< double >> &A, const Vector< Ref, std::complex< double >> &x)
System of linear equations.
Definition: linear_algebra_complex.cc:47