Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- Initializing matrices for dgemm (beginner question)

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

psinclairegi_com

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-23-2010
02:14 PM

33 Views

Initializing matrices for dgemm (beginner question)

double a[3*3] = { 0.3804, -0.7225, 0.5774,

-0.8159, 0.0318, 0.5774,

0.4355, 0.6907, 0.5774};

double b[3*6] = { 1.0006, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,

0.0000, 0.4887, 0.0000, 0.0000, 0.0000, 0.0000,

0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000};

double c[3*6] = { 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,

0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,

0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000};

int m = 3;

int n = 6;

int k = 3;

double alpha = 1;

double beta = 0;

int lda = m;

int ldb = k;

int ldc = m;

dgemm("N", "N", &m, &n, &k, α, a, &lda, b, &ldb, β, c, &ldc);

...to fill matrix c with:

0.3806, -0.3531, 0.0000, 0.0000, 0.0000, 0.0000,

-0.8164, 0.0155, 0.0000, 0.0000, 0.0000, 0.0000,

0.4358, 0.3375, 0.0000, 0.0000, 0.0000, 0.0000

My own matrix multiplication code does this, MATLAB does this, and the first 2 matrix multiplication apps that I tried online produced the above result. (http://www.bluebit.gr/matrix-calculator/matrix_multiplication.aspx)

dgemm will only return a similar result if I first transpose matrix a (it returns the same numbers but transposed). What am I doing wrong?

Link Copied

3 Replies

Gennady_F_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-23-2010
08:58 PM

33 Views

Please look at this article. May be it will usefull.

--Gennady

psinclairegi_com

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-24-2010
12:24 PM

33 Views

Thank you very much. Works fine now.

Gennady_F_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-24-2010
10:06 PM

33 Views

Thanks for the feedback. Precisely for these purposes and has been written this article.

--Gennady

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.