OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
MatrixType Class Reference

#include <newmat.h>

Public Types

enum  Attribute {
  Valid = 1, Diagonal = 2, Symmetric = 4, Band = 8,
  Lower = 16, Upper = 32, Square = 64, Skew = 128,
  LUDeco = 256, Ones = 512
}
 
enum  {
  US = 0, UT = Valid + Upper + Square, LT = Valid + Lower + Square, Rt = Valid,
  Sq = Valid + Square, Sm = Valid + Symmetric + Square, Sk = Valid + Skew + Square, Dg,
  Id, RV = Valid, CV = Valid, BM = Valid + Band + Square,
  UB = Valid + Band + Upper + Square, LB = Valid + Band + Lower + Square, SB = Valid + Band + Symmetric + Square, Ct = Valid + LUDeco + Square,
  BC = Valid + Band + LUDeco + Square, Mask = ~Square
}
 

Public Member Functions

 MatrixType ()
 
 MatrixType (int i)
 
 MatrixType (int i, bool dlok)
 
 MatrixType (const MatrixType &mt)
 
void operator= (const MatrixType &mt)
 
void SetDataLossOK ()
 
int operator+ () const
 
MatrixType operator+ (MatrixType mt) const
 
MatrixType operator* (const MatrixType &) const
 
MatrixType SP (const MatrixType &) const
 
MatrixType KP (const MatrixType &) const
 
MatrixType operator| (const MatrixType &mt) const
 
MatrixType operator & (const MatrixType &mt) const
 
bool operator>= (MatrixType mt) const
 
bool operator< (MatrixType mt) const
 
bool operator== (MatrixType t) const
 
bool operator!= (MatrixType t) const
 
bool operator! () const
 
MatrixType i () const
 
MatrixType t () const
 
MatrixType AddEqualEl () const
 
MatrixType MultRHS () const
 
MatrixType sub () const
 
MatrixType ssub () const
 
GeneralMatrixNew () const
 
GeneralMatrixNew (int, int, BaseMatrix *) const
 
const char * Value () const
 
bool IsBand () const
 
bool IsDiagonal () const
 
bool IsSymmetric () const
 
bool CannotConvert () const
 

Static Public Member Functions

static int nTypes ()
 

Public Attributes

int attribute
 
bool DataLossOK
 

Friends

bool Rectangular (MatrixType a, MatrixType b, MatrixType c)
 
bool Compare (const MatrixType &, MatrixType &)
 

Detailed Description

Definition at line 91 of file newmat.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
US 
UT 
LT 
Rt 
Sq 
Sm 
Sk 
Dg 
Id 
RV 
CV 
BM 
UB 
LB 
SB 
Ct 
BC 
Mask 

Definition at line 105 of file newmat.h.

105  { US = 0,
106  UT = Valid + Upper + Square,
107  LT = Valid + Lower + Square,
108  Rt = Valid,
109  Sq = Valid + Square,
110  Sm = Valid + Symmetric + Square,
111  Sk = Valid + Skew + Square,
113  + Square,
115  + Square + Ones,
116  RV = Valid, // do not separate out
117  CV = Valid, // vectors
118  BM = Valid + Band + Square,
119  UB = Valid + Band + Upper + Square,
120  LB = Valid + Band + Lower + Square,
121  SB = Valid + Band + Symmetric + Square,
122  Ct = Valid + LUDeco + Square,
123  BC = Valid + Band + LUDeco + Square,
124  Mask = ~Square
125  };

◆ Attribute

Enumerator
Valid 
Diagonal 
Symmetric 
Band 
Lower 
Upper 
Square 
Skew 
LUDeco 
Ones 

Definition at line 94 of file newmat.h.

94  { Valid = 1,
95  Diagonal = 2, // order of these is important
96  Symmetric = 4,
97  Band = 8,
98  Lower = 16,
99  Upper = 32,
100  Square = 64,
101  Skew = 128,
102  LUDeco = 256,
103  Ones = 512 };

Constructor & Destructor Documentation

◆ MatrixType() [1/4]

MatrixType::MatrixType ( )
inline

Definition at line 135 of file newmat.h.

135 : DataLossOK(false) {}
bool DataLossOK
Definition: newmat.h:132

◆ MatrixType() [2/4]

MatrixType::MatrixType ( int  i)
inline

Definition at line 136 of file newmat.h.

136 : attribute(i), DataLossOK(false) {}
int attribute
Definition: newmat.h:131
bool DataLossOK
Definition: newmat.h:132
MatrixType i() const
Definition: newmat1.cpp:77

◆ MatrixType() [3/4]

MatrixType::MatrixType ( int  i,
bool  dlok 
)
inline

