Class: Vector
Prev
Next

Class: Vector

Represents a vector of any type in Kst. Some vectors are editable, while others are not. This class behaves just as a JavaScript array, but has additional properties and methods.

Inherits: Object

Collection class: VectorCollection

Constructors:

Methods:

Properties:

Vector ( )

Default constructor creates an empty, editable vector.

Vector ( Array array )

  • Array array - The array to be copied.

Creates a vector that is a copy of array.

void resize ( number size )

  • number size - The new size of the vector. Should be >= 2.

Resizes the vector.
  • Throws: GeneralError - Throws this exception if the vector is not editable.

number interpolate ( number i, number n )

  • number i - The sample number to obtain the interpolated value of.

  • number n - The number of samples to interpolate to.

Interpolates the vector to n samples and returns the interpolated value of sample i.

void zero ( )

Sets all values in the vector to zero.

  • Throws: GeneralError - Throws this exception if the vector is not editable.

void update ( )

Updates the statistical values associated with a vector.

  • Throws: GeneralError - Throws this exception if the vector is not editable.

void valueAt ( number index )

  • number index - The sample number to obtain the value of. A negative value of -n returns the n'th sample from the end of the vector..

Returns the value at the given index.

number length [Read-Only]

The number of samples in the vector.

number min [Read-Only]

The value of the smallest sample in the vector.

number max [Read-Only]

The value of the largest sample in the vector.

number mean [Read-Only]

The mean value of all samples in the vector.

number numNew [Read-Only]

number numShifted [Read-Only]

number editable [Read-Only]

True if the vector is editable by the user. This should be checked before attempting to modify a vector in any way.

number numNaN [Read-Only]

The number of NaN values in the vector.

Array array [Read-Only]

The vector as an Array.

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team