File Exchange

image thumbnail

Gram-Schmidt

version 1.0.0.0 (1.18 KB) by Vito Tafuni
Gram-Schmidt algorithm to orthonormalize a set of vectors.

6 Downloads

Updated 03 Feb 2010

View License

The set of vectors is passed like column vectors of a matrix.
This algorithm take advantage of the matrix form using sub matrix (more vectors at the same time).
I've tested it with a random 1000x1000 matrix (so 1000 vectors 1000x1) giving a result in 7.4863 sec (mean value on 5 executions... best time 7.2321)

Cite As

Vito Tafuni (2021). Gram-Schmidt (https://www.mathworks.com/matlabcentral/fileexchange/26583-gram-schmidt), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

John

Gram Schmidt provided a ranking of the columns based on reduction of remaining columns. This function doesn't have that processing.

Vito Tafuni

I think QR performs better on square matrices:

A=rand(500,500);
t=time;[Q,R]=qr(A);time-t
ans = 0.18440
t=time;O=grsm(A);time-t
ans = 0.60662

A=rand(500,10);
t=time;[Q,R]=qr(A);time-t
ans = 0.020872
t=time;O=grsm(A);time-t
ans = 0.0041921

Mo Chen

why not use QR

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Acknowledgements

Inspired: Gramschmidt matrix

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!