Creating ILArray<> with new
The new operator may be used, to create instances of ILArrays<T> from the scratch. The initial values
of the new array may be given also. In this case a System.Array of the inner element type must be provided to
the constructor. This System.Array will then directly be used as inner storage for the elements of the ILArrays<T>. No copy will be made.
The following examples demonstrates both versions of the new operator for elements of system type double. The concepts may just as well be used for arbitrary inner types.
// create scalar with value 10.0
ILArray<double> A = new ILArray<double>(10.0);
// create vector with values ranging from 1.0...4.0
ILArray<double> A = new ILArray<double>(1.0,2.0,3.0,4.0);
// create matrix of size 10x20 and specify predefined values
double[] elements = new double[200];
YourFunctionForFillingValues(elements); // fill your values into the elements
ILArray<double> A = new ILArray<double>(elements,10,20);
The above concept can directly be transfered to the creation of arrays for arbitrary dimensions.