uncomplicate / neanderthal

Fast Clojure Matrix Library
http://neanderthal.uncomplicate.org
Eclipse Public License 1.0
1.06k stars 56 forks source link

Why is the source in GE matrices column-oriented by default? #90

Closed vascoferreira25 closed 4 years ago

vascoferreira25 commented 4 years ago

Hi, why is it that when you specify a source for a GE matrix, it is by default column-oriented?

For example:

(dge [[1 2 3]
      [4 5 6]])

;; => #RealGEMatrix[double, mxn:3x2, layout:column, offset:0]
;;    ▥        ↓       ↓       ┓    
;;    →       1.00    4.00         
;;    →       2.00    5.00         
;;    →       3.00    6.00         
;;     ┗                       ┛    

I know that if I specify the rows, columns and the layout it will stay as it should, but I don't understand why.

(dge 2 3 [[1 2 3]
          [4 5 6]] {:layout :row})

;; => #RealGEMatrix[double, mxn:2x3, layout:row, offset:0]
;;    ▤       ↓       ↓       ↓       ┓    
;;    →       1.00    2.00    3.00         
;;    →       4.00    5.00    6.00         
;;     ┗                               ┛    
blueberry commented 4 years ago

Because something has to be default, and it is the column layout, which is also default in Fortran, and in lots of other data analysis software because (statistical) variables are usually represented by columns.