Skip to content

Commit

Permalink
Reformatted all OCaml and C-files
Browse files Browse the repository at this point in the history
  • Loading branch information
mmottl committed Nov 28, 2024
1 parent 7820c22 commit 1fa0720
Show file tree
Hide file tree
Showing 93 changed files with 10,317 additions and 13,734 deletions.
24 changes: 12 additions & 12 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Copyright (c) 2000- Markus Mottl <[email protected]>
Copyright (c) 2000- Christophe Troestler <[email protected]>

Copyright (c) 2000-2012 Egbert Ammicht <[email protected]>
Copyright (c) 2000-2012 Patrick Cousot <[email protected]>
Copyright (c) 2000-2012 Sam Ehrlichman <[email protected]>
Copyright (c) 2000-2012 Jane Street Capital LLC <[email protected]>
Copyright (c) 2000-2012 Florent Hoareau <[email protected]>
Copyright (c) 2000-2012 Liam Stewart <[email protected]>
Copyright (c) 2000-2012 Oleg Trott <[email protected]>
Copyright (c) 2000-2012 Martin Willensdorfer <[email protected]>
Copyright © 2000- Markus Mottl <[email protected]>
Copyright © 2000- Christophe Troestler <[email protected]>

Copyright © 2000-2012 Egbert Ammicht <[email protected]>
Copyright © 2000-2012 Patrick Cousot <[email protected]>
Copyright © 2000-2012 Sam Ehrlichman <[email protected]>
Copyright © 2000-2012 Jane Street Capital LLC <[email protected]>
Copyright © 2000-2012 Florent Hoareau <[email protected]>
Copyright © 2000-2012 Liam Stewart <[email protected]>
Copyright © 2000-2012 Oleg Trott <[email protected]>
Copyright © 2000-2012 Martin Willensdorfer <[email protected]>

The Library is distributed under the terms of the GNU Lesser General
Public License version 2.1 (included below).
Expand All @@ -22,7 +22,7 @@ requirements listed in clause 6 of the GNU Lesser General Public License.
By "a publicly distributed version of the Library", we mean either the
unmodified Library as distributed by the authors, or a modified version
of the Library that is distributed under the conditions defined in clause
2 of the GNU Lesser General Public License. This exception does not
3 of the GNU Lesser General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU Lesser General Public License.

Expand Down
14 changes: 8 additions & 6 deletions dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
(env
(dev
(flags (:standard -w -9 -principal))
(c_flags
(:standard -Wall -pedantic -Wno-strict-prototypes -Wextra -Wunused)))
(release (ocamlopt_flags (:standard -O3)))
)
(dev
(flags
(:standard -w -9 -principal))
(c_flags
(:standard -Wall -pedantic -Wno-strict-prototypes -Wextra -Wunused)))
(release
(ocamlopt_flags
(:standard -O3))))
49 changes: 17 additions & 32 deletions examples/blas.ml
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
(* File: blas.ml
Copyright (C) 2004-
Copyright © 2004-
Markus Mottl
email: [email protected]
WWW: http://www.ocaml.info
Markus Mottl email: [email protected] WWW: http://www.ocaml.info
Christophe Troestler
email: [email protected]
WWW: http://www.umh.ac.be/math/an/
Christophe Troestler email: [email protected] WWW:
http://www.umh.ac.be/math/an/
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *)

open Format

open Lacaml.D
open Lacaml.Io

Expand All @@ -53,18 +48,8 @@ let () =
printf "y <- x@\n@\n";
printf "y = @[%a@]@\n@\n" pp_rfvec (copy ~y x);

let a =
Mat.of_array
[|
[| 2.; 3. |];
[| 1.; -5. |];
|] in
let b =
Mat.of_array
[|
[| 4.; 3.; 6. |];
[| 1.; -2.; 3. |];
|] in
let a = Mat.of_array [| [| 2.; 3. |]; [| 1.; -5. |] |] in
let b = Mat.of_array [| [| 4.; 3.; 6. |]; [| 1.; -2.; 3. |] |] in

