TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Did you know you can multiply matrices without multiplication?

6 pointsby danbstabout 2 years ago
TL;DR: This idea implemented in Python https:&#x2F;&#x2F;gist.github.com&#x2F;danbst&#x2F;fdf604ae279f9e01c8a28f1f84f9876e<p>Hello. Long time ago I have learned that<p><pre><code> log(xy) = log(x) + log(y) </code></pre> and that this was used by Napier to multiply numbers. Also I knew that matrix multiplication time is dominated by inner dot products, which use addition and multiplication.<p>And it just stuck me today, that it is possible to multiply matrices in logarithmic space (that is, matrix values are logs of real values) without multiplication! By using same trick Napier did.<p>(There are restrictions, as negative values produce complex logarithms. So it has to be handled carefully)

1 comment

mikequinlanabout 2 years ago
This can (obviously) be done to replace any multiplication. The problem is that 2 logs, an add, and an exponentiation are a lot slower than a single multiply.
评论 #34940136 未加载
评论 #34940146 未加载
评论 #34940141 未加载