Frames No Frames Cognitoware API v2009512
Cognitoware.Robotics.dll

Class Vector
System.Object
Cognitoware.Mathematics.Data.Vector

## Summary

Represents a list of double values. Vector is the primary data type used in distributions and bayes filters.

## Constructor Summary

Vector()
Creates a vector with a null internal array.
Vector(Double)
Creates a Vector of order one that contains the parameter value.
Vector(Double[])
Creates a Vector whose order and contents are determined by the parameters.

## Method Summary

Takes the sum of two Vectors.
Cross(Vector)
Creates the cross (outer) product between a column Vector and a row Vector.
Equals(Object)
Inherited from System.Object
Finalize()
Inherited from System.Object
GetHashCode()
Inherited from System.Object
GetType()
Inherited from System.Object
GreaterThan(Vector, Vector)
Compares the elements of two Vectors.
LessThan(Vector, Vector)
Compares the elements of two Vectors.
MemberwiseClone()
Inherited from System.Object
Multiply(Matrix, Vector)
Multiplies a Matrix by a column Vector.
Multiply(Vector, Matrix)
Multiplies a row Vector by a Matrx.
Multiply(Vector, Vector)
Takes the dot (inner) product of two Vectors.
Set(Vector)
Copies the internal array reference of the Vector parameter into this Vector.
Set(Double[])
Sets the contents of the Vector.
Subtraction(Vector, Vector)
Takes the difference between two Vectors.
ToString()
Converts the Vector to a string.

## Details

Represents a list of double values. Vector is the primary data type used in distributions and bayes filters. A Vector can also be a row or column of a Matrix. A Vector is not specified to be a column or a row Vector. That property is determined through context. The Vector is simply a wrapper for an array of doubles. The Vector should be considered immutable so that its internal representation can be reused. The protection around this immutability is weak for performance reasons. The user is responsible for not changing the underlying array.

## Constructor Details

public Vector()
Creates a vector with a null internal array. Set must be called before this Vector can be used.

public Vector(Double x)
Creates a Vector of order one that contains the parameter value. Because this array may be reused, the user should not change the array argument after passing it into the constructor.

### Parameters:

`x` - The value of the single element in the Vector.

public Vector(Double[] a)
Creates a Vector whose order and contents are determined by the parameters. Since 'a' is a 'params' argument, the Vector values may be passed as individual parameters or as a single array.

### Parameters:

`a` - The values in the new Vector.

## Method Details

public static Vector Addition(Vector v1, Vector v2)
Takes the sum of two Vectors. Each element in the new Vector is the sum of the elements at the same index in the two parameter Vectors. An error is generated if the two Vectors have different orders.

### Parameters:

`v1` - The left Vector operand.
`v2` - The right Vector operand.

### Returns:

A new Vector representing the sum of the two parameter vectors.

public Matrix Cross(Vector that)
Creates the product between a column Vector and a row Vector. The resulting Matrix has a number of rows equal to the order of the first Vector, and a number of columns equal to the order of the second Vector. Each row of the Matrix is a scaled copy of the row Vector in the right operand.

### Parameters:

`that` - The right operand of the operation.

### Returns:

A Matrix

public static Boolean GreaterThan(Vector v1, Vector v2)
Compares the elements of two Vectors.

### Parameters:

`v1` - The left Vector operand.
`v2` - The right Vector operand.

### Returns:

Returns true if every index of the left vector is greater than the corresponding index in the right vector.

public static Boolean LessThan(Vector v1, Vector v2)
Compares the elements of two Vectors.

### Parameters:

`v1` - The left Vector operand.
`v2` - The right Vector operand.

### Returns:

Returns true if every index of the left vector is less than the corresponding index in the right vector.

public static Vector Multiply(Matrix m, Vector v)
Multiplies a Matrix by a column Vector. The dot product is calculated between each row of the Matrix and the Vector. The mean is a new Vector. An error is generated if the column count of the Matrix is different from the order of the Vector.

### Parameters:

`m` - The left Matrix operand.
`v` - The right Vector operand.

### Returns:

A Vector where each value is the dot product of a row of the Matrix and the Vector.

public static Vector Multiply(Vector v, Matrix m)
Multiplies a row Vector by a Matrix. The dot product is calculated between the Vector and each column of the Matrix. The mean is a new Vector. An error is generated if the row count of the Matrix is different from the order of the Vector.

### Parameters:

`v` - The left Vector operand.
`m` - The right Matrix operand.

### Returns:

A Vector where each value is the dot product of the Vector and a column of the Matrix.

public static Double Multiply(Vector v1, Vector v2)
Takes the dot (inner) product of two Vectors. The values of the two Vectors at each index are multiplied and summed. An error is generated if the two Vectors have different orders.

### Parameters:

`v1` - The left Vector operand.
`v2` - The right Vector operand.

### Returns:

The sum of products of each index of the operands.

public virtual void Set(Vector v)
Copies the internal array reference of the Vector parameter into this Vector.

### Parameters:

`v` - The Vector to copy into this Array.

public void Set(Double[] a)
Sets the contents of the Vector. The passed in array is used directly as the internal representation. The passed in array should not be changed after calling Set. Since 'a' is a 'params' argument, the Vector values may be passed as individual parameters or as a single array.

public static Vector Subtraction(Vector v1, Vector v2)
Takes the difference between two Vectors. Each element in the new Vector is the difference between the elements at the same index in the two parameter Vectors.

### Parameters:

`v1` - The left Vector operand.
`v2` - The right Vector operand.

### Returns:

A new Vector representing the difference between the two parameter vectors.

public override String ToString()
Converts the Vector to a string. Each element of the Vector is included in the string.

### Returns:

A string representation of the Vector.