TBCI Numerical high perf. C++ Library 2.8.0
symm_bdmatrix.h
Go to the documentation of this file.
1
5// Version 2.0
6//
7//--------------------------------------------------------------------
8// NOTE: The whole code in this files is based on the assumption that
9// the main diagonal of an object of type Symm_BdMatrix has been
10// allocated. This should be taken into account upon doing changes.
11// 13th of march 1999
12//--------------------------------------------------------------------
13// Jose L. Tinoco,
14// Feb. 1999
15// $Id: symm_bdmatrix.h,v 1.15.2.13 2019/05/28 11:13:02 garloff Exp $
16//--------------------------------------------------------------------
17
18#ifndef _SYMM_BAND_MATRIX
19#define _SYMM_BAND_MATRIX
20
21#include "tbci/vector.h"
22#include "tbci/matrix_sig.h"
23//#include "solver/ilu0precond.h"
24
25template <typename T> class Symm_BdMatrix;
26// Avoid -fguiding-decls
27#if !defined(NO_GD) && !defined(AUTO_DECL)
28# include "tbci/symm_bdmatrix_gd.h"
29#endif
30
32
33// Forward - declarations
34template <typename T> class Symm_BdMatrix;
35//template <typename T, typename MatrixType = Symm_BdMatrix<T> > class ILU0_Symm_BdMatrixPreconditioner;
36template <typename T> class ILU0_Symm_BdMatrixPreconditioner;
37
38
39#ifndef TBCI_DISABLE_EXCEPT
40//# include "except.h" is in basics.h
41
43class SymmBdMatrixErr : public NumErr
44{
45 public:
47 : NumErr("Error in var conf Symm_BdMatrix class") {}
48 SymmBdMatrixErr(const char* t, const long i = 0)
49 : NumErr(t, i) {}
51 : NumErr(be) {}
52 virtual ~SymmBdMatrixErr() throw() {}
53};
54#endif /* TBCI_DISABLE_EXCEPT */
55
56// Class declarations
57//--------------------------------------------------------------------
62template<typename T>
63class Symm_BdMatrix : public Matrix_Sig<T>
64{
66
67 protected:
69 T* elementPtr; // Allocation of all diagonals as a single vector
70 unsigned int dimension;
71 BVector<T*> rowPtr; // Elements point to entries in main diag
72 BVector<unsigned int> rowOccupation; // which diags have been allocated
74
75 void construct (const unsigned int N, const T&, T*&,
78 inline void create (const T& val, const unsigned int N);
79 inline void create (const T& val, const unsigned int N,
81 inline void destroy ();
82 public:
83 // Constructor, Destructor
84 Symm_BdMatrix () { create(T(0),1); }
85 Symm_BdMatrix (const unsigned int N) { create(T(0),N); }
86 Symm_BdMatrix (const T& val, const unsigned int N) { create(val,N); }
87 Symm_BdMatrix (const T& val, const unsigned int N,
88 const BVector<unsigned int>& diagConf) { create(val,N,diagConf); }
89 //Symm_BdMatrix(const Matrix_Sig<T>&);
90
91 inline void resize (const T&, const unsigned int);
92 inline void resize (const unsigned int newDim) { resize (0, newDim); }
93 inline void resize (const T&, const unsigned int N, const BVector<unsigned int>&);
94
96
97 // allow instantiation (Matrix_Sig)
98 /*virtual*/ const char* mat_info () const { return ("Symm_BdMatrix"); }
99
100 // element access
101 const T& operator() (const unsigned int i, const unsigned int k) const;
102 const T& get (const unsigned int i, const unsigned int k) const
103 { return (*this) (i, k); }
104 friend STD__ ostream& operator<< FGD (STD__ ostream&, const Symm_BdMatrix<T>&);
105 T& setval (const unsigned int i, const unsigned int k);
106 void setval (const T& wert, const unsigned int i, const unsigned int k)
107 { setval (i,k) = wert; }
108 void autoinsert (const T& wert, const unsigned int i, const unsigned int k)
109 { setval (i,k) = wert; }
110
111 // Matrix-Vector-Multiplication
112 TVector<T> operator * (const Vector<T>&) const;
113
114 // Misc
115 unsigned int rows () const { return dimension; }
116 unsigned int columns () const { return dimension; }
117 void clear ();
118 // typedefs
119 typedef T value_type;
121 typedef T aligned_value_type TALIGN(MIN_ALIGN2);
122
123};
124
125
126/********************************************************************
127 ******************* Memberdefinitions ***********************
128 ********************************************************************/
129
130
131template<typename T>
132inline void Symm_BdMatrix<T>::resize (const T& val, const unsigned int N)
133{
134 destroy ();
135 create (val, N);
136}
137
138template<typename T>
139inline void Symm_BdMatrix<T>::resize (const T& val, const unsigned int N,
140 const BVector<unsigned int>& Diagconf)
141{
142 destroy ();
143 create (val, N, Diagconf);
144}
145
146
147
148//--------------------------------------------------------------------
149// Konstruktor: Allokiert nur die Hauptdiagonale, initialisiert alle
150// Eintraege auf T(0) und setzt alle privaten Variablen
151template<typename T>
152inline void Symm_BdMatrix<T>::create (const T& wert, const unsigned int dim)
153{
154 dimension = dim;
155 zero = T(0);
156 conf.resize (0);
157 rowPtr.resize (dim);
158 rowOccupation.resize (dim);
159
160 // check
161 if(dim==0)
162 STD__ cerr << "void Symm_BdMatrix<T>::Symm_BdMatrix(const T&, const unsigned int)" << STD__ endl
163 << "Invalid constructor parameters: Matrix can not have dimension == 0" << STD__ endl;
164
165 // erzeuge Speicherbereich
167
168}// End OF Symm_BdMatrix<T>::Symm_BdMatrix (const T&, const unsigned int)
169
170
171
172//--------------------------------------------------------------------
173// Constructor: Allokiert die Hauptdiagonale und die Nebendiagonalen
174// mit den Nummern configVector(0), configVector(1), configVector(2),
175// u.s.w., initiallisiert alle Eintraege auf T(0) und setzt alle privaten
176// Variablen
177template<typename T>
178inline void Symm_BdMatrix<T>::create(const T& wert, const unsigned int dim,
179 const BVector<unsigned int>& configVector)
180{
181 dimension=dim;
182 zero=T(0);
183 conf.resize(configVector.size());
184 rowPtr.resize(dim);
185 rowOccupation.resize(dim);
186
187 // check
188 if(dim==0)
189 STD__ cerr << "void Symm_BdMatrix<T>::Symm_BdMatrix(const T&, const unsigned int, const BVector<unsigned int>&)" << STD__ endl
190 << "Invalid constructor parameters: Matrix can not have dimension == 0" << STD__ endl;
191 if(configVector.size()>=dim)
192 STD__ cerr << "void Symm_BdMatrix<T>::Symm_BdMatrix(const T&, const unsigned int, const BVector<unsigned int>&)" << STD__ endl
193 << "Invalid constructor parameters: Number of off-diagonals larger than matrix dimension" << STD__ endl;
194 for(unsigned i=0; i<configVector.size(); i++)
195 if(configVector(i)>=dim)
196 STD__ cerr << "void Symm_BdMatrix<T>::Symm_BdMatrix(const T&, const unsigned int, const BVector<unsigned int>&)" << STD__ endl
197 << "Invalid constructor parameters: Off-diagonal is out of range" << STD__ endl;
198
199 // erzeuge Speicherbereich
200 construct(dim,wert,elementPtr,configVector,rowPtr,rowOccupation);
201 conf = configVector;
202}// Ende Symm_BdMatrix<T>::Symm_BdMatrix(const T&, const unsigned int, const unsigned int)
203
204
205
206//--------------------------------------------------------------------
207// Construct: Hilfefunktion. Erzeugt das interne "Datensystem", d.h.
208// allokiert den noetigen Speicherbereich und besetzt die Vectoren
209// rowPtr und rowOccupation
210template<typename T>
211inline void Symm_BdMatrix<T>::construct (const unsigned int dim, const T& value,
212 T*& elemPtr, const BVector<unsigned int>& ConfVector,
213 BVector<T*>& rPtr, BVector<unsigned int>& rowOccup)
214{
215 // berechne Groesse des Speicherbereiches
216 unsigned int i, j, length = dim; // Laenge der Hauptdiagonale
217 for (i=0; i<ConfVector.size(); i++)
218 length += dim - ConfVector.get(i); // addiere Laenge der Nebendiagonalen
219
220 // allokiere Speicherbereich initialisiere alle Elemente auf value
221 elemPtr = new T [length];
222 for (i=0; i<length; i++)
223 elemPtr[i] = value;
224
225 // besetze zPtr mit Zeigern auf die Zeilen (Eintraege der Hauptdiagonale)
226 if (ConfVector.size()) {
227 unsigned int next = 0;
228 for (i=0; i<dim; i++) {
229 rPtr.set(i) = &(elemPtr[next]);
230 next += ConfVector.size()+1;
231 // verringere next gegen Ende des Speicherbereiches -> unten
232 // rechts in der Matrix
233 for (j = ConfVector.size(); j >= 1; j--)
234 if(ConfVector.get(j-1) +i >=dim) next--;
235 else break;
236 }
237 }
238 else
239 for (i=0; i<dim; i++) rPtr.set(i) = &(elemPtr[i]);
240
241 // besetze rowOccup mit Null wenn die entspechende Diagonale nicht allokiert ist
242 // sonst mit der Nummer der Stelle, an der angesprochene Eintrag im Zeilenblock im elemPtr
243 // gespeichert ist
244 for (i=0; i<dim; i++)
245 rowOccup.set(i) = 0;
246 /*if(ConfVector.size())*/
247 for (i=0; i<ConfVector.size(); i++)
248 rowOccup.set(ConfVector.get(i)) = i+1;
249
250}// Ende void Symm_BdMatrix<T>::construct(unsigned int,const T&,T*&,const BVector<unsigned int>&,Vector<T*>&,Vector<unsigned int>&)
251
252
253#if 0
254template <typename T>
256{
257 create(T(0),1);
258 for (unsigned i = 0; i < m.rows(); i++)
259 for (unsigned j = 0; j < m.columns(); j++)
260 if (MATH__ fabs(m(i,j)) > 1e-15)
261 this->setval(i, j) = m (i,j);
262}
263#endif
264
265//--------------------------------------------------------------------
266// Destruktor: Gibt den belegten Speicherplatz wieder frei
267template<typename T>
269{
270 delete[] elementPtr;
271}// Ende Symm_BdMatrix<T>::~Symm_BdMatrix()
272
273
274
275//-------------------------------------------------------------
276// Setval: Wie operator() mit dem Unterschied, dass setval die zu
277// (i,k) zugehoerige Nebendiagonale allokiert und alle Eintraege
278// in ihr zu T(0) initiallisiert wenn diese nicht vorhanden ist,
279// und gibt erst dann den Wert (i,k) zurueck, auf dem geschrieben
280// werden kann
281template<typename T>
282inline T& Symm_BdMatrix<T>::setval (const unsigned int i, const unsigned int k)
283{
284 // check
285 if((i>=dimension) || (k>=dimension))
286 STD__ cerr << "T& Symm_BdMatrix<T>::setval (const unsigned int, const unsigned int)" << STD__ endl
287 << "Invalid Index: Index out of range" << STD__ endl;
288
289 // tausche k und i um, wenn i>k, also wenn das Element unterhalb der Hauptdiagonalen ist
290 unsigned int l,m;
291 if (i > k) {
292 l=k; m=i;
293 } else {
294 l=i; m=k;
295 }
296 // (l,m) oberhalb der Hauptdiagonale
297
298 // falls (l,m) in der Hauptdiagonale
299 if (m == l)
300 return *rowPtr.get(l);
301
302 // falls (l,m) sonst irgendwo
303 if(rowOccupation(m-l) != 0) {
304 return *(rowPtr.get(l) + rowOccupation.get(m-l));
305 }
306 else {
307
308 // erzeuge neuen Speicherbereich und schreibe neue Diagonale
309 // zwischen den Diagonalen Nr. (found-1) und found
310 T* newmem;
311 BVector<unsigned int> newConfVector(conf.size() + 1);
312
313 // schreibe newConfVector und finde Stelle found, in der
314 // die neue Nebendiagonale geschrieben wird
315 unsigned int j,g,h;
316 int found(-1);
317 for(g=j=0; j<conf.size(); j++,g++) {
318 // falls konf(f)-te Nebendiagonale weiter ausserhalb als die (m-l)-te
319 if( conf.get(j) > (m-l)) {newConfVector.set(g++)= m-l; found=j;break;}
320 newConfVector.set(g) = conf.get(j);
321 }
322 // schreibe rest ab
323 for(; j<conf.size(); j++,g++) {
324 newConfVector.set(g) = conf.get(j);
325 }
326 // falls Stelle nicht gefunden -> neue Diagonale ist letzte
327 if(found == -1) {newConfVector.set(conf.size()) = m-l; found=conf.size();}
328
329 Vector<T*> newrowPtr(dimension);
330 Vector<unsigned int> neuerowOccupation(dimension);
331
332 // erzeuge neuen Speicherbereich
333 construct(dimension,T(0),newmem,newConfVector,newrowPtr,neuerowOccupation);
334
335 T* newPtr;
336 T* oldPtr;
337 oldPtr = elementPtr;
338 newPtr = newmem;
339
340 // schreibe Werte auf neuen Speicherbereich ab
341 for(h=1; h<dimension; h++){ // h springt von Zeile zu Zeile
342 j=0; // j laeuft innerhalb einer Zeile
343 while(newPtr != newrowPtr.get(h)) {
344 *(newPtr++) = *(oldPtr++);
345 if( ((int)j == found)&& (int(found+1) < int(newrowPtr.get(h) - newrowPtr.get(h-1))) )
346 newPtr++;
347 j++;
348 }
349 }
350 *(newPtr) = *(oldPtr); // letzter Eintrag
351
352 // zerstoere alten Speicherbereich
353 delete[] elementPtr;
354
355 // setze private Variablen auf neue Werte
356 rowPtr = newrowPtr;
357 rowOccupation = neuerowOccupation;
358 conf.resize(newConfVector.size()) = newConfVector;
359 elementPtr = newmem;
360
361 // endlich!!
362 return *(rowPtr.get(l) + rowOccupation.get(m-l));
363 }
364
365
366}// Ende T& Symm_BdMatrix<T>::setval (const unsigned int, const unsigned int)
367
368
369
370//-------------------------------------------------------------
371// Zugriffoperator: Erlaubt Lesezugriff auf das Matrixelement
372// mit den Indizes (i,k), wobei auf das erste Element oben links
373// in der Matrix mit (0,0) zugegriffen wird
374template<typename T>
375inline const T& Symm_BdMatrix<T>::operator() (const unsigned int i, const unsigned int k) const
376{
377 // check
378 EXPCHK((i>=dimension) || (k>=dimension), SymmBdMatrixErr, "const T& Symm_BdMatrix<T>::operator() (const unsigned int, const unsigned int)const: inval idx", i, zero);
379 // tausche k und i um, wenn i>k, also wenn das Element unterhalb der Hauptdiagonalen ist
380 unsigned int l,m;
381 if(i>k) {l=k; m=i;}
382 else {l=i; m=k;}
383 // (l,m) oberhalb der Hauptdiagonale
384
385 // falls (l,m) in der Hauptdiagonale
386 if(m==l) return *rowPtr.get(l);
387
388 // falls (l,m) sonst irgendwo
389 if(rowOccupation(m-l) != 0) return *(rowPtr.get(l) + rowOccupation.get(m-l));
390 else return zero;
391
392}// Ende const T& Symm_BdMatrix<T>::operator() (const unsigned int, const unsigned int)const
393
394
395
396//-------------------------------------------------------------
397// Ausgabenoperator: Schreibt alle Eintraege der Matrix matrix
398// auf den ostream out in der natuerlichen Reihenfolge
399template<typename T>
400inline STD__ ostream& operator<< (STD__ ostream& out, const Symm_BdMatrix<T>& matrix)
401{
402 unsigned int i,k;
403 for(i=0; i< matrix.dimension; i++){
404 // schreibe Zeile
405 for(k=0; k< matrix.dimension; k++) out << matrix(i,k) << " ";
406 out << STD__ endl;
407 }
408 return out;
409}// Ende std::ostream& operator<< (std::ostream&, const Symm_BdMatrix<T>&)
410
411
412
413//-------------------------------------------------------------
414// Multiplikationsoperator: Multipliziert *this mit Vector.
415template<typename T>
417{
418 // check
419 if (Vector.size() != dimension)
420 STD__ cerr << "TVector<T> Symm_BdMatrix<T>::operator* (const Vector<T>&)const" << STD__ endl
421 << "Matrix and Vector have different dimensions" << STD__ endl;
422
423 TVector<T> result (Vector.size());
424
425 // falls keine Nebendiagonalen allokiert
426 unsigned int i;
427 if (conf.size() == 0) {
428 for (i=0; i<dimension; i++)
429 result.setval(i) = ((*(rowPtr.get(i))) * Vector.get(i));
430 return result;
431 }
432
433/*
434 // multipliziere in der natuerlichen Reihenfolge, optimiert, 2 Schleifen
435 unsigned int j, diagonal, confsize;
436 confsize=conf.size();
437 // falls mindestens eine Nebendiagonal allokiert
438 T temp;
439 unsigned max_off=conf(confsize-1);
440 T* memPtr = elementPtr;
441 unsigned int* konfPtr = conf.vecptr();
442
443 // h haelt die Zeilennummer fest
444 // Hauptdiagonale und obere Diagonanlen
445 for(unsigned int h=0; h<dimension-1; h++)
446 {
447 // Hauptdiagonale nur einmal zaehlen
448 temp = (*(memPtr)) * Vector(h);
449 memPtr++;
450 while(memPtr != rowPtr(h+1))
451 {
452 temp += *(memPtr) * (Vector(h + *(konfPtr)));
453 konfPtr++;
454 memPtr++;
455 }
456 result.setval(h)=temp;
457 // setze konfPtr zurueck
458 konfPtr= conf.vecptr();
459 }
460 // letzter Summand
461 result.setval(dimension-1) = (*(memPtr)) * Vector(h);
462
463 //Unteren Nebendiagonalen
464 for(i=0; i<max_off; i++)
465 {
466 temp=0;
467 for(j=0; ((diagonal=conf(j))<=i) && (j<confsize); j++)
468 temp += *(rowPtr(i-diagonal) + j +1) * Vector(i-diagonal);
469 result.setval(i)+=temp;
470 }
471 for(i=max_off; i<dimension; i++)
472 {
473 temp=0;
474 for(j=0; j<confsize; j++)
475 temp += *(rowPtr(i-conf(j)) + j +1) * Vector(i-conf(j));
476 result.setval(i)+=temp;
477 }
478*/
479
480
481// /*
482 // multipliziere in der natuerlichen Reihenfolge, optimiert (Nr. 1)
483 unsigned int j, diagonal, confsize;
484 confsize=conf.size();
485 // falls mindestens eine Nebendiagonale allokiert
486 T temp;
487 unsigned max_off=conf.get(confsize-1);
488 for(i=0; i<max_off; i++)
489 {
490 // Hauptdiagonale
491 temp = ((*(rowPtr.get(i))) * Vector.get(i));
492 // unterhalb der Hauptdiagonalen
493 for(j=0; ((diagonal=conf.get(j))<=i) && (j<confsize); j++)
494 temp += *(rowPtr.get(i-diagonal) + j +1) * Vector.get(i-diagonal);
495 // oberhalb der Hauptdiagonalen
496 for(j=0; j<confsize; j++)
497 temp += *(rowPtr.get(i) + j +1) * Vector.get(i + conf.get(j));
498 result.setval(i)=temp;
499 }
500 for(i=max_off; i<dimension-max_off; i++)
501 {
502 // Hauptdiagonale
503 temp = ((*(rowPtr.get(i))) * Vector.get(i));
504 for(j=0; j<confsize; j++)
505 {
506 // unterhalb der Hauptdiagonalen
507 temp += *(rowPtr.get(i-conf.get(j)) + j +1) * Vector.get(i-conf.get(j));
508 // oberhalb der Hauptdiagonalen
509 temp += *(rowPtr.get(i) + j +1) * Vector.get(i + conf.get(j));
510 }
511 result.setval(i)=temp;
512 }
513 for(i=dimension-max_off; i<dimension; i++)
514 {
515 // Hauptdiagonale
516 temp = ((*(rowPtr.get(i))) * Vector.get(i));
517 // unterhalb der Hauptdiagonalen
518 for(j=0; j<confsize; j++)
519 temp += *(rowPtr.get(i-conf.get(j)) + j +1) * Vector.get(i-conf.get(j));
520 // oberhalb der Hauptdiagonalen
521 for(j=0; (conf.get(j)<dimension-i) && (j<confsize); j++)
522 temp += *(rowPtr.get(i) + j +1) * Vector.get(i + conf.get(j));
523 result.setval(i)=temp;
524 }
525// */
526
527/*
528 // multipliziere in der natuerliche Reihenfolge
529 unsigned int j, diagonal, confsize;
530 confsize=conf.size();
531 // falls mindestens eine Nebendiagonale allokiert
532 T temp;
533
534 for(i=0; i<dimension; i++)
535 {
536 // Hauptdiagonale
537 temp = ((*(rowPtr(i))) * Vector(i));
538
539 // unterhalb der Hauptdiagonalen
540 for(j=0; ((diagonal=conf(j))<=i) && (j<confsize); j++)
541 temp += *(rowPtr(i-diagonal) + j +1) * Vector(i-diagonal);
542
543 // oberhalb der Hauptdiagonalen
544 for(j=0; (conf(j)<dimension-i) && (j<confsize); j++)
545 temp += *(rowPtr(i) + j +1) * Vector(i + conf(j));
546
547 result.setval(i)=temp;
548 }
549*/
550
551/*
552 // multipliziere in der Reihenfolge der Allokierung der Matrixelemente
553 T* memPtr = elementPtr;
554 unsigned int* konfPtr = conf.vecptr();
555 result.clear();
556 T temp;
557
558 // h haelt die Zeilennummer fest
559 for(unsigned int h=0; h<dimension-1; h++)
560 {
561 // Hauptdiagonale nur einmal zaehlen
562 temp = (*(memPtr)) * Vector(h);
563 memPtr++;
564
565 // fuehre alle Operationen durch, in denen die Matrixelemente der
566 // Zeile h (ohne Hauptdiagonale) enthalten sind
567 while(memPtr != rowPtr(h+1))
568 {
569 // oberhalb der Hauptdiagonale
570 temp += *(memPtr) * (Vector(h + *(konfPtr)));
571 // unterhalb der Hauptdiagonale
572 result.setval(h + *(konfPtr)) += *(memPtr) * (Vector(h));
573
574 konfPtr++;
575 memPtr++;
576 }
577 result.setval(h)+=temp;
578
579 // setze konfPtr zurueck
580 konfPtr= conf.vecptr();
581 }
582 // letzter Summand
583 result.setval(h) += (*(memPtr)) * Vector(h);
584*/
585
586/*
587 // multipliziere in der Reihenfolge der Allokierung der Matrixelemente, (Nr. 2)
588 // 2 Schleifen!!
589 T* memPtr = elementPtr;
590 unsigned int* konfPtr = conf.vecptr();
591 T temp;
592
593 // h haelt die Zeilennummer fest
594 // Hauptdiagonale und obere Diagonanlen
595 for(unsigned int h=0; h<dimension-1; h++)
596 {
597 // Hauptdiagonale nur einmal zaehlen
598 temp = (*(memPtr)) * Vector(h);
599 memPtr++;
600 while(memPtr != rowPtr(h+1))
601 {
602 temp += *(memPtr) * (Vector(h + *(konfPtr)));
603 konfPtr++;
604 memPtr++;
605 }
606 result.setval(h)=temp;
607 // setze konfPtr zurueck
608 konfPtr= conf.vecptr();
609 }
610 // letzter Summand
611 result.setval(h) = (*(memPtr)) * Vector(h);
612 // unterhalb der Hauptdiagonale
613 memPtr = elementPtr;
614 for(h=0; h<dimension-1; h++)
615 {
616 // Hauptdiagonale ueberspringen
617 memPtr++;
618 // setze konfPtr zurueck
619 konfPtr= conf.vecptr();
620 while(memPtr != rowPtr(h+1))
621 {
622 result.setval(h + *(konfPtr)) += *(memPtr) * (Vector(h));
623 konfPtr++;
624 memPtr++;
625 }
626 }
627*/
628
629 return result;
630}// Ende TVector<T> Symm_BdMatrix<T>::operator* (const Vector<T>&)const
631
632
633
634//-------------------------------------------------------------
635// Clear: Assigns 0 to all elements
636template<typename T>
638{
639 T* Ptr = elementPtr;
640 while(Ptr != rowPtr.get(dimension-1)) (*Ptr++) = T(0);
641 *Ptr = T(0); // last entry
642
643}// end void Symm_BdMatrix<T>::clear()
644
645
647
648#endif // !defined(_Symm_BdMatrix)
const Vector< T > const Vector< T > const Vector< T > int T h
Definition LM_fit.h:99
int i
Definition LM_fit.h:71
#define STD__
Definition basics.h:338
#define MIN_ALIGN2
Definition basics.h:424
#define NAMESPACE_END
Definition basics.h:323
#define EXPCHK(cond, exc, txt, ind, rtval)
Definition basics.h:630
#define NAMESPACE_TBCI
Definition basics.h:317
#define MATH__
Definition basics.h:339
#define FGD
Definition basics.h:144
#define T
Definition bdmatlib.cc:20
provides basic Vector functionality but arithmetic operators (+=, - , *, /...).
Definition bvector.h:68
unsigned long size() const HOT
Definition bvector.h:144
tbci_traits< T >::const_refval_type get(const unsigned long idx) const HOT
Definition bvector.h:132
T & set(const unsigned long idx) HOT
Definition bvector.h:134
Common interface definition (signature) for all Matrices.
Definition matrix_sig.h:46
unsigned int rows() const
unsigned int columns() const
NumErr()
Definition except.h:65
Matrix class with optimized Matrix-Vector multiplication for symmetrical Matrices.
Symm_BdMatrix(const unsigned int N)
void construct(const unsigned int N, const T &, T *&, const BVector< unsigned int > &, BVector< T * > &, BVector< unsigned int > &)
TVector< T > operator*(const Vector< T > &) const
const T & get(const unsigned int i, const unsigned int k) const
unsigned int columns() const
const char * mat_info() const
const T & operator()(const unsigned int i, const unsigned int k) const
void setval(const T &wert, const unsigned int i, const unsigned int k)
void autoinsert(const T &wert, const unsigned int i, const unsigned int k)
void resize(const T &, const unsigned int)
unsigned int rows() const
BVector< unsigned int > conf
Symm_BdMatrix(const T &val, const unsigned int N)
Symm_BdMatrix(const T &val, const unsigned int N, const BVector< unsigned int > &diagConf)
BVector< unsigned int > rowOccupation
void resize(const unsigned int newDim)
BVector< T * > rowPtr
T aligned_value_type TALIGN(MIN_ALIGN2)
void create(const T &val, const unsigned int N)
unsigned int dimension
T & setval(const unsigned int i, const unsigned int k)
exception class
virtual ~SymmBdMatrixErr()
SymmBdMatrixErr(const SymmBdMatrixErr &be)
SymmBdMatrixErr(const char *t, const long i=0)
Temporary Base Class Idiom: Class TVector is used for temporary variables.
Definition vector.h:73
tbci_traits< T >::const_refval_type get(const unsigned long i) const
Definition vector.h:190
unsigned long size() const
Definition vector.h:104
T & setval(const unsigned long i) const
Definition vector.h:192
double fabs(const TBCI__ cplx< T > &c)
Definition cplx.h:746
STD__ ostream & operator<<(STD__ ostream &out, const Symm_BdMatrix< T > &matrix)