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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
include/MultiMatrix.h | 14 +++++++-------
include/UnionHolder.h | 40 ++++++++++++++++++++--------------------
include/basedefs.h | 22 ++++++++++++----------
utils/Fork_controller.cc | 3 +++
utils/ttyio.cc | 2 ++
5 files changed, 44 insertions(+), 37 deletions(-)
diff --git a/include/MultiMatrix.h b/include/MultiMatrix.h
index b6fec33..2d54db5 100755
--- a/include/MultiMatrix.h
+++ b/include/MultiMatrix.h
@@ -254,19 +254,19 @@ namespace libcmatrix {
}
size_t operator()(size_t r) const
- { check_bounds_open(dim,r);
+ { this->check_bounds_open(dim,r);
return r*mults[0]; }
size_t operator()(size_t r,size_t s) const
- { check_bounds_open(dim,r,s);
+ { this->check_bounds_open(dim,r,s);
return r*mults[0]+s*mults[1]; }
size_t operator()(size_t r,size_t s,size_t t) const
- { check_bounds_open(dim,r,s,t);
+ { this->check_bounds_open(dim,r,s,t);
return r*mults[0]+s*mults[1]+t*mults[2]; }
size_t operator()(size_t r,size_t s,size_t t,size_t u) const
- { check_bounds_open(dim,r,s,t,u);
+ { this->check_bounds_open(dim,r,s,t,u);
return r*mults[0]+s*mults[1]+t*mults[2]+u*mults[3]; }
size_t index(size_t r) const
@@ -293,14 +293,14 @@ namespace libcmatrix {
void reverse(size_t& r, size_t& s, size_t ind) const {
LCM_STATIC_CHECK(N==2, Indexer_non2D_object);
- check(ind<size(),"Indexer::reverse");
+ this->check(ind<size(),"Indexer::reverse");
r=ind / mults[0];
s=ind-r*mults[0];
}
void reverse(size_t& r, size_t& s, size_t& t, size_t ind) const {
LCM_STATIC_CHECK(N==3, Indexer_non3D_object);
- check(ind<size(),"Indexer::reverse");
+ this->check(ind<size(),"Indexer::reverse");
r=ind / mults[0];
ind-=r*mults[0];
s=ind / mults[1];
@@ -309,7 +309,7 @@ namespace libcmatrix {
void reverse(size_t& r, size_t& s, size_t& t, size_t& u, size_t ind) const {
LCM_STATIC_CHECK(N==4, Indexer_non4D_object);
- check(ind<size(),"Indexer::reverse");
+ this->check(ind<size(),"Indexer::reverse");
r=ind / mults[0];
ind-=r*mults[0];
s=ind / mults[1];
diff --git a/include/UnionHolder.h b/include/UnionHolder.h
index f447501..3157330 100755
--- a/include/UnionHolder.h
+++ b/include/UnionHolder.h
@@ -359,21 +359,21 @@ namespace libcmatrix {
//! overrides ::clear method from ::CommonHolder
void clear() {
switch (type_) {
- case 1: clear_(first_); break;
- case 2: clear_(second_); break;
- case 3: clear_(third_); break;
- case 4: clear_(fourth_); break;
- case 5: clear_(fifth_); break;
- case 6: clear_(sixth_); break;
- case 7: clear_(seventh_); break;
- case 8: clear_(eighth_); break;
- case 9: clear_(nineth_); break;
+ case 1: this->clear_(first_); break;
+ case 2: this->clear_(second_); break;
+ case 3: this->clear_(third_); break;
+ case 4: this->clear_(fourth_); break;
+ case 5: this->clear_(fifth_); break;
+ case 6: this->clear_(sixth_); break;
+ case 7: this->clear_(seventh_); break;
+ case 8: this->clear_(eighth_); break;
+ case 9: this->clear_(nineth_); break;
}
type_=0;
}
template<class T> UnionHolder& operator= (const T& v) {
- get(Type2Type<T>())=v;
+ this->get(Type2Type<T>())=v;
type(Type2Type<T>()); //only change type if assignment was successful
return *this;
}
@@ -399,12 +399,12 @@ namespace libcmatrix {
template<class T> T& set(Type2Type<T> in) {
type(in);
- return get(in);
+ return this->get(in);
}
template<int M> typename reverse<M>::type& set(Int2Type<M> in) {
type(in);
- return get(Type2Type<typename reverse<M>::type>());
+ return this->get(Type2Type<typename reverse<M>::type>());
}
template<class T> T& operator()(Type2Type<T> in) {
@@ -429,12 +429,12 @@ namespace libcmatrix {
template<int M> typename reverse<M>::type& operator()(Int2Type<M> in) {
verify(in);
- return get(Type2Type<typename reverse<M>::type>());
+ return this->get(Type2Type<typename reverse<M>::type>());
}
template<int M> const typename reverse<M>::type& operator()(Int2Type<M> in) const {
verify(in);
- return get(Type2Type<typename reverse<M>::type>());
+ return this->get(Type2Type<typename reverse<M>::type>());
}
};
@@ -482,12 +482,12 @@ namespace libcmatrix {
bool iscomplex() const { return (this->type()==COMPLEX); }
bool isreal() const { return (this->type()==REAL); }
- C& set_complex() { return set(Int2Type<COMPLEX>()); }
- R& set_real() { return set(Int2Type<REAL>()); }
- const C& get_complex() const { return get(Type2Type<C>()); }
- const R& get_real() const { return get(Type2Type<R>()); }
- C& get_complex() { return get(Type2Type<C>()); }
- R& get_real() { return get(Type2Type<R>()); }
+ C& set_complex() { return this->set(Int2Type<COMPLEX>()); }
+ R& set_real() { return this->set(Int2Type<REAL>()); }
+ const C& get_complex() const { return this->get(Type2Type<C>()); }
+ const R& get_real() const { return this->get(Type2Type<R>()); }
+ C& get_complex() { return this->get(Type2Type<C>()); }
+ R& get_real() { return this->get(Type2Type<R>()); }
};
} //namespace libcmatrix
diff --git a/include/basedefs.h b/include/basedefs.h
index 420b341..80d47e3 100755
--- a/include/basedefs.h
+++ b/include/basedefs.h
@@ -13,6 +13,8 @@
#include <functional>
#include <iterator>
#include <algorithm>
+#include <math.h>
+//#include "BlockedMatrix.h"
//#include <complex>
// #ifdef LCM_DEBUG_ALLOCATOR
@@ -1703,6 +1705,16 @@ template<size_t N> struct Multiply_<N,N,0> {
}
};
+template<size_t,size_t,size_t> struct Mla_ {
+ template<class T1,class T2,class T3> static void func(T1&, const T2&, const T3&) {
+ LCM_STATIC_ERROR( mla_incompatible_dimensionalities );
+ }
+};
+
+template<class T1,class T2,class T3> inline void mla(T1& d,const T2& a,const T3& b) {
+ Mla_<LCM_DIM(T1),LCM_DIM(T2),LCM_DIM(T3)>::func(d,a,b);
+}
+
template<> struct Multiply_<2,2,2> {
template<class T1,class T2,class T3> static void func(T1& dest,const T2& a,const T3& b)
{
@@ -1875,12 +1887,6 @@ template<> struct Multiply_<0,0,0> {
Multiply_<LCM_DIM(T1),LCM_DIM(T2),LCM_DIM(T3)>::func(d,a,b);
}
-template<size_t,size_t,size_t> struct Mla_ {
- template<class T1,class T2,class T3> static void func(T1&, const T2&, const T3&) {
- LCM_STATIC_ERROR( mla_incompatible_dimensionalities );
- }
-};
-
template<size_t N> struct Mla_<N,0,N> {
template<class T1,class T2,class T3> LCM_INLINE static void func(T1& d, const T2& a, const T3& b) {
if (d.empty())
@@ -1940,10 +1946,6 @@ template<> struct Mla_<0,0,0> {
}
};
-template<class T1,class T2,class T3> inline void mla(T1& d,const T2& a,const T3& b) {
- Mla_<LCM_DIM(T1),LCM_DIM(T2),LCM_DIM(T3)>::func(d,a,b);
-}
-
template<class T,size_t N> struct Print_ {
static void print(const T& a,std::ostream& ostr) {
ostr << '[';
diff --git a/utils/Fork_controller.cc b/utils/Fork_controller.cc
index 5f6b913..08ec942 100755
--- a/utils/Fork_controller.cc
+++ b/utils/Fork_controller.cc
@@ -3,6 +3,9 @@
#include <sys/wait.h>
#include <time.h>
#include <cstdio>
+#include <sys/types.h>
+#include <unistd.h>
+
namespace libcmatrix {
diff --git a/utils/ttyio.cc b/utils/ttyio.cc
index 17e4eb3..bbeac81 100755
--- a/utils/ttyio.cc
+++ b/utils/ttyio.cc
@@ -17,6 +17,8 @@
#include "args_iter.h"
#endif
+#include <unistd.h>
+
namespace libcmatrix {
namespace {
|