Search Results for

    Show / Hide Table of Contents

    Class Vec<T>

    Class for generic methods on any type T that treat arrays as vectors (sorting,slicing,concatenating).

    For mathematical methods on vectors of doubles and integers, look into non-generic sister class "Vec".

    Inheritance
    object
    Vec<T>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: TimeSeriesAnalysis
    Assembly: TimeSeriesAnalysis.dll
    Syntax
    public static class Vec<T>
    Type Parameters
    Name Description
    T

    type, such as double, int or DateTime

    Methods

    | Edit this page View Source

    Concat(T[], T)

    concatenates the value y to the end of array x

    Declaration
    public static T[] Concat(T[] x, T y)
    Parameters
    Type Name Description
    T[] x
    T y
    Returns
    Type Description
    T[]
    | Edit this page View Source

    Concat(T[], T[])

    concatenates arrays x and y into a new larger array

    Declaration
    public static T[] Concat(T[] x, T[] y)
    Parameters
    Type Name Description
    T[] x
    T[] y
    Returns
    Type Description
    T[]
    | Edit this page View Source

    Downsample(T[], double, int)

    Downsample a vector by a given factor by choosing every Floor(factor*n) value. The optional key index indicates an index for which to base the downsampling around.

    Declaration
    public static T[] Downsample(T[] vec, double factor, int keyIndex = 0)
    Parameters
    Type Name Description
    T[] vec
    double factor
    int keyIndex
    Returns
    Type Description
    T[]
    | Edit this page View Source

    Fill(T, int)

    creates an array of size N where every element has value value

    Declaration
    public static T[] Fill(T value, int N)
    Parameters
    Type Name Description
    T value
    int N
    Returns
    Type Description
    T[]
    | Edit this page View Source

    GetIndicesOfValue(T, List<T>)

    Get the indice of value val values that are present in vec

    Declaration
    public static List<int> GetIndicesOfValue(T val, List<T> vec)
    Parameters
    Type Name Description
    T val

    The results are related to the positions in this vector

    List<T> vec

    vec1 is compared to this vector

    Returns
    Type Description
    List<int>
    | Edit this page View Source

    GetIndicesOfValues(List<T>, List<T>)

    Get the indices of vec1 values that are present in vec2

    Declaration
    public static List<int> GetIndicesOfValues(List<T> vec1, List<T> vec2)
    Parameters
    Type Name Description
    List<T> vec1

    The results are related to the positions in this vector

    List<T> vec2

    vec1 is compared to this vector

    Returns
    Type Description
    List<int>
    | Edit this page View Source

    GetValuesAtIndices(T[], List<int>)

    returns an array of the values that are in array at the indices given by indices list, or null if input is null

    Declaration
    public static T[] GetValuesAtIndices(T[] array, List<int> indices)
    Parameters
    Type Name Description
    T[] array
    List<int> indices
    Returns
    Type Description
    T[]
    | Edit this page View Source

    GetValuesExcludingIndices(T[], List<int>)

    returns an array of the values that are in array excluding those with indices given by indices list

    Declaration
    public static T[] GetValuesExcludingIndices(T[] array, List<int> indices)
    Parameters
    Type Name Description
    T[] array
    List<int> indices
    Returns
    Type Description
    T[]
    | Edit this page View Source

    Intersect(List<List<T>>)

    returns the intersection of a number of arrays

    Declaration
    public static List<T> Intersect(List<List<T>> lists)
    Parameters
    Type Name Description
    List<List<T>> lists
    Returns
    Type Description
    List<T>
    | Edit this page View Source

    Intersect(List<T>, List<T>)

    returns the intersection of array1 and array2, a list of elements that are in both vectors

    Declaration
    public static List<T> Intersect(List<T> vec1, List<T> vec2)
    Parameters
    Type Name Description
    List<T> vec1
    List<T> vec2
    Returns
    Type Description
    List<T>
    | Edit this page View Source

    IsConstant(T[])

    returns the intersection of a number of arrays

    Declaration
    public static bool IsConstant(T[] vec)
    Parameters
    Type Name Description
    T[] vec
    Returns
    Type Description
    bool
    | Edit this page View Source

    Oversample(T[], double, int)

    Oversample a vector by a given factor by choosing every value until (i/factor > 1). The optional key index indicates an index for which to base the oversampling around.

    Declaration
    public static T[] Oversample(T[] vec, double factor, int keyIndex = 0)
    Parameters
    Type Name Description
    T[] vec
    double factor
    int keyIndex
    Returns
    Type Description
    T[]
    | Edit this page View Source

    ReplaceIndWithValuesPrior(double[], List<int>)

    replaces all the vaules in array with indices in indList with the last good value prior to that index.

    Declaration
    public static double[] ReplaceIndWithValuesPrior(double[] array, List<int> indList)
    Parameters
    Type Name Description
    double[] array
    List<int> indList
    Returns
    Type Description
    double[]
    | Edit this page View Source

    Sort(T[], VectorSortType)

    Sort a vector

    Declaration
    public static T[] Sort(T[] vec, VectorSortType sortType)
    Parameters
    Type Name Description
    T[] vec

    vector to be sorted

    VectorSortType sortType

    the type of sorting

    Returns
    Type Description
    T[]

    indices of vec in sorted order

    | Edit this page View Source

    Sort(T[], VectorSortType, out int[])

    Sort the vector

    Declaration
    public static T[] Sort(T[] vec, VectorSortType sortType, out int[] idx)
    Parameters
    Type Name Description
    T[] vec
    VectorSortType sortType
    int[] idx
    Returns
    Type Description
    T[]
    | Edit this page View Source

    SubArray(T[], int, int)

    Returns the portion of array1 starting and indStart, and ending at indEnd(or at the end if third paramter is omitted)

    Declaration
    public static T[] SubArray(T[] array1, int indStart, int indEnd = -9999)
    Parameters
    Type Name Description
    T[] array1

    array to get subarray from

    int indStart

    starting index

    int indEnd

    ending index(or to the end if omitted)

    Returns
    Type Description
    T[]

    null if indStart and indEnd are the same, otherwise the subarray

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX