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

#include <newmat.h>

Inheritance diagram for SubtractedMatrix:
AddedMatrix MultipliedMatrix BaseMatrix

Public Member Functions

 ~SubtractedMatrix ()
 
GeneralMatrixEvaluate (MatrixType mt=MatrixTypeUnSp)
 
- Public Member Functions inherited from AddedMatrix
 ~AddedMatrix ()
 
MatrixBandWidth BandWidth () const
 
- Public Member Functions inherited from MultipliedMatrix
 ~MultipliedMatrix ()
 
- 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
 
virtual LogAndSign LogDeterminant () const
 
Real Determinant () const
 
virtual Real SumSquare () const
 
Real NormFrobenius () const
 
virtual Real SumAbsoluteValue () const
 
virtual Real Sum () const
 
virtual Real MaximumAbsoluteValue () const
 
virtual Real MaximumAbsoluteValue1 (int &i) const
 
virtual Real MaximumAbsoluteValue2 (int &i, int &j) const
 
virtual Real MinimumAbsoluteValue () const
 
virtual Real MinimumAbsoluteValue1 (int &i) const
 
virtual Real MinimumAbsoluteValue2 (int &i, int &j) const
 
virtual Real Maximum () const
 
virtual Real Maximum1 (int &i) const
 
virtual Real Maximum2 (int &i, int &j) const
 
virtual Real Minimum () const
 
virtual Real Minimum1 (int &i) const
 
virtual Real Minimum2 (int &i, int &j) const
 
virtual Real Trace () const
 
Real Norm1 () const
 
Real NormInfinity () const
 
virtual void CleanUp ()
 
void IEQND () const
 

Private Member Functions

 SubtractedMatrix (const BaseMatrix *bm1x, const BaseMatrix *bm2x)
 

Friends

class BaseMatrix
 
class GeneralMatrix
 
class GenericMatrix
 

Additional Inherited Members

- Protected Member Functions inherited from AddedMatrix
 AddedMatrix (const BaseMatrix *bm1x, const BaseMatrix *bm2x)
 
- Protected Member Functions inherited from MultipliedMatrix
 MultipliedMatrix (const BaseMatrix *bm1x, const BaseMatrix *bm2x)
 
int search (const BaseMatrix *) const
 
- Protected Attributes inherited from MultipliedMatrix
union {
   const BaseMatrix *   bm1
 
   GeneralMatrix *   gm1
 
}; 
 
union {
   const BaseMatrix *   bm2
 
   GeneralMatrix *   gm2
 
}; 
 

Detailed Description

Definition at line 1332 of file newmat.h.

Constructor & Destructor Documentation

◆ SubtractedMatrix()

SubtractedMatrix::SubtractedMatrix ( const BaseMatrix bm1x,
const BaseMatrix bm2x 
)
inlineprivate

Definition at line 1334 of file newmat.h.

1335  : AddedMatrix(bm1x,bm2x) {}
AddedMatrix(const BaseMatrix *bm1x, const BaseMatrix *bm2x)
Definition: newmat.h:1239

◆ ~SubtractedMatrix()

SubtractedMatrix::~SubtractedMatrix ( )
inline

Definition at line 1340 of file newmat.h.

1340 {}

Member Function Documentation

◆ Evaluate()

GeneralMatrix * SubtractedMatrix::Evaluate ( MatrixType  mt = MatrixTypeUnSp)
virtual

Reimplemented from AddedMatrix.

Definition at line 576 of file newmat7.cpp.

References MatrixType::DataLossOK, GeneralMatrix::Evaluate(), GeneralMatrix::Ncols(), GeneralMatrix::Nrows(), REPORT, GeneralMatrix::reuse(), GeneralMatrix::SimpleAddOK(), GeneralMatrix::tDelete(), and GeneralMatrix::Type().

Referenced by GenericMatrix::operator-=().

