[NAME] ALL.dao.type.array.method [TITLE] Array methods [DESCRIPTION] Currently Dao array type supports the following methods: 1 array<@T<none|int|float|double|complex>=none>( dim1: int, dim2 = 0, dim3 = 0 ) 2 [I: int, J: int, K: int => @T|array<@T>] => array<@T> 3 dim( invar self: array<@T>, i: int ) => int 4 dims( invar self: array<@T> ) => tuple<...:int> 5 index( invar self: array<@T>, i: int ) => tuple<...:int> 6 size( invar self: array<@T> ) => int 7 resize( self: array<@T>, size: int, ...: int ) => array<@T> 8 reshape( self: array<@T>, size: int, ...: int ) => array<@T> 9 permute( self: array<@T>, size: int, ...: int ) => array<@T> 10 transpose( self: array<@T> ) 11 max( invar self: array<@T<int|float|double>> ) => tuple<@T,int>|none 12 min( invar self: array<@T<int|float|double>> ) => tuple<@T,int>|none 13 sum( invar self: array<@T> ) => @T 14 sort( self: array<@T>, order: enum<ascend,descend> = $ascend, part = 0 ) 15 => array<@T> 16 map( invar self: array<@T> ) 17 [item: @T, I: int, J: int, K: int, L: int, M: int => @V] => array<@V> 18 reduce( invar self: array<@T> ) 19 [item: @T, res: @T, I: int, J: int, K: int, L: int, M: int => @T] => @T 20 reduce( invar self: array<@T>, init: @V ) 21 [item: @T, res: @V, I: int, J: int, K: int, L: int, M: int => @V] => @V 22 collect( invar self: array<@T> ) 23 [item: @T, I: int, J: int, K: int, L: int, M: int => none|@V] => list<@V> 24 iterate( invar self: array<@T> ) 25 [item: @T, I: int, J: int, K: int, L: int, M: int] 26 apply( self: array<@T> ) 27 [item: @T, I: int, J: int, K: int, L: int, M: int => @T] => array<@T> 0.1 Methods 0.1.1 dim(invar self:array<@T>,i:int)=>int 1 dim( invar self: array<@T>, i: int ) => int Get the i-th dimension. 0.1.2 dims(invar self:array<@T>)=>tuple<...:int> 1 dims( invar self: array<@T> ) => tuple<...:int> Get all the dimensions. 0.1.3 index(invar self:array<@T>,i:int)=>tuple<...:int> 1 index( invar self: array<@T>, i: int ) => tuple<...:int> Convert an one-dimensional index to a multi-dimensional index. 0.1.4 size(invar self:array<@T>)=>int 1 size( invar self: array<@T> ) => int Get the total number of elements in the array. 0.1.5 resize(self:array<@T>,size:int,...:int) 1 resize( self: array<@T>, size: int, ...: int ) Resize the array. The size in each dimension is specified in the parameters. 0.1.6 reshape(self:array<@T>,size:int, ...:int) 1 reshape( self: array<@T>, size: int, ...: int ) Reshape the array. The size in each dimension is specified in the parameters. 0.1.7 permute(self:array<@T>,size:int,...:int) 1 permute( self: array<@T>, size: int, ...: int ) Permute the elements of the array such that an element located by its original index in t he original array is moved to the location as specified by its permuted index in the perm uted array. 0.1.8 transpose(self:array<@T>) 1 transpose( self: array<@T> ) Transpose a matrix. 0.1.9 max(invar self:array<@T<int|float|double>>)=>tuple<@T,int>|none 1 max( invar self: array<@T<int|float|double>> ) => tuple<@T,int>|none Get the maximum element in the array. 0.1.10 min(invar self:array<@T<int|float|double>>)=>tuple<@T,int>|none 1 min( invar self: array<@T<int|float|double>> ) => tuple<@T,int>|none Get the minimum element in the array. 0.1.11 sum(invar self:array<@T>)=>@T 1 sum( invar self: array<@T> ) => @T Get the sum of the elements in the array. 0.1.12 sort(self:array<@T>,order:enum<ascend,descend>=$ascend,part=0)=>array<@T> 1 sort( self: array<@T>, order: enum<ascend,descend> = $ascend, part = 0 ) 2 => array<@T> Sort the elements in the array in ascend or descend order. If part is not zero, the array is partially sorted such that the first part elements in the sorted array are the part ma ximum or minimum elements in right order. 0.1.13 map(invar self:array<@T>)[item:@T,I:int,J:int,K:int,...=>@V]=>array<@V> 1 map( invar self: array<@T> ) 2 [item: @T, I: int, J: int, K: int, L: int, M: int => @V] => array<@V> Map the array to a new array such that each element in the original array is mapped to a new value in the new array according to the code section evaluation. The value of the ele ments can be passed to the code section as the first parameter of the code section, and t he multi-dimensional index can be passed as the remaining parameters. 0.1.14 reduce(invar self:array<@T>)[item:@T,res:@T,I:int,J:int,K:int,...=>@T]=>@T 1 reduce( invar self: array<@T> ) 2 [item: @T, res: @T, I: int, J: int, K: int, L: int, M: int => @T] => @T Reduce/fold the elements in the array according to the evaluation result of the code sect ion. The first element will be used as the initial result, and be passed to the code sect ion as the second paramter. The returned value of the code section will become the new re sult. 0.1.15 reduce(invar self:array<@T>,init:@V)[item:@T,res:@V,I:int,J:int,...=>@V]=>@V 1 reduce( invar self: array<@T>, init: @V ) 2 [item: @T, res: @V, I: int, J: int, K: int, L: int, M: int => @V] => @V Reduce/fold the elements in the array according the evaluation result of the code section . It is the same as the previous method, except that the initial result is specified as a n additional parameter to the method. 0.1.16 collect(invar self:array<@T>)[item:@T,I:int,J:int,...=>none|@V]=>list<@V> 1 collect( invar self: array<@T> ) 2 [item: @T, I: int, J: int, K: int, L: int, M: int => none|@V] => list<@V> Iterate over the array, and execute the code section for each element, then collect the n on none values to produce and return a list. 0.1.17 iterate(invar self:array<@T>)[item:@T,I:int,J:int,K:int,...] 1 iterate( invar self: array<@T> ) 2 [item: @T, I: int, J: int, K: int, L: int, M: int] Iterate over the array, and execute the code section for each element. 0.1.18 apply(self:array<@T>)[item:@T,I:int,J:int,K:int,...=>@T]=>array<@T> 1 apply( self: array<@T> ) 2 [item: @T, I: int, J: int, K: int, L: int, M: int => @T] => array<@T> Iterate over the array, and execute the code section for each element. And substitute the elements with the values returned by the code section.