<?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 How do I use MKL to sample from discrete probability distributi in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787072#M1909</link>
    <description>Thank you Andrey.&lt;BR /&gt;&lt;BR /&gt;I guess it will work. I'll make some follow up notes after I try this algorithm. Thanks!&lt;BR /&gt;&lt;BR /&gt;Jun</description>
    <pubDate>Sat, 13 Nov 2010 17:17:56 GMT</pubDate>
    <dc:creator>junuylia</dc:creator>
    <dc:date>2010-11-13T17:17:56Z</dc:date>
    <item>
      <title>How do I use MKL to sample from discrete probability distribution</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787070#M1907</link>
      <description>For example,&lt;BR /&gt;&lt;BR /&gt;I want to sample from a distribution with&lt;BR /&gt;&lt;BR /&gt;x=1,   2, 3&lt;BR /&gt;p(x)=1/2, 1/3, 1/6&lt;BR /&gt;&lt;BR /&gt;how do I do it with mkl library?&lt;BR /&gt;&lt;BR /&gt;Thank you very much.&lt;BR /&gt;&lt;BR /&gt;Jun</description>
      <pubDate>Sat, 13 Nov 2010 04:38:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787070#M1907</guid>
      <dc:creator>junuylia</dc:creator>
      <dc:date>2010-11-13T04:38:57Z</dc:date>
    </item>
    <item>
      <title>How do I use MKL to sample from discrete probability distributi</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787071#M1908</link>
      <description>Hello Jun,&lt;BR /&gt;&lt;BR /&gt;You may want to follow the algorithm described below. &lt;BR /&gt;&lt;BR /&gt;1. Split the interval I=[0,1) into three sub-intervals:&lt;BR /&gt; I1 = [0, 1/2)&lt;BR /&gt; I2 = [1/2, 5/6), 5/6=1/2+1/3&lt;BR /&gt; I3 = [5/6,1)&lt;BR /&gt;&lt;BR /&gt;2. Generate uniformly distributed on the interval I random numbers u(1),...,u(n) using VSL RNG routine &lt;BR /&gt;v[d|s]RngUniform.&lt;BR /&gt;&lt;BR /&gt;3. For each number u(i) find the interval Ij which contains u(i) and set y(i) to j&lt;BR /&gt;&lt;BR /&gt;4. Output of the algorithm is sequence y(1),...,y(n)&lt;BR /&gt;&lt;BR /&gt;Please, let me know if this answers your question.&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Andrey&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 13 Nov 2010 07:06:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787071#M1908</guid>
      <dc:creator>Andrey_N_Intel</dc:creator>
      <dc:date>2010-11-13T07:06:10Z</dc:date>
    </item>
    <item>
      <title>How do I use MKL to sample from discrete probability distributi</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787072#M1909</link>
      <description>Thank you Andrey.&lt;BR /&gt;&lt;BR /&gt;I guess it will work. I'll make some follow up notes after I try this algorithm. Thanks!&lt;BR /&gt;&lt;BR /&gt;Jun</description>
      <pubDate>Sat, 13 Nov 2010 17:17:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787072#M1909</guid>
      <dc:creator>junuylia</dc:creator>
      <dc:date>2010-11-13T17:17:56Z</dc:date>
    </item>
    <item>
      <title>How do I use MKL to sample from discrete probability distributi</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787073#M1910</link>
      <description>No need for guesses! For a continuous random variable &lt;I&gt;X&lt;/I&gt; with range &lt;I&gt;(a,b)&lt;/I&gt; with density function &lt;I&gt;f(x)&lt;/I&gt;, define the cumulative probability function &lt;I&gt;F(x) = \int_a^x&lt;/I&gt;&lt;I&gt; f(t) dt&lt;/I&gt;,&lt;I&gt; &lt;/I&gt;where \int_a^x stands for "integral from t=a to t=x". Then, the random variable &lt;I&gt;U&lt;/I&gt; defined by &lt;I&gt;U&lt;/I&gt;&lt;I&gt; = F(X) / F(b)&lt;/I&gt; is uniformly distributed with range (0,1).&lt;BR /&gt;&lt;BR /&gt;For discrete random distributions, replace integrals by sums in the definition of &lt;I&gt;F(x)&lt;/I&gt;. The algorithm that Andrey described for you essentially solves &lt;I&gt;F(X) = U&lt;/I&gt;, where &lt;I&gt;U&lt;/I&gt; is obtained from a uniform random number generator. The solution &lt;I&gt;X&lt;/I&gt; is the result that you sought.&lt;BR /&gt;&lt;BR /&gt;To supplement the mathematical argument that I stated, you can easily run a Monte-Carlo simulation, generating a few million random numbers with your distribution. Count the numbers of times that 1, 2 and 3 occur in the sequence, and divide by the number of random numbers generated. The resulting fractions should be close to 1/2, 1/3 and 1/6.&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Nov 2010 11:19:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787073#M1910</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2010-11-15T11:19:36Z</dc:date>
    </item>
    <item>
      <title>How do I use MKL to sample from discrete probability distributi</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787074#M1911</link>
      <description>I just saw this, which explains a lot. I've used the previous method, and it works. &lt;BR /&gt;&lt;BR /&gt;This method is new for me, and I'll try it later. Thanks a lot!</description>
      <pubDate>Thu, 21 Apr 2011 21:20:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-I-use-MKL-to-sample-from-discrete-probability/m-p/787074#M1911</guid>
      <dc:creator>junuylia</dc:creator>
      <dc:date>2011-04-21T21:20:12Z</dc:date>
    </item>
  </channel>
</rss>