577 {
578  REPORT
579  Tracer tr("SubtractedMatrix::Evaluate");
580  gm1=((BaseMatrix*&)bm1)->Evaluate(); gm2=((BaseMatrix*&)bm2)->Evaluate();
581  int nr=gm1->Nrows(); int nc=gm1->Ncols();
582  if (nr!=gm2->Nrows() || nc!=gm2->Ncols())
583  {
584  Try { Throw(IncompatibleDimensionsException(*gm1, *gm2)); }
585  CatchAll
586  {
587  gm1->tDelete(); gm2->tDelete();
588  ReThrow;
589  }
590  }
591  MatrixType mt1 = gm1->Type(), mt2 = gm2->Type(); MatrixType mts = mt1 + mt2;
592  if (!mtd) { REPORT mtd = mts; }
593  else if (!(mtd.DataLossOK || mtd >= mts))
594  {
595  gm1->tDelete(); gm2->tDelete();
596  Throw(ProgramException("Illegal Conversion", mts, mtd));
597  }
598  GeneralMatrix* gmx;
599  bool c1 = (mtd == mt1), c2 = (mtd == mt2);
600  if ( c1 && c2 && (gm1->SimpleAddOK(gm2) == 0) )
601  {
602  if (gm1->reuse())
603  { REPORT SubtractFrom(gm1,gm2); gm2->tDelete(); gmx = gm1; }
604  else if (gm2->reuse()) { REPORT ReverseSubtract(gm2,gm1); gmx = gm2; }
605  else
606  {
607  REPORT
608  Try { gmx = mt1.New(nr,nc,this); }
609  CatchAll
610  {
611  ReThrow;
612  }
613  gmx->ReleaseAndDelete(); Subtract(gmx,gm1,gm2);
614  }
615  }
616  else
617  {
618  if (c1 && c2)
619  {
620  short SAO = gm1->SimpleAddOK(gm2);
621  if (SAO & 1) { REPORT c1 = false; }
622  if (SAO & 2) { REPORT c2 = false; }
623  }
624  if (c1 && gm1->reuse() ) // must have type test first
625  { REPORT SubtractDS(gm1,gm2); gm2->tDelete(); gmx = gm1; }
626  else if (c2 && gm2->reuse() )
627  {
628  REPORT ReverseSubtractDS(gm2,gm1);
629  if (!c1) gm1->tDelete(); gmx = gm2;
630  }
631  else
632  {
633  REPORT
634  // what if New throws and exception
635  Try { gmx = mtd.New(nr,nc,this); }
636  CatchAll
637  {
638  if (!c1) gm1->tDelete(); if (!c2) gm2->tDelete();
639  ReThrow;
640  }
641  SubtractDS(gmx,gm1,gm2);
642  if (!c1) gm1->tDelete(); if (!c2) gm2->tDelete();
643  gmx->ReleaseAndDelete();
644  }
645  }
646  return gmx;
647 }
void tDelete()
Definition: newmat4.cpp:535
const BaseMatrix * bm2
Definition: newmat.h:1222
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Definition: newmat5.cpp:79
GeneralMatrix * New() const
virtual short SimpleAddOK(const GeneralMatrix *)
Definition: newmat.h:419
#define REPORT
Definition: newmat7.cpp:18
void ReleaseAndDelete()
Definition: newmat.h:442
bool reuse()
Definition: newmat4.cpp:568
virtual MatrixType Type() const =0
const BaseMatrix * bm1
Definition: newmat.h:1220
int Nrows() const
Definition: newmat.h:430
GeneralMatrix * gm2
Definition: newmat.h:1222
GeneralMatrix * gm1
Definition: newmat.h:1220

Friends And Related Function Documentation

◆ BaseMatrix

friend class BaseMatrix
friend

Definition at line 1336 of file newmat.h.

◆ GeneralMatrix

friend class GeneralMatrix
friend

Definition at line 1337 of file newmat.h.

◆ GenericMatrix

friend class GenericMatrix
friend

Definition at line 1338 of file newmat.h.


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