|
14 | 14 | * To support the Op matching paradigm, we establish three types of equivalence: |
15 | 15 | * <ol> |
16 | 16 | * <li><b>Form Equivalence</b></li> Drawn from <a href="https://en.wikipedia.org/wiki/Theory_of_forms">Plato's Theory of Forms</a>, Form Equivalence implies that two objects (which could be Ops, or Op parameters) theoretically draw from the same shared idea (such as an addition operation, or an image, etc.) |
17 | | - * <li><b>Algorithmic Equivalence</b></li> Algorithmic Equivalence means that two Ops: |
| 17 | + * <li><b>Structural Equivalence</b></li> Structural Equivalence means that two Ops: |
18 | 18 | * <ol> |
19 | 19 | * <li>Are Form Equivalent</li> |
20 | 20 | * <li>Have the same number of inputs and the same number of outputs</li> |
21 | | - * <li>For each input position, accept form equivalent types</li> |
22 | | - * <li>Return form equivalent output types</li> |
| 21 | + * <li>For each input position, accept form-equivalent inputs</li> |
| 22 | + * <li>Return form-equivalent outputs</li> |
23 | 23 | * </ol> |
24 | | - * <li><b>Numerical Equivalence</b></li> Numerical Equivalence means that {@code o1.equals(o2)} for two outputs {@code o1} and {@code o2} from two Ops. |
| 24 | + * <li><b>Result Equivalence</b></li> Result Equivalence means that {@code o1.equals(o2)} for two outputs {@code o1} and {@code o2} from two Ops. |
25 | 25 | * </ol> |
26 | 26 | * Within the Ops API, each type of equivalence is utilized in the following ways: |
27 | 27 | * <ol> |
28 | | - * <li><b>Form Equivalence</b></li> If two Ops are "Form Equivalent", they are defined under the same name, i.e. {@code op1.name().equals(op2.name())} |
29 | | - * <li><b>Algorithmic Equivalence</b></li> If two Ops are "Algorithm Equivalent", then they are considered to implement the same computational algorithm. |
30 | | - * <li><b>Numerical Equivalence</b></li> If two Ops are "Numerically Equivalent", then they are considered to output the same values, neglecting trivial differences such as floating-point errors. |
| 28 | + * <li><b>Form Equivalence</b></li> If two Ops are "Form Equivalent", they are defined under the same name. |
| 29 | + * <li><b>Structural Equivalence</b></li> If two Ops are "Structural Equivalent", they share a common form-reduced description, searchable using {@link org.scijava.ops.api.OpEnvironment#descriptions(java.lang.String)}. For example, an Op "math.add" that produces an ImgLib2 Img from Img operands, and another Op "math.add" that produces a NumPy ndarray from ndarray operands, will reduce to a single description "math.add" that produces an image from image operands. |
| 30 | + * <li><b>Result Equivalence</b></li> If two Ops are "Result Equivalent", then they are considered to produce equivalent values, using the primary language-specific definition of equality (e.g. `Object.equals`, for Java usage). |
31 | 31 | * </ol> |
32 | 32 | * |
33 | 33 | * For example, consider three Ops: |
|
36 | 36 | * <li> filter.gauss(ij.ImagePlus, java.lang.Double) -> ij.ImagePlus</li> |
37 | 37 | * <li> filter.gauss(net.imglib2.img.Img, net.imglib2.algorithm.neighborhood.Shape) -> net.imglib2.img.Img</li> |
38 | 38 | * </ol> |
39 | | - * Ops 1 and 2 should be considered form equivalent, as they have the same name, and algorithmically equivalent, as they both take in an image data structure and a floating point number and return an image data structure, but they are likely not numerically equivalent due to the underlying data structures. |
| 39 | + * Ops 1 and 2 should be considered form-equivalent, as they have the same name, and structural-equivalent, as they both take in an image data structure and a floating point number and return an image data structure, but they are likely not result-equivalent due to the underlying data structures. |
40 | 40 | * <p> |
41 | | - * Ops 1 and 3 should also be considered form equivalent, as they have the same name, but are not form equivalent, as one computes its own Shape over which to perform a gaussian blur, while the other takes a predefined shape. |
| 41 | + * Ops 1 and 3 should also be considered form-equivalent, as they have the same name, but are not structural-equivalent, as one computes its own Shape over which to perform a gaussian blur, while the other takes a predefined shape. |
42 | 42 | * <p> |
43 | | - * These definitions of equivalence provide a level of flexibility impossible without the Ops API; algorithmic equivalence allows us to, for example, define equivalent Ops across programming languages and libraries, and then to create scripts that can run unaltered on data types from each of those languages and libraries. Within each form implementation, however, we ensure numeric equivalence and therefore reproducability |
| 43 | + * These definitions of equivalence provide a level of flexibility impossible without the Ops API; structural-equivalence allows us to, for example, define equivalent Ops across programming languages and libraries, and then to create scripts that can run unaltered on data types from each of those languages and libraries. Given the same {@link org.scijava.ops.api.OpEnvironment} and inputs, however, we ensure result-equivalence and therefore reproducability |
44 | 44 | * |
45 | 45 | */ |
46 | 46 | package org.scijava.ops.api; |
0 commit comments