-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFullMatrix.cpp
More file actions
102 lines (72 loc) · 2.15 KB
/
Copy pathFullMatrix.cpp
File metadata and controls
102 lines (72 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// FullMatrix.cpp
//
// Template class for normal matrices.
// A size_t is used for indexing. Indexing starts at 1.
//
// 2002-4-8 DD Another possibility FArray<FArray <TValue> >; Use or redundant values nr, nc
//
// (C) Datasim Component Technology 1999
#ifndef DSFullMatrix_cpp
#define DSFullMatrix_cpp
#include "FullMatrix.hpp"
// Constructors & destructor
template <class V, class TA>
FullMatrix<V, TA>::FullMatrix(): MatrixStructure<V>()
{ // Default constructor
m_structure=FullArray<FullArray<V, TA>, std::allocator<FullArray<V, TA> > >();
nr = nc = 1;
}
template <class V, class TA>
FullMatrix<V, TA>::FullMatrix(size_t rows, size_t columns): MatrixStructure<V>()
{ // Constructor with size
// Create the rows
m_structure=FullArray<FullArray<V, TA>, std::allocator<FullArray<V, TA> > >(rows);
// Add the colums to the rows
for (size_t i=1; i<=m_structure.Size(); i++) m_structure[i]=FullArray<V, TA>(columns);
nr = rows; nc = columns;
}
template <class V, class TA>
FullMatrix<V, TA>::FullMatrix(const FullMatrix<V, TA>& source): MatrixStructure<V>(source)
{ // Copy constructor
m_structure=source.m_structure;
nr = sopurce.nr; nc = source.nc;
}
template <class V, class TA>
FullMatrix<V, TA>::~FullMatrix()
{ // Destructor
}
// Selectors
template <class V, class TA>
size_t FullMatrix<V, TA>::Rows() const
{ // Number of rows
return nr;
}
template <class V, class TA>
size_t FullMatrix<V, TA>::Columns() const
{ // Number of columns
return nc;
}
// Modifiers
// Operators
template <class V, class TA>
ArrayStructure<V>& FullMatrix<V, TA>::operator[] (size_t row)
{ // Subscripting operator
return m_structure[row];
}
template <class V, class TA>
const ArrayStructure<V>& FullMatrix<V, TA>::operator[] (size_t row) const
{ // Subscripting operator
return m_structure[row];
}
template <class V, class TA>
FullMatrix<V, TA>& FullMatrix<V, TA>::operator = (const FullMatrix<V, TA>& source)
{ // Assignment operator
// Exit if same object
if (this==&source) return *this;
// Call base class assignment
MatrixStructure<V>::operator = (source);
m_structure=source.m_structure;
nr = source.nr; nc = source.nc;
return *this;
}
#endif // DSFullMatrix_cpp