Array Functions |
|
|
Array Functions SupportThe Fractal Science Kit fractal generator Array functions are useful when working with arrays. Array.Dim1(<Array>) Array.Dim1 returns the size of an array's 1st dimension. Array.Dim2 returns the size of an array's 2nd dimension. Example: n = Array.Dim1(vector[]) This example sets n equal to the size of the array vector[]; i.e., n is set to the number of items in the 1-dimensional array vector[]. Example: rows = Array.Dim1(table[,]) This example sets rows equal to the size of the 1st dimension of the array table[,] and cols equal to the size of the 2nd dimension. void Array.Copy(src[], srcIndex, dst[], dstIndex, count) Array.Copy copies items from one array to another. Specifically, it copies the count items in the array src[], starting at srcIndex, into the array dst[], starting at dstIndex. In most cases the source and destination array will have the same type and rank but this is not required. If the source or destination arrays are 2-dimensional arrays, the index is a relative offset into the array. Example: Complex data1[6,4] This example fills m[] with 12 Mobius objects using the data given in the 2 arrays data1[,] and data2[,]. Since the source arrays are of type Complex, the count argument is the number of Complex elements to copy (24), and these are mapped onto 6 Mobius objects, each with 4 fields. While this type of usage should be avoided for the sake of code clarity, it can be useful in selected circumstances. Array.Offset(array[,], row, col) = row*Array.Dim2(array[,])+col Array.Offset returns the offset into the 2-dimensional array[,] of the item at the given row and col. void Array.Clear(a[]) Array.Clear sets all the elements of array a[] to 0. If a[] is an array of objects, it sets all fields in all objects to 0. void Array.Reverse(a[]) Array.Reverse reverses the elements of the 1-dimensional array a[]. a[] is an array complex values or objects. |
|
Copyright © 2004-2008 Hilbert, LLC |