SA_VectorArray


Description

SA_VectorArray is a data structure which holds a list of [N x k] Matrices where k has to be the same for all elements. The list uses a [T x k] stack matrix where the elements are stored cosecutively. An index array stores for every element where it begins. The dimension k is determined when the first [k x L] element is inserted into the structure.


Constructor:

VecArr = SA_VectorArray

VecArr: object of type SA_VectorArray;

Creates a new (empty) instance of the class SA_VectorArray.


Public Functions:

VecArr = add(VecArr,Vector,index)

VecArr: SA_VectorArray; The VectorArray used.
Vector: [1 x k] Vector; The vector to be added.
index: Uint; Index of the element in the structure.

VecArr: SA_VectorArray; The VectorArray used.

Adds Vector to all rows of the element at index in the structure. If index is not passed, Vector is added to all rows of all elements in the structure.



VecArr = appendToElement(VecArr, index, new_elem)

VecArr: SA_VectorArray; The VectorArray used.
index: Uint; Index of the element in the structure. new_elem: [N x k] Matrix; A (partial) element to be appended.

VecArr: SA_VectorArray; The VectorArray used.

Appends new_elem to the end of the element at index in the structure. The order of the elements is not changed.



s = get(VecArr, index)

VecArr: SA_VectorArray; The VectorArray used.
index: Uint; Index of the element in the structure.

s: [N x k] Float Vector; Element of the structure.

get returns the element at the position index in the structure. If index is not passed the entire stack (all elements in one [M x k] matrix) is returned.



VecArr = insert(VecArr,VectorList)

VecArr: SA_VectorArray; The VectorArray used.
VectorList: [L x k] Matrix; The element to be inserted.

VecArr: SA_VectorArray; The VectorArray with the new element inserted.

Inserts VectorList at the end of VecArr.



VecArr = combine(VecArr1,VecArr2)

VecArr1: SA_VectorArray; The first VectorArray to be combined.
VecArr2: SA_VectorArray; The second VectorArray to be combined.

VecArr: SA_VectorArray; The combined VectorArray.

Combines the two vector arrays VecArr1 and VecArr2 to one vector array. VecArr2 is added to the end of VecArr1.



VecArr = remove(VecArr, index)

VecArr: SA_VectorArray; The VectorArray used.
index: Uint; Index of the element to be removed from the structure.

VecArr: SA_VectorArray; VectorArray with the element removed.

Removes the element at the index position index from the structure. All elements with indices greater than index will have their index decremented by one.



VecArr = removeSmallerThan(VecArr, length)

VecArr: SA_VectorArray; The VectorArray used.
length: Uint; Minimum length for elements to remain in the structure.

VecArr: SA_VectorArray; VectorArray with the (appropriate) elements removed.

All elements of the structure with length (= the free dimension of the matrices) smaller than length will be removed from the structure. After this operation, indices can be changed for all elements.



s = size(VecArr, index)

VecArr: SA_VectorArray; The VectorArray used.
index: Uint; Index of the element of interest.

s: Uint; The size.

size returns the length (= free dimension of the matrix element) if index is specified. If not the function returns the number of elements in the structure.



v = index(VecArr)

VecArr: SA_VectorArray; The VectorArray used.

v: [k x 1] Uint Matrix; The list of indices.

index returns the inter index list that is used to point on the positions of the stack where the element starts. element i starts at v[i] and ends at v[i+1]-1.



SortVA = sort(VecArr)

VecArr: SA_VectorArray; The VectorArray used.

SortVA: SA_VectorArray; The sorted VectorArray.

This function sorts all elements in VecArr by their length (= free dimension of the matrix element). SortVA will have the longest element at index i=1 and the smallest at index j=size(SortVA).



save(VecArr, Name)

VecArr: SA_VectorArray; The VectorArry to be saved.
Name: string; The name under which the VectorArray will be saved.

save writes the data of VecArr into the folder @VectorArray/saves.



VecArr = load(VecArrIn, Name)

VecArr: SA_VectorArray; An instance of type SA_VectorArray
Name: string; The name under which the VectorArray will be saved.

VecArr: SA_VectorArray; The VectorArry to be saved.

load reads the VectorArray data stored under Name from the disc and returns an instance of SA_VectorArray. VecArrIn is needed as parameter to indicate Matlab that load is a function of the Class SA_VectorArray.



Private Functions:






Copyright © 2007 Thomas Oskam, ETH Zürich. All rights reserved.