OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | List of all members
BandMatrix Class Reference

#include <newmat.h>

Inheritance diagram for BandMatrix:
GeneralMatrix BaseMatrix LowerBandMatrix UpperBandMatrix

Public Member Functions

 BandMatrix ()
 
 ~BandMatrix ()
 
 BandMatrix (int n, int lb, int ub)
 
 BandMatrix (const BaseMatrix &)
 
void operator= (const BaseMatrix &)
 
void operator= (Real f)
 
void operator= (const BandMatrix &m)
 
MatrixType Type () const
 
Real & operator() (int, int)
 
Real & element (int, int)
 
Real operator() (int, int) const
 
Real element (int, int) const
 
 BandMatrix (const BandMatrix &gm)
 
LogAndSign LogDeterminant () const
 
GeneralMatrixMakeSolver ()
 
Real Trace () const
 
Real SumSquare () const
 
Real SumAbsoluteValue () const
 
Real Sum () const
 
Real MaximumAbsoluteValue () const
 
Real MinimumAbsoluteValue () const
 
Real Maximum () const
 
Real Minimum () const
 
void GetRow (MatrixRowCol &)
 
void GetCol (MatrixRowCol &)
 
void GetCol (MatrixColX &)
 
void RestoreCol (MatrixRowCol &)
 
void RestoreCol (MatrixColX &c)
 
void NextRow (MatrixRowCol &)
 
virtual void ReSize (int, int, int)
 
void ReSize (const GeneralMatrix &A)
 
bool SameStorageType (const GeneralMatrix &A) const
 
void ReSizeForAdd (const GeneralMatrix &A, const GeneralMatrix &B)
 
void ReSizeForSP (const GeneralMatrix &A, const GeneralMatrix &B)
 
MatrixBandWidth BandWidth () const
 
void SetParameters (const GeneralMatrix *)
 
MatrixInput operator<< (Real)
 
MatrixInput operator<< (int f)
 
void operator<< (const Real *r)
 
void operator<< (const int *r)
 
void operator<< (const BaseMatrix &X)
 
- Public Member Functions inherited from GeneralMatrix
GeneralMatrixEvaluate (MatrixType mt=MatrixTypeUnSp)
 
int Nrows () const
 
int Ncols () const
 
int Storage () const
 
RealStore () const
 
virtual ~GeneralMatrix ()
 
void tDelete ()
 
bool reuse ()
 
void Protect ()
 
int Tag () const
 
bool IsZero () const
 
void Release ()
 
void Release (int t)
 
void ReleaseAndDelete ()
 
void operator<< (const Real *)
 
void operator<< (const int *)
 
void operator<< (const BaseMatrix &X)
 
void Inject (const GeneralMatrix &)
 
void operator+= (const BaseMatrix &)
 
void operator-= (const BaseMatrix &)
 
void operator*= (const BaseMatrix &)
 
void operator|= (const BaseMatrix &)
 
void operator &= (const BaseMatrix &)
 
void operator+= (Real)
 
void operator-= (Real r)
 
void operator*= (Real)
 
void operator/= (Real r)
 
virtual void Solver (MatrixColX &, const MatrixColX &)
 
virtual void RestoreRow (MatrixRowCol &)
 
virtual void NextCol (MatrixRowCol &)
 
virtual void NextCol (MatrixColX &)
 
Real MaximumAbsoluteValue1 (int &i) const
 
Real MinimumAbsoluteValue1 (int &i) const
 
Real Maximum1 (int &i) const
 
Real Minimum1 (int &i) const
 
Real MaximumAbsoluteValue2 (int &i, int &j) const
 
Real MinimumAbsoluteValue2 (int &i, int &j) const
 
Real Maximum2 (int &i, int &j) const
 
Real Minimum2 (int &i, int &j) const
 
virtual bool IsEqual (const GeneralMatrix &) const
 
void CheckStore () const
 
 operator ReturnMatrix () const
 
ReturnMatrix ForReturn () const
 
MatrixInput operator<< (Real)
 
MatrixInput operator<< (int f)
 
void CleanUp ()
 
- Public Member Functions inherited from BaseMatrix
AddedMatrix operator+ (const BaseMatrix &) const
 
MultipliedMatrix operator* (const BaseMatrix &) const
 
SubtractedMatrix operator- (const BaseMatrix &) const
 
ConcatenatedMatrix operator| (const BaseMatrix &) const
 
StackedMatrix operator & (const BaseMatrix &) const
 
ShiftedMatrix operator+ (Real) const
 
ScaledMatrix operator* (Real) const
 
