PsiLAB Help Manual Page

Section: Basic Matrix functions

Name: <<--

Copy a submatrix from a matrix a to another matrix b.
The target matrix must hold the submatrix. Both matrices must have the same dimension, and the target matrix must be already allocated.

[ b:('a, 'b, 'c) Matrix.t ]
<<--
a:('a, 'b, 'c) Matrix.t *
range:(int * int) list *
offset:int list

The source matrix is a , and the target matrix is b .
The subrange for each dimension is put in a (int*int) list . Keep a dimension unchanged with the (--) operator. The offset list determines the offset in the target matrix b . An empty list indicates no offsets.
Example:
[] let a = fmatrix ~dim:[5;3] ~rand:[1.0] () ;; 
val a : (float, '_a, '_b) Matrix.t = <abstr> 
[] let b = fmatrix ~dim:[5;3] ~fill:[0.0] () ;; 
val b : (float, '_a, '_b) Matrix.t = <abstr> 
[] b <<-- ( a , [(1,2);(--)] , [1;1]);; 
- : unit = () 

Printed by PsiLAB