Esempio n. 1
0
 /// <summary>
 ///   Converts the string representation of a matrix to its
 ///   double-precision floating-point number matrix equivalent.
 ///   A return value indicates whether the conversion succeeded or failed.
 /// </summary>
 /// <param name="s">The string representation of the matrix.</param>
 /// <param name="provider">
 ///   The format provider to use in the conversion. Default is to use
 ///   <see cref="DefaultMatrixFormatProvider.CurrentCulture"/>.
 /// </param>
 /// <param name="matrix">A double-precision floating-point number matrix parsed
 /// from the given string using the given format provider.</param>
 /// <result>When this method returns, contains the double-precision floating-point
 /// number matrix equivalent to the <see param="s"/> parameter, if the conversion succeeded,
 /// or null if the conversion failed. The conversion fails if the <see param="s"/> parameter
 /// is null, is not a matrix in a valid format, or contains elements which represent
 /// a number less than MinValue or greater than MaxValue. This parameter is passed
 /// uninitialized. </result>
 ///
 public static bool TryParse(string s, IMatrixFormatProvider provider, out double[][] matrix)
 {
     return(Jagged.TryParse(s, provider, out matrix));
 }
Esempio n. 2
0
 /// <summary>
 ///   Applies a function to every element of the array.
 /// </summary>
 ///
 public static TResult[][] Apply <TInput, TResult>(this TInput[][] matrix, Func <TInput, int, int, TResult> func)
 {
     return(Apply(matrix, func, Jagged.CreateAs <TInput, TResult>(matrix)));
 }
Esempio n. 3
0
 public static double[][] ParseJagged(string s, IMatrixFormatProvider provider)
 {
     return(Jagged.Parse(s, provider));
 }
Esempio n. 4
0
        /// <summary>
        ///   Sets a region of a matrix to the given values.
        /// </summary>
        ///
        /// <param name="destination">The matrix where elements will be set.</param>
        /// <param name="value">The matrix of values to which matrix elements will be set.</param>
        /// <param name="rowIndices">Array of row indices</param>
        /// <param name="columnIndices">Array of column indices</param>
        ///
        public static void Set <T>(this T[][] destination, T value, int[] rowIndices, int[] columnIndices)
        {
            var values = Jagged.Create <T>(destination.Rows(), destination.Columns(), value);

            set(destination, rowIndices, columnIndices, values, rowIndices, columnIndices);
        }
Esempio n. 5
0
 /// <summary>
 ///   Sets a region of a matrix to the given values.
 /// </summary>
 ///
 /// <param name="destination">The matrix where elements will be set.</param>
 /// <param name="value">The value to which matrix elements will be set.</param>
 ///
 public static void Set <T>(this T[][] destination, T value)
 {
     Set(destination, Jagged.Create(destination.Rows(), destination.Columns(), value));
 }
Esempio n. 6
0
 /// <summary>
 ///   Sets a region of a matrix to the given values.
 /// </summary>
 ///
 /// <param name="destination">The matrix where elements will be set.</param>
 /// <param name="value">The matrix of values to which matrix elements will be set.</param>
 /// <param name="rowIndices">Array of row indices</param>
 /// <param name="startColumn">Start column index</param>
 /// <param name="endColumn">End column index</param>
 ///
 public static void Set <T>(this T[][] destination, T value, int[] rowIndices, int startColumn, int endColumn)
 {
     Set(destination, Jagged.Create(destination.Rows(), destination.Columns(), value), rowIndices, startColumn, endColumn);
 }
Esempio n. 7
0
 /// <summary>
 ///   Sets a region of a matrix to the given values.
 /// </summary>
 ///
 /// <param name="destination">The matrix where elements will be set.</param>
 /// <param name="value">The matrix of values to which matrix elements will be set.</param>
 /// <param name="startRow">Starting row index</param>
 /// <param name="endRow">End row index</param>
 /// <param name="columnIndices">Array of column indices</param>
 ///
 public static void Set <T>(this T[][] destination, T value, int startRow, int endRow, int[] columnIndices)
 {
     T[][] source = Jagged.Create(destination.Rows(), destination.Columns(), value);
     Set(destination, source, startRow, endRow, columnIndices);
 }
Esempio n. 8
0
 public static T[][] Diagonal <T>(int rows, int cols, T[] values)
 {
     return(Diagonal(rows, cols, values, Jagged.Create <T>(rows, cols)));
 }
Esempio n. 9
0
 /// <summary>
 ///   Transforms a vector into a matrix of given dimensions.
 /// </summary>
 ///
 public static T[][] Reshape <T>(T[] array, int rows, int cols, MatrixOrder order = MatrixOrder.Default)
 {
     return(Jagged.Reshape(array, rows, cols, Jagged.Create <T>(rows, cols), order));
 }
Esempio n. 10
0
 public static T[][] Diagonal <T>(int size, T value)
 {
     return(Diagonal(size, value, Jagged.Create <T>(size, size)));
 }
Esempio n. 11
0
 public static T[][] Diagonal <T>(T[] values)
 {
     return(Diagonal(values, Jagged.Create <T>(values.Length, values.Length)));
 }
Esempio n. 12
0
 public static double[][] KHot(bool[][] mask, int columns)
 {
     return(KHot(mask, Jagged.Create <double>(mask.Length, columns)));
 }
Esempio n. 13
0
 public static double[][] KHot(int[][] indices, int columns)
 {
     return(KHot(indices, Jagged.Create <double>(indices.Length, columns)));
 }
Esempio n. 14
0
 public static T[][] KHot <T>(int[][] indices, int columns)
 {
     return(KHot <T>(indices, Jagged.Create <T>(indices.Length, columns)));
 }
Esempio n. 15
0
 public static T[][] KHot <T>(bool[][] mask)
 {
     return(KHot <T>(mask, Jagged.CreateAs <bool, T>(mask)));
 }
Esempio n. 16
0
 public static T[][] OneHot <T>(bool[] mask)
 {
     return(OneHot <T>(mask, Jagged.Create <T>(mask.Length, 2)));
 }