3 #include "TRDiagMatrix.h"
7 TRDiagMatrix::TRDiagMatrix(Int_t nrows,Double_t a0, ...) :
12 TRDiagMatrix::TRDiagMatrix(
const TRDiagMatrix& S,ETRMatrixCreatorsOp kop) {
18 fNrows = S.GetNcols();
19 Set(fNrows*(fNrows+1)/2);
20 for (i = 0; i < fNrows; i++)
if (fArray[i] != 0) fArray[i] = 1./fArray[i];
23 Error(
"TRDiagMatrix(ETRMatrixCreatorsOp)",
"operation %d not yet implemented", kop);
27 Double_t TRDiagMatrix::Product(
const TRVector& A,ETRMatrixCreatorsOp kop) {
36 assert(N == A.GetNcols() || M == N);
37 for (i = 0; i < N; i++) Value += A[i]*fArray[i]*A[i];
41 Error(
"TRDiagMatrix(ETRMatrixCreatorsOp)",
"operation %d not yet implemented", kop);
46 ostream& operator<<(ostream& s,
const TRDiagMatrix &target) {
47 static const int width = 10;
48 static const Double_t zero = 0;
49 Int_t Nrows = target.GetNrows();
50 const Double_t *Array = target.GetArray();
51 s <<
"Diagonal Matrix Size \t["
52 << Nrows <<
"," << Nrows <<
"]" << endl;
54 s.setf(std::ios::fixed,std::ios::scientific);
55 s.setf(std::ios::showpos);
56 for (
int i = 0; i< Nrows; i++) {
57 for (
int j = 0; j <= i; j++)
59 s << std::setw(width) << std::setprecision(width-3) << Array[i] <<
":\t";
61 s << std::setw(width) << std::setprecision(width-3) << zero <<
":\t";
64 s.unsetf(std::ios::showpos);
70 void TRDiagMatrix::Print(Option_t *opt)
const {
if (opt) {}; cout << *
this << endl;}