Source file owl_dense_ndarray.ml

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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# 1 "src/owl/dense/owl_dense_ndarray.ml"
(*
 * OWL - OCaml Scientific and Engineering Computing
 * Copyright (c) 2016-2019 Liang Wang <liang.wang@cl.cam.ac.uk>
 *)

(** Ndarray: module aliases *)


module Operator = struct
  include Owl_operator.Make_Basic (Owl_dense_ndarray_generic)
  include Owl_operator.Make_Extend (Owl_dense_ndarray_generic)
  include Owl_operator.Make_Ndarray (Owl_dense_ndarray_generic)
end


module Generic = struct
  include Owl_dense_ndarray_generic
  include Operator

  (* inject function aliases *)

  let inv = Owl_linalg_generic.inv

  let mpow = Owl_linalg_generic.mpow

  let tril ?(k=0) x = Owl_dense_matrix_generic.tril ~k x

  let triu ?(k=0) x = Owl_dense_matrix_generic.triu ~k x

  let qr x =
    let q, r, _ = Owl_linalg_generic.qr ~thin:true ~pivot:false x in
    (q,r)

  let lq x = Owl_linalg_generic.lq ~thin:true x

  let sylvester = Owl_linalg_generic.lyapunov 

  let lyapunov = Owl_linalg_generic.lyapunov

  let discrete_lyapunov ?(solver=`default) a q = Owl_linalg_generic.discrete_lyapunov ~solver a q

  let linsolve ?(trans=false) ?(typ=`n) a b = Owl_linalg_generic.linsolve ~trans ~typ a b

  let care = Owl_linalg_generic.care
end


module S = struct
  include Owl_dense_ndarray_s
  include Operator
  module Scalar = Owl_maths

  (* inject function aliases *)

  let inv = Owl_linalg_s.inv

  let logdet = Owl_linalg_s.logdet

  let svd ?(thin=true) = Owl_linalg_s.svd ~thin

  let chol = Owl_linalg_s.chol

  let mpow = Owl_linalg_s.mpow

  let diagm ?(k=0) x = Owl_dense_matrix_generic.diagm ~k x

  let eye n = Owl_dense_matrix_s.eye n

  let tril ?(k=0) x = Owl_dense_matrix_generic.tril ~k x

  let triu ?(k=0) x = Owl_dense_matrix_generic.triu ~k x

  let qr x =
    let q, r, _ = Owl_linalg_s.qr ~thin:true ~pivot:false x in
    (q,r)

  let lq x = Owl_linalg_s.lq ~thin:true x

  let sylvester = Owl_linalg_s.sylvester

  let lyapunov = Owl_linalg_s.lyapunov

  let discrete_lyapunov ?(solver=`default) a q = Owl_linalg_s.discrete_lyapunov ~solver a q

  let linsolve ?(trans=false) ?(typ=`n) a b = Owl_linalg_s.linsolve ~trans ~typ a b

  let care = Owl_linalg_s.care
end


module D = struct
  include Owl_dense_ndarray_d
  include Operator
  module Scalar = Owl_maths

  (* inject function aliases *)

  let inv = Owl_linalg_d.inv

  let logdet = Owl_linalg_d.logdet

  let svd ?(thin=true) = Owl_linalg_d.svd ~thin

  let chol = Owl_linalg_d.chol

  let mpow = Owl_linalg_d.mpow

  let diagm ?(k=0) x = Owl_dense_matrix_generic.diagm ~k x

  let eye n = Owl_dense_matrix_d.eye n

  let tril ?(k=0) x = Owl_dense_matrix_generic.tril ~k x

  let triu ?(k=0) x = Owl_dense_matrix_generic.triu ~k x

  let qr x =
    let q, r, _ = Owl_linalg_d.qr ~thin:true ~pivot:false x in
    (q,r)

  let lq x = Owl_linalg_d.lq ~thin:true x

  let sylvester = Owl_linalg_d.sylvester

  let lyapunov = Owl_linalg_d.lyapunov

  let discrete_lyapunov ?(solver=`default) a q = Owl_linalg_d.discrete_lyapunov ~solver a q

  let linsolve ?(trans=false) ?(typ=`n) a b = Owl_linalg_d.linsolve ~trans ~typ a b

  let care = Owl_linalg_d.care
end


module C = struct
  include Owl_dense_ndarray_c
  include Operator

  (* inject function aliases *)

  let inv = Owl_linalg_c.inv

  let mpow = Owl_linalg_c.mpow

  let eye n = Owl_dense_matrix_c.eye n

  let tril ?(k=0) x = Owl_dense_matrix_generic.tril ~k x

  let triu ?(k=0) x = Owl_dense_matrix_generic.triu ~k x

  let qr x =
    let q, r, _ = Owl_linalg_c.qr ~thin:true ~pivot:false x in
    (q,r)

  let lq x = Owl_linalg_c.lq ~thin:true x

  let sylvester = Owl_linalg_c.sylvester

  let lyapunov = Owl_linalg_c.lyapunov

  let discrete_lyapunov ?(solver=`default) a q = Owl_linalg_c.discrete_lyapunov ~solver a q

  let linsolve ?(trans=false) ?(typ=`n) a b = Owl_linalg_c.linsolve ~trans ~typ a b
end


module Z = struct
  include Owl_dense_ndarray_z
  include Operator

  (* inject function aliases *)

  let inv = Owl_linalg_z.inv

  let mpow = Owl_linalg_z.mpow

  let eye n = Owl_dense_matrix_z.eye n

  let tril ?(k=0) x = Owl_dense_matrix_generic.tril ~k x

  let triu ?(k=0) x = Owl_dense_matrix_generic.triu ~k x

  let qr x =
    let q, r, _ = Owl_linalg_z.qr ~thin:true ~pivot:false x in
    (q,r)

  let lq x = Owl_linalg_z.lq ~thin:true x

  let sylvester = Owl_linalg_z.sylvester

  let lyapunov = Owl_linalg_z.lyapunov

  let discrete_lyapunov ?(solver=`default) a q = Owl_linalg_z.discrete_lyapunov ~solver a q

  let linsolve ?(trans=false) ?(typ=`n) a b = Owl_linalg_z.linsolve ~trans ~typ a b
end


module Any = struct
  include Owl_dense_ndarray_a
end