xc
vcolM.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 //vcolM.h
22 
23 #ifndef VCOLM_H
24 #define VCOLM_H
25 
26 #include "MMatrix.h"
27 
28 
30 class vcolM: public MMatrix
31  {
32  private:
33  inline m_double &operator()(const size_t &iRow,const size_t &)
34  { return MMatrix::operator()(iRow,1); }
35  inline const m_double &operator()(const size_t &iRow,const size_t &) const
36  { return MMatrix::operator()(iRow,1); }
37  public:
39  vcolM(const size_type &n_rows= 1)
40  : MMatrix(n_rows,1) {}
42  vcolM(const size_type &n_rows,const m_double &val)
43  : MMatrix(n_rows,1,val) {}
44  vcolM(const std::vector<size_t> &dim);
45  vcolM(const MMatrix &m,const size_type &c);
47  vcolM(const vcolM &other)
48  : MMatrix(other) {}
50  vcolM &operator=(const vcolM &m)
51  {
52  MMatrix::operator=(m);
53  return *this;
54  }
55  m_double &operator()(const size_t &iRow=1)
56  { return MMatrix::operator()(iRow,1); }
57  const m_double &operator()(const size_t &iRow=1) const
58  { return MMatrix::operator()(iRow,1); }
59 
60  vcolM &operator*=(const m_double &m);
61  vcolM &operator*=(const double &d);
62  friend vcolM operator+(const vcolM &m1,const vcolM &m2);
63  friend vcolM operator-(const vcolM &m1,const vcolM &m2);
64  friend vcolM operator*(const vcolM &m,const double &d);
65  friend vcolM operator*(const double &d,const vcolM &m)
66  { return m*d; }
67  friend vcolM operator*(const m_double &m,const vcolM &mM);
68  friend vcolM operator*(const vcolM &mM, const m_double &m)
69  { return m*mM; }
70  };
71 #endif
72 
73 vcolM operator*(const MMatrix &a,const vcolM &b);
vcolM(const size_type &n_rows, const m_double &val)
Constructor.
Definition: vcolM.h:42
vcolM & operator=(const vcolM &m)
Operador asignacion.
Definition: vcolM.h:50
column vector with components are matrix.
Definition: vcolM.h:30
vcolM(const size_type &n_rows=1)
Constructor por defecto.
Definition: vcolM.h:39
vcolM(const vcolM &other)
Constructor de copia.
Definition: vcolM.h:47
Definition: MMatrix.h:33