计算矩阵乘以转置的有效算法

发布于 2024-12-06 17:59:54 字数 1435 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

动听の歌 2024-12-13 17:59:54

截至目前,这种特定乘法尚不存在任何渐近屏障破坏特性。

明显的优化是利用产品的对称性。也就是说,第[i][j]条目等于第[j][i]条目。

对于特定于实现的优化,您可以执行大量缓存。在大型矩阵乘法中,大量时间花费在内存和 CPU 之间的数据传输上。因此,CPU 设计者实现了一种智能缓存系统,将最近使用的内存存储在称为缓存的小内存部分中。除此之外,他们还使得附近内存也被缓存。这是因为大量内存 IO 是由于从数组读取/写入数组而产生的,而数组是顺序存储的。

由于矩阵的转置只是交换索引的同一矩阵,因此在矩阵中缓存值可能会产生两倍以上的影响。

As of right now there aren't any aymptotic barrier-breaking properties of this particular multiplication.

The obvious optimization is to take advantage of the symmetry of the product. That is to say, the [i][j]th entry is equal to the [j][i]th entry.

For implementation-specific optimizations, there is a significant amount of caching that you can do. A very significant amount of time in the multiplication of large matrices is spent transferring data to and from memory and CPU. So CPU designers implemented a smart caching system whereby recently used memory is stored in a small memory section called the cache. In addition to that, they also made it so that nearby memory is also cached. This is because a lot of the memory IO is due to reading/writing from/to arrays, which are stored sequentially.

Since the transpose of a matrix is simply the same matrix with the indices swapped, caching a value in the matrix can have over twice the impact.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文