public static RrFunction Mult(LinearCombinationRrFunction lc, ConstantRrFunction cst) { if (DoubleUtils.MachineEquality(1.0, cst.Value)) { return(lc); } if (DoubleUtils.EqualZero(cst.Value)) { return(RrFunctions.Zero); } return(LinearCombinationRrFunction.Create(lc.Weights.Map(w => w * cst.Value), lc.Functions)); }
public static RrFunction LinearCombination(double[] weights, RrFunction[] funcs) { return(LinearCombinationRrFunction.Create(weights, funcs)); }
public static RrFunction Sum(params RrFunction[] functions) { return(LinearCombinationRrFunction.Create(functions.Select(f => 1.0).ToArray(), functions)); }