/// <summary> /// Create vector of n-dimensions with equal coordinates /// </summary> public Vector(int dimensions, double val) { _coordinates = new double[dimensions]; IVector self = this; VectorOperations.Fill(ref self, val); }
public static Vector operator*(Vector lhs, double s) { Vector res = new Vector(lhs.Dimensions); VectorOperations.ScalarMul(lhs, s, ref res); return(res); }
public static Vector operator-(Vector lhs, IVector rhs) { Vector res = new Vector(lhs.Dimensions); VectorOperations.Sub(lhs, rhs, ref res); return(res); }
/// <summary> /// Create the union of the left and right bounds. /// </summary> public static void Union(AABB left, AABB right, ref AABB dest) { VectorOperations.Copy(left.Lower, ref dest._min); VectorOperations.Copy(left.Upper, ref dest._max); // Selective enlargement to cope with possibly unbounded regions in right. dest.EnlargeLower(right.Lower); dest.EnlargeUpper(right.Upper); }
/// <summary> /// Reset to empty state. /// </summary> public void Reset() { VectorOperations.Fill(ref _min, Double.MaxValue); VectorOperations.Fill(ref _max, Double.MinValue); }
/// <summary> /// Calculate the square-length (L2 norm) of the given vector. /// </summary> public static double SquaredL2Norm(IVector a) { return(VectorOperations.Inner(a, a)); }