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

#include <newmat.h>

Inheritance diagram for UpperTriangularMatrix:
GeneralMatrix BaseMatrix

Public Member Functions

 UpperTriangularMatrix ()
 
 ~UpperTriangularMatrix ()
 
 UpperTriangularMatrix (ArrayLengthSpecifier)
 
void operator= (const BaseMatrix &)
 
void operator= (const UpperTriangularMatrix &m)
 
 UpperTriangularMatrix (const BaseMatrix &)
 
 UpperTriangularMatrix (const UpperTriangularMatrix &gm)
 
void operator= (Real f)
 
Real & operator() (int, int)
 
Real & element (int, int)
 
Real operator() (int, int) const
 
Real element (int, int) const
 
MatrixType Type () const
 
GeneralMatrixMakeSolver ()
 
void Solver (MatrixColX &, const MatrixColX &)
 
LogAndSign LogDeterminant () const
 
Real Trace () const
 
void GetRow (MatrixRowCol &)
 
void GetCol (MatrixRowCol &)
 
void GetCol (MatrixColX &)
 
void RestoreCol (MatrixRowCol &)
 
void RestoreCol (MatrixColX &c)
 
void NextRow (MatrixRowCol &)
 
void ReSize (int)
 
void ReSize (const GeneralMatrix &A)
 
MatrixBandWidth BandWidth () const
 
void operator+= (const UpperTriangularMatrix &M)
 
void operator-= (const UpperTriangularMatrix &M)
 
void operator+= (Real f)
 
void operator-= (Real f)
 
- 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 RestoreRow (MatrixRowCol &)
 
virtual void NextCol (MatrixRowCol &)
 
virtual void NextCol (MatrixColX &)
 
Real SumSquare () const
 
Real SumAbsoluteValue () const
 
Real Sum () const
 
Real MaximumAbsoluteValue1 (int &i) const
 
Real MinimumAbsoluteValue1 (int &i) const
 
Real Maximum1 (int &i) const
 
Real Minimum1 (int &i) const
 
Real MaximumAbsoluteValue () const
 
Real MaximumAbsoluteValue2 (int &i, int &j) const
 
Real MinimumAbsoluteValue () const
 
Real MinimumAbsoluteValue2 (int &i, int &j) const
 
Real Maximum () const
 
Real Maximum2 (int &i, int &j) const
 
Real Minimum () const
 
Real Minimum2 (int &i, int &j) const
 
virtual bool IsEqual (const GeneralMatrix &) const
 
void CheckStore () const
 
virtual void SetParameters (const GeneralMatrix *)
 
 operator ReturnMatrix () const
 
ReturnMatrix ForReturn () const
 
virtual bool SameStorageType (const GeneralMatrix &A) const
 
virtual void ReSizeForAdd (const GeneralMatrix &A, const GeneralMatrix &B)
 
virtual void ReSizeForSP (const GeneralMatrix &A, const GeneralMatrix &B)
 
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
 

Private Member Functions

GeneralMatrixImage () const
 

Additional Inherited Members

- 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 short SimpleAddOK (const GeneralMatrix *)
 
virtual void MiniCleanUp ()
 
void PlusEqual (const GeneralMatrix &gm)
 
void MinusEqual (const GeneralMatrix &gm)
 
void PlusEqual (Real f)
 
void MinusEqual (Real f)
 
- Protected Attributes inherited from GeneralMatrix
int tag
 
int nrows
 
int ncols
 
int storage
 
Realstore
 

Detailed Description

Definition at line 690 of file newmat.h.

Constructor & Destructor Documentation

◆ UpperTriangularMatrix() [1/4]

UpperTriangularMatrix::UpperTriangularMatrix ( )
inline

Definition at line 694 of file newmat.h.

Referenced by Image().

694 :GeneralMatrix() {}

◆ ~UpperTriangularMatrix()

UpperTriangularMatrix::~UpperTriangularMatrix ( )
inline

Definition at line 695 of file newmat.h.

695 {}

◆ UpperTriangularMatrix() [2/4]

UpperTriangularMatrix::UpperTriangularMatrix ( ArrayLengthSpecifier  n)

Definition at line 59 of file newmat4.cpp.

60  : GeneralMatrix(tristore(n.Value()))
61 { REPORT nrows=n.Value(); ncols=n.Value(); }
#define REPORT
Definition: newmat4.cpp:19
os2<< "> n<< " > nendobj n

◆ UpperTriangularMatrix() [3/4]

UpperTriangularMatrix::UpperTriangularMatrix ( const BaseMatrix M)

Definition at line 129 of file newmat4.cpp.

