问题描述
**已编辑**
我尝试使用libfixmath将提到的Jacobi算法更改为固定点但我得不到正确的结果。我错过了什么?
** ************************** Fisrt post ********************** ********************** *
C新手在这里。我在某种程度上让自己深陷其中,我无法找到自己的出路。如果你能提供帮助那就太棒了!
情况:我试图在C中实现ICA算法。我这样做是使用浮点运算(double,float )。现在我希望这段代码将它转换为固定点,这样我就可以在32位的ARM微控制器上导入它(这就是为什么我不能使用double,float等)。
我找到了四个我认为可以帮助我的库:
http://sourceforge.net/projects/avrfix/files/
http://www.dsprelated.com/showcode/40.php
http://sourceforge.net/p/fixedptc/code/ci/default/tree/
libfixmath
我没有使用1. 2.或3.我正在尝试使用libfixmath,因为所有的计算都是用矩阵完成的。
我的问题是当试图找到协方差矩阵(正对称3x3矩阵)的特征值和特征向量时。我在周围寻找能够进行特征分解或SVD等的库或函数,但我没有找到任何东西。
如何在固定点进行那种计算?有没有我没找到的功能/库?我是否必须改变浮点中的特征函数(逐行转换为固定点 - 即fix16_from_dbl())?
我当前的特征函数(当然不是我的,我认为它来自Numerical Recipes)
****我的第一个问题是,如果我的问题有任何问题需要纠正,请说出来...... :)
**编辑**
libfixmath确实,和QR分解。
我试着用数学运算并用这些数据产生矩阵的特征向量或特征值(来自上述函数的数据)bu我失败了。
如果有人知道怎么做那么问题就解决了。
** Edited **
I tried changing the mentioned Jacobi algorithm to fixed point using libfixmath but I am not getting right results. What did I miss??
edited Jacobi code
makefile
**************************** Fisrt post ********************************************
C newbie here. I somehow got my self in the deep and i cant find my way out. If you could help that would be awesome!
The situation: I am trying to implement an ICA algorithm in C. I did so using floating point arithmetic (double, float). Now I want this code to transform it to fixed point so I can import it on an ARM microcontroller of 32 bits (thats why i cant use double, float etc).
I have found four libraries that I think can help me:
http://sourceforge.net/projects/avrfix/files/
http://www.dsprelated.com/showcode/40.php
http://sourceforge.net/p/fixedptc/code/ci/default/tree/
libfixmath
I didnt use 1. 2. or 3. I am currently trying libfixmath because allmost all calculations are done with matrices.
My problem is when trying to find the eigenvalues and eigenvectors of a covariance matrix (positive symmetic 3x3 matrix). I searched around for libs or functions that do eigendecomposition or SVD etc. but i didnt find anything.
How to you do that sort of calculation in fixed point?? Are there any functions/libs that i didnt find out? Do I have to alter the eigen function that I have in floating-point (line by line converting to fixed point - i.e fix16_from_dbl() )?
My current eigen function (not mine of course i think it is from Numerical Recipes)
jacobi.h
****Is my first question if there is anything to correct in my question please say so... :)
** Edited **
libfixmath does Cholesky, wiki and QR decomposition.
I tried to play with maths and produce the eigenvectors or eigenvalue of a matrix with this data (data from the above functions) but I failed.
If anyone knows how to do that then problem solved.
推荐答案
这篇关于特征向量,特征值在C中的定点计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!