<?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 C# dtrnlspbc_init in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085834#M22967</link>
    <description>&lt;P&gt;I'm trying to understand how to declare and use in C#: RCI TR Routines for Problem with Bound Constraints.&lt;/P&gt;

&lt;P&gt;I have created a simple test console program, and declared just one function (dtrnlspbc_init) but &amp;nbsp;I receive that "there was an error in the input parameters".&lt;/P&gt;

&lt;P&gt;It is a Marshalling problem, I suppose, but I don't understand where there is the error.&lt;/P&gt;

&lt;P&gt;Is there someone that can help me?&lt;/P&gt;

&lt;P&gt;Thankyou&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Gianluca&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2017 15:43:05 GMT</pubDate>
    <dc:creator>Gianluca_G_1</dc:creator>
    <dc:date>2017-02-02T15:43:05Z</dc:date>
    <item>
      <title>C# dtrnlspbc_init</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085834#M22967</link>
      <description>&lt;P&gt;I'm trying to understand how to declare and use in C#: RCI TR Routines for Problem with Bound Constraints.&lt;/P&gt;

&lt;P&gt;I have created a simple test console program, and declared just one function (dtrnlspbc_init) but &amp;nbsp;I receive that "there was an error in the input parameters".&lt;/P&gt;

&lt;P&gt;It is a Marshalling problem, I suppose, but I don't understand where there is the error.&lt;/P&gt;

&lt;P&gt;Is there someone that can help me?&lt;/P&gt;

&lt;P&gt;Thankyou&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Gianluca&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 15:43:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085834#M22967</guid>
      <dc:creator>Gianluca_G_1</dc:creator>
      <dc:date>2017-02-02T15:43:05Z</dc:date>
    </item>
    <item>
      <title>Check the second and third</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085835#M22968</link>
      <description>&lt;P&gt;Check the second and third arguments to&amp;nbsp;dtrnlspbc_init(). I believe that you have them interchanged.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 01:11:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085835#M22968</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2017-02-03T01:11:13Z</dc:date>
    </item>
    <item>
      <title>Now it works! thank you </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085836#M22969</link>
      <description>&lt;P&gt;Now it works! &lt;SPAN style="font-size: 13.008px;"&gt;thank you&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;by the way the documentations it is not so clear.&lt;/P&gt;

&lt;P&gt;Best Regards&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Gianluca&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 08:26:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085836#M22969</guid>
      <dc:creator>Gianluca_G_1</dc:creator>
      <dc:date>2017-02-03T08:26:16Z</dc:date>
    </item>
    <item>
      <title>Which version of the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085837#M22970</link>
      <description>&lt;P&gt;Which version of the documentation do you mean? The current MKL documentation at&amp;nbsp;https://software.intel.com/en-us/node/471100#867C84A5-D029-4C48-B63B-B68E04CE043D clearly states that the second and third arguments are the number of variables and number of functions whose sum of squares is to be minimized.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 22:55:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085837#M22970</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2017-02-03T22:55:22Z</dc:date>
    </item>
    <item>
      <title>Hi Thank you a lot for the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085838#M22971</link>
      <description>&lt;P&gt;Hi Thank you a lot&amp;nbsp;for the reply&amp;nbsp;mecej4.&lt;/P&gt;

&lt;P&gt;Hi Gianluca,&lt;/P&gt;

&lt;P&gt;You can take the second and third arguments are x length &amp;nbsp;and F(x) length (or&amp;nbsp;&amp;nbsp; m - dimension of function value */.)&amp;nbsp;&lt;/P&gt;

&lt;P&gt;actually,&amp;nbsp; the&amp;nbsp;solver&amp;nbsp;required m&amp;gt;&amp;gt;n.Where &amp;nbsp;n is&amp;nbsp; array X's size; &amp;nbsp;m is&amp;nbsp; &lt;FONT size="2"&gt;&lt;SPAN class="fontstyle0"&gt;&lt;EM&gt;fvec &lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN class="fontstyle2"&gt;&lt;FONT face="Verdana"&gt;Array of size &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="fontstyle3"&gt;&lt;EM&gt;m.&amp;nbsp; So you may be change the m = xxx. when go to &lt;/EM&gt;solve step based on your fvec. &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN class="fontstyle3"&gt;Best Regards,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN class="fontstyle3"&gt;Ying &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;BR style="text-transform: none; line-height: normal; text-indent: 0px; letter-spacing: normal; font-style: normal; font-variant: normal; font-weight: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2017 03:42:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085838#M22971</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2017-02-04T03:42:19Z</dc:date>
    </item>
    <item>
      <title>If I read this page https:/</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085839#M22972</link>
      <description>&lt;P&gt;If I read this page&amp;nbsp;https://software.intel.com/en-us/node/471100#867C84A5-D029-4C48-B63B-B68E04CE043D,&lt;/P&gt;

&lt;P&gt;n is the number of variables and, m is the number of functions. In my case I have n=5 and m=1 but this is not allowed because m &amp;gt;&amp;gt; n.&lt;/P&gt;

&lt;P&gt;Maybe the parameter are swapped in the &lt;SPAN style="font-size: 12px;"&gt;dtrnlspbc_init().&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Best Regards&lt;/P&gt;

