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

#include <newmatrc.h>

Inheritance diagram for MatrixRowCol:
MatrixCol MatrixColX MatrixRow

Public Member Functions

void IncrMat ()
 
void IncrDiag ()
 
void IncrId ()
 
void IncrUT ()
 
void IncrLT ()
 
void Zero ()
 
void Add (const MatrixRowCol &)
 
void AddScaled (const MatrixRowCol &, Real)
 
void Add (const MatrixRowCol &, const MatrixRowCol &)
 
void Add (const MatrixRowCol &, Real)
 
void NegAdd (const MatrixRowCol &, Real)
 
void Sub (const MatrixRowCol &)
 
void Sub (const MatrixRowCol &, const MatrixRowCol &)
 
void RevSub (const MatrixRowCol &)
 
void ConCat (const MatrixRowCol &, const MatrixRowCol &)
 
void Multiply (const MatrixRowCol &)
 
void Multiply (const MatrixRowCol &, const MatrixRowCol &)
 
void KP (const MatrixRowCol &, const MatrixRowCol &)
 
void Copy (const MatrixRowCol &)
 
void CopyCheck (const MatrixRowCol &)
 
void Check (const MatrixRowCol &)
 
void Check ()
 
void Copy (const Real *&)
 
void Copy (const int *&)
 
void Copy (Real)
 
void Add (Real)
 
void Multiply (Real)
 
Real SumAbsoluteValue ()
 
Real MaximumAbsoluteValue1 (Real r, int &i)
 
Real MinimumAbsoluteValue1 (Real r, int &i)
 
Real Maximum1 (Real r, int &i)
 
Real Minimum1 (Real r, int &i)
 
Real Sum ()
 
void Inject (const MatrixRowCol &)
 
void Negate (const MatrixRowCol &)
 
void Multiply (const MatrixRowCol &, Real)
 
Real * Data ()
 
int Skip ()
 
int Storage ()
 
int Length ()
 
void Skip (int i)
 
void Storage (int i)
 
void Length (int i)
 
void SubRowCol (MatrixRowCol &, int, int) const
 
 MatrixRowCol ()
 
 ~MatrixRowCol ()
 

Public Attributes

int length
 
int skip
 
int storage
 
int rowcol
 
GeneralMatrixgm
 
Real * data
 
LoadAndStoreFlag cw
 

Friends

Real DotProd (const MatrixRowCol &, const MatrixRowCol &)
 

Detailed Description

Definition at line 33 of file newmatrc.h.

Constructor & Destructor Documentation

◆ MatrixRowCol()

MatrixRowCol::MatrixRowCol ( )
inline

Definition at line 99 of file newmatrc.h.

99 {} // to stop warning messages

◆ ~MatrixRowCol()

MatrixRowCol::~MatrixRowCol ( )

Definition at line 824 of file newmat3.cpp.

References HaveStore, and MONITOR_REAL_DELETE.

825 {
826  if (+(cw*HaveStore))
827  {
828  MONITOR_REAL_DELETE("Free (RowCol)",-1,data) // do not know length
829  delete [] data;
830  }
831 }
Real * data
Definition: newmatrc.h:43
#define MONITOR_REAL_DELETE(Operation, Size, Pointer)
Definition: myexcept.h:319
LoadAndStoreFlag cw
Definition: newmatrc.h:44

Member Function Documentation

◆ Add() [1/4]

void MatrixRowCol::Add ( const MatrixRowCol mrc)

Definition at line 30 of file newmat2.cpp.

References data, REPORT, skip, and storage.

Referenced by ShiftedMatrix::Evaluate(), and GetSubMatrix::operator+=().

