public VectorValue <TScalar> Subtract(VectorValue <TScalar> subtrahend) { int max = Math.Max(Count, subtrahend.Count); int min = Math.Min(Count, subtrahend.Count); TScalar[] otherValue = subtrahend._dataValue; TScalar[] value = new TScalar[max]; if (Count > subtrahend.Count) { Array.Copy(_dataValue, min, value, min, max - min); } else { for (int i = min; i < max; i++) { value[i] = otherValue[i].Negate(); } } for (int i = 0; i < min; i++) { value[i] = _dataValue[i].Subtract(otherValue[i]); } return(new VectorValue <TScalar>(value)); }
public override bool Equals(ValueStructure other) { VectorValue <TScalar> vectorValue = other as VectorValue <TScalar>; if (vectorValue != null) { return(Equals(vectorValue)); } return(other == this); }
public VectorValue <TScalar> Add(VectorValue <TScalar> summand) { int max = Math.Max(Count, summand.Count); int min = Math.Min(Count, summand.Count); TScalar[] otherValue = summand._dataValue; TScalar[] value = new TScalar[max]; if (Count > summand.Count) { Array.Copy(_dataValue, min, value, min, max - min); } else { Array.Copy(otherValue, min, value, min, max - min); } for (int i = 0; i < min; i++) { value[i] = _dataValue[i].Add(otherValue[i]); } return(new VectorValue <TScalar>(value)); }
public bool Equals(VectorValue <TScalar> other) { return(other != null && _dataValue.Equals(other._dataValue)); }
public static VectorValue <TScalar> Negate(VectorValue <TScalar> subtrahend) { return(subtrahend.Negate()); }
public static VectorValue <TScalar> Subtract(VectorValue <TScalar> minuend, VectorValue <TScalar> subtrahend) { return(minuend.Subtract(subtrahend)); }
public static VectorValue <TScalar> Add(VectorValue <TScalar> summand1, VectorValue <TScalar> summand2) { return(summand1.Add(summand2)); }