Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

utils.h File Reference

#include "types.h"
#include "matrix.h"
#include <valarray>
#include <iostream>
#include <string>

Go to the source code of this file.

Defines

#define DEFAULT_PRECISION   0.00001

Functions

short int sign (Real x)
 sign of a Real

Matrix transform1DvalarrayToColumnMatrix (valarray< Real > array)
 Transforms a 1D array into a column vector - easier to handle our structures and do operations on them.

Matrix transform2DvalarrayToMatrix (valarray< valarray< Real > > array)
 Transforms a 2D array into a matrix.

valarray< RealtransformColumnMatrixTo1Dvalarray (Matrix M)
 Transforms a column matrix to a 1D array.

valarray< valarray< Real > > transformMatrixTo2Dvalarray (Matrix M)
 Transforms a normal matrix to a 2D array.

valarray< Realmergeunique (valarray< Real > a1, valarray< Real > a2)
 helper function to merge two valarrays of reals sorted in ascending order and remove duplicates.

void ErrorMsg (string str, bool mustexit=false)
int getint (istream &istr)
bool realsEqual (Real realOne, Real realTwo, Real precision=0.00001)
string valarrayRealToString (const valarray< Real > &theArray)


Define Documentation

#define DEFAULT_PRECISION   0.00001
 

Definition at line 11 of file utils.h.


Function Documentation

void ErrorMsg string  str,
bool  mustexit = false
 

Definition at line 74 of file utils.cpp.

Referenced by Matrix::CMAC(), Matrix::CMAR(), Matrix::Determinant(), Matrix::DivideColumn(), Matrix::DivideRow(), Matrix::GetInverse(), Matrix::operator *(), Matrix::operator()(), Matrix::operator+(), Matrix::operator-(), Matrix::operator/(), and Matrix::operator[]().

int getint istream &  istr  ) 
 

Definition at line 143 of file utils.cpp.

Referenced by Matrix::Input().

valarray<Real> mergeunique valarray< Real a1,
valarray< Real a2
 

helper function to merge two valarrays of reals sorted in ascending order and remove duplicates.

a1 - first array to merge a2 - second array to merge

Returns:
the merged array

Definition at line 12 of file utils.cpp.

References Natural, Real, and TN_INFINITY.

Referenced by creditCurve::combineUnderlyingAndSpreads(), and yieldCurve::operator==().

bool realsEqual Real  realOne,
Real  realTwo,
Real  precision = 0.00001
 

Definition at line 157 of file utils.cpp.

References Real.

Referenced by mainbinomialtree(), and mainconvertiblebond().

short int sign Real  x  ) 
 

sign of a Real

Author:
Yann

Definition at line 62 of file utils.cpp.

References Real.

Referenced by CumulativeBivariateNormal().

Matrix transform1DvalarrayToColumnMatrix valarray< Real array  ) 
 

Transforms a 1D array into a column vector - easier to handle our structures and do operations on them.

Definition at line 96 of file utils.cpp.

References Natural, and Matrix::SetValue().

Referenced by mainmatrix().

Matrix transform2DvalarrayToMatrix valarray< valarray< Real > >  array  ) 
 

Transforms a 2D array into a matrix.

Definition at line 107 of file utils.cpp.

References Natural, and Matrix::SetValue().

Referenced by mainmatrix().

valarray<Real> transformColumnMatrixTo1Dvalarray Matrix  M  ) 
 

Transforms a column matrix to a 1D array.

Definition at line 119 of file utils.cpp.

References M, and Natural.

Referenced by mainmatrix().

valarray<valarray<Real> > transformMatrixTo2Dvalarray Matrix  M  ) 
 

Transforms a normal matrix to a 2D array.

Definition at line 128 of file utils.cpp.

References M, and Natural.

Referenced by mainmatrix().

string valarrayRealToString const valarray< Real > &  theArray  ) 
 

Definition at line 162 of file utils.cpp.

References Natural.

Referenced by operator<<().


Note: Generated nightly - reload for latest version
Generated on Thu Dec 22 23:12:38 2005 for terreneuve by doxygen 1.3.6