# Singular value decomposition of rectangular matrices?

**URL:** <https://www.ruby-forum.com/t/singular-value-decomposition-of-rectangular-matrices/57405>\
**Category:** Ruby\
**Created:** [April 10, 2006, 6:09pm UTC](https://www.ruby-forum.com/t/singular-value-decomposition-of-rectangular-matrices/57405 "2006-04-10T18:09:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [April 10, 2006, 6:09pm UTC](https://www.ruby-forum.com/t/singular-value-decomposition-of-rectangular-matrices/57405/1 "2006-04-10T18:09:24Z")

</div>

Dear all,

I am searching for some code that can decompose rectangular  
matrices according to SVD.  
Unfortunately, rb-gsl can only handle square matrices.

Also, I’ve have some strange installation error with the linalg  
library.  
(I’ve posted a message to the list about this).  
Is there any other software that can singular-decompose a matrix  
that is rectangular and maybe really big and “very rectangular” ?  
Can someone who uses linalg tell me what options to use to tell  
install.rb what options to use ?

Thank you very much!

Best regards,

Axel

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [April 11, 2006, 4:00pm UTC](https://www.ruby-forum.com/t/singular-value-decomposition-of-rectangular-matrices/57405/2 "2006-04-11T16:00:09Z")

</div>

removed\_email\_address@domain.invalid wrote:

> Can someone who uses linalg tell me what options to use to tell  
> install.rb what options to use ?

What do you mean by “really big”? Does the matrix fit in _real_ memory  
on your system, or do you need an “out of core” SVD? Is the matrix dense  
or sparse? And are you just doing the SVD, or is there some real-world  
processing downstream of the singular values and vectors?

IIRC Lapack has a dense in-core SVD built in, and I know that R can do  
an SVD and many of the statistical functions downstream, like linear  
regression, principal component analysis, “machine learning”, etc. If  
you’re in a hurry, the best course of action might be to “shell out” to  
R from your Ruby code and read the singular values and vectors back in.

Sparse SVDs are a whole different ballgame. IIRC the algorithm of choice  
is a Lanczos code pioneered in Fortran a couple of decades back by Jane  
Cullum and Ralph Willoughby. A search of NetLib using

[http://www.netlib.org/cgi-bin/search.pl](http://www.netlib.org/cgi-bin/search.pl)

turned up this:

[http://www.netlib.org/tennessee/ut-cs-93-194.ps](http://www.netlib.org/tennessee/ut-cs-93-194.ps)

> Thank you very much!
> 
> Best regards,
> 
> Axel

–  
M. Edward (Ed) Borasky

> **[世界杯竞猜彩票-世界杯官网竞猜（集团）有限公司](http://www.linuxcapacityplanning.com/)**
>
> 世界杯竞猜彩票一直以来遵守商业道德，世界杯官网竞猜坚持诚信为本，保证诚实经营。世界杯竞猜彩票先后成为安徽省电子商务协会理事单位、安徽省网商协会会员单位、合肥市电子商务协会理事单位、合肥市服务外包行业协会会员单位、安徽省云计算产业促进会会员单位。世界杯官网竞猜一直保持良好的技术及服务态度，更好地为客户服务。

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [April 11, 2006, 4:58pm UTC](https://www.ruby-forum.com/t/singular-value-decomposition-of-rectangular-matrices/57405/3 "2006-04-11T16:58:43Z")

</div>

On Tue, 11 Apr 2006 removed\_email\_address@domain.invalid wrote:

> Can someone who uses linalg tell me what options to use to tell  
> install.rb what options to use ?
> 
> Thank you very much!
> 
> Best regards,
> 
> Axel

can you let us know what your install errors are? linalg can certainly  
do  
this…

-a