Definition at line 137 of file newmat.h.

137 : attribute(i), DataLossOK(dlok) {}
int attribute
Definition: newmat.h:131
bool DataLossOK
Definition: newmat.h:132
MatrixType i() const
Definition: newmat1.cpp:77

◆ MatrixType() [4/4]

MatrixType::MatrixType ( const MatrixType mt)
inline

Definition at line 138 of file newmat.h.

int attribute
Definition: newmat.h:131
bool DataLossOK
Definition: newmat.h:132

Member Function Documentation

◆ AddEqualEl()

MatrixType MatrixType::AddEqualEl ( ) const
inline

Definition at line 164 of file newmat.h.

◆ CannotConvert()

bool MatrixType::CannotConvert ( ) const
inline

Definition at line 181 of file newmat.h.

181 { return (attribute & LUDeco) != 0; }
int attribute
Definition: newmat.h:131

◆ i()

MatrixType MatrixType::i ( ) const

Definition at line 77 of file newmat1.cpp.

References REPORT.

78 {
79  REPORT
80  int a = attribute & ~(Band+LUDeco);
81  a |= (a & Diagonal) * 63; // recognise diagonal
82  return MatrixType(a);
83 }
#define REPORT
Definition: newmat1.cpp:17
int attribute
Definition: newmat.h:131
MatrixType()
Definition: newmat.h:135

◆ IsBand()

bool MatrixType::IsBand ( ) const
inline

Definition at line 178 of file newmat.h.

178 { return (attribute & Band) != 0; }
int attribute
Definition: newmat.h:131

◆ IsDiagonal()

bool MatrixType::IsDiagonal ( ) const
inline

Definition at line 179 of file newmat.h.

179 { return (attribute & Diagonal) != 0; }
int attribute
Definition: newmat.h:131

◆ IsSymmetric()

bool MatrixType::IsSymmetric ( ) const
inline

Definition at line 180 of file newmat.h.

Referenced by GetSubMatrix::operator=().

180 { return (attribute & Symmetric) != 0; }
int attribute
Definition: newmat.h:131

◆ KP()

MatrixType MatrixType::KP ( const MatrixType mt) const

Definition at line 62 of file newmat1.cpp.

References REPORT.

67 {
68  REPORT
69  int a = (attribute & mt.attribute) & ~Ones;
70  if ((attribute & Band) != 0 && (mt.attribute & Square) != 0)
71  a |= Band;
72  //int a = ((attribute & mt.attribute) | (attribute & Band)) & ~Ones;
73 
74  return MatrixType(a);
75 }
#define REPORT
Definition: newmat1.cpp:17
int attribute
Definition: newmat.h:131
MatrixType()
Definition: newmat.h:135

◆ MultRHS()

MatrixType MatrixType::MultRHS ( ) const

Definition at line 95 of file newmat1.cpp.

References REPORT.

96 {
97  REPORT
98  // remove symmetric attribute unless diagonal
99  return (attribute >= Dg) ? attribute : (attribute & ~Symmetric);
100 }
#define REPORT
Definition: newmat1.cpp:17
int attribute
Definition: newmat.h:131

◆ New() [1/2]

GeneralMatrix* MatrixType::New ( ) const

◆ New() [2/2]

GeneralMatrix * MatrixType::New ( int  nr,
int  nc,
BaseMatrix bm 
) const

Definition at line 140 of file newmat1.cpp.

References BaseMatrix::BandWidth(), MatrixBandWidth::lower, MatrixErrorNoSpace(), GeneralMatrix::Protect(), REPORT, and MatrixBandWidth::upper.

