The following C# program will take two matrices of 2*2 order in its input and then print the product of them.
using System;
using System.Collections.Generic;
using System.Text;
namespace matrix_muliplication
{
class Program
{
static void Main(string[] args)
{
int i,j,k,l;
int[,] matrix=new int[2,2];
int[,] matri=new int [2,2];
int[,] matr=new int [2,2];
Console.WriteLine("Enter 1st 2*2 matrix: \n");
for (i=0;i<2;++i)
{
Console.WriteLine("Enter "+ (i+1) +"# row: ");
for (j=0;j<2;++j)
{
matrix[i,j]=Int32.Parse( Console.ReadLine());
}
}
Console.WriteLine("\n");
Console.WriteLine("Enter 2nd 2*2 matrix: \n");
for (i=0;i<2;++i)
{
Console.WriteLine("Enter "+(i+1)+" # row: ");
for (j=0;j<2;++j)
matri[i,j]=Int32.Parse(Console.ReadLine());
}
Console.WriteLine();
Console.WriteLine("Matrix muliplication");
for (j=0;j<2;++j)
{
for (i=0;i<2;++i)
{
for (l = 0; l < 2; ++l)
{
matr[i, j] = matr[i, j] + (matrix[i, l]) * (matri[l, j]);
}
}
}
for (i = 0; i < 2; i++)
{
for (j = 0; j < 2; j++)
{
Console.Write(matr[i, j] + "\t");
}
Console.WriteLine();
}
}
}
}
how to write a program for matrix multiplication in microprocesspr
maltiplication of matrix for algorithme
The matrix multiplication in c language : c program is used to multiply matrices with two dimensional array. This program multiplies two matrices which will be entered by the user.
Poor boy
That is true, matrix multiplication is not commutative.
Matrix addition is commutative if the elements in the matrices are themselves commutative.Matrix multiplication is not commutative.
C Examples on Matrix OperationsA matrix is a rectangular array of numbers or symbols arranged in rows and columns. The following section contains a list of C programs which perform the operations of Addition, Subtraction and Multiplication on the 2 matrices. The section also deals with evaluating the transpose of a given matrix. The transpose of a matrix is the interchange of rows and columns.The section also has programs on finding the trace of 2 matrices, calculating the sum and difference of two matrices. It also has a C program which is used to perform multiplication of a matrix using recursion.C Program to Calculate the Addition or Subtraction & Trace of 2 MatricesC Program to Find the Transpose of a given MatrixC Program to Compute the Product of Two MatricesC Program to Calculate the Sum & Difference of the MatricesC Program to Perform Matrix Multiplication using Recursion
The time complexity of the Strassen algorithm for matrix multiplication is O(n2.81).
Matrix multiplication typically refers to an operation which yields a new matrix from a pair of matrices which are already known. This is normally covered in an Algebra class or textbook.
13
7
ghanto