21 #ifndef SELDON_FILE_MATRIX_HERMPACKED_INLINE_CXX
23 #include "Matrix_HermPacked.hxx"
38 template <
class T,
class Prop,
class Storage,
class Allocator>
51 template <
class T,
class Prop,
class Storage,
class Allocator>
67 template <
class T,
class Prop,
class Storage,
class Allocator>
70 return (
long(this->m_) *
long(this->m_ + 1)) / 2;
75 template <
class T,
class Prop,
class Storage,
class Allocator>
78 size_t taille =
sizeof(*this) + size_t(GetDataSize())*
sizeof(T);
95 template <
class T,
class Prop,
class Storage,
class Allocator>
97 Matrix_HermPacked<T, Prop, Storage, Allocator>::value_type
102 #ifdef SELDON_CHECK_BOUNDS
103 CheckBounds(i, j, this->m_, this->n_,
"Matrix_HermPacked");
107 return conj(this->data_[Storage::GetFirst(j * this->m_
109 (i*(i+1)) / 2 + j)]);
111 return this->data_[Storage::GetFirst(i * this->n_ - (i*(i+1)) / 2 + j,
124 template <
class T,
class Prop,
class Storage,
class Allocator>
125 inline typename Matrix_HermPacked<T, Prop, Storage, Allocator>::reference
129 #ifdef SELDON_CHECK_BOUNDS
130 CheckBoundsSym(i, j, this->m_, this->n_,
"Matrix_HermPacked");
133 return this->data_[Storage::GetFirst(i * this->n_ - (i*(i+1)) / 2 + j,
146 template <
class T,
class Prop,
class Storage,
class Allocator>
152 #ifdef SELDON_CHECK_BOUNDS
153 CheckBoundsSym(i, j, this->m_, this->n_,
"Matrix_HermPacked");
156 return this->data_[Storage::GetFirst(i * this->n_ - (i*(i+1)) / 2 + j,
167 template <
class T,
class Prop,
class Storage,
class Allocator>
168 inline typename Matrix_HermPacked<T, Prop, Storage, Allocator>::reference
171 return this->Val(i, j);
181 template <
class T,
class Prop,
class Storage,
class Allocator>
186 return this->Val(i, j);
196 template <
class T,
class Prop,
class Storage,
class Allocator>
197 inline typename Matrix_HermPacked<T, Prop, Storage, Allocator>::reference
201 #ifdef SELDON_CHECK_BOUNDS
202 CheckBounds(i, this->GetDataSize(),
"Matrix_HermPacked");
205 return this->data_[i];
215 template <
class T,
class Prop,
class Storage,
class Allocator>
221 #ifdef SELDON_CHECK_BOUNDS
222 CheckBounds(i, this->GetDataSize(),
"Matrix_HermPacked");
225 return this->data_[i];
235 template <
class T,
class Prop,
class Storage,
class Allocator>
252 template <
class T,
class Prop,
class Storage,
class Allocator>
257 this->Val(j, i) = conj(x);
269 template <
class T,
class Prop,
class Storage,
class Allocator>
273 this->Reallocate(A.
GetM(), A.
GetN());
275 Allocator::memorycpy(this->data_, A.
GetData(), this->GetDataSize());
279 #ifdef SELDON_WITH_VIRTUAL
280 template <
class T,
class Prop,
class Storage,
class Allocator>
286 this->Val(i, j) += val;
291 template <
class T,
class Prop,
class Storage,
class Allocator>
292 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
293 ::AddInteractionRow(
int i,
int n,
const Vector<int>& col,
294 const Vector<T>& val,
bool sorted)
296 for (
int k = 0; k < n; k++)
298 this->Val(i, col(k)) += val(k);
303 template <
class T,
class Prop,
class Storage,
class Allocator>
304 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
305 ::AddInteractionColumn(
int i,
int n,
const Vector<int>& row,
306 const Vector<T>& val,
bool sorted)
308 for (
int k = 0; k < n; k++)
310 this->Val(row(k), i) += val(k);
315 template <
class T,
class Prop,
class Storage,
class Allocator>
316 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
319 for (
int k = 0; k < this->n_; k++)
320 SetComplexZero(this->Val(i, k));
324 template <
class T,
class Prop,
class Storage,
class Allocator>
325 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
326 ::ApplySor(
const SeldonTranspose& trans, Vector<Treal>& x,
const Vector<Treal>& r,
327 const typename ClassComplexType<T>::Treal& omega,
328 int nb_iter,
int stage_ssor)
const
330 SOR(trans,
static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
331 x, r, omega, nb_iter, stage_ssor);
334 template <
class T,
class Prop,
class Storage,
class Allocator>
335 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
336 ::ApplySor(
const SeldonTranspose& trans, Vector<Tcplx>& x,
const Vector<Tcplx>& r,
337 const typename ClassComplexType<T>::Treal& omega,
338 int nb_iter,
int stage_ssor)
const
341 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_HermPacked<T, Prop, Storage, Allocator>
347 ::MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
348 const Treal& beta, Vector<Treal>& y)
const
350 cout <<
"Not defined for real numbers" << endl;
354 template <
class T,
class Prop,
class Storage,
class Allocator>
355 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
356 ::MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
357 const Tcplx& beta, Vector<Tcplx>& y)
const
360 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
364 template <
class T,
class Prop,
class Storage,
class Allocator>
365 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
366 ::MltAddVector(
const Treal& alpha,
const SeldonTranspose& trans,
367 const Vector<Treal>& x,
368 const Treal& beta, Vector<Treal>& y)
const
370 cout <<
"Not defined for real numbers" << endl;
374 template <
class T,
class Prop,
class Storage,
class Allocator>
375 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
376 ::MltAddVector(
const Tcplx& alpha,
const SeldonTranspose& trans,
377 const Vector<Tcplx>& x,
378 const Tcplx& beta, Vector<Tcplx>& y)
const
381 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this),
385 template <
class T,
class Prop,
class Storage,
class Allocator>
386 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
387 ::MltVector(
const Vector<Treal>& x, Vector<Treal>& y)
const
389 cout <<
"Not defined for real numbers" << endl;
393 template <
class T,
class Prop,
class Storage,
class Allocator>
394 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
395 ::MltVector(
const Vector<Tcplx>& x, Vector<Tcplx>& y)
const
397 Mlt(
static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
400 template <
class T,
class Prop,
class Storage,
class Allocator>
401 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
402 ::MltVector(
const SeldonTranspose& trans,
403 const Vector<Treal>& x, Vector<Treal>& y)
const
405 cout <<
"Not defined for real numbers" << endl;
409 template <
class T,
class Prop,
class Storage,
class Allocator>
410 inline void Matrix_HermPacked<T, Prop, Storage, Allocator>
411 ::MltVector(
const SeldonTranspose& trans,
412 const Vector<Tcplx>& x, Vector<Tcplx>& y)
const
415 static_cast<const Matrix<T, Prop, Storage, Allocator>&
>(*
this), x, y);
418 template <
class T,
class Prop,
class Storage,
class Allocator>
419 inline bool Matrix_HermPacked<T, Prop, Storage, Allocator>
420 ::IsSymmetric()
const
441 template <
class T,
class Prop,
class Allocator>
454 template <
class T,
class Prop,
class Allocator>
470 template <
class T,
class Prop,
class Allocator>
488 template <
class T,
class Prop,
class Allocator>
514 template <
class T,
class Prop,
class Allocator>
527 template <
class T,
class Prop,
class Allocator>
543 template <
class T,
class Prop,
class Allocator>
561 template <
class T,
class Prop,
class Allocator>
574 #define SELDON_FILE_MATRIX_HERMPACKED_INLINE_CXX