Hi,
The attached code crashes on my core I7 machine which runs ubuntu 9.10 64 bits.
#include <iostream>
#include <mkl.h>
#include <mkl_cblas.h>
#include <mkl_lapack.h>
#include <assert.h>
#include <math.h>
#include <string.h>
#include <malloc.h>
#include <sys/time.h>
using namespace std;
#define NUM_ITEMS 1
#define NUM_WEIGHTS 100
#define NUM_OUTPUTS 25
#define NUM_CYCLES 50
void PrintMatrix(double* pMatrix, const size_t nRows, const size_t nCols)
{
for (size_t i=0; i<< pMatrix[i * nCols + j] << '\t';
}
cout << endl;
}
cout << endl;
}
void PrintLowerTriangularMatrix(double* pMatrix, const size_t nRowCols)
{
for (size_t i=0; i<=i; ++j)
{
cout << pMatrix[i * nRowCols + j] << '\t';
}
cout << endl;
}
cout << endl;
}
void CreatePascalMatrix(double* const pMatrix, const int nWidthHeight)
{
for (int i=0; i<< "P:" << endl;
PrintMatrix(P, NUM_WEIGHTS, NUM_OUTPUTS);
int nNumOutputs = NUM_OUTPUTS;
char chUplo = 'L';
int nInfo;
CreatePascalMatrix(S, NUM_OUTPUTS);
cout << "S:" << endl;
PrintMatrix(S, NUM_OUTPUTS, NUM_OUTPUTS);
dpotrf(
&chUplo,
&nNumOutputs,
S,
&nNumOutputs,
&nInfo);
cout << "S Cholesky:" << endl;
PrintLowerTriangularMatrix(S, NUM_OUTPUTS);
cblas_dtrsm(CblasRowMajor, CblasRight, CblasLower, CblasTrans, CblasNonUnit, NUM_WEIGHTS, NUM_OUTPUTS, 1, S, NUM_OUTPUTS, P, NUM_WEIGHTS);
cout << "X:" << endl;
PrintMatrix(P, NUM_WEIGHTS, NUM_OUTPUTS);
// multiply to check result
cblas_dtrmm(CblasRowMajor, CblasRight, CblasLower, CblasTrans, CblasNonUnit, NUM_WEIGHTS, NUM_OUTPUTS, 1, S, NUM_OUTPUTS, P, NUM_WEIGHTS);
cout << "P:" << endl;
PrintMatrix(P, NUM_WEIGHTS, NUM_OUTPUTS);
}
int main()
{
CalculateGain();
return 0;
}
Hagai.