<?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 Re: Question: 2d array in C language for Lapack fortran library in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-2d-array-in-C-language-for-Lapack-fortran-library/m-p/893768#M10628</link>
    <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Hello, Joon.&lt;BR /&gt;&lt;BR /&gt;MKL will publish LAPACK C examples soon, there will be dgels example, illustrating 1-d arrays usage. For instance, if you needto solve the problem with the matrix 4-by-4:&lt;BR /&gt;&lt;BR /&gt;1.44 -7.84 -4.39 4.53&lt;BR /&gt;-9.96 -0.28 -3.24 3.83&lt;BR /&gt;-7.55 3.24 6.27 -6.64&lt;BR /&gt;8.34 8.09 5.28 2.06&lt;BR /&gt;&lt;BR /&gt;and right-hand side:&lt;BR /&gt;&lt;BR /&gt;8.58&lt;BR /&gt;8.26&lt;BR /&gt;8.48&lt;BR /&gt;-5.28&lt;BR /&gt;&lt;BR /&gt;you need to initialize the arrays as follows:&lt;BR /&gt;&lt;BR /&gt;int n = 4, nrhs = 1, info, lwork = 100; // Use lwork no less than minimal recommended, or query it&lt;BR /&gt;double work[100];&lt;BR /&gt;double a[4*4] = {&lt;BR /&gt;1.44, -9.96, -7.55, 8.34,&lt;BR /&gt;-7.84, -0.28, 3.24, 8.09,&lt;BR /&gt;-4.39, -3.24, 6.27, 5.28,&lt;BR /&gt;4.53, 3.83, -6.64, 2.06&lt;BR /&gt;};&lt;BR /&gt;double b[4*1] = {&lt;BR /&gt;8.58, 8.26, 8.48, -5.28&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;to call dgels:&lt;BR /&gt;&lt;BR /&gt;dgels( "No transpose", &amp;amp;n, &amp;amp;n, &amp;amp;nrhs, a, &amp;amp;n, b, &amp;amp;n, work, &amp;amp;lwork, &amp;amp;info );&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You may want to put the data into 2-d array instead1-dwith absoluetely the same order of elements:&lt;BR /&gt;&lt;BR /&gt;double a2d[4][4] = {&lt;BR /&gt;1.44, -9.96, -7.55, 8.34,&lt;BR /&gt;-7.84, -0.28, 3.24, 8.09,&lt;BR /&gt;-4.39, -3.24, 6.27, 5.28,&lt;BR /&gt;4.53, 3.83, -6.64, 2.06&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;but in this case you need to specify input data differently to pass the pointer to the first element of the array:&lt;BR /&gt;&lt;BR /&gt;dgels( "No transpose", &amp;amp;n, &amp;amp;n, &amp;amp;nrhs, *a2d, &amp;amp;n, b, &amp;amp;n, work, &amp;amp;lwork, &amp;amp;info );&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;dgels( "No transpose", &amp;amp;n, &amp;amp;n, &amp;amp;nrhs, a2d[0], &amp;amp;n, b, &amp;amp;n, work, &amp;amp;lwork, &amp;amp;info );&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Michael.</description>
    <pubDate>Tue, 09 Jun 2009 09:16:31 GMT</pubDate>
    <dc:creator>Michael_C_Intel4</dc:creator>
    <dc:date>2009-06-09T09:16:31Z</dc:date>
    <item>
      <title>Question: 2d array in C language for Lapack fortran library.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-2d-array-in-C-language-for-Lapack-fortran-library/m-p/893767#M10627</link>
      <description>can someone help me ?&lt;BR /&gt;I need to use lapack functions is C.&lt;BR /&gt;&lt;BR /&gt;for example,&lt;BR /&gt;&lt;BR /&gt;dgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy) for matrix vector multiplication or&lt;BR /&gt;dgels(trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info) for LS solution using QR factorization,&lt;BR /&gt;&lt;BR /&gt;Can someone inform me &lt;BR /&gt;how to define the 2 D array and 1 D array correctly ?formatrix a and vector b in above functions ?&lt;BR /&gt;&lt;BR /&gt; I was using one - d array instead of 2 -d like&lt;BR /&gt;&lt;BR /&gt;a[100] instead of a[10][10] and put the elements in a[100] as column based format and used for above functions,&lt;BR /&gt;dgemv worked but dgels give me segmentation faults error.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;Joon.</description>
      <pubDate>Wed, 27 May 2009 16:05:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-2d-array-in-C-language-for-Lapack-fortran-library/m-p/893767#M10627</guid>
      <dc:creator>kimjoonshikgmail_com</dc:creator>
      <dc:date>2009-05-27T16:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Question: 2d array in C language for Lapack fortran library</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-2d-array-in-C-language-for-Lapack-fortran-library/m-p/893768#M10628</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Hello, Joon.&lt;BR /&gt;&lt;BR /&gt;MKL will publish LAPACK C examples soon, there will be dgels example, illustrating 1-d arrays usage. For instance, if you needto solve the problem with the matrix 4-by-4:&lt;BR /&gt;&lt;BR /&gt;1.44 -7.84 -4.39 4.53&lt;BR /&gt;-9.96 -0.28 -3.24 3.83&lt;BR /&gt;-7.55 3.24 6.27 -6.64&lt;BR /&gt;8.34 8.09 5.28 2.06&lt;BR /&gt;&lt;BR /&gt;and right-hand side:&lt;BR /&gt;&lt;BR /&gt;8.58&lt;BR /&gt;8.26&lt;BR /&gt;8.48&lt;BR /&gt;-5.28&lt;BR /&gt;&lt;BR /&gt;you need to initialize the arrays as follows:&lt;BR /&gt;&lt;BR /&gt;int n = 4, nrhs = 1, info, lwork = 100; // Use lwork no less than minimal recommended, or query it&lt;BR /&gt;double work[100];&lt;BR /&gt;double a[4*4] = {&lt;BR /&gt;1.44, -9.96, -7.55, 8.34,&lt;BR /&gt;-7.84, -0.28, 3.24, 8.09,&lt;BR /&gt;-4.39, -3.24, 6.27, 5.28,&lt;BR /&gt;4.53, 3.83, -6.64, 2.06&lt;BR /&gt;};&lt;BR /&gt;double b[4*1] = {&lt;BR /&gt;8.58, 8.26, 8.48, -5.28&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;to call dgels:&lt;BR /&gt;&lt;BR /&gt;dgels( "No transpose", &amp;amp;n, &amp;amp;n, &amp;amp;nrhs, a, &amp;amp;n, b, &amp;amp;n, work, &amp;amp;lwork, &amp;amp;info );&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You may want to put the data into 2-d array instead1-dwith absoluetely the same order of elements:&lt;BR /&gt;&lt;BR /&gt;double a2d[4][4] = {&lt;BR /&gt;1.44, -9.96, -7.55, 8.34,&lt;BR /&gt;-7.84, -0.28, 3.24, 8.09,&lt;BR /&gt;-4.39, -3.24, 6.27, 5.28,&lt;BR /&gt;4.53, 3.83, -6.64, 2.06&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;but in this case you need to specify input data differently to pass the pointer to the first element of the array:&lt;BR /&gt;&lt;BR /&gt;dgels( "No transpose", &amp;amp;n, &amp;amp;n, &amp;amp;nrhs, *a2d, &amp;amp;n, b, &amp;amp;n, work, &amp;amp;lwork, &amp;amp;info );&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;dgels( "No transpose", &amp;amp;n, &amp;amp;n, &amp;amp;nrhs, a2d[0], &amp;amp;n, b, &amp;amp;n, work, &amp;amp;lwork, &amp;amp;info );&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Michael.</description>
      <pubDate>Tue, 09 Jun 2009 09:16:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-2d-array-in-C-language-for-Lapack-fortran-library/m-p/893768#M10628</guid>
      <dc:creator>Michael_C_Intel4</dc:creator>
      <dc:date>2009-06-09T09:16:31Z</dc:date>
    </item>
  </channel>
</rss>

