![]() Registered Member ![]()
|
And if it is of any use to scope Eigen malloc checks, I have a class here:
https://github.com/eacousineau/amber_de ... ig.hpp#L92 in addition to a few simple unittests: https://github.com/eacousineau/amber_de ... config.cpp Note that the unittests for enabling EIGEN_RUNTIME_NO_MALLOC in one source file and disabling it in EIGEN_RUNTIME_NO_MALLOC in other source files fail for builds with debug symbols due to inlining behavior, at least with g++-4.6.3 on Ubuntu 12.04. |
![]() Moderator ![]()
|
It's not a good idea to explicitly compute the inverse of a matrix, unless it is close to be unitary and very small. In general this is numerically less accurate and much more expensive than calling solve on the factorized matrix: computing the inverse first requires to factorize the matrix and then call solve with a matrix on the right-hand-side.
|
![]() Registered Member ![]()
|
wow, i'll try your code as soon as possible! looks great. if you want to solve Ax = b, i read everywhere that taking the inverse wan't good at all for 1 stability, 2 speed. but maybe in some cases it will work. there are so many types of matrices that it depends i guess. Jeff |
![]() Registered Member ![]()
|
okay so now i have another challenge
one word : ROOTS ![]() here is some code i put up that doesn't raise the "malloc error"
but the thing is, it doesn't work. What i thought was : if a polynomial is of the form a0 + a1 *x + a2 * x*x + a3 * x*x*x ... + an * x^n, we could zeros some coeffs from "am" to "an", and still be able to compute the right roots. of course it would maybe take a little bit more computations, but in some cases, it's manageable (with nowadays CPU power) the only problem is that when i put all coeffs to 0 after index sizea, the solver reduces the size of the poly automatically and raises an error: Assertion failed : Scalar(0) != poly[poly.size()-1] even when i try to trick the solver by putting a very small value for "an" so...is there a way to compute roots in real-time? with my code or something else? thanks Jeff. |
![]() Moderator ![]()
|
The Polynomials module is in unsupported/ meaning that it did not received much polishing. Feel free to propose a patch fixing this issue. It should probably be enough to compute the actual degree in Companion.h and use the template Degree parameter as a maximal size in teh declaration of matrix/vector objects.
|
![]() Registered Member ![]()
|
i got an issue once again.
this time it's about a "simple" matrix multiplication the matrices are 512x512. I've succeeded in using multiplication with fixed-size matrices, but with matrices this big (512x512) it cannot be done this way. so i thought i would perform my own multiplication algorithm. Only problem it's soooo slooow (512x512x512 multiplications each time!)
So what are my options here ? Maybe separating the big matrices into smaller matrices ? but i don't know how to do that... Are there other ways i wouldn't've thought of? thanks for help. Jeff |
![]() Moderator ![]()
|
You should not have issue with our product implementation, however, do not forget the noalias() to avoid the creation of a temporary:
C.noalias() = A * B; |
![]() Registered Member ![]()
|
okay so finally i found how to perform block multiplications, it's super simple:
you just name some sub-matrices and do the mul like if it was scalars. for example : A = [1 2 3 4; 3 4 5 6; 4 5 6 7; 5 6 7 8] you put P1= [1 2; 3 4] p2 = [3 4 ; 56] ...etc and put the mul as : A = [P1 P2; P3 P4] and do the mul normally. i ended up with some code that works for Matrices with size >=N. You can change the value of N of course. The higher N, the faster the computation I did a quick benchmark. in debug mode : naïve computing : 48 sec optimized N=128 : 12 sec optimized N = 32 : 16 sec in release mode, naïve computing is less than 1 sec, so it globally goes as fast as in Matlab (which was the goal) ooops almost forgot the code:
tell me what you think of this code, can it be optimized? Jeff |
![]() Registered Member ![]()
|
EDI1: oh just saw the above post. will try noalias() and see the speed
Thanks bro you rock!. Jeff |
![]() Registered Member ![]()
|
eh, noalias() raises a no malloc flag! what's going on? |
![]() Moderator ![]()
|
Does your platform support alloca? In doubt try to compile with -DEIGEN_ALLOCA=alloca
|
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]