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

Method sub_slice

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

Returns every second element starting from `start_offset`

(&self, start_offset: i64, bit_len: i64)

Source from the content-addressed store, hash-verified

173
174 /// Returns every second element starting from `start_offset`
175 fn sub_slice(&self, start_offset: i64, bit_len: i64) -> Result<Self> {
176 // TODO: at some point this could become the slowest part, as getting
177 // every second element is not efficient. If we have an efficient way to
178 // reorder elements of the array at the beginning, we potentially could
179 // do it an a way, such that later all splits will have the form
180 // [0..len/2] and [len/2..len].
181 // But currently the slowest part is `permuteAxes` and there is no good
182 // way of permutating the array, so not optimizing it right now.
183 let get_slice = |node: &Node| {
184 node.get_slice(vec![SliceElement::SubArray(
185 Some(start_offset),
186 Some(bit_len),
187 Some(2),
188 )])
189 };
190 Ok(Self {
191 a_equal_b: get_slice(&self.a_equal_b)?,
192 a: get_slice(&self.a)?,
193 })
194 }
195
196 fn not_a(&self) -> Result<Node> {
197 let graph = self.a_equal_b.get_graph();

Callers 1

shrinkMethod · 0.45

Calls 2

get_sliceFunction · 0.85
get_sliceMethod · 0.45

Tested by

no test coverage detected