Steradiant
Steradiant

Reputation: 233

How to use dger (BLAS) in C

I'm struggling with using dger() correctly in C. My code is as follows:

#include <stdio.h>
#include "blas.h"

int main() {
    double a[4*5] = {  1, 2, 3, 4, 5,
                     6, 7, 8, 9,10,
                    11,12,13,14,15,
                    16,17,18,19,20
                  };
    double x[4]  = {2,3,4,5};
    double y[5] = {7,8,9,10,11};
    int tm=4, tn=5, tone=1;

    dger(&tm, &tn, &tone, x, &tone, y, &tone, a, &tm);
}

The code compiles without error but when I execute the code, it crashes. I don't really get more details why the code crashes because I'm writing a mex C file (MATLAB C-code) - I have omitted the overhead of the mex entry function and so on.

Upvotes: 0

Views: 257

Answers (1)

Haatschii
Haatschii

Reputation: 9319

You have to check your arguments: https://www.netlib.org/lapack/explore-html/d7/d15/group__double__blas__level2_ga458222e01b4d348e9b52b9343d52f828.html In particular you are missing the alpha parameter (passing &tone instead).

Upvotes: 1

Related Questions