<?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 In general, it is not correct in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070770#M22252</link>
    <description>&lt;P&gt;In general, it is not correct to alias one subroutine argument to another argument, unless the documentation explicitly lists arguments that may be aliased.&lt;/P&gt;

&lt;P&gt;The Fortran standard prohibits such aliasing of arguments, and being able to rely on arguments being distinct is what enables many code optimizations to be performed by the compiler. If you are calling a library routine that was compiled from Fortran sources, the rule applies to calls made to the routine from code written in any language.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jan 2017 12:49:43 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2017-01-16T12:49:43Z</dc:date>
    <item>
      <title>Interpolate1D "in place" allowed ?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070769#M22251</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;

&lt;P&gt;I notice that df?Interpolate1D and&amp;nbsp;&lt;SPAN style="font-size: 13.008px;"&gt;df?Interpolate&lt;STRONG&gt;Ex&lt;/STRONG&gt;1D have different behaviour when working &lt;STRONG&gt;InPlace&lt;/STRONG&gt;&amp;nbsp;(&amp;amp;site == &amp;amp;r) :&amp;nbsp;InterpolateEx1D works,&amp;nbsp;Interpolate1D does not.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;Here is my sample test:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;int flatExtrapolation(long long* n, long long* /*cell*/, double* /*site*/, double* r, void* params)
{
  const double value = *static_cast&amp;lt;double*&amp;gt;(params);
  std::fill(r, r + *n, value);
  return 0;
}
class ExtrapolationFunction
{
public:
  virtual ~ExtrapolationFunction(){}
  explicit ExtrapolationFunction(double value)
  {
    _extrapolationFunction = static_cast&amp;lt;dfdInterpCallBack&amp;gt;(flatExtrapolation);
    _value = value;
  }
  const dfdInterpCallBack&amp;amp; getFunction() const { return _extrapolationFunction; }
  const void* getParameters() const { return &amp;amp;_value; }
private:
  dfdInterpCallBack _extrapolationFunction;
  double _value;
};

void interpolInPlaceTest()
{
  const int lengthX = 7;
  const double minAbscissaRef = 0.0;
  const double maxAbscissaRef = 3.0;
  const int lengthOrdinateRef = 4;

  double *X = new double[lengthX];
  double *XBackUp = new double[lengthX];
  double *Z = new double[lengthX];

  X[0] = 0.0;
  X[1] = 0.5;
  X[2] = 1.0;
  X[3] = 1.5;
  X[4] = 2.0;
  X[5] = 2.5;
  X[6] = 3.0;
  for (int i = 0; i &amp;lt; lengthX; i++)
  {
    XBackUp&lt;I&gt; = X&lt;I&gt;;
    Z&lt;I&gt; = 0.0;
  }
  
  double* ordinates = new double[lengthOrdinateRef];
  double* abscissae = new double[lengthOrdinateRef];
  double step = (maxAbscissaRef - minAbscissaRef) / (lengthOrdinateRef - 1);
  for (int i = 0; i &amp;lt; lengthOrdinateRef; i++)
  {
    ordinates&lt;I&gt; = i + 20.0;
    abscissae&lt;I&gt; = minAbscissaRef + step*i;
  }

  MKL_INT ny = 1;
  DFTaskPtr task = nullptr;
  double* splineCoeffs = new double[DF_PP_LINEAR*(lengthOrdinateRef - 1)];

  dfdNewTask1D(&amp;amp;task, lengthOrdinateRef, abscissae, DF_NON_UNIFORM_PARTITION, ny, ordinates, DF_MATRIX_STORAGE_ROWS);
  dfdEditPPSpline1D(task, DF_PP_LINEAR, DF_PP_DEFAULT, DF_NO_BC, nullptr, DF_NO_IC, nullptr, splineCoeffs, DF_NO_HINT);
  dfdConstruct1D(task, DF_PP_SPLINE, DF_METHOD_STD);

  int ndorder = 1;
  MKL_INT* dorder = new MKL_INT[ndorder];
  dorder[0] = 1;

  // ****** Interpolation without extrapolation ******
  int status = dfdInterpolate1D(task, DF_INTERP, DF_METHOD_PP, lengthX, X, DF_NON_UNIFORM_PARTITION, ndorder, dorder,
    nullptr, Z, DF_MATRIX_STORAGE_ROWS, nullptr);
  printf("\ndfdInterpolate1D Out of Place status: %d\n", status);
  for (int i = 0; i &amp;lt; lengthX; i++)
    printf("%d\t%lf\t%lf\n", i, XBackUp&lt;I&gt;, Z&lt;I&gt;);

  status = dfdInterpolate1D(task, DF_INTERP, DF_METHOD_PP, lengthX, X, DF_NON_UNIFORM_PARTITION, ndorder, dorder,
    nullptr, X, DF_MATRIX_STORAGE_ROWS, nullptr);
  printf("\ndfdInterpolate1D In Place status: %d\n", status);
  for (int i = 0; i &amp;lt; lengthX; i++)
    printf("%d\t%lf\t%lf\n", i, XBackUp&lt;I&gt;, X&lt;I&gt;);

  // ****** Interpolation with extrapolation ******
  // reset buffers
  for (int i = 0; i &amp;lt; lengthX; i++)
  {
    X&lt;I&gt; = XBackUp&lt;I&gt;;
    Z&lt;I&gt; = 0.0;
  }
  ExtrapolationFunction* _extrapolationFunc = new ExtrapolationFunction(42.0);
  status = dfdInterpolateEx1D(task, DF_INTERP, DF_METHOD_PP, lengthX, X, DF_NON_UNIFORM_PARTITION, ndorder, dorder,
    nullptr, Z, DF_MATRIX_STORAGE_ROWS, nullptr,
    _extrapolationFunc-&amp;gt;getFunction(),
    _extrapolationFunc-&amp;gt;getParameters(), 
    _extrapolationFunc-&amp;gt;getFunction(),
    _extrapolationFunc-&amp;gt;getParameters(), 
    nullptr, nullptr, // interpolation function 
    nullptr, nullptr);
  printf("\ndfdInterpolateEx1D Out of Place status: %d\n", status);
  for (int i = 0; i &amp;lt; lengthX; i++)
    printf("%d\t%lf\t%lf\n", i, XBackUp&lt;I&gt;, Z&lt;I&gt;);

  status = dfdInterpolateEx1D(task, DF_INTERP, DF_METHOD_PP, lengthX, X, DF_NON_UNIFORM_PARTITION, ndorder, dorder,
    nullptr, X, DF_MATRIX_STORAGE_ROWS, nullptr,
    _extrapolationFunc-&amp;gt;getFunction(),
    _extrapolationFunc-&amp;gt;getParameters(), 
    _extrapolationFunc-&amp;gt;getFunction(),
    _extrapolationFunc-&amp;gt;getParameters(),
    nullptr, nullptr, // interpolation function 
    nullptr, nullptr);
  printf("\ndfdInterpolateEx1D In Place status: %d\n", status);
  for (int i = 0; i &amp;lt; lengthX; i++)
    printf("%d\t%lf\t%lf\n", i, XBackUp&lt;I&gt;, X&lt;I&gt;);

  delete[] X;
  delete[] XBackUp;
  delete[] Z;
  delete[] ordinates;
  delete[] abscissae;
  delete[] splineCoeffs;
  delete[] dorder;
  delete _extrapolationFunc;
  dfDeleteTask(&amp;amp;task);
}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;And here is the output :&lt;/P&gt;