References GeneralMatrix::Evaluate(), GeneralMatrix::GetMatrix(), REPORT, and MatrixType::UT.

130 {
131  REPORT // CheckConversion(M);
132  // MatrixConversionCheck mcc;
134  GetMatrix(gmx);
135 }
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Definition: newmat5.cpp:79
#define REPORT
Definition: newmat4.cpp:19
void GetMatrix(const GeneralMatrix *)
Definition: newmat4.cpp:610

◆ UpperTriangularMatrix() [4/4]

UpperTriangularMatrix::UpperTriangularMatrix ( const UpperTriangularMatrix gm)
inline

Definition at line 700 of file newmat.h.

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

Member Function Documentation

◆ BandWidth()

MatrixBandWidth UpperTriangularMatrix::BandWidth ( ) const
virtual

Reimplemented from BaseMatrix.

Definition at line 435 of file newmat4.cpp.

References REPORT.

436  { REPORT return MatrixBandWidth(0,-1); }
#define REPORT
Definition: newmat4.cpp:19

◆ element() [1/2]

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

Definition at line 693 of file newmat6.cpp.

References n, and REPORT.

694 {
695  REPORT
696  if (m<0 || n<m || n>=ncols)
697  Throw(IndexException(m,n,*this,true));
698  return store[m*ncols+n-tristore(m)];
699 }
os2<< "> n<< " > nendobj n
#define REPORT
Definition: newmat6.cpp:19
Real * store
Definition: newmat.h:393

◆ element() [2/2]

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

Definition at line 701 of file newmat6.cpp.

References n, and REPORT.

702 {
703  REPORT
704  if (m<0 || n<m || n>=ncols)
705  Throw(IndexException(m,n,*this,true));
706  return store[m*ncols+n-tristore(m)];
707 }
os2<< "> n<< " > nendobj n
#define REPORT
Definition: newmat6.cpp:19
Real * store
Definition: newmat.h:393

◆ GetCol() [1/2]

void UpperTriangularMatrix::GetCol ( MatrixRowCol mrc)
virtual

Implements GeneralMatrix.

Definition at line 280 of file newmat3.cpp.

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

281 {
282  REPORT
283  mrc.skip=0; int i=mrc.rowcol+1; mrc.storage=i;
284  mrc.length=nrows; Real* ColCopy;
285  if ( !(mrc.cw*(StoreHere+HaveStore)) )
286  {
287  REPORT // not accessed
288  ColCopy = new Real [nrows]; MatrixErrorNoSpace(ColCopy);
289  MONITOR_REAL_NEW("Make (UT GetCol)",nrows,ColCopy)
290  mrc.data = ColCopy; mrc.cw += HaveStore;
291  }
292  else { REPORT ColCopy = mrc.data; }
293  if (+(mrc.cw*LoadOnEntry))
294  {
295  REPORT
296  Real* Mstore = store+mrc.rowcol; int j = ncols;
297  // while (i--) { *ColCopy++ = *Mstore; Mstore += --j; }
298  if (i) for (;;)
299  { *ColCopy++ = *Mstore; if (!(--i)) break; Mstore += --j; }
300  }
301 }
double Real
Definition: include.h:57
InvertedMatrix i() const
Definition: newmat6.cpp:325
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
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 length
Definition: newmatrc.h:38

◆ GetCol() [2/2]

void UpperTriangularMatrix::GetCol ( MatrixColX mrc)
virtual

Implements GeneralMatrix.

Definition at line 303 of file newmat3.cpp.

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

304 {
305  REPORT
306  mrc.skip=0; int i=mrc.rowcol+1; mrc.storage=i;
307  mrc.length=nrows;
308  if (+(mrc.cw*LoadOnEntry))
309  {
310  REPORT
311  Real* ColCopy = mrc.data;
312  Real* Mstore = store+mrc.rowcol; int j = ncols;
313  // while (i--) { *ColCopy++ = *Mstore; Mstore += --j; }
314  if (i) for (;;)
315  { *ColCopy++ = *Mstore; if (!(--i)) break; Mstore += --j; }
316  }
317 }
double Real
Definition: include.h:57
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: newmat3.cpp:20
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
LoadAndStoreFlag cw
Definition: newmatrc.h:44
Real * store
Definition: newmat.h:393
int rowcol
Definition: newmatrc.h:41
int length
Definition: newmatrc.h:38

◆ GetRow()

void UpperTriangularMatrix::GetRow ( MatrixRowCol mrc)
virtual

Implements GeneralMatrix.

Definition at line 272 of file newmat3.cpp.

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