ScaledMatrix operator/ (Real) const
 
ShiftedMatrix operator- (Real) const
 
TransposedMatrix t () const
 
NegatedMatrix operator- () const
 
ReversedMatrix Reverse () const
 
InvertedMatrix i () const
 
RowedMatrix AsRow () const
 
ColedMatrix AsColumn () const
 
DiagedMatrix AsDiagonal () const
 
MatedMatrix AsMatrix (int, int) const
 
GetSubMatrix SubMatrix (int, int, int, int) const
 
GetSubMatrix SymSubMatrix (int, int) const
 
GetSubMatrix Row (int) const
 
GetSubMatrix Rows (int, int) const
 
GetSubMatrix Column (int) const
 
GetSubMatrix Columns (int, int) const
 
Real AsScalar () const
 
Real Determinant () const
 
Real NormFrobenius () const
 
Real Norm1 () const
 
Real NormInfinity () const
 
void IEQND () const
 

Public Attributes

int lower
 
int upper
 

Protected Member Functions

void CornerClear () const
 
short SimpleAddOK (const GeneralMatrix *gm)
 
- Protected Member Functions inherited from GeneralMatrix
 GeneralMatrix ()
 
 GeneralMatrix (ArrayLengthSpecifier)
 
void Add (GeneralMatrix *, Real)
 
void Add (Real)
 
void NegAdd (GeneralMatrix *, Real)
 
void NegAdd (Real)
 
void Multiply (GeneralMatrix *, Real)
 
void Multiply (Real)
 
void Negate (GeneralMatrix *)
 
void Negate ()
 
void ReverseElements ()
 
void ReverseElements (GeneralMatrix *)
 
void operator= (Real)
 
Real * GetStore ()
 
GeneralMatrixBorrowStore (GeneralMatrix *, MatrixType)
 
void GetMatrix (const GeneralMatrix *)
 
void Eq (const BaseMatrix &, MatrixType)
 
void Eq (const GeneralMatrix &)
 
void Eq (const BaseMatrix &, MatrixType, bool)
 
void Eq2 (const BaseMatrix &, MatrixType)
 
int search (const BaseMatrix *) const
 
virtual GeneralMatrixTranspose (TransposedMatrix *, MatrixType)
 
void CheckConversion (const BaseMatrix &)
 
void ReSize (int, int, int)
 
virtual void MiniCleanUp ()
 
void PlusEqual (const GeneralMatrix &gm)
 
void MinusEqual (const GeneralMatrix &gm)
 
void PlusEqual (Real f)
 
void MinusEqual (Real f)
 

Private Member Functions

GeneralMatrixImage () const
 

Additional Inherited Members

- Protected Attributes inherited from GeneralMatrix
int tag
 
int nrows
 
int ncols
 
int storage
 
Realstore
 

Detailed Description

Definition at line 929 of file newmat.h.

Constructor & Destructor Documentation

◆ BandMatrix() [1/4]

BandMatrix::BandMatrix ( )
inline

Definition at line 937 of file newmat.h.

Referenced by Image().

937 :GeneralMatrix() { lower=0; upper=0; CornerClear(); }
int lower
Definition: newmat.h:936
void CornerClear() const
Definition: bandmat.cpp:157
int upper
Definition: newmat.h:936

◆ ~BandMatrix()

BandMatrix::~BandMatrix ( )
inline

Definition at line 938 of file newmat.h.

938 {}

◆ BandMatrix() [2/4]

BandMatrix::BandMatrix ( int  n,
int  lb,
int  ub 
)
inline

Definition at line 939 of file newmat.h.

References n.

939 { ReSize(n,lb,ub); CornerClear(); }
virtual void ReSize(int, int, int)
Definition: bandmat.cpp:46
void CornerClear() const
Definition: bandmat.cpp:157
os2<< "> n<< " > nendobj n

◆ BandMatrix() [3/4]

BandMatrix::BandMatrix ( const BaseMatrix M)

Definition at line 31 of file bandmat.cpp.

References MatrixType::BM, GeneralMatrix::Evaluate(), and REPORT.

32 {
33  REPORT // CheckConversion(M);
34  // MatrixConversionCheck mcc;
36  GetMatrix(gmx); CornerClear();
37 }
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Definition: newmat5.cpp:79
void CornerClear() const
Definition: bandmat.cpp:157
#define REPORT
Definition: bandmat.cpp:24
void GetMatrix(const GeneralMatrix *)
Definition: newmat4.cpp:610

◆ BandMatrix() [4/4]

