Debian Codegraph @

3rdparty/dissection/src/Algebra/VectorArray.hpp

raw
1 /*! \file ColumnMatrix.hpp
2 \brief Rectangular matrix view as a set of column vectors
3 \author Xavier Juvigny, ONERA
4 \date Jan. 19th 2005
5 \modification allocation of array by STL vector class
6 \author Atsushi Suzuki, Laboratoire Jacques-Louis Lions
7 \date Jun. 11th 2013
8 \date Jul. 12th 2015
9 \date Nov. 30th 2016
10 */
11
12 // This file is part of Dissection
13 //
14 // Dissection is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 // Linking Dissection statically or dynamically with other modules is making
20 // a combined work based on Disssection. Thus, the terms and conditions of
21 // the GNU General Public License cover the whole combination.
22 //
23 // As a special exception, the copyright holders of Dissection give you
24 // permission to combine Dissection program with free software programs or
25 // libraries that are released under the GNU LGPL and with independent modules
26 // that communicate with Dissection solely through the Dissection-fortran
27 // interface. You may copy and distribute such a system following the terms of
28 // the GNU GPL for Dissection and the licenses of the other code concerned,
29 // provided that you include the source code of that other code when and as
30 // the GNU GPL requires distribution of source code and provided that you do
31 // not modify the Dissection-fortran interface.
32 //
33 // Note that people who make modified versions of Dissection are not obligated
34 // to grant this special exception for their modified versions; it is their
35 // choice whether to do so. The GNU General Public License gives permission to
36 // release a modified version without this exception; this exception also makes
37 // it possible to release a modified version which carries forward this
38 // exception. If you modify the Dissection-fortran interface, this exception
39 // does not apply to your modified version of Dissection, and you must remove
40 // this exception when you distribute your modified version.
41 //
42 // This exception is an additional permission under section 7 of the GNU
43 // General Public License, version 3 ("GPLv3")
44 //
45 // Dissection is distributed in the hope that it will be useful,
46 // but WITHOUT ANY WARRANTY; without even the implied warranty of
47 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 // GNU General Public License for more details.
49 //
50 // You should have received a copy of the GNU General Public License
51 // along with Dissection. If not, see <http://www.gnu.org/licenses/>.
52 //
53
54 #ifndef _ALGEBRA_VECTORARRAY_HPP
55 # define _ALGEBRA_VECTORARRAY_HPP
56
57 # include "Algebra/PlainMatrix.hpp"
58
59 template<typename T>
60 class VectorArray : public PlainMatrix<T>
61 {
62 public:
63
64 using PlainMatrix<T>::coefs;
65 using PlainMatrix<T>::addrCoefs;
66 using PlainMatrix<T>::addrCoefs_pt;
67 using PlainMatrix<T>::size;
68 using PlainMatrix<T>::ZeroClear;
69 using PlainMatrix<T>::init;
70 using PlainMatrix<T>::free;
71
72 VectorArray() : PlainMatrix<T>() {}
73 VectorArray(int n) : PlainMatrix<T>() {
74 PlainMatrix<T>::init(n);
75 }
76
77 ~VectorArray() { }
78
79 virtual T& operator () (int i, int j)
80 {
81 return coefs()[i];
82 }
83
84 virtual const T& operator () (int i, int j) const
85 {
86 return coefs()[i];
87 }
88 virtual VectorArray<T>* clone() const
89 {
90 VectorArray<T> *ret = new VectorArray<T>;
91 ret->copy(*this);
92 return(ret);
93 }
94
95 };
96
97 #endif