Ejemplo n.º 1
0
        /// <summary>
        /// Generates a new random real vector with the given <paramref name="length"/> and in the interval [min,max).
        /// </summary>
        /// <exception cref="ArgumentException">
        /// Thrown when <paramref name="length"/> is smaller or equal to 0.<br />
        /// Thrown when <paramref name="min"/> is greater than <paramref name="max"/>.
        /// </exception>
        /// <remarks>
        /// Note that if <paramref name="min"/> is equal to <paramref name="max"/>, all elements of the vector will be equal to <paramref name="min"/>.
        /// </remarks>
        /// <param name="random">The random number generator.</param>
        /// <param name="length">The length of the real vector.</param>
        /// <param name="bounds">The lower and upper bound (1st and 2nd column) of the positions in the vector. If there are less rows than dimensions, the rows are cycled.</param>
        /// <returns>The newly created real vector.</returns>
        public static RealVector Apply(IRandom random, int length, DoubleMatrix bounds)
        {
            RealVector result = new RealVector(length);

            result.Randomize(random, bounds);
            return(result);
        }
 /// <summary>
 /// Generates a new random real vector with the given <paramref name="length"/> and in the interval [min,max).
 /// </summary>
 /// <exception cref="ArgumentException">
 /// Thrown when <paramref name="length"/> is smaller or equal to 0.<br />
 /// Thrown when <paramref name="min"/> is greater than <paramref name="max"/>.
 /// </exception>
 /// <remarks>
 /// Note that if <paramref name="min"/> is equal to <paramref name="max"/>, all elements of the vector will be equal to <paramref name="min"/>.
 /// </remarks>
 /// <param name="random">The random number generator.</param>
 /// <param name="length">The length of the real vector.</param>
 /// <param name="bounds">The lower and upper bound (1st and 2nd column) of the positions in the vector. If there are less rows than dimensions, the rows are cycled.</param>
 /// <returns>The newly created real vector.</returns>
 public static RealVector Apply(IRandom random, int length, DoubleMatrix bounds) {
   RealVector result = new RealVector(length);
   result.Randomize(random, bounds);
   return result;
 }