<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic cblas_zgemm problem in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835099#M6014</link>
    <description>&lt;DIV id="_mcePaste"&gt;don't doubt - the latest version supports all IA-32 Architecture systems generally compatible with the Intel Pentium processors, (for example, Intel Pentium 4 processor or Intel Xeon processor), or processors from other manufacturers supporting the same instruction set and running a 32-bit operating system.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;--Gennady</description>
    <pubDate>Wed, 25 Aug 2010 05:08:10 GMT</pubDate>
    <dc:creator>Gennady_F_Intel</dc:creator>
    <dc:date>2010-08-25T05:08:10Z</dc:date>
    <item>
      <title>cblas_zgemm problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835096#M6011</link>
      <description>First of all hello to everyone. I am having some problems with the cblas_zgemm function. I am trying to multiply two matrices, and all the input parameters are correct and in the right order. For some reason, i dont know why if the matrices are smaller than 15x15 the calculations are correct, and if they are bigger than that the 15-th column is filled only with zeros, and those are not the correct values, because i checked them in matlab. All other values are correct, only the 15-th column is wrong. I am using mkl 8.0.1. This gives me great trouble because the error than stackes, because there are more multiplications further. I would appreciate any help.&lt;BR /&gt;&lt;BR /&gt;Just ot add that no matter what the matrix size iz, if it is greater than 15x15 the 15-th column gives bad results, then the 30-th column... The arguments ae as follows:&lt;BR /&gt;&lt;BR /&gt;cblas_zgemm(CblasRowMajor, CblasNoTrans, CblasTrans, N, N, N1, α, A, N1, A, N1, β, C, N) where &lt;BR /&gt;&lt;BR /&gt;alpha=(1,0) and beta=(0,0). Thans in advance.</description>
      <pubDate>Mon, 23 Aug 2010 22:19:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835096#M6011</guid>
      <dc:creator>andragon</dc:creator>
      <dc:date>2010-08-23T22:19:08Z</dc:date>
    </item>
    <item>
      <title>cblas_zgemm problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835097#M6012</link>
      <description>&lt;DIV id="_mcePaste"&gt;Actually this version is no longer support.&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;Please check this probelm with the latest 10.3 beta and let us know if the probelm is still there.&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=75274&amp;amp;o=d&amp;amp;s=lr"&gt;Here &lt;/A&gt;is the link&lt;SPAN style="font-size: 10.8333px;"&gt;which&lt;SPAN style="border-collapse: collapse; font-family: Arial, sans-serif; line-height: 22px; font-size: 9.72225px;"&gt;invites you to participate in the Intel MKL 10.3 Beta program.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;--Gennady&lt;/DIV&gt;</description>
      <pubDate>Tue, 24 Aug 2010 04:45:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835097#M6012</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2010-08-24T04:45:17Z</dc:date>
    </item>
    <item>
      <title>cblas_zgemm problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835098#M6013</link>
      <description>Ok, will try. I would realy appreciate if anyone would go to the trouble to repeat my results, even with a different version of the mkl library. I have a relatively old computer, a 32 bit architecture, so i dont know if the new beta is realy for me. I made an experiment, and an arbitrary complex matrix works fine, but a mode matching matrix i am working with gives those fanthom zeros that drive me crazy. I mean there should be zeros in the matrix but not in those columns, or at least not in most of it. Here is the code, i forgot to copy the header files with the declarations but you can get a good picture from the code. Just call the function and see in the error . txt what you get. Any and all sugestions are welcome. Thank you all in advance.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#include &lt;IOSTREAM&gt;&lt;BR /&gt;#include &lt;COMPLEX&gt;&lt;BR /&gt;#include &lt;CMATH&gt;&lt;BR /&gt;&lt;BR /&gt;extern "C" {&lt;BR /&gt;#include"mkl_cblas.h"&lt;BR /&gt;#include"mkl_lapack.h"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;void Alfa::hstep(char* file, double a, double c, double x1, const int N, double f1, double f2, int k) {&lt;BR /&gt; const double c1 = 300000000;//299792458&lt;BR /&gt; const double PI = 3.141592653589793;&lt;BR /&gt; f1*=1000000000;&lt;BR /&gt; f2*=1000000000;&lt;BR /&gt; double st = (f2-f1)/k;&lt;BR /&gt; const int N1 = ((c/a*N)&amp;lt;(floor(c/a*N)+0.5)) ? (int)floor(c/a*N) : (int)ceil(c/a*N);&lt;BR /&gt;&lt;BR /&gt; FILE *fs11 = fopen("Step.txt", "w");&lt;BR /&gt; FILE *fs12 = fopen("error.txt", "w");&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; complex&lt;DOUBLE&gt; *Bna, *Bnc;&lt;BR /&gt; Bna = new complex&lt;DOUBLE&gt;&lt;N&gt;;&lt;BR /&gt; Bnc = new complex&lt;DOUBLE&gt;[N1];&lt;BR /&gt; MKL_Complex16 *Le = new MKL_Complex16[N*N1];&lt;BR /&gt; MKL_Complex16 *L = new MKL_Complex16[N*N];&lt;BR /&gt; MKL_Complex16 *Li = new MKL_Complex16[N*N], *Ld = new MKL_Complex16[N*N];&lt;BR /&gt; int *NLi = new int(N), *MLi = new int(N), *ldaLi = new int(N), *ipivLi = new int&lt;N&gt;, *infoLi = new int(0);&lt;BR /&gt; int lworkLi = -1;&lt;BR /&gt; MKL_Complex16 *s11 = new MKL_Complex16[N*N];&lt;BR /&gt; MKL_Complex16 *s12 = new MKL_Complex16[N*N1];&lt;BR /&gt; MKL_Complex16 *s21 = new MKL_Complex16[N1*N];&lt;BR /&gt; MKL_Complex16 *s22 = new MKL_Complex16[N1*N1];&lt;BR /&gt;&lt;BR /&gt; MKL_Complex16 *neka = new MKL_Complex16[N*N];&lt;BR /&gt; MKL_Complex16 *neka1 = new MKL_Complex16[N*N];&lt;BR /&gt;&lt;BR /&gt;//&lt;BR /&gt; &lt;BR /&gt; MKL_Complex16 *dummywork=new MKL_Complex16[1];&lt;BR /&gt; zgetri(NLi, Li, ldaLi, ipivLi, dummywork, &amp;amp;lworkLi, infoLi);&lt;BR /&gt; lworkLi=(int)(dummywork[0].real);&lt;BR /&gt; MKL_Complex16 *work=new MKL_Complex16[lworkLi];&lt;BR /&gt; &lt;BR /&gt;//&lt;BR /&gt;&lt;BR /&gt; for (double temp=f1; temp&amp;lt;=f2; temp+=st) {&lt;BR /&gt;  double k0=2*PI*temp/c1;&lt;BR /&gt;&lt;BR /&gt;  for (int i=0; i&lt;N&gt; = conj(sqrt(complex&lt;DOUBLE&gt;(k0*k0-((i+1)*PI/a)*((i+1)*PI/a),0)));&lt;BR /&gt;&lt;BR /&gt;  for (int i=0; i&lt;N1&gt; = conj(sqrt(complex&lt;DOUBLE&gt;(k0*k0-((i+1)*PI/c)*((i+1)*PI/c),0)));&lt;BR /&gt;&lt;BR /&gt;  for (int i=0; i&lt;N&gt;&lt;/N&gt;   for (int j=0; j&lt;N1&gt;&lt;/N1&gt;    complex&lt;DOUBLE&gt; prvi(c*a*Bnc&lt;J&gt;.real(), c*a*Bnc&lt;J&gt;.imag());&lt;BR /&gt;    complex&lt;DOUBLE&gt; ctemp = sqrt(Bna&lt;I&gt;/prvi);&lt;BR /&gt;    double itemp = int1(a,c,i,j,x1);&lt;BR /&gt;    complex&lt;DOUBLE&gt; ftemp(2*itemp*ctemp.real(), 2*itemp*ctemp.imag());&lt;BR /&gt;    Le[i*N1+j].real = ftemp.real();&lt;BR /&gt;    Le[i*N1+j].imag = ftemp.imag();&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;  complex&lt;DOUBLE&gt; alpha(1,0), beta(0,0);&lt;BR /&gt;  cblas_zgemm(CblasRowMajor, CblasNoTrans, CblasTrans, N, N, N1, α, Le, N1, Le, N1, β, L, N); &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;------------------------------------This is where the problem appeares&lt;BR /&gt;  &lt;BR /&gt;  for (int i=0; i&lt;N&gt;&lt;/N&gt;   fprintf(fs12, "\n");&lt;BR /&gt;   for (int j=0; j&lt;N&gt;&lt;/N&gt;    fprintf(fs12, "%lf\t %1d %.18lf %.18lf\n", temp/1000000000, i*N+j, L[i*N+j].real, L[i*N+j].imag);&lt;BR /&gt;   }&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;////////////////////////////&lt;BR /&gt;&lt;BR /&gt;int1.cpp&lt;BR /&gt;&lt;BR /&gt;///////////////////////////&lt;BR /&gt;&lt;BR /&gt;#include &lt;CMATH&gt;&lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;double Alfa::int1(double a, double c, int n, int m, double x1) {&lt;BR /&gt; const double PI = 3.141592653589793;&lt;BR /&gt; double ret = 0;&lt;BR /&gt; n++;&lt;BR /&gt; m++;&lt;BR /&gt; if (n*c!=a*m) {&lt;BR /&gt;  double e = a*c*sin(PI*n*(c+x1)/a-PI*m)/(2*PI*(c*n-a*m)); &lt;BR /&gt;  double e1 = a*c*sin(PI*n*(c+x1)/a+PI*m)/(2*PI*(c*n+a*m));&lt;BR /&gt;  double e2 = a*a*c*m*sin(PI*n*x1/a)/(PI*(a*m+c*n)*(a*m-c*n));&lt;BR /&gt;  ret = e-e1+e2;&lt;BR /&gt; } else {&lt;BR /&gt;&lt;BR /&gt;  ret = c/2*cos(m*PI*x1/c);&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; return ret;&lt;BR /&gt;}&lt;/CMATH&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/I&gt;&lt;/DOUBLE&gt;&lt;/J&gt;&lt;/J&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/N1&gt;&lt;/DOUBLE&gt;&lt;/N&gt;&lt;/N&gt;&lt;/DOUBLE&gt;&lt;/N&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/CMATH&gt;&lt;/COMPLEX&gt;&lt;/IOSTREAM&gt;</description>
      <pubDate>Tue, 24 Aug 2010 19:52:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835098#M6013</guid>
      <dc:creator>andragon</dc:creator>
      <dc:date>2010-08-24T19:52:36Z</dc:date>
    </item>
    <item>
      <title>cblas_zgemm problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835099#M6014</link>
      <description>&lt;DIV id="_mcePaste"&gt;don't doubt - the latest version supports all IA-32 Architecture systems generally compatible with the Intel Pentium processors, (for example, Intel Pentium 4 processor or Intel Xeon processor), or processors from other manufacturers supporting the same instruction set and running a 32-bit operating system.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;--Gennady</description>
      <pubDate>Wed, 25 Aug 2010 05:08:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835099#M6014</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2010-08-25T05:08:10Z</dc:date>
    </item>
    <item>
      <title>cblas_zgemm problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835100#M6015</link>
      <description>I've tried the same problem in mkl 10.2.2.025, the result was the same. Sorry about the bad news. Maybe i did something wrong in the definitions, or some parameter was wrong, or something else, but the fanthom zeros are there. If anybody is willing to repeat my results i would be gratefull. Any other idea is welcome. Thanks in advance.&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Aug 2010 14:59:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835100#M6015</guid>
      <dc:creator>andragon</dc:creator>
      <dc:date>2010-08-25T14:59:06Z</dc:date>
    </item>
    <item>
      <title>cblas_zgemm problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835101#M6016</link>
      <description>Please give a specific example where the claimed error occurs, and state which compiler you used.&lt;BR /&gt;&lt;BR /&gt;Please give source code that is &lt;I&gt;complete&lt;/I&gt;, so that someone interested can compile and run the program to reproduce the errors that you saw. The code that you have given is incomplete (no main(), missing definition of Alfa), and you have not specified the values of variables (a, c, n, m, etc.) that are needed to enable running the program.</description>
      <pubDate>Wed, 25 Aug 2010 15:10:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835101#M6016</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2010-08-25T15:10:25Z</dc:date>
    </item>
    <item>
      <title>cblas_zgemm problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835102#M6017</link>
      <description>Will do. Im working in visual studio 2005. I will put all of the components, and the values that i used are the ones in the main program. &lt;BR /&gt;&lt;BR /&gt;///////////////////////////&lt;BR /&gt;&lt;BR /&gt;int1.h&lt;BR /&gt;&lt;BR /&gt;//////////////////////////&lt;BR /&gt;&lt;BR /&gt;#ifndef _int1_h_&lt;BR /&gt;#define _int1_h_&lt;BR /&gt;&lt;BR /&gt;namespace Alfa {&lt;BR /&gt; double int1(double a, double c, int n, int m, double x1);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;
