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

#include <newmat.h>

Inheritance diagram for GetSubMatrix:
NegatedMatrix BaseMatrix

Public Member Functions

 GetSubMatrix (const GetSubMatrix &g)
 
 ~GetSubMatrix ()
 
GeneralMatrixEvaluate (MatrixType mt=MatrixTypeUnSp)
 
void operator= (const BaseMatrix &)
 
void operator+= (const BaseMatrix &)
 
void operator-= (const BaseMatrix &)
 
void operator= (const GetSubMatrix &m)
 
void operator<< (const BaseMatrix &)
 
void operator<< (const Real *)
 
void operator<< (const int *)
 
MatrixInput operator<< (Real)
 
MatrixInput operator<< (int f)
 
void operator= (Real)
 
void operator+= (Real)
 
void operator-= (Real r)
 
void operator*= (Real)
 
void operator/= (Real r)
 
void Inject (const GeneralMatrix &)
 
MatrixBandWidth BandWidth () const
 
- Public Member Functions inherited from NegatedMatrix
 ~NegatedMatrix ()
 
- 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

 GetSubMatrix (const BaseMatrix *bmx, int rs, int rn, int cs, int cn, bool is)
 
void SetUpLHS ()
 

Private Attributes

int row_skip
 
int row_number
 
int col_skip
 
int col_number
 
bool IsSym
 

Friends

class BaseMatrix
 

Additional Inherited Members

- Protected Member Functions inherited from NegatedMatrix
 NegatedMatrix (const BaseMatrix *bmx)
 
int search (const BaseMatrix *) const
 
- Protected Attributes inherited from NegatedMatrix
union {
   const BaseMatrix *   bm
 
   GeneralMatrix *   gm
 
}; 
 

Detailed Description

Definition at line 1503 of file newmat.h.

Constructor & Destructor Documentation

◆ GetSubMatrix() [1/2]

GetSubMatrix::GetSubMatrix ( const BaseMatrix bmx,
int  rs,
int  rn,
int  cs,
int  cn,
bool  is 
)
inlineprivate

Definition at line 1512 of file newmat.h.

1513  : NegatedMatrix(bmx),
1514  row_skip(rs), row_number(rn), col_skip(cs), col_number(cn), IsSym(is) {}
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
int row_number
Definition: newmat.h:1506
NegatedMatrix(const BaseMatrix *bmx)
Definition: newmat.h:1394
int col_skip
Definition: newmat.h:1507
bool IsSym
Definition: newmat.h:1509

◆ GetSubMatrix() [2/2]

GetSubMatrix::GetSubMatrix ( const GetSubMatrix g)
inline

Definition at line 1520 of file newmat.h.

const BaseMatrix * bm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
int row_number
Definition: newmat.h:1506
NegatedMatrix(const BaseMatrix *bmx)
Definition: newmat.h:1394
int col_skip
Definition: newmat.h:1507
bool IsSym
Definition: newmat.h:1509

◆ ~GetSubMatrix()

GetSubMatrix::~GetSubMatrix ( )
inline

Definition at line 1524 of file newmat.h.

1524 {}

Member Function Documentation

◆ BandWidth()

MatrixBandWidth GetSubMatrix::BandWidth ( ) const
virtual

Reimplemented from NegatedMatrix.

Definition at line 517 of file newmat4.cpp.

References BaseMatrix::BandWidth(), col_number, col_skip, NegatedMatrix::gm, REPORT, row_number, and row_skip.

518 {
519 
521  { REPORT return gm->BandWidth(); }
522  else { REPORT return MatrixBandWidth(-1); }
523 }
virtual MatrixBandWidth BandWidth() const
Definition: newmat4.cpp:431
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
int row_number
Definition: newmat.h:1506
#define REPORT
Definition: newmat4.cpp:19
int col_skip
Definition: newmat.h:1507

◆ Evaluate()

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

Reimplemented from NegatedMatrix.

