xc
FT_matrix.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //FT_matrix.h
22 
23 #ifndef FT_MATRIX_H
24 #define FT_MATRIX_H
25 
26 #include "utility/matrices/ZMatrix.h"
27 #include "cgal_types.h"
28 #include <boost/python/list.hpp>
29 
30 
31 
32 //Elementos neutros para la suma y el producto.
33 GEOM_FT neutro_suma(const GEOM_FT &);
34 GEOM_FT neutro_producto(const GEOM_FT &);
35 
36 
38 //
40 class FT_matrix: public ZMatrix<GEOM_FT>
41  {
42  FT_matrix(const FT_matrix &orig,size_t f1, size_t c1, size_t f2, size_t c2);
43  public:
44  FT_matrix(void);
45  FT_matrix(size_type rows,size_type cols);
46  FT_matrix(size_type rows,size_type cols,GEOM_FT val);
47  template <class InputIterator>
48  FT_matrix(const size_t &,const size_t &,InputIterator ,InputIterator );
49  FT_matrix(const boost::python::list &l);
50  boost::python::list getPyList(void) const;
51  FT_matrix getBox(size_t f1, size_t c1, size_t f2, size_t c2) const;
52  FT_matrix getRow(size_t iRow) const;
53  FT_matrix getColumn(size_t col) const;
54  FT_matrix GetTrn(void) const;
55  friend FT_matrix operator+(const FT_matrix &a,const FT_matrix &b);
56  friend FT_matrix operator-(const FT_matrix &a,const FT_matrix &b);
57  friend FT_matrix operator*(const FT_matrix &a,const FT_matrix &b);
58  friend FT_matrix operator*(const GEOM_FT &d,const FT_matrix &a);
59  friend FT_matrix operator*(const FT_matrix &a,const GEOM_FT &d);
60  friend FT_matrix operator^(const FT_matrix &,const FT_matrix &v2);
61  };
62 
63 FT_matrix identity(const size_t &f);
64 FT_matrix identity(const FT_matrix &m);
65 FT_matrix traspuesta(const FT_matrix &m);
66 
67 
68 //Producto tensorial de dos tensores de primer orden.
69 FT_matrix prod_tensor(const FT_matrix &u,const FT_matrix &v);
70 
71 //Operador producto tensorial.
72 inline FT_matrix operator&(const FT_matrix &u,const FT_matrix &v)
73  { return prod_tensor(u,v); }
74 
75 void normalize(FT_matrix &m);
76 void NormalizeRows(FT_matrix &m);
77 FT_matrix normalize(const FT_matrix &m);
78 
79 FT_matrix operator-(const FT_matrix &m);
80 
81 ZMatrix<double> to_double(const FT_matrix &m);
82 FT_matrix from_double(const ZMatrix<double> &m);
83 
85 template <class InputIterator>
86 FT_matrix::FT_matrix(const size_t &n_rows,const size_t &n_columns,InputIterator b,InputIterator e)
87  : ZMatrix<GEOM_FT>(n_rows,n_columns,b,e) {}
88 
89 namespace boost
90  {
91  class any;
92  }
93 
94 #endif
Definition: FT_matrix.h:89
friend FT_matrix operator*(const FT_matrix &a, const FT_matrix &b)
Producto de matrices.
Definition: FT_matrix.cc:130
Matrix which element type has estructura de anillo respecto a las operaciones + y *...
Definition: ZMatrix.h:37
FT_matrix(void)
Constructor.
Definition: FT_matrix.cc:38
friend FT_matrix operator^(const FT_matrix &, const FT_matrix &v2)
Producto vectorial. ¡Ojo! está escrito para vectores de dimensión 3 xxx.
Definition: FT_matrix.cc:150
boost::python::list getPyList(void) const
Return the matrix values in a Python list.
Definition: FT_matrix.cc:93
Matrix which components are GEOM_FT numbers.
Definition: FT_matrix.h:40