Vector.DifferenceInto<T> Method

Computes the forward or backward difference of a vector.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.7.0
C#
public static Vector<T> DifferenceInto<T>(
	this Vector<T> vector,
	int lag,
	Vector<T>? result
)

Parameters

vector  Vector<T>
A vector.
lag  Int32
The distance between elements to difference. Positive values compute later elements minus earlier elements. Negative values compute earlier elements minus later elements.
result  Vector<T>
The vector that is to hold the result. May be null. If supplied, it must be writable and have length at least the computed difference length.

Type Parameters

T

Return Value

Vector<T>
A vector whose elements are equal to the difference between elements of vector that are lag apart. If result is null, the returned vector length is the maximum of vector length minus the absolute value of lag, and zero.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

vector is null.

DimensionMismatchException

result is shorter than the computed difference.

See Also