← HomOps Reference
HomMinMax
Element-wise min or max core. Prefer HomMin / HomMax in graphs.
NmComparison
RunsServer
Changes shapeYes - broadcast
Changes scaleYes - via nested ops
Levels spentTunable - poly depth + mul
RotatesNo
KeysSquare key
What it does
HomMinMax is the shared comparison core behind HomMin and HomMax. It is a composite: HomCompare plus arithmetic, not a registered leaf.Prefer HomMin or HomMax in user-facing graphs. Use this class directly only when you need to select min vs max at runtime via
is_min.Current accuracy calibration requires inputs in
[0, 1]. Comparison is element-wise and needs identical input shapes.Signature
HomMinMax( is_min, # required: True = min, False = max x_accuracy=10, y_accuracy=10, left=0.0, right=1.0, tol=1e-8, rows_budget=None, )
Two ciphertext inputs. No
set_data.Parameters
ParameterTypeDefaultDescription
is_minboolrequiredTrue for min, False for max.x_accuracyint10Horizontal accuracy for the min/max decision. Must be in 4..14.y_accuracyfloat10Vertical accuracy for approximation error, forwarded to Compare / Sign.leftfloat0.0Domain left; currently must be 0.0.rightfloat1.0Domain right; currently must be 1.0.tolfloat1e-8Tolerance forwarded to comparison internals.rows_budgetSequence[int] | NoneNoneAbsolute rows allowed for internal mod-switch.SettingRuleIf you break it
domainInputs must lie in [0, 1]. left must be 0.0 and right must be 1.0.Construction raises: current calibration requires inputs in [0, 1].Example
pipeline.pyPYTHON
from lattica_build.operators import HomMin, HomMax, HomMinMax # Prefer HomMin / HomMax in graphs h_min = HomMin(x_accuracy=7, y_accuracy=7) h_max = HomMax(x_accuracy=7, y_accuracy=7) # HomMinMax only when selecting min vs max at runtime h_minmax = HomMinMax(is_min=True, x_accuracy=7, y_accuracy=7)
See also
- HomMin · HomMax - the usual graph operators
- HomCompare - soft comparison underneath