java实现矩阵乘法public class MatrixMultiply { //A=A*B 将相乘的结果赋给A public static void Multiply(double[][
来源:互联网 发布:siam journal 知乎 编辑:程序博客网 时间:2024/05/29 09:01
- public class MatrixMultiply {
- //A=A*B 将相乘的结果赋给A
- public static void Multiply(double[][]A,int line,int list,double[][]B){
- double[][]C=new double[line][list];
- for(int i=0;i<line;i++)
- {
- for(int j=0;j<list;j++)
- {
- for(int a=0;a<list;a++)
- {
- C[i][j]+=A[i][a]*B[a][j];
- }
- }
- }
- for(int i=0;i<line;i++)
- {
- for(int j=0;j<list;j++)
- {
- A[i][j]=C[i][j];
- }
- }
- }
- public static void main(String[]args)//测试
- {
- double[][] TMatrix1 = {
- {1, 2},
- {3,4} ,
- {1,1}};
- double[][] TMatrix2={
- {1,-1},{-2,3}
- };
- String Strr=new String("");
- Multiply(TMatrix1,3,2, TMatrix2);
- for(int i=0;i<3;i++)
- {
- for(int j=0;j<2;j++)
- {
- String str=String.valueOf(TMatrix1[i][j]);
- Strr+=str;
- Strr+=" ";
- }
- Strr+="\n";
- }
- System.out.println(Strr);
- }
- }
0 0
- java实现矩阵乘法public class MatrixMultiply { //A=A*B 将相乘的结果赋给A public static void Multiply(double[][
- class A 和 class B: public A中A a; B b; A *p = &a; p->foo();相关题目
- Java之矩阵相乘(A=A*B)
- c++中,class C:public A,B和class C:public A,public B有什么区别
- public static final int a;
- public static string a与sting a的区别
- oracle 将A用户权限赋给B用户
- A* obj=new C(); obj->fun(); class C:public B { private: virtual fun()
- Erlang实现的矩阵相乘C=A*B单线程与并行多线程性能对比
- a = b(将 b 赋值给 a 的另类实现)
- public static void fill(Object[] a, int fromIndex, int toIndex, Object val)
- 将A表中某个字段的值赋给B表某个字段
- 匿名内部类到底可不可以继承类或实现接口? Interface A{ public void method(); } 这时你可以写一个如下的语句得到接口A的实现类的对象 A a=new
- Jar内外配置文件的读取public class JarReader { public static void main(String[] args) { String jarPath = "C
- ....Fragment must be a public static class to be properly recreated from instance state.
- IllegalStateException: Fragment null must be a public static class to be properly recreated from ins
- 将两个矩阵相乘,A为x行y列的矩阵,B为y行z列的矩阵,A*B
- Java题,class A { static int x; } class B { A a = new A(); a.x=1; }错在哪
- Device Interface Classes WDM
- C++基础_05
- Windows驱动小计
- Windows Inf文件
- Spring-AOP更加细化的织入时机
- java实现矩阵乘法public class MatrixMultiply { //A=A*B 将相乘的结果赋给A public static void Multiply(double[][
- tensorflow linspace
- nodejs中使用async来对异步操作进行同步,避免多个异步同时启动引发连接错误
- selenium 无法启动IE浏览器的解决方法
- recyclerView不显示数据
- Windows显示驱动参考
- 【学习笔记javascript设计模式与开发实践(代理模式)----6】
- 安装和卸载windows服务
- libcmt.lib