Definition at line 276 of file newmat5.cpp.

References Compare(), MatrixRowCol::Copy(), DirectPart, LoadOnEntry, MatrixType::New(), MatrixRow::Next(), REPORT, StoreOnExit, and MatrixRowCol::SubRowCol().

277 {
278  REPORT
279  Tracer tr("SubMatrix(evaluate)");
280  gm = ((BaseMatrix*&)bm)->Evaluate();
281  if (row_number < 0) row_number = gm->Nrows();
282  if (col_number < 0) col_number = gm->Ncols();
284  {
285  gm->tDelete();
287  }
288  if (IsSym) Compare(gm->Type().ssub(), mt);
289  else Compare(gm->Type().sub(), mt);
290  GeneralMatrix* gmx = mt.New(row_number, col_number, this);
291  int i = row_number;
293  MatrixRow mrx(gmx, StoreOnExit+DirectPart);
294  MatrixRowCol sub;
295  while (i--)
296  {
297  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
298  mrx.Copy(sub); mrx.Next(); mr.Next();
299  }
300  gmx->ReleaseAndDelete(); gm->tDelete();
301  return gmx;
302 }
const BaseMatrix * bm
Definition: newmat.h:1393
void tDelete()
Definition: newmat4.cpp:535
MatrixType ssub() const
Definition: newmat.h:169
InvertedMatrix i() const
Definition: newmat6.cpp:325
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Definition: newmat5.cpp:79
GeneralMatrix * New() const
bool Compare(const MatrixType &source, MatrixType &destination)
Definition: newmat4.cpp:729
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
MatrixType sub() const
Definition: newmat.h:167
int row_number
Definition: newmat.h:1506
#define REPORT
Definition: newmat5.cpp:20
void SubRowCol(MatrixRowCol &, int, int) const
Definition: newmat2.cpp:629
virtual MatrixType Type() const =0
int Nrows() const
Definition: newmat.h:430
int col_skip
Definition: newmat.h:1507
bool IsSym
Definition: newmat.h:1509

◆ Inject()

void GetSubMatrix::Inject ( const GeneralMatrix gmx)

Definition at line 210 of file submat.cpp.

References DirectPart, MatrixRowCol::Inject(), LoadOnEntry, GeneralMatrix::Ncols(), MatrixRow::Next(), GeneralMatrix::Nrows(), REPORT, StoreOnExit, and MatrixRowCol::SubRowCol().

211 {
212  REPORT
213  Tracer tr("SubMatrix(inject)");
214  SetUpLHS();
215  if (row_number != gmx.Nrows() || col_number != gmx.Ncols())
217  MatrixRow mrx((GeneralMatrix*)(&gmx), LoadOnEntry);
219  // do need LoadOnEntry
220  MatrixRowCol sub; int i = row_number;
221  while (i--)
222  {
223  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
224  sub.Inject(mrx); mr.Next(); mrx.Next();
225  }
226 }
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: submat.cpp:17
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
int Nrows() const
Definition: newmat.h:430
void Inject(const MatrixRowCol &)
Definition: newmat2.cpp:63
int col_skip
Definition: newmat.h:1507

◆ operator*=()

void GetSubMatrix::operator*= ( Real  r)

Definition at line 313 of file submat.cpp.

References DirectPart, LoadOnEntry, MatrixRowCol::Multiply(), MatrixRow::Next(), REPORT, StoreOnExit, and MatrixRowCol::SubRowCol().

314 {
315  REPORT
316  Tracer tr("SubMatrix(*= or /= Real)");
317  // MatrixConversionCheck mcc; // Check for loss of info
318  Try
319  {
320  SetUpLHS();
322  // do need LoadOnEntry
323  MatrixRowCol sub; int i = row_number;
324  while (i--)
325  {
326  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
327  sub.Multiply(r); mr.Next();
328  }
329  }
330 
331  CatchAll
332  {
333  ReThrow;
334  }
335 }
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: submat.cpp:17
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
void Multiply(const MatrixRowCol &)
Definition: newmat2.cpp:308
int col_skip
Definition: newmat.h:1507

