矩阵生发java_Java实现任意矩阵Strassen算法

本例输入为两个任意尺寸的矩阵m * n, n * m,输出为两个矩阵的乘积。计算任意尺寸矩阵相乘时,使用了Strassen算法。程序为自编,经过测试,请放心使用。基本算法是:

1.对于方阵(正方形矩阵),找到最大的l, 使得l = 2 ^ k, k为整数并且l < m。边长为l的方形矩阵则采用Strassen算法,其余部分以及方形矩阵中遗漏的部分用蛮力法。

2.对于非方阵,依照行列相应添加0使其成为方阵。

参考资料:1. http://wenku.baidu.com/link?url=qVuG2cKevujSNCSVtK1uS8k5VJu3gzJ_ZNs99un3uv5v5Mw2YEY2NlZbY9CI52HMYADnnovZNXgfEAfYSFIK3EPp9su5zhkJdgwStxxFDPy

2.Introduction to Algorithms, 3rd Edition

This program implements m * n matrices by using Strassen's algorithm. It is tested. The key is to divide the matrices into 2 cases:

1. If the matrices are square matrices. This means that we can find sub-matrice which has the largest edge length (size) in the code that is of length that can be expressed as form 2 ^ k, whereas k is an integer.

2. If the matrices are not square matrices, add 0 to rows and columns to make it like square m

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值