Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: dgemm in 64-bit C++ error
Replies: 1   Last Post: Sep 25, 2013 8:43 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
NIcholas

Posts: 54
Registered: 5/19/10
dgemm in 64-bit C++ error
Posted: Sep 25, 2013 4:08 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I am being told that MATLAB has encountered an internal error and needs to close when running this very simple dgemm call in c++ (64-bit windows). Does anyone know why?

// file: blasTest.cpp
#include "matrix.h"
#include "mex.h"
#include "blas.h"

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
int K = 256; int M = 100;
double* Phi = (double*) mxMalloc(sizeof(double)*K*K);
for(int i=0; i<K*K; i++)
Phi[i] = double(i);

double* scratch = (double*) mxMalloc(sizeof(double)*K*M);
double* scratch2 = (double*) mxMalloc(sizeof(double)*K*M);
for(int i=0; i<K*M; i++)
scratch[i] = 1.0;

double zero = 0.0; double one = 1.0;
// scratch2 = Phi * scratch
dgemm("N", "N", (ptrdiff_t*)&K, (ptrdiff_t*)&M, (ptrdiff_t*)&K, &one, Phi, (ptrdiff_t*)&K, scratch, (ptrdiff_t*)&K, &zero, scratch2, (ptrdiff_t*)&K);
}

I am compiling it with these commands:
blaslib = fullfile(matlabroot, 'extern', 'lib', 'win64', 'microsoft', 'libmwblas.lib');
mex('blasTest.cpp', blaslib);



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.