Copying And Conversion |
Hereinafter the following convention is used:
– small Greek letters are used to denote scalars;
– small Latin letters are used to denote vectors;
– capital Latin letters are used to denote matrices.
This topic contains the following sections:
This section describes methods applied to receive a copy of a vector and to get a sub-vector of the given vector.
Operation | Description | Performance |
---|---|---|
copy | Creates a copy of the original vector. | |
copy part of this vector to another vector | Suppose the given vector is and the vector to copy to is We want to copy l elements from offset k of the source vector to offset t of the destination vector. The resulting vector will then contain the set of l elements from vector u, which will replace l elements in vector v, starting from t-th element. Consider our vector is , the destination vector is . User specifies offsets as follows: C# 1u.CopyTo(v, 2, 4, 3); after that vector v will be . | |
set subvector | Copies the values from another vector and places them into this vector starting from a specified offset. Suppose our vector is: and another vector is: then the values of the vector v will be placed into the vector u starting from the element with k-th index. | |
get subvector | Gets values of the subvector of this vector. Copies a specified number of values l from this vector starting from a specified offset k. Suppose our vector is: then the subvector of the vector u will be: It is also available to get subvector of vector starting from a specified index, number of elements to copy is equal to the length of the destination vector. |
This section describes various methods applied to convert a vector into an array, a matrix or a string.
Operation | Description | Performance |
---|---|---|
set values | Sets vector elements to the array values. | |
get values | Returns the array of values of this vector. Returning result:Out of place: | |
convert to string | Formats the value of the current instance using the specified format. | |
convert to matrix | Returns the matrix representation of this vector as column vector or a row vector. | |
convert to array | Returns an array filled with elements of this vector. |