Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: How to run dgemms subroutine on mac computer

  1. May 16, 2010 #1
    1. The problem statement, all variables and given/known data

    I wrote a program to run the dgemul subroutine on my mac to find the matrix product for matrix a and matrix b, outputted as matrix c, just like the reference manual told me to. Being a mac user, I added the accelerate framework to the file which contain all the lapack stuff, but it does not recognize 'dgemul' as a function. Can someone please enlighten me as to what I am doing wrong? Below is the completed program.

    2. Relevant equations
    3. The attempt at a solution

    #import <Foundation/Foundation.h>
    #include <Accelerate/Accelerate.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>

    int main ()
    {

    double a[16] =
    {
    1.0, 2.0, 3.0, 4.0,
    1.0, 2.0, 3.0, 4.0,
    1.0, 2.0, 3.0, 4.0,
    1.0, 2.0, 3.0, 4.0

    };

    double b[16] =
    {
    5.0, 4.0, 3.0, 2.0,
    5.0, 4.0, 3.0, 2.0,
    5.0, 4.0, 3.0, 2.0,
    5.0, 4.0, 3.0, 2.0
    };

    double c[16] =
    {
    0.0, 0.0, 0.0, 0.0,
    0.0, 0.0, 0.0, 0.0,
    0.0, 0.0, 0.0, 0.0,
    0.0, 0.0, 0.0, 0.0
    };

    int lda = 4;
    int ldb = 4;
    char transa = 'N';
    char transb = 'N';
    int ldc = 4;
    int l = 4;
    int m = 4;
    int n = 4;

    dgemul(a, lda, transa, b, ldb, transb, c, ldc, l, m, n);
    int i;
    for (i=0; i<16; ++i) printf("%5.10f\n", c);


    return 0;
    }


    Thank you!
    -miss fangula
     
  2. jcsd
  3. May 16, 2010 #2
    sorry, i meant the dgemul subroutine in the title, not dgemms
     
  4. May 16, 2010 #3

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    I took a quick look at lapack and didn't see a routine called dgemul included.
     
  5. May 16, 2010 #4
  6. May 16, 2010 #5
    what subroutine should i call to do a matrix-matrix product?
     
  7. May 16, 2010 #6

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook