Got a compiling version of the algorithm

This commit is contained in:
Your Name 2011-12-13 17:48:37 -05:00
parent 8dd58836e0
commit 8d4419d2fd
3 changed files with 194 additions and 10 deletions

View file

@ -26,3 +26,7 @@ if (HDF5_FOUND)
add_executable(testReadFlash testReadFlash.cpp)
target_link_libraries(testReadFlash ${tolink})
endif (HDF5_FOUND)
add_executable(testEskow testEskow.cpp)
target_link_libraries(testEskow ${tolink})

50
sample/testEskow.cpp Normal file
View file

@ -0,0 +1,50 @@
#include <cstring>
#include <iostream>
#include <iomanip>
#include <vector>
#include "eskow.hpp"
using namespace std;
double Hartmann_Matrix[6][6] = {
{ 14.8253, -6.4243, 7.8746, -1.2498, 10.2733, 10.2733 },
{ -6.4243, 15.1024, -1.1155, -0.2761, -8.2117, -8.2117 },
{ 7.8746, -1.1155, 51.8519, -23.3482, 12.5902, 12.5902 },
{ -1.2498, -0.2761, -23.3482, 22.7962, -9.8958, -9.8958 },
{ 10.2733, -8.2117, 12.5902, -9.8958, 21.0656, 21.0656 },
{ 10.2733, -8.2117, 12.5902, -9.8958, 21.0656, 21.0656 }
};
struct MatrixOp
{
vector<double> M;
int N;
double& operator()(int i, int j)
{
return M[i*N + j];
}
};
int main()
{
MatrixOp M;
double norm_E;
M.N = 6;
M.M.resize(M.N*M.N);
memcpy(&M.M[0], &Hartmann_Matrix[0][0], sizeof(double)*36);
CholeskyEskow::cholesky_eskow(M, M.N, norm_E);
for (int i = 0; i < M.N; i++)
{
for (int j = 0; j < M.N; j++)
{
cout << setprecision(25) << M(i,j) << " ";
}
cout << endl;
}
return 0;
}