◆ operator+=() [1/2]

void GetSubMatrix::operator+= ( const BaseMatrix bmx)

Definition at line 228 of file submat.cpp.

References MatrixRowCol::Add(), MatrixRowCol::Check(), DirectPart, GeneralMatrix::Evaluate(), LoadOnEntry, GeneralMatrix::Ncols(), MatrixRow::Next(), GeneralMatrix::Nrows(), REPORT, StoreOnExit, MatrixRowCol::SubRowCol(), and GeneralMatrix::tDelete().

229 {
230  REPORT
231  Tracer tr("SubMatrix(+=)"); GeneralMatrix* gmx = 0;
232  // MatrixConversionCheck mcc; // Check for loss of info
233  Try
234  {
235  SetUpLHS(); gmx = ((BaseMatrix&)bmx).Evaluate();
236  if (row_number != gmx->Nrows() || col_number != gmx->Ncols())
238  MatrixRow mrx(gmx, LoadOnEntry);
240  // do need LoadOnEntry
241  MatrixRowCol sub; int i = row_number;
242  while (i--)
243  {
244  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
245  sub.Check(mrx); // check for loss of info
246  sub.Add(mrx); mr.Next(); mrx.Next();
247  }
248  gmx->tDelete();
249  }
250 
251  CatchAll
252  {
253  if (gmx) gmx->tDelete();
254  ReThrow;
255  }
256 }
void Check(const MatrixRowCol &)
Definition: newmat2.cpp:446
void tDelete()
Definition: newmat4.cpp:535
InvertedMatrix i() const
Definition: newmat6.cpp:325
void Add(const MatrixRowCol &)
Definition: newmat2.cpp:30
#define REPORT
Definition: submat.cpp:17
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Definition: newmat5.cpp:79
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
int Nrows() const
Definition: newmat.h:430
int col_skip
Definition: newmat.h:1507

◆ operator+=() [2/2]

void GetSubMatrix::operator+= ( Real  r)

Definition at line 288 of file submat.cpp.

References MatrixRowCol::Add(), MatrixRowCol::Check(), DirectPart, LoadOnEntry, MatrixRow::Next(), REPORT, StoreOnExit, and MatrixRowCol::SubRowCol().

289 {
290  REPORT
291  Tracer tr("SubMatrix(+= or -= Real)");
292  // MatrixConversionCheck mcc; // Check for loss of info
293  Try
294  {
295  SetUpLHS();
297  // do need LoadOnEntry
298  MatrixRowCol sub; int i = row_number;
299  while (i--)
300  {
301  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
302  sub.Check(); // check for loss of info
303  sub.Add(r); mr.Next();
304  }
305  }
306 
307  CatchAll
308  {
309  ReThrow;
310  }
311 }
void Check(const MatrixRowCol &)
Definition: newmat2.cpp:446
InvertedMatrix i() const
Definition: newmat6.cpp:325
void Add(const MatrixRowCol &)
Definition: newmat2.cpp:30
#define REPORT
Definition: submat.cpp:17
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
int col_skip
Definition: newmat.h:1507

◆ operator-=() [1/2]

void GetSubMatrix::operator-= ( const BaseMatrix bmx)

Definition at line 258 of file submat.cpp.

References MatrixRowCol::Check(), DirectPart, GeneralMatrix::Evaluate(), LoadOnEntry, GeneralMatrix::Ncols(), MatrixRow::Next(), GeneralMatrix::Nrows(), REPORT, StoreOnExit, MatrixRowCol::Sub(), MatrixRowCol::SubRowCol(), and GeneralMatrix::tDelete().

