hmatrix-0.2.1.0: Linear algebra and numerical computationsSource codeContentsIndex
Numeric.LinearAlgebra.Linear
Portabilityuses ffi
Stabilityprovisional
MaintainerAlberto Ruiz (aruiz at um dot es)
Description
Basic optimized operations on vectors and matrices.
Synopsis
class Container c e => Linear c e where
scale :: e -> c e -> c e
addConstant :: e -> c e -> c e
add :: c e -> c e -> c e
sub :: c e -> c e -> c e
mul :: c e -> c e -> c e
divide :: c e -> c e -> c e
scaleRecip :: e -> c e -> c e
equal :: c e -> c e -> Bool
multiply :: Element a => Matrix a -> Matrix a -> Matrix a
dot :: Element t => Vector t -> Vector t -> t
outer :: Element t => Vector t -> Vector t -> Matrix t
kronecker :: Element t => Matrix t -> Matrix t -> Matrix t
Documentation
class Container c e => Linear c e whereSource
A generic interface for vectors and matrices to a few element-by-element functions in Numeric.GSL.Vector.
Methods
scale :: e -> c e -> c eSource
addConstant :: e -> c e -> c eSource
add :: c e -> c e -> c eSource
sub :: c e -> c e -> c eSource
mul :: c e -> c e -> c eSource
element by element multiplication
divide :: c e -> c e -> c eSource
element by element division
scaleRecip :: e -> c e -> c eSource
scale the element by element reciprocal of the object: scaleRecip 2 (fromList [5,i]) == 2 |> [0.4 :+ 0.0,0.0 :+ (-2.0)]
equal :: c e -> c e -> BoolSource
show/hide Instances
multiply :: Element a => Matrix a -> Matrix a -> Matrix aSource
matrix product
dot :: Element t => Vector t -> Vector t -> tSource
euclidean inner product
outer :: Element t => Vector t -> Vector t -> Matrix tSource

Outer product of two vectors.

> fromList [1,2,3] `outer` fromList [5,2,3]
(3><3)
 [  5.0, 2.0, 3.0
 , 10.0, 4.0, 6.0
 , 15.0, 6.0, 9.0 ]
kronecker :: Element t => Matrix t -> Matrix t -> Matrix tSource

Kronecker product of two matrices.

m1=(2><3)
 [ 1.0,  2.0, 0.0
 , 0.0, -1.0, 3.0 ]
m2=(4><3)
 [  1.0,  2.0,  3.0
 ,  4.0,  5.0,  6.0
 ,  7.0,  8.0,  9.0
 , 10.0, 11.0, 12.0 ]
> kronecker m1 m2
(8><9)
 [  1.0,  2.0,  3.0,   2.0,   4.0,   6.0,  0.0,  0.0,  0.0
 ,  4.0,  5.0,  6.0,   8.0,  10.0,  12.0,  0.0,  0.0,  0.0
 ,  7.0,  8.0,  9.0,  14.0,  16.0,  18.0,  0.0,  0.0,  0.0
 , 10.0, 11.0, 12.0,  20.0,  22.0,  24.0,  0.0,  0.0,  0.0
 ,  0.0,  0.0,  0.0,  -1.0,  -2.0,  -3.0,  3.0,  6.0,  9.0
 ,  0.0,  0.0,  0.0,  -4.0,  -5.0,  -6.0, 12.0, 15.0, 18.0
 ,  0.0,  0.0,  0.0,  -7.0,  -8.0,  -9.0, 21.0, 24.0, 27.0
 ,  0.0,  0.0,  0.0, -10.0, -11.0, -12.0, 30.0, 33.0, 36.0 ]
Produced by Haddock version 2.4.2