MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / join

Method join

ciphercore-base/src/ops/comparisons.rs:132–144  ·  view source on GitHub ↗

`rhs` has higher priority. So if `rhs.a_is_smaller` or `rhs.b_is_smaller` is set to 1 for a specific position, this value is used. Otherwise, values from `self` are used. Multiplication depth of formulas here is 1, which is important for performance reasons.

(&self, rhs: &Self)

Source from the content-addressed store, hash-verified

130 /// Multiplication depth of formulas here is 1, which is important for performance
131 /// reasons.
132 fn join(&self, rhs: &Self) -> Result<Self> {
133 let graph = &self.a_equal_b.get_graph();
134 let one = graph.ones(scalar_type(BIT))?;
135
136 let a = self
137 .a
138 .multiply(rhs.a_equal_b.clone())?
139 .add(rhs.a.multiply(rhs.a_equal_b.add(one)?)?)?;
140
141 let a_equal_b = self.a_equal_b.multiply(rhs.a_equal_b.clone())?;
142
143 Ok(Self { a_equal_b, a })
144 }
145
146 /// Joins even-indexed and odd-indexed values
147 /// If the number of elements is not divisible by two,

Callers 2

shrinkMethod · 0.45
build_comparison_graphFunction · 0.45

Calls 6

onesMethod · 0.80
cloneMethod · 0.80
scalar_typeFunction · 0.50
get_graphMethod · 0.45
addMethod · 0.45
multiplyMethod · 0.45

Tested by

no test coverage detected