bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] cblas_sgemm


From: Youhua Xu
Subject: [Bug-gsl] cblas_sgemm
Date: Tue, 03 Jun 2014 14:59:41 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Hi, guys

I just happen to find that there is a bug with cblas_sgemm, I ran the example provided by you on p-474, however, on my computer the result was wrong!
here is the result:
[ 233.73     233.96
  13584.2    13597.7 ]
apparently this is quite different from the correct answer:
[ 367.76,  368.12
  674.06,  674.72 ]
I also used other language (python) to check this result ... so what is the wrong ?

======= The example =======
  1 #include <stdio.h>
  2 #include <gsl/gsl_cblas.h>
  3
  4 int main(void)
  5 {
  6     int lda = 3;
  7     float A[] = { 0.11, 0.12, 0,13,
  8                   0.21, 0.22, 0.23 };
  9     int ldb = 2;
 10     float B[] = { 1011, 1012,
 11                   1021, 1022,
 12                   1031, 1032 };
 13
 14     int ldc = 2;
 15     float C[] = { 0.00, 0.00,
 16                   0.00, 0.00 };
 17
 18     /* Compute C = A*B */
 19     cblas_sgemm(CblasRowMajor,
 20                 CblasNoTrans, CblasNoTrans, 2, 2, 3,
 21                 1.0, A, lda, B, ldb, 0.0, C, ldc);
 22
 23     printf("[ %g    %g\n", C[0], C[1]);
 24     printf("  %g    %g ]\n", C[2], C[3]);
 25
 26     return 0;
 27 }

The OS of my computer is Ubuntu 14.04, gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) and the gsl version is 1.16.

Best wishes!

Youhua Xu






reply via email to

[Prev in Thread] Current Thread [Next in Thread]