PointSet.js (1173B)
1 import * as Continuous from "../PointSet/Continuous.js"; 2 import * as Discrete from "../PointSet/Discrete.js"; 3 import * as Mixed from "../PointSet/Mixed.js"; 4 import { ContinuousShape } from "./Continuous.js"; 5 import { DiscreteShape } from "./Discrete.js"; 6 export const convolutionOperationToFn = (op) => { 7 return { 8 Add: (x, y) => x + y, 9 Multiply: (x, y) => x * y, 10 Subtract: (x, y) => x - y, 11 }[op]; 12 }; 13 export const combinePointwise = (t1, t2, fn, integralSumCachesFn = () => undefined, integralCachesFn = () => undefined) => { 14 if (t1 instanceof ContinuousShape && t2 instanceof ContinuousShape) { 15 return Continuous.combinePointwise(t1, t2, fn, undefined, integralSumCachesFn); 16 } 17 else if (t1 instanceof DiscreteShape && t2 instanceof DiscreteShape) { 18 return Discrete.combinePointwise(t1, t2, fn, integralSumCachesFn); 19 } 20 else { 21 return Mixed.combinePointwise(t1.toMixed(), t2.toMixed(), fn, integralSumCachesFn, integralCachesFn); 22 } 23 }; 24 export const isContinuous = (d) => d instanceof ContinuousShape; 25 export const isDiscrete = (d) => d instanceof DiscreteShape; 26 //# sourceMappingURL=PointSet.js.map