问题标签 [matrix-multiplication]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
1617 浏览

php - 我将如何将 ASM 转换为 PHP?

有一个程序我想了解更多,但大部分是在 ASM 中。矩阵乘法

参考页在这里

我了解 C++,但 ASM 部分有点模糊。有人可以解释吗?

0 投票
3 回答
2658 浏览

matlab - 将矩阵分解为基本矩阵

MATLAB、Maple 或 Mathematica 中是否有一个包可以做到这一点?

0 投票
1 回答
1357 浏览

animation - Collada and Skeletal Animation

I am attempting to implement a skeletal animation setup within a game engine I am currently coding for my practicum at school. The engine is coded in c++ and directx 10 using a right handed system.

Currently I am using collada for importing and loading meshes (I know it's not the best solution available). The setup I am using uses quaternions for rotations which I convert to matrices just before passing the data off to the gpu for gpu skinning. I am using softimage for building test meshes to test various aspects of the animation code.

The issue I am having is when it comes to the rotation values. I am using D3DXQuaternionRotationYawPitchRoll to convert the rotation values over from euler angles to quaternions. Problem with this is that currently the animations are on the wrong axis. what should be a rotation around the y-axis is a rotation around the x-axis. For it to animation properly, I have to swap the x and y values and negate the y value. This is on just a simple extruded box with branches. For each animated bone I am currently calculating it's local transformation matrix (rotation matrix multiplied by translation matrix) which I then multiply parent matrix by the current local matrix to get the final transformed matrix relative to it's parent.

Is there some secret to handling collada rotations properly? everything I have checked shows the values are correct before multiplying each bone by the parent. Swapping the order of the matrix multiplications hasn't made any noticeable improvement. Any help is greatly appreciated, in the mean time I will work on other sections of the engine as I have spent too much time currently running in circles.

0 投票
0 回答
1529 浏览

lua - 平移和旋转矩阵

有没有人有代码来执行点 I. 2D 的平移和旋转的矩阵计算?

我一直在寻找整个网络,但没有找到我可以使用的形式。我正在用 lua 编码,但任何其他语言都可以。

非常感谢,

马特。

0 投票
1 回答
3317 浏览

c - 将 BLAS 中的三个矩阵相乘,中间一个是对角线

A是一个MxK矩阵,B是一个大小为 的向量KC是一个KxN矩阵。我应该使用哪组 BLAS 运算符来计算下面的矩阵?

实现这一点的一种方法是使用三个 for 循环,如下所示

为了获得更好的速度效率,是否真的值得在 BLAS 中实现这一点?

0 投票
4 回答
5705 浏览

python - 使用 Numpy 进行矩阵乘法

假设我有一个亲和矩阵 A 和一个对角矩阵 D。如何使用 nympy 在 Python 中计算拉普拉斯矩阵?

L = D^(-1/2) AD^(1/2)

目前,我使用 L = D**(-1/2) * A * D**(1/2)。这是正确的方法吗?

谢谢你。

0 投票
4 回答
874 浏览

java - Java 矩阵处理时间

我需要所有大师的简单意见!

我开发了一个程序来做一些矩阵计算。它适用于小矩阵。但是,当我开始计算大千列行矩阵时。它杀死了速度。

我正在考虑对每一行进行处理并将结果写入文件中,然后释放内存并开始处理第二行并写入文件,依此类推。

对提高速度有帮助吗?我必须做出很大的改变来实现这个改变。这就是为什么我需要你的意见。你怎么看?

谢谢

PS:我知道 colt 和 Jama 矩阵。由于公司规定,我不能使用这些包。


已编辑

在我的程序中,我将所有矩阵存储在二维数组中,如果矩阵很小,那很好。但是,当它有数千列和行时。然后将所有这些矩阵存储在内存中进行计算会导致性能问题。矩阵包含浮动值。对于处理,我读取内存中的所有矩阵存储,然后开始计算。计算后我将结果写入文件。

0 投票
3 回答
1305 浏览

c# - c#中的浮点和双精度

这里的矩阵乘法代码有点问题。我似乎在大矩阵乘法上失去了精度(我的代码在小矩阵上运行良好)。

我的循环如下:

如您所见,我强制使用(双)精度以确保在将两个浮点数相乘时不会丢失精度。

查看 IL 代码,我可以看到两个 conv.r8,这让我认为 IL 代码中有这种浮点到双精度的转换。

但是,在运行它并查看反汇编(x86 机器)时,我看到以下内容:

这让我觉得 JIT 认为由于我已经在乘以浮点数,它不应该使用双精度乘法而是单精度乘法,这给了我一直在跟踪的错误。

我对吗 ?有没有办法强制这种双精度乘法?

谢谢

0 投票
8 回答
245033 浏览

python - NumPy Matrix 与 Array 类的乘法有何不同?

numpy 文档建议使用数组而不是矩阵来处理矩阵。但是,与八度音程(直到最近我还在使用)不同,* 不执行矩阵乘法,您需要使用函数 matrixmultipy()。我觉得这使代码非常不可读。

有没有人分享我的观点,并找到了解决方案?

0 投票
2 回答
910 浏览

c++ - 向量的错误内存分配 C++

我在以下代码中收到 std_bad_alloc 错误。问题似乎是当我将矩阵添加到向量时,当我在调试器中到达该行时程序崩溃。问题是只从文件中读取前两个矩阵,其他两个不是因为程序因上述错误而崩溃。