Vector

The Vector domain is used for storing data in a one-dimensonal indexed data structure. A vector is a homogeneous data structure in that all the components of the vector must belong to the same Axiom domain. Each vector has a fixed length specified by the user; vectors are not extensible. This domain is similar to the OneDimensionalArray domain, except that when the components of a Vector belong to a Ring, arithmetic operations are provided. For more examples of operations that are defined for both Vector and OneDimensionalArray, see OneDimensionalArray. As with the OneDimensionalArray domain, a Vector can be created by calling the operation new, its components can be accessed by calling the operations elt and qelt, and its components can be reset by calling the operations setelt and setelt!. This creates a vector of integers of length 5 all of whose components are 12.
This is how you create a vector from a list of its components.
Indexing for vectors begins at 1. The last element has index equal to the length of the vector, which is computed by #.
This is the standard way to use elt to extract an element.
This is the standard way to use setelt to change an element. It is the same as if you had typed setelt(v,3,99).
Now look at v to see the change. You can use qelt and qsetelt! (instead of elt and setelt, respectively) but only when you know that the indexis within the valid range.
When the components belong to a Ring, Axiom provides arithmetic operations for Vector. These include left and right scalar multiplication.
Addition and subtraction are also available
Of course, when adding or subtracting, the two vectors must have the same length or an error message is displayed.
For more information about other aggregate domains, see List, Matrix, OneDimensionalArray. Set, Table, and TwoDimensionalArray. Issue the system command
to display the full list of operations defined by Vector.