<?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 Lazarus Pascal &amp;amp; intel mkl usage in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Lazarus-Pascal-amp-intel-mkl-usage/m-p/1723540#M37399</link>
    <description>&lt;P&gt;Hi, I have used The intel MKL to calculate an eigenvalue equation for Self Consistent Field Approximation (Hartree Fock method). The program part is below. But For a degenerate matrix, Sometimes it changes order of eigenvectors like that&amp;nbsp;&lt;/P&gt;&lt;P&gt;tempCC1: [ 0.999927 -0.012047 0.000000 -0.001017 0.000000 ]&lt;BR /&gt;tempCC2: [ 0.010611 0.914781 0.000000 -0.403812 0.000000 ]&lt;BR /&gt;tempCC3: [ 0.000000 0.000000 0.000000 0.000000 1.000000 ]&lt;BR /&gt;tempCC4: [ 0.005795 0.403771 0.000000 0.914842 0.000000 ]&lt;BR /&gt;tempCC5: [ 0.000000 0.000000 1.000000 0.000000 0.000000 ]&lt;/P&gt;&lt;P&gt;whereas it should make a progress like that&lt;/P&gt;&lt;P&gt;Eigenvalues:&lt;BR /&gt;en[1] = -11.301550274377&lt;BR /&gt;en[2] = -0.677494616682&lt;BR /&gt;en[3] = -0.003523316893&lt;BR /&gt;en[4] = -0.003523316893&lt;BR /&gt;en[5] = -0.003523316893&lt;BR /&gt;Eigenvectors (rows):&lt;BR /&gt;tempCC1: [ 0.999938 -0.011161 0.000000 0.000000 0.000000 ]&lt;BR /&gt;tempCC2: [ 0.011161 0.999938 0.000000 0.000000 0.000000 ]&lt;BR /&gt;tempCC3: [ 0.000000 0.000000 1.000000 0.000000 0.000000 ]&lt;BR /&gt;tempCC4: [ 0.000000 0.000000 0.000000 1.000000 0.000000 ]&lt;BR /&gt;tempCC5: [ 0.000000 0.000000 0.000000 0.000000 1.000000 ]&lt;/P&gt;&lt;P&gt;I want to know whether or not I make a mistake in the program part below. I hope someone helps me and corrects it. thank you in advance, SEDSIL.&lt;/P&gt;&lt;P&gt;const&lt;/P&gt;&lt;P&gt;LAPACK_COL_MAJOR = 102;&lt;BR /&gt;MKL_PATH = 'pathto\Intel\oneAPI\mkl\latest\bin\mkl_rt.dll';&lt;BR /&gt;OMP_PATH = 'pathto\Intel\oneAPI\compiler\latest\bin\libiomp5md.dll';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;type&lt;BR /&gt;TLAPACKE_dsyev = function(layout: Integer; jobz: Char; uplo: Char;&lt;BR /&gt;n: Integer; a: PDouble; lda: Integer;&lt;BR /&gt;w: PDouble): Integer; cdecl;&lt;/P&gt;&lt;P&gt;function CalculateEigens(const a: RealArrayNPbyNP;&lt;BR /&gt;var d: RealArrayNP;&lt;BR /&gt;var v: RealArrayNPbyNP): Boolean;&lt;BR /&gt;var&lt;BR /&gt;i, j, ret: Integer;&lt;BR /&gt;a_data: array of Double;&lt;BR /&gt;w: array of Double;&lt;BR /&gt;hMKL, hOMP: THandle;&lt;BR /&gt;f_dsyev: TLAPACKE_dsyev;&lt;BR /&gt;begin&lt;BR /&gt;Result := False;&lt;BR /&gt;hMKL := 0;&lt;BR /&gt;hOMP := 0;&lt;/P&gt;&lt;P&gt;try&lt;BR /&gt;SetLength(a_data, np*np);&lt;BR /&gt;SetLength(w, np);&lt;/P&gt;&lt;P&gt;for i := 1 to np do&lt;BR /&gt;for j := 1 to np do&lt;BR /&gt;a_data[(j-1)*np + (i-1)] := a[i,j];&lt;/P&gt;&lt;P&gt;hOMP := LoadLibrary(PChar(OMP_PATH));&lt;BR /&gt;hMKL := LoadLibrary(PChar(MKL_PATH));&lt;BR /&gt;if (hOMP = 0) or (hMKL = 0) then Exit;&lt;/P&gt;&lt;P&gt;f_dsyev := TLAPACKE_dsyev(GetProcAddress(hMKL, 'LAPACKE_dsyev'));&lt;BR /&gt;if not Assigned(f_dsyev) then Exit;&lt;/P&gt;&lt;P&gt;ret := f_dsyev(LAPACK_COL_MAJOR, 'V', 'U', np, @a_data[0], np, @w[0]);&lt;BR /&gt;if ret &amp;lt;&amp;gt; 0 then Exit;&lt;/P&gt;&lt;P&gt;for i := 1 to np do&lt;BR /&gt;begin&lt;BR /&gt;d[i] := w[i-1];&lt;BR /&gt;for j := 1 to np do&lt;BR /&gt;v[i,j] := a_data[(j-1)*np + (i-1)];&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;Result := True;&lt;/P&gt;&lt;P&gt;finally&lt;BR /&gt;if hMKL &amp;lt;&amp;gt; 0 then FreeLibrary(hMKL);&lt;BR /&gt;if hOMP &amp;lt;&amp;gt; 0 then FreeLibrary(hOMP);&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;/P&gt;</description>
    <pubDate>Sun, 26 Oct 2025 15:29:30 GMT</pubDate>
    <dc:creator>sedsil</dc:creator>
    <dc:date>2025-10-26T15:29:30Z</dc:date>
    <item>
      <title>Lazarus Pascal &amp; intel mkl usage</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Lazarus-Pascal-amp-intel-mkl-usage/m-p/1723540#M37399</link>
      <description>&lt;P&gt;Hi, I have used The intel MKL to calculate an eigenvalue equation for Self Consistent Field Approximation (Hartree Fock method). The program part is below. But For a degenerate matrix, Sometimes it changes order of eigenvectors like that&amp;nbsp;&lt;/P&gt;&lt;P&gt;tempCC1: [ 0.999927 -0.012047 0.000000 -0.001017 0.000000 ]&lt;BR /&gt;tempCC2: [ 0.010611 0.914781 0.000000 -0.403812 0.000000 ]&lt;BR /&gt;tempCC3: [ 0.000000 0.000000 0.000000 0.000000 1.000000 ]&lt;BR /&gt;tempCC4: [ 0.005795 0.403771 0.000000 0.914842 0.000000 ]&lt;BR /&gt;tempCC5: [ 0.000000 0.000000 1.000000 0.000000 0.000000 ]&lt;/P&gt;&lt;P&gt;whereas it should make a progress like that&lt;/P&gt;&lt;P&gt;Eigenvalues:&lt;BR /&gt;en[1] = -11.301550274377&lt;BR /&gt;en[2] = -0.677494616682&lt;BR /&gt;en[3] = -0.003523316893&lt;BR /&gt;en[4] = -0.003523316893&lt;BR /&gt;en[5] = -0.003523316893&lt;BR /&gt;Eigenvectors (rows):&lt;BR /&gt;tempCC1: [ 0.999938 -0.011161 0.000000 0.000000 0.000000 ]&lt;BR /&gt;tempCC2: [ 0.011161 0.999938 0.000000 0.000000 0.000000 ]&lt;BR /&gt;tempCC3: [ 0.000000 0.000000 1.000000 0.000000 0.000000 ]&lt;BR /&gt;tempCC4: [ 0.000000 0.000000 0.000000 1.000000 0.000000 ]&lt;BR /&gt;tempCC5: [ 0.000000 0.000000 0.000000 0.000000 1.000000 ]&lt;/P&gt;&lt;P&gt;I want to know whether or not I make a mistake in the program part below. I hope someone helps me and corrects it. thank you in advance, SEDSIL.&lt;/P&gt;&lt;P&gt;const&lt;/P&gt;&lt;P&gt;LAPACK_COL_MAJOR = 102;&lt;BR /&gt;MKL_PATH = 'pathto\Intel\oneAPI\mkl\latest\bin\mkl_rt.dll';&lt;BR /&gt;OMP_PATH = 'pathto\Intel\oneAPI\compiler\latest\bin\libiomp5md.dll';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;type&lt;BR /&gt;TLAPACKE_dsyev = function(layout: Integer; jobz: Char; uplo: Char;&lt;BR /&gt;n: Integer; a: PDouble; lda: Integer;&lt;BR /&gt;w: PDouble): Integer; cdecl;&lt;/P&gt;&lt;P&gt;function CalculateEigens(const a: RealArrayNPbyNP;&lt;BR /&gt;var d: RealArrayNP;&lt;BR /&gt;var v: RealArrayNPbyNP): Boolean;&lt;BR /&gt;var&lt;BR /&gt;i, j, ret: Integer;&lt;BR /&gt;a_data: array of Double;&lt;BR /&gt;w: array of Double;&lt;BR /&gt;hMKL, hOMP: THandle;&lt;BR /&gt;f_dsyev: TLAPACKE_dsyev;&lt;BR /&gt;begin&lt;BR /&gt;Result := False;&lt;BR /&gt;hMKL := 0;&lt;BR /&gt;hOMP := 0;&lt;/P&gt;&lt;P&gt;try&lt;BR /&gt;SetLength(a_data, np*np);&lt;BR /&gt;SetLength(w, np);&lt;/P&gt;&lt;P&gt;for i := 1 to np do&lt;BR /&gt;for j := 1 to np do&lt;BR /&gt;a_data[(j-1)*np + (i-1)] := a[i,j];&lt;/P&gt;&lt;P&gt;hOMP := LoadLibrary(PChar(OMP_PATH));&lt;BR /&gt;hMKL := LoadLibrary(PChar(MKL_PATH));&lt;BR /&gt;if (hOMP = 0) or (hMKL = 0) then Exit;&lt;/P&gt;&lt;P&gt;f_dsyev := TLAPACKE_dsyev(GetProcAddress(hMKL, 'LAPACKE_dsyev'));&lt;BR /&gt;if not Assigned(f_dsyev) then Exit;&lt;/P&gt;&lt;P&gt;ret := f_dsyev(LAPACK_COL_MAJOR, 'V', 'U', np, @a_data[0], np, @w[0]);&lt;BR /&gt;if ret &amp;lt;&amp;gt; 0 then Exit;&lt;/P&gt;&lt;P&gt;for i := 1 to np do&lt;BR /&gt;begin&lt;BR /&gt;d[i] := w[i-1];&lt;BR /&gt;for j := 1 to np do&lt;BR /&gt;v[i,j] := a_data[(j-1)*np + (i-1)];&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;Result := True;&lt;/P&gt;&lt;P&gt;finally&lt;BR /&gt;if hMKL &amp;lt;&amp;gt; 0 then FreeLibrary(hMKL);&lt;BR /&gt;if hOMP &amp;lt;&amp;gt; 0 then FreeLibrary(hOMP);&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Oct 2025 15:29:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Lazarus-Pascal-amp-intel-mkl-usage/m-p/1723540#M37399</guid>
      <dc:creator>sedsil</dc:creator>
      <dc:date>2025-10-26T15:29:30Z</dc:date>
    </item>
  </channel>
</rss>