BandMatrix::BandMatrix ( const BandMatrix gm)
inline

Definition at line 954 of file newmat.h.

954 :GeneralMatrix(gm) { GetMatrix(&gm); }
void GetMatrix(const GeneralMatrix *)
Definition: newmat4.cpp:610

Member Function Documentation

◆ BandWidth()

MatrixBandWidth BandMatrix::BandWidth ( ) const
virtual

Reimplemented from BaseMatrix.

Definition at line 441 of file newmat4.cpp.

References lower, REPORT, and upper.

442  { REPORT return MatrixBandWidth(lower,upper); }
int lower
Definition: newmat.h:936
#define REPORT
Definition: newmat4.cpp:19
int upper
Definition: newmat.h:936

◆ CornerClear()

void BandMatrix::CornerClear ( ) const
protected

Definition at line 157 of file bandmat.cpp.

References REPORT.

158 {
159  // set unused parts of BandMatrix to zero
160  REPORT
161  int i = lower; Real* s = store; int bw = lower + 1 + upper;
162  while (i)
163  { int j = i--; Real* sj = s; s += bw; while (j--) *sj++ = 0.0; }
164  i = upper; s = store + storage;
165  while (i)
166  { int j = i--; Real* sj = s; s -= bw; while (j--) *(--sj) = 0.0; }
167 }
double Real
Definition: include.h:57
int lower
Definition: newmat.h:936
InvertedMatrix i() const
Definition: newmat6.cpp:325
Real * store
Definition: newmat.h:393
int upper
Definition: newmat.h:936
#define REPORT
Definition: bandmat.cpp:24
int storage
Definition: newmat.h:392

◆ element() [1/2]

Real & BandMatrix::element ( int  m,
int  n 
)

Definition at line 783 of file newmat6.cpp.

References n, and REPORT.

784 {
785  REPORT
786  int w = upper+lower+1; int i = lower+n-m;
787  if (m<0 || m>= nrows || n<0 || n>= ncols || i<0 || i>=w)
788  Throw(IndexException(m,n,*this,true));
789  return store[w*m+i];
790 }
int lower
Definition: newmat.h:936
InvertedMatrix i() const
Definition: newmat6.cpp:325
os2<< "> n<< " > nendobj n
#define REPORT
Definition: newmat6.cpp:19
Real * store
Definition: newmat.h:393
int upper
Definition: newmat.h:936

◆ element() [2/2]

Real BandMatrix::element ( int  m,
int  n 
) const

Definition at line 792 of file newmat6.cpp.

References n, and REPORT.

793 {
794  REPORT
795  int w = upper+lower+1; int i = lower+n-m;
796  if (m<0 || m>= nrows || n<0 || n>= ncols || i<0 || i>=w)
797  Throw(IndexException(m,n,*this,true));
798  return store[w*m+i];
799 }
int lower
Definition: newmat.h:936
InvertedMatrix i() const
Definition: newmat6.cpp:325
os2<< "> n<< " > nendobj n
#define REPORT
Definition: newmat6.cpp:19
Real * store
Definition: newmat.h:393
int upper
Definition: newmat.h:936

◆ GetCol() [1/2]

void BandMatrix::GetCol ( MatrixRowCol mrc)
virtual

Implements GeneralMatrix.

Definition at line 587 of file newmat3.cpp.

References MatrixRowCol::cw, MatrixRowCol::data, HaveStore, MatrixRowCol::length, LoadOnEntry, MatrixErrorNoSpace(), MONITOR_REAL_NEW, n, REPORT, MatrixRowCol::rowcol, MatrixRowCol::skip, MatrixRowCol::storage, and StoreHere.

588 {
589  REPORT
590  int c = mrc.rowcol; int n = lower+upper; int w = n+1;
591  mrc.length=nrows; Real* ColCopy;
592  int b; int s = c-upper;
593  if (s<=0) { w += s; s = 0; b = c+lower; } else b = s*w+n;
594  mrc.skip = s; s += w-nrows; if (s>0) w -= s; mrc.storage = w;
595  if ( +(mrc.cw*(StoreHere+HaveStore)) )
596  { REPORT ColCopy = mrc.data; }
597  else
598  {
599  REPORT
600  ColCopy = new Real [n+1]; MatrixErrorNoSpace(ColCopy);
601  MONITOR_REAL_NEW("Make (BMGetCol)",n+1,ColCopy)
602  mrc.cw += HaveStore; mrc.data = ColCopy;
603  }
604 
605  if (+(mrc.cw*LoadOnEntry))
606  {
607  REPORT
608  Real* Mstore = store+b;
609  // while (w--) { *ColCopy++ = *Mstore; Mstore+=n; }
610  if (w) for (;;)
611  { *ColCopy++ = *Mstore; if (!(--w)) break; Mstore+=n; }
612  }
613 }
double Real
Definition: include.h:57
int lower
Definition: newmat.h:936
void MatrixErrorNoSpace(const void *)
Definition: newmatex.cpp:292
#define REPORT
Definition: newmat3.cpp:20
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
os2<< "> n<< " > nendobj n
LoadAndStoreFlag cw
Definition: newmatrc.h:44
Real * store
Definition: newmat.h:393
#define MONITOR_REAL_NEW(Operation, Size, Pointer)
Definition: myexcept.h:317
int rowcol
Definition: newmatrc.h:41
int upper
Definition: newmat.h:936
int length
Definition: newmatrc.h:38

