Esempio n. 1
0
        /// <summary>Overrides the stream state data of a specific stream object with the data of the current object.
        /// </summary>
        /// <param name="destinationStream">The destination random number stream.</param>
        /// <exception cref="ArgumentException">Thrown, if the stream of the current instance and the stream represented by <paramref name="destinationStream"/> are not compatible.</exception>
        /// <remarks>Stream state data are for example the dimension etc.</remarks>
        public void CopyStreamStateTo(IRandomNumberStream destinationStream)
        {
            if (destinationStream == null)
            {
                throw new ArgumentNullException("destinationStream");
            }

            MklRandomNumberStream destinationVslRandomStream = destinationStream as MklRandomNumberStream;

            if (destinationVslRandomStream == null)
            {
                throw new ArgumentException("destinationStream");
            }

            int errorCode = vslCopyStreamState(destinationVslRandomStream.m_Handle, m_Handle);

            if (errorCode != 0) // execution is not successful
            {
                throw new ArgumentException("MKL: Return value " + errorCode + " in vslCopyStreamState.", "destinationStream");
            }
            destinationVslRandomStream.m_Dimension = m_Dimension;
            destinationVslRandomStream.m_Generator = m_Generator;
        }
 /// <summary>Initializes a new instance of the <see cref="Distribution" /> class.
 /// </summary>
 /// <param name="randomNumberStream">The random number stream.</param>
 internal Distribution(MklRandomNumberStream randomNumberStream)
 {
     m_Stream = randomNumberStream;
 }