<?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 Hello Mario, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036159#M20422</link>
    <description>&lt;P&gt;Hello Mario,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Generally, interpolation results computed with Data Fitting routines of Intel® MKL are represented as 3-dimensional array r of size NY x NSITE x ndorder. The results are packed in the following way:&lt;/SPAN&gt;&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;NSITE x ndorder array of &amp;nbsp;interpolation results of the 1-st coordinate of vector-valued function;&lt;/LI&gt;
	&lt;LI&gt;NSITE x ndorder array of interpolation results of the 2-nd coordinate of vector-valued function;&lt;/LI&gt;
	&lt;LI&gt;...&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The flag rhint specifies how to pack the array of size NSITE x ndorder for each coordinate of the function. In your example ndorder=1, thus, the results in row-major format are the same as in column-major format.&lt;/P&gt;

&lt;P&gt;Please have a look at the Intel® MKL documentation section that provides additional details on the storage format of interpolation results &amp;nbsp;&lt;A href="https://software.intel.com/en-us/node/522231"&gt;https://software.intel.com/en-us/node/522231&lt;/A&gt; and &amp;nbsp;let us know, if you have any additional questions on the Data Fitting component of the library.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Victoriya&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Sep 2015 12:56:40 GMT</pubDate>
    <dc:creator>VictoriyaS_F_Intel</dc:creator>
    <dc:date>2015-09-21T12:56:40Z</dc:date>
    <item>
      <title>Data fitting of vector-valued function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036158#M20421</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a problem using the data fitting for a linear interpolation of a vector valued function. It seems that the format rhint is ignored by the function dfdInterpolate1D.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;iostream&amp;gt;
#include "mkl.h"

#define ALIGNMENT 64

int main(int argc, char** argv){

  DFTaskPtr task;
  MKL_INT NX = 3;
  MKL_INT NY = 2;

  double* x = (double*)mkl_malloc(NX*sizeof(double), ALIGNMENT);
  double* y = (double*)mkl_malloc(NX*NY*sizeof(double), ALIGNMENT);
  
  x[0] = 0; x[1] = 1; x[2] = 2;
  
  /* y is 2 dimensional in col-major format (y(0)=(0;1), y(1)=(5;1), y(3)=(10;1)) */
  y[0] = 0; y[1] = 1;
  y[2] = 5; y[3] = 1;
  y[4] = 10; y[5] = 1;
  MKL_INT yHint = DF_MATRIX_STORAGE_COLS;
  
  int status = dfdNewTask1D( &amp;amp;task, NX, x, DF_NO_HINT, NY, y, yHint);
  std::cout &amp;lt;&amp;lt; "Status after dfdNewTask1D: " &amp;lt;&amp;lt; status &amp;lt;&amp;lt; std::endl;
  

  MKL_INT s_order = DF_PP_LINEAR;
  MKL_INT s_type = DF_PP_DEFAULT;

  MKL_INT ic_type = DF_NO_IC; 
  double* ic = NULL;

  MKL_INT bc_type = DF_NO_BC; 
  double* bc = NULL;
  
  double* scoeff = (double*)mkl_malloc(NY*(NX-1)* s_order * sizeof(double), ALIGNMENT);
  MKL_INT scoeffhint = DF_NO_HINT; 

  status = dfdEditPPSpline1D( task, s_order, s_type, bc_type, bc, ic_type,
                              ic, scoeff, scoeffhint );
  std::cout &amp;lt;&amp;lt; "Status after dfdEditPPSpline1D: " &amp;lt;&amp;lt; status &amp;lt;&amp;lt; std::endl;
  
  
  status = dfdConstruct1D( task, DF_PP_SPLINE, DF_METHOD_STD );
  std::cout &amp;lt;&amp;lt; "Status after dfdConstruct1D: " &amp;lt;&amp;lt; status &amp;lt;&amp;lt; std::endl;
  
  MKL_INT NSITE = 2;
  double* site =  (double*)mkl_malloc(NSITE*sizeof(double), ALIGNMENT);
  site[0] = 0.5; site[1] = 1.5;
  MKL_INT sitehint = DF_NO_HINT;
  
  double* r = (double*)mkl_malloc(NSITE*NY*sizeof(double), ALIGNMENT);
  MKL_INT rhint = DF_MATRIX_STORAGE_COLS;
  
  MKL_INT ndorder = 1;
  MKL_INT dorder = 1;
  double* datahint = NULL;
  MKL_INT* cell = NULL;

  status = dfdInterpolate1D( task, DF_INTERP, DF_METHOD_PP, NSITE, site,
                             sitehint, ndorder, &amp;amp;dorder, datahint, r, rhint, cell );
  std::cout &amp;lt;&amp;lt; "Status after dfdInterpolate1D: " &amp;lt;&amp;lt; status &amp;lt;&amp;lt; std::endl;
  
  
  status = dfDeleteTask( &amp;amp;task );
  std::cout &amp;lt;&amp;lt; "Status after dfDeleteTask: " &amp;lt;&amp;lt; status &amp;lt;&amp;lt; std::endl;
  
  
  /* Print output */
  std::cout &amp;lt;&amp;lt; "scoeff = ( ";
  for (int i = 0; i&amp;lt;NY*(NX-1)* s_order; i++){
    std::cout &amp;lt;&amp;lt; scoeff&lt;I&gt; &amp;lt;&amp;lt; " ";
  }
  std::cout &amp;lt;&amp;lt; ")" &amp;lt;&amp;lt; std::endl;
  
  std::cout &amp;lt;&amp;lt; "r = ( ";
  for (int i = 0; i&amp;lt;NSITE*NY; i++){
    std::cout &amp;lt;&amp;lt; r&lt;I&gt; &amp;lt;&amp;lt; " ";
  }
  std::cout &amp;lt;&amp;lt; ")" &amp;lt;&amp;lt; std::endl;
  
  std::cout &amp;lt;&amp;lt; "r_expected = ( 2.5 1 7.5 1 )" &amp;lt;&amp;lt; std::endl;
  
  mkl_free(x);
  mkl_free(y);
  mkl_free(scoeff);
  mkl_free(site);
  mkl_free(r);
  
  return 0;
}