273 {
274  REPORT
275  int row = mrc.rowcol; mrc.skip=row; mrc.length=ncols;
276  mrc.storage=ncols-row; mrc.data=store+(row*(2*ncols-row+1))/2;
277 }
#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 length
Definition: newmatrc.h:38

◆ Image()

GeneralMatrix * UpperTriangularMatrix::Image ( ) const
privatevirtual

Reimplemented from GeneralMatrix.

Definition at line 761 of file newmat4.cpp.

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

762 {
763  REPORT
764  GeneralMatrix* gm = new UpperTriangularMatrix(*this);
765  MatrixErrorNoSpace(gm); return gm;
766 }
void MatrixErrorNoSpace(const void *)
Definition: newmatex.cpp:292
#define REPORT
Definition: newmat4.cpp:19

◆ LogDeterminant()

LogAndSign UpperTriangularMatrix::LogDeterminant ( ) const
virtual

Reimplemented from GeneralMatrix.

Definition at line 666 of file newmat8.cpp.

References REPORT.

667 {
668  REPORT
669  int i = nrows; LogAndSign sum; Real* s = store;
670  while (i) { sum *= *s; s += i--; }
671  ((GeneralMatrix&)*this).tDelete(); return sum;
672 }
double Real
Definition: include.h:57
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: newmat8.cpp:21
Real * store
Definition: newmat.h:393

◆ MakeSolver()

GeneralMatrix* UpperTriangularMatrix::MakeSolver ( )
inlinevirtual

Reimplemented from GeneralMatrix.

Definition at line 711 of file newmat.h.

711 { return this; } // for solving

◆ NextRow()

void UpperTriangularMatrix::NextRow ( MatrixRowCol mrc)
virtual

Reimplemented from GeneralMatrix.

Definition at line 329 of file newmat3.cpp.

References MatrixRowCol::IncrUT(), and REPORT.

329 { REPORT mrc.IncrUT(); }
#define REPORT
Definition: newmat3.cpp:20
void IncrUT()
Definition: newmatrc.h:48

◆ operator()() [1/2]

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

Definition at line 47 of file newmat6.cpp.

References n, and REPORT.

48 {
49  REPORT
50  if (m<=0 || n<m || n>ncols)
51  Throw(IndexException(m,n,*this));
52  return store[(m-1)*ncols+n-1-tristore(m-1)];
53 }
os2<< "> n<< " > nendobj n
#define REPORT
Definition: newmat6.cpp:19
Real * store
Definition: newmat.h:393

◆ operator()() [2/2]

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

Definition at line 159 of file newmat6.cpp.

References n, and REPORT.

160 {
161  REPORT
162  if (m<=0 || n<m || n>ncols)
163  Throw(IndexException(m,n,*this));
164  return store[(m-1)*ncols+n-1-tristore(m-1)];
165 }
os2<< "> n<< " > nendobj n
#define REPORT
Definition: newmat6.cpp:19
Real * store
Definition: newmat.h:393

◆ operator+=() [1/2]

void UpperTriangularMatrix::operator+= ( const UpperTriangularMatrix M)
inline

Definition at line 724 of file newmat.h.

724 { PlusEqual(M); }
void PlusEqual(const GeneralMatrix &gm)
Definition: newmat7.cpp:148

◆ operator+=() [2/2]

void UpperTriangularMatrix::operator+= ( Real  f)
inline

Definition at line 726 of file newmat.h.

References GeneralMatrix::operator+=().

void operator+=(const BaseMatrix &)
Definition: newmat6.cpp:469

◆ operator-=() [1/2]

void UpperTriangularMatrix::operator-= ( const UpperTriangularMatrix M)
inline

Definition at line 725 of file newmat.h.

725 { MinusEqual(M); }
void MinusEqual(const GeneralMatrix &gm)
Definition: newmat7.cpp:178

◆ operator-=() [2/2]

void UpperTriangularMatrix::operator-= ( Real  f)
inline

Definition at line 727 of file newmat.h.

References GeneralMatrix::operator-=().

void operator-=(const BaseMatrix &)
Definition: newmat6.cpp:482

◆ operator=() [1/3]

void UpperTriangularMatrix::operator= ( const BaseMatrix X)

Definition at line 394 of file newmat6.cpp.

References REPORT, and MatrixType::UT.

395 {
396  REPORT //CheckConversion(X);
397  // MatrixConversionCheck mcc;
398  Eq(X,MatrixType::UT);
399 }
#define REPORT
Definition: newmat6.cpp:19
void Eq(const BaseMatrix &, MatrixType)
Definition: newmat4.cpp:637

◆ operator=() [2/3]

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

