Removing parts of ILArray

Parts of ILArray can get removed conveniently without having to recreate the whole array. This is done by a syntax very similiar to the assignments. Here null or ILArray<T>.empty() must be assigned to the left side range.

In order to be a "removable range" the range specification must fullfill the following conditions:

  • Ranges to be removed must get specified by strings or by ILBaseArrays
  • All but exactly one dimension specified by range must be 'full dimensions' - specified by null or ":"
  • Indices to be removed must lay inside the bounds of the corresponding dimension

In the example below we remove the second column from a [4 x 3] matrix.

ILArray<double> A = ILMath.counter(4,3);
// A is now:
// (:,:) 1e+001 * 
//  0,10000   0,50000   0,90000 
//  0,20000   0,60000   1,00000 
//  0,30000   0,70000   1,10000 
//  0,40000   0,80000   1,20000
 
// remove the second column from A: 
A[":;1"] = null; 
// - or - 
A[null,1] = null; 
      
// A is now:
//(:,:) 1e+001 * 
//  0,10000   0,90000 
//  0,20000   1,00000 
//  0,30000   1,10000 
//  0,40000   1,20000 

The concept works the same way for n dimensional arrays of arbitrary shape.


Valid CSS! Valid XHTML 1.0 Transitional