kharish
code for multiplication of matrix in java using methods
Posted in : Java Beginners

code for multiplication of matrix in java using methods

April 20, 2011 at 10:55 AM

```   import java.util.*;
class MatrixMultiplication{

public static void main(String[] args){
Scanner input = new Scanner(System.in);
int[][] A = new int[3][3];
int[][] B = new int[3][3];
int[][] C = new int[3][3];
System.out.println("Enter elements for matrix A : ");
for (int i=0 ; i < A.length ; i++)
for  (int j=0 ; j < A[i].length ; j++){
A[i][j] = input.nextInt();
}
System.out.println("Enter elements for matrix B : ");
for (int i=0 ; i < B.length ; i++)
for  (int j=0 ; j < B[i].length ; j++){
B[i][j] = input.nextInt();
}
System.out.println("Matrix A: ");
for (int i=0 ; i < A.length ; i++){
System.out.println();
for  (int j=0 ; j < A[i].length ; j++){
System.out.print(A[i][j]+" ");
}
}
System.out.println();
System.out.println();
System.out.println("Matrix B: ");
for (int i=0 ; i < B.length ; i++){
System.out.println();
for  (int j=0 ; j < B[i].length ; j++){
System.out.print(B[i][j]+" ");
}
}
System.out.println();
System.out.println();
System.out.println("Result is: ");
System.out.println();

for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
for(int k=0;k<3;k++){
C[i][j]+=A[i][k]*B[k][j];
}
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
System.out.print(+C[i][j]+" ");
}
System.out.println();
}
}
}
```

October 28, 2011 at 10:12 PM

for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ for(int k=0;k<3;k++){ C[i][j]+=A[i][k]*B[k][j]; } } } It is a super formula for Multiplication of matrix

I also did this by using the following code

for(int i=1,c=1,d=1,p=1,o=1;o<=3;o++,++c,++p){ for(int j=1,q=1;j<=3;j++,++q){
z[p][q]=x[c][d]y[i][j]+x[c][d+1]y[i+1][j]+x[c][d+2]*y[i+2][j]; } }

the codeing which I done seems to be more complicated but I did with only two "for loops"

