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

#include <newmatrm.h>

Inheritance diagram for RectMatrixRowCol:
RectMatrixCol RectMatrixDiag RectMatrixRow

Public Member Functions

Real operator* (const RectMatrixRowCol &) const
 
void AddScaled (const RectMatrixRowCol &, Real)
 
void Divide (const RectMatrixRowCol &, Real)
 
void Divide (Real)
 
void Negate ()
 
void Zero ()
 
Real & operator[] (int i)
 
Real SumSquare () const
 
Real & First ()
 
void DownDiag ()
 
void UpDiag ()
 

Protected Member Functions

 RectMatrixRowCol (Real *st, int nx, int sp, int sh)
 
void Reset (Real *st, int nx, int sp, int sh)
 

Protected Attributes

Real * store
 
int n
 
int spacing
 
int shift
 

Friends

void ComplexScale (RectMatrixCol &, RectMatrixCol &, Real, Real)
 
void Rotate (RectMatrixCol &, RectMatrixCol &, Real, Real)
 

Detailed Description

Definition at line 16 of file newmatrm.h.

Constructor & Destructor Documentation

◆ RectMatrixRowCol()

RectMatrixRowCol::RectMatrixRowCol ( Real *  st,
int  nx,
int  sp,
int  sh 
)
inlineprotected

Definition at line 27 of file newmatrm.h.

28  : store(st), n(nx), spacing(sp), shift(sh) {}
Real * store
Definition: newmatrm.h:23

Member Function Documentation

◆ AddScaled()

void RectMatrixRowCol::AddScaled ( const RectMatrixRowCol rmrc,
Real  r 
)

Definition at line 79 of file newmatrm.cpp.

References n, n, REPORT, spacing, and store.

Referenced by SVD().

80 {
81  REPORT
82  int i = n; Real* s = store; int d = spacing;
83  Real* s1 = rmrc.store; int d1 = rmrc.spacing;
84  if (i!=rmrc.n)
85  {
86  Tracer tr("newmatrm");
87  Throw(InternalException("Dimensions differ in AddScaled"));
88  }
89  // while (i--) { *s += *s1 * r; s += d; s1 += d1; }
90  if (i) for (;;)
91  { *s += *s1 * r; if (!(--i)) break; s += d; s1 += d1; }
92 }
double Real
Definition: include.h:57
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18

◆ Divide() [1/2]

void RectMatrixRowCol::Divide ( const RectMatrixRowCol rmrc,
Real  r 
)

Definition at line 94 of file newmatrm.cpp.

References n, n, REPORT, spacing, and store.

Referenced by SVD().

95 {
96  REPORT
97  int i = n; Real* s = store; int d = spacing;
98  Real* s1 = rmrc.store; int d1 = rmrc.spacing;
99  if (i!=rmrc.n)
100  {
101  Tracer tr("newmatrm");
102  Throw(InternalException("Dimensions differ in Divide"));
103  }
104  // while (i--) { *s = *s1 / r; s += d; s1 += d1; }
105  if (i) for (;;) { *s = *s1 / r; if (!(--i)) break; s += d; s1 += d1; }
106 }
double Real
Definition: include.h:57
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18

◆ Divide() [2/2]

void RectMatrixRowCol::Divide ( Real  r)

Definition at line 108 of file newmatrm.cpp.

References n, and REPORT.

109 {
110  REPORT
111  int i = n; Real* s = store; int d = spacing;
112  // while (i--) { *s /= r; s += d; }
113  if (i) for (;;) { *s /= r; if (!(--i)) break; s += d; }
114 }
double Real
Definition: include.h:57
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18

◆ DownDiag()

void RectMatrixRowCol::DownDiag ( )
inline

Definition at line 41 of file newmatrm.h.

References n.

Referenced by SVD().

41 { store += (shift+spacing); n--; }
Real * store
Definition: newmatrm.h:23

◆ First()

Real& RectMatrixRowCol::First ( )
inline

Definition at line 40 of file newmatrm.h.

Referenced by SVD().

40 { return *store; } // get first element
Real * store
Definition: newmatrm.h:23

◆ Negate()

void RectMatrixRowCol::Negate ( )

Definition at line 116 of file newmatrm.cpp.

References n, and REPORT.

Referenced by SVD().

117 {
118  REPORT
119  int i = n; Real* s = store; int d = spacing;
120  // while (i--) { *s = - *s; s += d; }
121  if (i) for (;;) { *s = - *s; if (!(--i)) break; s += d; }
122 }
double Real
Definition: include.h:57
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18

◆ operator*()

Real RectMatrixRowCol::operator* ( const RectMatrixRowCol rmrc) const

Definition at line 62 of file newmatrm.cpp.

References n, n, REPORT, spacing, and store.

63 {
64  REPORT
65  long_Real sum = 0.0; int i = n;
66  Real* s = store; int d = spacing;
67  Real* s1 = rmrc.store; int d1 = rmrc.spacing;
68  if (i!=rmrc.n)
69  {
70  Tracer tr("newmatrm");
71  Throw(InternalException("Dimensions differ in *"));
72  }
73  // while (i--) { sum += (long_Real)*s * *s1; s += d; s1 += d1; }
74  if (i) for(;;)
75  { sum += (long_Real)*s * *s1; if (!(--i)) break; s += d; s1 += d1; }
76  return (Real)sum;
77 }
double long_Real
Definition: include.h:59
double Real
Definition: include.h:57
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18

