PsiLAB Help Manual
Page
Section:
Basic Matrix functions
Name:
matrix_window
Extract a window from an already existing matrix.
This function extracts a window (sub range) of the matrix a and returns a new matrix b, but both matrices share the same data space. Therefore, changes in the window matrix b is visible to matrix a, and vice versa.
[ b:('a,'b,'c) Matrix.t ] = matrix_window
a:('a,'b,'c) Matrix.t
range: (int*int) list
The range list consists of int pair tuples for the window start and end indeces. With the (--) operator, the full dimension of the source matrix is preserved. All dimensions must be specified.
Warning:
Not all PsiLAB functions can handle matrix windows. Therefore, this function is intended for experts only.
Example:
[] let f = fmatrix ~dim:[500;300] ~rand:[10.0] () ;;
val f : (float, '_a, '_b) Matrix.t = <abstr>
[] let fw = matrix_window f [(--);(10,20)] ;;
val fw : (float, '_a, '_b) Matrix.t = <abstr>
[] f.{1,10}
- : float = 1.26877334984
[] fw.{1,1}
- : float = 1.26877334984
Printed by PsiLAB