Keywords: sic

Next: Implicit Loops Up: Variables and Expressions Previous: Functions and Operators Contents Index

### Vector Operations

SIC supports array variables of up to 7 dimensions. Array dimensions are specified between brackets (not parentheses) with the comma as separators. `CHARACTER` and `LOGICAL` variables can also be arrays. Arithmetic operations always work on arrays on an element by element basis. Scalar variables are considered like arrays of any size. For example,

          DEFINE REAL A[5] B[5]
          LET A = ABS(B)
          LET B = 1.0

assigns to each element of A the absolute value of the corresponding element of B, and then assigns to each element of B the value 1.0. Dimensions of arrays must match in arithmetic expressions.

Any subset of an array variable can be referenced in an expression, for example

          DEFINE REAL A[5] B[5,10] C[5,10,3]
          LET B[,6] = A
          LET C[,10,1] = B[,3]

Dimensions of the sub-arrays must also match. Transposition is now supported : e.g. in the precedent example, C[1,,1] could have replaced C[,10,1]. The indices can be previously defined scalar variables. Leading commas may be omitted.

          DEFINE REAL A[5] B[5,10] C[5,10,3]
          LET B[,6] = A
          LET C[,10,1] = B[,3]

It is also possible to specify a range of indexes rather than a single index.

          DEFINE REAL A[5] B[3,10] C[4,4,4]
          LET B[,6] = A[2:4]
          LET A[:3] = B[,8]
          LET A[2:5] = C[3,,4]