Be the first to rate this file! 3 Downloads (last 30 days) File Size: 1.18 KB File ID: #26583

Gram-Schmidt

by Vito Tafuni

 

03 Feb 2010

Gram-Schmidt algorithm to orthonormalize a set of vectors.

| Watch this File

File Information
Description

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)

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
gramschmidt, mathematics, orthogonalization, orthonormalization
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
03 Feb 2010 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

03 Feb 2010 Mo Chen

why not use QR

Contact us