◆ GetCol() [2/2]

void BandMatrix::GetCol ( MatrixColX mrc)
virtual

Implements GeneralMatrix.

Definition at line 615 of file newmat3.cpp.

References MatrixRowCol::cw, MatrixRowCol::data, MatrixRowCol::length, LoadOnEntry, n, REPORT, MatrixRowCol::rowcol, MatrixRowCol::skip, MatrixRowCol::storage, and MatrixColX::store.

616 {
617  REPORT
618  int c = mrc.rowcol; int n = lower+upper; int w = n+1;
619  mrc.length=nrows; int b; int s = c-upper;
620  if (s<=0) { w += s; s = 0; b = c+lower; } else b = s*w+n;
621  mrc.skip = s; s += w-nrows; if (s>0) w -= s; mrc.storage = w;
622  mrc.data = mrc.store+mrc.skip;
623 
624  if (+(mrc.cw*LoadOnEntry))
625  {
626  REPORT
627  Real* ColCopy = mrc.data; Real* Mstore = store+b;
628  // while (w--) { *ColCopy++ = *Mstore; Mstore+=n; }
629  if (w) for (;;)
630  { *ColCopy++ = *Mstore; if (!(--w)) break; Mstore+=n; }
631  }
632 }
double Real
Definition: include.h:57
int lower
Definition: newmat.h:936
#define REPORT
Definition: newmat3.cpp:20
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
os2<< "> n<< " > nendobj n
Real * store
Definition: newmatrc.h:139
LoadAndStoreFlag cw
Definition: newmatrc.h:44
Real * store
Definition: newmat.h:393
int rowcol
Definition: newmatrc.h:41
int upper
Definition: newmat.h:936
int length
Definition: newmatrc.h:38

◆ GetRow()

void BandMatrix::GetRow ( MatrixRowCol mrc)
virtual

Implements GeneralMatrix.

Definition at line 566 of file newmat3.cpp.

References MatrixRowCol::data, MatrixRowCol::length, REPORT, MatrixRowCol::rowcol, MatrixRowCol::skip, and MatrixRowCol::storage.

567 {
568  REPORT
569  int r = mrc.rowcol; int w = lower+1+upper; mrc.length=ncols;
570  int s = r-lower;
571  if (s<0) { mrc.data = store+(r*w-s); w += s; s = 0; }
572  else mrc.data = store+r*w;
573  mrc.skip = s; s += w-ncols; if (s>0) w -= s; mrc.storage = w;
574 }
int lower
Definition: newmat.h:936
#define REPORT
Definition: newmat3.cpp:20
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
Real * store
Definition: newmat.h:393
int rowcol
Definition: newmatrc.h:41
int upper
Definition: newmat.h:936
int length
Definition: newmatrc.h:38

◆ Image()

GeneralMatrix * BandMatrix::Image ( ) const
privatevirtual

Reimplemented from GeneralMatrix.

Reimplemented in LowerBandMatrix, and UpperBandMatrix.

Definition at line 796 of file newmat4.cpp.

References BandMatrix(), MatrixErrorNoSpace(), and REPORT.

797 {
798  REPORT
799  GeneralMatrix* gm = new BandMatrix(*this); MatrixErrorNoSpace(gm);
800  return gm;
801 }
BandMatrix()
Definition: newmat.h:937
void MatrixErrorNoSpace(const void *)
Definition: newmatex.cpp:292
#define REPORT
Definition: newmat4.cpp:19

◆ LogDeterminant()

LogAndSign BandMatrix::LogDeterminant ( ) const
virtual

Reimplemented from GeneralMatrix.

Reimplemented in LowerBandMatrix, and UpperBandMatrix.

