20 #ifndef SELDON_FILE_MATRIX_ARRAY_SPARSE_INLINE_CXX
22 #include "Matrix_ArraySparse.hxx"
31 template <
class T,
class Prop,
class Storage,
class Allocator>
44 template <
class T,
class Prop,
class Storage,
class Allocator>
53 template <
class T,
class Prop,
class Storage,
class Allocat>
65 template <
class T,
class Prop,
class Storage,
class Allocator>
85 template <
class T,
class Prop,
class Storage,
class Allocator>
99 template <
class T,
class Prop,
class Storage,
class Allocator>
112 template <
class T,
class Prop,
class Storage,
class Allocator>
125 template <
class T,
class Prop,
class Storage,
class Allocat>
138 #ifdef SELDON_WITH_MODIFIABLE_PARENTHESIS_OPERATOR
139 template <
class T,
class Prop,
class Storage,
class Allocator>
155 template <
class T,
class Prop,
class Storage,
class Allocator>
161 #ifdef SELDON_CHECK_BOUNDS
162 CheckBounds(i, j, this->m_, this->n_,
"Matrix_ArraySparse");
165 return this->val_(Storage::GetFirst(i, j))(Storage::GetSecond(i, j));
176 template <
class T,
class Prop,
class Storage,
class Allocator>
181 #ifdef SELDON_CHECK_BOUNDS
182 CheckBounds(i, j, this->m_, this->n_,
"Matrix_ArraySparse");
185 return this->val_(Storage::GetFirst(i, j)).Get(Storage::GetSecond(i, j));
196 template <
class T,
class Prop,
class Storage,
class Allocator>
201 #ifdef SELDON_CHECK_BOUNDS
202 CheckBounds(i, j, this->m_, this->n_,
"Matrix_ArraySparse");
205 return this->val_(Storage::GetFirst(i, j)).Get(Storage::GetSecond(i, j));
215 template <
class T,
class Prop,
class Storage,
class Allocator>
220 #ifdef SELDON_CHECK_BOUNDS
221 CheckBounds(i, j, this->m_, this->n_,
"Matrix_ArraySparse");
225 this->val_(Storage::GetFirst(i, j)).Val(Storage::GetSecond(i, j));
236 template <
class T,
class Prop,
class Storage,
class Allocator>
241 #ifdef SELDON_CHECK_BOUNDS
242 CheckBounds(i, j, this->m_, this->n_,
"Matrix_ArraySparse");
246 this->val_(Storage::GetFirst(i, j)).Val(Storage::GetSecond(i, j));
256 template <
class T,
class Prop,
class Storage,
class Allocator>
270 template <
class T,
class Prop,
class Storage,
class Allocator>
284 template <
class T,
class Prop,
class Storage,
class Allocator>
289 #ifdef SELDON_CHECK_BOUNDS
290 CheckBounds(i, j, Storage::GetFirst(this->m_, this->n_),
291 this->val_(i).GetM(),
"Matrix_ArraySparse");
294 return val_(i).Value(j);
304 template <
class T,
class Prop,
class Storage,
class Allocator>
309 #ifdef SELDON_CHECK_BOUNDS
310 CheckBounds(i, j, Storage::GetFirst(this->m_, this->n_),
311 this->val_(i).GetM(),
"Matrix_ArraySparse");
314 return val_(i).Value(j);
324 template <
class T,
class Prop,
class Storage,
class Allocator>
inline
329 #ifdef SELDON_CHECK_BOUNDS
330 CheckBounds(i, j, Storage::GetFirst(this->m_, this->n_),
331 this->val_(i).GetM(),
"Matrix_ArraySparse");
334 return val_(i).Index(j);
344 template <
class T,
class Prop,
class Storage,
class Allocator>
inline
348 #ifdef SELDON_CHECK_BOUNDS
349 CheckBounds(i, j, Storage::GetFirst(this->m_, this->n_),
350 this->val_(i).GetM(),
"Matrix_ArraySparse");
353 return val_(i).Index(j);
364 template <
class T,
class Prop,
class Storage,
class Allocator>
377 template <
class T,
class Prop,
class Storage,
class Allocator>
390 template <
class T,
class Prop,
class Storage,
class Allocator>
396 val_.
SetData(Storage::GetFirst(m, n), val);
405 template <
class T,
class Prop,
class Storage,
class Allocator>
414 #ifdef SELDON_WITH_VIRTUAL
415 template <
class T,
class Prop,
class Storage,
class Allocator>
418 const typename ClassComplexType<T>::Treal& omega,
419 int nb_iter,
int stage_ssor)
const
422 x, r, omega, nb_iter, stage_ssor);
425 template <
class T,
class Prop,
class Storage,
class Allocator>
426 inline void Matrix_ArraySparse<T, Prop, Storage, Allocator>
427 ::ApplySor(
const SeldonTranspose& trans, Vector<Tcplx>& x,
const Vector<Tcplx>& r,
428 const typename ClassComplexType<T>::Treal& omega,
429 int nb_iter,
int stage_ssor)
const
432 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
433 x, r, omega, nb_iter, stage_ssor);
436 template <
class T,
class Prop,
class Storage,
class Allocator>
437 inline void Matrix_ArraySparse<T, Prop, Storage, Allocator>
438 ::MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
439 const Treal& beta, Vector<Treal>& y)
const
442 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
446 template <
class T,
class Prop,
class Storage,
class Allocator>
447 inline void Matrix_ArraySparse<T, Prop, Storage, Allocator>
448 ::MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
449 const Tcplx& beta, Vector<Tcplx>& y)
const
452 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
456 template <
class T,
class Prop,
class Storage,
class Allocator>
457 inline void Matrix_ArraySparse<T, Prop, Storage, Allocator>
458 ::MltAddVector(
const Treal& alpha,
const SeldonTranspose& trans,
459 const Vector<Treal>& x,
460 const Treal& beta, Vector<Treal>& y)
const
463 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
467 template <
class T,
class Prop,
class Storage,
class Allocator>
468 inline void Matrix_ArraySparse<T, Prop, Storage, Allocator>
469 ::MltAddVector(
const Tcplx& alpha,
const SeldonTranspose& trans,
470 const Vector<Tcplx>& x,
471 const Tcplx& beta, Vector<Tcplx>& y)
const
474 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
478 template <
class T,
class Prop,
class Storage,
class Allocator>
479 inline void Matrix_ArraySparse<T, Prop, Storage, Allocator>
480 ::MltVector(
const Vector<Treal>& x, Vector<Treal>& y)
const
482 Mlt(
static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
485 template <
class T,
class Prop,
class Storage,
class Allocator>
486 inline void Matrix_ArraySparse<T, Prop, Storage, Allocator>
487 ::MltVector(
const Vector<Tcplx>& x, Vector<Tcplx>& y)
const
489 Mlt(
static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
492 template <
class T,
class Prop,
class Storage,
class Allocator>
493 inline void Matrix_ArraySparse<T, Prop, Storage, Allocator>
494 ::MltVector(
const SeldonTranspose& trans,
495 const Vector<Treal>& x, Vector<Treal>& y)
const
498 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
501 template <
class T,
class Prop,
class Storage,
class Allocator>
502 inline void Matrix_ArraySparse<T, Prop, Storage, Allocator>
503 ::MltVector(
const SeldonTranspose& trans,
504 const Vector<Tcplx>& x, Vector<Tcplx>& y)
const
507 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
510 template <
class T,
class Prop,
class Storage,
class Allocator>
511 inline bool Matrix_ArraySparse<T, Prop, Storage, Allocator>
512 ::IsSymmetric()
const
515 Allocator
>& >(*
this));
529 template <
class T,
class Prop,
class Allocator>
542 template <
class T,
class Prop,
class Allocator>
550 template <
class T,
class Prop,
class Allocator>
553 this->val_(i).Clear();
562 template <
class T,
class Prop,
class Alloc>
inline
565 this->val_(i).Reallocate(j);
574 template <
class T,
class Prop,
class Allocator>
inline
577 this->val_(i).Resize(j);
586 template <
class T,
class Prop,
class Allocator>
inline
589 Swap(this->val_(i), this->val_(j));
598 template <
class T,
class Prop,
class Allocator>
602 for (
int j = 0; j < this->val_(i).GetM(); j++)
603 this->val_(i).Index(j) = new_index(j);
612 template <
class T,
class Prop,
class Allocator>
616 return this->val_(i).GetSize();
621 template <
class T,
class Prop,
class Allocator>
inline
624 this->val_(i).Print();
634 template <
class T,
class Prop,
class Allocator>
inline
637 this->val_(i).Assemble();
647 template <
class T,
class Prop,
class Allocator>
651 this->val_(j).AddInteraction(i, val);
664 template <
class T,
class Prop,
class Allocator>
677 template <
class T,
class Prop,
class Allocator>
685 template <
class T,
class Prop,
class Allocator>
688 this->val_(i).Clear();
698 template <
class T,
class Prop,
class Allocator>
702 this->val_(i).Reallocate(j);
712 template <
class T,
class Prop,
class Allocator>
inline
715 this->val_(i).Resize(j);
724 template <
class T,
class Prop,
class Allocator>
727 Swap(this->val_(i), this->val_(j));
736 template <
class T,
class Prop,
class Allocator>
740 for (
int j = 0; j < this->val_(i).GetM(); j++)
741 this->val_(i).Index(j) = new_index(j);
750 template <
class T,
class Prop,
class Allocator>
inline
753 return this->val_(i).GetSize();
758 template <
class T,
class Prop,
class Allocator>
inline
761 this->val_(i).Print();
771 template <
class T,
class Prop,
class Allocator>
774 this->val_(i).Assemble();
783 template <
class T,
class Prop,
class Allocator>
787 this->val_(i).AddInteraction(j, val);
800 template <
class T,
class Prop,
class Allocator>
813 template <
class T,
class Prop,
class Allocator>
825 #ifdef SELDON_WITH_MODIFIABLE_PARENTHESIS_OPERATOR
826 template <
class T,
class Prop,
class Allocator>
842 template <
class T,
class Prop,
class Allocator>
848 #ifdef SELDON_CHECK_BOUNDS
849 CheckBounds(i, j, this->m_, this->n_,
"Matrix");
853 return this->val_(j)(i);
855 return this->val_(i)(j);
866 template <
class T,
class Prop,
class Allocator>
871 #ifdef SELDON_CHECK_BOUNDS
872 CheckBounds(i, j, this->m_, this->n_,
"Matrix");
876 return this->val_(j).Get(i);
878 return this->val_(i).Get(j);
889 template <
class T,
class Prop,
class Allocator>
894 #ifdef SELDON_CHECK_BOUNDS
895 CheckBounds(i, j, this->m_, this->n_,
"Matrix");
899 return this->val_(j).Get(i);
901 return this->val_(i).Get(j);
912 template <
class T,
class Prop,
class Allocator>
917 #ifdef SELDON_CHECK_BOUNDS
918 CheckBounds(i, j, this->m_, this->n_,
"Matrix");
922 return this->val_(i).Val(j);
924 return this->val_(j).Val(i);
935 template <
class T,
class Prop,
class Allocator>
940 #ifdef SELDON_CHECK_BOUNDS
941 CheckBounds(i, j, this->m_, this->n_,
"Matrix");
945 return this->val_(i).Val(j);
947 return this->val_(j).Val(i);
957 template <
class T,
class Prop,
class Allocator>
962 this->val_(j).Get(i) = x;
964 this->val_(i).Get(j) = x;
974 template <
class T,
class Prop,
class Allocator>
979 this->val_(j).Get(i) = x;
981 this->val_(i).Get(j) = x;
986 template <
class T,
class Prop,
class Allocator>
inline
989 this->val_(i).Clear();
999 template <
class T,
class Prop,
class Allocator>
1003 this->val_(i).Reallocate(j);
1012 template <
class T,
class Prop,
class Allocator>
1016 this->val_(i).Resize(j);
1025 template <
class T,
class Prop,
class Allocator>
1029 Swap(this->val_(i), this->val_(j));
1038 template <
class T,
class Prop,
class Allocator>
1042 for (
int j = 0; j < this->val_(i).GetM(); j++)
1043 this->val_(i).Index(j) = new_index(j);
1052 template <
class T,
class Prop,
class Allocator>
1056 return this->val_(i).GetSize();
1061 template <
class T,
class Prop,
class Allocator>
1065 this->val_(i).Print();
1075 template <
class T,
class Prop,
class Allocator>
1079 this->val_(i).Assemble();
1089 template <
class T,
class Prop,
class Allocator>
1094 this->val_(j).AddInteraction(i, val);
1107 template <
class T,
class Prop,
class Allocator>
1120 template <
class T,
class Prop,
class Allocator>
1132 #ifdef SELDON_WITH_MODIFIABLE_PARENTHESIS_OPERATOR
1133 template <
class T,
class Prop,
class Allocator>
1149 template <
class T,
class Prop,
class Allocator>
1155 #ifdef SELDON_CHECK_BOUNDS
1156 CheckBounds(i, j, this->m_, this->n_,
"Matrix");
1160 return this->val_(i)(j);
1162 return this->val_(j)(i);
1173 template <
class T,
class Prop,
class Allocator>
1178 #ifdef SELDON_CHECK_BOUNDS
1179 CheckBounds(i, j, this->m_, this->n_,
"Matrix");
1183 return this->val_(i).Get(j);
1185 return this->val_(j).Get(i);
1196 template <
class T,
class Prop,
class Allocator>
1201 #ifdef SELDON_CHECK_BOUNDS
1202 CheckBounds(i, j, this->m_, this->n_,
"Matrix");
1206 return this->val_(i).Get(j);
1208 return this->val_(j).Get(i);
1219 template <
class T,
class Prop,
class Allocator>
1224 #ifdef SELDON_CHECK_BOUNDS
1225 CheckBounds(i, j, this->m_, this->n_,
"Matrix");
1229 return this->val_(j).Val(i);
1231 return this->val_(i).Val(j);
1242 template <
class T,
class Prop,
class Allocator>
1247 #ifdef SELDON_CHECK_BOUNDS
1248 CheckBounds(i, j, this->m_, this->n_,
"Matrix");
1252 return this->val_(j).Val(i);
1254 return this->val_(i).Val(j);
1264 template <
class T,
class Prop,
class Allocator>
1269 this->val_(i).Get(j) = x;
1271 this->val_(j).Get(i) = x;
1281 template <
class T,
class Prop,
class Allocator>
1286 this->val_(i).Get(j) = x;
1288 this->val_(j).Get(i) = x;
1293 template <
class T,
class Prop,
class Allocator>
1296 this->val_(i).Clear();
1306 template <
class T,
class Prop,
class Allocator>
1310 this->val_(i).Reallocate(j);
1319 template <
class T,
class Prop,
class Allocator>
1323 this->val_(i).Resize(j);
1332 template <
class T,
class Prop,
class Allocator>
1336 Swap(this->val_(i), this->val_(j));
1345 template <
class T,
class Prop,
class Allocator>
1349 for (
int j = 0; j < this->val_(i).GetM(); j++)
1350 this->val_(i).Index(j) = new_index(j);
1359 template <
class T,
class Prop,
class Allocator>
1363 return this->val_(i).GetSize();
1368 template <
class T,
class Prop,
class Allocator>
1372 this->val_(i).Print();
1382 template <
class T,
class Prop,
class Allocator>
1386 this->val_(i).Assemble();
1396 template <
class T,
class Prop,
class Allocator>
1401 this->val_(i).AddInteraction(j, val);
1405 template <
class T,
class Prop,
class Allocator>
1415 template <
class T,
class Prop,
class Allocator>
1417 const Matrix<T, Prop, ArrayColSparse, Allocator>& A)
1425 template <
class T,
class Prop,
class Allocator>
1427 const Matrix<T, Prop, ArrayRowSymSparse, Allocator>& A)
1435 template <
class T,
class Prop,
class Allocator>
1437 const Matrix<T, Prop, ArrayColSymSparse, Allocator>& A)
1446 #define SELDON_FILE_MATRIX_ARRAY_SPARSE_INLINE_CXX