forsyde-atom-0.3.0.0: Shallow-embedded DSL for modeling cyber-physical systems
Safe HaskellSafe
LanguageHaskell2010

ForSyDe.Atom.Skel.FastVector.Matrix

Synopsis

Documentation

type Matrix a = Vector (Vector a) Source #

Matrix is simply a type synonym for vector of vectors. This means that any function on Vector works also on Matrix.

pretty Source #

Arguments

:: Show a 
=> String

separator string

-> Matrix a

input matrix

-> IO () 

Prints out to the terminal a matrix in a readable format, where all elements are right-aligned and separated by a custom separator.

>>> let m = matrix 3 3 [1,2,3,3,100,4,12,32,67]
>>> pretty "|" m
 1|  2| 3
 3|100| 4
12| 32|67

size :: Matrix a -> (Int, Int) Source #

See size.

groupEvery :: Int -> [a] -> [[a]] Source #

matrix Source #

Arguments

:: Int

number of columns (X dimension) = x

-> Int

number of rows (Y dimension) = y

-> [a]

list of values; length = x * y

-> Matrix a

Matrix of values; size = (x,y)

See Matrix.

fromMatrix Source #

Arguments

:: Matrix a

size = (x,y)

-> [a]

length = x * y

fanout :: a -> Matrix a Source #

See fanout.

farm11 Source #

Arguments

:: (a -> b) 
-> Matrix a

size = (xa,ya)

-> Matrix b

size = (xa,ya)

See farm11.

farm21 Source #

Arguments

:: (a -> b -> c) 
-> Matrix a

size = (xa,ya)

-> Matrix b

size = (xb,yb)

-> Matrix c

size = (minimum [xa,xb], minimum [ya,yb])

See farm21.

farm31 Source #

Arguments

:: (a -> b -> c -> d) 
-> Matrix a

size = (xa,ya)

-> Matrix b

size = (xb,yb)

-> Matrix c

size = (xc,yc)

-> Matrix d

size = (minimum [xa,xb,xc], minimum [ya,yb,yc])

See farm31.

reduce :: (a -> a -> a) -> Matrix a -> a Source #

See reduce.

dotV Source #

Arguments

:: (a -> a -> a)

kernel function for a row/column reduction, e.g. (+) for dot product

-> (b -> a -> a)

binary operation for pair-wise elements, e.g. (*) for dot product

-> Matrix b

size = (xa,ya)

-> Vector a

length = xa

-> Vector a

length = xa

See fotV.

dot Source #

Arguments

:: (a -> a -> a)

kernel function for a row/column reduction, e.g. (+) for dot product

-> (b -> a -> a)

binary operation for pair-wise elements, e.g. (*) for dot product

-> Matrix b

size = (xa,ya)

-> Matrix a

size = (ya,xa)

-> Matrix a

size = (xa,xa)

See dot.

get Source #

Arguments

:: Int

X index starting from zero

-> Int

Y index starting from zero

-> Matrix a 
-> Maybe a 

See get.

take Source #

Arguments

:: Int

X index starting from zero

-> Int

Y index starting from zero

-> Matrix a 
-> Matrix a 

See take.

drop Source #

Arguments

:: Int

X index starting from zero

-> Int

Y index starting from zero

-> Matrix a 
-> Matrix a 

See drop.

crop Source #

Arguments

:: Int

crop width = w

-> Int

crop height = h

-> Int

X start position = x0

-> Int

Y start position = y0

-> Matrix a

size = (xa,ya)

-> Matrix a

size = (minimum [w,xa-x0], minimum [h,xa-x0])

See crop.

group Source #

Arguments

:: Int

width of groups = w

-> Int

height of groups = h

-> Matrix a

size = (xa,ya)

-> Matrix (Matrix a)

size = (xa div w,ya div h)

See group.

stencil :: Int -> Int -> Matrix a -> Matrix (Matrix a) Source #

See stencil.

transpose Source #

Arguments

:: Matrix a

X:Y orientation

-> Matrix a

Y:X orientation

replace :: Int -> Int -> Matrix a -> Matrix a -> Matrix a Source #

See replace.