&lt;P&gt;dfdInterpolate1D Out of Place status: 0&lt;BR /&gt;
	0&amp;nbsp;&amp;nbsp; &amp;nbsp;0.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.000000&lt;BR /&gt;
	1&amp;nbsp;&amp;nbsp; &amp;nbsp;0.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.500000&lt;BR /&gt;
	2&amp;nbsp;&amp;nbsp; &amp;nbsp;1.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;21.000000&lt;BR /&gt;
	3&amp;nbsp;&amp;nbsp; &amp;nbsp;1.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;21.500000&lt;BR /&gt;
	4&amp;nbsp;&amp;nbsp; &amp;nbsp;2.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;22.000000&lt;BR /&gt;
	5&amp;nbsp;&amp;nbsp; &amp;nbsp;2.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;22.500000&lt;BR /&gt;
	6&amp;nbsp;&amp;nbsp; &amp;nbsp;3.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;23.000000&lt;BR /&gt;
	&lt;STRONG&gt;dfdInterpolate1D In Place status: 0&lt;BR /&gt;
	0&amp;nbsp;&amp;nbsp; &amp;nbsp;0.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.000000&lt;BR /&gt;
	1&amp;nbsp;&amp;nbsp; &amp;nbsp;0.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.000000&lt;BR /&gt;
	2&amp;nbsp;&amp;nbsp; &amp;nbsp;1.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.000000&lt;BR /&gt;
	3&amp;nbsp;&amp;nbsp; &amp;nbsp;1.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.000000&lt;BR /&gt;
	4&amp;nbsp;&amp;nbsp; &amp;nbsp;2.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.000000&lt;BR /&gt;
	5&amp;nbsp;&amp;nbsp; &amp;nbsp;2.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.000000&lt;BR /&gt;
	6&amp;nbsp;&amp;nbsp; &amp;nbsp;3.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.000000&lt;/STRONG&gt;&lt;BR /&gt;
	dfdInterpolateEx1D Out of Place status: 0&lt;BR /&gt;
	0&amp;nbsp;&amp;nbsp; &amp;nbsp;0.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.000000&lt;BR /&gt;
	1&amp;nbsp;&amp;nbsp; &amp;nbsp;0.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.500000&lt;BR /&gt;
	2&amp;nbsp;&amp;nbsp; &amp;nbsp;1.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;21.000000&lt;BR /&gt;
	3&amp;nbsp;&amp;nbsp; &amp;nbsp;1.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;21.500000&lt;BR /&gt;
	4&amp;nbsp;&amp;nbsp; &amp;nbsp;2.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;22.000000&lt;BR /&gt;
	5&amp;nbsp;&amp;nbsp; &amp;nbsp;2.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;22.500000&lt;BR /&gt;
	6&amp;nbsp;&amp;nbsp; &amp;nbsp;3.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;42.000000&lt;BR /&gt;
	dfdInterpolateEx1D In Place status: 0&lt;BR /&gt;
	0&amp;nbsp;&amp;nbsp; &amp;nbsp;0.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.000000&lt;BR /&gt;
	1&amp;nbsp;&amp;nbsp; &amp;nbsp;0.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;20.500000&lt;BR /&gt;
	2&amp;nbsp;&amp;nbsp; &amp;nbsp;1.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;21.000000&lt;BR /&gt;
	3&amp;nbsp;&amp;nbsp; &amp;nbsp;1.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;21.500000&lt;BR /&gt;
	4&amp;nbsp;&amp;nbsp; &amp;nbsp;2.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;22.000000&lt;BR /&gt;
	5&amp;nbsp;&amp;nbsp; &amp;nbsp;2.500000&amp;nbsp;&amp;nbsp; &amp;nbsp;22.500000&lt;BR /&gt;
	6&amp;nbsp;&amp;nbsp; &amp;nbsp;3.000000&amp;nbsp;&amp;nbsp; &amp;nbsp;42.000000&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;When using dfdInterpolate1D In Place the status is OK but the results are wrong. That were the results with &lt;STRONG&gt;Composer&lt;/STRONG&gt; &lt;STRONG&gt;2016 (first release)&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;If I run the same code with &lt;STRONG&gt;Composer 2017 Update 1&lt;/STRONG&gt;, the output of&amp;nbsp;dfdInterpolate&lt;STRONG&gt;Ex&lt;/STRONG&gt;1D In Place become wrong too !&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;So, I am a bit lost...&amp;nbsp;&lt;SPAN style="font-size: 13.008px;"&gt;Is working In Place with&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;dfdInterpolate1D (or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;dfdInterpolateEx1D) allowed or not ? Is that supposed to work ? I did not find the answer in the documentation.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Guix&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 10:50:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070769#M22251</guid>
      <dc:creator>Guillaume_A_2</dc:creator>
      <dc:date>2017-01-16T10:50:19Z</dc:date>
    </item>
    <item>
      <title>In general, it is not correct</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070770#M22252</link>
      <description>&lt;P&gt;In general, it is not correct to alias one subroutine argument to another argument, unless the documentation explicitly lists arguments that may be aliased.&lt;/P&gt;

