How to accelerate the SVD algorithm?

In summary, the conversation revolves around the performance of a program written in C language using the GR SVD algorithm compared to MATLAB's svd algorithm. The individual is disappointed with the performance and wishes to know which algorithm MATLAB uses. It is revealed that MATLAB uses the DGESVD routine from LAPACK for real-valued matrices. The individual is then criticized for not reading the documentation and wasting others' time. Further discussion is had about optimizing computations and using C++ template metaprogramming to improve performance.
  • #1
irongreat
9
0
I've written a program in c language in terms of the GR SVD algorithm. To my dispointment,its performance is worse than the svd of matlab. I wish to get to know which algorithm the MATLAB used. Who may tell me? Thanks.
 
Technology news on Phys.org
  • #2
Sigh.

irongreat said:
I've written a program in c language in terms of the GR SVD algorithm. To my dispointment,its performance is worse than the svd of matlab. I wish to get to know which algorithm the MATLAB used. Who may tell me?

Matlab will.

Code:
doc svd
 
  • #3
Oh, you said nothing.
 
  • #4
irongreat said:
Oh, you said nothing.

No, I told you that if you had had the startlingly obvious idea to check the documentation for svd in Matlab, you'd find which algorithms it uses to compute singular value decompositions.

If you want to be snippy towards someone who's given you the answer to your question, that's your business.
 
  • #5
You are not friendly,Shoehorn. I have read the MATLAB document. I know it use DGESVD. But I cannot find the details of the algorithm. So I asked the question.
Do take any thing for granted. Ok? GUY
 
  • #6
As a matter of fact ,I have found the source code of the algorithm. But I wonder the cause of its fast speed.So I hope to find the primitive document about the algorithm.
Who may tell me?
 
  • #7
irongreat said:
Oh, you said nothing.
Actually, shoehorn said everything. It was enough for you to figure out that, for real-valued matrices, MATLAB uses the DGESVD routine from LAPACK. That should have been enough of a clue for you to find the http://www.netlib.org/lapack/lug/" , which is probably what you were looking for.
 
Last edited by a moderator:
  • #8
irongreat said:
You are not friendly,Shoehorn. I have read the MATLAB document. I know it use DGESVD... So I asked the question.

So you know which algorithm Matlab uses for singular value decompositions, and yet you still decided to waste everyone's time by asking which algorithm Matlab uses for singular value decompositions?

Matlab has the best documentation of any software I've ever seen. Ever. Learn how to use it. 90% of the questions about Matlab on this forum are from people who are too lazy to read the documentation and instead want to waste other people's time by getting them to do work that they are too lazy/stupid to perform.
 
Last edited:
  • #9
So you know which algorithm Matlab uses for singular value decompositions, and yet you still decided to waste everyone's time by asking which algorithm Matlab uses for singular value decompositions?

Matlab has the best documentation of any software I've ever seen. Ever. Learn how to use it. 90% of the questions about Matlab on this forum are from people who are too lazy to read the documentation and instead want to waste other people's time by getting them to do work that they are too lazy/stupid to perform.

Don't insult me,ok? I only implement sth not by matlab.
If I used matlab, I not ask the question.

Matlab is a good software, but it is too large , I cannot put it into a hardware. So I have to implement svd by myself.
 
  • #10
I have to research linpack source code. It is more complicated than read the primitive document.

Sigh.
 
  • #11
I dislike those who take themselves as industrious men.
Is it a a great thing to develop sth on matlab?
 
  • #12
I dislike them also.

By taking advantage of the specific processor-memory architecture you can accelerate
computations in way not directly related to the mathematical algorithm:

using processor specific vectorization (SSE2,3,...)
blocking,
loop unrolling, ...

You would want to

optimize main memory to L2-cache traffic,
avoid TLB misses

and possibly many other things.

When you go up against MATLAB you are going up against Intel hand tuned BLAS
(10 times faster than naive code depending on the operation).

Large systems that try to optimize on different architectures are
ATLAS BLAS, GOTO BLAS.

Look for paper by Jack Donguerra for the issues involved.

Naive C-code is hopeless.

For a reasonably small system that accomlishes quite a lot using C++ template metaprogramming see Eigen2:
http://eigen.tuxfamily.org/index.php?title=Main_Page

This is your best chance to do something yourself and is also very elegant code.
 

1. How does the SVD algorithm work?

The SVD (Singular Value Decomposition) algorithm decomposes a matrix into three matrices, U, Σ, and V, where U and V are orthogonal matrices and Σ is a diagonal matrix. This decomposition allows us to simplify matrix operations and perform tasks such as dimensionality reduction and data compression.

2. What is the purpose of accelerating the SVD algorithm?

The SVD algorithm is a computationally intensive process, especially for large matrices. Accelerating the algorithm can significantly reduce the time and resources needed to perform matrix operations, making it more practical for real-world applications.

3. What are some techniques for accelerating the SVD algorithm?

There are several techniques for accelerating the SVD algorithm, including parallelization, matrix compression, and using randomized algorithms. Parallelization involves dividing the computation among multiple processors, while matrix compression reduces the size of the matrices involved. Randomized algorithms use a subset of the original matrix to approximate the SVD and can be significantly faster for large matrices.

4. How do I choose the best technique for accelerating the SVD algorithm?

The best technique for accelerating the SVD algorithm depends on the specific problem and the resources available. For example, if you have access to multiple processors, parallelization may be the most effective method. However, if you have limited resources, using a randomized algorithm may be a better choice. It is important to consider the trade-offs between accuracy and speed when choosing a technique.

5. Are there any drawbacks to accelerating the SVD algorithm?

While accelerating the SVD algorithm can greatly improve its speed and efficiency, there are some potential drawbacks to consider. For example, some acceleration techniques may sacrifice accuracy for speed, so it is important to evaluate the trade-offs carefully. Additionally, some techniques may only be effective for certain types of matrices or problems, so it is important to choose the right technique for your specific application.

Similar threads

  • Programming and Computer Science
Replies
8
Views
1K
Replies
9
Views
1K
  • Programming and Computer Science
Replies
30
Views
4K
  • Programming and Computer Science
Replies
14
Views
2K
Replies
3
Views
1K
  • Programming and Computer Science
Replies
13
Views
2K
  • Programming and Computer Science
Replies
25
Views
2K
  • Programming and Computer Science
Replies
29
Views
3K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
12
Views
1K
Back
Top