This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Complex | |
(** [roots_initvals ?r [c(n); ...; c(2); c(1); c(0)]] computes | |
initial values for [roots] by using Aberth's method. | |
*) | |
let roots_initvals ?(r=1000.0) coeff_list = | |
match coeff_list with | |
| a::b::_ -> | |
let n = List.length coeff_list - 1 in | |
let s = 3.14159265358979 /. (float n) in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(** [levinson r] computes AR coefficients by using Levinson-Durvin method. | |
@param r values of autocorrelation function: [[r(0); r(1); r(2); ...; r(M)]] | |
@return [([ar(1); ar(2); ...; ar(M)], sigma2)] where [ar(i)] is the [i]-th | |
coefficient of AR([M]) and [sigma2] is variance of errors. | |
*) | |
let levinson r = | |
let rec loop r ar sigma2 = function | |
| [] -> (List.rev ar, sigma2) | |
| rm :: rest -> | |
let rev_ar = List.rev ar in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* recursiveNeuralNetwork.ml --- Recursive Neural Networks and | |
Online Backpropagation Through Structure (BPTS) | |
[MIT License] Copyright (C) 2015 Akinori ABE | |
Compilation: | |
$ ocamlfind ocamlopt -linkpkg -package slap recursiveNeuralNetwork.ml | |
This program requires Sized Linear Algebra Library (SLAP), a linear algebra | |
library for OCaml with static size checking for matrix operations (see |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* unfoldingRAE.ml --- Unfolding Recursive Autoencoder and | |
Online Backpropagation Through Structure (BPTS) | |
[MIT License] Copyright (C) 2015 Akinori ABE | |
Compilation: | |
$ ocamlfind ocamlopt -linkpkg -package slap unfoldingRAE.ml | |
This program requires Sized Linear Algebra Package (SLAP), a linear algebra | |
library for OCaml with static size checking for matrix operations (see |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* ========================================================================== * | |
* General implementation of A-star algorithm | |
* ========================================================================== *) | |
module Astar : | |
sig | |
type 'a t = | |
{ | |
cost : 'a -> 'a -> int; | |
goal : 'a; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <int n> | |
struct Int { static const int val = n; }; // Wrap an integer | |
template <class fst, class snd> | |
struct pair { | |
typedef fst first; | |
typedef snd second; | |
}; | |
struct nil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* http://akabe.github.io/2015/10/GenerativePhantomTypes *) | |
#load "str.cma";; | |
(** Loads a list of integers from a file of a given path (delimiters = spaces, | |
tabs, or line feeds). *) | |
let load_list fname = | |
let re = Str.regexp "[ \t]+" in | |
let oc = open_in fname in | |
let rec aux acc = try aux (input_line oc :: acc) with End_of_file -> acc in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* http://akabe.github.io/2015/10/GenerativePhantomTypes *) | |
#load "str.cma";; | |
(** Loads a list of integers from a file of a given path (delimiters = spaces, | |
tabs, or line feeds). *) | |
let load_list fname = | |
let re = Str.regexp "[ \t]+" in | |
let oc = open_in fname in | |
let rec aux acc = try aux (input_line oc :: acc) with End_of_file -> acc in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* http://akabe.github.io/2015/10/GenerativePhantomTypes *) | |
#load "str.cma";; | |
(** Loads a list of integers from a file of a given path (delimiters = spaces, | |
tabs, or line feeds). *) | |
let load_list fname = | |
let re = Str.regexp "[ \t]+" in | |
let oc = open_in fname in | |
let rec aux acc = try aux (input_line oc :: acc) with End_of_file -> acc in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* http://akabe.github.io/2015/10/GenerativePhantomTypes *) | |
#load "str.cma";; | |
(** Loads a list of integers from a file of a given path (delimiters = spaces, | |
tabs, or line feeds). *) | |
let load_list fname = | |
let re = Str.regexp "[ \t]+" in | |
let oc = open_in fname in | |
let rec aux acc = try aux (input_line oc :: acc) with End_of_file -> acc in |
OlderNewer