<?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 Nonlinear Least Squares Problem with Linear (Bound) Constraints in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonlinear-Least-Squares-Problem-with-Linear-Bound-Constraints/m-p/1186576#M29621</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I noticed that the nonlinear solver uses central difference to calculate the Jacobi matrix, I was wondering is it possible to pass the analytical Jacobi elements to the code or not? I mean, in my problem, I want to use analytical Jacobi instead of numerical Jacobi. How can I do that?&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;Javad&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jun 2020 08:25:48 GMT</pubDate>
    <dc:creator>Shokriafra__Mohammad</dc:creator>
    <dc:date>2020-06-18T08:25:48Z</dc:date>
    <item>
      <title>Nonlinear Least Squares Problem with Linear (Bound) Constraints</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonlinear-Least-Squares-Problem-with-Linear-Bound-Constraints/m-p/1186576#M29621</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I noticed that the nonlinear solver uses central difference to calculate the Jacobi matrix, I was wondering is it possible to pass the analytical Jacobi elements to the code or not? I mean, in my problem, I want to use analytical Jacobi instead of numerical Jacobi. How can I do that?&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;Javad&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 08:25:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonlinear-Least-Squares-Problem-with-Linear-Bound-Constraints/m-p/1186576#M29621</guid>
      <dc:creator>Shokriafra__Mohammad</dc:creator>
      <dc:date>2020-06-18T08:25:48Z</dc:date>
    </item>
    <item>
      <title>The nonlinear solver uses the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonlinear-Least-Squares-Problem-with-Linear-Bound-Constraints/m-p/1186577#M29622</link>
      <description>&lt;P&gt;The nonlinear solver uses the reverse call interface. When RCI_REQUEST is equal to 2, you have to update the Jacobian matrix FJAC and call the solver again. The method used for calculating the Jacobian is entirely in your hands.&amp;nbsp; You can enter formulae for the elements of the Jacobian in line, or in a separate subroutine that you write and call; you can&amp;nbsp;use&amp;nbsp;finite difference approximations for some or all elements, or obtain the derivatives from a finite-field extension using complex variables.&lt;/P&gt;&lt;P&gt;You can, for example, take the furnished testcase ex_nlsqp_f.f and modify it so that FJAC is calculated analytically instead of calling DJACOBI.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 13:48:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonlinear-Least-Squares-Problem-with-Linear-Bound-Constraints/m-p/1186577#M29622</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-06-19T13:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: The nonlinear solver uses the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonlinear-Least-Squares-Problem-with-Linear-Bound-Constraints/m-p/1188388#M29656</link>
      <description>&lt;P&gt;Thanks for your reply,&lt;/P&gt;
&lt;P&gt;I am using this solver in C++, I used the "ex_nlsqp_bc_c.c" example and tried to implement what you mentioned as the following.&lt;/P&gt;
&lt;P&gt;I defined the function as&lt;/P&gt;
&lt;P&gt;extern void jacobian(MKL_INT *, MKL_INT *, double *, double *);&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;I called the Jacobian function as&lt;/P&gt;
&lt;P&gt;if (RCI_Request == 2)&lt;BR /&gt;{&lt;BR /&gt;jacobian(&amp;amp;m, &amp;amp;n, x, fjac);&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;and defined the Jacobian like the following:&lt;/P&gt;
&lt;P&gt;void jacobian(MKL_INT * m, MKL_INT * n, double *x, double *fj)&lt;BR /&gt;{&lt;BR /&gt;fj[0] = 2 * x[0];&lt;BR /&gt;fj[1] = 2 * x[1];&lt;BR /&gt;fj[2] = 1;&lt;BR /&gt;fj[3] = -1;&lt;/P&gt;
&lt;P&gt;return;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;The function was defined as:&lt;/P&gt;
&lt;P&gt;void extended_powell(MKL_INT * m, MKL_INT * n, double *x, double *f)&lt;BR /&gt;{&lt;BR /&gt;f[0] = pow(x[0],2) + pow(x[1],2) - 9;&lt;BR /&gt;f[1] = x[0] - x[1] + 3;&lt;/P&gt;
&lt;P&gt;return;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;When I call the jacobian, unfortunately it does not work, but if I call djacobi it works.&lt;/P&gt;
&lt;P&gt;I tracked the iteration of jacobian, it does around 20 iterations and becomes close to the solution, but I do not know why it fails after several iteration while it is getting closer to the correct solution.&lt;/P&gt;
&lt;P&gt;The correct solution for this problem is "zero" and "3", and in the following I printed the two last iterations of the solution when I am using jacobian.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;x1= 0.10554969128064530&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x2= 2.9935339376683032&lt;/P&gt;
&lt;P&gt;x1= 0.10554965354656229&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;x2=&amp;nbsp;2.9935339407828785&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help me?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 12:42:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonlinear-Least-Squares-Problem-with-Linear-Bound-Constraints/m-p/1188388#M29656</guid>
      <dc:creator>Shokriafra__Mohammad</dc:creator>
      <dc:date>2020-06-30T12:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: The nonlinear solver uses the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonlinear-Least-Squares-Problem-with-Linear-Bound-Constraints/m-p/1188621#M29661</link>
      <description>&lt;P&gt;I wrote a detailed reply, but the forum software marked it as spam and removed it. Here is a short replacement:&lt;/P&gt;
&lt;P&gt;Your Jacobian vector arranges the elements of the 2-dimensional matrix in row-major order. The MKL routine may expect it to be in column-major (as in Fortran) order. Try printing out the values of &lt;STRONG&gt;fjac&lt;/STRONG&gt;&amp;nbsp;from the finite-difference calculation and compare those with the analytically calculated values for accuracy and matching order.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 02:29:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonlinear-Least-Squares-Problem-with-Linear-Bound-Constraints/m-p/1188621#M29661</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-07-01T02:29:42Z</dc:date>
    </item>
  </channel>
</rss>