Definition at line 398 of file bandmat.cpp.

References REPORT.

399 {
400  REPORT
401  BandLUMatrix C(*this); return C.LogDeterminant();
402 }
#define REPORT
Definition: bandmat.cpp:24

◆ MakeSolver()

GeneralMatrix * BandMatrix::MakeSolver ( )
virtual

Reimplemented from GeneralMatrix.

Reimplemented in LowerBandMatrix, and UpperBandMatrix.

Definition at line 265 of file bandmat.cpp.

References MatrixErrorNoSpace(), and REPORT.

266 {
267  REPORT
268  GeneralMatrix* gm = new BandLUMatrix(*this);
269  MatrixErrorNoSpace(gm); gm->ReleaseAndDelete(); return gm;
270 }
void MatrixErrorNoSpace(const void *)
Definition: newmatex.cpp:292
#define REPORT
Definition: bandmat.cpp:24

◆ Maximum()

Real BandMatrix::Maximum ( ) const
inlinevirtual

Reimplemented from GeneralMatrix.

Definition at line 967 of file newmat.h.

References GeneralMatrix::Maximum2().

967 { int i, j; return GeneralMatrix::Maximum2(i, j); }
InvertedMatrix i() const
Definition: newmat6.cpp:325
Real Maximum2(int &i, int &j) const
Definition: newmat8.cpp:322

◆ MaximumAbsoluteValue()

Real BandMatrix::MaximumAbsoluteValue ( ) const
inlinevirtual

Reimplemented from GeneralMatrix.

Definition at line 963 of file newmat.h.

References GeneralMatrix::MaximumAbsoluteValue().

Real MaximumAbsoluteValue() const
Definition: newmat8.cpp:214
void CornerClear() const
Definition: bandmat.cpp:157

◆ Minimum()

Real BandMatrix::Minimum ( ) const
inlinevirtual

Reimplemented from GeneralMatrix.

Definition at line 968 of file newmat.h.

References GeneralMatrix::Minimum2().

968 { int i, j; return GeneralMatrix::Minimum2(i, j); }
InvertedMatrix i() const
Definition: newmat6.cpp:325
Real Minimum2(int &i, int &j) const
Definition: newmat8.cpp:337

◆ MinimumAbsoluteValue()

Real BandMatrix::MinimumAbsoluteValue ( ) const
inlinevirtual

Reimplemented from GeneralMatrix.

Definition at line 965 of file newmat.h.

References GeneralMatrix::MinimumAbsoluteValue2().

966  { int i, j; return GeneralMatrix::MinimumAbsoluteValue2(i, j); }
InvertedMatrix i() const
Definition: newmat6.cpp:325
Real MinimumAbsoluteValue2(int &i, int &j) const
Definition: newmat8.cpp:307

◆ NextRow()

void BandMatrix::NextRow ( MatrixRowCol mrc)
virtual

Reimplemented from GeneralMatrix.

Definition at line 578 of file newmat3.cpp.

References MatrixRowCol::data, REPORT, MatrixRowCol::rowcol, MatrixRowCol::skip, and MatrixRowCol::storage.

579 {
580  REPORT
581  int r = ++mrc.rowcol;
582  if (r<=lower) { mrc.storage++; mrc.data += lower+upper; }
583  else { mrc.skip++; mrc.data += lower+upper+1; }
584  if (r>=ncols-upper) mrc.storage--;
585 }
int lower
Definition: newmat.h:936
#define REPORT
Definition: newmat3.cpp:20
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
int rowcol
Definition: newmatrc.h:41
int upper
Definition: newmat.h:936

◆ operator()() [1/2]

Real & BandMatrix::operator() ( int  m,
int  n 
)

Definition at line 92 of file newmat6.cpp.

References n, and REPORT.

93 {
94  REPORT
95  int w = upper+lower+1; int i = lower+n-m;
96  if (m<=0 || m>nrows || n<=0 || n>ncols || i<0 || i>=w)
97  Throw(IndexException(m,n,*this));
98  return store[w*(m-1)+i];
99 }
int lower
Definition: newmat.h:936
InvertedMatrix i() const
Definition: newmat6.cpp:325
os2<< "> n<< " > nendobj n
#define REPORT
Definition: newmat6.cpp:19
Real * store
Definition: newmat.h:393
int upper
Definition: newmat.h:936

◆ operator()() [2/2]

Real BandMatrix::operator() ( int  m,
int  n 
) const

Definition at line 204 of file newmat6.cpp.

References n, and REPORT.

