![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
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!" );
132 for (
const datamap::value_type&
p : *
m.ptrMap()) {
133 m.elem(
p.first,
i, j);
144 if( si !=
m.nrow() || si !=
m.ncol() ) {
145 throw std::range_error(
"AlSymMat::copy: sizes do not match!" );
148 for(
int i=0;
i<si;
i++ )
149 for(
int j=0; j<=
i; j++ )
169 if(
m.nrow() !=
m.ncol() ) {
170 throw std::range_error(
"AlSymMat::operator=: a squared matrix is required!" );
191 if(
size() !=
m.size()) {
192 throw std::range_error(
"AlSymMat::operator+: size do not match!" );
207 if(
size() !=
m.size()){
208 throw std::range_error(
"AlSymMat::operator+=: size do not match!" );
221 if(
size() !=
m.size()) {
222 throw std::range_error(
"AlSymMat::operator-: size do not match!" );
237 if(
size() !=
m.size()) {
238 throw std::range_error(
"AlSymMat::operator-=: size do not match!" );
251 if(
size() !=
m.size() ) {
252 throw std::range_error(
"AlSymMat::operator*: size do not match!" );
257 long int k,
l,
n, ii, jj;
258 long int siz(
size());
261 for(
long int i=0;
i<siz;
i++ )
262 for(
long int j=0; j<siz; j++ ) {
278 for(
k=
n;
k<siz;
k++)
289 if(
size() !=
m.nrow() ) {
290 throw std::range_error(
"AlSymMat::operator*: size do not match!" );
297 long int siz(
size()), nco(
m.ncol());
300 for(
long int i=0;
i<siz;
i++ )
301 for(
long int j=0; j<nco; j++ ) {
306 for(
k=
i;
k<siz;
k++)
317 if(
size() !=
v.size() ) {
318 throw std::range_error(
"AlSymMat::operator*: size do not match! " );
325 for(
long int i=0;
i<
size();
i++ ) {
327 for(
long int j=0; j<
i; j++ )
329 for(
long int j=
i; j<
size(); j++ )
368 int * ipiv =
new int[
N];
369 double * work =
new double[
N];
396 double TINY = 1.E-20;
402 for(
int I=0;
I<
N;
I++) {
405 if (fabs(
A[
I][J])>AMAX)
413 for(
int J=0;J<
N;J++) {
414 for(
int I=0;
I<
N;
I++) {
416 int KMAX = (
I<J)?
I:J;
417 for(
int K=0;K<KMAX;K++)
418 SUM = SUM -
A[
I][K]*
A[K][J];
424 for (
int I=J+1;
I<
N;
I++) {
425 if(fabs(
A[
I][J])>fabs(
A[IMAX][J])) IMAX=
I;
429 for(
int K=0;K<
N;K++) {
437 if(J<
N && (fabs(
A[J][J])>TINY)) {
439 for(
int I=J+1;
I<
N;
I++)
A[
I][J] =
A[
I][J]*DUM;
445 deter = deter*
A[
I][
I];
456 double * work =
new double[3*
N];
475 for(
int k=0;
k<shift;
k++) {
498 throw std::range_error(
"Vector of indices larger than matrix size.");
503 for (
int i=0;
i<
n-1;
i++)
504 for (
int j=
i+1; j<
n; j++)
512 for (
int i=0;
i<
n;
i++) {
515 throw std::out_of_range(
"AlSymMat::RemoveCollsRows: Index goes beyond matrix.");
560 if (counterCol==5-control) {
567 if (counterRow==5-control) {
588 bool square,
double,
float version)
590 std::ofstream outmat;
592 int32_t msizz = square ?
size() : (-1)*
size();
597 return StatusCode::FAILURE;
600 outmat.write((
char*)&msizz,
sizeof (msizz));
606 return StatusCode::FAILURE;
607 outmat.setf(std::ios::fixed);
608 outmat.setf(std::ios::showpoint);
610 outmat <<
"msizz: " << std::setw(6) << msizz << std::endl;
611 outmat <<
"AlSymMat version: " << std::setw(6) <<
version << std::endl;
618 for(
int j=0; j<=
i; j++) {
621 outmat.write((
char*)&(melem),
sizeof (melem));
623 outmat << std::setw(14) << melem;
631 for(
int j=0; j<
size(); j++) {
635 outmat.write((
char*)&(melem),
sizeof (melem));
637 outmat << std::setw(14) << melem;
644 return StatusCode::SUCCESS;
650 std::ifstream inmat((
filename).c_str(), std::ios::binary);
652 return StatusCode::FAILURE;
655 inmat.read((
char*)&msiz,
sizeof (msiz));
666 return StatusCode::SUCCESS;
673 bool stdUnits =
true;
675 return StatusCode::FAILURE;
681 return StatusCode::FAILURE;
684 inmat.read((
char*)&msiz,
sizeof (msiz));
695 for(
int i=0;
i<msiz;
i++) {
696 for(
int j=0; j<msiz; j++) {
697 inmat.read((
char*)&melem,
sizeof (melem));
707 for(
int i=0;
i<msiz;
i++) {
708 for(
int j=0; j<=
i; j++) {
709 inmat.read((
char*)&melem,
sizeof (melem));
716 return StatusCode::SUCCESS;
725 return StatusCode::FAILURE;
728 inmat.read((
char*)&msiz,
sizeof (msiz));
738 for(
int i=0;
i<msiz;
i++) {
739 for(
int j=0; j<msiz; j++) {
740 inmat.read((
char*)&melem,
sizeof (melem));
750 for(
int i=0;
i<msiz;
i++) {
751 for(
int j=0; j<=
i; j++) {
752 inmat.read((
char*)&melem,
sizeof (melem));
759 return StatusCode::SUCCESS;
765 if ( Nnew !=
size() ) {
771 long int Size_old =
size();
773 long int k =
size() <= Size_old ?
size() : Size_old;
774 for(
long int i=0;
i<
k;
i++ ) {
776 for(
long int j=0; j<=
i; j++ )
788 throw std::underflow_error(
"AlSymMat::elemr: Index 1 < zero!" );
791 throw std::overflow_error(
"AlSymMat::elemr: Index 1 too large!" );
794 throw std::underflow_error(
"AlSymMat::elemr: Index 2 < zero!" );
797 throw std::overflow_error(
"AlSymMat::elemr: Index 2 too large!" );
811 throw std::underflow_error(
"AlSymMat::elemc: Index 1 < zero!" );
814 throw std::overflow_error(
"AlSymMat::elemc: Index 1 too large!" );
817 throw std::underflow_error(
"AlSymMat::elemc: Index 2 < zero!" );
820 throw std::overflow_error(
"AlSymMat::elemc: Index 2 too large!" );
836 for(
int i=0;
i<si;
i++ )
837 for(
int j=0; j<=
i; j++ )
842 int *irow =
new int[nnz];
843 int *
icol =
new int[nnz];
844 double *
val =
new double[nnz];
847 for (
int i=0;
i<si;
i++) {
848 for (
int j=0;j<=
i;j++) {
860 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 &)