&lt;P&gt;Gianluca&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2017 07:57:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085839#M22972</guid>
      <dc:creator>Gianluca_G_1</dc:creator>
      <dc:date>2017-02-04T07:57:51Z</dc:date>
    </item>
    <item>
      <title>In that case, you are</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085840#M22973</link>
      <description>&lt;P&gt;In that case, you are attempting to obtain five unknowns from a single scalar observation, i.e., you have a standard bound-constrained minimization problem -- instead of the kind of problem that ?TRNLSBC is designed to solve -- a least-squares minimization of an overdetermined problem. For your class of problems, you should use a solver such as those listed for that class in &lt;A href="http://plato.asu.edu/sub/nlores.html" target="_blank"&gt;http://plato.asu.edu/sub/nlores.html&lt;/A&gt; and&amp;nbsp;http://plato.asu.edu/sub/nlounres.html&amp;nbsp;.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2017 10:42:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085840#M22973</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2017-02-04T10:42:07Z</dc:date>
    </item>
    <item>
      <title>Thank you for your</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085841#M22974</link>
      <description>&lt;P&gt;Thank you for your suggestions.&lt;/P&gt;

&lt;P&gt;now it is more clear to me, by the way, I've implemented a test code like the example in the web page (https://software.intel.com/en-us/node/522321).&lt;/P&gt;

&lt;P&gt;The objective_function is my_function().&lt;/P&gt;

&lt;P&gt;The loop exited correctly but I can't understand where to find the solution!&lt;/P&gt;

&lt;P&gt;check row code number 411.&lt;/P&gt;

&lt;P&gt;What I miss?&lt;/P&gt;

&lt;P&gt;Thank you very much&lt;/P&gt;

&lt;P&gt;Gianluca&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 14:54:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085841#M22974</guid>
      <dc:creator>Gianluca_G_1</dc:creator>
      <dc:date>2017-02-06T14:54:53Z</dc:date>
    </item>
    <item>
      <title>The solution is in xres[],</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085842#M22975</link>
      <description>&lt;P&gt;The solution is in xres[], since you used Marshall.Copy to put it there. All that you have to do is to add a formatted output statement such as&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(string.Format("{0:0.00} {1:0.00} {2:0.00} {3:0.00} {4:0.00}",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xres[0],xres[1],xres[2],xres[3],xres[4]));&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 23:56:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085842#M22975</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2017-02-06T23:56:41Z</dc:date>
    </item>
    <item>
      <title>I'm sorry, maybe I was not</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085843#M22976</link>
      <description>&lt;P&gt;I'm sorry, maybe I was not clear ...&lt;/P&gt;

&lt;P&gt;Do you really thought that after the Marshal.Copy(), I couldn't get the array values?&lt;/P&gt;

&lt;P&gt;The problem is that the result it is not right!&lt;/P&gt;

&lt;P&gt;I mean, these are the initial values. The solutions should be differents.&lt;/P&gt;

&lt;P&gt;These should be the correct results:&lt;/P&gt;

&lt;P&gt;0 = 197&lt;BR /&gt;
	1 = 351&lt;BR /&gt;
	2 = 185&lt;BR /&gt;
	3 = 1,7&lt;BR /&gt;
	4 = 8,8&lt;/P&gt;

&lt;P&gt;We are sure of this, because we got it with another algoritms (Amoeba)&lt;/P&gt;

&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Gianluca&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 07:18:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085843#M22976</guid>
      <dc:creator>Gianluca_G_1</dc:creator>
      <dc:date>2017-02-07T07:18:01Z</dc:date>
    </item>
    <item>
      <title>mecej4 i got the solution!</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085844#M22977</link>
      <description>&lt;P&gt;mecej4 i got the solution!&lt;/P&gt;

&lt;P&gt;now it works ....&lt;/P&gt;

&lt;P&gt;I forgot to copy the result with Marshal.Copy &amp;nbsp;in my_function proc.&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;public static void my_function(ref int m, ref int n, [In] IntPtr xp, [Out] IntPtr fp)
        {
            double[] x = new double&lt;N&gt;;
            Marshal.Copy(xp, x, 0, n);
            double[] f = new double&lt;M&gt;;
            Marshal.Copy(fp, f, 0, m);

            double rho1 = x[0];
            double rho2 = x[1];
            double rho3 = x[2];
            double h1 = x[3];
            double h2 = x[4];

            //double phi = 0;
            //int iN = m; // mlMeasures.Count; //Da inserire

            for (int i = 0; i &amp;lt; m; i++)
            {
                f&lt;I&gt; = Math.Pow((mlMeasures&lt;I&gt;.RhoM - RhoCalc(mlMeasures&lt;I&gt;.A, rho1, rho2, rho3, h1, h2)) / mlMeasures&lt;I&gt;.RhoM, 2);
            }

            Marshal.Copy(f, 0, fp, m);
        }&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/M&gt;&lt;/N&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you very much&lt;/P&gt;

&lt;P&gt;Gianluca&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 08:05:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-dtrnlspbc-init/m-p/1085844#M22977</guid>
      <dc:creator>Gianluca_G_1</dc:creator>
      <dc:date>2017-02-07T08:05:13Z</dc:date>
    </item>
  </channel>
</rss>

