KSquare Utilities
Matrix.cpp File Reference
#include "FirstIncludes.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <fstream>
#include <iostream>
#include <ostream>
#include <vector>
#include "MemoryDebug.h"
#include "Matrix.h"
#include "KKException.h"
#include "OSservices.h"
#include "KKStr.h"

Go to the source code of this file.

Macros

#define DBL_EPSILON   2.2204460492503131e-016
 
#define SQR(X)   ((X) * (X))
 

Functions

ostream & operator<< (ostream &os, const Matrix &matrix)
 
template<class T >
const T SIGN (const T &a, const T &b)
 

Macro Definition Documentation

#define DBL_EPSILON   2.2204460492503131e-016

Definition at line 902 of file Matrix.cpp.

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

Definition at line 1218 of file Matrix.cpp.

Function Documentation

ostream& operator<< ( ostream &  os,
const Matrix matrix 
)

Definition at line 853 of file Matrix.cpp.

References KKB::Matrix::NumOfCols(), KKB::Matrix::NumOfRows(), and KKB::operator<<().

856 {
857  kkint32 col;
858  kkint32 row;
859 
860  os << "[" << matrix.NumOfRows () << "," << matrix.NumOfCols () << "]" << std::endl;
861 
862  os << "[";
863 
864  for (row = 0; row < matrix.NumOfRows (); row++)
865  {
866  if (row > 0)
867  os << " ";
868 
869  os << "[";
870 
871  for (col = 0; col < matrix.NumOfCols (); col++)
872  {
873  if (col > 0)
874  os << ", ";
875 
876  os.width (8);
877  os.precision (6);
878  os << matrix[row][col];
879  }
880 
881  os << "]" << std::endl;
882  }
883 
884  os << "]" << std::endl;
885 
886  return os;
887 } /* operator<< */
HTMLReport &__cdecl endl(HTMLReport &htmlReport)
Definition: HTMLReport.cpp:240
kkint32 NumOfRows() const
Definition: Matrix.h:128
__int32 kkint32
Definition: KKBaseTypes.h:88
kkint32 NumOfCols() const
Definition: Matrix.h:126
template<class T >
const T SIGN ( const T &  a,
const T &  b 
)
inline

Definition at line 1196 of file Matrix.cpp.

1199 {
1200  if (b >= 0)
1201  {
1202  if (a >= 0)
1203  return a;
1204  else
1205  return -a;
1206  }
1207 
1208  else
1209  {
1210  if (a >- 0)
1211  return -a;
1212  else
1213  return a;
1214  }
1215 } /* SIGN */