259 {
260  REPORT
261  Tracer tr("SubMatrix(-=)"); GeneralMatrix* gmx = 0;
262  // MatrixConversionCheck mcc; // Check for loss of info
263  Try
264  {
265  SetUpLHS(); gmx = ((BaseMatrix&)bmx).Evaluate();
266  if (row_number != gmx->Nrows() || col_number != gmx->Ncols())
268  MatrixRow mrx(gmx, LoadOnEntry);
270  // do need LoadOnEntry
271  MatrixRowCol sub; int i = row_number;
272  while (i--)
273  {
274  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
275  sub.Check(mrx); // check for loss of info
276  sub.Sub(mrx); mr.Next(); mrx.Next();
277  }
278  gmx->tDelete();
279  }
280 
281  CatchAll
282  {
283  if (gmx) gmx->tDelete();
284  ReThrow;
285  }
286 }
void Check(const MatrixRowCol &)
Definition: newmat2.cpp:446
void tDelete()
Definition: newmat4.cpp:535
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: submat.cpp:17
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Definition: newmat5.cpp:79
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
void Sub(const MatrixRowCol &)
Definition: newmat2.cpp:52
int Nrows() const
Definition: newmat.h:430
int col_skip
Definition: newmat.h:1507

◆ operator-=() [2/2]

void GetSubMatrix::operator-= ( Real  r)
inline

Definition at line 1537 of file newmat.h.

1537 { operator+=(-r); } // subtract constant
void operator+=(const BaseMatrix &)
Definition: submat.cpp:228

◆ operator/=()

void GetSubMatrix::operator/= ( Real  r)
inline

Definition at line 1539 of file newmat.h.

1539 { operator*=(1.0/r); } // divide by constant
void operator*=(Real)
Definition: submat.cpp:313

◆ operator<<() [1/5]

void GetSubMatrix::operator<< ( const BaseMatrix bmx)

Definition at line 98 of file submat.cpp.

References MatrixRowCol::Copy(), DirectPart, GeneralMatrix::Evaluate(), LoadOnEntry, GeneralMatrix::Ncols(), MatrixRow::Next(), GeneralMatrix::Nrows(), REPORT, StoreOnExit, MatrixRowCol::SubRowCol(), and GeneralMatrix::tDelete().

99 {
100  REPORT
101  Tracer tr("SubMatrix(<<)"); GeneralMatrix* gmx = 0;
102  Try
103  {
104  SetUpLHS(); gmx = ((BaseMatrix&)bmx).Evaluate();
105  if (row_number != gmx->Nrows() || col_number != gmx->Ncols())
107  MatrixRow mrx(gmx, LoadOnEntry);
109  // do need LoadOnEntry
110  MatrixRowCol sub; int i = row_number;
111  while (i--)
112  {
113  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
114  sub.Copy(mrx); mr.Next(); mrx.Next();
115  }
116  gmx->tDelete();
117  }
118 
119  CatchAll
120  {
121  if (gmx) gmx->tDelete();
122  ReThrow;
123  }
124 }
void Copy(const MatrixRowCol &)
Definition: newmat2.cpp:413
void tDelete()
Definition: newmat4.cpp:535
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: submat.cpp:17
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Definition: newmat5.cpp:79
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
int Nrows() const
Definition: newmat.h:430
int col_skip
Definition: newmat.h:1507

◆ operator<<() [2/5]

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

Definition at line 161 of file submat.cpp.

References MatrixRowCol::Copy(), DirectPart, LoadOnEntry, MatrixRow::Next(), REPORT, StoreOnExit, and MatrixRowCol::SubRowCol().

162 {
163  REPORT
164  Tracer tr("SubMatrix(<<Real*)");
165  SetUpLHS();
169  // do need LoadOnEntry
170  MatrixRowCol sub; int i = row_number;
171  while (i--)
172  {
173  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
174  sub.Copy(r); mr.Next();
175  }
176 }
void Copy(const MatrixRowCol &)
Definition: newmat2.cpp:413
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: submat.cpp:17
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
int Nrows() const
Definition: newmat.h:430
int col_skip
Definition: newmat.h:1507