code for multiplication of matrix in java using methods
code for multiplication of matrix in java using methods  code for multiplication of matrix in java using methods
Parallel multiplication matrix in java
Parallel multiplication matrix in java  hello dear I need parallel multiply matrix in java algorithm to account speed up and efficiency great wishes
Matrix Multiplication in Java
Matrix Multiplication in Java In this Java tutorial we will demonstrate you 'Matrix Multiplication in Java' with the help of a simple example from which you can easily learn how to write a matrix multiplication program in Java
Matrix multiplication
Matrix multiplication  program to read the elements of the given two matrices of order n*n and to perform the matrix multiplication
parallel dense matrix multiplication
using dense parallel matrix multiplication. I request you to kindly provide me a code for Parallel Matrix multiplication on distributed systems using Java...parallel dense matrix multiplication  hi friends, i am a final year
determinant of n*n matrix using java code
determinant of n*n matrix using java code  Here is my code... Scanner(System.in); System.out.println("enter dimension of matrix"); N...]; } System.out.println("enter the elements of matrix"); for(int i=0;i<N;i
Matrix Addition using RMI in Java
Matrix Addition using RMI in Java  Source Code for Matrix Addition using RMI in Java
Matrix multiplication in java
Matrix multiplication in java In this section we will learn about multiplication of two matrices. In java this is a simple program to multiply two matrices... two-dimensional array. Here we are going to develop a Java code for matrices
Find sum of all the elements of matrix using Java
Find sum of all the elements of matrix using Java A matrix is a rectangular array of numbers. The numbers in the matrix are called its entries or its elements. A matrix with m rows and n columns is called m-by-n matrix or m × n matrix
Multiplication of two Matrix
Multiplication of Two Matrix   .... The Java two dimensional array  program is operate to the two matrix number. In this program also provided Java source code with understanding the Java
Multiplication of two polynomials using linked list in java
Multiplication of two polynomials using linked list in java  I am doing a program "Multiplication of two polynomials using linked list in java...; Node q = front; //insert in front if exponent is higher
Multiplication of two Matrix
for multiplying two matrix to each other. Here providing you Java source code... by using the array1.length. After getting both matrix then multiply to it. Both matrix will be multiplied to each other by using 'for' loop. So the output
Java, matrix
"); System.out.println("3. Multiplication Of Matrix"); System.out.println("4. Exit"); boolean quit...Java, matrix  java program to get output on the basis of users choice of switch statement perform operations addition, subtraction and multiplication
Display tow dimensional array by matrix form using one for loop in java
Display tow dimensional array by matrix form using one for loop in java  Display tow dimensional array by matrix form using one for loop in java
code for a simple java program which performs basic arithmetic operation addition,subtraction,multiplication,division........
code for a simple java program which performs basic arithmetic operation addition,subtraction,multiplication,division........  code for a simple java...,multiplication,division
java program_big digits multiplication..
java program_big digits multiplication..  i want program about big digits multiplication program using java..plz tel me answer
matrix calculator - Java Beginners
matrix calculator  hi..... can you help me in writing source code of matrix calculator in java... i know you are the best you can do it!!! show yourself
Multiplication problem - Java Beginners
Multiplication problem  I am facing a peculiar problem in java regarding a multiplication. Please see below: 19300 * 0.001 = 19.3 19400 * 0.001 = 19.400000000000002 (why is this ??) 19500 * 0.001 = 19.5 Can anybody help
using class and methods - Java Beginners
using class and methods  Sir,Plz help me to write this below pgm. here is the question: Assume a table for annual examination results for 10... the following code: import java.util.*; public class Student{ int rollNo
java string multiplication
java string multiplication  Is there any simple method of string multiplication in java ..?   public class StringMultiplication { public static void main(String[] args) { String number1 = "17"; String number2
multiplication algorithms in java divide and conquer
multiplication algorithms in java divide and conquer  I need multiplication algorithms in java divide and conquer ask from user input two numbers in binary then the program multiply two number use multiplication algorithm in java
multiplication algorithms in java divide and conquer
multiplication algorithms in java divide and conquer  I need multiplication algorithms in java divide and conquer ask from user input two numbers in binary then the program multiply two number use multiplication algorithm in java
multiplication algorithms in java divide and conquer
multiplication algorithms in java divide and conquer  I need multiplication algorithms in java divide and conquer ask from user input two numbers in binary then the program multiply two number use multiplication algorithm in java
Java Matrix Multiplication Example
Java Matrix Multiplication Example In this tutorial, you will learn how... the multiplication of two matrices of any order. In the given program, firstly we have... and then accept the matrix elements as array elements. We have declared two
multiplication
multiplication  multiplication of two number numbers entered by user minimum 100digits using GUI   Java Multiplication of two 100 digits number import java.awt.*; import java.math.*; import javax.swing.*; import
multiplication
multiplication  multiplication of two number numbers entered by user minimum 100digits using GUI   Java Multiplication of two 100 digits number import java.awt.*; import java.math.*; import javax.swing.*; import
Matrix - Java Beginners
Matrix  give me the Matrix program   Hi friend, Code for Matrix Example in Java class MatrixExample{ public static void main...(" ]"); } System.out.println(); } } For more information on java visit to : http
matrix determination in java
matrix determination in java  hai
Java Transpose of a matrix
Java Transpose of a matrix In this section, you will learn how to determine... to create a matrix. Then using the for loop statements, turn all the rows of the matrix into columns and vice-versa. Here is the code: import java.util.
java code using swings
java code using swings  code that should be able to enter data of student details using all swings into the access database using jdbc connectivity
core java ,io operation,calling methods using switch cases
core java ,io operation,calling methods using switch cases  How to create a dictionary program,providing user inputs using io operations with switch cases and providing different options for searching,editing,storing meanings
Tutorials