///////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
hstep.h&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////&lt;BR /&gt;&lt;BR /&gt;#ifndef _hstep_h_&lt;BR /&gt;#define _hstep_h_&lt;BR /&gt;&lt;BR /&gt;namespace Alfa {&lt;BR /&gt; void hstep(char* file, double a, double c, double x1, int N, double f1, double f2, int k);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;///////////////////////////&lt;BR /&gt;

&lt;BR /&gt;

int1.cpp&lt;BR /&gt;

&lt;BR /&gt;

//////////////////////////&lt;BR /&gt;&lt;BR /&gt;#include "int1.h"&lt;BR /&gt;#include &lt;CMATH&gt;&lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;double Alfa::int1(double a, double c, int n, int m, double x1) {&lt;BR /&gt; const double PI = 3.141592653589793;&lt;BR /&gt; double ret = 0;&lt;BR /&gt; n++;&lt;BR /&gt; m++;&lt;BR /&gt; if (n*c!=a*m) {&lt;BR /&gt;  double e = a*c*sin(PI*n*(c+x1)/a-PI*m)/(2*PI*(c*n-a*m)); &lt;BR /&gt;  double e1 = a*c*sin(PI*n*(c+x1)/a+PI*m)/(2*PI*(c*n+a*m));&lt;BR /&gt;  double e2 = a*a*c*m*sin(PI*n*x1/a)/(PI*(a*m+c*n)*(a*m-c*n));&lt;BR /&gt;  ret = e-e1+e2;&lt;BR /&gt; } else {&lt;BR /&gt;&lt;BR /&gt;  ret = c/2*cos(m*PI*x1/c);&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; return ret;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;///////////////////////////&lt;BR /&gt;


