Esempio n. 1
0
 public static Func <Fraction, V> Interpolate <V>(this IVectorSpace <Fraction, V> space, V start, V end)
 {
     return(scale =>
     {
         return space.Add(space.Scale(scale.Complement(), start), space.Scale(scale, end));
     });
 }
Esempio n. 2
0
        public static V Average <S, V>(this IVectorSpace <S, V> space, IArray <S> factors, IArray <V> vectors)
        {
            var summands = new Array <V>(
                size: factors.Size,
                atF: index => space.Scale(factors[index], vectors[index]));

            return(space.Adding().Join(summands));
        }
Esempio n. 3
0
 public static IVectorSpace <S, IPoint <V> > Geometry <S, V>(this IVectorSpace <S, V> space)
 {
     return(new VectorSpace <S, IPoint <V> >(
                zero: new Point <V>(axis => space.Zero),
                addF: (left, right) =>
     {
         return new Point <V>(axis => space.Add(left.On(axis), right.On(axis)));
     },
                scaleF: (scale, point) =>
     {
         return new Point <V>(axis => space.Scale(scale, point.On(axis)));
     }));
 }