◆ operator<<() [3/5]

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

Definition at line 178 of file submat.cpp.

References MatrixRowCol::Copy(), DirectPart, LoadOnEntry, MatrixRow::Next(), REPORT, StoreOnExit, and MatrixRowCol::SubRowCol().

179 {
180  REPORT
181  Tracer tr("SubMatrix(<<int*)");
182  SetUpLHS();
186  // do need LoadOnEntry
187  MatrixRowCol sub; int i = row_number;
188  while (i--)
189  {
190  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
191  sub.Copy(r); mr.Next();
192  }
193 }
void Copy(const MatrixRowCol &)
Definition: newmat2.cpp:413
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: submat.cpp:17
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
int Nrows() const
Definition: newmat.h:430
int col_skip
Definition: newmat.h:1507

◆ operator<<() [4/5]

MatrixInput GetSubMatrix::operator<< ( Real  f)

Definition at line 411 of file newmat5.cpp.

References MatrixRowCol::cw, MatrixRowCol::Data(), DirectPart, HaveStore, n, REPORT, and MatrixRowCol::Storage().

412 {
413  REPORT
414  Tracer et("MatrixInput (GetSubMatrix)");
415  SetUpLHS();
416  if (row_number != 1 || col_skip != 0 || col_number != gm->Ncols())
417  {
418  Throw(ProgramException("MatrixInput requires complete rows"));
419  }
420  MatrixRow mr(gm, DirectPart, row_skip); // to pick up location and length
421  int n = mr.Storage();
422  if (n<=0)
423  {
424  Throw(ProgramException("Loading data to zero length row"));
425  }
426  Real* r; r = mr.Data(); *r = f; n--;
427  if (+(mr.cw*HaveStore))
428  {
429  Throw(ProgramException("Fails with this matrix type"));
430  }
431  return MatrixInput(n, r+1);
432 }
double Real
Definition: include.h:57
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
#define REPORT
Definition: newmat5.cpp:20
os2<< "> n<< " > nendobj n
int col_skip
Definition: newmat.h:1507

◆ operator<<() [5/5]

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

Definition at line 1779 of file newmat.h.

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

◆ operator=() [1/3]

void GetSubMatrix::operator= ( const BaseMatrix bmx)

Definition at line 126 of file submat.cpp.

References MatrixRowCol::CopyCheck(), DirectPart, GeneralMatrix::Evaluate(), MatrixType::IsSymmetric(), LoadOnEntry, GeneralMatrix::Ncols(), MatrixRow::Next(), GeneralMatrix::Nrows(), REPORT, StoreOnExit, MatrixRowCol::SubRowCol(), GeneralMatrix::tDelete(), and GeneralMatrix::Type().

127 {
128  REPORT
129  Tracer tr("SubMatrix(=)"); GeneralMatrix* gmx = 0;
130  // MatrixConversionCheck mcc; // Check for loss of info
131  Try
132  {
133  SetUpLHS(); gmx = ((BaseMatrix&)bmx).Evaluate();
134  if (row_number != gmx->Nrows() || col_number != gmx->Ncols())
136  LoadAndStoreFlag lasf =
137  ( row_skip == col_skip
138  && gm->Type().IsSymmetric()
139  && gmx->Type().IsSymmetric() )
141  : LoadOnEntry;
142  MatrixRow mrx(gmx, lasf);
144  // do need LoadOnEntry
145  MatrixRowCol sub; int i = row_number;
146  while (i--)
147  {
148  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
149  sub.CopyCheck(mrx); mr.Next(); mrx.Next();
150  }
151  gmx->tDelete();
152  }
153 
154  CatchAll
155  {
156  if (gmx) gmx->tDelete();
157  ReThrow;
158  }
159 }
void tDelete()
Definition: newmat4.cpp:535
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: submat.cpp:17
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Definition: newmat5.cpp:79
void CopyCheck(const MatrixRowCol &)
Definition: newmat2.cpp:431
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
bool IsSymmetric() const
Definition: newmat.h:180
virtual MatrixType Type() const =0
int Nrows() const
Definition: newmat.h:430
int col_skip
Definition: newmat.h:1507