31 {
32  // THIS += mrc
33  REPORT
34  int f = mrc.skip; int l = f + mrc.storage; int lx = skip + storage;
35  if (f < skip) f = skip; if (l > lx) l = lx; l -= f;
36  if (l<=0) return;
37  Real* elx=data+(f-skip); Real* el=mrc.data+(f-mrc.skip);
38  while (l--) *elx++ += *el++;
39 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Add() [2/4]

void MatrixRowCol::Add ( const MatrixRowCol mrc1,
const MatrixRowCol mrc2 
)

Definition at line 88 of file newmat2.cpp.

References data, REPORT, skip, and storage.

89 {
90  // THIS = mrc1 + mrc2
91  int f = skip; int l = skip + storage;
92  int f1 = mrc1.skip; int l1 = f1 + mrc1.storage;
93  if (f1<f) f1=f; if (l1>l) l1=l;
94  int f2 = mrc2.skip; int l2 = f2 + mrc2.storage;
95  if (f2<f) f2=f; if (l2>l) l2=l;
96  Real* el = data + (f-skip);
97  Real* el1 = mrc1.data+(f1-mrc1.skip); Real* el2 = mrc2.data+(f2-mrc2.skip);
98  if (f1<f2)
99  {
100  int i = f1-f; while (i--) *el++ = 0.0;
101  if (l1<=f2) // disjoint
102  {
103  REPORT // not accessed
104  i = l1-f1; while (i--) *el++ = *el1++;
105  i = f2-l1; while (i--) *el++ = 0.0;
106  i = l2-f2; while (i--) *el++ = *el2++;
107  i = l-l2; while (i--) *el++ = 0.0;
108  }
109  else
110  {
111  i = f2-f1; while (i--) *el++ = *el1++;
112  if (l1<=l2)
113  {
114  REPORT
115  i = l1-f2; while (i--) *el++ = *el1++ + *el2++;
116  i = l2-l1; while (i--) *el++ = *el2++;
117  i = l-l2; while (i--) *el++ = 0.0;
118  }
119  else
120  {
121  REPORT
122  i = l2-f2; while (i--) *el++ = *el1++ + *el2++;
123  i = l1-l2; while (i--) *el++ = *el1++;
124  i = l-l1; while (i--) *el++ = 0.0;
125  }
126  }
127  }
128  else
129  {
130  int i = f2-f; while (i--) *el++ = 0.0;
131  if (l2<=f1) // disjoint
132  {
133  REPORT // not accessed
134  i = l2-f2; while (i--) *el++ = *el2++;
135  i = f1-l2; while (i--) *el++ = 0.0;
136  i = l1-f1; while (i--) *el++ = *el1++;
137  i = l-l1; while (i--) *el++ = 0.0;
138  }
139  else
140  {
141  i = f1-f2; while (i--) *el++ = *el2++;
142  if (l2<=l1)
143  {
144  REPORT
145  i = l2-f1; while (i--) *el++ = *el1++ + *el2++;
146  i = l1-l2; while (i--) *el++ = *el1++;
147  i = l-l1; while (i--) *el++ = 0.0;
148  }
149  else
150  {
151  REPORT
152  i = l1-f1; while (i--) *el++ = *el1++ + *el2++;
153  i = l2-l1; while (i--) *el++ = *el2++;
154  i = l-l2; while (i--) *el++ = 0.0;
155  }
156  }
157  }
158 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Add() [3/4]

void MatrixRowCol::Add ( const MatrixRowCol mrc1,
Real  x 
)

Definition at line 233 of file newmat2.cpp.

References data, REPORT, skip, storage, and x.

234 {
235  // THIS = mrc1 + x
236  REPORT
237  if (!storage) return;
238  int f = mrc1.skip; int l = f + mrc1.storage; int lx = skip + storage;
239  if (f < skip) { f = skip; if (l < f) l = f; }
240  if (l > lx) { l = lx; if (f > lx) f = lx; }
241 
242  Real* elx = data; Real* ely = mrc1.data+(f-mrc1.skip);
243 
244  int l1 = f-skip; while (l1--) *elx++ = x;
245  l1 = l-f; while (l1--) *elx++ = *ely++ + x;
246  lx -= l; while (lx--) *elx++ = x;
247 }
ossim_uint32 x
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Add() [4/4]

void MatrixRowCol::Add ( Real  r)

Definition at line 564 of file newmat2.cpp.

References REPORT.

565 {
566  // THIS += r
567  REPORT
568  Real* elx = data; int l = storage; while (l--) *elx++ += r;
569 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ AddScaled()

void MatrixRowCol::AddScaled ( const MatrixRowCol mrc,
Real  x 
)

Definition at line 41 of file newmat2.cpp.

References data, REPORT, skip, storage, and x.

42 {
43  REPORT
44  // THIS += (mrc * x)
45  int f = mrc.skip; int l = f + mrc.storage; int lx = skip + storage;
46  if (f < skip) f = skip; if (l > lx) l = lx; l -= f;
47  if (l<=0) return;
48  Real* elx=data+(f-skip); Real* el=mrc.data+(f-mrc.skip);
49  while (l--) *elx++ += *el++ * x;
50 }
ossim_uint32 x
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Check() [1/2]

void MatrixRowCol::Check ( const MatrixRowCol mrc1)

Definition at line 446 of file newmat2.cpp.

References REPORT, skip, and storage.

Referenced by GetSubMatrix::operator+=(), and GetSubMatrix::operator-=().

448 {
449  REPORT
450  int f = mrc1.skip; int l = f + mrc1.storage; int lx = skip + storage;
451  if (f < skip || l > lx) Throw(ProgramException("Illegal Conversion"));
452 }
#define REPORT
Definition: newmat2.cpp:21
int storage
Definition: newmatrc.h:40

◆ Check() [2/2]

void MatrixRowCol::Check ( )

Definition at line 454 of file newmat2.cpp.

References REPORT.

458 {
459  REPORT
460  if (skip!=0 || storage!=length)
461  Throw(ProgramException("Illegal Conversion"));
462 }
#define REPORT
Definition: newmat2.cpp:21
int storage
Definition: newmatrc.h:40
int length
Definition: newmatrc.h:38

◆ ConCat()

void MatrixRowCol::ConCat ( const MatrixRowCol mrc1,
const MatrixRowCol mrc2 
)

Definition at line 281 of file newmat2.cpp.

References data, length, REPORT, skip, and storage.

Referenced by ConcatenatedMatrix::Evaluate().

282 {
283  // THIS = mrc1 | mrc2
284  REPORT
285  int f1 = mrc1.skip; int l1 = f1 + mrc1.storage; int lx = skip + storage;
286  if (f1 < skip) { f1 = skip; if (l1 < f1) l1 = f1; }
287  if (l1 > lx) { l1 = lx; if (f1 > lx) f1 = lx; }
288 
289  Real* elx = data;
290 
291  int i = f1-skip; while (i--) *elx++ =0.0;
292  i = l1-f1;
293  if (i) // in case f1 would take ely out of range
294  { Real* ely = mrc1.data+(f1-mrc1.skip); while (i--) *elx++ = *ely++; }
295 
296  int f2 = mrc2.skip; int l2 = f2 + mrc2.storage; i = mrc1.length;
297  int skipx = l1 - i; lx -= i; // addresses rel to second seg, maybe -ve
298  if (f2 < skipx) { f2 = skipx; if (l2 < f2) l2 = f2; }
299  if (l2 > lx) { l2 = lx; if (f2 > lx) f2 = lx; }
300 
301  i = f2-skipx; while (i--) *elx++ = 0.0;
302  i = l2-f2;
303  if (i) // in case f2 would take ely out of range
304  { Real* ely = mrc2.data+(f2-mrc2.skip); while (i--) *elx++ = *ely++; }
305  lx -= l2; while (lx--) *elx++ = 0.0;
306 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
int length
Definition: newmatrc.h:38

◆ Copy() [1/4]

void MatrixRowCol::Copy ( const MatrixRowCol mrc1)

Definition at line 413 of file newmat2.cpp.

References data, REPORT, skip, and storage.

Referenced by GeneralMatrix::Evaluate(), StackedMatrix::Evaluate(), GetSubMatrix::Evaluate(), GetSubMatrix::operator<<(), GetSubMatrix::operator=(), and GeneralMatrix::Transpose().

414 {
415  // THIS = mrc1
416  REPORT
417  if (!storage) return;
418  int f = mrc1.skip; int l = f + mrc1.storage; int lx = skip + storage;
419  if (f < skip) { f = skip; if (l < f) l = f; }
420  if (l > lx) { l = lx; if (f > lx) f = lx; }
421 
422  Real* elx = data; Real* ely = 0;
423 
424  if (l-f) ely = mrc1.data+(f-mrc1.skip);
425 
426  int l1 = f-skip; while (l1--) *elx++ = 0.0;
427  l1 = l-f; while (l1--) *elx++ = *ely++;
428  lx -= l; while (lx--) *elx++ = 0.0;
429 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Copy() [2/4]

void MatrixRowCol::Copy ( const Real *&  r)

Definition at line 530 of file newmat2.cpp.

References REPORT.

531 {
532  // THIS = *r
533  REPORT
534  Real* elx = data; const Real* ely = r+skip; r += length;
535  int l = storage; while (l--) *elx++ = *ely++;
536 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
int length
Definition: newmatrc.h:38

◆ Copy() [3/4]

void MatrixRowCol::Copy ( const int *&  r)

Definition at line 538 of file newmat2.cpp.

References REPORT.

539 {
540  // THIS = *r
541  REPORT
542  Real* elx = data; const int* ely = r+skip; r += length;
543  int l = storage; while (l--) *elx++ = *ely++;
544 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
int length
Definition: newmatrc.h:38

◆ Copy() [4/4]

void MatrixRowCol::Copy ( Real  r)

Definition at line 546 of file newmat2.cpp.

References REPORT.

547 {
548  // THIS = r
549  REPORT Real* elx = data; int l = storage; while (l--) *elx++ = r;
550 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ CopyCheck()

void MatrixRowCol::CopyCheck ( const MatrixRowCol mrc1)

Definition at line 431 of file newmat2.cpp.

References data, REPORT, skip, and storage.

Referenced by GetSubMatrix::operator=().

433 {
434  REPORT
435  if (!storage) return;
436  int f = mrc1.skip; int l = f + mrc1.storage; int lx = skip + storage;
437  if (f < skip || l > lx) Throw(ProgramException("Illegal Conversion"));
438 
439  Real* elx = data; Real* ely = mrc1.data+(f-mrc1.skip);
440 
441  int l1 = f-skip; while (l1--) *elx++ = 0.0;
442  l1 = l-f; while (l1--) *elx++ = *ely++;
443  lx -= l; while (lx--) *elx++ = 0.0;
444 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Data()

Real* MatrixRowCol::Data ( )
inline

Definition at line 90 of file newmatrc.h.

Referenced by GetSubMatrix::operator<<(), and GeneralMatrix::Transpose().

90 { return data; }
Real * data
Definition: newmatrc.h:43

◆ IncrDiag()

void MatrixRowCol::IncrDiag ( )
inline

Definition at line 46 of file newmatrc.h.

Referenced by DiagonalMatrix::NextCol(), IdentityMatrix::NextCol(), and DiagonalMatrix::NextRow().

46 { rowcol++; skip++; data++; }
Real * data
Definition: newmatrc.h:43
int rowcol
Definition: newmatrc.h:41

◆ IncrId()

void MatrixRowCol::IncrId ( )
inline

Definition at line 47 of file newmatrc.h.

Referenced by IdentityMatrix::NextCol(), and IdentityMatrix::NextRow().

47 { rowcol++; skip++; }
int rowcol
Definition: newmatrc.h:41

◆ IncrLT()

void MatrixRowCol::IncrLT ( )
inline

Definition at line 49 of file newmatrc.h.

Referenced by LowerTriangularMatrix::NextRow().

49 { rowcol++; data += storage; storage++; }
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
int rowcol
Definition: newmatrc.h:41

◆ IncrMat()

void MatrixRowCol::IncrMat ( )
inline

Definition at line 45 of file newmatrc.h.

Referenced by Matrix::NextRow().

45 { rowcol++; data += storage; } // used by NextRow
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
int rowcol
Definition: newmatrc.h:41

◆ IncrUT()

void MatrixRowCol::IncrUT ( )
inline

Definition at line 48 of file newmatrc.h.

Referenced by UpperTriangularMatrix::NextRow().

48 { rowcol++; data += storage; storage--; skip++; }
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
int rowcol
Definition: newmatrc.h:41

◆ Inject()

void MatrixRowCol::Inject ( const MatrixRowCol mrc)

Definition at line 63 of file newmat2.cpp.

References data, REPORT, skip, and storage.

Referenced by GeneralMatrix::Inject(), and GetSubMatrix::Inject().

65 {
66  REPORT
67  int f = mrc.skip; int l = f + mrc.storage; int lx = skip + storage;
68  if (f < skip) f = skip; if (l > lx) l = lx; l -= f;
69  if (l<=0) return;
70  Real* elx=data+(f-skip); Real* ely=mrc.data+(f-mrc.skip);
71  while (l--) *elx++ = *ely++;
72 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ KP()

void MatrixRowCol::KP ( const MatrixRowCol mrc1,
const MatrixRowCol mrc2 
)

Definition at line 346 of file newmat2.cpp.

References data, if(), length, skip, and storage.

348 {
349  int f = skip; int s = storage; Real* el = data; int i;
350 
351  i = mrc1.skip * mrc2.length;
352  if (i > f)
353  {
354  i -= f; f = 0; if (i > s) { i = s; s = 0; } else s -= i;
355  while (i--) *el++ = 0.0;
356  if (s == 0) return;
357  }
358  else f -= i;
359 
360  i = mrc1.storage; Real* el1 = mrc1.data;
361  int mrc2_skip = mrc2.skip; int mrc2_storage = mrc2.storage;
362  int mrc2_length = mrc2.length;
363  int mrc2_remain = mrc2_length - mrc2_skip - mrc2_storage;
364  while (i--)
365  {
366  int j; Real* el2 = mrc2.data; Real vel1 = *el1;
367  if (f == 0 && mrc2_length <= s)
368  {
369  j = mrc2_skip; s -= j; while (j--) *el++ = 0.0;
370  j = mrc2_storage; s -= j; while (j--) *el++ = vel1 * *el2++;
371  j = mrc2_remain; s -= j; while (j--) *el++ = 0.0;
372  }
373  else if (f >= mrc2_length) f -= mrc2_length;
374  else
375  {
376  j = mrc2_skip;
377  if (j > f)
378  {
379  j -= f; f = 0; if (j > s) { j = s; s = 0; } else s -= j;
380  while (j--) *el++ = 0.0;
381  }
382  else f -= j;
383 
384  j = mrc2_storage;
385  if (j > f)
386  {
387  j -= f; el2 += f; f = 0; if (j > s) { j = s; s = 0; } else s -= j;
388  while (j--) *el++ = vel1 * *el2++;
389  }
390  else f -= j;
391 
392  j = mrc2_remain;
393  if (j > f)
394  {
395  j -= f; f = 0; if (j > s) { j = s; s = 0; } else s -= j;
396  while (j--) *el++ = 0.0;
397  }
398  else f -= j;
399  }
400  if (s == 0) return;
401  ++el1;
402  }
403 
404  i = (mrc1.length - mrc1.skip - mrc1.storage) * mrc2.length;
405  if (i > f)
406  {
407  i -= f; if (i > s) i = s;
408  while (i--) *el++ = 0.0;
409  }
410 }
double Real
Definition: include.h:57
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
if(yy_init)
int length
Definition: newmatrc.h:38

◆ Length() [1/2]

int MatrixRowCol::Length ( )
inline

Definition at line 93 of file newmatrc.h.

93 { return length; } // length of row or column
int length
Definition: newmatrc.h:38

◆ Length() [2/2]

void MatrixRowCol::Length ( int  i)
inline

Definition at line 96 of file newmatrc.h.

96 { length=i; }
int length
Definition: newmatrc.h:38

◆ Maximum1()

Real MatrixRowCol::Maximum1 ( Real  r,
int &  i 
)

Definition at line 602 of file newmat2.cpp.

References REPORT.

603 {
604  REPORT
605  Real* elx = data; int l = storage; int li = -1;
606  while (l--) { Real f = *elx++; if (r <= f) { r = f; li = l; } }
607  i = (li >= 0) ? storage - li + skip : 0;
608  return r;
609 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ MaximumAbsoluteValue1()

Real MatrixRowCol::MaximumAbsoluteValue1 ( Real  r,
int &  i 
)

Definition at line 582 of file newmat2.cpp.

References REPORT.

583 {
584  REPORT
585  Real* elx = data; int l = storage; int li = -1;
586  while (l--) { Real f = std::fabs(*elx++); if (r <= f) { r = f; li = l; } }
587  i = (li >= 0) ? storage - li + skip : 0;
588  return r;
589 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Minimum1()

Real MatrixRowCol::Minimum1 ( Real  r,
int &  i 
)

Definition at line 612 of file newmat2.cpp.

References REPORT.

613 {
614  REPORT
615  Real* elx = data; int l = storage; int li = -1;
616  while (l--) { Real f = *elx++; if (r >= f) { r = f; li = l; } }
617  i = (li >= 0) ? storage - li + skip : 0;
618  return r;
619 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ MinimumAbsoluteValue1()

Real MatrixRowCol::MinimumAbsoluteValue1 ( Real  r,
int &  i 
)

Definition at line 592 of file newmat2.cpp.

References REPORT.

593 {
594  REPORT
595  Real* elx = data; int l = storage; int li = -1;
596  while (l--) { Real f = std::fabs(*elx++); if (r >= f) { r = f; li = l; } }
597  i = (li >= 0) ? storage - li + skip : 0;
598  return r;
599 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Multiply() [1/4]

void MatrixRowCol::Multiply ( const MatrixRowCol mrc1)

Definition at line 308 of file newmat2.cpp.

References data, REPORT, skip, and storage.

Referenced by ScaledMatrix::Evaluate(), and GetSubMatrix::operator*=().

310 {
311  REPORT
312  if (!storage) return;
313  int f = mrc1.skip; int l = f + mrc1.storage; int lx = skip + storage;
314  if (f < skip) { f = skip; if (l < f) l = f; }
315  if (l > lx) { l = lx; if (f > lx) f = lx; }
316 
317  Real* elx = data; Real* ely = mrc1.data+(f-mrc1.skip);
318 
319  int l1 = f-skip; while (l1--) *elx++ = 0;
320  l1 = l-f; while (l1--) *elx++ *= *ely++;
321  lx -= l; while (lx--) *elx++ = 0;
322 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Multiply() [2/4]

void MatrixRowCol::Multiply ( const MatrixRowCol mrc1,
const MatrixRowCol mrc2 
)

Definition at line 324 of file newmat2.cpp.

References data, REPORT, skip, and storage.

326 {
327  int f = skip; int l = skip + storage;
328  int f1 = mrc1.skip; int l1 = f1 + mrc1.storage;
329  if (f1<f) f1=f; if (l1>l) l1=l;
330  int f2 = mrc2.skip; int l2 = f2 + mrc2.storage;
331  if (f2<f) f2=f; if (l2>l) l2=l;
332  Real* el = data + (f-skip); int i;
333  if (f1<f2) f1 = f2; if (l1>l2) l1 = l2;
334  if (l1<=f1) { REPORT i = l-f; while (i--) *el++ = 0.0; } // disjoint
335  else
336  {
337  REPORT
338  Real* el1 = mrc1.data+(f1-mrc1.skip);
339  Real* el2 = mrc2.data+(f1-mrc2.skip);
340  i = f1-f ; while (i--) *el++ = 0.0;
341  i = l1-f1; while (i--) *el++ = *el1++ * *el2++;
342  i = l-l1; while (i--) *el++ = 0.0;
343  }
344 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Multiply() [3/4]

void MatrixRowCol::Multiply ( Real  r)

Definition at line 558 of file newmat2.cpp.

References REPORT.

559 {
560  // THIS *= r
561  REPORT Real* elx = data; int l = storage; while (l--) *elx++ *= r;
562 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Multiply() [4/4]

void MatrixRowCol::Multiply ( const MatrixRowCol mrc1,
Real  s 
)

Definition at line 480 of file newmat2.cpp.

References data, REPORT, skip, and storage.

481 {
482  // THIS = mrc1 * s
483  REPORT
484  if (!storage) return;
485  int f = mrc1.skip; int l = f + mrc1.storage; int lx = skip + storage;
486  if (f < skip) { f = skip; if (l < f) l = f; }
487  if (l > lx) { l = lx; if (f > lx) f = lx; }
488 
489  Real* elx = data; Real* ely = mrc1.data+(f-mrc1.skip);
490 
491  int l1 = f-skip; while (l1--) *elx++ = 0.0;
492  l1 = l-f; while (l1--) *elx++ = *ely++ * s;
493  lx -= l; while (lx--) *elx++ = 0.0;
494 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ NegAdd()

void MatrixRowCol::NegAdd ( const MatrixRowCol mrc1,
Real  x 
)

Definition at line 249 of file newmat2.cpp.

References data, REPORT, skip, storage, and x.

Referenced by NegShiftedMatrix::Evaluate().

250 {
251  // THIS = x - mrc1
252  REPORT
253  if (!storage) return;
254  int f = mrc1.skip; int l = f + mrc1.storage; int lx = skip + storage;
255  if (f < skip) { f = skip; if (l < f) l = f; }
256  if (l > lx) { l = lx; if (f > lx) f = lx; }
257 
258  Real* elx = data; Real* ely = mrc1.data+(f-mrc1.skip);
259 
260  int l1 = f-skip; while (l1--) *elx++ = x;
261  l1 = l-f; while (l1--) *elx++ = x - *ely++;
262  lx -= l; while (lx--) *elx++ = x;
263 }
ossim_uint32 x
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Negate()

void MatrixRowCol::Negate ( const MatrixRowCol mrc1)

Definition at line 464 of file newmat2.cpp.

References data, REPORT, skip, and storage.

Referenced by NegatedMatrix::Evaluate().

465 {
466  // THIS = -mrc1
467  REPORT
468  if (!storage) return;
469  int f = mrc1.skip; int l = f + mrc1.storage; int lx = skip + storage;
470  if (f < skip) { f = skip; if (l < f) l = f; }
471  if (l > lx) { l = lx; if (f > lx) f = lx; }
472 
473  Real* elx = data; Real* ely = mrc1.data+(f-mrc1.skip);
474 
475  int l1 = f-skip; while (l1--) *elx++ = 0.0;
476  l1 = l-f; while (l1--) *elx++ = - *ely++;
477  lx -= l; while (lx--) *elx++ = 0.0;
478 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ RevSub()

void MatrixRowCol::RevSub ( const MatrixRowCol mrc1)

Definition at line 265 of file newmat2.cpp.

References data, REPORT, skip, and storage.

266 {
267  // THIS = mrc - THIS
268  REPORT
269  if (!storage) return;
270  int f = mrc1.skip; int l = f + mrc1.storage; int lx = skip + storage;
271  if (f < skip) { f = skip; if (l < f) l = f; }
272  if (l > lx) { l = lx; if (f > lx) f = lx; }
273 
274  Real* elx = data; Real* ely = mrc1.data+(f-mrc1.skip);
275 
276  int l1 = f-skip; while (l1--) { *elx = - *elx; elx++; }
277  l1 = l-f; while (l1--) { *elx = *ely++ - *elx; elx++; }
278  lx -= l; while (lx--) { *elx = - *elx; elx++; }
279 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Skip() [1/2]

int MatrixRowCol::Skip ( )
inline

Definition at line 91 of file newmatrc.h.

91 { return skip; } // number of elements skipped

◆ Skip() [2/2]

void MatrixRowCol::Skip ( int  i)
inline

Definition at line 94 of file newmatrc.h.

94 { skip=i; }

◆ Storage() [1/2]

int MatrixRowCol::Storage ( )
inline

Definition at line 92 of file newmatrc.h.

Referenced by GetSubMatrix::operator<<().

92 { return storage; } // number of elements stored
int storage
Definition: newmatrc.h:40

◆ Storage() [2/2]

void MatrixRowCol::Storage ( int  i)
inline

Definition at line 95 of file newmatrc.h.

95 { storage=i; }
int storage
Definition: newmatrc.h:40

◆ Sub() [1/2]

void MatrixRowCol::Sub ( const MatrixRowCol mrc)

Definition at line 52 of file newmat2.cpp.

References data, REPORT, skip, and storage.

Referenced by GetSubMatrix::operator-=().

53 {
54  REPORT
55  // THIS -= mrc
56  int f = mrc.skip; int l = f + mrc.storage; int lx = skip + storage;
57  if (f < skip) f = skip; if (l > lx) l = lx; l -= f;
58  if (l<=0) return;
59  Real* elx=data+(f-skip); Real* el=mrc.data+(f-mrc.skip);
60  while (l--) *elx++ -= *el++;
61 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Sub() [2/2]

void MatrixRowCol::Sub ( const MatrixRowCol mrc1,
const MatrixRowCol mrc2 
)

Definition at line 160 of file newmat2.cpp.

References data, REPORT, skip, and storage.

161 {
162  // THIS = mrc1 - mrc2
163  int f = skip; int l = skip + storage;
164  int f1 = mrc1.skip; int l1 = f1 + mrc1.storage;
165  if (f1<f) f1=f; if (l1>l) l1=l;
166  int f2 = mrc2.skip; int l2 = f2 + mrc2.storage;
167  if (f2<f) f2=f; if (l2>l) l2=l;
168  Real* el = data + (f-skip);
169  Real* el1 = mrc1.data+(f1-mrc1.skip); Real* el2 = mrc2.data+(f2-mrc2.skip);
170  if (f1<f2)
171  {
172  int i = f1-f; while (i--) *el++ = 0.0;
173  if (l1<=f2) // disjoint
174  {
175  REPORT // not accessed
176  i = l1-f1; while (i--) *el++ = *el1++;
177  i = f2-l1; while (i--) *el++ = 0.0;
178  i = l2-f2; while (i--) *el++ = - *el2++;
179  i = l-l2; while (i--) *el++ = 0.0;
180  }
181  else
182  {
183  i = f2-f1; while (i--) *el++ = *el1++;
184  if (l1<=l2)
185  {
186  REPORT
187  i = l1-f2; while (i--) *el++ = *el1++ - *el2++;
188  i = l2-l1; while (i--) *el++ = - *el2++;
189  i = l-l2; while (i--) *el++ = 0.0;
190  }
191  else
192  {
193  REPORT
194  i = l2-f2; while (i--) *el++ = *el1++ - *el2++;
195  i = l1-l2; while (i--) *el++ = *el1++;
196  i = l-l1; while (i--) *el++ = 0.0;
197  }
198  }
199  }
200  else
201  {
202  int i = f2-f; while (i--) *el++ = 0.0;
203  if (l2<=f1) // disjoint
204  {
205  REPORT // not accessed
206  i = l2-f2; while (i--) *el++ = - *el2++;
207  i = f1-l2; while (i--) *el++ = 0.0;
208  i = l1-f1; while (i--) *el++ = *el1++;
209  i = l-l1; while (i--) *el++ = 0.0;
210  }
211  else
212  {
213  i = f1-f2; while (i--) *el++ = - *el2++;
214  if (l2<=l1)
215  {
216  REPORT
217  i = l2-f1; while (i--) *el++ = *el1++ - *el2++;
218  i = l1-l2; while (i--) *el++ = *el1++;
219  i = l-l1; while (i--) *el++ = 0.0;
220  }
221  else
222  {
223  REPORT
224  i = l1-f1; while (i--) *el++ = *el1++ - *el2++;
225  i = l2-l1; while (i--) *el++ = - *el2++;
226  i = l-l2; while (i--) *el++ = 0.0;
227  }
228  }
229  }
230 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ SubRowCol()

void MatrixRowCol::SubRowCol ( MatrixRowCol mrc,
int  skip1,
int  l1 
) const

Definition at line 629 of file newmat2.cpp.

References cw, data, length, skip, and storage.

Referenced by GetSubMatrix::Evaluate(), GetSubMatrix::Inject(), GetSubMatrix::operator*=(), GetSubMatrix::operator+=(), GetSubMatrix::operator-=(), GetSubMatrix::operator<<(), and GetSubMatrix::operator=().

630 {
631  mrc.length = l1; int d = skip - skip1;
632  if (d<0) { mrc.skip = 0; mrc.data = data - d; }
633  else { mrc.skip = d; mrc.data = data; }
634  d = skip + storage - skip1;
635  d = ((l1 < d) ? l1 : d) - mrc.skip; mrc.storage = (d < 0) ? 0 : d;
636  mrc.cw = 0;
637 }
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40
LoadAndStoreFlag cw
Definition: newmatrc.h:44
int length
Definition: newmatrc.h:38

◆ Sum()

Real MatrixRowCol::Sum ( )

Definition at line 621 of file newmat2.cpp.

References REPORT.

622 {
623  REPORT
624  Real sum = 0.0; Real* elx = data; int l = storage;
625  while (l--) sum += *elx++;
626  return sum;
627 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ SumAbsoluteValue()

Real MatrixRowCol::SumAbsoluteValue ( )

Definition at line 571 of file newmat2.cpp.

References REPORT.

Referenced by BaseMatrix::Norm1(), and BaseMatrix::NormInfinity().

572 {
573  REPORT
574  Real sum = 0.0; Real* elx = data; int l = storage;
575  while (l--) sum += std::fabs(*elx++);
576  return sum;
577 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

◆ Zero()

void MatrixRowCol::Zero ( )

Definition at line 552 of file newmat2.cpp.

References REPORT.

553 {
554  // THIS = 0
555  REPORT Real* elx = data; int l = storage; while (l--) *elx++ = 0;
556 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

Friends And Related Function Documentation

◆ DotProd

Real DotProd ( const MatrixRowCol mrc1,
const MatrixRowCol mrc2 
)
friend

Definition at line 74 of file newmat2.cpp.

75 {
76  REPORT // not accessed
77  int f = mrc1.skip; int f2 = mrc2.skip;
78  int l = f + mrc1.storage; int l2 = f2 + mrc2.storage;
79  if (f < f2) f = f2; if (l > l2) l = l2; l -= f;
80  if (l<=0) return 0.0;
81 
82  Real* el1=mrc1.data+(f-mrc1.skip); Real* el2=mrc2.data+(f-mrc2.skip);
83  Real sum = 0.0;
84  while (l--) sum += *el1++ * *el2++;
85  return sum;
86 }
double Real
Definition: include.h:57
#define REPORT
Definition: newmat2.cpp:21
Real * data
Definition: newmatrc.h:43
int storage
Definition: newmatrc.h:40

Member Data Documentation

◆ cw

LoadAndStoreFlag MatrixRowCol::cw

◆ data

Real* MatrixRowCol::data

◆ gm

GeneralMatrix* MatrixRowCol::gm

Definition at line 42 of file newmatrc.h.

◆ length

int MatrixRowCol::length

◆ rowcol

int MatrixRowCol::rowcol

◆ skip

int MatrixRowCol::skip

◆ storage

int MatrixRowCol::storage

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