&lt;P&gt;The Fortran standard prohibits such aliasing of arguments, and being able to rely on arguments being distinct is what enables many code optimizations to be performed by the compiler. If you are calling a library routine that was compiled from Fortran sources, the rule applies to calls made to the routine from code written in any language.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 12:49:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070770#M22252</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2017-01-16T12:49:43Z</dc:date>
    </item>
    <item>
      <title>Hello Guix,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070771#M22253</link>
      <description>&lt;P&gt;Hello Guix,&lt;/P&gt;

&lt;P&gt;The functions of Data Fitting component do not support in-place computations.&lt;/P&gt;

&lt;P&gt;It is a luck that you get the correct results with in-place invocation of&amp;nbsp;&lt;SPAN style="font-size: 12px;"&gt;dfdInterpolateEx1D&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;. Please use non-aliasing memory locations for input and output parameters of Data Fitting functions.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;Victoriya&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 08:20:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070771#M22253</guid>
      <dc:creator>VictoriyaS_F_Intel</dc:creator>
      <dc:date>2017-01-17T08:20:25Z</dc:date>
    </item>
    <item>
      <title>Ok, Thanks !</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070772#M22254</link>
      <description>&lt;P&gt;Ok, &lt;SPAN style="font-size: 12px;"&gt;Thanks&lt;/SPAN&gt; !&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 08:48:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070772#M22254</guid>
      <dc:creator>Guillaume_A_2</dc:creator>
      <dc:date>2017-01-17T08:48:39Z</dc:date>
    </item>
    <item>
      <title>We plan to add a note into</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070773#M22255</link>
      <description>&lt;P&gt;We plan to add a note into Data Fitting documentation. The note will explicitly specify that the in-place usage of df?Interpolate1D/df?InterpolateEx1D is not supported.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 12:47:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Interpolate1D-quot-in-place-quot-allowed/m-p/1070773#M22255</guid>
      <dc:creator>VictoriyaS_F_Intel</dc:creator>
      <dc:date>2017-01-17T12:47:22Z</dc:date>
    </item>
  </channel>
</rss>

