Common Reference > VectorMath Class

VectorMath Class

This class provides a convenient library of static methods for transforming array data.

public class VectorMath

VectorMath Methods

CatenateCatenate a vector to another vector (or scalar)
CosCompute the cosine of any vector
DifferenceCompute the first difference of an integer vector
DivideDivide two integer vectors
DropCreate an integer vector by removing count items from an existing integer vector
EnlistCatenate a list of vectors together
ExponentialSmoothSimple exponential smooth of existing vector with given smoothing constant
MaxThe largest item in an integer vector
MinThe smallest item in an integer vector
MovingAverageMoving average of an integer vector given period and pad value
MovingTotalMoving total of an integer vector given period and pad value
MultiplyMultiply two integer vectors
NegateThe negative values of an integer vector
PowPower two double vectors
RangeGenerate indices from start up to end
ReciprocalThe inverse values of an integer vector
RunningMaxRunning maximum of an integer vector
RunningMinRunning minimum of an integer vector
RunningTotalRunning total of an integer vector
SinCompute the sine of any vector
SqrtSquare root of an integer vector
SubtractSubtract two integer vectors
SumAdd two integer vectors
TailCreate an integer vector from the last elements of existing integer vector and new element count
TakeCreate an integer vector from an existing integer vector and new element count
TotalTotal of an integer vector


Typically you may want to combine several variables in a Scatterplot, or draw a timeseries with a moving average.

BP = new int[] {427,428,427,429,424,418,420,424,416,410,406,409,403,395,389,380,374,369,
pad = sp.MissingValue;
mav12 = VectorMath.MovingAverage(BP,12,pad);
mav20 = VectorMath.MovingAverage(BP,20,pad);

sp.LineGraphStyle = LineGraphStyles.Markers|LineGraphStyles.NoLines;



sp.LineGraphStyle = 0;
sp.DrawLineGraph(new double[][]{mav12,mav20});


Namespace: Causeway

Assembly: SharpPlot (in sharpplot.dll)

Send comments on this topic
© Dyalog Ltd 2021