Ejemplo n.º 1
0
        /// <summary>
        /// Convert the matrix to a readable string.
        /// </summary>
        /// /// <param name="message">an optional message</param>
        /// <returns>A string.</returns>
        public string ToString(string message)
        {
            StringBuilder b = new StringBuilder();

            b.Append("Matrix (" + MatrixMath.Rows(Values) + "x" + MatrixMath.Columns(Values) + ")" + (message.Length > 0 ? " - " : "") + message + "\n");

            for (int r = 0; r < MatrixMath.Rows(Values); r++)
            {
                b.Append("[");
                for (int c = 0; c < MatrixMath.Columns(Values); c++)
                {
                    b.Append(Values[r][c]);
                    if (c + 1 != MatrixMath.Columns(Values))
                    {
                        b.Append(", ");
                    }
                }
                b.Append("]\n");
            }

            return(b.ToString());
        }
 public static bool CompareColumnsWithRows(float[][] a, float[][] b)
 {
     return(MatrixMath.Columns(a) == MatrixMath.Rows(b));
 }