Lines 24-30
Link Here
|
24 |
|
24 |
|
25 |
#if 1 |
25 |
#if 1 |
26 |
|
26 |
|
27 |
#include <iostream.h> |
27 |
#include <iostream> |
28 |
#include <stdlib.h> |
28 |
#include <stdlib.h> |
29 |
#include <math.h> |
29 |
#include <math.h> |
30 |
//#define NDEBUG // uncomment to remove checking of assert() |
30 |
//#define NDEBUG // uncomment to remove checking of assert() |
Lines 57-65
Link Here
|
57 |
void rprint()const; //print entries on a single line |
57 |
void rprint()const; //print entries on a single line |
58 |
void resize(int n); |
58 |
void resize(int n); |
59 |
int operator==(const vector<ElType>& v)const; |
59 |
int operator==(const vector<ElType>& v)const; |
60 |
friend vector<ElType> operator*(ElType c,vector<ElType>& v ); |
60 |
friend vector<ElType> operator* (ElType c,vector<ElType>& v ); |
61 |
friend vector<ElType> operator*(vector<ElType>& v,ElType c ); |
61 |
friend vector<ElType> operator*(vector<ElType>& v,ElType c ); |
62 |
friend ostream& operator<<(ostream& s,vector<ElType>& v); |
62 |
friend std::ostream& operator<<(std::ostream& s,vector<ElType>& v); |
63 |
}; |
63 |
}; |
64 |
template <class ElType> |
64 |
template <class ElType> |
65 |
void vector<ElType>::zero() |
65 |
void vector<ElType>::zero() |
Lines 129-138
Link Here
|
129 |
void vector<ElType>::rprint()const //print entries on a single line |
129 |
void vector<ElType>::rprint()const //print entries on a single line |
130 |
{ |
130 |
{ |
131 |
int i; |
131 |
int i; |
132 |
cout << "VECTOR: "; |
132 |
std::cout << "VECTOR: "; |
133 |
cout << "("; |
133 |
std::cout << "("; |
134 |
for(i=0;i<len-1;i++) cout << data[i] << ","; |
134 |
for(i=0;i<len-1;i++) std::cout << data[i] << ","; |
135 |
cout << data[len-1] << ")" << endl; |
135 |
std::cout << data[len-1] << ")" << std::endl; |
136 |
return; |
136 |
return; |
137 |
} |
137 |
} |
138 |
template <class ElType> |
138 |
template <class ElType> |
Lines 164-170
Link Here
|
164 |
return ans; |
164 |
return ans; |
165 |
} |
165 |
} |
166 |
template <class ElType> |
166 |
template <class ElType> |
167 |
ostream& operator<<(ostream& s,vector<ElType>& v) |
167 |
std::ostream& operator<<(std::ostream& s,vector<ElType>& v) |
168 |
{ |
168 |
{ |
169 |
s << "("; |
169 |
s << "("; |
170 |
for(int i=0;i<v.len-1;i++) s << v.data[i] << ", "; |
170 |
for(int i=0;i<v.len-1;i++) s << v.data[i] << ", "; |
Lines 192-198
Link Here
|
192 |
matrix<ElType> operator-(const matrix<ElType>& a); |
192 |
matrix<ElType> operator-(const matrix<ElType>& a); |
193 |
matrix<ElType> transpose(); |
193 |
matrix<ElType> transpose(); |
194 |
//matrix<ElType> inverse(); |
194 |
//matrix<ElType> inverse(); |
195 |
friend ostream& operator<<(ostream& s,matrix<ElType>& m); |
195 |
friend std::ostream& operator<<(std::ostream& s,matrix<ElType>& m); |
196 |
friend void ludcmp(matrix<ElType>& a,vector<int>& indx,double &d); |
196 |
friend void ludcmp(matrix<ElType>& a,vector<int>& indx,double &d); |
197 |
friend void lubksb(matrix<ElType>&a,vector<int>& indx,vector<ElType>&b); |
197 |
friend void lubksb(matrix<ElType>&a,vector<int>& indx,vector<ElType>&b); |
198 |
}; |
198 |
}; |
Lines 357-363
Link Here
|
357 |
return ans; |
357 |
return ans; |
358 |
} |
358 |
} |
359 |
template <class ElType> |
359 |
template <class ElType> |
360 |
ostream& operator<<(ostream& s,matrix<ElType>& m) |
360 |
std::ostream& operator<<(std::ostream& s,matrix<ElType>& m) |
361 |
{ |
361 |
{ |
362 |
for(int i=0; i<m.rows;i++) s << m[i]; |
362 |
for(int i=0; i<m.rows;i++) s << m[i]; |
363 |
return s; |
363 |
return s; |
Lines 381-387
Link Here
|
381 |
// kdDebug() << "new search" << endl; |
381 |
// kdDebug() << "new search" << endl; |
382 |
for (j=0;j<n;j++) { if ((temp=fabs(a[i][j])) > big) big=temp; |
382 |
for (j=0;j<n;j++) { if ((temp=fabs(a[i][j])) > big) big=temp; |
383 |
/* kdDebug() << temp << " " << fabs(a[i][j]) << " "<< big <<endl; */} |
383 |
/* kdDebug() << temp << " " << fabs(a[i][j]) << " "<< big <<endl; */} |
384 |
if (big == 0.0) { cerr << "Singular matrix in routine LUDCMP" << endl; big = TINY;} |
384 |
if (big == 0.0) { std::cerr << "Singular matrix in routine LUDCMP" << std::endl; big = TINY;} |
385 |
vv[i]=1.0/big; |
385 |
vv[i]=1.0/big; |
386 |
} |
386 |
} |
387 |
for (j=0;j<n;j++) |
387 |
for (j=0;j<n;j++) |
388 |
|
388 |
|