| | |
I need help with matrix....please!!!
![]() |
•
•
Join Date: Sep 2004
Posts: 2
Reputation:
Solved Threads: 0
I got this far....but its not giving me the required output....can you give me some directions....here are my codes....thanks....please refer to my pdf file for the question.//import java.lang.*;
import java.math.*;
import java.io.*;
class MatMulti extends Thread
{
static int in1[][];
static int in2[][];
static int out[][];
static int n=2;
int row;
MatMulti(int i)
{
row=i;
this.start();
}
public void run()
{
int i,j;
for(i=0;i<n;i++)
{
out[row]=0;
for(j=0;j<n;j++)
out[row]=out[row]+in1[row][j]*in2[j];
}
}
public static void main(String args[])
{
int i,j;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the order of Matrix A : ");
try
{
n=Integer.parseInt(br.readLine());
}catch(Exception e){}
in1=new int[n][n];
in2=new int[n][n];
out=new int[n][n];
System.out.println("Enter the First Matrix : ");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
try
{
in1[j]=Integer.parseInt(br.readLine());
}catch(Exception e){}
}
}
System.out.println("Enter the Second Matrix : ");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
try
{
in2[j]=Integer.parseInt(br.readLine());
}catch(Exception e){}
}
}
MatMulti mat[]=new MatMulti[n];
for(i=0;i<n;i++)
mat=new MatMulti(i);
try
{
for(i=0;i<n;i++)
mat.join();
}catch(Exception e){}
System.out.println("OUTPUT :");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
System.out.println(out[j]);
}
}
Tell us what it is you think you need to do with this code, and try to solve it yourself. you should just put the small snippet of code that shows how you would like to solve the problem, then we can help you.
Also, put your code within [ CODE ] [ / CODE ] tags. Otherwise it is hard to help you.
Ed
Also, put your code within [ CODE ] [ / CODE ] tags. Otherwise it is hard to help you.
Ed
•
•
•
•
In a world without walls or fences,
What use are Windows and Gates.
•
•
Join Date: Sep 2004
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by cosi
Tell us what it is you think you need to do with this code, and try to solve it yourself. you should just put the small snippet of code that shows how you would like to solve the problem, then we can help you.
Also, put your code within [ CODE ] [ / CODE ] tags. Otherwise it is hard to help you.
Ed
If you refer to my pdf file.....thats the out put i want
firstly the size of matrix...then input first matrix by user using dialog box and so on......but the output is displayed on command prompt
eg:
Matrix A:
1.0 2.0 3.0
4.0 5.0 6.0
Matrix B:
7.0 8.0 9.0
0.0 9.0 8.0
7.0 6.0 5.0
Product of Matrix A and B
28.0 44.0 40.0
70.0 113.0 106.0
thanks
Rashil
![]() |
Similar Threads
- The Matrix & Philosophy (Geeks' Lounge)
- I MUST HAVE this Microsoft - Matrix video with Bill Gates + Steve Ballmer from Comdex (Geeks' Lounge)
- Enter the Matrix-not working (Windows NT / 2000 / XP)
- MATRIX REVOLUTIONS in the IMAX (Geeks' Lounge)
- Microsoft Releases Web Matrix (ASP.NET)
Other Threads in the Java Forum
- Previous Thread: creating dynamic textfields
- Next Thread: jbuilder 9
| Thread Tools | Search this Thread |
account android applet application apps array automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer homework html ide image inheritance integer integration intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield jtree julia linux loop method midlethttpconnection migrate mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source oracle plazmic print problem program property ria scanner server set sharepoint smart sms smsspam sourcelabs splash sql sqlite subclass support swing testautomation textfield threads tree trolltech unlimited utility windows





