21 #ifndef SELDON_FILE_MATRIX_HERMITIAN_INLINE_CXX
23 #include "Matrix_Hermitian.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 +=
sizeof(pointer)*this->m_;
100 template <
class T,
class Prop,
class Storage,
class Allocator>
101 inline const typename
102 Matrix_Hermitian<T, Prop, Storage, Allocator>::value_type
107 #ifdef SELDON_CHECK_BOUNDS
108 CheckBounds(i, j, this->m_, this->n_,
"Matrix_Hermitian");
112 return conj(me_[Storage::GetSecond(i, j)][Storage::GetFirst(i, j)]);
114 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
126 template <
class T,
class Prop,
class Storage,
class Allocator>
132 #ifdef SELDON_CHECK_BOUNDS
133 CheckBoundsSym(i, j, this->m_, this->n_,
"Matrix_Hermitian");
136 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
147 template <
class T,
class Prop,
class Storage,
class Allocator>
148 inline typename Matrix_Hermitian<T, Prop, Storage, Allocator>::reference
152 #ifdef SELDON_CHECK_BOUNDS
153 CheckBoundsSym(i, j, this->m_, this->n_,
"Matrix_Hermitian");
156 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
167 template <
class T,
class Prop,
class Storage,
class Allocator>
173 #ifdef SELDON_CHECK_BOUNDS
174 CheckBoundsSym(i, j, this->m_, this->n_,
"Matrix_Hermitian");
177 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
188 template <
class T,
class Prop,
class Storage,
class Allocator>
189 inline typename Matrix_Hermitian<T, Prop, Storage, Allocator>::reference
193 #ifdef SELDON_CHECK_BOUNDS
194 CheckBoundsSym(i, j, this->m_, this->n_,
"Matrix_Hermitian");
197 return me_[Storage::GetFirst(i, j)][Storage::GetSecond(i, j)];
207 template <
class T,
class Prop,
class Storage,
class Allocator>
208 inline typename Matrix_Hermitian<T, Prop, Storage, Allocator>::reference
212 #ifdef SELDON_CHECK_BOUNDS
213 CheckBounds(i, this->GetDataSize(),
"Matrix_Hermitian");
216 return this->data_[i];
226 template <
class T,
class Prop,
class Storage,
class Allocator>
232 #ifdef SELDON_CHECK_BOUNDS
233 CheckBounds(i, this->GetDataSize(),
"Matrix_Hermitian");
236 return this->data_[i];
246 template <
class T,
class Prop,
class Storage,
class Allocator>
251 this->Val(j, i) = conj(x);
263 template <
class T,
class Prop,
class Storage,
class Allocator>
280 template <
class T,
class Prop,
class Storage,
class Allocator>
284 this->Reallocate(A.
GetM(), A.
GetN());
286 Allocator::memorycpy(this->data_, A.
GetData(), this->GetDataSize());
290 #ifdef SELDON_WITH_VIRTUAL
291 template <
class T,
class Prop,
class Storage,
class Allocator>
297 this->Val(i, j) += val;
302 template <
class T,
class Prop,
class Storage,
class Allocator>
303 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
304 ::AddInteractionRow(
int i,
int n,
const Vector<int>& col,
305 const Vector<T>& val,
bool sorted)
307 for (
int k = 0; k < n; k++)
309 this->Val(i, col(k)) += val(k);
314 template <
class T,
class Prop,
class Storage,
class Allocator>
315 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
316 ::AddInteractionColumn(
int i,
int n,
const Vector<int>& row,
317 const Vector<T>& val,
bool sorted)
319 for (
int k = 0; k < n; k++)
321 this->Val(row(k), i) += val(k);
326 template <
class T,
class Prop,
class Storage,
class Allocator>
327 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
330 for (
int k = 0; k < this->n_; k++)
331 SetComplexZero(this->Val(i, k));
335 template <
class T,
class Prop,
class Storage,
class Allocator>
336 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
337 ::ApplySor(
const SeldonTranspose& trans, Vector<Treal>& x,
const Vector<Treal>& r,
338 const typename ClassComplexType<T>::Treal& omega,
339 int nb_iter,
int stage_ssor)
const
341 SOR(trans,
static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
342 x, r, omega, nb_iter, stage_ssor);
345 template <
class T,
class Prop,
class Storage,
class Allocator>
346 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
347 ::ApplySor(
const SeldonTranspose& trans, Vector<Tcplx>& x,
const Vector<Tcplx>& r,
348 const typename ClassComplexType<T>::Treal& omega,
349 int nb_iter,
int stage_ssor)
const
352 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
353 x, r, omega, nb_iter, stage_ssor);
356 template <
class T,
class Prop,
class Storage,
class Allocator>
357 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
358 ::MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
359 const Treal& beta, Vector<Treal>& y)
const
361 cout <<
"Not defined for real numbers" << endl;
365 template <
class T,
class Prop,
class Storage,
class Allocator>
366 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
367 ::MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
368 const Tcplx& beta, Vector<Tcplx>& y)
const
371 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
375 template <
class T,
class Prop,
class Storage,
class Allocator>
376 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
377 ::MltAddVector(
const Treal& alpha,
const SeldonTranspose& trans,
378 const Vector<Treal>& x,
379 const Treal& beta, Vector<Treal>& y)
const
381 cout <<
"Not defined for real numbers" << endl;
385 template <
class T,
class Prop,
class Storage,
class Allocator>
386 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
387 ::MltAddVector(
const Tcplx& alpha,
const SeldonTranspose& trans,
388 const Vector<Tcplx>& x,
389 const Tcplx& beta, Vector<Tcplx>& y)
const
392 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
396 template <
class T,
class Prop,
class Storage,
class Allocator>
397 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
398 ::MltVector(
const Vector<Treal>& x, Vector<Treal>& y)
const
400 cout <<
"Not defined for real numbers" << endl;
404 template <
class T,
class Prop,
class Storage,
class Allocator>
405 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
406 ::MltVector(
const Vector<Tcplx>& x, Vector<Tcplx>& y)
const
408 Mlt(
static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
411 template <
class T,
class Prop,
class Storage,
class Allocator>
412 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
413 ::MltVector(
const SeldonTranspose& trans,
414 const Vector<Treal>& x, Vector<Treal>& y)
const
416 cout <<
"Not defined for real numbers" << endl;
420 template <
class T,
class Prop,
class Storage,
class Allocator>
421 inline void Matrix_Hermitian<T, Prop, Storage, Allocator>
422 ::MltVector(
const SeldonTranspose& trans,
423 const Vector<Tcplx>& x, Vector<Tcplx>& y)
const
426 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
429 template <
class T,
class Prop,
class Storage,
class Allocator>
430 inline bool Matrix_Hermitian<T, Prop, Storage, Allocator>
431 ::IsSymmetric()
const
452 template <
class T,
class Prop,
class Allocator>
464 template <
class T,
class Prop,
class Allocator>
480 template <
class T,
class Prop,
class Allocator>
496 template <
class T,
class Prop,
class Allocator>
513 template <
class T,
class Prop,
class Allocator>
518 long size = this->GetDataSize();
519 for (
long i = 0; i < size;i++)
541 template <
class T,
class Prop,
class Allocator>
553 template <
class T,
class Prop,
class Allocator>
569 template <
class T,
class Prop,
class Allocator>
585 template <
class T,
class Prop,
class Allocator>
600 template <
class T,
class Prop,
class Allocator>
605 long size = this->GetDataSize();
606 for (
long i = 0; i < size; i++)
614 #define SELDON_FILE_MATRIX_HERMITIAN_INLINE_CXX