- #1
SpiffyEh
- 194
- 0
I'm having problems running cblas_dgemm on a matix matrix multiplication.
I have the following matricies
The idea is to multiply the mass * tempMass and put it in mass_avg
and multiple pos * tempPos and put it in pos_avg
nlocal is less than n and it needs to multiple up to nlocal rows not n
I'm using the following call for mass and it works as expected:
It's the position call that isn't working for me. I have the following for that one:
I've been struggling with this for hours and can't figure out why the position call isn't working. I keep getting a segmentation fault. Any ideas about what's going on? Or what I'm doing wrong in this situation?
I have the following matricies
Code:
double * mass = new double[n];
double (* pos)[NDIM] = new double[n][NDIM];
double tempPos[NDIM];
double tempMass[nlocal];
double mass_avg[1];
double pos_avg[NDIM];
The idea is to multiply the mass * tempMass and put it in mass_avg
and multiple pos * tempPos and put it in pos_avg
nlocal is less than n and it needs to multiple up to nlocal rows not n
I'm using the following call for mass and it works as expected:
Code:
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, 1, 1, nlocal, 1.0, mass, nlocal, tempMass, 1, 1.0, m_ave, 1);
It's the position call that isn't working for me. I have the following for that one:
Code:
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nlocal, 1, NDIM, 1.0, pos[0], NDIM, tempPos, 1, 0.0, pos_ave, 1);
I've been struggling with this for hours and can't figure out why the position call isn't working. I keep getting a segmentation fault. Any ideas about what's going on? Or what I'm doing wrong in this situation?