-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathLAPACK.hs
More file actions
127 lines (109 loc) · 2.04 KB
/
LAPACK.hs
File metadata and controls
127 lines (109 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
module ArrayFire.LAPACK where
import Foreign.Marshal
import Foreign.Storable
import Foreign.C.String
import ArrayFire.Internal.LAPACK
import ArrayFire.Exception
import ArrayFire.FFI
import ArrayFire.Types
import ArrayFire.Internal.Defines
svd
:: AFType a
=> Array a
-> (Array a, Array a, Array a)
svd = (`op3p` af_svd)
svdInPlace
:: AFType a
=> Array a
-> (Array a, Array a, Array a)
svdInPlace = (`op3p` af_svd_inplace)
lu
:: AFType a
=> Array a
-> (Array a, Array a, Array a)
lu = (`op3p` af_lu)
luInPlace
:: AFType a
=> Array a
-> Bool
-> Array a
luInPlace a b = a `op1` (\x y -> af_lu_inplace x y b)
qr
:: AFType a
=> Array a
-> (Array a, Array a, Array a)
qr = (`op3p` af_qr)
qrInPlace
:: AFType a
=> Array a
-> Array a
qrInPlace = (`op1` af_qr_inplace)
cholesky
:: AFType a
=> Array a
-> Bool
-> (Int, Array a)
cholesky a b =
op1b a (\x y z -> af_cholesky x y z b)
choleskyInplace
:: AFType a
=> Array a
-> Bool
-> Int
choleskyInplace a b =
infoFromArray a (\x y -> af_cholesky_inplace x y b)
solve
:: AFType a
=> Array a
-> Array a
-> MatProp
-> Array a
solve a b m =
op2 a b (\x y z -> af_solve x y z (toMatProp m))
solveLU
:: AFType a
=> Array a
-> Array a
-> Array a
-> MatProp
-> Array a
solveLU a b c m =
op3 a b c (\x y z w -> af_solve_lu x y z w (toMatProp m))
inverse
:: AFType a
=> Array a
-> MatProp
-> Array a
inverse a m =
a `op1` (\x y -> af_inverse x y (toMatProp m))
pinverse
:: AFType a
=> Array a
-> Double
-> MatProp
-> Array a
pinverse a d m =
a `op1` (\x y -> af_pinverse x y d (toMatProp m))
rank
:: AFType a
=> Array a
-> Double
-> Int
rank a b =
fromIntegral (a `infoFromArray` (\x y -> af_rank x y b))
det
:: AFType a
=> Array a
-> (Double,Double)
det = (`infoFromArray2` af_det)
norm
:: AFType a
=> Array a
-> AFNormType
-> Double
-> Double
-> Double
norm arr a b c =
arr `infoFromArray` (\w y -> af_norm w y a b c)
isLAPACKAvailable :: IO Bool
isLAPACKAvailable = afCall1 af_is_lapack_available