[NAME] ALL.dao.type.array [TITLE] Numeric Array Type [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 m ulti-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 i s inferred from the first expression of the expression list, if the enumeration is not e mpty; 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 var vec1 = [1, 2, 3] # array<int> vector, or 1x3 matrix; 2 var vec2 = [1F; 2; 3] # array<float> 3x1 matrix, or transposed vector; 3 var mat1 = [1.0, 2; 3, 4] # array<double> 2x2 matrix; 4 var mat2 = [ [1, 2], [3, 4] ] # 2x2 matrix 5 var mat3 = array{ 1, 2; 3, 4 } # 2x2 matrix 6 var mat4 = array<int>(5){ [1, 2, 3] } # 5x3 matrix; [STRUCTURE] dao.type.array--| dao.type.array: Numeric Array Type (8.7 KB) |--method--| dao.type.array.method: Array methods (6.7 KB)