Example #1
0
 /// <summary>
 /// Performs the operation:
 /// result[i] = <paramref name="thisVector"/>[i] + <paramref name="otherVector"/>[i], for
 /// 0 &lt;= i &lt; <paramref name="thisVector"/>.<see cref="IIndexable1D.Length"/>
 /// = <paramref name="otherVector"/>.<see cref="IIndexable1D.Length"/>.
 /// The resulting vector is written in a new object and then returned.
 /// </summary>
 /// <param name="thisVector">
 /// A vector with the same <see cref="IIndexable1D.Length"/> as <paramref name="otherVector"/>.
 /// </param>
 /// <param name="otherVector">
 /// A vector with the same <see cref="IIndexable1D.Length"/> as <paramref name="thisVector"/>.
 /// </param>
 /// <exception cref="NonMatchingDimensionsException">
 /// Thrown if <paramref name="thisVector"/> and <paramref name="otherVector"/> have different
 /// <see cref="IIndexable1D.Length"/>.
 /// </exception>
 public static IVector Add(this IVectorView thisVector, IVectorView otherVector)
 => thisVector.Axpy(otherVector, 1.0);
Example #2
0
 /// <summary>
 /// Performs the operation:
 /// result[i] = <paramref name="thisVector"/>[i] - <paramref name="otherVector"/>[i], for
 /// 0 &lt;= i &lt; <paramref name="thisVector"/>.<see cref="IIndexable1D.Length"/>
 /// = <paramref name="otherVector"/>.<see cref="IIndexable1D.Length"/>.
 /// The resulting vector is written in a new object and then returned.
 /// </summary>
 /// <param name="thisVector">
 /// A vector with the same <see cref="IIndexable1D.Length"/> as <paramref name="otherVector"/>.
 /// </param>
 /// <param name="otherVector">
 /// A vector with the same <see cref="IIndexable1D.Length"/> as <paramref name="thisVector"/>.
 /// </param>
 /// <exception cref="NonMatchingDimensionsException">
 /// Thrown if <paramref name="thisVector"/> and <paramref name="otherVector"/> have different
 /// <see cref="IIndexable1D.Length"/>.
 /// </exception>
 public static IVector Subtract(this IVectorView thisVector, IVectorView otherVector)
 => thisVector.Axpy(otherVector, -1.0);