Ask Your Question
0

What is best practice to solve least square problem AX = B

asked 2017-06-03 16:17:37 -0600

UsmanArif gravatar image

Hi, i have a system of linear equations AX = B where A is 76800x6, B is 76800x1 and we have to find X, which is 6x1. I was using X = invert(AT* A) AT* B where AT is transpose of A. But i want to increase the speed of operation and also it dose not protect my calculation under singularity conditions. Is there any faster way to do this.?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-06-03 22:22:10 -0600

Tetragramm gravatar image

There is a handy function for this, the solve function.

solve(A, b, x, DECOMP_SVD);
edit flag offensive delete link more

Comments

X = invert(AT* A) AT* B is taking 4 min and 37 sec while solve is taking 8 min and 34 secs for a video on which i am working. Is there any thing more fast.?

UsmanArif gravatar imageUsmanArif ( 2017-06-04 00:12:11 -0600 )edit

SVD is the most stable version, with the ability to check singularity ect. Try DECOMP_NORMAL for speed.

Alternatively, may I suggest using a specialized matrix math library like Eigen? Then you can use whatever decomposition you need with whatever properties you desire. And it might very well be faster.

Tetragramm gravatar imageTetragramm ( 2017-06-04 18:23:05 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-06-03 16:17:37 -0600

Seen: 5,768 times

Last updated: Jun 03 '17