&lt;BR /&gt;


hstep.cpp&lt;BR /&gt;


&lt;BR /&gt;


//////////////////////////&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#include "hstep.h"&lt;BR /&gt;#include "int1.h"&lt;BR /&gt;#include &lt;IOSTREAM&gt;&lt;BR /&gt;#include &lt;COMPLEX&gt;&lt;BR /&gt;#include &lt;CMATH&gt;&lt;BR /&gt;&lt;BR /&gt;extern "C" {&lt;BR /&gt;#include"mkl_cblas.h"&lt;BR /&gt;#include"mkl_lapack.h"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;void Alfa::hstep(char* file, double a, double c, double x1, const int N, double f1, double f2, int k) {&lt;BR /&gt; const double c1 = 300000000;//299792458&lt;BR /&gt; const double PI = 3.141592653589793;&lt;BR /&gt; f1*=1000000000;&lt;BR /&gt; f2*=1000000000;&lt;BR /&gt; double st = (f2-f1)/k;&lt;BR /&gt; const int N1 = ((c/a*N)&amp;lt;(floor(c/a*N)+0.5)) ? (int)floor(c/a*N) : (int)ceil(c/a*N);&lt;BR /&gt;&lt;BR /&gt; FILE *fs11 = fopen("Hstep.txt", "w");&lt;BR /&gt; FILE *fs12 = fopen("error.txt", "w");&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; complex&lt;DOUBLE&gt; *Bna, *Bnc;&lt;BR /&gt; Bna = new complex&lt;DOUBLE&gt;&lt;N&gt;;&lt;BR /&gt; Bnc = new complex&lt;DOUBLE&gt;[N1];&lt;BR /&gt; MKL_Complex16 *Le = new MKL_Complex16[N*N1];&lt;BR /&gt; MKL_Complex16 *L = new MKL_Complex16[N*N];&lt;BR /&gt; MKL_Complex16 *Li = new MKL_Complex16[N*N], *Ld = new MKL_Complex16[N*N];&lt;BR /&gt; int *NLi = new int(N), *MLi = new int(N), *ldaLi = new int(N), *ipivLi = new int&lt;N&gt;, *infoLi = new int(0);//*ipivLi = new int(0)&lt;BR /&gt; int lworkLi = -1;&lt;BR /&gt; MKL_Complex16 *s11 = new MKL_Complex16[N*N];&lt;BR /&gt; MKL_Complex16 *s12 = new MKL_Complex16[N*N1];&lt;BR /&gt; MKL_Complex16 *s21 = new MKL_Complex16[N1*N];&lt;BR /&gt; MKL_Complex16 *s22 = new MKL_Complex16[N1*N1];&lt;BR /&gt;&lt;BR /&gt; MKL_Complex16 *neka = new MKL_Complex16[N*N];&lt;BR /&gt; MKL_Complex16 *neka1 = new MKL_Complex16[N*N];&lt;BR /&gt;&lt;BR /&gt;//&lt;BR /&gt; &lt;BR /&gt; MKL_Complex16 *dummywork=new MKL_Complex16[1];&lt;BR /&gt; zgetri(NLi, Li, ldaLi, ipivLi, dummywork, &amp;amp;lworkLi, infoLi);&lt;BR /&gt; lworkLi=(int)(dummywork[0].real);&lt;BR /&gt; MKL_Complex16 *work=new MKL_Complex16[lworkLi];&lt;BR /&gt; &lt;BR /&gt;//&lt;BR /&gt;&lt;BR /&gt; for (double temp=f1; temp&amp;lt;=f2; temp+=st) {&lt;BR /&gt;  double k0=2*PI*temp/c1;&lt;BR /&gt;&lt;BR /&gt;  for (int i=0; i&lt;N&gt; = conj(sqrt(complex&lt;DOUBLE&gt;(k0*k0-((i+1)*PI/a)*((i+1)*PI/a),0)));&lt;BR /&gt;&lt;BR /&gt;  for (int i=0; i&lt;N1&gt; = conj(sqrt(complex&lt;DOUBLE&gt;(k0*k0-((i+1)*PI/c)*((i+1)*PI/c),0)));&lt;BR /&gt;&lt;BR /&gt;  for (int i=0; i&lt;N&gt;&lt;/N&gt;   for (int j=0; j&lt;N1&gt;&lt;/N1&gt;    complex&lt;DOUBLE&gt; prvi(c*a*Bnc&lt;J&gt;.real(), c*a*Bnc&lt;J&gt;.imag());&lt;BR /&gt;    complex&lt;DOUBLE&gt; ctemp = sqrt(Bna&lt;I&gt;/prvi);&lt;BR /&gt;    double itemp = int1(a,c,i,j,x1);&lt;BR /&gt;    complex&lt;DOUBLE&gt; ftemp(2*itemp*ctemp.real(), 2*itemp*ctemp.imag());&lt;BR /&gt;    Le[i*N1+j].real = ftemp.real();&lt;BR /&gt;    Le[i*N1+j].imag = ftemp.imag();&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;  complex&lt;DOUBLE&gt; alpha(1,0), beta(0,0);&lt;BR /&gt;  cblas_zgemm(CblasRowMajor, CblasNoTrans, CblasTrans, N, N, N1, α, Le, N1, Le, N1, β, L, N); /*&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;-------------------This is the place where the problem begins, it happens in all the other places with cblas_zgemm*/&lt;BR /&gt;  &lt;BR /&gt;  for (int i=0; i&lt;N&gt;&lt;/N&gt;   fprintf(fs12, "\n");&lt;BR /&gt;   for (int j=0; j&lt;N&gt;&lt;/N&gt;    fprintf(fs12, "%lf\t %1d %.18lf %.18lf\n", temp/1000000000, i*N+j, L[i*N+j].real, L[i*N+j].imag);&lt;BR /&gt;   }&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;  for (int i=0; i&lt;N&gt;&lt;/N&gt;   for (int j=0; j&lt;N&gt;&lt;/N&gt;    Li[i*N+j]=L[i*N+j];&lt;BR /&gt;    Ld[i*N+j]=L[i*N+j];&lt;BR /&gt;    if (i==j) {&lt;BR /&gt;     Li[i*N+j].real++;&lt;BR /&gt;     Ld[i*N+j].real--;&lt;BR /&gt;    }&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;  zgetrf(MLi, NLi, Li, ldaLi, ipivLi, infoLi);&lt;BR /&gt;&lt;BR /&gt;  zgetri(NLi, Li, ldaLi, ipivLi, work, &amp;amp;lworkLi, infoLi);&lt;BR /&gt;&lt;BR /&gt;  cblas_zgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, N, N, N, α, Li, N, Ld, N, β, s11, N);&lt;BR /&gt;&lt;BR /&gt;  /*for (int i=0; i&lt;N&gt;&lt;/N&gt;   fprintf(fs12, "\n");&lt;BR /&gt;   for (int j=0; j&lt;N&gt;&lt;/N&gt;    fprintf(fs12, "%lf\t %1d %.15lf %.15lf\n", temp/1000000000, i*N+j, s11[i*N+j].real, s11[i*N+j].imag);&lt;BR /&gt;   }&lt;BR /&gt;  }*/&lt;BR /&gt;&lt;BR /&gt;  alpha+=complex&lt;DOUBLE&gt;(1,0);&lt;BR /&gt;&lt;BR /&gt;  cblas_zgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, N, N1, N, α, Li, N, Le, N1, β, s12, N1);&lt;BR /&gt;&lt;BR /&gt;  for (int i=0; i&lt;N&gt;&lt;/N&gt;   for (int j=0; j&lt;N&gt;&lt;/N&gt;    neka[i*N+j].real = -s11[i*N+j].real;&lt;BR /&gt;    neka[i*N+j].imag = -s11[i*N+j].imag;&lt;BR /&gt;    if (i==j) neka[i*N+j].real++;&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;  alpha-=complex&lt;DOUBLE&gt;(1,0);&lt;BR /&gt;&lt;BR /&gt;  cblas_zgemm(CblasRowMajor, CblasTrans, CblasNoTrans, N1, N, N, α, Le, N1, neka, N, β, s21, N);&lt;BR /&gt;&lt;BR /&gt;  cblas_zgemm(CblasRowMajor, CblasTrans, CblasNoTrans, N1, N1, N, α, Le, N1, s12, N1, β, neka1, N1);&lt;BR /&gt;&lt;BR /&gt;  for (int i=0; i&lt;N1&gt;&lt;/N1&gt;   for (int j=0; j&lt;N1&gt;&lt;/N1&gt;    s22[i*N1+j].real = -neka1[i*N1+j].real;&lt;BR /&gt;    s22[i*N1+j].imag = -neka1[i*N1+j].imag;&lt;BR /&gt;    if (i==j) s22[i*N1+j].real++;&lt;BR /&gt;   }&lt;BR /&gt; if (temp==f1)&lt;BR /&gt;   fprintf(fs11," &amp;gt; GHz %1d\n ", lworkLi); &lt;BR /&gt;  //else if (temp&amp;gt;=f1) { &lt;BR /&gt;   fprintf(fs11, "%lf\t %1d %1d 0 0 0 0 %.15lf %.15lf\n", temp/1000000000, 1, 1, s11[0].real, s11[0].imag);&lt;BR /&gt;   fprintf(fs11, "%lf\t %1d %1d 0 0 0 0 %.15lf %.15lf\n", temp/1000000000, 1, 2, s12[0].real, s12[0].imag);&lt;BR /&gt;   fprintf(fs11, "%lf\t %1d %1d 0 0 0 0 %.15lf %.15lf\n", temp/1000000000, 2, 1, s21[0].real, s21[0].imag);&lt;BR /&gt;   fprintf(fs11, "%lf\t %1d %1d 0 0 0 0 %.15lf %.15lf\n", temp/1000000000, 2, 2, s22[0].real, s22[0].imag);&lt;BR /&gt;  //}&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; fclose(fs11);&lt;BR /&gt; fclose(fs12);&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; delete[] Bna;&lt;BR /&gt; delete[] Bnc;&lt;BR /&gt; delete[] Le;&lt;BR /&gt; delete[] L;&lt;BR /&gt; delete[] Li;&lt;BR /&gt; delete NLi;&lt;BR /&gt; delete MLi;&lt;BR /&gt; delete ldaLi;&lt;BR /&gt; delete[] Ld;&lt;BR /&gt; delete[] work;&lt;BR /&gt; delete[] s11;&lt;BR /&gt; delete[] s12;&lt;BR /&gt; delete[] s21;&lt;BR /&gt; delete[] s22;&lt;BR /&gt; delete[] neka;&lt;BR /&gt; delete[] neka1;&lt;BR /&gt; delete[] ipivLi;&lt;BR /&gt; delete infoLi;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;///////////////////////////&lt;BR /&gt;



