etomica.api

## Interface IVectorMutable

• All Superinterfaces:
IVector
All Known Subinterfaces:
IVectorRandom
All Known Implementing Classes:
Vector1D, Vector2D, Vector3D, VectorND

```public interface IVectorMutable
extends IVector```
Vector interface containing methods needed for vector operations which alter the contents of the vector.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`void` `DE(IVector u)`
Divide-equals (/=) operation.
`void` `E(double a)`
Sets all components of this vector equal to the given value.
`void` `E(double[] a)`
Sets the components of this vector equal to the corresponding elements of the given array.
`void` `E(IVector u)`
Sets the components of this vector equal to those of the given vector.
`void` ```Ea1Tv1(double a, IVector v1)```
Operation (= a1 * v1); sets the components of this to those of the given vector multiplied by the given constant.
`void` ```Ev1Mv2(IVector v1, IVector v2)```
Sets the components of this vector equal to (v1 - v2)
`void` ```Ev1Pv2(IVector v1, IVector v2)```
Sets the components of this vector equal to (v1 + v2)
`void` `map(IFunction f)`
Applies the given function to each element of the vector.
`void` `ME(IVector u)`
Minus-equals (-=) operation.
`void` `mod(IVector u)`
Replaces each component of this vector with its value modulo the corresponding component in u
`void` `normalize()`
Normalizes this vector, so this.squared() == 1.
`void` `PE(double a)`
Plus-equals (+=) operation, causing a constant value to be added to all components of this vector.
`void` `PE(IVector u)`
Plus-equals (+=) operation.
`void` ```PEa1Tv1(double a, IVector v1)```
Increments (+=) components by (a1 * v1)
`void` ```setX(int i, double d)```
Sets the i-th component of the vector to the given value d.
`void` `TE(double a)`
Multiplies all components by a constant.
`void` `TE(IVector u)`
Times-equals (*=) operation.
`void` `XE(IVector u)`
Sets this vector equal to the cross product of this vector with the given vector (only works for 3D vectors).
• ### Methods inherited from interface etomica.api.IVector

`assignTo, dot, equals, getD, getX, isNaN, isZero, Mv1Squared, squared`
• ### Method Detail

• #### setX

```void setX(int i,
double d)```
Sets the i-th component of the vector to the given value d. If index exceeds dimension of vector, no error is given and the last element of the vector is assigned.
• #### E

`void E(IVector u)`
Sets the components of this vector equal to those of the given vector.
• #### E

`void E(double a)`
Sets all components of this vector equal to the given value.
• #### E

`void E(double[] a)`
Sets the components of this vector equal to the corresponding elements of the given array. Inverse of the assignTo method.
• #### PE

`void PE(IVector u)`
Plus-equals (+=) operation. Increments each component of this vector by the corresponding value in the given vector.
• #### PE

`void PE(double a)`
Plus-equals (+=) operation, causing a constant value to be added to all components of this vector.
• #### ME

`void ME(IVector u)`
Minus-equals (-=) operation. Decrements each component of this vector by the corresponding value in the given vector.
• #### TE

`void TE(IVector u)`
Times-equals (*=) operation. Multiplies each component of this vector by the corresponding value in the given vector.
• #### DE

`void DE(IVector u)`
Divide-equals (/=) operation. Divides each component of this vector by the corresponding value in the given vector.
• #### TE

`void TE(double a)`
Multiplies all components by a constant.
• #### Ea1Tv1

```void Ea1Tv1(double a,
IVector v1)```
Operation (= a1 * v1); sets the components of this to those of the given vector multiplied by the given constant.
• #### PEa1Tv1

```void PEa1Tv1(double a,
IVector v1)```
Increments (+=) components by (a1 * v1)
• #### Ev1Pv2

```void Ev1Pv2(IVector v1,
IVector v2)```
Sets the components of this vector equal to (v1 + v2)
• #### Ev1Mv2

```void Ev1Mv2(IVector v1,
IVector v2)```
Sets the components of this vector equal to (v1 - v2)
• #### mod

`void mod(IVector u)`
Replaces each component of this vector with its value modulo the corresponding component in u
• #### normalize

`void normalize()`
Normalizes this vector, so this.squared() == 1. Divides all components by Math.sqrt(this.squared()).
• #### map

`void map(IFunction f)`
Applies the given function to each element of the vector.
• #### XE

`void XE(IVector u)`
Sets this vector equal to the cross product of this vector with the given vector (only works for 3D vectors).