<?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: How to make an analogue of the polyfit() function from Matlab using OneMKL in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1287446#M31455</link>
    <description>&lt;P&gt;There is C code in an &lt;A href="https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-Using-Lapack-for-Getting-Least-Squares-Fit-Polynomial/m-p/1003891" target="_self"&gt;earlier post&lt;/A&gt; in this forum for using LapackE-GELS to fit a polynomial in two independent variables, x and y. You can adapt that code by simply removing the portions that contain y and adjusting the indices of the regression matrix A to match.&lt;/P&gt;</description>
    <pubDate>Sat, 05 Jun 2021 11:34:37 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2021-06-05T11:34:37Z</dc:date>
    <item>
      <title>How to make an analogue of the polyfit() function from Matlab using OneMKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1286941#M31441</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to make a function that performs the most suitable (in the sense of least squares) polynomial in one variable from Cartesian coordinates.&lt;/P&gt;
&lt;P&gt;There is such a function in Matlab - it is called &lt;STRONG&gt;polyfit()&lt;/STRONG&gt;.&lt;BR /&gt;I know that OneMKL has a set of functions that do piecewise linear interpolation using &lt;STRONG&gt;splines&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;I cannot figure out how to use OnMKL to make an analogue of the&amp;nbsp;from Matlab's &lt;STRONG&gt;polyfit()&lt;/STRONG&gt; function?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 16:35:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1286941#M31441</guid>
      <dc:creator>Serjio</dc:creator>
      <dc:date>2021-06-03T16:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to make an analogue of the polyfit() function from Matlab using OneMKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1286946#M31442</link>
      <description>&lt;P&gt;Given m-vectors x and y, to fit a polynomial of degree n, form the m X (n+1) Vandermonde matrix, and call MKL/Lapack GELS.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 16:59:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1286946#M31442</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2021-06-03T16:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to make an analogue of the polyfit() function from Matlab using OneMKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1287219#M31451</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;SPAN&gt;mecej4.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks for your reply.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I understood, I need to use&amp;nbsp;MKL/Lapack GELS. Ok.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But could you explain more detail please, how to use, for example dgets().&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In my opinion, I should send the input data &lt;STRONG&gt;x()&lt;/STRONG&gt; and &lt;STRONG&gt;y()&lt;/STRONG&gt; and receive in response the coefficients of the polynomial &lt;STRONG&gt;C0, C1&lt;/STRONG&gt;.&amp;nbsp;I don't understand where I should insert my x() and y() data.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;// Function prototype
dgels( const char* trans, const MKL_INT* m, const MKL_INT* n,
       const MKL_INT* nrhs, double* a, const MKL_INT* lda, double* b,
       const MKL_INT* ldb, double* work, const MKL_INT* lwork,
       MKL_INT* info  );

// I have 2 vectors:
std::vector&amp;lt;double&amp;gt; x = {2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0}; // the size is variable
std::vector&amp;lt;double&amp;gt; y = {10.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0};

// Prepare data for dgels()
#define PolynomOrder 1
int m = x.size();         // number of rows of the matrix A
int n = PolynomOrder + 1; // number of of columns of the matrix A
int nrhs = 1;             // the number of columns in B
int lda = std::max(1, m);
int ldb = std::max(std::max(1, m), n);
int lwork = std::min(m, n)+ std::max(std::max(1, m), std::max(n, nrhs));
double work;              // What is this?
int info = 0;

// ...form the Vandermonde matrix - mX(n+1) | How to do it?



&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 13:10:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1287219#M31451</guid>
      <dc:creator>Serjio</dc:creator>
      <dc:date>2021-06-04T13:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to make an analogue of the polyfit() function from Matlab using OneMKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1287446#M31455</link>
      <description>&lt;P&gt;There is C code in an &lt;A href="https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-Using-Lapack-for-Getting-Least-Squares-Fit-Polynomial/m-p/1003891" target="_self"&gt;earlier post&lt;/A&gt; in this forum for using LapackE-GELS to fit a polynomial in two independent variables, x and y. You can adapt that code by simply removing the portions that contain y and adjusting the indices of the regression matrix A to match.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jun 2021 11:34:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1287446#M31455</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2021-06-05T11:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to make an analogue of the polyfit() function from Matlab using OneMKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1288961#M31488</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for accepting as a Solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As this issue has been resolved, we will no longer respond to this thread. If you require any additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a Good day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Rajesh&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 05:30:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-make-an-analogue-of-the-polyfit-function-from-Matlab/m-p/1288961#M31488</guid>
      <dc:creator>MRajesh_intel</dc:creator>
      <dc:date>2021-06-22T05:30:53Z</dc:date>
    </item>
  </channel>
</rss>

