JAVA实现矩阵连乘问题
来源:互联网 发布:画网络拓扑图 app 编辑:程序博客网 时间:2024/06/15 08:30
public class MatrixMultiply { public static int[][] matrixMultiply(int a[][], int b[][]) { int c[][] = new int[a.length][b[0].length]; if (a[0].length == b.length) { // 控制循环次数 for(int i=0;i<a.length;i++){ for (int j = 0; j < b[0].length; j++) { int sum = 0; for (int k = 0; k < a.length; k++) { sum = sum + a[i][k] * b[k][j]; System.out.println(a[i][k]+" * "+b[k][j]+"----->"+sum); } c[i][j]=sum; } } } else { System.out.println("矩阵不能相乘!"); } return null; } public static void main(String[] args) { // TODO Auto-generated method stub int a[][] = { { 1, 2, 3 }, { 4, 5, 6 } }; int b[][] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; MatrixMultiply .matrixMultiply(a, b); }}
0 0
- 矩阵连乘问题的java实现
- JAVA实现矩阵连乘问题
- 动态规划求解矩阵连乘问题Java实现
- java实现动态规划求解矩阵连乘问题
- C语言实现矩阵连乘问题
- 矩阵连乘问题 C语言实现
- 动态规划实现矩阵连乘问题
- 矩阵连乘问题
- 矩阵连乘问题
- 矩阵连乘问题
- 矩阵连乘问题
- 矩阵连乘问题
- 矩阵连乘问题
- 矩阵连乘问题
- 矩阵连乘问题
- 矩阵连乘问题
- 矩阵连乘问题
- 矩阵连乘问题
- POJ 3578 Card Game 可能会
- UVA442书上解法 对于栈的学习
- 考研机试整理
- 万年模拟- UVA - 210
- 1. 网络编程基础与Wireshark使用
- JAVA实现矩阵连乘问题
- 深入解读Spring Framework Web MVC(第四弹:使用@RequestMapping映射请求)
- 润乾报表Api后台导出报表组到PDF
- JavaScript数组操作常用函数总结
- git-push报错failed to push some refs to
- 刘未鹏的书单
- 字符串加密工具
- chrome视频无法播放的解决方法(Solve the problem of Google player cannot be played normally)
- Android 利用DOM,SAX,PULL解析xml文件