let c = gemm ~transa:`T a b in

Expand Down
32 changes: 5 additions & 27 deletions examples/dune
Original file line number Diff line number Diff line change
@@ -1,28 +1,6 @@
(executables
(names
blas
eig
gbsv
lin_eq
lin_eq_comp
lin_reg
nag_gbsv
nag_gesv
nag_gtsv
nag_pbsv
nag_posv
nag_ppsv
nag_ptsv
nag_spsv
nag_sysv
qr
sbev
sbgv
schur_complex
schur_real
shuffle
svd
)
(libraries lacaml)
(modes byte exe)
)
(names blas eig gbsv lin_eq lin_eq_comp lin_reg nag_gbsv nag_gesv nag_gtsv
nag_pbsv nag_posv nag_ppsv nag_ptsv nag_spsv nag_sysv qr sbev sbgv
schur_complex schur_real shuffle svd)
(libraries lacaml)
(modes byte exe))
73 changes: 35 additions & 38 deletions examples/eig.ml
Original file line number Diff line number Diff line change
@@ -1,36 +1,29 @@
(* File: eig.ml
Copyright (C) 2004-
Copyright © 2004-
Markus Mottl
email: [email protected]
WWW: http://www.ocaml.info
Markus Mottl email: [email protected] WWW: http://www.ocaml.info
Christophe Troestler
email: [email protected]
WWW: http://www.umh.ac.be/math/an/
Christophe Troestler email: [email protected] WWW:
http://www.umh.ac.be/math/an/
Oleg Trott
email: [email protected]
WWW: http://www.columbia.edu/~ot14
Oleg Trott email: [email protected] WWW: http://www.columbia.edu/~ot14
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *)

open Format

open Lacaml.Io

(* SYEV DEMO *)
Expand All @@ -45,11 +38,12 @@ let () =
printf "@[<2>Symmetric real matrix A =@\n@\n@[%a@]@]@\n@\n" pp_fmat a;

let w = syev a_copy in
printf "\
@[<2>Eigenvalues: W = @[%a@]@]@\n@\n\
----------------------------------------------------------------------@\n\
@\n" pp_rfvec w

printf
"@[<2>Eigenvalues: W = @[%a@]@]@\n\
@\n\
----------------------------------------------------------------------@\n\
@\n"
pp_rfvec w

(* GEEV DEMO *)

Expand All @@ -64,8 +58,9 @@ let () =
done;

(* All unperturbed eigenvalues are zero *)
a.{n, 1} <- 1e-5; (* perturbation, try this: n >> 1 *)
a.{n, 1} <- 1e-5;

(* perturbation, try this: n >> 1 *)
let a_copy = lacpy a in

printf "@[<2>General real matrix A =@\n@\n@[%a@]@]@\n@\n" pp_fmat a;
Expand All @@ -75,11 +70,14 @@ let () =
printf "@[<2>Eigenvalues: WR =@\n@\n@[%a@]@]@\n@\n" pp_rfvec wr;
printf "@[<2>Eigenvalues: WI =@\n@\n@[%a@]@]@\n@\n" pp_rfvec wi;

printf "\
@[<2>Matrix VR =@\n@\n@[%a@]@]@\n@\n\
----------------------------------------------------------------------@\n\
@\n" pp_fmat right

printf
"@[<2>Matrix VR =@\n\
@\n\
@[%a@]@]@\n\
@\n\
----------------------------------------------------------------------@\n\
@\n"
pp_fmat right

(* CGEEV DEMO *)

Expand All @@ -88,10 +86,9 @@ let () =
let n = 3 in

let a =
Mat.random
~re_from:(-500.) ~re_range:1000.
~im_from:(-500.) ~im_range:1000.
n n in
Mat.random ~re_from:(-500.) ~re_range:1000. ~im_from:(-500.) ~im_range:1000.
n n
in
let a_copy = lacpy a in

printf "@[<2>General complex matrix A =@\n@\n@[%a@]@]@\n@\n" pp_cmat a;
Expand Down
41 changes: 17 additions & 24 deletions examples/gbsv.ml
Original file line number Diff line number Diff line change
@@ -1,44 +1,37 @@
(* File: lin_eq.ml
Copyright (C) 2004-
Copyright © 2004-
Markus Mottl
email: [email protected]
WWW: http://www.ocaml.info
Markus Mottl email: [email protected] WWW: http://www.ocaml.info
Christophe Troestler
email: [email protected]
WWW: http://www.umh.ac.be/math/an/
Christophe Troestler email: [email protected] WWW:
http://www.umh.ac.be/math/an/
Oleg Trott
email: [email protected]
WWW: http://www.columbia.edu/~ot14
Oleg Trott email: [email protected] WWW: http://www.columbia.edu/~ot14
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *)

open Format

open Lacaml.D
open Lacaml.Io

let () =
let n = 10 in
let kl = 2 and ku = 1 in
let row = 2 in
let ab = Mat.random ~from:(-500.) ~range:1000. (2 * kl + ku + row) n in
let ab = Mat.random ~from:(-500.) ~range:1000. ((2 * kl) + ku + row) n in
let b = Vec.random n in
let sol = copy b in
gbsv (lacpy ab) kl ku ~abr:row (Mat.from_col_vec sol);
Expand Down
Loading

0 comments on commit 1fa0720

Please sign in to comment.