Elements That Can Manipulate Arrays

Many of the GoldSim elements can manipulate and produce vectors and matrices. For example, you can sum a number of matrices using the Sum element, or compute the peak value of each item of a vector using the Extrema element.

In general, if the outputs for an element are an array, its inputs must be arrays (defined by the same sets of array labels), and GoldSim carries out the element's calculations in parallel for each item of the array.

   Note: If an input field of an element requires a vector, and the vector only has a single item, GoldSim allows you to enter a scalar as the input. Of course, if you then add items to the set of array labels (such that it consists of more than one item), the scalar input will no longer be valid.

In order for an element to output an array, you must specify that it is to be a vector or a matrix when you define its output attributes (by pressing the Type… button in the element’s properties dialog).  The dialog for specifying output attributes for an element looks like this:

The Order drop-list provides three choices: “Scalar” (the default), “Vector (1D-Array)”, and Matrix (2D-Array)”:

If you wish to create a vector, select “Vector (1D-Array)”. If you wish to create a matrix, select “Matrix (2D-Array)”. If you select “Vector (1D-Array)”, the Row Labels field becomes available. If you select “Matrix (2D-Array)”, both the Row Labels and Column Labels fields become available.

These two fields contain lists of all of the sets of array labels defined in your model:

If you have defined the Order as a vector or a matrix (i.e., if the Row Labels or Column Labels fields are active), you must select a set of array labels (or GoldSim will display a warning message when you try to close the Output Attributes dialog):

Within the drop-list for the Row and Column labels is the choice to “Create new Array Labels…”. If you click this option, the dialog for defining new array labels will be displayed. After leaving the Array Labels dialog, you will be returned to the dialog for defining output attributes.

Related Topics…