Definition at line 698 of file newmat.h.

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

◆ operator=() [3/3]

void UpperTriangularMatrix::operator= ( Real  f)
inline

Definition at line 701 of file newmat.h.

References GeneralMatrix::operator=().

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

◆ ReSize() [1/2]

void UpperTriangularMatrix::ReSize ( int  nr)

Definition at line 250 of file newmat4.cpp.

References REPORT, and GeneralMatrix::ReSize().

Referenced by QRZ(), and ReSize().

251 { REPORT GeneralMatrix::ReSize(nr,nr,tristore(nr)); }
#define REPORT
Definition: newmat4.cpp:19
void ReSize(int, int, int)
Definition: newmat4.cpp:216

◆ ReSize() [2/2]

void UpperTriangularMatrix::ReSize ( const GeneralMatrix A)
virtual

Reimplemented from GeneralMatrix.

Definition at line 331 of file newmat4.cpp.

References A, n, REPORT, and ReSize().

332 {
333  REPORT
334  int n = A.Nrows();
335  if (n != A.Ncols())
336  {
337  Tracer tr("UpperTriangularMatrix::ReSize(GM)");
338  Throw(NotSquareException(*this));
339  }
340  ReSize(n);
341 }
#define A(r, c)
#define REPORT
Definition: newmat4.cpp:19
os2<< "> n<< " > nendobj n

◆ RestoreCol() [1/2]

void UpperTriangularMatrix::RestoreCol ( MatrixRowCol mrc)
virtual

Reimplemented from GeneralMatrix.

Definition at line 319 of file newmat3.cpp.

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

320 {
321  REPORT
322  Real* Mstore = store+mrc.rowcol; int i=mrc.rowcol+1; int j = ncols;
323  Real* Cstore = mrc.data;
324  // while (i--) { *Mstore = *Cstore++; Mstore += --j; }
325  if (i) for (;;)
326  { *Mstore = *Cstore++; if (!(--i)) break; Mstore += --j; }
327 }
double Real
Definition: include.h:57
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: newmat3.cpp:20
Real * data
Definition: newmatrc.h:43
Real * store
Definition: newmat.h:393
int rowcol
Definition: newmatrc.h:41

◆ RestoreCol() [2/2]

void UpperTriangularMatrix::RestoreCol ( MatrixColX c)
inlinevirtual

Reimplemented from GeneralMatrix.

Definition at line 719 of file newmat.h.

References RestoreCol().

Referenced by RestoreCol().

719 { RestoreCol((MatrixRowCol&)c); }
void RestoreCol(MatrixRowCol &)
Definition: newmat3.cpp:319

◆ Solver()

void UpperTriangularMatrix::Solver ( MatrixColX mcout,
const MatrixColX mcin 
)
virtual

Reimplemented from GeneralMatrix.

Definition at line 51 of file newmat7.cpp.

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

53 {
54  REPORT
55  int i = mcin.skip-mcout.skip; Real* elx = mcin.data-i;
56  while (i-- > 0) *elx++ = 0.0;
57  int nr = mcin.skip+mcin.storage;
58  elx = mcin.data+mcin.storage; Real* el = elx;
59  int j = mcout.skip+mcout.storage-nr; int nc = ncols-nr; i = nr-mcout.skip;
60  while (j-- > 0) *elx++ = 0.0;
61  Real* Ael = store + (nr*(2*ncols-nr+1))/2; j = 0;
62  while (i-- > 0)
63  {
64  elx = el; Real sum = 0.0; int jx = j++; Ael -= nc;
65  while (jx--) sum += *(--Ael) * *(--elx);
66  elx--; *elx = (*elx - sum) / *(--Ael);
67  }
68 }
double Real
Definition: include.h:57
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: newmat7.cpp:18
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
Real * store
Definition: newmat.h:393

◆ Trace()

Real UpperTriangularMatrix::Trace ( ) const
virtual

Reimplemented from BaseMatrix.

Definition at line 574 of file newmat8.cpp.

References REPORT.

575 {
576  REPORT
577  int i = nrows; Real sum = 0.0; Real* s = store;
578  while (i) { sum += *s; s += i--; } // won t cause a problem
579  ((GeneralMatrix&)*this).tDelete(); return sum;
580 }
double Real
Definition: include.h:57
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: newmat8.cpp:21
Real * store
Definition: newmat.h:393

◆ Type()

MatrixType UpperTriangularMatrix::Type ( ) const
virtual

Implements GeneralMatrix.

Definition at line 416 of file newmat4.cpp.

References MatrixType::UT.

416 { return MatrixType::UT; }

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