2矩阵的乘法 [英] multiplication of 2 matrix

查看:145
本文介绍了2矩阵的乘法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个java初学者,我有这个任务要做..创建一个给出2个矩阵的类,这些正确的维度,将通过乘以两者产生第三个矩阵。需要一个类Matrix,其中包含以下方法:

public Matrix multiply(Matrix multiplicand,Matrix multiplier);并且


public void display();

display()方法将在控制台上输出一个矩阵,列应该是选项卡并且

行打印在新行上,例如

20 6 112

1 -761 12

85 30 -65

矩阵可以有任意数量的列或行。您的Matrix类必须足够灵活以支持此功能。生成一个随机创建矩阵并将它们相乘的程序,始终显示每个矩阵(被乘数,乘数和结果......)


可以请一些人帮我处理这个任务吗?非常感谢

I am a java beginner and I was given this task to do.. to create a class which given 2 matrices,and these bein of the correct dimensions, will produce a third matrix by multiplying both. There is the need of a class Matrix which contains the following methods :

public Matrix multiply (Matrix multiplicand, Matrix multiplier); and

public void display();
The display() method will output a matrix upon the console, columns should be tabbed and
rows printed on a new line e.g.
20 6 112
1 -761 12
85 30 -65
The matrix may have a any number of columns or rows. Your Matrix class must be flexible enough to support this. Generate a program which randomly creates matrices and multiplies them, always displaying each matrix (the multiplicand, multiplier and the result..)

Can please some1 help me in dealing with this task? Thanks very much

推荐答案


我是一个java初学者,我有这个任务要做...创建一个给出2个矩阵的类,并且这些正确维度的bein将通过将两者相乘来产生第三个矩阵。需要一个类Matrix,其中包含以下方法:

public Matrix multiply(Matrix multiplicand,Matrix multiplier);并且


public void display();

display()方法将在控制台上输出一个矩阵,列应该是选项卡并且

行打印在新行上,例如

20 6 112

1 -761 12

85 30 -65

矩阵可以有任意数量的列或行。您的Matrix类必须足够灵活以支持此功能。生成一个随机创建矩阵并将它们相乘的程序,始终显示每个矩阵(被乘数,乘数和结果......)


可以请一些人帮我处理这个任务吗?非常感谢
I am a java beginner and I was given this task to do.. to create a class which given 2 matrices,and these bein of the correct dimensions, will produce a third matrix by multiplying both. There is the need of a class Matrix which contains the following methods :

public Matrix multiply (Matrix multiplicand, Matrix multiplier); and

public void display();
The display() method will output a matrix upon the console, columns should be tabbed and
rows printed on a new line e.g.
20 6 112
1 -761 12
85 30 -65
The matrix may have a any number of columns or rows. Your Matrix class must be flexible enough to support this. Generate a program which randomly creates matrices and multiplies them, always displaying each matrix (the multiplicand, multiplier and the result..)

Can please some1 help me in dealing with this task? Thanks very much



到目前为止你做了什么?

And what have you done so far?



我是一个java初学者,我有这个任务要做..创建一个给出2个矩阵的类,这些正确的维度,将通过乘以两者产生第三个矩阵。需要一个类Matrix,其中包含以下方法:

public Matrix multiply(Matrix multiplicand,Matrix multiplier);并且


public void display();

display()方法将在控制台上输出一个矩阵,列应该是选项卡并且

行打印在新行上,例如

20 6 112

1 -761 12

85 30 -65

矩阵可以有任意数量的列或行。您的Matrix类必须足够灵活以支持此功能。生成一个随机创建矩阵并将它们相乘的程序,始终显示每个矩阵(被乘数,乘数和结果......)


可以请一些人帮我处理这个任务吗?非常感谢
I am a java beginner and I was given this task to do.. to create a class which given 2 matrices,and these bein of the correct dimensions, will produce a third matrix by multiplying both. There is the need of a class Matrix which contains the following methods :

public Matrix multiply (Matrix multiplicand, Matrix multiplier); and

public void display();
The display() method will output a matrix upon the console, columns should be tabbed and
rows printed on a new line e.g.
20 6 112
1 -761 12
85 30 -65
The matrix may have a any number of columns or rows. Your Matrix class must be flexible enough to support this. Generate a program which randomly creates matrices and multiplies them, always displaying each matrix (the multiplicand, multiplier and the result..)

Can please some1 help me in dealing with this task? Thanks very much



因此对于分别有n行,m列和m行,p列的矩阵A和B,

什么是矩阵的大小C == A * B?


您如何测试A和B是否具有正确的尺寸?以及如何计算矩阵A的第i行的矩阵B的第j行的点积?


你计算了什么?你有没有想过这些子问题?


亲切的问候,


Jos

So for matrixes A and B with n rows, m columns and m rows, p columns respectively,
what would be the size of matrix C == A*B?

How would you test whether or not A and B have the correct sizes? and how
do you calculate the dot product of row i of matrix A times column j of matrix B?

What have you calculated then? Have you thought about these sub-problems?

kind regards,

Jos


我是什么知道我需要用2个数组[] []建立一个矩阵。需要随机生成这些数组的长度。另外第一个数组中的第一个元素需要乘以另一个数组中的第一个元素。


我不知道如何在java中执行此操作..也不知道怎么做随机生成数组的长度。


谢谢


问候


Christine
what i know is that i need to build a matrix with 2 arrays [] []. The length of these arrays need to be randomly generated. Also the first element in the first array needs to be multiplied by the first element in the other array.

I dont know how to do this in java.. also i dont know how to randomly generate the length of an array.

Thanks

Regards

Christine


这篇关于2矩阵的乘法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