◆ operator=() [2/3]

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

Definition at line 1529 of file newmat.h.

References operator=().

Referenced by operator=().

1529 { operator=((const BaseMatrix&)m); }
void operator=(const BaseMatrix &)
Definition: submat.cpp:126

◆ operator=() [3/3]

void GetSubMatrix::operator= ( Real  r)

Definition at line 195 of file submat.cpp.

References MatrixRowCol::Copy(), DirectPart, LoadOnEntry, MatrixRow::Next(), REPORT, StoreOnExit, and MatrixRowCol::SubRowCol().

196 {
197  REPORT
198  Tracer tr("SubMatrix(=Real)");
199  SetUpLHS();
201  // do need LoadOnEntry
202  MatrixRowCol sub; int i = row_number;
203  while (i--)
204  {
205  mr.SubRowCol(sub, col_skip, col_number); // put values in sub
206  sub.Copy(r); mr.Next();
207  }
208 }
void Copy(const MatrixRowCol &)
Definition: newmat2.cpp:413
InvertedMatrix i() const
Definition: newmat6.cpp:325
#define REPORT
Definition: submat.cpp:17
GeneralMatrix * gm
Definition: newmat.h:1393
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
void SetUpLHS()
Definition: submat.cpp:83
int row_number
Definition: newmat.h:1506
int col_skip
Definition: newmat.h:1507

◆ SetUpLHS()

void GetSubMatrix::SetUpLHS ( )
private

Definition at line 83 of file submat.cpp.

References GeneralMatrix::Evaluate(), GeneralMatrix::Ncols(), GeneralMatrix::Nrows(), and REPORT.

84 {
85  REPORT
86  Tracer tr("SubMatrix(LHS)");
87  const BaseMatrix* bm1 = bm;
88  GeneralMatrix* gm1 = ((BaseMatrix*&)bm)->Evaluate();
89  if ((BaseMatrix*)gm1!=bm1)
90  Throw(ProgramException("Invalid LHS"));
91  if (row_number < 0) row_number = gm1->Nrows();
92  if (col_number < 0) col_number = gm1->Ncols();
93  if (row_skip+row_number > gm1->Nrows()
94  || col_skip+col_number > gm1->Ncols())
96 }
const BaseMatrix * bm
Definition: newmat.h:1393
#define REPORT
Definition: submat.cpp:17
int Ncols() const
Definition: newmat.h:431
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Definition: newmat5.cpp:79
int col_number
Definition: newmat.h:1508
int row_skip
Definition: newmat.h:1505
int row_number
Definition: newmat.h:1506
int Nrows() const
Definition: newmat.h:430
int col_skip
Definition: newmat.h:1507

Friends And Related Function Documentation

◆ BaseMatrix

friend class BaseMatrix
friend

Definition at line 1516 of file newmat.h.

Member Data Documentation

◆ col_number

int GetSubMatrix::col_number
private

Definition at line 1508 of file newmat.h.

Referenced by BandWidth().

◆ col_skip

int GetSubMatrix::col_skip
private

Definition at line 1507 of file newmat.h.

Referenced by BandWidth().

◆ IsSym

bool GetSubMatrix::IsSym
private

Definition at line 1509 of file newmat.h.

◆ row_number

int GetSubMatrix::row_number
private

Definition at line 1506 of file newmat.h.

Referenced by BandWidth().

◆ row_skip

int GetSubMatrix::row_skip
private

Definition at line 1505 of file newmat.h.

Referenced by BandWidth().


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