Example #1
0
        private static RrFunction BinaryOp(SplineInterpoler left, SplineInterpoler right, FracBinaryOp binaryOp)
        {
            double[] mergedPillars = ArrayUtils.MergeSortedArray(left.pillars, right.pillars);
            var      binOpElems    = mergedPillars.Select(p =>
            {
                RationalFraction leftElem  = BasedSpline(left.stepSplines, p);
                RationalFraction rightElem = BasedSpline(right.stepSplines, p);
                return(binaryOp(leftElem, rightElem));
            }).ToArray();

            RationalFraction leftExtrapol  = BasedExtrapol(left.stepSplines, mergedPillars.First());
            RationalFraction rightExtrapol = BasedExtrapol(right.stepSplines, mergedPillars.First());
            RationalFraction binOpExtrapol = binaryOp(leftExtrapol, rightExtrapol);

            var stepSplines = new StepFunction <RationalFraction>(mergedPillars, binOpElems, binOpExtrapol);

            return(new SplineInterpoler(stepSplines));
        }
Example #2
0
 public static RrFunction Mult(SplineInterpoler left, ConstantRrFunction cst)
 {
     return(new SplineInterpoler(left.stepSplines.Map(f => f * cst.Value)));
 }
Example #3
0
 public static RrFunction Mult(SplineInterpoler left, SplineInterpoler right)
 {
     return(BinaryOp(left, right, (l, r) => l * r));
 }