|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #include "GaudiKernel/StatusCode.h"
49 , m_nele(m_nrow * m_ncol)
50 , m_pathbin(
m.m_pathbin)
51 , m_pathtxt(
m.m_pathtxt)
65 if( nr !=
m.nrow() ||
nc !=
m.ncol() ) {
66 throw std::range_error(
"AlMat::copy: sizes do not match!" );
69 for(
int i=0;
i<nr;
i++ ) {
70 for(
int j=0; j<
nc; j++ ) {
77 long int n =
m.size();
79 throw std::range_error(
"AlMat::copy: sizes do not match!" );
82 for(
int i=0;
i<
n;
i++ ) {
83 for(
int j=0; j<
n; j++ ) {
91 if(
i<0 ) {
throw std::out_of_range(
"AlMat::elemr: Index 1 < zero! " ); };
92 if(
i>=
size ) {
throw std::out_of_range(
"AlMat::elemr: Index 1 too large!" ); };
93 if( j<0 ) {
throw std::out_of_range(
"AlMat::elemr: Index 2 < zero! " ); };
94 if( j>=
size ) {
throw std::out_of_range(
"AlMat::elemr: Index 2 too large!" ); };
103 if(
i<0 ) {
throw std::out_of_range(
"AlMat::elemr: Index 1 < zero! " ); };
104 if(
i>=
size ) {
throw std::out_of_range(
"AlMat::elemr: Index 1 too large!" ); };
105 if( j<0 ) {
throw std::out_of_range(
"AlMat::elemr: Index 2 < zero! " ); };
106 if( j>=
size ) {
throw std::out_of_range(
"AlMat::elemr: Index 2 too large!" ); };
115 if(
i<0 ) {
throw std::out_of_range(
"AlMat::elemr: Index 1 < zero! " ); };
116 if(
i>=
size ) {
throw std::out_of_range(
"AlMat::elemr: Index 1 too large!" ); };
117 if( j<0 ) {
throw std::out_of_range(
"AlMat::elemr: Index 2 < zero! " ); };
118 if( j>=
size ) {
throw std::out_of_range(
"AlMat::elemr: Index 2 too large!" ); };
135 if (
this==&
m)
return *
this;
139 throw std::range_error(
"AlMat=AlMat Assignment: size do not match!" );
152 throw std::range_error(
"AlMat=AlSymMatBase Assignment: size do not match!" );
165 throw std::range_error(
"AlMat: operator+: size do not match!" );
182 throw std::range_error(
"AlMat: operator+=: size do not match!" );
195 throw std::range_error(
"AlMat: operator-: size do not match!" );
211 throw std::range_error(
"AlMat: operator-=: size do not match!");
222 if(
ncol() !=
m.nrow() )
224 throw std::range_error(
"AlMat: operator*: size do not match!" );
232 for(
int i=0;
i<
k;
i++ ) {
233 for(
int j=0; j<
l; j++ ) {
241 if(
ncol() !=
m.size())
243 throw std::range_error(
"AlMat: operator*: size do not match!" );
250 for(
int i=0;
i<
k;
i++ ) {
251 for(
int j=0; j<
l; j++ ) {
260 if(
ncol() !=
v.size() )
262 throw std::range_error(
"AlMat: operator*: size do not match! " );
271 for(
int i=0;
i<
k;
i++ ) {
274 for(
int j=0; j<
l; j++ ) *
p += (*(
q+j))*(*(
v.ptrData()+j));
291 for(
int i=0;
i<
b.m_nrow;
i++ ) {
292 for(
int j=0; j<
b.m_ncol; j++ ) {
319 throw std::range_error(
"AlMat invertS: non-square matrix!" );
323 for(
int i=0;
i<
b.size();
i++ ) {
324 for(
int j=0; j<=
i; j++ ) {
333 if (ierr==0) (*this).copy(
b);
353 for(
int i=0;
i<
k;
i++ ) {
354 for(
int j=0; j<
l; j++ ) {
365 std::ifstream inmat(
filename.c_str(), std::ios::binary);
367 return StatusCode::FAILURE;
370 inmat.read((
char*)&mNrow,
sizeof (mNrow));
372 inmat.read((
char*)&mNcol,
sizeof (mNcol));
385 for(
int j=0; j<
m_ncol; j++) {
386 inmat.read((
char*)&melem,
sizeof (melem));
393 return StatusCode::SUCCESS;
411 std::ofstream outmat;
416 return StatusCode::FAILURE;
419 outmat.write((
char*)&mNrow,
sizeof (mNrow));
421 outmat.write((
char*)&mNcol,
sizeof (mNcol));
426 return StatusCode::FAILURE;
427 outmat.setf(std::ios::fixed);
429 outmat.setf(std::ios::showpoint);
430 outmat.precision(precision);
436 for(
int j=0; j<
m_ncol; j++) {
439 outmat.write((
char*)&(melem),
sizeof (melem));
441 outmat <<
" " << std::setw(12) << melem;
448 return StatusCode::SUCCESS;
454 std::ostringstream textmatrix;
456 int LastCol = NColsPerSet;
458 int NSets = (
ncol()/NColsPerSet);
459 if (
ncol()%NColsPerSet>0) NSets++;
460 textmatrix << std::endl;
461 textmatrix <<
" ++++++++++++++ AlMat ++ "
465 <<
" +++++++++++++++++++++++++++++"<< std::endl;
467 FirstCol =
set*NColsPerSet;
468 LastCol = (
set+1)*NColsPerSet;
469 if (LastCol>
ncol()) LastCol =
ncol();
470 textmatrix <<
" |row\\col| ";
471 for (
int col=FirstCol;
col < LastCol;
col++) {
472 textmatrix << std::setw(6) <<
col <<
" | ";
474 textmatrix << std::endl;
475 textmatrix <<
" |-------|";
476 for (
int col=FirstCol;
col < LastCol;
col++) {
477 textmatrix <<
"--------|";
479 textmatrix << std::endl;
481 textmatrix <<
" |" << std::setw(6) <<
row <<
" | ";
482 for (
int col=FirstCol;
col<LastCol;
col++) {
484 textmatrix << std::setprecision(5) << std:: setw(6) << melem <<
" | ";
486 textmatrix << std::endl;
488 if (
set != (NSets-1)) textmatrix << std::endl;
490 textmatrix <<
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<< std::endl;
491 return textmatrix.str();
AlMat & operator=(const double &)
path
python interpreter configuration --------------------------------------—
AlMat operator*(const AlMat &m) const
void reSize(int Nnew, int Mnew)
StatusCode ReadScalaPack(const std::string &)
void SetPathTxt(const std::string &)
AlMat operator+(const AlMat &m) const
const std::string Print(const int NColsPerSet=10)
AlMat & operator+=(const AlMat &m)
void invertS(int &ierr, double Norm)
void copy(const AlMat &m)
AlMat & operator-=(const AlMat &m)
::StatusCode StatusCode
StatusCode definition for legacy code.
void SetPathBin(const std::string &)
Point Norm(const Point &a)
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Ensure that the ATLAS eigen extensions are properly loaded.
StatusCode Write(const std::string &, bool, unsigned int precision=6)
double elemc(long int, long int) const
double & elemr(long int, long int)
AlMat operator-(const AlMat &m) const
AlMat & operator*=(const double &d)
virtual long int elem(long int, long int) const