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

Method new

ciphercore-base/src/ops/long_division.rs:159–178  ·  view source on GitHub ↗
(divident_type: Type, divisor_type: Type)

Source from the content-addressed store, hash-verified

157
158impl Types {
159 fn new(divident_type: Type, divisor_type: Type) -> Result<Self> {
160 let (dividend_no_bits_shape, _dividend_bits) = pop_last_dim(divident_type.get_dimensions());
161 let (divisor_no_bits_shape, divisor_bits) = pop_last_dim(divisor_type.get_dimensions());
162 let output_no_bits_shape =
163 broadcast_shapes(dividend_no_bits_shape.clone(), divisor_no_bits_shape)?;
164 let dividend_no_bits_shape =
165 prepend_dims(dividend_no_bits_shape, output_no_bits_shape.len())?;
166 let remainder_pulled_bits_shape =
167 [vec![divisor_bits], output_no_bits_shape.clone()].concat();
168 let quotient_pulled_bit_shape = [vec![1], output_no_bits_shape.clone()].concat();
169 let quotient_no_bits_shape = output_no_bits_shape;
170 Ok(Self {
171 divident_type,
172 divisor_type,
173 remainder_pulled_bits_type: array_type(remainder_pulled_bits_shape, BIT),
174 quotient_pulled_bit_type: array_type(quotient_pulled_bit_shape, BIT),
175 dividend_no_bits_type: array_type(dividend_no_bits_shape, BIT),
176 quotient_no_bits_type: array_type(quotient_no_bits_shape, BIT),
177 })
178 }
179}
180
181fn broadcast(node: Node, want_type: Type) -> Result<Node> {

Callers

nothing calls this directly

Calls 6

pop_last_dimFunction · 0.85
broadcast_shapesFunction · 0.85
prepend_dimsFunction · 0.85
get_dimensionsMethod · 0.80
cloneMethod · 0.80
array_typeFunction · 0.50

Tested by

no test coverage detected