OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Macros | Functions
newmatrm.cpp File Reference
#include <cmath>
#include <ossim/matrix/newmat.h>
#include <ossim/matrix/newmatrm.h>

Go to the source code of this file.

Macros

#define WANT_MATH
 
#define REPORT   {}
 

Functions

void ComplexScale (RectMatrixCol &U, RectMatrixCol &V, Real x, Real y)
 
void Rotate (RectMatrixCol &U, RectMatrixCol &V, Real tau, Real s)
 
Real pythag (Real f, Real g, Real &c, Real &s)
 

Macro Definition Documentation

◆ REPORT

#define REPORT   {}

◆ WANT_MATH

#define WANT_MATH

Definition at line 5 of file newmatrm.cpp.

Function Documentation

◆ ComplexScale()

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

Definition at line 132 of file newmatrm.cpp.

References RectMatrixRowCol::n, n, REPORT, RectMatrixRowCol::spacing, RectMatrixRowCol::store, x, and y.

Referenced by SVD().

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
os2<< "> n<< " > nendobj n
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18

◆ pythag()

Real pythag ( Real  f,
Real  g,
Real &  c,
Real &  s 
)

Definition at line 186 of file newmatrm.cpp.

References REPORT, and sq.

Referenced by DowndateCholesky(), LeftCircularUpdateCholesky(), RightCircularUpdateCholesky(), SVD(), and UpdateCholesky().

190 {
191  if (f==0 && g==0) { c=1.0; s=0.0; return 0.0; }
192  Real af = f>=0 ? f : -f;
193  Real ag = g>=0 ? g : -g;
194  if (ag<af)
195  {
196  REPORT
197  Real h = g/f; Real sq = std::sqrt(1.0+h*h);
198  if (f<0) sq = -sq; // make return value non-negative
199  c = 1.0/sq; s = h/sq; return sq*f;
200  }
201  else
202  {
203  REPORT
204  Real h = f/g; Real sq = std::sqrt(1.0+h*h);
205  if (g<0) sq = -sq;
206  s = 1.0/sq; c = h/sq; return sq*g;
207  }
208 }
double Real
Definition: include.h:57
#define sq(a)
Definition: auxiliary.h:77
#define REPORT
Definition: newmatrm.cpp:18

◆ Rotate()

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

Definition at line 156 of file newmatrm.cpp.

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

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
os2<< "> n<< " > nendobj n
Real * store
Definition: newmatrm.h:23
#define REPORT
Definition: newmatrm.cpp:18