Accessing elements

next - skip - up - start

Elements are accessed by expressions of the form A(i,j) where i and j run from 1 to the appropriate dimension. Access elements of vectors with just one argument. Diagonal matrices can accept one or two subscripts.

This is different from the earliest version of the package in which the subscripts ran from 0 to one less than the appropriate dimension. Use A.element(i,j) if you want this earlier convention.

A(i,j) and A.element(i,j) can appear on either side of an = sign.

If you activate the #define SETUP_C_SUBSCRIPTS in include.h you can also access elements using the tradition C style notation. That is A[i][j] for matrices (except diagonal) and V[i] for vectors and diagonal matrices. The subscripts start at zero (ie like element) and there is no range checking. Because of the possibility of confusing V(i) and V[i], I suggest you do not activate this option unless you really want to use it.