205 {
206  REPORT
207  int w = upper+lower+1; int i = lower+n-m;
208  if (m<=0 || m>nrows || n<=0 || n>ncols || i<0 || i>=w)
209  Throw(IndexException(m,n,*this));
210  return store[w*(m-1)+i];
211 }
int lower
Definition: newmat.h:936
InvertedMatrix i() const
Definition: newmat6.cpp:325
os2<< "> n<< " > nendobj n
#define REPORT
Definition: newmat6.cpp:19
Real * store
Definition: newmat.h:393
int upper
Definition: newmat.h:936

◆ operator<<() [1/5]

MatrixInput BandMatrix::operator<< ( Real  )

Definition at line 441 of file newmat5.cpp.

442 {
443  Tracer et("MatrixInput");
444  // bool dummy = true;
445  // if (dummy) // get rid of warning message
446  Throw(ProgramException("Cannot use list read with a BandMatrix"));
447  return MatrixInput(0, 0);
448 }

◆ operator<<() [2/5]

MatrixInput BandMatrix::operator<< ( int  f)
inline

Definition at line 1778 of file newmat.h.

1778 { return *this << (Real)f; }
double Real
Definition: include.h:57

◆ operator<<() [3/5]

void BandMatrix::operator<< ( const Real *  r)

Definition at line 450 of file newmat5.cpp.

451 { Throw(ProgramException("Cannot use array read with a BandMatrix")); }

◆ operator<<() [4/5]

void BandMatrix::operator<< ( const int *  r)

Definition at line 453 of file newmat5.cpp.

454 { Throw(ProgramException("Cannot use array read with a BandMatrix")); }

◆ operator<<() [5/5]

void BandMatrix::operator<< ( const BaseMatrix X)
inline

Definition at line 988 of file newmat.h.

References GeneralMatrix::operator<<().

void operator<<(const Real *)
Definition: newmat6.cpp:422

◆ operator=() [1/3]

void BandMatrix::operator= ( const BaseMatrix X)

Definition at line 150 of file bandmat.cpp.

References MatrixType::BM, and REPORT.

151 {
152  REPORT // CheckConversion(X);
153  // MatrixConversionCheck mcc;
155 }
void CornerClear() const
Definition: bandmat.cpp:157
void Eq(const BaseMatrix &, MatrixType)
Definition: newmat4.cpp:637
#define REPORT
Definition: bandmat.cpp:24

◆ operator=() [2/3]

void BandMatrix::operator= ( Real  f)
inline

Definition at line 943 of file newmat.h.

References GeneralMatrix::operator=().

void operator=(Real)
Definition: newmat6.cpp:342

◆ operator=() [3/3]

void BandMatrix::operator= ( const BandMatrix m)
inline

Definition at line 944 of file newmat.h.

944 { Eq(m); }
void Eq(const BaseMatrix &, MatrixType)
Definition: newmat4.cpp:637

◆ ReSize() [1/2]

void BandMatrix::ReSize ( int  n,
int  lb,
int  ub 
)
virtual

Reimplemented in LowerBandMatrix, and UpperBandMatrix.

Definition at line 46 of file bandmat.cpp.

References n, REPORT, and GeneralMatrix::ReSize().

Referenced by UpperBandMatrix::ReSize(), and LowerBandMatrix::ReSize().

47 {
48  REPORT
49  Tracer tr("BandMatrix::ReSize");
50  if (lb<0 || ub<0) Throw(ProgramException("Undefined bandwidth"));
51  lower = (lb<=n) ? lb : n-1; upper = (ub<=n) ? ub : n-1;
53 }
int lower
Definition: newmat.h:936
void CornerClear() const
Definition: bandmat.cpp:157
os2<< "> n<< " > nendobj n
void ReSize(int, int, int)
Definition: newmat4.cpp:216
int upper
Definition: newmat.h:936
#define REPORT
Definition: bandmat.cpp:24

◆ ReSize() [2/2]

void BandMatrix::ReSize ( const GeneralMatrix A)
virtual

Reimplemented from GeneralMatrix.

Reimplemented in LowerBandMatrix, and UpperBandMatrix.

Definition at line 103 of file bandmat.cpp.

References A, MatrixBandWidth::Lower(), n, REPORT, and MatrixBandWidth::Upper().

