Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,2 @@
*Main> transpose [[1,2],[3,4],[5,6]]
[[1,3,5],[2,4,6]]

View file

@ -0,0 +1,7 @@
import Data.Array
swap (x,y) = (y,x)
transpArray :: (Ix a, Ix b) => Array (a,b) e -> Array (b,a) e
transpArray a = ixmap (swap l, swap u) swap a where
(l,u) = bounds a

View file

@ -0,0 +1,2 @@
tpose [ms] = [[m] | m <- ms]
tpose (ms:mss) = zipWith (:) ms (tpose mss)

View file

@ -0,0 +1,6 @@
import Data.Matrix
main :: IO ()
main = print matrix >> print (transpose matrix)
where
matrix = fromList 3 4 [1 ..]

View file

@ -0,0 +1,11 @@
import Numeric.LinearAlgebra
a :: Matrix I
a = (3><2)
[1,2
,3,4
,5,6]
main = do
print $ a
print $ tr a