&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Output is (&lt;/STRONG&gt;Compiled on RedHat 64bit with parallel studio 2016&lt;STRONG&gt;):&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Status after dfdNewTask1D: 0&lt;/P&gt;

&lt;P&gt;Status after dfdEditPPSpline1D: 0&lt;/P&gt;

&lt;P&gt;Status after dfdConstruct1D: 0&lt;/P&gt;

&lt;P&gt;Status after dfdInterpolate1D: 0&lt;/P&gt;

&lt;P&gt;Status after dfDeleteTask: 0&lt;/P&gt;

&lt;P&gt;scoeff = ( 0 5 5 5 1 0 1 0 )&lt;/P&gt;

&lt;P&gt;r = ( 2.5 7.5 1 1 )&lt;/P&gt;

&lt;P&gt;r_expected = ( 2.5 1 7.5 1 )&lt;/P&gt;

&lt;P&gt;RUN FINISHED; exit value 0; real time: 30ms; user: 0ms; system: 0ms&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The output is written in row-major format to r instead of the choosen col-major format using rhint. Is there a problem with my code or is it not possible to get the expected format.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Mario&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 09:12:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036158#M20421</guid>
      <dc:creator>Mario_K_</dc:creator>
      <dc:date>2015-09-21T09:12:53Z</dc:date>
    </item>
    <item>
      <title>Hello Mario,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036159#M20422</link>
      <description>&lt;P&gt;Hello Mario,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Generally, interpolation results computed with Data Fitting routines of Intel® MKL are represented as 3-dimensional array r of size NY x NSITE x ndorder. The results are packed in the following way:&lt;/SPAN&gt;&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;NSITE x ndorder array of &amp;nbsp;interpolation results of the 1-st coordinate of vector-valued function;&lt;/LI&gt;
	&lt;LI&gt;NSITE x ndorder array of interpolation results of the 2-nd coordinate of vector-valued function;&lt;/LI&gt;
	&lt;LI&gt;...&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The flag rhint specifies how to pack the array of size NSITE x ndorder for each coordinate of the function. In your example ndorder=1, thus, the results in row-major format are the same as in column-major format.&lt;/P&gt;

&lt;P&gt;Please have a look at the Intel® MKL documentation section that provides additional details on the storage format of interpolation results &amp;nbsp;&lt;A href="https://software.intel.com/en-us/node/522231"&gt;https://software.intel.com/en-us/node/522231&lt;/A&gt; and &amp;nbsp;let us know, if you have any additional questions on the Data Fitting component of the library.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Victoriya&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 12:56:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036159#M20422</guid>
      <dc:creator>VictoriyaS_F_Intel</dc:creator>
      <dc:date>2015-09-21T12:56:40Z</dc:date>
    </item>
    <item>
      <title>Hello Victoriya,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036160#M20423</link>
      <description>&lt;P&gt;Hello Victoriya,&lt;/P&gt;

