21 #ifndef SELDON_FILE_FUNCTIONS_CXX
23 #include "Functions.hxx"
25 #include "../computation/basic_functions/Functions_Vector.cxx"
79 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
83 #ifdef SELDON_CHECK_BOUNDS
87 string(
"Index should be in [0, ") +
to_str(m - 1)
88 +
"], but is equal to " +
to_str(i) +
".");
91 long* ptr = M.GetPtr();
92 int* ind = M.GetInd();
93 T0* data = M.GetData();
94 int size_row = ptr[i+1] - ptr[i];
96 X.Reallocate(size_row);
98 for (
int j = 0; j < size_row; j++)
100 X.Index(j) = ind[shift + j];
101 X.Value(j) = data[shift + j];
113 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
117 #ifdef SELDON_CHECK_BOUNDS
121 string(
"Index should be in [0, ") +
to_str(m - 1)
122 +
"], but is equal to " +
to_str(i) +
".");
125 long* ptr = M.GetPtr();
126 int* ind = M.GetInd();
127 T0* data = M.GetData();
128 list<pair<int, T0> > vec;
129 for (
int j = 0; j < M.GetN(); j++)
130 for (
long k = ptr[j]; k < ptr[j+1]; k++)
132 vec.push_back(make_pair(j, data[k]));
134 typename list<pair<int, T0> >::iterator it;
135 X.Reallocate(vec.size());
137 for (it = vec.begin(); it != vec.end(); it++)
139 X.Index(j) = it->first;
140 X.Value(j) = it->second;
153 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
157 #ifdef SELDON_CHECK_BOUNDS
161 string(
"Index should be in [0, ") +
to_str(m - 1)
162 +
"], but is equal to " +
to_str(i) +
".");
165 long* ptr = M.GetPtr();
166 int* ind = M.GetInd();
167 T0* data = M.GetData();
168 list<pair<int, T0> > vec;
169 for (
int j = 0; j < i; j++)
170 for (
long k = ptr[j]; k < ptr[j+1]; k++)
172 vec.push_back(make_pair(j, data[k]));
174 for (
long k = ptr[i]; k < ptr[i+1]; k++)
175 vec.push_back(make_pair(ind[k], data[k]));
177 typename list<pair<int, T0> >::iterator it;
178 X.Reallocate(vec.size());
180 for (it = vec.begin(); it != vec.end(); it++)
182 X.Index(j) = it->first;
183 X.Value(j) = it->second;
196 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
200 #ifdef SELDON_CHECK_BOUNDS
204 string(
"Index should be in [0, ") +
to_str(m - 1)
205 +
"], but is equal to " +
to_str(i) +
".");
208 long* ptr = M.GetPtr();
209 int* ind = M.GetInd();
210 T0* data = M.GetData();
211 list<pair<int, T0> > vec;
212 for (
long k = ptr[i]; k < ptr[i+1]; k++)
213 vec.push_back(make_pair(ind[k], data[k]));
215 for (
int j = i+1; j < M.GetM(); j++)
216 for (
long k = ptr[j]; k < ptr[j+1]; k++)
218 vec.push_back(make_pair(j, data[k]));
220 typename list<pair<int, T0> >::iterator it;
221 X.Reallocate(vec.size());
223 for (it = vec.begin(); it != vec.end(); it++)
225 X.Index(j) = it->first;
226 X.Value(j) = it->second;
239 template <
class T0,
class Prop0,
class Storage0,
class Allocator0,
240 class T1,
class Storage1,
class Allocator1>
244 if (Storage0::Sparse)
245 throw WrongArgument(
"GetRow",
"Function intended to dense matrices");
247 X.Reallocate(M.GetN());
248 for (
int j = 0; j < M.GetN(); j++)
260 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
264 #ifdef SELDON_CHECK_BOUNDS
268 string(
"Index should be in [0, ") +
to_str(n - 1)
269 +
"], but is equal to " +
to_str(j) +
".");
272 long* ptr = M.GetPtr();
273 int* ind = M.GetInd();
274 T0* data = M.GetData();
275 int size_col = ptr[j+1] - ptr[j];
277 X.Reallocate(size_col);
279 for (
int i = 0; i < size_col; i++)
281 X.Index(i) = ind[shift + i];
282 X.Value(i) = data[shift + i];
294 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
298 #ifdef SELDON_CHECK_BOUNDS
302 string(
"Index should be in [0, ") +
to_str(n - 1)
303 +
"], but is equal to " +
to_str(j) +
".");
306 long* ptr = M.GetPtr();
307 int* ind = M.GetInd();
308 T0* data = M.GetData();
311 list<pair<int, T0> > vec;
312 for (
int i = 0; i < m; i++)
313 for (
long k = ptr[i]; k < ptr[i+1]; k++)
315 vec.push_back(make_pair(i, data[k]));
317 typename list<pair<int, T0> >::iterator it;
318 X.Reallocate(vec.size());
320 for (it = vec.begin(); it != vec.end(); it++)
322 X.Index(i) = it->first;
323 X.Value(i) = it->second;
336 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
352 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
367 template <
class T0,
class Prop0,
class Allocator0,
368 class T1,
class Allocator1>
373 M.GetProcessorRowRange(a, b);
374 for (
int i = a; i < b; i++)
375 X.SetBuffer(i, M(i, j));
386 template <
class T0,
class Prop0,
class Allocator0,
387 class T1,
class Allocator1>
392 M.GetProcessorRowRange(a, b);
393 for (
int i = a; i < b; i++)
394 X.SetBuffer(i, M(i, j));
406 template <
class T0,
class Prop0,
class Storage0,
class Allocator0,
407 class T1,
class Storage1,
class Allocator1>
411 if (Storage0::Sparse)
412 throw WrongArgument(
"GetCol",
"Function intended to dense matrices");
414 X.Reallocate(M.GetM());
415 for (
int i = 0; i < M.GetM(); i++)
428 template <
class T0,
class Prop0,
class Storage0,
class Allocator0,
429 class T1,
class Prop1,
class Storage1,
class Allocator1>
434 M_out.Reallocate(M_in.GetM(), end - begin);
435 for (
int i = 0; i < M_in.GetM(); i++)
436 for (
int j = begin, k = 0; j < end; j++, k++)
437 M_out(i, k) = M_in(i, j);
448 template <
class T0,
class Prop0,
class Storage0,
class Allocator0,
449 class T1,
class Storage1,
class Allocator1>
453 if (Storage0::Sparse)
454 throw WrongArgument(
"SetRow",
"Function intended to dense matrices");
456 for (
int j = 0; j < M.GetN(); j++)
467 template <
class T0,
class Prop0,
class Allocator0,
468 class T1,
class Allocator1>
472 for (
int j = 0; j < M.GetN(); j++)
473 M.SetBuffer(i, j, X(j));
484 template <
class T0,
class Prop0,
class Allocator0,
485 class T1,
class Allocator1>
489 for (
int j = 0; j < M.GetN(); j++)
490 M.SetBuffer(i, j, X(j));
502 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
508 long nnz = M.GetDataSize();
509 int Nx = X.GetSize();
511 #ifdef SELDON_CHECK_BOUNDS
513 throw WrongIndex(
"SetRow(Vector, int, Matrix<RowSparse>)",
514 string(
"Index should be in [0, ") +
to_str(m - 1)
515 +
"], but is equal to " +
to_str(i) +
".");
518 long *ptr_vector = M.GetPtr();
519 long ptr_i0 = ptr_vector[i], ptr_i1 = ptr_vector[i + 1];
520 int row_size_difference = Nx - ptr_i1 + ptr_i0;
522 if (row_size_difference == 0)
524 for (
int k = 0; k < Nx; k++)
525 M.GetInd()[k + ptr_i0] = X.Index(k);
526 for (
int k = 0; k < Nx; k++)
527 M.GetData()[k + ptr_i0] = X.Value(k);
532 new_ind_vector(nnz + row_size_difference);
533 for (
long k = 0; k < ptr_i0; k++)
534 new_ind_vector(k) = M.GetInd()[k];
535 for (
int k = 0; k < Nx; k++)
536 new_ind_vector(k + ptr_i0) = X.Index(k);
537 for (
long k = 0; k < nnz - ptr_i1; k++)
538 new_ind_vector(k + ptr_i0 + Nx) = M.GetInd()[k + ptr_i1];
541 new_data_vector(nnz + row_size_difference);
542 for (
long k = 0; k < ptr_i0; k++)
543 new_data_vector(k) = M.GetData()[k];
544 for (
int k = 0; k < Nx; k++)
545 new_data_vector(k + ptr_i0) = X.Value(k);
546 for (
long k = 0; k < nnz - ptr_i1; k++)
547 new_data_vector(k + ptr_i0 + Nx) = M.GetData()[k + ptr_i1];
550 for (
int j = 0; j < i + 1; j++)
551 new_ptr_vector(j) = ptr_vector[j];
552 for (
int j = i + 1; j < m+1; j++)
553 new_ptr_vector(j) = ptr_vector[j] + row_size_difference;
555 M.SetData(m, n, new_data_vector, new_ptr_vector, new_ind_vector);
566 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
572 long nnz = M.GetDataSize();
574 long* ptr = M.GetPtr();
575 int* ind = M.GetInd();
576 T0* data = M.GetData();
578 #ifdef SELDON_CHECK_BOUNDS
580 throw WrongIndex(
"SetRow(Vector, int, Matrix<ColSparse>)",
581 string(
"Index should be in [0, ") +
to_str(m - 1)
582 +
"], but is equal to " +
to_str(i) +
".");
590 long new_nnz = nnz + X.GetM() - row.GetM();
594 bool same_pattern =
true;
595 if (X.GetM() == row.GetM())
597 for (
int k = 0; k < X.GetM(); k++)
598 if (X.Index(k) != row.Index(k))
599 same_pattern =
false;
602 same_pattern =
false;
606 for (
int k = 0; k < X.GetM(); k++)
609 for (
long k2 = ptr[j]; k2 < ptr[j+1]; k2++)
611 data[k2] = X.Value(k);
624 for (
int j = 0; j < n; j++)
627 bool valX =
false, val_row =
false;
628 while ( (kx < X.GetM()) && (X.Index(kx) < j))
631 if ( (kx < X.GetM()) && (X.Index(kx) == j))
634 while ( (kr < row.GetM()) && (row.Index(kr) < j))
637 if ( (kr < row.GetM()) && (row.Index(kr) == j))
642 while ((k < ptr[j+1]) && (ind[k] < i))
654 Val(nb) = X.Value(kx);
676 M.SetData(m, n, Val, Ptr, Ind);
688 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
693 long nnz = M.GetDataSize();
695 long* ptr = M.GetPtr();
696 int* ind = M.GetInd();
697 T0* data = M.GetData();
699 #ifdef SELDON_CHECK_BOUNDS
701 throw WrongIndex(
"SetRow(Vector, int, Matrix<RowSymSparse>)",
702 string(
"Index should be in [0, ") +
to_str(n - 1)
703 +
"], but is equal to " +
to_str(i) +
".");
711 long new_nnz = nnz + X.GetM() - row.GetM();
715 bool same_pattern =
true;
716 if (X.GetM() == row.GetM())
718 for (
int k = 0; k < X.GetM(); k++)
719 if (X.Index(k) != row.Index(k))
720 same_pattern =
false;
723 same_pattern =
false;
728 for (
int k = 0; k < X.GetM(); k++)
733 for (
long k2 = ptr[j]; k2 < ptr[j+1]; k2++)
735 data[k2] = X.Value(k);
741 long k2 = ptr[i] + k - kdiag;
742 data[k2] = X.Value(k);
756 for (
int j = 0; j < i; j++)
759 bool valX =
false, val_row =
false;
760 while ( (kx < X.GetM()) && (X.Index(kx) < j))
763 if ( (kx < X.GetM()) && (X.Index(kx) == j))
766 while ( (kr < row.GetM()) && (row.Index(kr) < j))
769 if ( (kr < row.GetM()) && (row.Index(kr) == j))
774 while ((k < ptr[j+1]) && (ind[k] < i))
786 Val(nb) = X.Value(kx);
809 while (kx < X.GetM())
811 Ind(nb) = X.Index(kx);
812 Val(nb) = X.Value(kx);
820 for (
int j = i+1; j < n; j++)
822 for (
long k = ptr[j]; k < ptr[j+1]; k++)
832 M.SetData(n, n, Val, Ptr, Ind);
844 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
849 long nnz = M.GetDataSize();
851 long* ptr = M.GetPtr();
852 int* ind = M.GetInd();
853 T0* data = M.GetData();
855 #ifdef SELDON_CHECK_BOUNDS
857 throw WrongIndex(
"SetRow(Vector, int, Matrix<RowSymSparse>)",
858 string(
"Index should be in [0, ") +
to_str(n - 1)
859 +
"], but is equal to " +
to_str(i) +
".");
867 long new_nnz = nnz + X.GetM() - row.GetM();
871 bool same_pattern =
true;
872 if (X.GetM() == row.GetM())
874 for (
int k = 0; k < X.GetM(); k++)
875 if (X.Index(k) != row.Index(k))
876 same_pattern =
false;
879 same_pattern =
false;
883 for (
int k = 0; k < X.GetM(); k++)
888 long k2 = ptr[i] + k;
889 data[k2] = X.Value(k);
893 for (
long k2 = ptr[j]; k2 < ptr[j+1]; k2++)
895 data[k2] = X.Value(k);
908 for (
int j = 0; j < i; j++)
910 for (
long k = ptr[j]; k < ptr[j+1]; k++)
922 while ( (kx < X.GetM()) && (X.Index(kx) <= i) )
924 Ind(nb) = X.Index(kx);
925 Val(nb) = X.Value(kx);
933 for (
int j = i+1; j < n; j++)
937 while ( (kx < X.GetM()) && (X.Index(kx) < j))
940 if ( (kx < X.GetM()) && (X.Index(kx) == j))
945 while ((k < ptr[j+1]) && (ind[k] < i))
957 Val(nb) = X.Value(kx);
964 if ( (k < ptr[j+1]) && (ind[k] == i))
979 M.SetData(n, n, Val, Ptr, Ind);
991 template <
class T0,
class Prop0,
class Allocator0,
992 class T1,
class Storage1,
class Allocator1>
996 for (
int j = 0; j <= i; j++)
1008 template <
class T0,
class Prop0,
class Allocator0,
1009 class T1,
class Storage1,
class Allocator1>
1013 for (
int j = 0; j <= i; j++)
1025 template <
class T0,
class Prop0,
class Allocator0,
1026 class T1,
class Storage1,
class Allocator1>
1030 for (
int j = 0; j <= i; j++)
1042 template <
class T0,
class Prop0,
class Allocator0,
1043 class T1,
class Storage1,
class Allocator1>
1047 for (
int j = 0; j <= i; j++)
1059 template <
class T0,
class Prop0,
class Allocator0,
1060 class T1,
class Storage1,
class Allocator1>
1064 for (
int j = i; j < M.GetN(); j++)
1076 template <
class T0,
class Prop0,
class Allocator0,
1077 class T1,
class Storage1,
class Allocator1>
1081 for (
int j = i; j < M.GetN(); j++)
1093 template <
class T0,
class Prop0,
class Allocator0,
1094 class T1,
class Storage1,
class Allocator1>
1098 for (
int j = i; j < M.GetN(); j++)
1110 template <
class T0,
class Prop0,
class Allocator0,
1111 class T1,
class Storage1,
class Allocator1>
1115 for (
int j = i; j < M.GetN(); j++)
1127 template <
class T0,
class Prop0,
class Storage0,
class Allocator0,
1128 class T1,
class Storage1,
class Allocator1>
1132 if (Storage0::Sparse)
1133 throw WrongArgument(
"SetCol",
"Function intended to dense matrices");
1135 for (
int i = 0; i < M.GetM(); i++)
1146 template <
class T0,
class Prop0,
class Allocator0,
1147 class T1,
class Allocator1>
1152 M.GetProcessorRowRange(a, b);
1153 for (
int i = a; i < b; i++)
1154 M.SetBuffer(i, j, X(i));
1165 template <
class T0,
class Prop0,
class Allocator0,
1166 class T1,
class Allocator1>
1171 M.GetProcessorRowRange(a, b);
1172 for (
int i = a; i < b; i++)
1173 M.SetBuffer(i, j, X(i));
1185 template <
class T0,
class Allocator0,
1186 class T1,
class Allocator1>
1191 for (
int k = 0; k < X.GetLength(); k++)
1194 if (value != T1(0.))
1195 X_sparse.AddInteraction(k, value);
1198 SetCol(X_sparse, j, M);
1209 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
1215 long nnz = M.GetDataSize();
1216 int Nx = X.GetSize();
1218 #ifdef SELDON_CHECK_BOUNDS
1219 if (j < 0 || j >= n)
1220 throw WrongIndex(
"SetCol(Vector, int, Matrix<RowSparse>)",
1221 string(
"Index should be in [0, ") +
to_str(n - 1)
1222 +
"], but is equal to " +
to_str(j) +
".");
1227 GetCol(M, j, column_j);
1228 int Ncolumn_j = column_j.GetSize();
1229 int column_size_difference = Nx - Ncolumn_j;
1235 for (
int p = 0; p < Ncolumn_j; p++)
1236 index_j(p) = column_j.Index(p);
1238 column_j_mask.SetData(value_j, index_j);
1244 for (
int p = 0; p < Nx; p++)
1245 index_x(p) = X.Index(p);
1247 X_mask.SetData(value_x, index_x);
1250 X_mask.AddInteractionRow(column_j_mask.GetSize(),
1251 column_j_mask.GetIndex(),
1252 column_j_mask.GetData(),
true);
1256 ptr_vector.SetData(m + 1, M.GetPtr());
1258 new_ptr_vector.Zero();
1259 for (
int p = 0; p < X_mask.GetM(); p++)
1260 new_ptr_vector(X_mask.Index(p) + 1) = X_mask.Value(p);
1262 for (
int p = 0; p < m; p++)
1263 new_ptr_vector(p + 1) += new_ptr_vector(p);
1265 new_ptr_vector += ptr_vector;
1269 new_ind_vector(nnz + column_size_difference);
1271 new_data_vector(nnz + column_size_difference);
1274 int Nworking_vector;
1277 for (
int interaction = 0; interaction < X_mask.GetM(); interaction++)
1279 int ind_x = X_mask.Index(interaction);
1280 for (
int k = 0; k < ptr_vector(ind_x) - ptr_vector(line); k++)
1281 new_ind_vector.GetData()[k + new_ptr_vector(line)] =
1282 M.GetInd()[k + ptr_vector(line)];
1283 for (
int k = 0; k < ptr_vector(ind_x) - ptr_vector(line); k++)
1284 new_data_vector.GetData()[k + new_ptr_vector(line)] =
1285 M.GetData()[k + ptr_vector(line)];
1288 Nworking_vector = ptr_vector(ind_x + 1) - ptr_vector(ind_x);
1289 working_vector.SetData(Nworking_vector,
1290 M.GetData() + ptr_vector(ind_x),
1291 M.GetInd() + ptr_vector(ind_x));
1292 switch(X_mask.Value(interaction))
1296 working_vector.Get(j) = X(ind_x);
1297 for (
int k = 0; k < Nworking_vector; k++)
1298 new_ind_vector.GetData()[k + new_ptr_vector(ind_x)] =
1299 working_vector.GetIndex()[k];
1300 for (
int k = 0; k < Nworking_vector; k++)
1301 new_data_vector.GetData()[k + new_ptr_vector(ind_x)] =
1302 working_vector.GetData()[k];
1308 while (ind_j < Nworking_vector &&
1309 working_vector.Index(ind_j) != j)
1312 for (
int k = 0; k < ind_j; k++)
1313 new_ind_vector.GetData()[k + new_ptr_vector(ind_x)] =
1314 working_vector.GetIndex()[k];
1315 for (
int k = 0; k < Nworking_vector - ind_j - 1; k++)
1316 new_ind_vector.GetData()[k + new_ptr_vector(ind_x) + ind_j] =
1317 working_vector.GetIndex()[k + ind_j + 1];
1319 for (
int k = 0; k < ind_j; k++)
1320 new_data_vector.GetData()[k + new_ptr_vector(ind_x)] =
1321 working_vector.GetData()[k];
1322 for (
int k = 0; k < Nworking_vector - ind_j - 1; k++)
1323 new_data_vector.GetData()[k + new_ptr_vector(ind_x) + ind_j] =
1324 working_vector.GetData()[k + ind_j + 1];
1330 while (ind_j < Nworking_vector &&
1331 working_vector.Index(ind_j) < j)
1333 for (
int k = 0; k < ind_j; k++)
1334 new_ind_vector.GetData()[k + new_ptr_vector(ind_x)] =
1335 working_vector.GetIndex()[k];
1336 new_ind_vector.GetData()[new_ptr_vector(ind_x) + ind_j] = j;
1337 for (
int k = 0; k < Nworking_vector - ind_j; k++)
1338 new_ind_vector.GetData()[k + new_ptr_vector(ind_x) + ind_j + 1]
1339 = working_vector.GetIndex()[k + ind_j];
1341 for (
int k = 0; k < ind_j; k++)
1342 new_data_vector.GetData()[k + new_ptr_vector(ind_x)] =
1343 working_vector.GetData()[k];
1344 new_data_vector.GetData()[new_ptr_vector(ind_x) + ind_j]
1346 for (
int k = 0; k < Nworking_vector - ind_j; k++)
1347 new_data_vector.GetData()[k + new_ptr_vector(ind_x) + ind_j + 1]
1348 = working_vector.GetData()[k + ind_j];
1352 working_vector.Nullify();
1354 for (
int k = 0; k < ptr_vector(m) - ptr_vector(line); k++)
1355 new_ind_vector.GetData()[k + new_ptr_vector(line)] =
1356 M.GetInd()[k + ptr_vector(line)];
1357 for (
int k = 0; k < ptr_vector(m) - ptr_vector(line); k++)
1358 new_data_vector.GetData()[k + new_ptr_vector(line)] =
1359 M.GetData()[k + ptr_vector(line)];
1361 M.SetData(m, n, new_data_vector, new_ptr_vector, new_ind_vector);
1362 ptr_vector.Nullify();
1363 new_data_vector.Nullify();
1364 new_ind_vector.Nullify();
1365 new_ptr_vector.Nullify();
1376 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
1382 long nnz = M.GetDataSize();
1384 long* ptr = M.GetPtr();
1385 int* ind = M.GetInd();
1386 T0* data = M.GetData();
1388 #ifdef SELDON_CHECK_BOUNDS
1389 if (j < 0 || j >= n)
1390 throw WrongIndex(
"SetCol(Vector, int, Matrix<ColSparse>)",
1391 string(
"Index should be in [0, ") +
to_str(n - 1)
1392 +
"], but is equal to " +
to_str(j) +
".");
1395 int size_col = ptr[j+1] - ptr[j];
1396 if (size_col == X.GetM())
1400 for (
int k = 0; k < X.GetM(); k++)
1402 ind[ptr[j] + k] = X.Index(k);
1403 data[ptr[j] + k] = X.Value(k);
1408 long new_nnz = nnz + X.GetM() - size_col;
1413 for (
int i = 0; i < j; i++)
1415 for (
long k = ptr[i]; k < ptr[i+1]; k++)
1420 Ptr(i+1) = ptr[i+1];
1424 for (
int k = 0; k < X.GetM(); k++)
1426 Ind(new_nnz) = X.Index(k);
1427 Val(new_nnz) = X.Value(k);
1432 for (
int i = j+1; i < n; i++)
1434 for (
long k = ptr[i]; k < ptr[i+1]; k++)
1436 Ind(new_nnz) = ind[k];
1437 Val(new_nnz) = data[k];
1443 M.SetData(m, n, Val, Ptr, Ind);
1455 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
1471 template <
class T0,
class Allocator0,
class T1,
class Allocator1>
1487 template <
class T0,
class Prop0,
class Allocator0,
1488 class T1,
class Storage1,
class Allocator1>
1492 for (
int i = j; i < M.GetM(); i++)
1504 template <
class T0,
class Prop0,
class Allocator0,
1505 class T1,
class Storage1,
class Allocator1>
1509 for (
int i = j; i < M.GetM(); i++)
1521 template <
class T0,
class Prop0,
class Allocator0,
1522 class T1,
class Storage1,
class Allocator1>
1526 for (
int i = j; i < M.GetM(); i++)
1538 template <
class T0,
class Prop0,
class Allocator0,
1539 class T1,
class Storage1,
class Allocator1>
1543 for (
int i = j; i < M.GetM(); i++)
1555 template <
class T0,
class Prop0,
class Allocator0,
1556 class T1,
class Storage1,
class Allocator1>
1560 for (
int i = 0; i <= j; i++)
1572 template <
class T0,
class Prop0,
class Allocator0,
1573 class T1,
class Storage1,
class Allocator1>
1577 for (
int i = 0; i <= j; i++)
1589 template <
class T0,
class Prop0,
class Allocator0,
1590 class T1,
class Storage1,
class Allocator1>
1594 for (
int i = 0; i <= j; i++)
1606 template <
class T0,
class Prop0,
class Allocator0,
1607 class T1,
class Storage1,
class Allocator1>
1611 for (
int i = 0; i <= j; i++)
1620 template<
class T,
class Prop,
class Allocator>
1628 for (
int i = 0; i < A.
GetM(); i++)
1629 for (
int j = 0; j < A.
GetN(); j++)
1630 A(i, j) = A_copy(row_perm(i) - starting_index,
1631 col_perm(j) - starting_index);
1639 template<
class T,
class Prop,
class Allocator>
1647 for (
int j = 0; j < A.
GetN(); j++)
1648 for (
int i = 0; i < A.
GetM(); i++)
1649 A(i, j) = A_copy(row_perm(i) - starting_index,
1650 col_perm(j) - starting_index);
1658 template<
class T,
class Prop,
class Allocator>
1666 for (
int i = 0; i < A.
GetM(); i++)
1667 for (
int j = i; j < A.
GetN(); j++)
1668 A(i, j) = A_copy(row_perm(i) - starting_index,
1669 row_perm(j) - starting_index);
1677 template<
class T,
class Prop,
class Allocator>
1685 for (
int j = 0; j < A.
GetN(); j++)
1686 for (
int i = 0; i <= j; i++)
1687 A(i, j) = A_copy(row_perm(i) - starting_index,
1688 row_perm(j) - starting_index);
1696 template<
class T,
class Prop,
class Allocator>
1704 for (
int i = 0; i < A.
GetM(); i++)
1705 for (
int j = i; j < A.
GetN(); j++)
1706 A.
Val(i, j) = A_copy(row_perm(i) - starting_index,
1707 row_perm(j) - starting_index);
1715 template<
class T,
class Prop,
class Allocator>
1723 for (
int j = 0; j < A.
GetN(); j++)
1724 for (
int i = 0; i <= j; i++)
1725 A.
Val(i, j) = A_copy(row_perm(i) - starting_index,
1726 row_perm(j) - starting_index);
1734 template<
class T,
class Prop,
class Allocator>
1742 for (
int i = 0; i < A.
GetM(); i++)
1743 for (
int j = i; j < A.
GetN(); j++)
1744 A.
Val(i, j) = A_copy(row_perm(i) - starting_index,
1745 row_perm(j) - starting_index);
1753 template<
class T,
class Prop,
class Allocator>
1761 for (
int j = 0; j < A.
GetN(); j++)
1762 for (
int i = 0; i <= j; i++)
1763 A.
Val(i, j) = A_copy(row_perm(i) - starting_index,
1764 row_perm(j) - starting_index);
1772 template<
class T,
class Prop,
class Allocator>
1780 for (
int i = 0; i < A.
GetM(); i++)
1781 for (
int j = i; j < A.
GetN(); j++)
1782 A.
Val(i, j) = A_copy(row_perm(i) - starting_index,
1783 row_perm(j) - starting_index);
1791 template<
class T,
class Prop,
class Allocator>
1799 for (
int j = 0; j < A.
GetN(); j++)
1800 for (
int i = 0; i <= j; i++)
1801 A.
Val(i, j) = A_copy(row_perm(i) - starting_index,
1802 row_perm(j) - starting_index);
1812 template<
class T,
class Prop,
class Allocator>
1820 for (
int i = 0; i < A.
GetM(); i++)
1821 for (
int j = 0; j < A.
GetN(); j++)
1822 A(row_perm(i) - starting_index, col_perm(j) - starting_index)
1833 template<
class T,
class Prop,
class Allocator>
1841 for (
int j = 0; j < A.
GetN(); j++)
1842 for (
int i = 0; i < A.
GetM(); i++)
1843 A(row_perm(i) - starting_index, col_perm(j) - starting_index)
1854 template<
class T,
class Prop,
class Allocator>
1862 for (
int i = 0; i < A.
GetM(); i++)
1863 for (
int j = i; j < A.
GetN(); j++)
1864 A.
Set(row_perm(i) - starting_index, row_perm(j) - starting_index,
1875 template<
class T,
class Prop,
class Allocator>
1883 for (
int j = 0; j < A.
GetN(); j++)
1884 for (
int i = 0; i <= j; i++)
1885 A.
Set(row_perm(i) - starting_index, row_perm(j) - starting_index,
1896 template<
class T,
class Prop,
class Allocator>
1904 for (
int i = 0; i < A.
GetM(); i++)
1905 for (
int j = i; j < A.
GetN(); j++)
1906 A.
Set(row_perm(i) - starting_index, row_perm(j) - starting_index,
1917 template<
class T,
class Prop,
class Allocator>
1925 for (
int j = 0; j < A.
GetN(); j++)
1926 for (
int i = 0; i <= j; i++)
1927 A.
Set(row_perm(i) - starting_index, row_perm(j) - starting_index,
1938 template<
class T,
class Prop,
class Allocator>
1946 for (
int i = 0; i < A.
GetM(); i++)
1947 for (
int j = i; j < A.
GetN(); j++)
1948 A.
Set(row_perm(i) - starting_index, row_perm(j) - starting_index,
1959 template<
class T,
class Prop,
class Allocator>
1967 for (
int j = 0; j < A.
GetN(); j++)
1968 for (
int i = 0; i <= j; i++)
1969 A.
Set(row_perm(i) - starting_index, row_perm(j) - starting_index,
1980 template<
class T,
class Prop,
class Allocator>
1988 for (
int i = 0; i < A.
GetM(); i++)
1989 for (
int j = i; j < A.
GetN(); j++)
1990 A.
Set(row_perm(i) - starting_index, row_perm(j) - starting_index,
2001 template<
class T,
class Prop,
class Allocator>
2009 for (
int j = 0; j < A.
GetN(); j++)
2010 for (
int i = 0; i <= j; i++)
2011 A.
Set(row_perm(i) - starting_index, row_perm(j) - starting_index,
2022 template<
class T,
class Prop,
class Allocator,
2023 class T1,
class Allocator1,
class T2,
class Allocator2>
2028 for (
int i = 0; i < A.
GetM(); i++)
2029 for (
int j = 0; j < A.
GetN(); j++)
2030 A(i, j) *= Drow(i)*Dcol(j);
2040 template<
class T,
class Prop,
class Allocator,
2041 class T1,
class Allocator1,
class T2,
class Allocator2>
2046 for (
int j = 0; j < A.
GetN(); j++)
2047 for (
int i = 0; i < A.
GetM(); i++)
2048 A(i, j) *= Drow(i)*Dcol(j);
2058 template<
class T,
class Prop,
class Allocator,
2059 class T1,
class Allocator1,
class T2,
class Allocator2>
2064 for (
int i = 0; i < A.
GetM(); i++)
2065 for (
int j = i; j < A.
GetN(); j++)
2066 A(i, j) *= Drow(i)*Drow(j);
2076 template<
class T,
class Prop,
class Allocator,
2077 class T1,
class Allocator1,
class T2,
class Allocator2>
2082 for (
int j = 0; j < A.
GetN(); j++)
2083 for (
int i = 0; i <= j; i++)
2084 A(i, j) *= Drow(i)*Drow(j);
2094 template<
class T,
class Prop,
class Allocator,
2095 class T1,
class Allocator1,
class T2,
class Allocator2>
2100 for (
int i = 0; i < A.
GetM(); i++)
2101 for (
int j = i; j < A.
GetN(); j++)
2102 A.
Val(i, j) *= Drow(i)*Drow(j);
2112 template<
class T,
class Prop,
class Allocator,
2113 class T1,
class Allocator1,
class T2,
class Allocator2>
2118 for (
int j = 0; j < A.
GetN(); j++)
2119 for (
int i = 0; i <= j; i++)
2120 A.
Val(i, j) *= Drow(i)*Drow(j);
2130 template<
class T,
class Prop,
class Allocator,
2131 class T1,
class Allocator1,
class T2,
class Allocator2>
2136 for (
int i = 0; i < A.
GetM(); i++)
2137 for (
int j = i; j < A.
GetN(); j++)
2138 A.
Val(i, j) *= Drow(i)*Drow(j);
2148 template<
class T,
class Prop,
class Allocator,
2149 class T1,
class Allocator1,
class T2,
class Allocator2>
2154 for (
int j = 0; j < A.
GetN(); j++)
2155 for (
int i = 0; i <= j; i++)
2156 A.
Val(i, j) *= Drow(i)*Drow(j);
2166 template<
class T,
class Prop,
class Allocator,
2167 class T1,
class Allocator1,
class T2,
class Allocator2>
2172 for (
int i = 0; i < A.
GetM(); i++)
2173 for (
int j = i; j < A.
GetN(); j++)
2174 A.
Val(i, j) *= Drow(i)*Drow(j);
2184 template<
class T,
class Prop,
class Allocator,
2185 class T1,
class Allocator1,
class T2,
class Allocator2>
2190 for (
int j = 0; j < A.
GetN(); j++)
2191 for (
int i = 0; i <= j; i++)
2192 A.
Val(i, j) *= Drow(i)*Drow(j);
2202 template<
class T,
class Prop,
class Allocator,
2203 class T1,
class Allocator1,
class T2,
class Allocator2>
2208 for (
int i = 0; i < A.
GetM(); i++)
2209 for (
int j = 0; j <= i; j++)
2210 A.
Val(i, j) *= Drow(i)*Dcol(j);
2220 template<
class T,
class Prop,
class Allocator,
2221 class T1,
class Allocator1,
class T2,
class Allocator2>
2226 for (
int i = 0; i < A.
GetM(); i++)
2227 for (
int j = 0; j <= i; j++)
2228 A.
Val(i, j) *= Drow(i)*Dcol(j);
2238 template<
class T,
class Prop,
class Allocator,
2239 class T1,
class Allocator1,
class T2,
class Allocator2>
2244 for (
int i = 0; i < A.
GetM(); i++)
2245 for (
int j = 0; j <= i; j++)
2246 A.
Val(i, j) *= Drow(i)*Dcol(j);
2256 template<
class T,
class Prop,
class Allocator,
2257 class T1,
class Allocator1,
class T2,
class Allocator2>
2262 for (
int i = 0; i < A.
GetM(); i++)
2263 for (
int j = 0; j <= i; j++)
2264 A.
Val(i, j) *= Drow(i)*Dcol(j);
2274 template<
class T,
class Prop,
class Allocator,
2275 class T1,
class Allocator1,
class T2,
class Allocator2>
2280 for (
int i = 0; i < A.
GetM(); i++)
2281 for (
int j = i; j < A.
GetM(); j++)
2282 A.
Val(i, j) *= Drow(i)*Dcol(j);
2292 template<
class T,
class Prop,
class Allocator,
2293 class T1,
class Allocator1,
class T2,
class Allocator2>
2298 for (
int i = 0; i < A.
GetM(); i++)
2299 for (
int j = i; j < A.
GetN(); j++)
2300 A.
Val(i, j) *= Drow(i)*Dcol(j);
2310 template<
class T,
class Prop,
class Allocator,
2311 class T1,
class Allocator1,
class T2,
class Allocator2>
2316 for (
int i = 0; i < A.
GetM(); i++)
2317 for (
int j = i; j < A.
GetM(); j++)
2318 A.
Val(i, j) *= Drow(i)*Dcol(j);
2328 template<
class T,
class Prop,
class Allocator,
2329 class T1,
class Allocator1,
class T2,
class Allocator2>
2334 for (
int i = 0; i < A.
GetM(); i++)
2335 for (
int j = i; j < A.
GetN(); j++)
2336 A.
Val(i, j) *= Drow(i)*Dcol(j);
2345 template<
class T,
class Prop,
class Allocator,
2346 class T1,
class Allocator1>
2350 for (
int i = 0; i < A.
GetM(); i++)
2351 for (
int j = 0; j < A.
GetN(); j++)
2361 template<
class T,
class Prop,
class Allocator,
2362 class T1,
class Allocator1>
2366 for (
int i = 0; i < A.
GetM(); i++)
2367 for (
int j = 0; j < A.
GetN(); j++)
2377 template<
class T,
class Prop,
class Allocator,
2378 class T1,
class Allocator1>
2382 for (
int i = 0; i < A.
GetM(); i++)
2383 for (
int j = 0; j <= i; j++)
2384 A.
Val(i, j) *= Drow(i);
2393 template<
class T,
class Prop,
class Allocator,
2394 class T1,
class Allocator1>
2398 for (
int i = 0; i < A.
GetM(); i++)
2399 for (
int j = 0; j <= i; j++)
2400 A.
Val(i, j) *= Drow(i);
2409 template<
class T,
class Prop,
class Allocator,
2410 class T1,
class Allocator1>
2414 for (
int i = 0; i < A.
GetM(); i++)
2415 for (
int j = 0; j <= i; j++)
2416 A.
Val(i, j) *= Drow(i);
2425 template<
class T,
class Prop,
class Allocator,
2426 class T1,
class Allocator1>
2430 for (
int i = 0; i < A.
GetM(); i++)
2431 for (
int j = 0; j <= i; j++)
2432 A.
Val(i, j) *= Drow(i);
2441 template<
class T,
class Prop,
class Allocator,
2442 class T1,
class Allocator1>
2446 for (
int i = 0; i < A.
GetM(); i++)
2447 for (
int j = i; j < A.
GetN(); j++)
2448 A.
Val(i, j) *= Drow(i);
2457 template<
class T,
class Prop,
class Allocator,
2458 class T1,
class Allocator1>
2462 for (
int i = 0; i < A.
GetM(); i++)
2463 for (
int j = i; j < A.
GetN(); j++)
2464 A.
Val(i, j) *= Drow(i);
2473 template<
class T,
class Prop,
class Allocator,
2474 class T1,
class Allocator1>
2478 for (
int i = 0; i < A.
GetM(); i++)
2479 for (
int j = i; j < A.
GetN(); j++)
2480 A.
Val(i, j) *= Drow(i);
2489 template<
class T,
class Prop,
class Allocator,
2490 class T1,
class Allocator1>
2494 for (
int i = 0; i < A.
GetM(); i++)
2495 for (
int j = i; j < A.
GetN(); j++)
2496 A.
Val(i, j) *= Drow(i);
2505 template<
class T,
class Prop,
class Allocator,
2506 class T2,
class Allocator2>
2510 for (
int i = 0; i < A.
GetM(); i++)
2511 for (
int j = 0; j < A.
GetN(); j++)
2521 template<
class T,
class Prop,
class Allocator,
2522 class T2,
class Allocator2>
2526 for (
int i = 0; i < A.
GetM(); i++)
2527 for (
int j = 0; j < A.
GetN(); j++)
2537 template<
class T,
class Prop,
class Allocator,
2538 class T2,
class Allocator2>
2542 for (
int i = 0; i < A.
GetM(); i++)
2543 for (
int j = 0; j <= i; j++)
2544 A.
Val(i, j) *= Dcol(j);
2553 template<
class T,
class Prop,
class Allocator,
2554 class T2,
class Allocator2>
2558 for (
int i = 0; i < A.
GetM(); i++)
2559 for (
int j = 0; j <= i; j++)
2560 A.
Val(i, j) *= Dcol(j);
2569 template<
class T,
class Prop,
class Allocator,
2570 class T2,
class Allocator2>
2574 for (
int i = 0; i < A.
GetM(); i++)
2575 for (
int j = 0; j <= i; j++)
2576 A.
Val(i, j) *= Dcol(j);
2585 template<
class T,
class Prop,
class Allocator,
2586 class T2,
class Allocator2>
2590 for (
int i = 0; i < A.
GetM(); i++)
2591 for (
int j = 0; j <= i; j++)
2592 A.
Val(i, j) *= Dcol(j);
2601 template<
class T,
class Prop,
class Allocator,
2602 class T2,
class Allocator2>
2606 for (
int i = 0; i < A.
GetM(); i++)
2607 for (
int j = i; j < A.
GetN(); j++)
2608 A.
Val(i, j) *= Dcol(j);
2617 template<
class T,
class Prop,
class Allocator,
2618 class T2,
class Allocator2>
2622 for (
int i = 0; i < A.
GetM(); i++)
2623 for (
int j = i; j < A.
GetN(); j++)
2624 A.
Val(i, j) *= Dcol(j);
2633 template<
class T,
class Prop,
class Allocator,
2634 class T2,
class Allocator2>
2638 for (
int i = 0; i < A.
GetM(); i++)
2639 for (
int j = i; j < A.
GetN(); j++)
2640 A.
Val(i, j) *= Dcol(j);
2649 template<
class T,
class Prop,
class Allocator,
2650 class T2,
class Allocator2>
2654 for (
int i = 0; i < A.
GetM(); i++)
2655 for (
int j = i; j < A.
GetN(); j++)
2656 A.
Val(i, j) *= Dcol(j);
2661 template<
class T,
class Prop,
class Storage,
class Allocator>
2662 typename ClassComplexType<T>::Treal
2666 typename ClassComplexType<T>::Treal res(0);
2668 long taille = A.GetDataSize();
2671 x.SetData(taille, A.GetData());
2681 #define SELDON_FILE_FUNCTIONS_CXX