&lt;BR /&gt;



prog.cpp&lt;BR /&gt;



&lt;BR /&gt;



//////////////////////////&lt;BR /&gt;&lt;BR /&gt;#include &lt;IOSTREAM&gt;&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;#include &lt;COMPLEX&gt;&lt;BR /&gt;#include "int1.h"&lt;BR /&gt;#include "hstep.h"&lt;BR /&gt;&lt;BR /&gt;extern "C" {&lt;BR /&gt;#include"mkl_cblas.h"&lt;BR /&gt;#include"mkl_lapack.h"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;int main() {&lt;BR /&gt;&lt;BR /&gt; clock_t t1 = clock();&lt;BR /&gt; Alfa::hstep("", 0.1, 0.08, 0, 20, 1.8, 2.4, 3);&lt;BR /&gt; clock_t t2 = clock();&lt;BR /&gt;&lt;BR /&gt; cout &amp;lt;&amp;lt; (double)(t2-t1)/CLOCKS_PER_SEC;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks to all, i hope that i didnt make any stupid errors.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/COMPLEX&gt;&lt;/TIME.H&gt;&lt;/IOSTREAM&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/I&gt;&lt;/DOUBLE&gt;&lt;/J&gt;&lt;/J&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/N1&gt;&lt;/DOUBLE&gt;&lt;/N&gt;&lt;/N&gt;&lt;/DOUBLE&gt;&lt;/N&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/CMATH&gt;&lt;/COMPLEX&gt;&lt;/IOSTREAM&gt;&lt;/CMATH&gt;</description>
      <pubDate>Wed, 25 Aug 2010 15:27:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835102#M6017</guid>
      <dc:creator>andragon</dc:creator>
      <dc:date>2010-08-25T15:27:13Z</dc:date>
    </item>
    <item>
      <title>cblas_zgemm problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835103#M6018</link>
      <description>The error is not caused by MKL, but by a misuse on your part of a floating point expression. When you call function &lt;I&gt;int1 &lt;/I&gt;with a=0.1, c=0.08, n=14 and m=11, the test &lt;I&gt;if (n*c!=a*m)&lt;/I&gt; can fail to perform as you intended it to. The test succeeds only if &lt;SPAN style="text-decoration: underline;"&gt;all bits&lt;/SPAN&gt; of n*c and a*m coincide. However, because of the inability to represent numbers exactly, 15*0.08 need not equal 12*0.1. To see this, add the following statement prior to the test and look at the output produced:&lt;BR /&gt;&lt;PRE&gt;[cpp]    if(n==15 &amp;amp;&amp;amp; m==12)printf("n=%d, m=%d, n*c==a*m? %sn",n,m,n*c==a*m ? "yes":"no");&lt;BR /&gt;[/cpp]&lt;/PRE&gt; To avoid this error, replace the test by something similar to&lt;BR /&gt;&lt;PRE&gt;[bash]if(fabs(n*c/(a*m)-1) &amp;gt; 1e-8)&lt;BR /&gt;[/bash]&lt;/PRE&gt; in whatever programming language you use (C++, Fortran, Matlab, etc.).&lt;BR /&gt;&lt;BR /&gt;For helpful discussions on this and related topics, see &lt;A href="http://docs.sun.com/source/806-3568/ncg_goldberg.html"&gt;Goldberg's article&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;There is a second lesson to be drawn from this example: it would have been impossible to make a diagnosis based on your first post in this thread. With the full code available, on the other hand, one could have given the Intel compiler the -Wall option to receive the helpful warning:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[bash]int1.cpp(12): remark #1572: floating-point equality and inequality comparisons are unreliable&lt;BR /&gt;      if (n*c!=a*m) {&lt;BR /&gt;[/bash]&lt;/PRE&gt; After you have corrected for this point, you will need to fix another potential source of error. The GEMM routines perform the operation&lt;BR /&gt;&lt;BR /&gt; C = alpha op(A) op(B) + beta C&lt;BR /&gt;&lt;BR /&gt;and, therefore, C has to be initialized before calling the routine, unless &lt;I&gt;beta&lt;/I&gt; is zero and the elements of C are well-defined.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Aug 2010 23:29:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835103#M6018</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2010-08-25T23:29:08Z</dc:date>
    </item>
    <item>
      <title>cblas_zgemm problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835104#M6019</link>
      <description>Thanks man, you have helped me alot. Sorry for the stupid error, i am kind of a begginer. Live and learn, right. Thanks again.</description>
      <pubDate>Sun, 29 Aug 2010 13:10:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-zgemm-problem/m-p/835104#M6019</guid>
      <dc:creator>andragon</dc:creator>
      <dc:date>2010-08-29T13:10:50Z</dc:date>
    </item>
  </channel>
</rss>