141 {
142 // make a new matrix with the given attributes
143 
144  Tracer tr("New"); GeneralMatrix* gm=0; // initialised to keep gnu happy
145  switch (attribute)
146  {
147  case Valid:
148  REPORT
149  if (nc==1) { gm = new ColumnVector(nr); break; }
150  if (nr==1) { gm = new RowVector(nc); break; }
151  gm = new Matrix(nr, nc); break;
152 
153  case Valid+Square:
154  REPORT
155  if (nc!=nr) { Throw(NotSquareException()); }
156  gm = new SquareMatrix(nr); break;
157 
158  case Valid+Symmetric+Square:
159  REPORT gm = new SymmetricMatrix(nr); break;
160 
161  case Valid+Band+Square:
162  {
163  REPORT
164  MatrixBandWidth bw = bm->BandWidth();
165  gm = new BandMatrix(nr,bw.lower,bw.upper); break;
166  }
167 
168  case Valid+Symmetric+Band+Square:
169  REPORT gm = new SymmetricBandMatrix(nr,bm->BandWidth().lower); break;
170 
171  case Valid+Upper+Square:
172  REPORT gm = new UpperTriangularMatrix(nr); break;
173 
175  REPORT gm = new DiagonalMatrix(nr); break;
176 
177  case Valid+Band+Upper+Square:
178  REPORT gm = new UpperBandMatrix(nr,bm->BandWidth().upper); break;
179 
180  case Valid+Lower+Square:
181  REPORT gm = new LowerTriangularMatrix(nr); break;
182 
183  case Valid+Band+Lower+Square:
184  REPORT gm = new LowerBandMatrix(nr,bm->BandWidth().lower); break;
185 
187  REPORT gm = new IdentityMatrix(nr); break;
188 
189  default:
190  Throw(ProgramException("Invalid matrix type"));
191  }
192 
193  MatrixErrorNoSpace(gm); gm->Protect(); return gm;
194 }
#define REPORT
Definition: newmat1.cpp:17
virtual MatrixBandWidth BandWidth() const
Definition: newmat4.cpp:431
int attribute
Definition: newmat.h:131
void MatrixErrorNoSpace(const void *)
Definition: newmatex.cpp:292
Definition: newmat.h:543

◆ nTypes()

static int MatrixType::nTypes ( )
inlinestatic

Definition at line 128 of file newmat.h.

128 { return 12; } // number of different types

◆ operator &()

MatrixType MatrixType::operator& ( const MatrixType mt) const
inline

Definition at line 151 of file newmat.h.

References attribute.

152  { return MatrixType(attribute & mt.attribute & Valid); }
int attribute
Definition: newmat.h:131
MatrixType()
Definition: newmat.h:135

◆ operator!()

bool MatrixType::operator! ( ) const
inline

Definition at line 161 of file newmat.h.

161 { return (attribute & Valid) == 0; }
int attribute
Definition: newmat.h:131

◆ operator!=()

bool MatrixType::operator!= ( MatrixType  t) const
inline

Definition at line 159 of file newmat.h.

References attribute.

160  { return (attribute != t.attribute); }
int attribute
Definition: newmat.h:131
MatrixType t() const
Definition: newmat1.cpp:85

◆ operator*()

MatrixType MatrixType::operator* ( const MatrixType mt) const

Definition at line 32 of file newmat1.cpp.

References attribute, and REPORT.

33 {
34  REPORT
35  int a = attribute & mt.attribute & ~(Symmetric | Skew);
36  a |= (a & Diagonal) * 63; // recognise diagonal
37  return MatrixType(a);
38 }
#define REPORT
Definition: newmat1.cpp:17
int attribute
Definition: newmat.h:131
MatrixType()
Definition: newmat.h:135

◆ operator+() [1/2]

int MatrixType::operator+ ( ) const
inline

Definition at line 143 of file newmat.h.

143 { return attribute; }
int attribute
Definition: newmat.h:131

◆ operator+() [2/2]

MatrixType MatrixType::operator+ ( MatrixType  mt) const
inline

Definition at line 144 of file newmat.h.

References attribute.

145  { return MatrixType(attribute & mt.attribute); }
int attribute
Definition: newmat.h:131
MatrixType()
Definition: newmat.h:135

◆ operator<()

bool MatrixType::operator< ( MatrixType  mt) const
inline

Definition at line 155 of file newmat.h.

156  { return ( attribute & ~mt.attribute & Mask ) != 0; }
int attribute
Definition: newmat.h:131

◆ operator=()

void MatrixType::operator= ( const MatrixType mt)
inline

Definition at line 140 of file newmat.h.

References attribute, and DataLossOK.

141  { attribute = mt.attribute; DataLossOK = mt.DataLossOK; }
int attribute
Definition: newmat.h:131
bool DataLossOK
Definition: newmat.h:132

◆ operator==()

bool MatrixType::operator== ( MatrixType  t) const
inline

Definition at line 157 of file newmat.h.

References attribute.

158  { return (attribute == t.attribute); }
int attribute
Definition: newmat.h:131
MatrixType t() const
Definition: newmat1.cpp:85

◆ operator>=()

bool MatrixType::operator>= ( MatrixType  mt) const
inline

Definition at line 153 of file newmat.h.

References attribute.

154  { return ( attribute & ~mt.attribute & Mask ) == 0; }
int attribute
Definition: newmat.h:131

◆ operator|()

MatrixType MatrixType::operator| ( const MatrixType mt) const
inline

Definition at line 149 of file newmat.h.

References attribute.

150  { return MatrixType(attribute & mt.attribute & Valid); }
int attribute
Definition: newmat.h:131
MatrixType()
Definition: newmat.h:135