◆ operator[]()

Real& RectMatrixRowCol::operator[] ( int  i)
inline

Definition at line 38 of file newmatrm.h.

38 { return *(store+i*spacing); } // element
Real * store
Definition: newmatrm.h:23

◆ Reset()

void RectMatrixRowCol::Reset ( Real *  st,
int  nx,
int  sp,
int  sh 
)
inlineprotected

Definition at line 29 of file newmatrm.h.

References n.

Referenced by RectMatrixRow::Reset(), and RectMatrixCol::Reset().

30  { store=st; n=nx; spacing=sp; shift=sh; }
Real * store
Definition: newmatrm.h:23

◆ SumSquare()

Real RectMatrixRowCol::SumSquare ( ) const

Definition at line 52 of file newmatrm.cpp.

References n, and REPORT.

Referenced by SVD().

53 {
54  REPORT
55  long_Real sum = 0.0; int i = n; Real* s = store; int d = spacing;
56  // while (i--) { sum += (long_Real)*s * *s; s += d; }
57  if (i) for(;;)
58  { sum += (long_Real)*s * *s; if (!(--i)) break; s += d; }
59  return (Real)sum;
60 }
double long_Real
Definition: include.h:59
double Real
Definition: include.h:57
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18

◆ UpDiag()

void RectMatrixRowCol::UpDiag ( )
inline

Definition at line 42 of file newmatrm.h.

References n.

Referenced by SVD().

42 { store -= (shift+spacing); n++; }
Real * store
Definition: newmatrm.h:23

◆ Zero()

void RectMatrixRowCol::Zero ( )

Definition at line 124 of file newmatrm.cpp.

References n, and REPORT.

Referenced by SVD().

125 {
126  REPORT
127  int i = n; Real* s = store; int d = spacing;
128  // while (i--) { *s = 0.0; s += d; }
129  if (i) for (;;) { *s = 0.0; if (!(--i)) break; s += d; }
130 }
double Real
Definition: include.h:57
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18

Friends And Related Function Documentation

◆ ComplexScale

void ComplexScale ( RectMatrixCol U,
RectMatrixCol V,
Real  x,
Real  y 
)
friend

Definition at line 132 of file newmatrm.cpp.

133 {
134  REPORT
135  int n = U.n;
136  if (n != V.n)
137  {
138  Tracer tr("newmatrm");
139  Throw(InternalException("Dimensions differ in ComplexScale"));
140  }
141  Real* u = U.store; Real* v = V.store;
142  int su = U.spacing; int sv = V.spacing;
143  //while (n--)
144  //{
145  // Real z = *u * x - *v * y; *v = *u * y + *v * x; *u = z;
146  // u += su; v += sv;
147  //}
148  if (n) for (;;)
149  {
150  Real z = *u * x - *v * y; *v = *u * y + *v * x; *u = z;
151  if (!(--n)) break;
152  u += su; v += sv;
153  }
154 }
ossim_uint32 x
double Real
Definition: include.h:57
ossim_uint32 y
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18

◆ Rotate

void Rotate ( RectMatrixCol U,
RectMatrixCol V,
Real  tau,
Real  s 
)
friend

Definition at line 156 of file newmatrm.cpp.

157 {
158  REPORT
159  // (U, V) = (U, V) * (c, s) where tau = s/(1+c), c^2 + s^2 = 1
160  int n = U.n;
161  if (n != V.n)
162  {
163  Tracer tr("newmatrm");
164  Throw(InternalException("Dimensions differ in Rotate"));
165  }
166  Real* u = U.store; Real* v = V.store;
167  int su = U.spacing; int sv = V.spacing;
168  //while (n--)
169  //{
170  // Real zu = *u; Real zv = *v;
171  // *u -= s * (zv + zu * tau); *v += s * (zu - zv * tau);
172  // u += su; v += sv;
173  //}
174  if (n) for(;;)
175  {
176  Real zu = *u; Real zv = *v;
177  *u -= s * (zv + zu * tau); *v += s * (zu - zv * tau);
178  if (!(--n)) break;
179  u += su; v += sv;
180  }
181 }
double Real
Definition: include.h:57
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18

Member Data Documentation

◆ n

int RectMatrixRowCol::n
protected

Definition at line 24 of file newmatrm.h.

Referenced by AddScaled(), ComplexScale(), Divide(), operator*(), and Rotate().

◆ shift

int RectMatrixRowCol::shift
protected

Definition at line 26 of file newmatrm.h.

◆ spacing

int RectMatrixRowCol::spacing
protected

Definition at line 25 of file newmatrm.h.

Referenced by AddScaled(), ComplexScale(), Divide(), operator*(), and Rotate().

◆ store

Real* RectMatrixRowCol::store
protected

Definition at line 23 of file newmatrm.h.

Referenced by AddScaled(), ComplexScale(), Divide(), operator*(), and Rotate().


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