#include "acl/acl.h"
#include "acl/aclGenerators.h"
#include "acl/aclMath/aclMatrixOfElements.h"
#include "acl/aclMath/aclVectorOfElements.h"
#include "acl/aclMath/aclVectorOfElements.h"
#include "math/aslMatrices.h"
#include "acl/Kernels/aclKernel.h"
#include "acl/DataTypes/aclArray.h"
{
cout << "Test of \"Matrix Operations\" function..." << flush;
copy(generateVEData<cl_float>(10u,3u),vec0);
copy(generateVEData<cl_float>(10u,1u),vec1);
{
using namespace elementOperators;
k << (vec0=generateVEConstant(0.1f,1.f,2.f));
k << (vec1=(elementProduct(generateVEConstant(0.f,1.f,2.f),vec0)*generateVEConstant(1.f,0.f,2.f))*vec0);
}
vector<cl_float> output(10);
copy(vec1[0], output);
bool status(output[1] == 20.5);
errorMessage(status);
return status;
}
{
cout << "Test of \"System Solve Cramer's rule\" function..." << flush;
copy(generateVEData<cl_float>(10u,2u),vecB);
copy(generateVEData<cl_float>(10u,2u),vecX);
auto matA(generateMEConstant(makeAMatr(makeAVec(4.,1.),makeAVec(1.,3.))));
{
using namespace elementOperators;
k << (vecB=generateVEConstant(1.f,2.f));
k << gcSolveSystem(matA,vecB,vecX);
}
vector<cl_float> output(10);
bool status(output[1] > 0.09 && output[1] < .1);
return status;
}
{
cout <<
"Test of \"System Solve congugate gradient method\" function..." <<
flush;
copy(generateVEData<cl_float>(10u,2u),vecB);
copy(generateVEData<cl_float>(10u,2u),vecX);
{
using namespace elementOperators;
}
vector<cl_float> output(10);
bool status(output[1] > 0.09 && output[1] < .1);
return status;
}
{
bool allTestsPassed(true);
return allTestsPassed ? EXIT_SUCCESS : EXIT_FAILURE;
}
The class represents several Element.
vector< Element > gcSolveSystemCG(const MatrixOfElements &a, const VectorOfElements &b, const VectorOfElements &x)
generates code for solving the solution of a system of linear equations
void errorMessage(cl_int status, const char *errorMessage)
Prints errorMessage and exits depending on the status.
MatrixOfElements generateMEConstant(const asl::AMatr< T > &a)
Generates VectorOfElements correspondinng to a.
VectorOfElements generateVEConstant(T a)
Generates VectorOfElements with 1 Element acl::Constant with value a.
Advanced Computational Language.
void copy(MemBlock &source, T *destination)
Advanced Simulation Library.
bool testMatrixOperations()