21 #ifndef SELDON_FILE_MATRIX_SYMMETRIC_INLINE_CXX
23 #include "Matrix_Symmetric.hxx"
38 template <
class T,
class Prop,
class Storage,
class Allocator>
52 template <
class T,
class Prop,
class Storage,
class Allocator>
71 template <
class T,
class Prop,
class Storage,
class Allocator>
74 return long(this->m_) * long(this->n_);
79 template <
class T,
class Prop,
class Storage,
class Allocator>
82 size_t taille =
sizeof(*this) + size_t(GetDataSize())*
sizeof(T);
83 taille += this->m_*
sizeof(pointer);
100 template <
class T,
class Prop,
class Storage,
class Allocator>
101 inline typename Matrix_Symmetric<T, Prop, Storage, Allocator>::reference
105 #ifdef SELDON_CHECK_BOUNDS
106 CheckBounds(i, j, this->m_, this->n_,
"Matrix_Symmetric");
110 return me_[Storage::GetSecond(i, j)][Storage::GetFirst(i, j)];
112 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
123 template <
class T,
class Prop,
class Storage,
class Allocator>
130 #ifdef SELDON_CHECK_BOUNDS
131 CheckBounds(i, j, this->m_, this->n_,
"Matrix_Symmetric");
135 return me_[Storage::GetSecond(i, j)][Storage::GetFirst(i, j)];
137 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
148 template <
class T,
class Prop,
class Storage,
class Allocator>
154 #ifdef SELDON_CHECK_BOUNDS
155 CheckBoundsSym(i, j, this->m_, this->n_,
"Matrix_Symmetric");
158 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
169 template <
class T,
class Prop,
class Storage,
class Allocator>
170 inline typename Matrix_Symmetric<T, Prop, Storage, Allocator>::reference
174 #ifdef SELDON_CHECK_BOUNDS
175 CheckBoundsSym(i, j, this->m_, this->n_,
"Matrix_Symmetric");
178 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
189 template <
class T,
class Prop,
class Storage,
class Allocator>
190 inline typename Matrix_Symmetric<T, Prop, Storage, Allocator>::reference
194 #ifdef SELDON_CHECK_BOUNDS
195 CheckBounds(i, j, this->m_, this->n_,
"Matrix_Symmetric");
199 return me_[Storage::GetSecond(i, j)][Storage::GetFirst(i, j)];
201 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
212 template <
class T,
class Prop,
class Storage,
class Allocator>
219 #ifdef SELDON_CHECK_BOUNDS
220 CheckBounds(i, j, this->m_, this->n_,
"Matrix_Symmetric");
224 return me_[Storage::GetSecond(i, j)][Storage::GetFirst(i, j)];
226 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
236 template <
class T,
class Prop,
class Storage,
class Allocator>
237 inline typename Matrix_Symmetric<T, Prop, Storage, Allocator>::reference
241 #ifdef SELDON_CHECK_BOUNDS
242 CheckBounds(i, this->GetDataSize(),
"Matrix_Symmetric");
245 return this->data_[i];
255 template <
class T,
class Prop,
class Storage,
class Allocator>
261 #ifdef SELDON_CHECK_BOUNDS
262 CheckBounds(i, this->GetDataSize(),
"Matrix_Symmetric");
265 return this->data_[i];
275 template <
class T,
class Prop,
class Storage,
class Allocator>
292 template <
class T,
class Prop,
class Storage,
class Allocator>
306 template <
class T,
class Prop,
class Storage,
class Allocator>
310 this->Reallocate(A.
GetM(), A.
GetN());
312 Allocator::memorycpy(this->data_, A.
GetData(), this->GetDataSize());
316 #ifdef SELDON_WITH_VIRTUAL
317 template <
class T,
class Prop,
class Storage,
class Allocator>
323 this->Val(i, j) += val;
328 template <
class T,
class Prop,
class Storage,
class Allocator>
329 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
330 ::AddInteractionRow(
int i,
int n,
const Vector<int>& col,
331 const Vector<T>& val,
bool sorted)
333 for (
int k = 0; k < n; k++)
335 this->Val(i, col(k)) += val(k);
340 template <
class T,
class Prop,
class Storage,
class Allocator>
341 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
342 ::AddInteractionColumn(
int i,
int n,
const Vector<int>& row,
343 const Vector<T>& val,
bool sorted)
345 for (
int k = 0; k < n; k++)
347 this->Val(row(k), i) += val(k);
352 template <
class T,
class Prop,
class Storage,
class Allocator>
353 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
356 for (
int k = 0; k < this->n_; k++)
357 SetComplexZero(this->Val(i, k));
361 template <
class T,
class Prop,
class Storage,
class Allocator>
362 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
363 ::ApplySor(
const SeldonTranspose& trans, Vector<Treal>& x,
const Vector<Treal>& r,
364 const typename ClassComplexType<T>::Treal& omega,
365 int nb_iter,
int stage_ssor)
const
367 SOR(trans,
static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
368 x, r, omega, nb_iter, stage_ssor);
371 template <
class T,
class Prop,
class Storage,
class Allocator>
372 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
373 ::ApplySor(
const SeldonTranspose& trans, Vector<Tcplx>& x,
const Vector<Tcplx>& r,
374 const typename ClassComplexType<T>::Treal& omega,
375 int nb_iter,
int stage_ssor)
const
378 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
379 x, r, omega, nb_iter, stage_ssor);
382 template <
class T,
class Prop,
class Storage,
class Allocator>
383 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
384 ::MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
385 const Treal& beta, Vector<Treal>& y)
const
388 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
392 template <
class T,
class Prop,
class Storage,
class Allocator>
393 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
394 ::MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
395 const Tcplx& beta, Vector<Tcplx>& y)
const
398 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
402 template <
class T,
class Prop,
class Storage,
class Allocator>
403 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
404 ::MltAddVector(
const Treal& alpha,
const SeldonTranspose& trans,
405 const Vector<Treal>& x,
406 const Treal& beta, Vector<Treal>& y)
const
409 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
413 template <
class T,
class Prop,
class Storage,
class Allocator>
414 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
415 ::MltAddVector(
const Tcplx& alpha,
const SeldonTranspose& trans,
416 const Vector<Tcplx>& x,
417 const Tcplx& beta, Vector<Tcplx>& y)
const
420 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
424 template <
class T,
class Prop,
class Storage,
class Allocator>
425 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
426 ::MltVector(
const Vector<Treal>& x, Vector<Treal>& y)
const
428 Mlt(
static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
431 template <
class T,
class Prop,
class Storage,
class Allocator>
432 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
433 ::MltVector(
const Vector<Tcplx>& x, Vector<Tcplx>& y)
const
435 Mlt(
static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
438 template <
class T,
class Prop,
class Storage,
class Allocator>
439 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
440 ::MltVector(
const SeldonTranspose& trans,
441 const Vector<Treal>& x, Vector<Treal>& y)
const
444 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
447 template <
class T,
class Prop,
class Storage,
class Allocator>
448 inline void Matrix_Symmetric<T, Prop, Storage, Allocator>
449 ::MltVector(
const SeldonTranspose& trans,
450 const Vector<Tcplx>& x, Vector<Tcplx>& y)
const
453 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
456 template <
class T,
class Prop,
class Storage,
class Allocator>
457 inline bool Matrix_Symmetric<T, Prop, Storage, Allocator>
458 ::IsSymmetric()
const
478 template <
class T,
class Prop,
class Allocator>
490 template <
class T,
class Prop,
class Allocator>
506 template <
class T,
class Prop,
class Allocator>
523 template <
class T,
class Prop,
class Allocator>
538 template <
class T,
class Prop,
class Allocator>
543 for (
long i = 0; i < this->GetDataSize();i++)
564 template <
class T,
class Prop,
class Allocator>
576 template <
class T,
class Prop,
class Allocator>
592 template <
class T,
class Prop,
class Allocator>
609 template <
class T,
class Prop,
class Allocator>
624 template <
class T,
class Prop,
class Allocator>
629 for (
long i = 0; i < this->GetDataSize();i++)
637 #define SELDON_FILE_MATRIX_SYMMETRIC_INLINE_CXX