open Basic;;
open Value;;
open Signal;;
+open Aux;;
class beam : signal_type array -> beam_type =
fun (signals_init : signal_type array) ->
method output : int -> data =
fun (length_max : int) ->
- let transpose : 'a array array -> 'a array array =
- fun matrix ->
- let get_element = fun i -> fun array -> array.(i) in
- let get_column = fun m -> fun i -> Array.map (get_element i) m in
- Array.init self#width (get_column matrix) in
let value2float = fun (v : value_type) -> v#to_float_array in
let init = [|0.|] in
let container = Array.make length_max
container.(!index) <- Array.map value2float (self#at !index);
incr index;
done;
- transpose container
+ transpose self#width container
with x ->
match x with
| Invalid_argument s ->
- transpose (Array.sub container 0 !index)
+ transpose self#width (Array.sub container 0 !index)
| _ -> raise x
+
+ method output_values : int -> raw_data =
+ fun (length_max : int) ->
+ let init = new value (N 0) in
+ let container = Array.make length_max
+ (Array.make self#width init) in
+ let index = ref 0 in
+
+ try
+ while !index < length_max do
+ container.(!index) <- self#at !index;
+ incr index;
+ done;
+ container
+
+ with x ->
+ match x with
+ | Invalid_argument s ->
+ Array.sub container 0 !index
+ | _ -> raise x
+
+
method frequency : rate_type array =
let each_rate : signal -> rate =
fun (s : signal) ->