<?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 I'm not sure I understand the in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153815#M27391</link>
    <description>&lt;P&gt;I'm not sure I understand the issue.&lt;/P&gt;

&lt;P&gt;The header (in C from mkl_spblas.h) is&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;   sparse_status_t mkl_sparse_z_syprd ( const sparse_operation_t op,
                                        const sparse_matrix_t    A,
                                        const MKL_Complex16      *B,
                                        const sparse_layout_t    layoutB,
                                        const MKL_INT            ldb,
                                        const MKL_Complex16      alpha,
                                        const MKL_Complex16      beta,
                                        MKL_Complex16            *C,
                                        const sparse_layout_t    layoutC,
                                        const MKL_INT            ldc );
&lt;/PRE&gt;

&lt;P&gt;and in fortran from mkl_spblas.f90 is&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;FUNCTION MKL_SPARSE_Z_SYPRD(op,A,B,layoutB,ldb,alpha,beta,C,layoutC,ldc) &amp;amp; !
                 BIND(C, name='MKL_SPARSE_Z_SYPRD')
            USE, INTRINSIC :: ISO_C_BINDING , ONLY : C_INT, C_DOUBLE_COMPLEX
            IMPORT SPARSE_MATRIX_T
            INTEGER(C_INT)              , INTENT(IN)   :: op
            TYPE(SPARSE_MATRIX_T)       , INTENT(IN)   :: A
            REAL(C_DOUBLE_COMPLEX)      , INTENT(IN) , DIMENSION(*) :: B
            INTEGER(C_INT)              , INTENT(IN)   :: layoutB
            INTEGER(C_INT)              , INTENT(IN)   :: ldb
            REAL(C_DOUBLE_COMPLEX)      , INTENT(IN)   :: alpha
            REAL(C_DOUBLE_COMPLEX)      , INTENT(IN)   :: beta
            REAL(C_DOUBLE_COMPLEX)      , INTENT(OUT), DIMENSION(*) :: C
            INTEGER(C_INT)              , INTENT(IN)   :: layoutC
            INTEGER(C_INT)              , INTENT(IN)   :: ldc
            INTEGER(C_INT) MKL_SPARSE_Z_SYPRD
        END FUNCTION
&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	which definitely uses complex valued arguments for alpha, beta, B input and C output.&amp;nbsp; A should also be created as a complex sparse matrix using mkl_sparse_z_create_csr()...&amp;nbsp; or bsr if that is what you are using.&amp;nbsp; Can you clarify what issue you are observing?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jul 2018 19:10:20 GMT</pubDate>
    <dc:creator>Spencer_P_Intel</dc:creator>
    <dc:date>2018-07-10T19:10:20Z</dc:date>
    <item>
      <title>mkl_sparse_z_syprd, fortran</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153813#M27389</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;It seems that&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;mkl_sparse_z_syprd requires real arguments even though they should be complex. Any advice? Thanks!&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 10:28:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153813#M27389</guid>
      <dc:creator>Bertazzi__Francesco</dc:creator>
      <dc:date>2018-07-10T10:28:34Z</dc:date>
    </item>
    <item>
      <title>Now, there are some caveats</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153814#M27390</link>
      <description>&lt;P&gt;Now, there are some caveats that I realize might be a little more confusing so I will see if I can clear them up:&lt;/P&gt;

&lt;P&gt;SYPR does the following operations (with opA = non transpose):&lt;BR /&gt;
	C = beta*C + alpha*A*B*(A^H)&lt;/P&gt;

&lt;P&gt;Now this operation has been designed to take in a Hermitian matrix B and C and return a Hermitian matrix C. In particular a necessary (not sufficient) condition to be Hermitian is that it must be real valued on diagonal since B_ii = (B^H)_ii = conj(B_ii).&amp;nbsp; (no imaginary parts)&lt;/P&gt;

&lt;P&gt;Now given a hermitian matrix B, if we want the resulting C matrix to also be Hermitian we must only use real valued alpha and beta to preserve this same real diagonal property even though technically we can use any complex alpha and beta values.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;As a side note, since we do expect a hermitian matrix B and C, we do not use the full general data.&amp;nbsp; We only use the upper triangular part of B in the computation and return only the upper triangular part of C (the lower part can easily be referenced as conjugate transpose of the upper). This allows us to avoid redundant computations and speed up the operation.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 19:03:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153814#M27390</guid>
      <dc:creator>Spencer_P_Intel</dc:creator>
      <dc:date>2018-07-10T19:03:00Z</dc:date>
    </item>
    <item>
      <title>I'm not sure I understand the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153815#M27391</link>
      <description>&lt;P&gt;I'm not sure I understand the issue.&lt;/P&gt;

&lt;P&gt;The header (in C from mkl_spblas.h) is&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;   sparse_status_t mkl_sparse_z_syprd ( const sparse_operation_t op,
                                        const sparse_matrix_t    A,
                                        const MKL_Complex16      *B,
                                        const sparse_layout_t    layoutB,
                                        const MKL_INT            ldb,
                                        const MKL_Complex16      alpha,
                                        const MKL_Complex16      beta,
                                        MKL_Complex16            *C,
                                        const sparse_layout_t    layoutC,
                                        const MKL_INT            ldc );
&lt;/PRE&gt;

&lt;P&gt;and in fortran from mkl_spblas.f90 is&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;FUNCTION MKL_SPARSE_Z_SYPRD(op,A,B,layoutB,ldb,alpha,beta,C,layoutC,ldc) &amp;amp; !
                 BIND(C, name='MKL_SPARSE_Z_SYPRD')
            USE, INTRINSIC :: ISO_C_BINDING , ONLY : C_INT, C_DOUBLE_COMPLEX
            IMPORT SPARSE_MATRIX_T
            INTEGER(C_INT)              , INTENT(IN)   :: op
            TYPE(SPARSE_MATRIX_T)       , INTENT(IN)   :: A
            REAL(C_DOUBLE_COMPLEX)      , INTENT(IN) , DIMENSION(*) :: B
            INTEGER(C_INT)              , INTENT(IN)   :: layoutB
            INTEGER(C_INT)              , INTENT(IN)   :: ldb
            REAL(C_DOUBLE_COMPLEX)      , INTENT(IN)   :: alpha
            REAL(C_DOUBLE_COMPLEX)      , INTENT(IN)   :: beta
            REAL(C_DOUBLE_COMPLEX)      , INTENT(OUT), DIMENSION(*) :: C
            INTEGER(C_INT)              , INTENT(IN)   :: layoutC
            INTEGER(C_INT)              , INTENT(IN)   :: ldc
            INTEGER(C_INT) MKL_SPARSE_Z_SYPRD
        END FUNCTION
&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	which definitely uses complex valued arguments for alpha, beta, B input and C output.&amp;nbsp; A should also be created as a complex sparse matrix using mkl_sparse_z_create_csr()...&amp;nbsp; or bsr if that is what you are using.&amp;nbsp; Can you clarify what issue you are observing?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 19:10:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153815#M27391</guid>
      <dc:creator>Spencer_P_Intel</dc:creator>
      <dc:date>2018-07-10T19:10:20Z</dc:date>
    </item>
    <item>
      <title>Thanks for your help!</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153816#M27392</link>
      <description>&lt;P&gt;Thanks for your help!&lt;BR /&gt;
	I think the problem is that I have defined the complex matrix B as&amp;nbsp;&lt;/P&gt;

&lt;P&gt;COMPLEX(KIND=8), ALLOCATABLE &amp;nbsp;:: B(:,:)&lt;/P&gt;

&lt;P&gt;while in mkl_spblas.f90, B appears as&amp;nbsp;&lt;/P&gt;

&lt;P&gt;REAL(C_DOUBLE_COMPLEX) &amp;nbsp; &amp;nbsp; &amp;nbsp;, INTENT(IN) , DIMENSION(*) :: B&lt;/P&gt;

&lt;P&gt;It's not clear to me how I should define a dense complex matrix. Could you comment on this?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks, Francesco&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 20:50:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153816#M27392</guid>
      <dc:creator>Bertazzi__Francesco</dc:creator>
      <dc:date>2018-07-10T20:50:01Z</dc:date>
    </item>
    <item>
      <title>Francesco,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153817#M27393</link>
      <description>&lt;P&gt;Francesco,&lt;/P&gt;

&lt;P&gt;I see that I was a little blind earlier.&amp;nbsp; You are absolutely right.&amp;nbsp; Your matrix is not compatible with this interface. &amp;nbsp; What you can do is the following:&lt;/P&gt;

&lt;P&gt;Add this new header definition to the top of your local code:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;FUNCTION MKL_SPARSE_Z_SYPRD_F(op,A,B,layoutB,ldb,alpha,beta,C,layoutC,ldc) &amp;amp; !
                 BIND(C, name='MKL_SPARSE_Z_SYPRD')
            USE, INTRINSIC :: ISO_C_BINDING , ONLY : C_INT, C_DOUBLE_COMPLEX
            IMPORT SPARSE_MATRIX_T
            INTEGER(C_INT)              , INTENT(IN)   :: op
            TYPE(SPARSE_MATRIX_T)       , INTENT(IN)   :: A
            COMPLEX(C_DOUBLE_COMPLEX)   , INTENT(IN) , DIMENSION(*) :: B
            INTEGER(C_INT)              , INTENT(IN)   :: layoutB
            INTEGER(C_INT)              , INTENT(IN)   :: ldb
            COMPLEX(C_DOUBLE_COMPLEX)   , INTENT(IN)   :: alpha
            COMPLEX(C_DOUBLE_COMPLEX)   , INTENT(IN)   :: beta
            COMPLEX(C_DOUBLE_COMPLEX)   , INTENT(OUT), DIMENSION(*) :: C
            INTEGER(C_INT)              , INTENT(IN)   :: layoutC
            INTEGER(C_INT)              , INTENT(IN)   :: ldc
            INTEGER(C_INT) MKL_SPARSE_Z_SYPRD_F
        END FUNCTION&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	&lt;BR /&gt;
	And then use MKL_SPARSE_Z_SYPRD_F()&amp;nbsp; instead of MKL_SPARSE_Z_SYPRD()&amp;nbsp; in your code...&amp;nbsp; This should work for your matrix definition.&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	Best,&lt;/P&gt;

&lt;P&gt;Spencer&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 22:01:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153817#M27393</guid>
      <dc:creator>Spencer_P_Intel</dc:creator>
      <dc:date>2018-07-10T22:01:18Z</dc:date>
    </item>
    <item>
      <title>It works, thanks!</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153818#M27394</link>
      <description>&lt;P&gt;It works, thanks!&lt;/P&gt;

&lt;P&gt;Cheers, Francesco&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 13:34:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-sparse-z-syprd-fortran/m-p/1153818#M27394</guid>
      <dc:creator>Bertazzi__Francesco</dc:creator>
      <dc:date>2018-07-11T13:34:39Z</dc:date>
    </item>
  </channel>
</rss>