◆ SetDataLossOK()

void MatrixType::SetDataLossOK ( )
inline

Definition at line 142 of file newmat.h.

Referenced by GeneralMatrix::Eq().

142 { DataLossOK = true; }
bool DataLossOK
Definition: newmat.h:132

◆ SP()

MatrixType MatrixType::SP ( const MatrixType mt) const

Definition at line 40 of file newmat1.cpp.

References REPORT.

Referenced by SPMatrix::Evaluate().

46 {
47  REPORT
48  int a = ((attribute | mt.attribute) & ~(Symmetric + Skew + Valid + Ones))
49  | (attribute & mt.attribute);
50  if ((a & Lower) != 0 && (a & Upper) != 0) a |= Diagonal;
51  if ((attribute & Skew) != 0)
52  {
53  if ((mt.attribute & Symmetric) != 0) a |= Skew;
54  if ((mt.attribute & Skew) != 0) { a &= ~Skew; a |= Symmetric; }
55  }
56  else if ((mt.attribute & Skew) != 0 && (attribute & Symmetric) != 0)
57  a |= Skew;
58  a |= (a & Diagonal) * 63; // recognise diagonal
59  return MatrixType(a);
60 }
#define REPORT
Definition: newmat1.cpp:17
int attribute
Definition: newmat.h:131
MatrixType()
Definition: newmat.h:135

◆ ssub()

MatrixType MatrixType::ssub ( ) const
inline

Definition at line 169 of file newmat.h.

170  { return MatrixType(attribute); } // not for selection matrix
int attribute
Definition: newmat.h:131
MatrixType()
Definition: newmat.h:135

◆ sub()

MatrixType MatrixType::sub ( ) const
inline

Definition at line 167 of file newmat.h.

168  { return MatrixType(attribute & Valid); }
int attribute
Definition: newmat.h:131
MatrixType()
Definition: newmat.h:135

◆ t()

MatrixType MatrixType::t ( ) const

Definition at line 85 of file newmat1.cpp.

References REPORT.

88 {
89  REPORT
90  int a = attribute;
91  a ^= (((a >> 1) ^ a) & Lower) * 3;
92  return MatrixType(a);
93 }
#define REPORT
Definition: newmat1.cpp:17
int attribute
Definition: newmat.h:131
MatrixType()
Definition: newmat.h:135

◆ Value()

const char * MatrixType::Value ( ) const

Definition at line 111 of file newmat1.cpp.

References REPORT.

Referenced by ProgramException::ProgramException().

112 {
113 // make a string with the name of matrix with the given attributes
114  switch (attribute)
115  {
116  case Valid: REPORT return "Rect ";
117  case Valid+Square: REPORT return "Squ ";
118  case Valid+Symmetric+Square: REPORT return "Sym ";
119  case Valid+Skew+Square: REPORT return "Skew ";
120  case Valid+Band+Square: REPORT return "Band ";
121  case Valid+Symmetric+Band+Square: REPORT return "SmBnd";
122  case Valid+Upper+Square: REPORT return "UT ";
124  REPORT return "Diag ";
126  REPORT return "Ident";
127  case Valid+Band+Upper+Square: REPORT return "UpBnd";
128  case Valid+Lower+Square: REPORT return "LT ";
129  case Valid+Band+Lower+Square: REPORT return "LwBnd";
130  default:
131  REPORT
132  if (!(attribute & Valid)) return "UnSp ";
133  if (attribute & LUDeco)
134  return (attribute & Band) ? "BndLU" : "Crout";
135  return "?????";
136  }
137 }
#define REPORT
Definition: newmat1.cpp:17
int attribute
Definition: newmat.h:131

Friends And Related Function Documentation

◆ Compare

bool Compare ( const MatrixType source,
MatrixType destination 
)
friend

Definition at line 729 of file newmat4.cpp.

730 {
731  if (!destination) { destination=source; return true; }
732  if (destination==source) return true;
733  if (!destination.DataLossOK && !(destination>=source))
734  Throw(ProgramException("Illegal Conversion", source, destination));
735  return false;
736 }
bool DataLossOK
Definition: newmat.h:132

◆ Rectangular

bool Rectangular ( MatrixType  a,
MatrixType  b,
MatrixType  c 
)
friend

Definition at line 103 of file newmat1.cpp.

104 {
105  REPORT
106  return
107  ((a.attribute | b.attribute | c.attribute)
109 }
#define REPORT
Definition: newmat1.cpp:17
int attribute
Definition: newmat.h:131

Member Data Documentation

◆ attribute

int MatrixType::attribute

◆ DataLossOK

bool MatrixType::DataLossOK

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