104 {
105  REPORT
106  int n = A.Nrows();
107  if (n != A.Ncols())
108  {
109  Tracer tr("BandMatrix::ReSize(GM)");
110  Throw(NotSquareException(*this));
111  }
112  MatrixBandWidth mbw = A.BandWidth();
113  ReSize(n, mbw.Lower(), mbw.Upper());
114 }
#define A(r, c)
virtual void ReSize(int, int, int)
Definition: bandmat.cpp:46
int Lower() const
Definition: newmat.h:204
os2<< "> n<< " > nendobj n
int Upper() const
Definition: newmat.h:203
#define REPORT
Definition: bandmat.cpp:24

◆ ReSizeForAdd()

void BandMatrix::ReSizeForAdd ( const GeneralMatrix A,
const GeneralMatrix B 
)
virtual

Reimplemented from GeneralMatrix.

Definition at line 123 of file bandmat.cpp.

124 {
125  REPORT
126  Tracer tr("BandMatrix::ReSizeForAdd");
127  MatrixBandWidth A_BW = A.BandWidth(); MatrixBandWidth B_BW = B.BandWidth();
128  if ((A_BW.Lower() < 0) | (A_BW.Upper() < 0) | (B_BW.Lower() < 0)
129  | (A_BW.Upper() < 0))
130  Throw(ProgramException("Can't ReSize to BandMatrix" ));
131  // already know A and B are square
132  ReSize(A.Nrows(), my_max(A_BW.Lower(), B_BW.Lower()),
133  my_max(A_BW.Upper(), B_BW.Upper()));
134 }
virtual MatrixBandWidth BandWidth() const
Definition: newmat4.cpp:431
#define A(r, c)
virtual void ReSize(int, int, int)
Definition: bandmat.cpp:46
int Lower() const
Definition: newmat.h:204
int Upper() const
Definition: newmat.h:203
#define REPORT
Definition: bandmat.cpp:24

◆ ReSizeForSP()

void BandMatrix::ReSizeForSP ( const GeneralMatrix A,
const GeneralMatrix B 
)
virtual

Reimplemented from GeneralMatrix.

Definition at line 136 of file bandmat.cpp.

137 {
138  REPORT
139  Tracer tr("BandMatrix::ReSizeForSP");
140  MatrixBandWidth A_BW = A.BandWidth(); MatrixBandWidth B_BW = B.BandWidth();
141  if ((A_BW.Lower() < 0) | (A_BW.Upper() < 0) | (B_BW.Lower() < 0)
142  | (A_BW.Upper() < 0))
143  Throw(ProgramException("Can't ReSize to BandMatrix" ));
144  // already know A and B are square
145  ReSize(A.Nrows(), my_min(A_BW.Lower(), B_BW.Lower()),
146  my_min(A_BW.Upper(), B_BW.Upper()));
147 }
virtual MatrixBandWidth BandWidth() const
Definition: newmat4.cpp:431
#define A(r, c)
virtual void ReSize(int, int, int)
Definition: bandmat.cpp:46
int Lower() const
Definition: newmat.h:204
int Upper() const
Definition: newmat.h:203
#define REPORT
Definition: bandmat.cpp:24

◆ RestoreCol() [1/2]

void BandMatrix::RestoreCol ( MatrixRowCol mrc)
virtual

Reimplemented from GeneralMatrix.

Definition at line 634 of file newmat3.cpp.

References MatrixRowCol::data, n, REPORT, MatrixRowCol::rowcol, and MatrixRowCol::storage.

635 {
636  REPORT
637  int c = mrc.rowcol; int n = lower+upper; int s = c-upper;
638  Real* Mstore = store + ((s<=0) ? c+lower : s*n+s+n);
639  Real* Cstore = mrc.data;
640  int w = mrc.storage;
641  // while (w--) { *Mstore = *Cstore++; Mstore += n; }
642  if (w) for (;;)
643  { *Mstore = *Cstore++; if (!(--w)) break; Mstore += n; }
644 }
double Real
Definition: include.h:57
int lower
Definition: newmat.h:936
#define REPORT
Definition: newmat3.cpp:20
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
os2<< "> n<< " > nendobj n
Real * store
Definition: newmat.h:393
int rowcol
Definition: newmatrc.h:41
int upper
Definition: newmat.h:936

◆ RestoreCol() [2/2]

void BandMatrix::RestoreCol ( MatrixColX c)
inlinevirtual

Reimplemented from GeneralMatrix.

Definition at line 973 of file newmat.h.

References RestoreCol().

Referenced by RestoreCol().

973 { RestoreCol((MatrixRowCol&)c); }
void RestoreCol(MatrixRowCol &)
Definition: newmat3.cpp:634

◆ SameStorageType()

bool BandMatrix::SameStorageType ( const GeneralMatrix A) const
virtual

