# DynamicArrayVariable class

(Shortest import: `from brian2.core.variables import DynamicArrayVariable)`

class brian2.core.variables.DynamicArrayVariable(name, owner, size, device, dimensions=Dimension(), dtype=None, constant=False, needs_reference_update=False, resize_along_first=False, scalar=False, read_only=False, unique=False)

  Bases: `ArrayVariable`

  An object providing information about a model variable stored in a dynamic array (used in `Synapses`). Most of the time `Variables.add_dynamic_array` should be used instead of instantiating this class directly.

  Parameters:

    name : ‘str’

    > The name of the variable. Note that this refers to the original name in the owning group. The same variable may be known under other names in other groups (e.g. the variable `v` of a `NeuronGroup` is known as `v_post` in a `Synapse` connecting to the group).

    dimensions : `Dimension`, optional

    > The physical dimensions of the variable.

    owner : `Nameable`

    > The object that “owns” this variable, e.g. the `NeuronGroup` or `Synapses` object that declares the variable in its model equations.

    size : int or tuple of int

    > The (initial) size of the variable.

    device : `Device`

    > The device responsible for the memory access.

    dtype : `dtype`, optional

    > The dtype used for storing the variable. If none is given, defaults to core.default_float_dtype.

    constant : bool, optional

    > Whether the variable’s value is constant during a run. Defaults to `False`.

    needs_reference_update : bool, optional

    > Whether the code objects need a new reference to the underlying data at every time step. This should be set if the size of the array can be changed by other code objects. Defaults to `False`.

    scalar : bool, optional

    > Whether this array is a 1-element array that should be treated like a scalar (e.g. for a single delay value across synapses). Defaults to `False`.

    read_only : bool, optional

    > Whether this is a read-only variable, i.e. a variable that is set internally and cannot be changed by the user. Defaults to `False`.

    unique : bool, optional

    > Whether the values in this array are all unique. This information is only important for variables used as indices and does not have to reflect the actual contents of the array but only the possibility of non-uniqueness (e.g. synaptic indices are always unique but the corresponding pre- and post-synaptic indices are not). Defaults to `False`.

  Attributes

  `dimensions` |
  `ndim` | The number of dimensions
  `needs_reference_update` | Whether this variable needs an update of the reference to the underlying data whenever it is passed to a code object
  `resize_along_first` | Whether this array will be only resized along the first dimension

  Methods

  `resize`(new_size) | Resize the dynamic array.

  Details

  dimensions
  ndim

    The number of dimensions

  needs_reference_update

    Whether this variable needs an update of the reference to the underlying data whenever it is passed to a code object

  resize_along_first

    Whether this array will be only resized along the first dimension

  resize(new_size)

    Resize the dynamic array. Calls `self.device.resize` to do the actual resizing.

    Parameters:

      new_size : int or tuple of int

      > The new size.