 |
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* );
39 charAddress(
auto &
v){
40 return reinterpret_cast<char *
>(&
v);
73 , m_pathbin(
m.m_pathbin)
74 , m_pathtxt(
m.m_pathtxt)
87 m_pathbin (
m.pathBin()),
88 m_pathtxt (
m.pathTxt())
118 if(
size() !=
m.size()) {
119 throw std::range_error(
"AlSymMat::copy: size do not match!" );
131 if(
size() !=
m.size()) {
132 throw std::range_error(
"AlSymMat::copy: size do not match!" );
138 for (
const datamap::value_type&
p : *
m.ptrMap()) {
139 m.elem(
p.first,
i, j);
150 if( si !=
m.nrow() || si !=
m.ncol() ) {
151 throw std::range_error(
"AlSymMat::copy: sizes do not match!" );
154 for(
int i=0;
i<si;
i++ )
155 for(
int j=0; j<=
i; j++ )
175 if(
m.nrow() !=
m.ncol() ) {
176 throw std::range_error(
"AlSymMat::operator=: a squared matrix is required!" );
197 if(
size() !=
m.size()) {
198 throw std::range_error(
"AlSymMat::operator+: size do not match!" );
213 if(
size() !=
m.size()){
214 throw std::range_error(
"AlSymMat::operator+=: size do not match!" );
227 if(
size() !=
m.size()) {
228 throw std::range_error(
"AlSymMat::operator-: size do not match!" );
243 if(
size() !=
m.size()) {
244 throw std::range_error(
"AlSymMat::operator-=: size do not match!" );
257 if(
size() !=
m.size() ) {
258 throw std::range_error(
"AlSymMat::operator*: size do not match!" );
263 long int k,
l,
n, ii, jj;
264 long int siz(
size());
267 for(
long int i=0;
i<siz;
i++ )
268 for(
long int j=0; j<siz; j++ ) {
284 for(
k=
n;
k<siz;
k++)
295 if(
size() !=
m.nrow() ) {
296 throw std::range_error(
"AlSymMat::operator*: size do not match!" );
303 long int siz(
size()), nco(
m.ncol());
306 for(
long int i=0;
i<siz;
i++ )
307 for(
long int j=0; j<nco; j++ ) {
312 for(
k=
i;
k<siz;
k++)
323 if(
size() !=
v.size() ) {
324 throw std::range_error(
"AlSymMat::operator*: size do not match! " );
331 for(
long int i=0;
i<
size();
i++ ) {
333 for(
long int j=0; j<
i; j++ )
335 for(
long int j=
i; j<
size(); j++ )
374 int * ipiv =
new int[
N];
375 double * work =
new double[
N];
402 double TINY = 1.E-20;
408 for(
int I=0;
I<
N;
I++) {
411 if (fabs(
A[
I][J])>AMAX)
419 for(
int J=0;J<
N;J++) {
420 for(
int I=0;
I<
N;
I++) {
422 int KMAX = (
I<J)?
I:J;
423 for(
int K=0;K<KMAX;K++)
424 SUM = SUM -
A[
I][K]*
A[K][J];
430 for (
int I=J+1;
I<
N;
I++) {
431 if(fabs(
A[
I][J])>fabs(
A[IMAX][J])) IMAX=
I;
435 for(
int K=0;K<
N;K++) {
443 if(J<
N && (fabs(
A[J][J])>TINY)) {
445 for(
int I=J+1;
I<
N;
I++)
A[
I][J] =
A[
I][J]*DUM;
451 deter = deter*
A[
I][
I];
462 double * work =
new double[3*
N];
481 for(
int k=0;
k<shift;
k++) {
482 for(
int col=0; col<
row+
k+1; col++) {
504 throw std::range_error(
"Vector of indices larger than matrix size.");
509 for (
int i=0;
i<
n-1;
i++)
510 for (
int j=
i+1; j<
n; j++)
518 for (
int i=0;
i<
n;
i++) {
521 throw std::out_of_range(
"AlSymMat::RemoveCollsRows: Index goes beyond matrix.");
525 for (
int col=0; col<=j; col++)
556 for(
int col=0; col<
row+1; col++) {
566 if (counterCol==5-control) {
573 if (counterRow==5-control) {
594 bool square,
double,
float version)
596 std::ofstream outmat;
598 int32_t msizz = square ?
size() : (-1)*
size();
603 return StatusCode::FAILURE;
606 outmat.write(charAddress(msizz),
sizeof (msizz));
612 return StatusCode::FAILURE;
613 outmat.setf(std::ios::fixed);
614 outmat.setf(std::ios::showpoint);
616 outmat <<
"msizz: " << std::setw(6) << msizz << std::endl;
617 outmat <<
"AlSymMat version: " << std::setw(6) <<
version << std::endl;
624 for(
int j=0; j<=
i; j++) {
627 outmat.write(charAddress((melem)),
sizeof (melem));
629 outmat << std::setw(14) << melem;
637 for(
int j=0; j<
size(); j++) {
641 outmat.write(charAddress((melem)),
sizeof (melem));
643 outmat << std::setw(14) << melem;
650 return StatusCode::SUCCESS;
656 std::ifstream inmat((
filename).c_str(), std::ios::binary);
658 return StatusCode::FAILURE;
661 inmat.read(charAddress(msiz),
sizeof (msiz));
672 return StatusCode::SUCCESS;
679 bool stdUnits =
true;
681 return StatusCode::FAILURE;
687 return StatusCode::FAILURE;
690 inmat.read(charAddress(msiz),
sizeof (msiz));
701 for(
int i=0;
i<msiz;
i++) {
702 for(
int j=0; j<msiz; j++) {
703 inmat.read(charAddress(melem),
sizeof (melem));
713 for(
int i=0;
i<msiz;
i++) {
714 for(
int j=0; j<=
i; j++) {
715 inmat.read(charAddress(melem),
sizeof (melem));
722 return StatusCode::SUCCESS;
731 return StatusCode::FAILURE;
734 inmat.read(charAddress(msiz),
sizeof (msiz));
744 for(
int i=0;
i<msiz;
i++) {
745 for(
int j=0; j<msiz; j++) {
746 inmat.read(charAddress(melem),
sizeof (melem));
756 for(
int i=0;
i<msiz;
i++) {
757 for(
int j=0; j<=
i; j++) {
758 inmat.read(charAddress(melem),
sizeof (melem));
765 return StatusCode::SUCCESS;
771 if ( Nnew !=
size() ) {
777 long int Size_old =
size();
779 long int k =
size() <= Size_old ?
size() : Size_old;
780 for(
long int i=0;
i<
k;
i++ ) {
782 for(
long int j=0; j<=
i; j++ )
794 throw std::underflow_error(
"AlSymMat::elemr: Index 1 < zero!" );
797 throw std::overflow_error(
"AlSymMat::elemr: Index 1 too large!" );
800 throw std::underflow_error(
"AlSymMat::elemr: Index 2 < zero!" );
803 throw std::overflow_error(
"AlSymMat::elemr: Index 2 too large!" );
817 throw std::underflow_error(
"AlSymMat::elemc: Index 1 < zero!" );
820 throw std::overflow_error(
"AlSymMat::elemc: Index 1 too large!" );
823 throw std::underflow_error(
"AlSymMat::elemc: Index 2 < zero!" );
826 throw std::overflow_error(
"AlSymMat::elemc: Index 2 too large!" );
842 for(
int i=0;
i<si;
i++ )
843 for(
int j=0; j<=
i; j++ )
848 int *irow =
new int[nnz];
849 int *
icol =
new int[nnz];
850 double *
val =
new double[nnz];
853 for (
int i=0;
i<si;
i++) {
854 for (
int j=0;j<=
i;j++) {
866 myTMatrix->SetMatrixArray(nnz,irow,
icol,
val);
virtual void RemoveAlignPar(int, int) override final
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 &)