Reimplemented from GeneralMatrix.

Definition at line 116 of file bandmat.cpp.

References A, and REPORT.

117 {
118  if (Type() != A.Type()) { REPORT return false; }
119  REPORT
120  return BandWidth() == A.BandWidth();
121 }
#define A(r, c)
MatrixType Type() const
Definition: newmat4.cpp:422
MatrixBandWidth BandWidth() const
Definition: newmat4.cpp:441
#define REPORT
Definition: bandmat.cpp:24

◆ SetParameters()

void BandMatrix::SetParameters ( const GeneralMatrix gmx)
virtual

Reimplemented from GeneralMatrix.

Definition at line 39 of file bandmat.cpp.

References BaseMatrix::BandWidth(), MatrixBandWidth::lower, and REPORT.

40 {
41  REPORT
42  MatrixBandWidth bw = gmx->BandWidth();
43  lower = bw.lower; upper = bw.upper;
44 }
int lower
Definition: newmat.h:936
virtual MatrixBandWidth BandWidth() const
Definition: newmat4.cpp:431
int upper
Definition: newmat.h:936
#define REPORT
Definition: bandmat.cpp:24

◆ SimpleAddOK()

short BandMatrix::SimpleAddOK ( const GeneralMatrix gm)
protectedvirtual

Reimplemented from GeneralMatrix.

Definition at line 64 of file bandmat.cpp.

References lower, REPORT, and upper.

65 {
66  const BandMatrix* bm = (const BandMatrix*)gm;
67  if (bm->lower == lower && bm->upper == upper) { REPORT return 0; }
68  else if (bm->lower >= lower && bm->upper >= upper) { REPORT return 1; }
69  else if (bm->lower <= lower && bm->upper <= upper) { REPORT return 2; }
70  else { REPORT return 3; }
71 }
int lower
Definition: newmat.h:936
int upper
Definition: newmat.h:936
#define REPORT
Definition: bandmat.cpp:24

◆ Sum()

Real BandMatrix::Sum ( ) const
inlinevirtual

Reimplemented from GeneralMatrix.

Definition at line 961 of file newmat.h.

References GeneralMatrix::Sum().

962  { CornerClear(); return GeneralMatrix::Sum(); }
void CornerClear() const
Definition: bandmat.cpp:157
Real Sum() const
Definition: newmat8.cpp:168

◆ SumAbsoluteValue()

Real BandMatrix::SumAbsoluteValue ( ) const
inlinevirtual

Reimplemented from GeneralMatrix.

Definition at line 959 of file newmat.h.

References GeneralMatrix::SumAbsoluteValue().

void CornerClear() const
Definition: bandmat.cpp:157
Real SumAbsoluteValue() const
Definition: newmat8.cpp:160

◆ SumSquare()

Real BandMatrix::SumSquare ( ) const
inlinevirtual

Reimplemented from GeneralMatrix.

Definition at line 958 of file newmat.h.

References GeneralMatrix::SumSquare().

958 { CornerClear(); return GeneralMatrix::SumSquare(); }
void CornerClear() const
Definition: bandmat.cpp:157
Real SumSquare() const
Definition: newmat8.cpp:152

◆ Trace()

Real BandMatrix::Trace ( ) const
virtual

Reimplemented from BaseMatrix.

Definition at line 582 of file newmat8.cpp.

References REPORT.

583 {
584  REPORT
585  int i = nrows; int w = lower+upper+1;
586  Real sum = 0.0; Real* s = store+lower;
587  // while (i--) { sum += *s; s += w; }
588  if (i) for (;;) { sum += *s; if (!(--i)) break; s += w; }
589  ((GeneralMatrix&)*this).tDelete(); return sum;
590 }
double Real
Definition: include.h:57
int lower
Definition: newmat.h:936
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: newmat8.cpp:21
Real * store
Definition: newmat.h:393
int upper
Definition: newmat.h:936

◆ Type()

MatrixType BandMatrix::Type ( ) const
virtual

Implements GeneralMatrix.

Reimplemented in LowerBandMatrix, and UpperBandMatrix.

Definition at line 422 of file newmat4.cpp.

References MatrixType::BM.

422 { return MatrixType::BM; }

Member Data Documentation

◆ lower

int BandMatrix::lower

Definition at line 936 of file newmat.h.

Referenced by BandWidth(), and SimpleAddOK().

◆ upper

int BandMatrix::upper

Definition at line 936 of file newmat.h.

Referenced by BandWidth(), and SimpleAddOK().


The documentation for this class was generated from the following files: