<?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 GaussianMV parameter error in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GaussianMV-parameter-error/m-p/833817#M5884</link>
    <description>Hello, I am trying to work with the random number generator of the mutlivariate Gaussian distribution in FORTAN. TO this end, I have compiled my MKL library, and am attempting to get the random numbers. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1. I have several questions. One it is hard to tell from the documentation. whether ytou need the Cholesky decompostion, or the full covariance matrix. which is required&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;2. When I attempt to run the below program, I recive the following error: Parameter 4 was incorrect on entry to vsRngGaussia&lt;BR /&gt;&lt;BR /&gt;Does anyone have any suggestions as to what is wrong with my code. Please also note that I have tried using the Cholesky decomposition code from LAPACK but it does not seem to work.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;program mcnet&lt;/P&gt;&lt;P&gt;implicit none&lt;/P&gt;&lt;P&gt;integer :: i, j&lt;/P&gt;&lt;P&gt;real :: harvest1, harvest2, sd&lt;/P&gt;&lt;P&gt;integer :: dimen, seed_in1, seed_in2, n_rand_obs_in&lt;/P&gt;&lt;P&gt;real , dimension (:, :), allocatable :: newidentity, sigmanew, meanvectnorm, meanvectnormtrans, meanvect, meanvecttrans, &amp;amp;&lt;/P&gt;&lt;P&gt;meanvectold, meanvecttransold, Q, r_mvgaussian_list1, r_mvgaussian_list2, sigmanewchol, newidentity2 &lt;/P&gt;&lt;P&gt;interface&lt;/P&gt;&lt;P&gt;subroutine gaussianmv_rng_mkl(seed_in, n_rand_obs_in, r_mvgaussian_list, dimen, mean, tcv)&lt;/P&gt;&lt;P&gt;implicit none&lt;/P&gt;&lt;P&gt;integer, intent(in) :: seed_in, n_rand_obs_in, dimen&lt;/P&gt;&lt;P&gt;real, dimension(1:n_rand_obs_in, 1:dimen), intent(out) :: r_mvgaussian_list&lt;/P&gt;&lt;P&gt;real, dimension(1:1, 1:dimen), intent(in) :: mean&lt;/P&gt;&lt;P&gt;real, dimension(1:dimen, 1:dimen), intent(in) :: tcv&lt;/P&gt;&lt;P&gt;end subroutine gaussianmv_rng_mkl&lt;/P&gt;&lt;P&gt;end interface&lt;/P&gt;&lt;P&gt;! allowing for easy changes in dimensionality&lt;/P&gt;&lt;P&gt;dimen = 3&lt;/P&gt;&lt;P&gt;n_rand_obs_in = 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;allocate(newidentity(1:dimen, 1:dimen))&lt;/P&gt;&lt;P&gt;!allocate(sigmanew(1:dimen, 1:dimen))&lt;/P&gt;&lt;P&gt;allocate(meanvectnorm(1:dimen, 1:1))&lt;/P&gt;&lt;P&gt;allocate(meanvectnormtrans(1:1, 1:dimen))&lt;/P&gt;&lt;P&gt;!allocate(meanvect(1:dimen, 1:1))&lt;/P&gt;&lt;P&gt;!allocate(meanvecttrans(1:1, 1:dimen))&lt;/P&gt;&lt;P&gt;!allocate(meanvectold(1:dimen, 1:1))&lt;/P&gt;&lt;P&gt;!allocate(meanvecttransold(1:1, 1:dimen))&lt;/P&gt;&lt;P&gt;!allocate(sigmanewchol(1:dimen, 1:dimen))&lt;/P&gt;&lt;P&gt;allocate(newidentity2(1:dimen, 1:dimen))&lt;/P&gt;&lt;P&gt;allocate(r_mvgaussian_list2(1:n_rand_obs_in, 1:dimen) )&lt;/P&gt;&lt;P&gt;allocate(Q(1:dimen, 1:1))&lt;/P&gt;&lt;P&gt;!allocate(tcv(1:dimen, 1:dimen))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;newidentity = 1.0&lt;/P&gt;&lt;P&gt;!scaling factor as per algoritm&lt;/P&gt;&lt;P&gt;sd = (2.38)**2/dimen&lt;/P&gt;&lt;P&gt;meanvect = 0.0&lt;/P&gt;&lt;P&gt;meanvectnorm = 0.0&lt;/P&gt;&lt;P&gt;do j = 1, dimen&lt;/P&gt;&lt;P&gt;! identity matrix times scaling factor as per Roberts and Rosthenthal (2009) gives innitial value of covariance matrix&lt;/P&gt;&lt;P&gt;newidentity( j, j) = 1.0*(0.01)/dimen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;print *, newidentity&lt;/P&gt;&lt;P&gt;call random_number(harvest1)&lt;/P&gt;&lt;P&gt;seed_in1 = aint(harvest1 * 2.0e0**31)&lt;/P&gt;&lt;P&gt;meanvectnorm(1,1) = 0.2&lt;/P&gt;&lt;P&gt;meanvectnorm(2,1) = 0.3&lt;/P&gt;&lt;P&gt;meanvectnorm(3,1) = 0.001 &lt;/P&gt;&lt;P&gt;!print *, meanvectnorm&lt;/P&gt;&lt;P&gt;meanvectnormtrans = transpose(meanvectnorm)&lt;/P&gt;&lt;P&gt;! call spotrf('U', dimen, newidentity)&lt;/P&gt;&lt;P&gt;!call potrf( newidentity, 'U')&lt;/P&gt;&lt;P&gt;! note that since cholesky decomposition of newidentity does not change, since newidentity does not change one only needs to derive it once&lt;/P&gt;&lt;P&gt;newidentity2 = 0.0&lt;/P&gt;&lt;P&gt;do i = 1, dimen&lt;/P&gt;&lt;P&gt;do j = 1, dimen&lt;/P&gt;&lt;P&gt;if (i .ge. j) then&lt;/P&gt;&lt;P&gt;newidentity2(i,j) = newidentity(i,j)&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;print *, newidentity2&lt;/P&gt;&lt;P&gt;print *, "test"&lt;/P&gt;&lt;P&gt;call gaussianmv_rng_mkl(seed_in1, n_rand_obs_in, r_mvgaussian_list2, dimen, meanvectnormtrans, newidentity2)&lt;/P&gt;&lt;P&gt;!subroutine gaussianmv_rng_mkl(seed_in, n_rand_obs_in, r_mvgaussian_list, dimen, mean, tcv)&lt;/P&gt;&lt;P&gt;do i = 1, n_rand_obs_in&lt;/P&gt;&lt;P&gt;do j = 1, dimen&lt;/P&gt;&lt;P&gt;print *, r_mvgaussian_list2(i, j)&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;end program&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;which in turns calls the subroutine that I have created to use mutlivariate random numbers,&lt;/P&gt;&lt;P&gt;subroutine gaussianmv_rng_mkl(seed_in, n_rand_obs_in, r_mvgaussian_list, dimen, mean, tcv)&lt;/P&gt;&lt;P&gt;use :: mkl_vsl_type&lt;/P&gt;&lt;P&gt;integer :: brng&lt;/P&gt;&lt;P&gt;integer, intent(in) :: seed_in, n_rand_obs_in&lt;/P&gt;&lt;P&gt;real, pointer, intent(out) :: r_mvgaussian_list&lt;/P&gt;&lt;P&gt;type(VSL_STREAM_STATE) :: stream&lt;/P&gt;&lt;P&gt;integer :: status, methodrng&lt;/P&gt;&lt;P&gt;external :: vslnewstream, vsrnggausianmv, vsldeletestream&lt;/P&gt;&lt;P&gt;methodrng = VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER&lt;/P&gt;&lt;P&gt;mstorage = VSL_MATRIX_STORAGE_FULL&lt;/P&gt;&lt;P&gt;brng = vsl_brng_mcg31&lt;/P&gt;&lt;P&gt;status = vslnewstream(stream, brng, seed_in)&lt;/P&gt;&lt;P&gt;status = vsrnggaussianmv( methodrng, stream, n_rand_obs_in, r_mvgaussian_list, dimen, mstorage, mean, tcv)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;status = vsldeletestream(stream)&lt;/P&gt;&lt;P&gt;end subroutine&lt;/P&gt;</description>
    <pubDate>Mon, 25 Apr 2011 21:19:26 GMT</pubDate>
    <dc:creator>jaureus</dc:creator>
    <dc:date>2011-04-25T21:19:26Z</dc:date>
    <item>
      <title>GaussianMV parameter error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GaussianMV-parameter-error/m-p/833817#M5884</link>
      <description>Hello, I am trying to work with the random number generator of the mutlivariate Gaussian distribution in FORTAN. TO this end, I have compiled my MKL library, and am attempting to get the random numbers. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1. I have several questions. One it is hard to tell from the documentation. whether ytou need the Cholesky decompostion, or the full covariance matrix. which is required&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;2. When I attempt to run the below program, I recive the following error: Parameter 4 was incorrect on entry to vsRngGaussia&lt;BR /&gt;&lt;BR /&gt;Does anyone have any suggestions as to what is wrong with my code. Please also note that I have tried using the Cholesky decomposition code from LAPACK but it does not seem to work.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;program mcnet&lt;/P&gt;&lt;P&gt;implicit none&lt;/P&gt;&lt;P&gt;integer :: i, j&lt;/P&gt;&lt;P&gt;real :: harvest1, harvest2, sd&lt;/P&gt;&lt;P&gt;integer :: dimen, seed_in1, seed_in2, n_rand_obs_in&lt;/P&gt;&lt;P&gt;real , dimension (:, :), allocatable :: newidentity, sigmanew, meanvectnorm, meanvectnormtrans, meanvect, meanvecttrans, &amp;amp;&lt;/P&gt;&lt;P&gt;meanvectold, meanvecttransold, Q, r_mvgaussian_list1, r_mvgaussian_list2, sigmanewchol, newidentity2 &lt;/P&gt;&lt;P&gt;interface&lt;/P&gt;&lt;P&gt;subroutine gaussianmv_rng_mkl(seed_in, n_rand_obs_in, r_mvgaussian_list, dimen, mean, tcv)&lt;/P&gt;&lt;P&gt;implicit none&lt;/P&gt;&lt;P&gt;integer, intent(in) :: seed_in, n_rand_obs_in, dimen&lt;/P&gt;&lt;P&gt;real, dimension(1:n_rand_obs_in, 1:dimen), intent(out) :: r_mvgaussian_list&lt;/P&gt;&lt;P&gt;real, dimension(1:1, 1:dimen), intent(in) :: mean&lt;/P&gt;&lt;P&gt;real, dimension(1:dimen, 1:dimen), intent(in) :: tcv&lt;/P&gt;&lt;P&gt;end subroutine gaussianmv_rng_mkl&lt;/P&gt;&lt;P&gt;end interface&lt;/P&gt;&lt;P&gt;! allowing for easy changes in dimensionality&lt;/P&gt;&lt;P&gt;dimen = 3&lt;/P&gt;&lt;P&gt;n_rand_obs_in = 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;allocate(newidentity(1:dimen, 1:dimen))&lt;/P&gt;&lt;P&gt;!allocate(sigmanew(1:dimen, 1:dimen))&lt;/P&gt;&lt;P&gt;allocate(meanvectnorm(1:dimen, 1:1))&lt;/P&gt;&lt;P&gt;allocate(meanvectnormtrans(1:1, 1:dimen))&lt;/P&gt;&lt;P&gt;!allocate(meanvect(1:dimen, 1:1))&lt;/P&gt;&lt;P&gt;!allocate(meanvecttrans(1:1, 1:dimen))&lt;/P&gt;&lt;P&gt;!allocate(meanvectold(1:dimen, 1:1))&lt;/P&gt;&lt;P&gt;!allocate(meanvecttransold(1:1, 1:dimen))&lt;/P&gt;&lt;P&gt;!allocate(sigmanewchol(1:dimen, 1:dimen))&lt;/P&gt;&lt;P&gt;allocate(newidentity2(1:dimen, 1:dimen))&lt;/P&gt;&lt;P&gt;allocate(r_mvgaussian_list2(1:n_rand_obs_in, 1:dimen) )&lt;/P&gt;&lt;P&gt;allocate(Q(1:dimen, 1:1))&lt;/P&gt;&lt;P&gt;!allocate(tcv(1:dimen, 1:dimen))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;newidentity = 1.0&lt;/P&gt;&lt;P&gt;!scaling factor as per algoritm&lt;/P&gt;&lt;P&gt;sd = (2.38)**2/dimen&lt;/P&gt;&lt;P&gt;meanvect = 0.0&lt;/P&gt;&lt;P&gt;meanvectnorm = 0.0&lt;/P&gt;&lt;P&gt;do j = 1, dimen&lt;/P&gt;&lt;P&gt;! identity matrix times scaling factor as per Roberts and Rosthenthal (2009) gives innitial value of covariance matrix&lt;/P&gt;&lt;P&gt;newidentity( j, j) = 1.0*(0.01)/dimen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;print *, newidentity&lt;/P&gt;&lt;P&gt;call random_number(harvest1)&lt;/P&gt;&lt;P&gt;seed_in1 = aint(harvest1 * 2.0e0**31)&lt;/P&gt;&lt;P&gt;meanvectnorm(1,1) = 0.2&lt;/P&gt;&lt;P&gt;meanvectnorm(2,1) = 0.3&lt;/P&gt;&lt;P&gt;meanvectnorm(3,1) = 0.001 &lt;/P&gt;&lt;P&gt;!print *, meanvectnorm&lt;/P&gt;&lt;P&gt;meanvectnormtrans = transpose(meanvectnorm)&lt;/P&gt;&lt;P&gt;! call spotrf('U', dimen, newidentity)&lt;/P&gt;&lt;P&gt;!call potrf( newidentity, 'U')&lt;/P&gt;&lt;P&gt;! note that since cholesky decomposition of newidentity does not change, since newidentity does not change one only needs to derive it once&lt;/P&gt;&lt;P&gt;newidentity2 = 0.0&lt;/P&gt;&lt;P&gt;do i = 1, dimen&lt;/P&gt;&lt;P&gt;do j = 1, dimen&lt;/P&gt;&lt;P&gt;if (i .ge. j) then&lt;/P&gt;&lt;P&gt;newidentity2(i,j) = newidentity(i,j)&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;print *, newidentity2&lt;/P&gt;&lt;P&gt;print *, "test"&lt;/P&gt;&lt;P&gt;call gaussianmv_rng_mkl(seed_in1, n_rand_obs_in, r_mvgaussian_list2, dimen, meanvectnormtrans, newidentity2)&lt;/P&gt;&lt;P&gt;!subroutine gaussianmv_rng_mkl(seed_in, n_rand_obs_in, r_mvgaussian_list, dimen, mean, tcv)&lt;/P&gt;&lt;P&gt;do i = 1, n_rand_obs_in&lt;/P&gt;&lt;P&gt;do j = 1, dimen&lt;/P&gt;&lt;P&gt;print *, r_mvgaussian_list2(i, j)&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;end program&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;which in turns calls the subroutine that I have created to use mutlivariate random numbers,&lt;/P&gt;&lt;P&gt;subroutine gaussianmv_rng_mkl(seed_in, n_rand_obs_in, r_mvgaussian_list, dimen, mean, tcv)&lt;/P&gt;&lt;P&gt;use :: mkl_vsl_type&lt;/P&gt;&lt;P&gt;integer :: brng&lt;/P&gt;&lt;P&gt;integer, intent(in) :: seed_in, n_rand_obs_in&lt;/P&gt;&lt;P&gt;real, pointer, intent(out) :: r_mvgaussian_list&lt;/P&gt;&lt;P&gt;type(VSL_STREAM_STATE) :: stream&lt;/P&gt;&lt;P&gt;integer :: status, methodrng&lt;/P&gt;&lt;P&gt;external :: vslnewstream, vsrnggausianmv, vsldeletestream&lt;/P&gt;&lt;P&gt;methodrng = VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER&lt;/P&gt;&lt;P&gt;mstorage = VSL_MATRIX_STORAGE_FULL&lt;/P&gt;&lt;P&gt;brng = vsl_brng_mcg31&lt;/P&gt;&lt;P&gt;status = vslnewstream(stream, brng, seed_in)&lt;/P&gt;&lt;P&gt;status = vsrnggaussianmv( methodrng, stream, n_rand_obs_in, r_mvgaussian_list, dimen, mstorage, mean, tcv)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;status = vsldeletestream(stream)&lt;/P&gt;&lt;P&gt;end subroutine&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2011 21:19:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GaussianMV-parameter-error/m-p/833817#M5884</guid>
      <dc:creator>jaureus</dc:creator>
      <dc:date>2011-04-25T21:19:26Z</dc:date>
    </item>
    <item>
      <title>GaussianMV parameter error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GaussianMV-parameter-error/m-p/833818#M5885</link>
      <description>see ....\mkl\examples\vslf</description>
      <pubDate>Tue, 26 Apr 2011 08:01:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GaussianMV-parameter-error/m-p/833818#M5885</guid>
      <dc:creator>yuriisig</dc:creator>
      <dc:date>2011-04-26T08:01:17Z</dc:date>
    </item>
    <item>
      <title>GaussianMV parameter error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GaussianMV-parameter-error/m-p/833819#M5886</link>
      <description>You have a large number of errors with respect to argument types in your sample code. To catch such errors at compile time rather than experiencing run-time aborts, use IMPLICIT NONE, use all available interface modules, and use /warn:all as a compiler option. Finally, note that one of the worst things you can do is to give the compiler an &lt;SPAN style="text-decoration: underline;"&gt;incorrect interface block&lt;/SPAN&gt;.&lt;BR /&gt;&lt;BR /&gt;The documentation clearly states that you need to supply the Cholesky factor T of the variance-covariance matrix as an argument.&lt;BR /&gt;&lt;BR /&gt;There is also a functioning example, &lt;I&gt;vsrnggaussianmv.f&lt;/I&gt;, provided in the MKL examples directory. The example shows the call the call to the Cholesky factorization routine &lt;I&gt;spotrf&lt;/I&gt;.&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Apr 2011 08:06:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GaussianMV-parameter-error/m-p/833819#M5886</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2011-04-26T08:06:40Z</dc:date>
    </item>
  </channel>
</rss>

