KSquare Utilities
EigenVector.cpp File Reference
#include "FirstIncludes.h"
#include <stdlib.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <vector>
#include "MemoryDebug.h"
#include "KKBaseTypes.h"
#include "EigenVector.h"
#include "KKException.h"
#include "OSservices.h"

Go to the source code of this file.

Macros

#define SQR(X)   ((X) * (X))
 

Functions

double pythag (const double a, const double b)
 
template<class T >
const T SIGN (const T &a, const T &b)
 

Macro Definition Documentation

#define SQR (   X)    ((X) * (X))

Definition at line 166 of file EigenVector.cpp.

Function Documentation

double pythag ( const double  a,
const double  b 
)

Definition at line 170 of file EigenVector.cpp.

Referenced by KKB::tqli().

173 {
174  double absa, absb;
175 
176  absa = fabs (a);
177  absb = fabs (b);
178 
179  if (absa > absb)
180  {
181  return absa * sqrt (1.0 + SQR (absb / absa));
182  }
183  else
184  {
185  if (absb == 0.0)
186  return 0.0;
187  else
188  return absb * sqrt (1.0 + SQR (absa / absb));
189  }
190 } /* pythag */
#define SQR(X)
template<class T >
const T SIGN ( const T &  a,
const T &  b 
)
inline

Definition at line 144 of file EigenVector.cpp.

147 {
148  if (b >= 0)
149  {
150  if (a >= 0)
151  return a;
152  else
153  return -a;
154  }
155 
156  else
157  {
158  if (a >- 0)
159  return -a;
160  else
161  return a;
162  }
163 } /* SIGN */