[NAME] ALL.dao.type.array [TITLE] Multi-dimensional Numeric Array [DESCRIPTION] Multi-dimentional numeric array is supported by Dao as array type. 0.1 Definition 1 # Elements Enumeration: 2 VectorEnumeration ::= '[' ExpressionList ']' 3 MatrixEnumeration ::= '[' ExpressionList { ';' ExpressionList } ']' 4 VectorEnumeration2 ::= 'array' '{' ExpressionList '}' 5 MatrixEnumeration2 ::= 'array' '{' ExpressionList { ';' ExpressionList } '}' 6 7 # Elements of Arithmetic Progression sequence: count ~ start [ ~ step ] 8 ArrayByArithProg ::= '[' Expression ':' [ Expression ':' ] Expression ']' 9 ArrayByArithProg2 ::= 'array' '{' Expression ':' [ Expression ':' ] Expression '}' 10 11 Array ::= VectorEnumeration | MatrixEnumeration | ArrayByArithProg 12 | VectorEnumeration2 | MatrixEnumeration2 | ArrayByArithProg2 Please note that VectorEnumeration or VectorEnumeration2 can still create a matrix or a multi-dimensional array, if the ExpressionList produces a list of arrays. Four numeric types are supported by the array type: int, float, double and complex. When an array is created by enumeration without explicit type declaration, its numeric type is inferred from the first expression of the expression list, if the enumeration is not empty; otherwise, float will be used as the numeric type. Dao supports a number of built-in operations for array. For arithmetic operations, they are always supported element-wise operations. 0.2 Examples 1 vec1 = [1, 2, 3] # array<int> vector, or 1x3 matrix; 2 vec2 = [1.0; 2; 3] # array<float> 3x1 matrix, or transposed vector; 3 mat1 = [1D, 2; 3, 4] # array<double> 2x2 matrix; 4 mat2 = [ [1, 2], [3, 4] ] # 2x2 matrix 5 mat3 = [ [1, 2, 3] : 5 ] # 5x3 matrix; 6 mat4 = array{ 1, 2; 3, 4 } # 2x2 matrix [STRUCTURE] dao.type.array--| dao.type.array: Multi-dimensional Numeric Array (3.3 KB) |--method--| dao.type.array.method: Array methods (1.3 KB) |--dim----| dao.type.array.method.dim: Array method dim() (0.0 KB) |--index--| dao.type.array.method.index: Array method index() (0.0 KB)