# Where would you store a large, fluctuating Matrix?

**URL:** <https://www.ruby-forum.com/t/where-would-you-store-a-large-fluctuating-matrix/116601>\
**Category:** Rails\
**Created:** [October 7, 2007, 9:00pm UTC](https://www.ruby-forum.com/t/where-would-you-store-a-large-fluctuating-matrix/116601 "2007-10-07T21:00:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stuart](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/cab0a1/32.png) [@stuart](https://www.ruby-forum.com/u/stuart)\
**Post date:** [October 7, 2007, 9:00pm UTC](https://www.ruby-forum.com/t/where-would-you-store-a-large-fluctuating-matrix/116601/1 "2007-10-07T21:00:29Z")

</div>

I have a large matrix (~450x450) that I need to invert and multiply.  
I’m hoping matrix.rb will do the trick for me.

The interesting part is that in addition to the base 450x450, I need  
to accept new rows/columns into the matrix based on user input. So  
the base is:

xxxxx and I will need to add xxxxxy or remove the y, or add  
both xxxxxyz  
xxxxx  
xxxxxy  
xxxxxyz  
xxxxx  
xxxxxy xxxxxyz  
xxxxx  
xxxxxy xxxxxyz  
xxxxx  
xxxxxy xxxxxyz

00000y 00000yz

00000zz

My question is,  
(1) Where should I store these matrices? (in a static ruby  
array, or in Mysql?)  
(2) What methods will I need to manipulate the storage format  
into one that’s accessible by Matrix.rb? (see below).

Thanks for your interest!

Matrix.rb

Matrix.rows([[25, 93], [-1, 66]])  
Creates a matrix where rows is an array of arrays, each of which is a  
row to the matrix. If the optional argument copy is false, use the  
given arrays as the internal structure of the matrix without copying.

---

<div class="post-metadata">

**Author:** ![stuart](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/cab0a1/32.png) [@stuart](https://www.ruby-forum.com/u/stuart)\
**Post date:** [October 7, 2007, 9:05pm UTC](https://www.ruby-forum.com/t/where-would-you-store-a-large-fluctuating-matrix/116601/2 "2007-10-07T21:05:46Z")

</div>

Wow, the illustrations didn’t come out the way I had hoped. Maybe  
this will work better:

The base matrix is something like:

xxx  
xxx  
xxx

I’ll have to add other columns and rows (often more than one)

xxxy  
xxxy  
xxxy  
000y

and also be able to remove them.
