|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #include "GaudiKernel/StatusCode.h"
21 #include <TMatrixDSparse.h>
25 void dsptrf_(
char*,
const int*,
double*,
int*,
int* );
29 void dsptri_(
char*,
const int*,
double*,
int*,
double*,
int* );
33 void dspev_(
char*,
char*,
const int*,
double*,
34 double*,
double*,
const int*,
double*,
int* );
67 , m_pathbin(
m.m_pathbin)
68 , m_pathtxt(
m.m_pathtxt)
81 m_pathbin (
m.pathBin()),
82 m_pathtxt (
m.pathTxt())
112 if(
size() !=
m.size()) {
113 throw std::range_error(
"AlSymMat::copy: size do not match!" );
125 if(
size() !=
m.size()) {
126 throw std::range_error(
"AlSymMat::copy: size do not match!" );
133 for (
pos =
m.ptrMap()->begin();
pos!=
m.ptrMap()->end();
pos++) {
134 m.elem(
pos->first,
i, j);
145 if( si !=
m.nrow() || si !=
m.ncol() ) {
146 throw std::range_error(
"AlSymMat::copy: sizes do not match!" );
149 for(
int i=0;
i<si;
i++ )
150 for(
int j=0; j<=
i; j++ )
170 if(
m.nrow() !=
m.ncol() ) {
171 throw std::range_error(
"AlSymMat::operator=: a squared matrix is required!" );
192 if(
size() !=
m.size()) {
193 throw std::range_error(
"AlSymMat::operator+: size do not match!" );
208 if(
size() !=
m.size()){
209 throw std::range_error(
"AlSymMat::operator+=: size do not match!" );
222 if(
size() !=
m.size()) {
223 throw std::range_error(
"AlSymMat::operator-: size do not match!" );
238 if(
size() !=
m.size()) {
239 throw std::range_error(
"AlSymMat::operator-=: size do not match!" );
252 if(
size() !=
m.size() ) {
253 throw std::range_error(
"AlSymMat::operator*: size do not match!" );
258 long int k,
l,
n, ii, jj;
259 long int siz(
size());
262 for(
long int i=0;
i<siz;
i++ )
263 for(
long int j=0; j<siz; j++ ) {
279 for(
k=
n;
k<siz;
k++)
290 if(
size() !=
m.nrow() ) {
291 throw std::range_error(
"AlSymMat::operator*: size do not match!" );
298 long int siz(
size()), nco(
m.ncol());
301 for(
long int i=0;
i<siz;
i++ )
302 for(
long int j=0; j<nco; j++ ) {
307 for(
k=
i;
k<siz;
k++)
318 if(
size() !=
v.size() ) {
319 throw std::range_error(
"AlSymMat::operator*: size do not match! " );
326 for(
long int i=0;
i<
size();
i++ ) {
328 for(
long int j=0; j<
i; j++ )
330 for(
long int j=
i; j<
size(); j++ )
369 int * ipiv =
new int[
N];
370 double * work =
new double[
N];
397 double TINY = 1.E-20;
403 for(
int I=0;
I<
N;
I++) {
406 if (fabs(
A[
I][J])>AMAX)
414 for(
int J=0;J<
N;J++) {
415 for(
int I=0;
I<
N;
I++) {
417 int KMAX = (
I<J)?
I:J;
418 for(
int K=0;K<KMAX;K++)
419 SUM = SUM -
A[
I][K]*
A[K][J];
425 for (
int I=J+1;
I<
N;
I++) {
426 if(fabs(
A[
I][J])>fabs(
A[IMAX][J])) IMAX=
I;
430 for(
int K=0;K<
N;K++) {
438 if(J<
N && (fabs(
A[J][J])>TINY)) {
440 for(
int I=J+1;
I<
N;
I++)
A[
I][J] =
A[
I][J]*DUM;
446 deter = deter*
A[
I][
I];
457 double * work =
new double[3*
N];
476 for(
int k=0;
k<shift;
k++) {
499 throw std::range_error(
"Vector of indices larger than matrix size.");
504 for (
int i=0;
i<
n-1;
i++)
505 for (
int j=
i+1; j<
n; j++)
513 for (
int i=0;
i<
n;
i++) {
516 throw std::out_of_range(
"AlSymMat::RemoveCollsRows: Index goes beyond matrix.");
561 if (counterCol==5-control) {
568 if (counterRow==5-control) {
589 bool square,
double,
float version)
591 std::ofstream outmat;
593 int32_t msizz = square ?
size() : (-1)*
size();
598 return StatusCode::FAILURE;
601 outmat.write((
char*)&msizz,
sizeof (msizz));
607 return StatusCode::FAILURE;
608 outmat.setf(std::ios::fixed);
609 outmat.setf(std::ios::showpoint);
611 outmat <<
"msizz: " << std::setw(6) << msizz << std::endl;
612 outmat <<
"AlSymMat version: " << std::setw(6) <<
version << std::endl;
619 for(
int j=0; j<=
i; j++) {
622 outmat.write((
char*)&(melem),
sizeof (melem));
624 outmat << std::setw(14) << melem;
632 for(
int j=0; j<
size(); j++) {
636 outmat.write((
char*)&(melem),
sizeof (melem));
638 outmat << std::setw(14) << melem;
645 return StatusCode::SUCCESS;
651 std::ifstream inmat((
filename).c_str(), std::ios::binary);
653 return StatusCode::FAILURE;
656 inmat.read((
char*)&msiz,
sizeof (msiz));
667 return StatusCode::SUCCESS;
674 bool stdUnits =
true;
676 return StatusCode::FAILURE;
682 return StatusCode::FAILURE;
685 inmat.read((
char*)&msiz,
sizeof (msiz));
696 for(
int i=0;
i<msiz;
i++) {
697 for(
int j=0; j<msiz; j++) {
698 inmat.read((
char*)&melem,
sizeof (melem));
708 for(
int i=0;
i<msiz;
i++) {
709 for(
int j=0; j<=
i; j++) {
710 inmat.read((
char*)&melem,
sizeof (melem));
717 return StatusCode::SUCCESS;
726 return StatusCode::FAILURE;
729 inmat.read((
char*)&msiz,
sizeof (msiz));
739 for(
int i=0;
i<msiz;
i++) {
740 for(
int j=0; j<msiz; j++) {
741 inmat.read((
char*)&melem,
sizeof (melem));
751 for(
int i=0;
i<msiz;
i++) {
752 for(
int j=0; j<=
i; j++) {
753 inmat.read((
char*)&melem,
sizeof (melem));
760 return StatusCode::SUCCESS;
766 if ( Nnew !=
size() ) {
772 long int Size_old =
size();
774 long int k =
size() <= Size_old ?
size() : Size_old;
775 for(
long int i=0;
i<
k;
i++ ) {
777 for(
long int j=0; j<=
i; j++ )
789 throw std::underflow_error(
"AlSymMat::elemr: Index 1 < zero!" );
792 throw std::overflow_error(
"AlSymMat::elemr: Index 1 too large!" );
795 throw std::underflow_error(
"AlSymMat::elemr: Index 2 < zero!" );
798 throw std::overflow_error(
"AlSymMat::elemr: Index 2 too large!" );
812 throw std::underflow_error(
"AlSymMat::elemc: Index 1 < zero!" );
815 throw std::overflow_error(
"AlSymMat::elemc: Index 1 too large!" );
818 throw std::underflow_error(
"AlSymMat::elemc: Index 2 < zero!" );
821 throw std::overflow_error(
"AlSymMat::elemc: Index 2 too large!" );
837 for(
int i=0;
i<si;
i++ )
838 for(
int j=0; j<=
i; j++ )
843 int *irow =
new int[nnz];
844 int *
icol =
new int[nnz];
845 double *
val =
new double[nnz];
848 for (
int i=0;
i<si;
i++) {
849 for (
int j=0;j<=
i;j++) {
861 myTMatrix->SetMatrixArray(nnz,irow,
icol,
val);
virtual void RemoveAlignPar(int, int) override final
datamap::const_iterator const_mapiterator
path
python interpreter configuration --------------------------------------—
@ z
global position (cartesian)
virtual AlSymMat operator+(const AlSymMat &) const
std::pair< long int, long int > indices
virtual StatusCode Write(const std::string &, bool, bool, double, float) override final
virtual AlSymMat & operator+=(const AlSymMat &)
long int elem(long int, long int) const
virtual int invert() override final
virtual void SetPathBin(const std::string &) override final
virtual AlSymMat & operator*=(const double &)
class TMatrixTSparse< double > TMatrixDSparse
virtual void SetPathTxt(const std::string &) override final
AlSymMat & operator=(const AlSpaMat &)
void dsptrf_(char *, const int *, double *, int *, int *)
::StatusCode StatusCode
StatusCode definition for legacy code.
virtual void RemoveModule(int) override final
virtual StatusCode Read(const std::string &, int &, bool &, float &) override final
virtual double elemc(long int, long int) const override final
virtual TMatrixDSparse * makeTMatrix() override final
Ensure that the ATLAS eigen extensions are properly loaded.
void copy(const AlSymMat &m)
void dspev_(char *, char *, const int *, double *, double *, double *, const int *, double *, int *)
virtual StatusCode ReadProjected(const std::string &, int &, bool &, float &) override final
virtual int diagonalize(char jobz, AlVec &w, AlMat &z) override final
void dsptri_(char *, const int *, double *, int *, double *, int *)
virtual int RemoveCollsRows(std::vector< int >) override final
virtual void reSize(long int Nnew) override final
virtual AlMat operator*(const AlSymMat &) const
virtual AlSymMat operator-(const AlSymMat &) const
virtual double determinant() override final
virtual StatusCode CheckMatVersion(const std::string &, bool &) override final
virtual double & elemr(long int, long int) override final
virtual AlSymMat & operator-=(const AlSymMat &)