Changeset 813 in Sophya for trunk/SophyaLib/TArray/sopemtx.cc
- Timestamp:
- Apr 5, 2000, 5:44:19 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/sopemtx.cc
r804 r813 63 63 64 64 uint_4 IMaxAbs(uint_4 first=0); 65 void Print(ostream & os) const ; 65 66 66 67 static void Swap(TMatrixRC<T>& rc1, TMatrixRC<T>& rc2); … … 105 106 template <class T> 106 107 inline uint_4 TMatrixRC<T>::Step(const TMatrix<T>& m, TRCKind rckind) 107 { switch (rckind) { case TmatrixRow : return m.Step(m. RowsKA());108 case TmatrixCol : return m.Step(m. ColsKA());108 { switch (rckind) { case TmatrixRow : return m.Step(m.ColsKA()); 109 case TmatrixCol : return m.Step(m.RowsKA()); 109 110 case TmatrixDiag : return (m.Step(m.RowsKA())+m.Step(m.ColsKA())); } 110 111 return 0; } … … 333 334 334 335 template <class T> 336 void TMatrixRC<T>::Print(ostream & os) const 337 { 338 os << " TMatrixRC<T>::Print(ostream & os) " << NElts() << " Kind=" 339 << kind << " Index=" << index << " Step= " << step << endl; 340 for(uint_4 i=0; i<NElts(); i++) { 341 os << (*this)(i); 342 if (kind == TmatrixCol) os << endl; 343 else os << ", "; 344 } 345 os << endl; 346 } 347 348 template <class T> 335 349 void TMatrixRC<T>::Swap(TMatrixRC<T>& rc1, TMatrixRC<T>& rc2) 336 350 { … … 435 449 436 450 for(uint_4 l=0; l<n; l++) { 437 if (fabs( a(l,l)) <= 1.e-50) return 0.0;451 if (fabs((double)a(l,l)) <= 1.e-50) return 0.0; 438 452 TMatrixRC<T>::Row(b, l) /= a(l,l); 439 453 } … … 447 461 { 448 462 TMatrix<T> a(A); 449 TMatrix<T> b(a.NCols(),a.NRows()); b = 1.;450 if(fabs( GausPiv(a,b)) < 1.e-50)463 TMatrix<T> b(a.NCols(),a.NRows()); b = IdentityMatrix(1.); 464 if(fabs((double)GausPiv(a,b)) < 1.e-50) 451 465 throw(MathExc("TMatrix Inverse() Singular OMatrix")); 452 466 return b; … … 578 592 579 593 580 594 void _ZZ_TestTMatrixRC_YY_(TMatrix<r_8> & m) 595 { 596 cout << " ::::: _ZZ_TestTMatrixRC_YY_ :::: M= \n" << m << endl; 597 TMatrixRC<r_8> l0 = TMatrixRC<r_8>::Row(m,0); 598 cout << "TMatrixRC<r_8>::Row(m,0) = \n" ; 599 l0.Print(cout); 600 TMatrixRC<r_8> l1 = TMatrixRC<r_8>::Row(m,1); 601 cout << "TMatrixRC<r_8>::Row(m,1) = \n" ; 602 l1.Print(cout); 603 l0.SetRow(2); 604 cout << "TMatrixRC<r_8>::l0.SetRow(2 = \n" ; 605 l0.Print(cout); 606 607 TMatrixRC<r_8> c0 = TMatrixRC<r_8>::Col(m,0); 608 cout << "TMatrixRC<r_8>::Col(m,0) = \n" ; 609 c0.Print(cout); 610 TMatrixRC<r_8> c1 = TMatrixRC<r_8>::Col(m,1); 611 cout << "TMatrixRC<r_8>::Col(m,1) = \n" ; 612 c1.Print(cout); 613 c0.SetCol(2); 614 cout << "TMatrixRC<r_8>::c0.SetCol(2) = \n" ; 615 c0.Print(cout); 616 TMatrixRC<r_8> c00 = TMatrixRC<r_8>::Col(m,0); 617 TMatrixRC<r_8>::Swap(c0, c00); 618 cout << " ::::: M Apres Swap = \n" << m << endl; 619 620 } 581 621 582 622 ///////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.