Exemple #1
0
        /**
         * <p>
         * Creates a new SimpleMatrix with random elements drawn from a uniform distribution from minValue to maxValue.
         * </p>
         *
         * @see RandomMatrices_DDRM#fillUniform(DMatrixRMaj,java.util.Random)
         *
         * @param numRows The number of rows in the new matrix
         * @param numCols The number of columns in the new matrix
         * @param minValue Lower bound
         * @param maxValue Upper bound
         * @param rand The random number generator that's used to fill the matrix.  @return The new random matrix.
         */
        public static SimpleMatrix <T> random64(int numRows, int numCols, double minValue, double maxValue, IMersenneTwister rand)
        {
            SimpleMatrix <T> ret = new SimpleMatrix <T>(numRows, numCols, typeof(DMatrixRMaj));

            RandomMatrices_DDRM.fillUniform(ret.mat as DMatrixRMaj, minValue, maxValue, rand);
            return(ret);
        }
Exemple #2
0
        /// <summary>
        /// Creates a real valued diagonal matrix of the specified type
        /// </summary>
        ///

        /*
         * public static SimpleMatrix diag(Type type, params double[] vals)
         * {
         *      SimpleMatrix M = new SimpleMatrix(vals.Length, vals.Length, type);
         *      for (int i = 0; i < vals.Length; i++)
         *      {
         *              M.set(i, i, vals[i]);
         *      }
         *      return M;
         * }*/

        /// <summary>
        /// <para>
        /// Creates a new SimpleMatrix with random elements drawn from a uniform distribution from minValue to maxValue.
        /// </para>
        /// </summary>
        /// <param name="numRows"> The number of rows in the new matrix </param>
        /// <param name="numCols"> The number of columns in the new matrix </param>
        /// <param name="minValue"> Lower bound </param>
        /// <param name="maxValue"> Upper bound </param> </param>
        /// <param name="rand"> The random number generator that's used to fill the matrix.  <returns> The new random matrix. </returns>
        /// <seealso cref= RandomMatrices_DDRM#fillUniform(DMatrixRMaj, java.util.Random) </seealso>
        public static SimpleMatrix <W> random_DDRM(int numRows, int numCols, double minValue, double maxValue, Random rand)
        {
            SimpleMatrix <W> ret = new SimpleMatrix <W>(numRows, numCols);

            Java.Util.Random rd = new Java.Util.Random();
            RandomMatrices_DDRM.fillUniform((DMatrixRMaj)ret.mat, minValue, maxValue, rd);
            return(ret);
        }
Exemple #3
0
        public static DMatrixRBlock createRandom(int numRows, int numCols,
                                                 double min, double max, IMersenneTwister rand)
        {
            DMatrixRBlock ret = new DMatrixRBlock(numRows, numCols);

            RandomMatrices_DDRM.fillUniform(ret, min, max, rand);

            return(ret);
        }