static void Main(String[] args) { try { String path1 = args[0], path2 = args[1]; Matrix matrix1 = MatrixReader.ReadMatrix(path1), matrix2 = MatrixReader.ReadMatrix(path2); Console.WriteLine(matrix1 * matrix2); } catch (IndexOutOfRangeException exn) { Console.Error.WriteLine("Paths to factors should be given."); } }
static void Main(string[] args) { try { string path1 = args[0]; string path2 = args[1]; Matrix factor1 = MatrixReader.Read(path1); Matrix factor2 = MatrixReader.Read(path2); Console.WriteLine(factor1 * factor2); } catch (IndexOutOfRangeException) { Console.Error.WriteLine("paths to factors must be given"); } }
static void Main(string[] args) { String m1_input = Console.ReadLine(), m2_input = Console.ReadLine(), output = Console.ReadLine(); Natural[][] t1 = new MatrixReader <Natural>(m1_input).GetResult(), t2 = new MatrixReader <Natural>(m2_input).GetResult(); try { Matrix <Natural> m1 = new Matrix <Natural>(t1), m2 = new Matrix <Natural>(t2); Matrix <Natural> m = Matrix <Natural> .Multiply(m1, m2, new NaturalSemiring()); MatrixWriter <Natural> .WriteMatrix(m.GetTable(), output); } catch (ArgumentException exception) { Console.WriteLine(exception.Message); } }