gslpp_matrix_double.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 HEPfit Collaboration
3  * All rights reserved.
4  *
5  * For the licensing terms see doc/COPYING.
6  */
7 
8 #ifndef GSLPP_MATRIX_DOUBLE_H
9 #define GSLPP_MATRIX_DOUBLE_H
10 #include <iostream>
11 #ifndef __GSL_MATRIX_DOUBLE_H__
12 #include <gsl/gsl_matrix_double.h>
13 #endif
14 #ifndef GSLPP_COMPLEX_H
15 #ifndef __GSL_MATRIX_DOUBLE_H__
16 #include <gsl/gsl_matrix_double.h>
17 #endif
18 #include "gslpp_complex.h"
19 #endif
20 #ifndef GSLPP_VECTOR_BASE_H
21 #include "gslpp_vector_base.h"
22 #endif
23 #ifndef GSLPP_VECTOR_DOUBLE_H
24 #include "gslpp_vector_double.h"
25 #endif
26 #ifndef GSLPP_VECTOR_COMPLEX_H
27 #include "gslpp_vector_complex.h"
28 #endif
29 #ifndef GSLPP_MATRIX_BASE_H
30 #include "gslpp_matrix_base.h"
31 #endif
32 #ifndef GSLPP_MATRIX_COMPLEX_H
33 #include "gslpp_matrix_complex.h"
34 #endif
35 
36 namespace gslpp
37 {
47  template <>
48  class matrix<double>
49  {
50  gsl_matrix *_matrix;
51 
52  public:
54  matrix(const size_t& size_i, const size_t& size_j, const double& a);
55  matrix(const size_t& size_i, const double& a);
57  matrix(const matrix<double>& m);
58  matrix(const gsl_matrix& m);
59  matrix(const gsl_matrix* m);
60  matrix(const vector<double>& v);
62  ~matrix();
64  double operator()(const size_t& i, const size_t& j) const;
66  double& operator()(const size_t& i, const size_t& j);
68  matrix<double>& operator=(const matrix<double>& m);
69  matrix<double>& operator=(double a);
70  void assign(const size_t& i, const size_t& j, const double& a);
71  void assign(const size_t& i, const size_t& j, const matrix<double>& a);
73  size_t size_i() const;
74  size_t size_j() const;
76  static matrix<double> Id(size_t size);
78  matrix<double> transpose();
80  matrix<double> inverse();
82  double determinant();
84  void eigensystem(matrix<complex> &U, vector<complex> &S);
86  gsl_matrix* as_gsl_type_ptr() const;
87  gsl_matrix& as_gsl_type();
88  const gsl_matrix& as_gsl_type() const;
90  //bool is_equal(const matrix<double>& m1, const matrix<double>& m2);
91 
93  matrix<double> operator-() const;
105  matrix<double>& operator+=(const matrix<double>& m);
107  matrix<double>& operator-=(const matrix<double>& m);
109  matrix<double>& operator*=(const matrix<double>& m);
111  matrix<double> operator+(const double& a);
113  matrix<double> operator-(const double& a);
115  matrix<double> operator*(const double& a);
117  matrix<double> operator/(const double& a);
119  matrix<double>& operator+=(const double& a);
121  matrix<double>& operator-=(const double& a);
123  matrix<double>& operator*=(const double& a);
125  matrix<double>& operator/=(const double& a);
135  friend std::ostream& operator<<(std::ostream& output, const matrix<double>& m);
145  friend matrix<double> operator+(const double& a, matrix<double> m);
146 
153  friend matrix<double> operator-(const double& a, matrix<double> m);
154 
161  friend matrix<double> operator*(const double& a, matrix<double> m);
162 
170 
178 
185  friend matrix<complex> operator+(const complex& z, matrix<double> m);
186 
193  friend matrix<complex> operator-(const complex& z, matrix<double> m);
194 
201  friend matrix<complex> operator*(const complex& z, matrix<double> m);
204  };
205 
206 }
207 
208 #endif
complex operator*(const double &x1, const complex &z2)
A class for the form factor in .
A class for constructing and defining operations on real matrices.
A base class for defining operations on matrices, both real and complex.
A class for constructing and defining operations on complex vectors.
A class for constructing and defining operations on complex matrices.
complex operator/(const double &x1, const complex &z2)
A class for constructing and defining operations on real vectors.
complex operator+(const double &x1, const complex &z2)
A class for defining operations on and functions of complex numbers.
Definition: gslpp_complex.h:35
complex operator-(const double &x1, const complex &z2)
Complex number, vector and matrix manipulation using GSL.