- if size = self#length then self
- else if size > self#length && size mod self#length = 0 then
-
- else if size < self#length && self#length mod size = 0 then
-
+ if size = self#length then new beam self#get
+
+ else if (size > self#length) && (size mod self#length = 0) then
+ let () = self#add_memory 1 in
+ let split_signals =
+ Array.concat (Array.to_list
+ (Array.make (size/self#length) self#get)) in
+ new beam split_signals
+
+ else if (size < self#length) && (self#length mod size = 0) then
+ let rec merge_rec =
+ fun (sa : signal_type array) ->
+ fun (l : int) ->
+ fun (i : int) ->
+ if i + l < Array.length sa then
+ (sa.(i))#add (merge_rec sa l (i + l))
+ else sa.(i) in
+ let merge_signals = Array.init size (merge_rec self#get size) in
+ new beam merge_signals
+