&lt;P&gt;thank you very much for your helpful comment.&lt;/P&gt;

&lt;P&gt;Due to my frame I have an input function in major-column format and I also want to have this format after interpolation.&lt;/P&gt;

&lt;P&gt;I could implement a function to convert from major-row to major-column by my own using cblas_dcopy&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;void majorRowToMajorCol(const unsigned int cGridSize, const unsigned int cDim, double* pSrc, double* pDst) 
{
  const int cIncrement = 1;
  const unsigned int cSize = cGridSize * cDim;
  double* pTemporary = mkl_alloc(cSize*sizeof(double), 64);
  cblas_dcopy(cSize, pSrc, cIncrement, pTemporary, cIncrement);
  for (int i = 0; i &amp;lt; cDim; i++){
    cblas_dcopy(cGridSize, &amp;amp;pTemporary[i*cDim], cIncrement, &amp;amp;pDst&lt;I&gt;, cDim);
  }
  mkl_free(pTemporary);
}&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;but is there any other way which is more perfomant? Is there a suitable function in MKL?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Mario&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 13:17:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036160#M20423</guid>
      <dc:creator>Mario_K_</dc:creator>
      <dc:date>2015-09-21T13:17:00Z</dc:date>
    </item>
    <item>
      <title>Mario,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036161#M20424</link>
      <description>&lt;P&gt;Mario,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;The results computed with Intel® MKL Data Fitting interpolation routines are currently packed in row-major format only.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;To come up with a suggestion can you please help me better understand additional details behind your request/question?&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;In particular, it would be useful to get a general idea about typical problem sizes such as dimension of vector valued function, number of interpolation sites and expected estimates (only values, or values and first order derivatives, etc) used in your application.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Additionally, how the column-major format you suggest is used in your subsequent computations? Do you need it to get additional performance benefit for your application, or it is used for usability reasons or something else?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Victoriya&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 10:28:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036161#M20424</guid>
      <dc:creator>VictoriyaS_F_Intel</dc:creator>
      <dc:date>2015-09-22T10:28:11Z</dc:date>
    </item>
    <item>
      <title>Hello Victoriya,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036162#M20425</link>
      <description>&lt;P&gt;Hello Victoriya,&lt;/P&gt;

&lt;P&gt;My typical problem is as follows. I have a complex valued 1-dimensional function F&amp;nbsp;on grids with a size ~300.000. Now I want to compute the values of F on another grid of similar size by linear interpolation (no derivatives). The data fitting interpolation routines only support real valued functions, but&amp;nbsp;one can interpret the complex function F as a real valued 2-dimensional function in major-column format by a cast i.e.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;MKL_COMPLEX16* F = (MKL_COMPLEX16*)mkl_malloc(300000*sizeof(MKL_COMPLEX16), 64);
double* realF = (double*)F;
...
/* Data fitting result */
double* realFInterpolated = ...
&lt;/PRE&gt;

&lt;P&gt;But I want to cast this result back to 1-dimensional complex function i.e.&lt;/P&gt;

&lt;PRE class="brush:;"&gt;MKL_COMPLEX16* FInterpolated = (MKL_COMPLEX16*)realFInterpolated;&lt;/PRE&gt;

&lt;P&gt;Here it is needed that realFInterpolated is also in major-column format. So I have to apply&amp;nbsp;majorRowToMajorCol to realFInterpolated&amp;nbsp;first.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Mario&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 07:26:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036162#M20425</guid>
      <dc:creator>Mario_K_</dc:creator>
      <dc:date>2015-09-23T07:26:00Z</dc:date>
    </item>
    <item>
      <title>Mario,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036163#M20426</link>
      <description>&lt;P&gt;Mario,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Thank you for the explanation of Intel® MKL Data Fitting usage scenario in your application.&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;This clarifies why having interpolation results in column-major order is necessary for you.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Currently the solution that you mentioned is a proper way to get the interpolation results in column-major format: you will need to re-pack the results after calling dfdInterpolate1D.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Can you please submit the feature request on support of the column-major format in the Data Fitting component of the library via Premier Support?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Victoriya&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 16:28:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Data-fitting-of-vector-valued-function/m-p/1036163#M20426</guid>
      <dc:creator>VictoriyaS_F_Intel</dc:creator>
      <dc:date>2015-09-23T16:28:04Z</dc:date>
    </item>
  </channel>
</rss>

