internal static IVector SubEq(IVector v1, IVector v2)
 {
     VectorChecker.MismatchSize(v1, v2);
     for (int i = 0; i < v1.Size; ++i)
     {
         v1[i] -= v2[i];
     }
     return(v1);
 }
Exemple #2
0
        internal static void Setter(IVectorCollection collection, int index, IVector value)
        {
            IVector dst = collection[index];
            IVector src = value;

            VectorChecker.MismatchSize(src, dst);

            for (int i = 0; i < src.Size; ++i)
            {
                dst[i] = src[i];
            }
        }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <returns></returns>
 public static ColumnVector operator +(Vector v1, ColumnVector v2)
 {
     VectorChecker.MismatchSize(v1, v2);
     return(VectorImpl.Add(new ColumnVector(v1.Size), v1, v2));
 }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <returns></returns>
 public static new ColumnVector Sub(IVector v1, IVector v2)
 {
     VectorChecker.MismatchSize(v1, v2);
     return(VectorImpl.Sub(new ColumnVector(v1.Size), v1, v2));
 }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="rv"></param>
 /// <param name="cv"></param>
 /// <returns></returns>
 public static double operator *(RowVector rv, ColumnVector cv)
 {
     VectorChecker.MismatchSize(rv, cv);
     return(VectorImpl.Dot(rv, cv));
 }
Exemple #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <returns></returns>
 public static double operator *(IVector v1, ColumnVector v2)
 {
     VectorChecker.MismatchSize(v1, v2);
     return(VectorImpl.Dot(v1, v2));
 }
Exemple #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <returns></returns>
 public static RowVector operator +(RowVector v1, Vector v2)
 {
     VectorChecker.MismatchSize(v1, v2);
     return(VectorImpl.Add(new RowVector(v1.Size), v1, v2));
 }
Exemple #8
0
 /// <summary>
 /// 加算する.
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <returns>加算結果の<see cref="RowVector"/></returns>
 public static new RowVector Add(IVector v1, IVector v2)
 {
     VectorChecker.MismatchSize(v1, v2);
     return(VectorImpl.Add(new RowVector(v1.Size), v1, v2));
 }
Exemple #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <returns></returns>
 public static RowVector operator -(IVector v1, RowVector v2)
 {
     VectorChecker.MismatchSize(v1, v2);
     return(VectorImpl.Sub(new RowVector(v1.Size), v1, v2));
 }