21 #ifndef SELDON_FILE_FUNCTIONS_MATVECT_COMPLEX_CXX
42 template <
class T1,
class Prop1,
class Allocator1,
43 class T2,
class Storage2,
class Allocator2,
44 class T4,
class Storage4,
class Allocator4>
45 void MltVector(
const Matrix<T1, Prop1, RowComplexSparse, Allocator1>& M,
46 const Vector<T2, Storage2, Allocator2>& X,
47 Vector<T4, Storage4, Allocator4>& Y)
53 #ifdef SELDON_CHECK_DIMENSIONS
54 CheckDim(M, X, Y,
"MltAdd(alpha, M, X, beta, Y)");
57 typename ClassComplexType<T1>::Treal rzero(0);
61 long* real_ptr = M.GetRealPtr();
62 long* imag_ptr = M.GetImagPtr();
63 int* real_ind = M.GetRealInd();
64 int* imag_ind = M.GetImagInd();
65 typename Matrix<T1, Prop1, RowComplexSparse, Allocator1>::pointer
66 real_data = M.GetRealData();
67 typename Matrix<T1, Prop1, RowComplexSparse, Allocator1>::pointer
68 imag_data = M.GetImagData();
70 for (i = 0; i < ma; i++)
73 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
74 temp += real_data[j] * X(real_ind[j]);
79 for (i = 0; i < ma; i++)
82 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
83 temp += T1(rzero, imag_data[j]) * X(imag_ind[j]);
90 template <
class T1,
class Prop1,
class Allocator1,
91 class T2,
class Storage2,
class Allocator2,
92 class T4,
class Storage4,
class Allocator4>
93 void MltVector(
const Matrix<T1, Prop1, ColComplexSparse, Allocator1>& M,
94 const Vector<T2, Storage2, Allocator2>& X,
95 Vector<T4, Storage4, Allocator4>& Y)
99 #ifdef SELDON_CHECK_DIMENSIONS
100 CheckDim(M, X, Y,
"MltAdd(alpha, M, X, beta, Y)");
103 typename ClassComplexType<T1>::Treal rzero(0);
104 long* real_ptr = M.GetRealPtr();
105 long* imag_ptr = M.GetImagPtr();
106 int* real_ind = M.GetRealInd();
107 int* imag_ind = M.GetImagInd();
108 typename Matrix<T1, Prop1, ColComplexSparse, Allocator1>::pointer
109 real_data = M.GetRealData();
110 typename Matrix<T1, Prop1, ColComplexSparse, Allocator1>::pointer
111 imag_data = M.GetImagData();
114 for (i = 0; i < M.GetN(); i++)
116 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
117 Y(real_ind[j]) += real_data[j] * X(i);
119 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
120 Y(imag_ind[j]) += T1(rzero, imag_data[j]) * X(i);
128 template <
class T1,
class Prop1,
class Allocator1,
129 class T2,
class Storage2,
class Allocator2,
130 class T4,
class Storage4,
class Allocator4>
131 void MltVector(
const Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>& M,
132 const Vector<T2, Storage2, Allocator2>& X,
133 Vector<T4, Storage4, Allocator4>& Y)
137 #ifdef SELDON_CHECK_DIMENSIONS
138 CheckDim(M, X, Y,
"MltAdd(alpha, M, X, beta, Y)");
142 typename ClassComplexType<T1>::Treal rzero(0);
146 long* real_ptr = M.GetRealPtr();
147 long* imag_ptr = M.GetImagPtr();
148 int* real_ind = M.GetRealInd();
149 int* imag_ind = M.GetImagInd();
150 typename Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>::pointer
151 real_data = M.GetRealData();
152 typename Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>::pointer
153 imag_data = M.GetImagData();
156 for (i = 0; i < ma; i++)
159 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
161 temp += real_data[j] * X(real_ind[j]);
162 if (real_ind[j] != i)
163 Y(real_ind[j]) += real_data[j] * X(i);
166 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
168 temp += T1(rzero, imag_data[j]) * X(imag_ind[j]);
169 if (imag_ind[j] != i)
170 Y(imag_ind[j]) += T1(rzero, imag_data[j]) * X(i);
178 template <
class T1,
class Prop1,
class Allocator1,
179 class T2,
class Storage2,
class Allocator2,
180 class T4,
class Storage4,
class Allocator4>
181 void MltVector(
const Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>& M,
182 const Vector<T2, Storage2, Allocator2>& X,
183 Vector<T4, Storage4, Allocator4>& Y)
187 #ifdef SELDON_CHECK_DIMENSIONS
188 CheckDim(M, X, Y,
"MltAdd(alpha, M, X, beta, Y)");
192 typename ClassComplexType<T1>::Treal rzero(0);
196 long* real_ptr = M.GetRealPtr();
197 long* imag_ptr = M.GetImagPtr();
198 int* real_ind = M.GetRealInd();
199 int* imag_ind = M.GetImagInd();
200 typename Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>::pointer
201 real_data = M.GetRealData();
202 typename Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>::pointer
203 imag_data = M.GetImagData();
206 for (i = 0; i<ma; i++)
209 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
211 temp += real_data[j] * X(real_ind[j]);
212 if (real_ind[j] != i)
213 Y(real_ind[j]) += real_data[j] * X(i);
216 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
218 temp += T1(rzero, imag_data[j]) * X(imag_ind[j]);
219 if (imag_ind[j] != i)
220 Y(imag_ind[j]) += T1(rzero, imag_data[j]) * X(i);
231 template <
class T1,
class Prop1,
class Allocator1,
232 class T2,
class Storage2,
class Allocator2,
233 class T4,
class Storage4,
class Allocator4>
234 void MltVector(
const SeldonTranspose& Trans,
235 const Matrix<T1, Prop1, RowComplexSparse, Allocator1>& M,
236 const Vector<T2, Storage2, Allocator2>& X,
237 Vector<T4, Storage4, Allocator4>& Y)
249 #ifdef SELDON_CHECK_DIMENSIONS
250 CheckDim(Trans, M, X, Y,
"MltAdd(alpha, SeldonTrans, M, X, beta, Y)");
253 typename ClassComplexType<T1>::Treal rzero(0);
254 long* real_ptr = M.GetRealPtr();
255 long* imag_ptr = M.GetImagPtr();
256 int* real_ind = M.GetRealInd();
257 int* imag_ind = M.GetImagInd();
258 typename Matrix<T1, Prop1, RowComplexSparse, Allocator1>::pointer
259 real_data = M.GetRealData();
260 typename Matrix<T1, Prop1, RowComplexSparse, Allocator1>::pointer
261 imag_data = M.GetImagData();
267 for (i = 0; i < ma; i++)
268 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
269 Y(real_ind[j]) += real_data[j] * X(i);
271 for (i = 0; i < ma; i++)
272 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
273 Y(imag_ind[j]) += T1(rzero, imag_data[j]) * X(i);
277 for (i = 0; i < ma; i++)
278 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
279 Y(real_ind[j]) += real_data[j] * X(i);
281 for (i = 0; i < ma; i++)
282 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
283 Y(imag_ind[j]) += T1(rzero, - imag_data[j]) * X(i);
288 template <
class T1,
class Prop1,
class Allocator1,
289 class T2,
class Storage2,
class Allocator2,
290 class T4,
class Storage4,
class Allocator4>
291 void MltVector(
const SeldonTranspose& Trans,
292 const Matrix<T1, Prop1, ColComplexSparse, Allocator1>& M,
293 const Vector<T2, Storage2, Allocator2>& X,
294 Vector<T4, Storage4, Allocator4>& Y)
304 #ifdef SELDON_CHECK_DIMENSIONS
305 CheckDim(Trans, M, X, Y,
"MltAdd(alpha, SeldonTrans, M, X, beta, Y)");
309 typename ClassComplexType<T1>::Treal rzero(0);
311 long* real_ptr = M.GetRealPtr();
312 long* imag_ptr = M.GetImagPtr();
313 int* real_ind = M.GetRealInd();
314 int* imag_ind = M.GetImagInd();
315 typename Matrix<T1, Prop1, ColComplexSparse, Allocator1>::pointer
316 real_data = M.GetRealData();
317 typename Matrix<T1, Prop1, ColComplexSparse, Allocator1>::pointer
318 imag_data = M.GetImagData();
322 for (i = 0; i < M.GetN(); i++)
324 SetComplexZero(temp);
325 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
326 temp += real_data[j] * X(real_ind[j]);
328 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
329 temp += T1(rzero, imag_data[j]) * X(imag_ind[j]);
336 for (i = 0; i < M.GetN(); i++)
338 SetComplexZero(temp);
339 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
340 temp += real_data[j] * X(real_ind[j]);
342 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
343 temp += T1(rzero, -imag_data[j]) * X(imag_ind[j]);
354 template <
class T1,
class Prop1,
class Allocator1,
355 class T2,
class Storage2,
class Allocator2,
356 class T4,
class Storage4,
class Allocator4>
357 void MltVector(
const SeldonTranspose& Trans,
358 const Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>& M,
359 const Vector<T2, Storage2, Allocator2>& X,
360 Vector<T4, Storage4, Allocator4>& Y)
362 if (!Trans.ConjTrans())
370 #ifdef SELDON_CHECK_DIMENSIONS
371 CheckDim(Trans, M, X, Y,
"MltAdd(alpha, SeldonConjTrans, M, X, beta, Y)");
377 typename ClassComplexType<T1>::Treal rzero(0);
379 long* real_ptr = M.GetRealPtr();
380 long* imag_ptr = M.GetImagPtr();
381 int* real_ind = M.GetRealInd();
382 int* imag_ind = M.GetImagInd();
383 typename Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>::pointer
384 real_data = M.GetRealData();
385 typename Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>::pointer
386 imag_data = M.GetImagData();
389 for (i = 0; i < ma; i++)
392 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
394 temp += real_data[j] * X(real_ind[j]);
395 if (real_ind[j] != i)
396 Y(real_ind[j]) += real_data[j] * X(i);
399 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
401 temp += T1(rzero, - imag_data[j]) * X(imag_ind[j]);
402 if (imag_ind[j] != i)
403 Y(imag_ind[j]) += T1(rzero, - imag_data[j]) * X(i);
411 template <
class T1,
class Prop1,
class Allocator1,
412 class T2,
class Storage2,
class Allocator2,
413 class T4,
class Storage4,
class Allocator4>
414 void MltVector(
const SeldonTranspose& Trans,
415 const Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>& M,
416 const Vector<T2, Storage2, Allocator2>& X,
417 Vector<T4, Storage4, Allocator4>& Y)
419 if (!Trans.ConjTrans())
427 #ifdef SELDON_CHECK_DIMENSIONS
428 CheckDim(Trans, M, X, Y,
"MltAdd(alpha, SeldonConjTrans, M, X, beta, Y)");
434 typename ClassComplexType<T1>::Treal rzero(0);
436 long* real_ptr = M.GetRealPtr();
437 long* imag_ptr = M.GetImagPtr();
438 int* real_ind = M.GetRealInd();
439 int* imag_ind = M.GetImagInd();
440 typename Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>::pointer
441 real_data = M.GetRealData();
442 typename Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>::pointer
443 imag_data = M.GetImagData();
446 for (i = 0; i < ma; i++)
449 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
451 temp += real_data[j] * X(real_ind[j]);
452 if (real_ind[j] != i)
453 Y(real_ind[j]) += real_data[j] * X(i);
456 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
458 temp += T1(rzero, - imag_data[j]) * X(imag_ind[j]);
459 if (imag_ind[j] != i)
460 Y(imag_ind[j]) += T1(rzero, - imag_data[j]) * X(i);
471 template<
class T1,
class T2,
class T3,
472 class Allocator1,
class Allocator2,
class Allocator3>
473 void MltVector(
const Matrix<T1, Symmetric,
474 ArrayRowSymComplexSparse, Allocator1>& A,
475 const Vector<T2, VectFull, Allocator2>& B,
476 Vector<T3, VectFull, Allocator3>& C)
480 int m = A.GetM(), n, p;
481 typename ClassComplexType<T1>::Treal val;
482 for (
int i = 0 ; i < m ; i++)
484 n = A.GetRealRowSize(i);
485 for (
int k = 0; k < n ; k++)
487 p = A.IndexReal(i, k);
488 val = A.ValueReal(i, k);
498 n = A.GetImagRowSize(i);
499 for (
int k = 0; k < n ; k++)
501 p = A.IndexImag(i, k);
502 val = A.ValueImag(i, k);
504 C(i) += T1(0, val) * B(i);
507 C(i) += T1(0, val) * B(p);
508 C(p) += T1(0, val) * B(i);
515 template<
class T1,
class T2,
class T3,
516 class Allocator1,
class Allocator2,
class Allocator3>
517 void MltVector(
const SeldonTranspose& Trans,
const Matrix<T1, Symmetric,
518 ArrayRowSymComplexSparse, Allocator1>& A,
519 const Vector<T2, VectFull, Allocator2>& B,
520 Vector<T3, VectFull, Allocator3>& C)
522 if (!Trans.ConjTrans())
529 int m = A.GetM(),n,p;
530 typename ClassComplexType<T1>::Treal val;
531 for (
int i = 0 ; i < m ; i++)
533 n = A.GetRealRowSize(i);
534 for (
int k = 0; k < n ; k++)
536 p = A.IndexReal(i, k);
537 val = A.ValueReal(i, k);
546 n = A.GetImagRowSize(i);
547 for (
int k = 0; k < n ; k++)
549 p = A.IndexImag(i, k);
550 val = A.ValueImag(i, k);
552 C(i) -= T1(0, val) * B(i);
555 C(i) -= T1(0, val) * B(p);
556 C(p) -= T1(0, val) * B(i);
563 template<
class T1,
class T2,
class T3,
564 class Allocator1,
class Allocator2,
class Allocator3>
565 void MltVector(
const Matrix<T1, Symmetric,
566 ArrayColSymComplexSparse, Allocator1>& A,
567 const Vector<T2, VectFull, Allocator2>& B,
568 Vector<T3, VectFull, Allocator3>& C)
571 int m = A.GetM(), n, p;
572 typename ClassComplexType<T1>::Treal val;
573 for (
int i = 0 ; i < m ; i++)
575 n = A.GetRealColumnSize(i);
576 for (
int k = 0; k < n ; k++)
578 p = A.IndexReal(i, k);
579 val = A.ValueReal(i, k);
589 n = A.GetImagColumnSize(i);
590 for (
int k = 0; k < n ; k++)
592 p = A.IndexImag(i, k);
593 val = A.ValueImag(i, k);
595 C(i) += T1(0, val) * B(i);
598 C(i) += T1(0, val) * B(p);
599 C(p) += T1(0, val) * B(i);
606 template<
class T1,
class T2,
class T3,
607 class Allocator1,
class Allocator2,
class Allocator3>
608 void MltVector(
const SeldonTranspose& Trans,
const Matrix<T1, Symmetric,
609 ArrayColSymComplexSparse, Allocator1>& A,
610 const Vector<T2, VectFull, Allocator2>& B,
611 Vector<T3, VectFull, Allocator3>& C)
613 if (!Trans.ConjTrans())
621 int m = A.GetM(), n, p;
622 typename ClassComplexType<T1>::Treal val;
623 for (
int i = 0 ; i < m ; i++)
625 n = A.GetRealColumnSize(i);
626 for (
int k = 0; k < n ; k++)
628 p = A.IndexReal(i, k);
629 val = A.ValueReal(i, k);
639 n = A.GetImagColumnSize(i);
640 for (
int k = 0; k < n ; k++)
642 p = A.IndexImag(i, k);
643 val = A.ValueImag(i, k);
645 C(i) -= T1(0, val) * B(i);
648 C(i) -= T1(0, val) * B(p);
649 C(p) -= T1(0, val) * B(i);
659 template<
class T1,
class T2,
class T3,
660 class Allocator1,
class Allocator2,
class Allocator3>
661 void MltVector(
const Matrix<T1, General,
662 ArrayRowComplexSparse, Allocator1>& A,
663 const Vector<T2, VectFull, Allocator2>& B,
664 Vector<T3, VectFull, Allocator3>& C)
668 for (
int i = 0 ; i < m ; i++)
670 SetComplexZero(temp);
671 n = A.GetRealRowSize(i);
672 for (
int k = 0; k < n ; k++)
673 temp += A.ValueReal(i, k)*B(A.IndexReal(i, k));
675 n = A.GetImagRowSize(i);
676 for (
int k = 0; k < n ; k++)
677 temp += T1(0, A.ValueImag(i, k)) * B(A.IndexImag(i, k));
684 template<
class T1,
class T2,
class T3,
685 class Allocator1,
class Allocator2,
class Allocator3>
686 void MltVector(
const SeldonTranspose& Trans,
const Matrix<T1, General,
687 ArrayRowComplexSparse, Allocator1>& A,
688 const Vector<T2, VectFull, Allocator2>& B,
689 Vector<T3, VectFull, Allocator3>& C)
699 int m = A.GetM(), n, p;
700 typename ClassComplexType<T1>::Treal val;
704 for (
int i = 0 ; i < m ; i++)
706 n = A.GetRealRowSize(i);
707 for (
int k = 0; k < n ; k++)
709 p = A.IndexReal(i, k);
710 val = A.ValueReal(i, k);
714 n = A.GetImagRowSize(i);
715 for (
int k = 0; k < n ; k++)
717 p = A.IndexImag(i, k);
718 val = A.ValueImag(i, k);
719 C(p) += T1(0, val) * B(i);
725 for (
int i = 0 ; i < m ; i++)
727 n = A.GetRealRowSize(i);
728 for (
int k = 0; k < n ; k++)
730 p = A.IndexReal(i, k);
731 val = A.ValueReal(i, k);
735 n = A.GetImagRowSize(i);
736 for (
int k = 0; k < n ; k++)
738 p = A.IndexImag(i, k);
739 val = A.ValueImag(i, k);
740 C(p) -= T1(0, val) * B(i);
747 template<
class T1,
class T2,
class T3,
748 class Allocator1,
class Allocator2,
class Allocator3>
749 void MltVector(
const Matrix<T1, General,
750 ArrayColComplexSparse, Allocator1>& A,
751 const Vector<T2, VectFull, Allocator2>& B,
752 Vector<T3, VectFull, Allocator3>& C)
757 typename ClassComplexType<T1>::Treal val;
758 for (
int i = 0 ; i < A.GetN(); i++)
760 n = A.GetRealColumnSize(i);
761 for (
int k = 0; k < n ; k++)
763 p = A.IndexReal(i, k);
764 val = A.ValueReal(i, k);
768 n = A.GetImagColumnSize(i);
769 for (
int k = 0; k < n ; k++)
771 p = A.IndexImag(i, k);
772 val = A.ValueImag(i, k);
773 C(p) += T1(0, val) * B(i);
779 template<
class T1,
class T2,
class T3,
780 class Allocator1,
class Allocator2,
class Allocator3>
781 void MltVector(
const SeldonTranspose& Trans,
const Matrix<T1, General,
782 ArrayColComplexSparse, Allocator1>& A,
783 const Vector<T2, VectFull, Allocator2>& B,
784 Vector<T3, VectFull, Allocator3>& C)
796 for (
int i = 0; i < A.GetN(); i++)
798 SetComplexZero(temp);
799 n = A.GetRealColumnSize(i);
800 for (
int k = 0; k < n ; k++)
801 temp += A.ValueReal(i, k) * B(A.IndexReal(i, k));
803 n = A.GetImagColumnSize(i);
804 for (
int k = 0; k < n ; k++)
805 temp += T1(0, A.ValueImag(i, k)) * B(A.IndexImag(i, k));
812 for (
int i = 0; i < A.GetN(); i++)
814 SetComplexZero(temp);
815 n = A.GetRealColumnSize(i);
816 for (
int k = 0; k < n ; k++)
817 temp += A.ValueReal(i, k) * B(A.IndexReal(i, k));
819 n = A.GetImagColumnSize(i);
820 for (
int k = 0; k < n ; k++)
821 temp -= T1(0, A.ValueImag(i, k)) * B(A.IndexImag(i, k));
838 class T1,
class Prop1,
class Allocator1,
839 class T2,
class Storage2,
class Allocator2,
841 class T4,
class Storage4,
class Allocator4>
842 void MltAddVector(
const T0& alpha,
843 const Matrix<T1, Prop1, RowComplexSparse, Allocator1>& M,
844 const Vector<T2, Storage2, Allocator2>& X,
845 const T3& beta, Vector<T4, Storage4, Allocator4>& Y)
851 #ifdef SELDON_CHECK_DIMENSIONS
852 CheckDim(M, X, Y,
"MltAdd(alpha, M, X, beta, Y)");
857 typename ClassComplexType<T1>::Treal rzero(0);
861 long* real_ptr = M.GetRealPtr();
862 long* imag_ptr = M.GetImagPtr();
863 int* real_ind = M.GetRealInd();
864 int* imag_ind = M.GetImagInd();
865 typename Matrix<T1, Prop1, RowComplexSparse, Allocator1>::pointer
866 real_data = M.GetRealData();
867 typename Matrix<T1, Prop1, RowComplexSparse, Allocator1>::pointer
868 imag_data = M.GetImagData();
870 for (i = 0; i < ma; i++)
873 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
874 temp += real_data[j] * X(real_ind[j]);
875 Y(i) += alpha * temp;
878 for (i = 0; i < ma; i++)
881 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
882 temp += T1(rzero, imag_data[j]) * X(imag_ind[j]);
883 Y(i) += alpha * temp;
889 class T1,
class Prop1,
class Allocator1,
890 class T2,
class Storage2,
class Allocator2,
892 class T4,
class Storage4,
class Allocator4>
893 void MltAddVector(
const T0& alpha,
894 const Matrix<T1, Prop1, ColComplexSparse, Allocator1>& M,
895 const Vector<T2, Storage2, Allocator2>& X,
896 const T3& beta, Vector<T4, Storage4, Allocator4>& Y)
900 #ifdef SELDON_CHECK_DIMENSIONS
901 CheckDim(M, X, Y,
"MltAdd(alpha, M, X, beta, Y)");
906 typename ClassComplexType<T1>::Treal rzero(0);
907 long* real_ptr = M.GetRealPtr();
908 long* imag_ptr = M.GetImagPtr();
909 int* real_ind = M.GetRealInd();
910 int* imag_ind = M.GetImagInd();
911 typename Matrix<T1, Prop1, ColComplexSparse, Allocator1>::pointer
912 real_data = M.GetRealData();
913 typename Matrix<T1, Prop1, ColComplexSparse, Allocator1>::pointer
914 imag_data = M.GetImagData();
916 for (i = 0; i < M.GetN(); i++)
918 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
919 Y(real_ind[j]) += alpha * real_data[j] * X(i);
921 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
922 Y(imag_ind[j]) += alpha * T1(rzero, imag_data[j]) * X(i);
931 class T1,
class Prop1,
class Allocator1,
932 class T2,
class Storage2,
class Allocator2,
934 class T4,
class Storage4,
class Allocator4>
935 void MltAddVector(
const T0& alpha,
936 const Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>& M,
937 const Vector<T2, Storage2, Allocator2>& X,
938 const T3& beta, Vector<T4, Storage4, Allocator4>& Y)
942 #ifdef SELDON_CHECK_DIMENSIONS
943 CheckDim(M, X, Y,
"MltAdd(alpha, M, X, beta, Y)");
949 typename ClassComplexType<T1>::Treal rzero(0);
953 long* real_ptr = M.GetRealPtr();
954 long* imag_ptr = M.GetImagPtr();
955 int* real_ind = M.GetRealInd();
956 int* imag_ind = M.GetImagInd();
957 typename Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>::pointer
958 real_data = M.GetRealData();
959 typename Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>::pointer
960 imag_data = M.GetImagData();
962 for (i = 0; i < ma; i++)
965 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
967 temp += real_data[j] * X(real_ind[j]);
968 if (real_ind[j] != i)
969 Y(real_ind[j]) += alpha * real_data[j] * X(i);
972 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
974 temp += T1(rzero, imag_data[j]) * X(imag_ind[j]);
975 if (imag_ind[j] != i)
976 Y(imag_ind[j]) += alpha * T1(rzero, imag_data[j]) * X(i);
979 Y(i) += alpha * temp;
985 class T1,
class Prop1,
class Allocator1,
986 class T2,
class Storage2,
class Allocator2,
988 class T4,
class Storage4,
class Allocator4>
989 void MltAddVector(
const T0& alpha,
990 const Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>& M,
991 const Vector<T2, Storage2, Allocator2>& X,
992 const T3& beta, Vector<T4, Storage4, Allocator4>& Y)
996 #ifdef SELDON_CHECK_DIMENSIONS
997 CheckDim(M, X, Y,
"MltAdd(alpha, M, X, beta, Y)");
1003 typename ClassComplexType<T1>::Treal rzero(0);
1007 long* real_ptr = M.GetRealPtr();
1008 long* imag_ptr = M.GetImagPtr();
1009 int* real_ind = M.GetRealInd();
1010 int* imag_ind = M.GetImagInd();
1011 typename Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>::pointer
1012 real_data = M.GetRealData();
1013 typename Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>::pointer
1014 imag_data = M.GetImagData();
1016 for (i = 0; i<ma; i++)
1019 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
1021 temp += real_data[j] * X(real_ind[j]);
1022 if (real_ind[j] != i)
1023 Y(real_ind[j]) += alpha * real_data[j] * X(i);
1026 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
1028 temp += T1(rzero, imag_data[j]) * X(imag_ind[j]);
1029 if (imag_ind[j] != i)
1030 Y(imag_ind[j]) += alpha * T1(rzero, imag_data[j]) * X(i);
1033 Y(i) += alpha * temp;
1042 class T1,
class Prop1,
class Allocator1,
1043 class T2,
class Storage2,
class Allocator2,
1045 class T4,
class Storage4,
class Allocator4>
1046 void MltAddVector(
const T0& alpha,
1047 const SeldonTranspose& Trans,
1048 const Matrix<T1, Prop1, RowComplexSparse, Allocator1>& M,
1049 const Vector<T2, Storage2, Allocator2>& X,
1050 const T3& beta, Vector<T4, Storage4, Allocator4>& Y)
1052 if (Trans.NoTrans())
1054 MltAddVector(alpha, M, X, beta, Y);
1062 #ifdef SELDON_CHECK_DIMENSIONS
1063 CheckDim(Trans, M, X, Y,
"MltAdd(alpha, SeldonTrans, M, X, beta, Y)");
1068 typename ClassComplexType<T1>::Treal rzero(0);
1069 long* real_ptr = M.GetRealPtr();
1070 long* imag_ptr = M.GetImagPtr();
1071 int* real_ind = M.GetRealInd();
1072 int* imag_ind = M.GetImagInd();
1073 typename Matrix<T1, Prop1, RowComplexSparse, Allocator1>::pointer
1074 real_data = M.GetRealData();
1075 typename Matrix<T1, Prop1, RowComplexSparse, Allocator1>::pointer
1076 imag_data = M.GetImagData();
1080 for (i = 0; i < ma; i++)
1081 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
1082 Y(real_ind[j]) += alpha * real_data[j] * X(i);
1084 for (i = 0; i < ma; i++)
1085 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
1086 Y(imag_ind[j]) += alpha * T1(rzero, imag_data[j]) * X(i);
1090 for (i = 0; i < ma; i++)
1091 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
1092 Y(real_ind[j]) += alpha * real_data[j] * X(i);
1094 for (i = 0; i < ma; i++)
1095 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
1096 Y(imag_ind[j]) += alpha * T1(rzero, - imag_data[j]) * X(i);
1102 class T1,
class Prop1,
class Allocator1,
1103 class T2,
class Storage2,
class Allocator2,
1105 class T4,
class Storage4,
class Allocator4>
1106 void MltAddVector(
const T0& alpha,
1107 const SeldonTranspose& Trans,
1108 const Matrix<T1, Prop1, ColComplexSparse, Allocator1>& M,
1109 const Vector<T2, Storage2, Allocator2>& X,
1110 const T3& beta, Vector<T4, Storage4, Allocator4>& Y)
1112 if (Trans.NoTrans())
1114 MltAddVector(alpha, M, X, beta, Y);
1120 #ifdef SELDON_CHECK_DIMENSIONS
1121 CheckDim(Trans, M, X, Y,
"MltAdd(alpha, SeldonTrans, M, X, beta, Y)");
1127 typename ClassComplexType<T1>::Treal rzero(0);
1129 long* real_ptr = M.GetRealPtr();
1130 long* imag_ptr = M.GetImagPtr();
1131 int* real_ind = M.GetRealInd();
1132 int* imag_ind = M.GetImagInd();
1133 typename Matrix<T1, Prop1, ColComplexSparse, Allocator1>::pointer
1134 real_data = M.GetRealData();
1135 typename Matrix<T1, Prop1, ColComplexSparse, Allocator1>::pointer
1136 imag_data = M.GetImagData();
1140 for (i = 0; i < M.GetN(); i++)
1142 SetComplexZero(temp);
1143 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
1144 temp += real_data[j] * X(real_ind[j]);
1146 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
1147 temp += T1(rzero, imag_data[j]) * X(imag_ind[j]);
1149 Y(i) += alpha * temp;
1154 for (i = 0; i < M.GetN(); i++)
1156 SetComplexZero(temp);
1157 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
1158 temp += real_data[j] * X(real_ind[j]);
1160 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
1161 temp += T1(rzero, -imag_data[j]) * X(imag_ind[j]);
1163 Y(i) += alpha * temp;
1173 class T1,
class Prop1,
class Allocator1,
1174 class T2,
class Storage2,
class Allocator2,
1176 class T4,
class Storage4,
class Allocator4>
1177 void MltAddVector(
const T0& alpha,
1178 const SeldonTranspose& Trans,
1179 const Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>& M,
1180 const Vector<T2, Storage2, Allocator2>& X,
1181 const T3& beta, Vector<T4, Storage4, Allocator4>& Y)
1183 if (!Trans.ConjTrans())
1185 MltAddVector(alpha, M, X, beta, Y);
1191 #ifdef SELDON_CHECK_DIMENSIONS
1192 CheckDim(Trans, M, X, Y,
"MltAdd(alpha, SeldonConjTrans, M, X, beta, Y)");
1200 typename ClassComplexType<T1>::Treal rzero(0);
1202 long* real_ptr = M.GetRealPtr();
1203 long* imag_ptr = M.GetImagPtr();
1204 int* real_ind = M.GetRealInd();
1205 int* imag_ind = M.GetImagInd();
1206 typename Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>::pointer
1207 real_data = M.GetRealData();
1208 typename Matrix<T1, Prop1, RowSymComplexSparse, Allocator1>::pointer
1209 imag_data = M.GetImagData();
1211 for (i = 0; i < ma; i++)
1214 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
1216 temp += real_data[j] * X(real_ind[j]);
1217 if (real_ind[j] != i)
1218 Y(real_ind[j]) += alpha * real_data[j] * X(i);
1221 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
1223 temp += T1(rzero, - imag_data[j]) * X(imag_ind[j]);
1224 if (imag_ind[j] != i)
1225 Y(imag_ind[j]) += alpha * T1(rzero, - imag_data[j]) * X(i);
1228 Y(i) += alpha * temp;
1234 class T1,
class Prop1,
class Allocator1,
1235 class T2,
class Storage2,
class Allocator2,
1237 class T4,
class Storage4,
class Allocator4>
1238 void MltAddVector(
const T0& alpha,
1239 const SeldonTranspose& Trans,
1240 const Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>& M,
1241 const Vector<T2, Storage2, Allocator2>& X,
1242 const T3& beta, Vector<T4, Storage4, Allocator4>& Y)
1244 if (!Trans.ConjTrans())
1246 MltAddVector(alpha, M, X, beta, Y);
1252 #ifdef SELDON_CHECK_DIMENSIONS
1253 CheckDim(Trans, M, X, Y,
"MltAdd(alpha, SeldonConjTrans, M, X, beta, Y)");
1261 typename ClassComplexType<T1>::Treal rzero(0);
1263 long* real_ptr = M.GetRealPtr();
1264 long* imag_ptr = M.GetImagPtr();
1265 int* real_ind = M.GetRealInd();
1266 int* imag_ind = M.GetImagInd();
1267 typename Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>::pointer
1268 real_data = M.GetRealData();
1269 typename Matrix<T1, Prop1, ColSymComplexSparse, Allocator1>::pointer
1270 imag_data = M.GetImagData();
1272 for (i = 0; i < ma; i++)
1275 for (j = real_ptr[i]; j < real_ptr[i + 1]; j++)
1277 temp += real_data[j] * X(real_ind[j]);
1278 if (real_ind[j] != i)
1279 Y(real_ind[j]) += alpha * real_data[j] * X(i);
1282 for (j = imag_ptr[i]; j < imag_ptr[i + 1]; j++)
1284 temp += T1(rzero, - imag_data[j]) * X(imag_ind[j]);
1285 if (imag_ind[j] != i)
1286 Y(imag_ind[j]) += alpha * T1(rzero, - imag_data[j]) * X(i);
1289 Y(i) += alpha * temp;
1297 template<
class T0,
class T1,
class T2,
class T3,
class T4,
1298 class Allocator1,
class Allocator2,
class Allocator3>
1299 void MltAddVector(
const T0& alpha,
const Matrix<T1, Symmetric,
1300 ArrayRowSymComplexSparse, Allocator1>& A,
1301 const Vector<T2, VectFull, Allocator2>& B,
1303 Vector<T3, VectFull, Allocator3>& C)
1306 SetComplexZero(zero);
1314 int m = A.GetM(), n, p;
1315 typename ClassComplexType<T1>::Treal val;
1319 for (
int i = 0 ; i < m ; i++)
1321 n = A.GetRealRowSize(i);
1322 for (
int k = 0; k < n ; k++)
1324 p = A.IndexReal(i, k);
1325 val = A.ValueReal(i, k);
1334 n = A.GetImagRowSize(i);
1335 for (
int k = 0; k < n ; k++)
1337 p = A.IndexImag(i, k);
1338 val = A.ValueImag(i, k);
1340 C(i) += T1(0, val) * B(i);
1343 C(i) += T1(0, val) * B(p);
1344 C(p) += T1(0, val) * B(i);
1351 for (
int i = 0 ; i < m ; i++)
1353 n = A.GetRealRowSize(i);
1354 for (
int k = 0; k < n ; k++)
1356 p = A.IndexReal(i, k);
1357 val_cplx = alpha * T1(A.ValueReal(i, k), 0);
1359 C(i) += val_cplx * B(i);
1362 C(i) += val_cplx * B(p);
1363 C(p) += val_cplx * B(i);
1366 n = A.GetImagRowSize(i);
1367 for (
int k = 0; k < n ; k++)
1369 p = A.IndexImag(i, k);
1370 val_cplx = alpha * T1(0, A.ValueImag(i, k));
1372 C(i) += val_cplx * B(i);
1375 C(i) += val_cplx * B(p);
1376 C(p) += val_cplx * B(i);
1384 template<
class T0,
class T1,
class T2,
class T3,
class T4,
1385 class Allocator1,
class Allocator2,
class Allocator3>
1386 void MltAddVector(
const T0& alpha,
1387 const SeldonTranspose& Trans,
const Matrix<T1, Symmetric,
1388 ArrayRowSymComplexSparse, Allocator1>& A,
1389 const Vector<T2, VectFull, Allocator2>& B,
1391 Vector<T3, VectFull, Allocator3>& C)
1393 if (!Trans.ConjTrans())
1395 MltAddVector(alpha, A, B, beta, C);
1400 SetComplexZero(zero);
1408 int m = A.GetM(),n,p;
1409 typename ClassComplexType<T1>::Treal val;
1413 for (
int i = 0 ; i < m ; i++)
1415 n = A.GetRealRowSize(i);
1416 for (
int k = 0; k < n ; k++)
1418 p = A.IndexReal(i, k);
1419 val = A.ValueReal(i, k);
1428 n = A.GetImagRowSize(i);
1429 for (
int k = 0; k < n ; k++)
1431 p = A.IndexImag(i, k);
1432 val = A.ValueImag(i, k);
1434 C(i) -= T1(0, val) * B(i);
1437 C(i) -= T1(0, val) * B(p);
1438 C(p) -= T1(0, val) * B(i);
1446 for (
int i = 0 ; i < m ; i++)
1448 n = A.GetRealRowSize(i);
1449 for (
int k = 0; k < n ; k++)
1451 p = A.IndexReal(i, k);
1452 val_cplx = alpha * T1(A.ValueReal(i, k), 0);
1454 C(i) += val_cplx * B(i);
1457 C(i) += val_cplx * B(p);
1458 C(p) += val_cplx * B(i);
1461 n = A.GetImagRowSize(i);
1462 for (
int k = 0; k < n ; k++)
1464 p = A.IndexImag(i, k);
1465 val_cplx = alpha * T1(0, A.ValueImag(i, k));
1467 C(i) -= val_cplx * B(i);
1470 C(i) -= val_cplx * B(p);
1471 C(p) -= val_cplx * B(i);
1479 template<
class T0,
class T1,
class T2,
class T3,
class T4,
1480 class Allocator1,
class Allocator2,
class Allocator3>
1481 void MltAddVector(
const T0& alpha,
const Matrix<T1, Symmetric,
1482 ArrayColSymComplexSparse, Allocator1>& A,
1483 const Vector<T2, VectFull, Allocator2>& B,
1485 Vector<T3, VectFull, Allocator3>& C)
1488 SetComplexZero(zero);
1496 int m = A.GetM(), n, p;
1497 typename ClassComplexType<T1>::Treal val;
1501 for (
int i = 0 ; i < m ; i++)
1503 n = A.GetRealColumnSize(i);
1504 for (
int k = 0; k < n ; k++)
1506 p = A.IndexReal(i, k);
1507 val = A.ValueReal(i, k);
1516 n = A.GetImagColumnSize(i);
1517 for (
int k = 0; k < n ; k++)
1519 p = A.IndexImag(i, k);
1520 val = A.ValueImag(i, k);
1522 C(i) += T1(0, val) * B(i);
1525 C(i) += T1(0, val) * B(p);
1526 C(p) += T1(0, val) * B(i);
1533 for (
int i = 0 ; i < m ; i++)
1535 n = A.GetRealColumnSize(i);
1536 for (
int k = 0; k < n ; k++)
1538 p = A.IndexReal(i, k);
1539 val_cplx = alpha * T1(A.ValueReal(i, k), 0);
1541 C(i) += val_cplx * B(i);
1544 C(i) += val_cplx * B(p);
1545 C(p) += val_cplx * B(i);
1548 n = A.GetImagColumnSize(i);
1549 for (
int k = 0; k < n ; k++)
1551 p = A.IndexImag(i, k);
1552 val_cplx = alpha * T1(0, A.ValueImag(i, k));
1554 C(i) += val_cplx * B(i);
1557 C(i) += val_cplx * B(p);
1558 C(p) += val_cplx * B(i);
1566 template<
class T0,
class T1,
class T2,
class T3,
class T4,
1567 class Allocator1,
class Allocator2,
class Allocator3>
1568 void MltAddVector(
const T0& alpha,
1569 const SeldonTranspose& Trans,
const Matrix<T1, Symmetric,
1570 ArrayColSymComplexSparse, Allocator1>& A,
1571 const Vector<T2, VectFull, Allocator2>& B,
1573 Vector<T3, VectFull, Allocator3>& C)
1575 if (!Trans.ConjTrans())
1577 MltAddVector(alpha, A, B, beta, C);
1582 SetComplexZero(zero);
1590 int m = A.GetM(),n,p;
1591 typename ClassComplexType<T1>::Treal val;
1595 for (
int i = 0 ; i < m ; i++)
1597 n = A.GetRealColumnSize(i);
1598 for (
int k = 0; k < n ; k++)
1600 p = A.IndexReal(i, k);
1601 val = A.ValueReal(i, k);
1610 n = A.GetImagColumnSize(i);
1611 for (
int k = 0; k < n ; k++)
1613 p = A.IndexImag(i, k);
1614 val = A.ValueImag(i, k);
1616 C(i) -= T1(0, val) * B(i);
1619 C(i) -= T1(0, val) * B(p);
1620 C(p) -= T1(0, val) * B(i);
1628 for (
int i = 0 ; i < m ; i++)
1630 n = A.GetRealColumnSize(i);
1631 for (
int k = 0; k < n ; k++)
1633 p = A.IndexReal(i, k);
1634 val_cplx = alpha * T1(A.ValueReal(i, k), 0);
1636 C(i) += val_cplx * B(i);
1639 C(i) += val_cplx * B(p);
1640 C(p) += val_cplx * B(i);
1643 n = A.GetImagColumnSize(i);
1644 for (
int k = 0; k < n ; k++)
1646 p = A.IndexImag(i, k);
1647 val_cplx = alpha * T1(0, A.ValueImag(i, k));
1649 C(i) -= val_cplx * B(i);
1652 C(i) -= val_cplx * B(p);
1653 C(p) -= val_cplx * B(i);
1664 template<
class T0,
class T1,
class T2,
class T3,
class T4,
1665 class Allocator1,
class Allocator2,
class Allocator3>
1666 void MltAddVector(
const T0& alpha,
const Matrix<T1, General,
1667 ArrayRowComplexSparse, Allocator1>& A,
1668 const Vector<T2, VectFull, Allocator2>& B,
1670 Vector<T3, VectFull, Allocator3>& C)
1673 SetComplexZero(zero);
1681 int m = A.GetM(), n, p;
1682 typename ClassComplexType<T1>::Treal val;
1686 for (
int i = 0 ; i < m ; i++)
1688 n = A.GetRealRowSize(i);
1689 for (
int k = 0; k < n ; k++)
1691 p = A.IndexReal(i, k);
1692 val = A.ValueReal(i, k);
1695 n = A.GetImagRowSize(i);
1696 for (
int k = 0; k < n ; k++)
1698 p = A.IndexImag(i, k);
1699 val = A.ValueImag(i, k);
1700 C(i) += T1(0, val) * B(p);
1707 for (
int i = 0 ; i < m ; i++)
1709 n = A.GetRealRowSize(i);
1710 for (
int k = 0; k < n ; k++)
1712 p = A.IndexReal(i, k);
1713 val_cplx = alpha * T1(A.ValueReal(i, k), 0);
1714 C(i) += val_cplx * B(p);
1716 n = A.GetImagRowSize(i);
1717 for (
int k = 0; k < n ; k++)
1719 p = A.IndexImag(i, k);
1720 val_cplx = alpha * T1(0, A.ValueImag(i, k));
1721 C(i) += val_cplx * B(p);
1728 template<
class T0,
class T1,
class T2,
class T3,
class T4,
1729 class Allocator1,
class Allocator2,
class Allocator3>
1730 void MltAddVector(
const T0& alpha,
1731 const SeldonTranspose& Trans,
const Matrix<T1, General,
1732 ArrayRowComplexSparse, Allocator1>& A,
1733 const Vector<T2, VectFull, Allocator2>& B,
1735 Vector<T3, VectFull, Allocator3>& C)
1737 if (Trans.NoTrans())
1739 MltAddVector(alpha, A, B, beta, C);
1744 SetComplexZero(zero);
1752 int m = A.GetM(),n,p;
1753 typename ClassComplexType<T1>::Treal val;
1760 for (
int i = 0 ; i < m ; i++)
1762 n = A.GetRealRowSize(i);
1763 for (
int k = 0; k < n ; k++)
1765 p = A.IndexReal(i, k);
1766 val = A.ValueReal(i, k);
1769 n = A.GetImagRowSize(i);
1770 for (
int k = 0; k < n ; k++)
1772 p = A.IndexImag(i, k);
1773 val = A.ValueImag(i, k);
1774 C(p) += T1(0, val) * B(i);
1781 for (
int i = 0 ; i < m ; i++)
1783 n = A.GetRealRowSize(i);
1784 for (
int k = 0; k < n ; k++)
1786 p = A.IndexReal(i, k);
1787 val_cplx = alpha * T1(A.ValueReal(i, k), 0);
1788 C(p) += val_cplx * B(i);
1791 n = A.GetImagRowSize(i);
1792 for (
int k = 0; k < n ; k++)
1794 p = A.IndexImag(i, k);
1795 val_cplx = alpha * T1(0, A.ValueImag(i, k));
1796 C(p) += val_cplx * B(i);
1805 for (
int i = 0 ; i < m ; i++)
1807 n = A.GetRealRowSize(i);
1808 for (
int k = 0; k < n ; k++)
1810 p = A.IndexReal(i, k);
1811 val = A.ValueReal(i, k);
1814 n = A.GetImagRowSize(i);
1815 for (
int k = 0; k < n ; k++)
1817 p = A.IndexImag(i, k);
1818 val = A.ValueImag(i, k);
1819 C(p) -= T1(0, val) * B(i);
1826 for (
int i = 0 ; i < m ; i++)
1828 n = A.GetRealRowSize(i);
1829 for (
int k = 0; k < n ; k++)
1831 p = A.IndexReal(i, k);
1832 val_cplx = alpha * T1(A.ValueReal(i, k), 0);
1833 C(p) += val_cplx * B(i);
1835 n = A.GetImagRowSize(i);
1836 for (
int k = 0; k < n ; k++)
1838 p = A.IndexImag(i, k);
1839 val_cplx = alpha * T1(0, -A.ValueImag(i, k));
1840 C(p) += val_cplx * B(i);
1848 template<
class T0,
class T1,
class T2,
class T3,
class T4,
1849 class Allocator1,
class Allocator2,
class Allocator3>
1850 void MltAddVector(
const T0& alpha,
const Matrix<T1, General,
1851 ArrayColComplexSparse, Allocator1>& A,
1852 const Vector<T2, VectFull, Allocator2>& B,
1854 Vector<T3, VectFull, Allocator3>& C)
1857 SetComplexZero(zero);
1866 typename ClassComplexType<T1>::Treal val;
1870 for (
int i = 0 ; i < A.GetN(); i++)
1872 n = A.GetRealColumnSize(i);
1873 for (
int k = 0; k < n ; k++)
1875 p = A.IndexReal(i, k);
1876 val = A.ValueReal(i, k);
1879 n = A.GetImagColumnSize(i);
1880 for (
int k = 0; k < n ; k++)
1882 p = A.IndexImag(i, k);
1883 val = A.ValueImag(i, k);
1884 C(p) += T1(0, val) * B(i);
1891 for (
int i = 0; i < A.GetN(); i++)
1893 n = A.GetRealColumnSize(i);
1894 for (
int k = 0; k < n ; k++)
1896 p = A.IndexReal(i, k);
1897 val_cplx = alpha * T1(A.ValueReal(i, k), 0);
1898 C(p) += val_cplx * B(i);
1900 n = A.GetImagColumnSize(i);
1901 for (
int k = 0; k < n ; k++)
1903 p = A.IndexImag(i, k);
1904 val_cplx = alpha * T1(0, A.ValueImag(i, k));
1905 C(p) += val_cplx * B(i);
1912 template<
class T0,
class T1,
class T2,
class T3,
class T4,
1913 class Allocator1,
class Allocator2,
class Allocator3>
1914 void MltAddVector(
const T0& alpha,
1915 const SeldonTranspose& Trans,
const Matrix<T1, General,
1916 ArrayColComplexSparse, Allocator1>& A,
1917 const Vector<T2, VectFull, Allocator2>& B,
1919 Vector<T3, VectFull, Allocator3>& C)
1921 if (Trans.NoTrans())
1923 MltAddVector(alpha, A, B, beta, C);
1928 SetComplexZero(zero);
1937 typename ClassComplexType<T1>::Treal val;
1944 for (
int i = 0; i < A.GetN(); i++)
1946 n = A.GetRealColumnSize(i);
1947 for (
int k = 0; k < n ; k++)
1949 p = A.IndexReal(i, k);
1950 val = A.ValueReal(i, k);
1954 n = A.GetImagColumnSize(i);
1955 for (
int k = 0; k < n ; k++)
1957 p = A.IndexImag(i, k);
1958 val = A.ValueImag(i, k);
1959 C(i) += T1(0, val) * B(p);
1966 for (
int i = 0; i < A.GetN(); i++)
1968 n = A.GetRealColumnSize(i);
1969 for (
int k = 0; k < n ; k++)
1971 p = A.IndexReal(i, k);
1972 val_cplx = alpha * T1(A.ValueReal(i, k), 0);
1973 C(i) += val_cplx * B(p);
1976 n = A.GetImagColumnSize(i);
1977 for (
int k = 0; k < n ; k++)
1979 p = A.IndexImag(i, k);
1980 val_cplx = alpha * T1(0, A.ValueImag(i, k));
1981 C(i) += val_cplx * B(p);
1990 for (
int i = 0; i < A.GetN(); i++)
1992 n = A.GetRealColumnSize(i);
1993 for (
int k = 0; k < n; k++)
1995 p = A.IndexReal(i, k);
1996 val = A.ValueReal(i, k);
1999 n = A.GetImagColumnSize(i);
2000 for (
int k = 0; k < n; k++)
2002 p = A.IndexImag(i, k);
2003 val = A.ValueImag(i, k);
2004 C(i) -= T1(0, val) * B(p);
2011 for (
int i = 0 ; i < A.GetN(); i++)
2013 n = A.GetRealColumnSize(i);
2014 for (
int k = 0; k < n ; k++)
2016 p = A.IndexReal(i, k);
2017 val_cplx = alpha * T1(A.ValueReal(i, k), 0);
2018 C(i) += val_cplx * B(p);
2020 n = A.GetImagColumnSize(i);
2021 for (
int k = 0; k < n; k++)
2023 p = A.IndexImag(i, k);
2024 val_cplx = alpha * T1(0, -A.ValueImag(i, k));
2025 C(i) += val_cplx * B(p);
2045 template <
class T0,
class Prop0,
class Allocator0,
2046 class T1,
class Storage1,
class Allocator1,
2047 class T2,
class Storage2,
class Allocator2,
class T3>
2049 Vector<complex<T2>, Storage2, Allocator2>& X,
2050 const Vector<complex<T1>, Storage1, Allocator1>& B,
2051 const T3& omega,
int iter,
int type_ssor)
2053 complex<T1> temp, zero; T3 one;
2054 SetComplexZero(zero);
2059 #ifdef SELDON_CHECK_BOUNDS
2062 throw WrongDim(
"SOR",
"Matrix must be squared.");
2064 if (ma != X.GetM() || ma != B.GetM())
2065 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
2068 long* ptr_real = A.GetRealPtr();
2069 long* ptr_imag = A.GetImagPtr();
2070 int* ind_real = A.GetRealInd();
2071 int* ind_imag = A.GetImagInd();
2073 typename ClassComplexType<T0>::Treal* data_real = A.GetRealData();
2074 typename ClassComplexType<T0>::Treal* data_imag = A.GetImagData();
2078 if (type_ssor % 2 == 0)
2079 for (
int i = 0; i < iter; i++)
2080 for (
int j = 0; j < ma; j++)
2084 for (
long k = ptr_real[j]; k < ptr_real[j+1]; k++)
2086 if (ind_real[k] != j)
2087 temp += data_real[k] * X(ind_real[k]);
2092 for (
long k = ptr_imag[j]; k < ptr_imag[j+1]; k++)
2094 if (ind_imag[k] != j)
2095 temp += complex<T1>(0, data_imag[k]) * X(ind_imag[k]);
2097 ajj += complex<T1>(0, data_imag[k]);
2100 #ifdef SELDON_CHECK_BOUNDS
2103 " a non-null diagonal");
2106 X(j) = (one-omega) * X(j) + omega * (B(j) - temp) / ajj;
2109 if (type_ssor % 3 == 0)
2110 for (
int i = 0; i < iter; i++)
2111 for (
int j = ma-1; j >= 0; j--)
2115 for (
long k = ptr_real[j]; k < ptr_real[j+1]; k++)
2117 if (ind_real[k] != j)
2118 temp += data_real[k] * X(ind_real[k]);
2123 for (
long k = ptr_imag[j]; k < ptr_imag[j+1]; k++)
2125 if (ind_imag[k] != j)
2126 temp += complex<T1>(0, data_imag[k]) * X(ind_imag[k]);
2128 ajj += complex<T1>(0, data_imag[k]);
2131 X(j) = (one-omega) * X(j) + omega * (B(j) - temp) / ajj;
2144 template <
class T0,
class Prop0,
class Allocator0,
2145 class T1,
class Storage1,
class Allocator1,
2146 class T2,
class Storage2,
class Allocator2,
class T3>
2148 Vector<complex<T2>, Storage2, Allocator2>& X,
2149 const Vector<complex<T1>, Storage1, Allocator1>& B,
2150 const T3& omega,
int iter,
int type_ssor)
2152 complex<T1> temp, zero; T3 one;
2153 SetComplexZero(zero);
2158 #ifdef SELDON_CHECK_BOUNDS
2161 throw WrongDim(
"SOR",
"Matrix must be squared.");
2163 if (ma != X.GetM() || ma != B.GetM())
2164 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
2169 if (type_ssor%2 == 0)
2170 for (
int i = 0; i < iter; i++)
2171 for (
int j = 0; j < ma; j++)
2175 for (
int k = 0; k < A.GetRealRowSize(j); k++)
2177 if (A.IndexReal(j, k) != j)
2178 temp += A.ValueReal(j,k) * X(A.IndexReal(j,k));
2180 ajj += A.ValueReal(j, k);
2183 for (
int k = 0; k < A.GetImagRowSize(j); k++)
2185 if (A.IndexImag(j, k) != j)
2186 temp += T0(0, A.ValueImag(j,k))
2187 * X(A.IndexImag(j, k));
2189 ajj += T0(0, A.ValueImag(j,k));
2192 #ifdef SELDON_CHECK_BOUNDS
2195 " a non-null diagonal");
2198 X(j) = (one-omega) * X(j) + omega * (B(j) - temp) / ajj;
2201 if (type_ssor % 3 == 0)
2202 for (
int i = 0; i < iter; i++)
2203 for (
int j = ma-1; j >= 0; j--)
2207 for (
int k = 0; k < A.GetRealRowSize(j); k++)
2209 if (A.IndexReal(j, k) != j)
2210 temp += A.ValueReal(j,k) * X(A.IndexReal(j,k));
2212 ajj += A.ValueReal(j, k);
2215 for (
int k = 0; k < A.GetImagRowSize(j); k++)
2217 if (A.IndexImag(j, k) != j)
2218 temp += T0(0, A.ValueImag(j,k))
2219 * X(A.IndexImag(j, k));
2221 ajj += T0(0, A.ValueImag(j,k));
2224 X(j) = (one-omega) * X(j) + omega * (B(j) - temp) / ajj;
2237 template <
class T0,
class Prop0,
class Allocator0,
2238 class T1,
class Storage1,
class Allocator1,
2239 class T2,
class Storage2,
class Allocator2,
class T3>
2241 Vector<complex<T2>, Storage2, Allocator2>& X,
2242 const Vector<complex<T1>, Storage1, Allocator1>& B,
2243 const T3& omega,
int iter,
int type_ssor)
2245 complex<T1> zero; T3 one;
2246 SetComplexZero(zero);
2251 #ifdef SELDON_CHECK_BOUNDS
2254 throw WrongDim(
"SOR",
"Matrix must be squared.");
2256 if (ma != X.GetM() || ma != B.GetM())
2257 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
2260 long* ptr_real = A.GetRealPtr();
2261 long* ind_real = A.GetRealInd();
2262 typename ClassComplexType<T0>::Treal* data_real = A.GetRealData();
2264 int* ptr_imag = A.GetImagPtr();
2265 int* ind_imag = A.GetImagInd();
2266 typename ClassComplexType<T0>::Treal* data_imag = A.GetImagData();
2276 T3 coef = (one - omega) / omega;
2277 if (type_ssor % 2 == 0)
2278 for (
int i = 0; i < iter; i++)
2281 for (
int j = 0; j < ma; j++)
2283 long kr = ptr_real[j];
2284 while ( (kr < ptr_real[j+1]) && (ind_real[kr] < j))
2286 X(ind_real[kr]) -= data_real[kr]*X(j);
2290 if ( (kr < ptr_real[j+1]) && (ind_real[kr] == j))
2293 long ki = ptr_imag[j];
2294 while ( (ki < ptr_imag[j+1]) && (ind_imag[ki] < j))
2296 X(ind_imag[ki]) -= T0(0, data_imag[ki])*X(j);
2300 if ( (ki < ptr_imag[j+1]) && (ind_imag[ki] == j))
2301 ajj += T0(0, data_imag[ki]);
2303 #ifdef SELDON_CHECK_BOUNDS
2306 " a non-null diagonal");
2309 X(j) = B(j) + coef * ajj * X(j);
2313 for (
int j = 0; j < ma; j++)
2315 long kr = ptr_real[j];
2316 while ( (kr < ptr_real[j+1]) && (ind_real[kr] < j))
2319 if ( (kr < ptr_real[j+1]) && (ind_real[kr] == j))
2325 long ki = ptr_imag[j];
2326 while ( (ki < ptr_imag[j+1]) && (ind_imag[ki] < j))
2329 if ( (ki < ptr_imag[j+1]) && (ind_imag[ki] == j))
2331 ajj += T0(0, data_imag[ki]);
2336 while (kr < ptr_real[j+1])
2338 X(ind_real[kr]) -= data_real[kr]*X(j);
2342 while (ki < ptr_imag[j+1])
2344 X(ind_imag[ki]) -= T0(0, data_imag[ki])*X(j);
2352 if (type_ssor % 3 == 0)
2353 for (
int i = 0; i < iter; i++)
2356 for (
int j = ma-1; j >= 0; j--)
2358 long kr = ptr_real[j+1]-1;
2359 while ( (kr >= ptr_real[j]) && (ind_real[kr] > j) )
2361 X(ind_real[kr]) -= data_real[kr]*X(j);
2365 if ( (kr >= ptr_real[j]) && (ind_real[kr] == j))
2368 long ki = ptr_imag[j+1]-1;
2369 while ( (ki >= ptr_imag[j]) && (ind_imag[ki] > j) )
2371 X(ind_imag[ki]) -= T0(0, data_imag[ki])*X(j);
2375 if ( (ki >= ptr_imag[j]) && (ind_imag[ki] == j))
2376 ajj += T0(0, data_imag[ki]);
2378 #ifdef SELDON_CHECK_BOUNDS
2381 " a non-null diagonal");
2384 X(j) = B(j) + coef * ajj * X(j);
2388 for (
int j = ma-1; j >= 0; j--)
2390 long kr = ptr_real[j+1]-1;
2391 while ( (kr >= ptr_real[j]) && (ind_real[kr] > j) )
2394 if ( (kr >= ptr_real[j]) && (ind_real[kr] == j))
2396 ajj = T0(data_real[kr], 0);
2400 long ki = ptr_imag[j+1]-1;
2401 while ( (ki >= ptr_imag[j]) && (ind_imag[ki] > j) )
2404 if ( (ki >= ptr_imag[j]) && (ind_imag[ki] == j))
2406 ajj += T0(0, data_imag[ki]);
2411 while (kr >= ptr_real[j])
2413 X(ind_real[kr]) -= data_real[kr]*X(j);
2417 while (ki >= ptr_imag[j])
2419 X(ind_imag[ki]) -= T0(0, data_imag[ki])*X(j);
2435 template <
class T0,
class Prop0,
class Allocator0,
2436 class T1,
class Storage1,
class Allocator1,
2437 class T2,
class Storage2,
class Allocator2,
class T3>
2439 Vector<complex<T2>, Storage2, Allocator2>& X,
2440 const Vector<complex<T1>, Storage1, Allocator1>& B,
2441 const T3& omega,
int iter,
int type_ssor)
2443 complex<T1> zero; T3 one;
2444 SetComplexZero(zero);
2449 #ifdef SELDON_CHECK_BOUNDS
2452 throw WrongDim(
"SOR",
"Matrix must be squared.");
2454 if (ma != X.GetM() || ma != B.GetM())
2455 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
2466 T3 coef = (one - omega) / omega;
2467 if (type_ssor % 2 == 0)
2468 for (
int i = 0; i < iter; i++)
2471 for (
int j = 0; j < ma; j++)
2474 while ( (kr < A.GetRealColumnSize(j)) && (A.IndexReal(j, kr) < j))
2476 X(A.IndexReal(j, kr)) -= A.ValueReal(j, kr) * X(j);
2480 if ( (kr < A.GetRealColumnSize(j)) && (A.IndexReal(j, kr) == j))
2481 ajj = T0(A.ValueReal(j, kr), 0);
2484 while ( (ki < A.GetImagColumnSize(j)) && (A.IndexImag(j, ki) < j))
2486 X(A.IndexImag(j, ki)) -= T0(0, A.ValueImag(j, ki))*X(j);
2490 if ( (ki < A.GetImagColumnSize(j)) && (A.IndexImag(j, ki) == j) )
2491 ajj += T0(0, A.ValueImag(j, ki));
2493 #ifdef SELDON_CHECK_BOUNDS
2496 " a non-null diagonal");
2499 X(j) = B(j) + coef * ajj * X(j);
2503 for (
int j = 0; j < ma; j++)
2506 while ( (kr < A.GetRealColumnSize(j)) && (A.IndexReal(j, kr) < j))
2509 if ( (kr < A.GetRealColumnSize(j)) && (A.IndexReal(j, kr) == j) )
2511 ajj = T0(A.ValueReal(j, kr), 0);
2516 while ( (ki < A.GetImagColumnSize(j)) && (A.IndexImag(j, ki) < j))
2519 if ( (ki < A.GetImagColumnSize(j)) && (A.IndexImag(j, ki) == j))
2521 ajj += T0(0, A.ValueImag(j, ki));
2526 while (kr < A.GetRealColumnSize(j))
2528 X(A.IndexReal(j, kr)) -= A.ValueReal(j, kr)*X(j);
2532 while (ki < A.GetImagColumnSize(j))
2534 X(A.IndexImag(j, ki)) -= T0(0, A.ValueImag(j, ki))*X(j);
2542 if (type_ssor % 3 == 0)
2543 for (
int i = 0; i < iter; i++)
2546 for (
int j = ma-1; j >= 0; j--)
2548 long kr = A.GetRealColumnSize(j)-1;
2549 while ( (kr >= 0) && (A.IndexReal(j, kr) > j) )
2551 X(A.IndexReal(j, kr)) -= A.ValueReal(j, kr)*X(j);
2555 if ( (kr >= 0) && (A.IndexReal(j, kr) == j))
2556 ajj = T0(A.ValueReal(j, kr), 0);
2558 long ki = A.GetImagColumnSize(j)-1;
2559 while ( (ki >= 0) && (A.IndexImag(j, ki) > j) )
2561 X(A.IndexImag(j, ki)) -= T0(0, A.ValueImag(j, ki))*X(j);
2565 if ( (ki >= 0) && (A.IndexImag(j, ki) == j))
2566 ajj += T0(0, A.ValueImag(j, ki));
2568 #ifdef SELDON_CHECK_BOUNDS
2571 " a non-null diagonal");
2574 X(j) = B(j) + coef * ajj * X(j);
2578 for (
int j = ma-1; j >= 0; j--)
2580 long kr = A.GetRealColumnSize(j)-1;
2581 while ( (kr >= 0) && (A.IndexReal(j, kr) > j) )
2584 if ( (kr >= 0) && (A.IndexReal(j, kr) == j))
2586 ajj = T0(A.ValueReal(j, kr), 0);
2590 long ki = A.GetImagColumnSize(j)-1;
2591 while ( (ki >= 0) && (A.IndexImag(j, ki) > j) )
2594 if ( (ki >= 0) && (A.IndexImag(j, ki) == j))
2596 ajj += T0(0, A.ValueImag(j, ki));
2603 X(A.IndexReal(j, kr)) -= A.ValueReal(j, kr)*X(j);
2609 X(A.IndexImag(j, ki)) -= T0(0, A.ValueImag(j, ki))*X(j);
2625 template <
class T0,
class Prop0,
class Allocator0,
2626 class T1,
class Storage1,
class Allocator1,
2627 class T2,
class Storage2,
class Allocator2,
class T3>
2629 Vector<complex<T2>, Storage2, Allocator2>& X,
2630 const Vector<complex<T1>, Storage1, Allocator1>& B,
2631 const T3& omega,
int iter,
int type_ssor)
2633 complex<T1> temp, zero; T3 one;
2634 SetComplexZero(zero);
2639 #ifdef SELDON_CHECK_BOUNDS
2642 throw WrongDim(
"SOR",
"Matrix must be squared.");
2644 if (ma != X.GetM() || ma != B.GetM())
2645 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
2648 long* ptr_real = A.GetRealPtr();
2649 int* ind_real = A.GetRealInd();
2650 typename ClassComplexType<T0>::Treal* data_real = A.GetRealData();
2652 long* ptr_imag = A.GetImagPtr();
2653 int* ind_imag = A.GetImagInd();
2654 typename ClassComplexType<T0>::Treal* data_imag = A.GetImagData();
2665 T3 coef = (T3(1) - omega) / omega;
2666 if (type_ssor % 2 == 0)
2667 for (
int i = 0; i < iter; i++)
2670 for (
int j = 0; j < ma; j++)
2674 long kr = ptr_real[j];
2675 if ((kr < ptr_real[j+1]) && (ind_real[kr] == j))
2676 ajj = T0(data_real[kr++], 0);
2678 long ki = ptr_imag[j];
2679 if ((ki < ptr_imag[j+1]) && (ind_imag[ki] == j))
2680 ajj += T0(0, data_imag[ki++]);
2682 #ifdef SELDON_CHECK_BOUNDS
2685 " a non-null diagonal");
2688 for (
long k = kr; k < ptr_real[j+1]; k++)
2689 temp += data_real[k] * X(ind_real[k]);
2691 for (
long k = ki; k < ptr_imag[j+1]; k++)
2692 temp += T0(0, data_imag[k]) * X(ind_imag[k]);
2694 X(j) = coef * ajj * X(j) + B(j) - temp;
2698 for (
int j = 0; j < ma; j++)
2701 long kr = ptr_real[j];
2702 if ((kr < ptr_real[j+1]) && (ind_real[kr] == j))
2703 ajj = T0(data_real[kr++], 0);
2705 long ki = ptr_imag[j];
2706 if ((ki < ptr_imag[j+1]) && (ind_imag[ki] == j))
2707 ajj += T0(0, data_imag[ki++]);
2709 X(j) *= omega / ajj;
2710 for (
long k = kr; k < ptr_real[j+1]; k++)
2711 X(ind_real[k]) -= data_real[k]*X(j);
2713 for (
long k = ki; k < ptr_imag[j+1]; k++)
2714 X(ind_imag[k]) -= T0(0, data_imag[k])*X(j);
2721 if (type_ssor % 3 == 0)
2722 for (
int i = 0; i < iter; i++)
2725 for (
int j = ma-1; j >= 0; j--)
2728 long kr = ptr_real[j];
2729 if ((kr < ptr_real[j+1]) && (ind_real[kr] == j))
2730 ajj = T0(data_real[kr++], 0);
2732 long ki = ptr_imag[j];
2733 if ((ki < ptr_imag[j+1]) && (ind_imag[ki] == j))
2734 ajj += T0(0, data_imag[ki++]);
2736 for (
long k = kr; k < ptr_real[j+1]; k++)
2737 X(ind_real[k]) -= data_real[k]*X(j);
2739 for (
long k = ki; k < ptr_imag[j+1]; k++)
2740 X(ind_imag[k]) -= T0(0, data_imag[k])*X(j);
2742 X(j) = B(j) + coef * ajj * X(j);
2746 for (
int j = ma-1; j >= 0; j--)
2750 long kr = ptr_real[j];
2751 if ((kr < ptr_real[j+1]) && (ind_real[kr] == j))
2752 ajj = T0(data_real[kr++], 0);
2754 long ki = ptr_imag[j];
2755 if ((ki < ptr_imag[j+1]) && (ind_imag[ki] == j))
2756 ajj += T0(0, data_imag[ki++]);
2758 for (
long k = kr; k < ptr_real[j+1]; k++)
2759 temp += data_real[k]*X(ind_real[k]);
2761 for (
long k = ki; k < ptr_imag[j+1]; k++)
2762 temp += T0(0, data_imag[k])*X(ind_imag[k]);
2764 X(j) = (X(j) - temp) * omega / ajj;
2778 template <
class T0,
class Prop0,
class Allocator0,
2779 class T1,
class Storage1,
class Allocator1,
2780 class T2,
class Storage2,
class Allocator2,
class T3>
2782 Vector<complex<T2>, Storage2, Allocator2>& X,
2783 const Vector<complex<T1>, Storage1, Allocator1>& B,
2784 const T3& omega,
int iter,
int type_ssor)
2786 complex<T1> temp, zero; T3 one;
2787 SetComplexZero(zero);
2792 #ifdef SELDON_CHECK_BOUNDS
2795 throw WrongDim(
"SOR",
"Matrix must be squared.");
2797 if (ma != X.GetM() || ma != B.GetM())
2798 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
2810 T3 coef = (one - omega) / omega;
2811 if (type_ssor % 2 == 0)
2812 for (
int i = 0; i < iter; i++)
2815 for (
int j = 0; j < ma; j++)
2820 if ((kr < A.GetRealRowSize(j)) && (A.IndexReal(j, kr) == j))
2821 ajj = T0(A.ValueReal(j, kr++), 0);
2824 if ((ki < A.GetImagRowSize(j)) && (A.IndexImag(j, ki) == j))
2825 ajj += T0(0, A.ValueImag(j, ki++));
2827 #ifdef SELDON_CHECK_BOUNDS
2830 " a non-null diagonal");
2833 for (
int k = kr; k < A.GetRealRowSize(j); k++)
2834 temp += A.ValueReal(j, k) * X(A.IndexReal(j, k));
2836 for (
int k = ki; k < A.GetImagRowSize(j); k++)
2837 temp += T0(0, A.ValueImag(j, k)) * X(A.IndexImag(j, k));
2839 X(j) = coef * ajj * X(j) + B(j) - temp;
2843 for (
int j = 0; j < ma; j++)
2847 if ((kr < A.GetRealRowSize(j)) && (A.IndexReal(j, kr) == j))
2848 ajj = T0(A.ValueReal(j, kr++), 0);
2851 if ((ki < A.GetImagRowSize(j)) && (A.IndexImag(j, ki) == j))
2852 ajj += T0(0, A.ValueImag(j, ki++));
2854 X(j) *= omega / ajj;
2855 for (
int k = kr; k < A.GetRealRowSize(j); k++)
2856 X(A.IndexReal(j, k)) -= A.ValueReal(j, k)*X(j);
2858 for (
int k = ki; k < A.GetImagRowSize(j); k++)
2859 X(A.IndexImag(j, k)) -= T0(0, A.ValueImag(j, k))*X(j);
2866 if (type_ssor % 3 == 0)
2867 for (
int i = 0; i < iter; i++)
2870 for (
int j = ma-1; j >= 0; j--)
2874 if ((kr < A.GetRealRowSize(j)) && (A.IndexReal(j, kr) == j))
2875 ajj = T0(A.ValueReal(j, kr++), 0);
2878 if ((ki < A.GetImagRowSize(j)) && (A.IndexImag(j, ki) == j))
2879 ajj += T0(0, A.ValueImag(j, ki++));
2881 for (
int k = kr; k < A.GetRealRowSize(j); k++)
2882 X(A.IndexReal(j, k)) -= A.ValueReal(j, k)*X(j);
2884 for (
int k = ki; k < A.GetImagRowSize(j); k++)
2885 X(A.IndexImag(j, k)) -= T0(0, A.ValueImag(j, k))*X(j);
2887 X(j) = B(j) + coef * ajj * X(j);
2891 for (
int j = ma-1; j >= 0; j--)
2896 if ((kr < A.GetRealRowSize(j)) && (A.IndexReal(j, kr) == j))
2897 ajj = T0(A.ValueReal(j, kr++), 0);
2900 if ((ki < A.GetImagRowSize(j)) && (A.IndexImag(j, ki) == j))
2901 ajj += T0(0, A.ValueImag(j, ki++));
2903 for (
int k = kr; k < A.GetRealRowSize(j); k++)
2904 temp += A.ValueReal(j, k)*X(A.IndexReal(j, k));
2906 for (
int k = ki; k < A.GetImagRowSize(j); k++)
2907 temp += T0(0, A.ValueImag(j, k))*X(A.IndexImag(j, k));
2909 X(j) = (X(j) - temp) * omega / ajj;
2923 template <
class T0,
class Prop0,
class Allocator0,
2924 class T1,
class Storage1,
class Allocator1,
2925 class T2,
class Storage2,
class Allocator2,
class T3>
2927 Vector<complex<T2>, Storage2, Allocator2>& X,
2928 const Vector<complex<T1>, Storage1, Allocator1>& B,
2929 const T3& omega,
int iter,
int type_ssor)
2931 complex<T1> temp, zero; T3 one;
2932 SetComplexZero(zero);
2937 #ifdef SELDON_CHECK_BOUNDS
2940 throw WrongDim(
"SOR",
"Matrix must be squared.");
2942 if (ma != X.GetM() || ma != B.GetM())
2943 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
2946 long* ptr_real = A.GetRealPtr();
2947 int* ind_real = A.GetRealInd();
2948 typename ClassComplexType<T0>::Treal* data_real = A.GetRealData();
2950 long* ptr_imag = A.GetImagPtr();
2951 int* ind_imag = A.GetImagInd();
2952 typename ClassComplexType<T0>::Treal* data_imag = A.GetImagData();
2963 T3 coef = (one - omega) / omega;
2964 if (type_ssor % 2 == 0)
2965 for (
int i = 0; i < iter; i++)
2968 for (
int j = 0; j < ma; j++)
2971 long kr = ptr_real[j+1]-1;
2972 if ((kr >= ptr_real[j]) && (ind_real[kr] == j))
2973 ajj = T0(data_real[kr--], 0);
2975 long ki = ptr_imag[j+1]-1;
2976 if ((ki >= ptr_imag[j]) && (ind_imag[ki] == j))
2977 ajj += T0(0, data_imag[ki--]);
2979 #ifdef SELDON_CHECK_BOUNDS
2982 " a non-null diagonal");
2985 for (
long k = ptr_real[j]; k <= kr; k++)
2986 X(ind_real[k]) -= data_real[k] * X(j);
2988 for (
long k = ptr_imag[j]; k <= ki; k++)
2989 X(ind_imag[k]) -= T0(0, data_imag[k]) * X(j);
2991 X(j) = coef * ajj * X(j) + B(j);
2995 for (
int j = 0; j < ma; j++)
2998 long kr = ptr_real[j+1]-1;
2999 if ((kr >= ptr_real[j]) && (ind_real[kr] == j))
3000 ajj = T0(data_real[kr--], 0);
3002 long ki = ptr_imag[j+1]-1;
3003 if ((ki >= ptr_imag[j]) && (ind_imag[ki] == j))
3004 ajj += T0(0, data_imag[ki--]);
3006 for (
long k = ptr_real[j]; k <= kr; k++)
3007 X(j) -= data_real[k] * X(ind_real[k]);
3009 for (
long k = ptr_imag[j]; k <= ki; k++)
3010 X(j) -= T0(0, data_imag[k]) * X(ind_imag[k]);
3012 X(j) *= omega / ajj;
3019 if (type_ssor % 3 == 0)
3020 for (
int i = 0; i < iter; i++)
3023 for (
int j = ma-1; j >= 0; j--)
3027 long kr = ptr_real[j+1]-1;
3028 if ((kr >= ptr_real[j]) && (ind_real[kr] == j))
3029 ajj = T0(data_real[kr--], 0);
3031 long ki = ptr_imag[j+1]-1;
3032 if ((ki >= ptr_imag[j]) && (ind_imag[ki] == j))
3033 ajj += T0(0, data_imag[ki--]);
3035 for (
long k = ptr_real[j]; k <= kr; k++)
3036 temp -= data_real[k] * X(ind_real[k]);
3038 for (
long k = ptr_imag[j]; k <= ki; k++)
3039 temp -= T0(0, data_imag[k]) * X(ind_imag[k]);
3041 X(j) = B(j) + coef * ajj * X(j) + temp;
3045 for (
int j = ma-1; j >= 0; j--)
3049 long kr = ptr_real[j+1]-1;
3050 if ((kr >= ptr_real[j]) && (ind_real[kr] == j))
3051 ajj = T0(data_real[kr--], 0);
3053 long ki = ptr_imag[j+1]-1;
3054 if ((ki >= ptr_imag[j]) && (ind_imag[ki] == j))
3055 ajj += T0(0, data_imag[ki--]);
3057 X(j) *= omega / ajj;
3058 for (
long k = ptr_real[j]; k <= kr; k++)
3059 X(ind_real[k]) -= data_real[k] * X(j);
3061 for (
long k = ptr_imag[j]; k <= ki; k++)
3062 X(ind_imag[k]) -= T0(0, data_imag[k]) * X(j);
3076 template <
class T0,
class Prop0,
class Allocator0,
3077 class T1,
class Storage1,
class Allocator1,
3078 class T2,
class Storage2,
class Allocator2,
class T3>
3080 Vector<complex<T2>, Storage2, Allocator2>& X,
3081 const Vector<complex<T1>, Storage1, Allocator1>& B,
3082 const T3& omega,
int iter,
int type_ssor)
3084 complex<T1> temp, zero; T3 one;
3085 SetComplexZero(zero);
3090 #ifdef SELDON_CHECK_BOUNDS
3093 throw WrongDim(
"SOR",
"Matrix must be squared.");
3095 if (ma != X.GetM() || ma != B.GetM())
3096 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
3108 T3 coef = (T3(1) - omega) / omega;
3109 if (type_ssor % 2 == 0)
3110 for (
int i = 0; i < iter; i++)
3113 for (
int j = 0; j < ma; j++)
3116 int kr = A.GetRealColumnSize(j)-1;
3117 if ((kr >= 0) && (A.IndexReal(j, kr) == j))
3118 ajj = T0(A.ValueReal(j, kr--), 0);
3120 int ki = A.GetImagColumnSize(j)-1;
3121 if ((ki >= 0) && (A.IndexImag(j, ki) == j))
3122 ajj += T0(0, A.ValueImag(j, ki--));
3124 #ifdef SELDON_CHECK_BOUNDS
3127 " a non-null diagonal");
3130 for (
int k = 0; k <= kr; k++)
3131 X(A.IndexReal(j, k)) -= A.ValueReal(j, k) * X(j);
3133 for (
int k = 0; k <= ki; k++)
3134 X(A.IndexImag(j, k)) -= T0(0, A.ValueImag(j, k)) * X(j);
3136 X(j) = coef * ajj * X(j) + B(j);
3140 for (
int j = 0; j < ma; j++)
3143 int kr = A.GetRealColumnSize(j)-1;
3144 if ((kr >= 0) && (A.IndexReal(j, kr) == j))
3145 ajj = T0(A.ValueReal(j, kr--), 0);
3147 int ki = A.GetImagColumnSize(j)-1;
3148 if ((ki >= 0) && (A.IndexImag(j, ki) == j))
3149 ajj += T0(0, A.ValueImag(j, ki--));
3151 for (
int k = 0; k <= kr; k++)
3152 X(j) -= A.ValueReal(j, k) * X(A.IndexReal(j, k));
3154 for (
int k = 0; k <= ki; k++)
3155 X(j) -= T0(0, A.ValueImag(j, k)) * X(A.IndexImag(j, k));
3157 X(j) *= omega / ajj;
3164 if (type_ssor % 3 == 0)
3165 for (
int i = 0; i < iter; i++)
3168 for (
int j = ma-1; j >= 0; j--)
3172 int kr = A.GetRealColumnSize(j)-1;
3173 if ((kr >= 0) && (A.IndexReal(j, kr) == j))
3174 ajj = T0(A.ValueReal(j, kr--), 0);
3176 int ki = A.GetImagColumnSize(j)-1;
3177 if ((ki >= 0) && (A.IndexImag(j, ki) == j))
3178 ajj += T0(0, A.ValueImag(j, ki--));
3180 for (
int k = 0; k <= kr; k++)
3181 temp -= A.ValueReal(j, k) * X(A.IndexReal(j, k));
3183 for (
int k = 0; k <= ki; k++)
3184 temp -= T0(0, A.ValueImag(j, k)) * X(A.IndexImag(j, k));
3186 X(j) = B(j) + coef * ajj * X(j) + temp;
3190 for (
int j = ma-1; j >= 0; j--)
3194 int kr = A.GetRealColumnSize(j)-1;
3195 if ((kr >= 0) && (A.IndexReal(j, kr) == j))
3196 ajj = T0(A.ValueReal(j, kr--), 0);
3198 int ki = A.GetImagColumnSize(j)-1;
3199 if ((ki >= 0) && (A.IndexImag(j, ki) == j))
3200 ajj += T0(0, A.ValueImag(j, ki--));
3202 X(j) *= omega / ajj;
3203 for (
int k = 0; k <= kr; k++)
3204 X(A.IndexReal(j, k)) -= A.ValueReal(j, k) * X(j);
3206 for (
int k = 0; k <= ki; k++)
3207 X(A.IndexImag(j, k)) -= T0(0, A.ValueImag(j, k)) * X(j);
3221 template <
class T0,
class Prop0,
class Allocator0,
3222 class T1,
class Storage1,
class Allocator1,
3223 class T2,
class Storage2,
class Allocator2,
class T3>
3226 Vector<complex<T2>, Storage2, Allocator2>& X,
3227 const Vector<complex<T1>, Storage1, Allocator1>& B,
3228 const T3& omega,
int iter,
int type_ssor)
3230 if (transM.NoTrans())
3231 return SorVector(A, X, B, omega, iter, type_ssor);
3233 complex<T1> temp, zero; T3 one;
3234 SetComplexZero(zero);
3239 #ifdef SELDON_CHECK_BOUNDS
3242 throw WrongDim(
"SOR",
"Matrix must be squared.");
3244 if (ma != X.GetM() || ma != B.GetM())
3245 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
3248 long* ptr_real = A.GetRealPtr();
3249 long* ptr_imag = A.GetImagPtr();
3250 int* ind_real = A.GetRealInd();
3251 int* ind_imag = A.GetImagInd();
3253 typename ClassComplexType<T0>::Treal* data_real = A.GetRealData();
3254 typename ClassComplexType<T0>::Treal* data_imag = A.GetImagData();
3258 if (type_ssor % 2 == 0)
3259 for (
int i = 0; i < iter; i++)
3260 for (
int j = 0; j < ma; j++)
3264 for (
long k = ptr_real[j]; k < ptr_real[j+1]; k++)
3266 if (ind_real[k] != j)
3267 temp += data_real[k] * X(ind_real[k]);
3269 ajj = T0(data_real[k], 0);
3272 for (
long k = ptr_imag[j]; k < ptr_imag[j+1]; k++)
3274 if (ind_imag[k] != j)
3275 temp += complex<T1>(0, data_imag[k]) * X(ind_imag[k]);
3277 ajj += complex<T1>(0, data_imag[k]);
3280 #ifdef SELDON_CHECK_BOUNDS
3283 " a non-null diagonal");
3286 X(j) = (one-omega) * X(j) + omega * (B(j) - temp) / ajj;
3289 if (type_ssor % 3 == 0)
3290 for (
int i = 0; i < iter; i++)
3291 for (
int j = ma-1; j >= 0; j--)
3295 for (
long k = ptr_real[j]; k < ptr_real[j+1]; k++)
3297 if (ind_real[k] != j)
3298 temp += data_real[k] * X(ind_real[k]);
3300 ajj = T0(data_real[k], 0);
3303 for (
long k = ptr_imag[j]; k < ptr_imag[j+1]; k++)
3305 if (ind_imag[k] != j)
3306 temp += complex<T1>(0, data_imag[k]) * X(ind_imag[k]);
3308 ajj += complex<T1>(0, data_imag[k]);
3311 X(j) = (one-omega) * X(j) + omega * (B(j) - temp) / ajj;
3324 template <
class T0,
class Prop0,
class Allocator0,
3325 class T1,
class Storage1,
class Allocator1,
3326 class T2,
class Storage2,
class Allocator2,
class T3>
3329 Vector<complex<T2>, Storage2, Allocator2>& X,
3330 const Vector<complex<T1>, Storage1, Allocator1>& B,
3331 const T3& omega,
int iter,
int type_ssor)
3333 if (transM.NoTrans())
3334 return SorVector(A, X, B, omega, iter, type_ssor);
3336 complex<T1> temp, zero; T3 one;
3337 SetComplexZero(zero);
3342 #ifdef SELDON_CHECK_BOUNDS
3345 throw WrongDim(
"SOR",
"Matrix must be squared.");
3347 if (ma != X.GetM() || ma != B.GetM())
3348 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
3353 if (type_ssor%2 == 0)
3354 for (
int i = 0; i < iter; i++)
3355 for (
int j = 0; j < ma; j++)
3359 for (
int k = 0; k < A.GetRealColumnSize(j); k++)
3361 if (A.IndexReal(j, k) != j)
3362 temp += A.ValueReal(j,k) * X(A.IndexReal(j,k));
3364 ajj += A.ValueReal(j, k);
3367 for (
int k = 0; k < A.GetImagColumnSize(j); k++)
3369 if (A.IndexImag(j, k) != j)
3370 temp += T0(0, A.ValueImag(j,k))
3371 * X(A.IndexImag(j, k));
3373 ajj += T0(0, A.ValueImag(j,k));
3376 #ifdef SELDON_CHECK_BOUNDS
3379 " a non-null diagonal");
3382 X(j) = (one-omega) * X(j) + omega * (B(j) - temp) / ajj;
3385 if (type_ssor % 3 == 0)
3386 for (
int i = 0; i < iter; i++)
3387 for (
int j = ma-1; j >= 0; j--)
3391 for (
int k = 0; k < A.GetRealColumnSize(j); k++)
3393 if (A.IndexReal(j, k) != j)
3394 temp += A.ValueReal(j,k) * X(A.IndexReal(j,k));
3396 ajj += A.ValueReal(j, k);
3399 for (
int k = 0; k < A.GetImagColumnSize(j); k++)
3401 if (A.IndexImag(j, k) != j)
3402 temp += T0(0, A.ValueImag(j,k))
3403 * X(A.IndexImag(j, k));
3405 ajj += T0(0, A.ValueImag(j,k));
3408 X(j) = (one-omega) * X(j) + omega * (B(j) - temp) / ajj;
3421 template <
class T0,
class Prop0,
class Allocator0,
3422 class T1,
class Storage1,
class Allocator1,
3423 class T2,
class Storage2,
class Allocator2,
class T3>
3426 Vector<complex<T2>, Storage2, Allocator2>& X,
3427 const Vector<complex<T1>, Storage1, Allocator1>& B,
3428 const T3& omega,
int iter,
int type_ssor)
3430 if (transM.NoTrans())
3431 return SorVector(A, X, B, omega, iter, type_ssor);
3433 complex<T1> zero; T3 one;
3434 SetComplexZero(zero);
3439 #ifdef SELDON_CHECK_BOUNDS
3442 throw WrongDim(
"SOR",
"Matrix must be squared.");
3444 if (ma != X.GetM() || ma != B.GetM())
3445 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
3448 long* ptr_real = A.GetRealPtr();
3449 int* ind_real = A.GetRealInd();
3450 typename ClassComplexType<T0>::Treal* data_real = A.GetRealData();
3452 long* ptr_imag = A.GetImagPtr();
3453 int* ind_imag = A.GetImagInd();
3454 typename ClassComplexType<T0>::Treal* data_imag = A.GetImagData();
3464 T3 coef = (one - omega) / omega;
3465 if (type_ssor % 2 == 0)
3466 for (
int i = 0; i < iter; i++)
3469 for (
int j = 0; j < ma; j++)
3471 long kr = ptr_real[j];
3472 while ( (kr < ptr_real[j+1]) && (ind_real[kr] < j))
3474 X(ind_real[kr]) -= data_real[kr]*X(j);
3478 if ( (kr < ptr_real[j+1]) && (ind_real[kr] == j))
3479 ajj = T0(data_real[kr], 0);
3481 long ki = ptr_imag[j];
3482 while ( (ki < ptr_imag[j+1]) && (ind_imag[ki] < j))
3484 X(ind_imag[ki]) -= T0(0, data_imag[ki])*X(j);
3488 if ( (ki < ptr_imag[j+1]) && (ind_imag[ki] == j))
3489 ajj += T0(0, data_imag[ki]);
3491 #ifdef SELDON_CHECK_BOUNDS
3494 " a non-null diagonal");
3497 X(j) = B(j) + coef * ajj * X(j);
3501 for (
int j = 0; j < ma; j++)
3503 long kr = ptr_real[j];
3504 while ( (kr < ptr_real[j+1]) && (ind_real[kr] < j))
3507 if ( (kr < ptr_real[j+1]) && (ind_real[kr] == j))
3509 ajj = T0(data_real[kr], 0);
3513 long ki = ptr_imag[j];
3514 while ( (ki < ptr_imag[j+1]) && (ind_imag[ki] < j))
3517 if ( (ki < ptr_imag[j+1]) && (ind_imag[ki] == j))
3519 ajj += T0(0, data_imag[ki]);
3524 while (kr < ptr_real[j+1])
3526 X(ind_real[kr]) -= data_real[kr]*X(j);
3530 while (ki < ptr_imag[j+1])
3532 X(ind_imag[ki]) -= T0(0, data_imag[ki])*X(j);
3540 if (type_ssor % 3 == 0)
3541 for (
int i = 0; i < iter; i++)
3544 for (
int j = ma-1; j >= 0; j--)
3546 long kr = ptr_real[j+1]-1;
3547 while ( (kr >= ptr_real[j]) && (ind_real[kr] > j) )
3549 X(ind_real[kr]) -= data_real[kr]*X(j);
3553 if ( (kr >= ptr_real[j]) && (ind_real[kr] == j))
3554 ajj = T0(data_real[kr], 0);
3556 long ki = ptr_imag[j+1]-1;
3557 while ( (ki >= ptr_imag[j]) && (ind_imag[ki] > j) )
3559 X(ind_imag[ki]) -= T0(0, data_imag[ki])*X(j);
3563 if ( (ki >= ptr_imag[j]) && (ind_imag[ki] == j))
3564 ajj += T0(0, data_imag[ki]);
3566 #ifdef SELDON_CHECK_BOUNDS
3569 " a non-null diagonal");
3572 X(j) = B(j) + coef * ajj * X(j);
3576 for (
int j = ma-1; j >= 0; j--)
3578 long kr = ptr_real[j+1]-1;
3579 while ( (kr >= ptr_real[j]) && (ind_real[kr] > j) )
3582 if ( (kr >= ptr_real[j]) && (ind_real[kr] == j))
3584 ajj = T0(data_real[kr], 0);
3588 long ki = ptr_imag[j+1]-1;
3589 while ( (ki >= ptr_imag[j]) && (ind_imag[ki] > j) )
3592 if ( (ki >= ptr_imag[j]) && (ind_imag[ki] == j))
3594 ajj += T0(0, data_imag[ki]);
3599 while (kr >= ptr_real[j])
3601 X(ind_real[kr]) -= data_real[kr]*X(j);
3605 while (ki >= ptr_imag[j])
3607 X(ind_imag[ki]) -= T0(0, data_imag[ki])*X(j);
3623 template <
class T0,
class Prop0,
class Allocator0,
3624 class T1,
class Storage1,
class Allocator1,
3625 class T2,
class Storage2,
class Allocator2,
class T3>
3628 Vector<complex<T2>, Storage2, Allocator2>& X,
3629 const Vector<complex<T1>, Storage1, Allocator1>& B,
3630 const T3& omega,
int iter,
int type_ssor)
3632 if (transM.NoTrans())
3633 return SorVector(A, X, B, omega, iter, type_ssor);
3635 complex<T1> zero; T3 one;
3636 SetComplexZero(zero);
3641 #ifdef SELDON_CHECK_BOUNDS
3644 throw WrongDim(
"SOR",
"Matrix must be squared.");
3646 if (ma != X.GetM() || ma != B.GetM())
3647 throw WrongDim(
"SOR",
"Matrix and vector dimensions are incompatible.");
3658 T3 coef = (one - omega) / omega;
3659 if (type_ssor % 2 == 0)
3660 for (
int i = 0; i < iter; i++)
3663 for (
int j = 0; j < ma; j++)
3666 while ( (kr < A.GetRealRowSize(j)) && (A.IndexReal(j, kr) < j))
3668 X(A.IndexReal(j, kr)) -= A.ValueReal(j, kr) * X(j);
3672 if ( (kr < A.GetRealRowSize(j)) && (A.IndexReal(j, kr) == j))
3673 ajj = T0(A.ValueReal(j, kr), 0);
3676 while ( (ki < A.GetImagRowSize(j)) && (A.IndexImag(j, ki) < j))
3678 X(A.IndexImag(j, ki)) -= T0(0, A.ValueImag(j, ki))*X(j);
3682 if ( (ki < A.GetImagRowSize(j)) && (A.IndexImag(j, ki) == j) )
3683 ajj += T0(0, A.ValueImag(j, ki));
3685 #ifdef SELDON_CHECK_BOUNDS
3688 " a non-null diagonal");
3691 X(j) = B(j) + coef * ajj * X(j);
3695 for (
int j = 0; j < ma; j++)
3698 while ( (kr < A.GetRealRowSize(j)) && (A.IndexReal(j, kr) < j))
3701 if ( (kr < A.GetRealRowSize(j)) && (A.IndexReal(j, kr) == j) )
3703 ajj = T0(A.ValueReal(j, kr), 0);
3708 while ( (ki < A.GetImagRowSize(j)) && (A.IndexImag(j, ki) < j))
3711 if ( (ki < A.GetImagRowSize(j)) && (A.IndexImag(j, ki) == j))
3713 ajj += T0(0, A.ValueImag(j, ki));
3718 while (kr < A.GetRealRowSize(j))
3720 X(A.IndexReal(j, kr)) -= A.ValueReal(j, kr)*X(j);
3724 while (ki < A.GetImagRowSize(j))
3726 X(A.IndexImag(j, ki)) -= T0(0, A.ValueImag(j, ki))*X(j);
3734 if (type_ssor % 3 == 0)
3735 for (
int i = 0; i < iter; i++)
3738 for (
int j = ma-1; j >= 0; j--)
3740 int kr = A.GetRealRowSize(j)-1;
3741 while ( (kr >= 0) && (A.IndexReal(j, kr) > j) )
3743 X(A.IndexReal(j, kr)) -= A.ValueReal(j, kr)*X(j);
3747 if ( (kr >= 0) && (A.IndexReal(j, kr) == j))
3748 ajj = T0(A.ValueReal(j, kr), 0);
3750 int ki = A.GetImagRowSize(j)-1;
3751 while ( (ki >= 0) && (A.IndexImag(j, ki) > j) )
3753 X(A.IndexImag(j, ki)) -= T0(0, A.ValueImag(j, ki))*X(j);
3757 if ( (ki >= 0) && (A.IndexImag(j, ki) == j))
3758 ajj += T0(0, A.ValueImag(j, ki));
3760 #ifdef SELDON_CHECK_BOUNDS
3763 " a non-null diagonal");
3766 X(j) = B(j) + coef * ajj * X(j);
3770 for (
int j = ma-1; j >= 0; j--)
3772 int kr = A.GetRealRowSize(j)-1;
3773 while ( (kr >= 0) && (A.IndexReal(j, kr) > j) )
3776 if ( (kr >= 0) && (A.IndexReal(j, kr) == j))
3778 ajj = T0(A.ValueReal(j, kr), 0);
3782 int ki = A.GetImagRowSize(j)-1;
3783 while ( (ki >= 0) && (A.IndexImag(j, ki) > j) )
3786 if ( (ki >= 0) && (A.IndexImag(j, ki) == j))
3788 ajj += T0(0, A.ValueImag(j, ki));
3795 X(A.IndexReal(j, kr)) -= A.ValueReal(j, kr)*X(j);
3801 X(A.IndexImag(j, ki)) -= T0(0, A.ValueImag(j, ki))*X(j);
3817 template <
class T0,
class Prop0,
class Allocator0,
3818 class T1,
class Storage1,
class Allocator1,
3819 class T2,
class Storage2,
class Allocator2,
class T3>
3822 Vector<complex<T2>, Storage2, Allocator2>& X,
3823 const Vector<complex<T1>, Storage1, Allocator1>& B,
3824 const T3& omega,
int iter,
int type_ssor)
3826 SorVector(A, X, B, omega, iter, type_ssor);
3838 template <
class T0,
class Prop0,
class Allocator0,
3839 class T1,
class Storage1,
class Allocator1,
3840 class T2,
class Storage2,
class Allocator2,
class T3>
3843 Vector<complex<T2>, Storage2, Allocator2>& X,
3844 const Vector<complex<T1>, Storage1, Allocator1>& B,
3845 const T3& omega,
int iter,
int type_ssor)
3847 SorVector(A, X, B, omega, iter, type_ssor);
3859 template <
class T0,
class Prop0,
class Allocator0,
3860 class T1,
class Storage1,
class Allocator1,
3861 class T2,
class Storage2,
class Allocator2,
class T3>
3864 Vector<complex<T2>, Storage2, Allocator2>& X,
3865 const Vector<complex<T1>, Storage1, Allocator1>& B,
3866 const T3& omega,
int iter,
int type_ssor)
3868 SorVector(A, X, B, omega, iter, type_ssor);
3880 template <
class T0,
class Prop0,
class Allocator0,
3881 class T1,
class Storage1,
class Allocator1,
3882 class T2,
class Storage2,
class Allocator2,
class T3>
3885 Vector<complex<T2>, Storage2, Allocator2>& X,
3886 const Vector<complex<T1>, Storage1, Allocator1>& B,
3887 const T3& omega,
int iter,
int type_ssor)
3889 SorVector(A, X, B, omega, iter, type_ssor);
3898 #define SELDON_FILE_FUNCTIONS_MATVECT_COMPLEX_CXX