I'm having problems running cblas_dgemm on a matix matrix multiplication.(adsbygoogle = window.adsbygoogle || []).push({});

I have the following matricies

The idea is to multiply the mass * tempMass and put it in mass_avgCode (Text):

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];

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:Code (Text):

cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, 1, 1, nlocal, 1.0, mass, nlocal, tempMass, 1, 1.0, m_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?Code (Text):

cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nlocal, 1, NDIM, 1.0, pos[0], NDIM, tempPos, 1, 0.0, pos_ave, 1);

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Help with cblas_dgemm matrix multiplication

Loading...

Similar Threads - Help cblas_dgemm matrix | Date |
---|---|

C/++/# Help with MATLAB code? | Feb 9, 2018 |

WaveGrid - Non-equilibrium Emergence Sandbox | Jan 22, 2018 |

What's wrong with my bisection method code? | Dec 10, 2017 |

Help: Convert Matlab to Python code | Dec 8, 2017 |

**Physics Forums - The Fusion of Science and Community**