allow to combine more than two blocks
this MR allows to give any number of blocks to recode them.
this is a convenience to avoid combining the blocks pair-wise and create intermediate and useless blocks, e.g. by defining the following Nushell command with the komodo.nu
module
def "komodo full-recode" []: list<string> -> string {
let blocks = $in
match ($blocks | length) {
0 => { return null },
1 => { return $blocks.0 },
}
$blocks | skip 1 | reduce --fold $blocks.0 {|it, acc| komodo combine $it $acc}
}
one can now do directly
komodo combine ...(komodo ls)
which will create a single new fully recoded block!
changelog
- new
fec::combine
that takes a list of shards and their coefficients and combines them, returnsNone
if the slices are empty or not of the same length
pub(super) combine<E: Pairing>(
shards: &[Shard<E>],
coeffs: &[E::ScalarField],
) -> Option<Shard<E>>
- modified
recode
that takes any number of blocks and returns anOption
if there is none
pub recode<E: Pairing>(blocks: &[Block<E>]) -> Result<Option<Block<E>>, KomodoError>
- the
komodo combine
command fromkomodo.nu
can now take any number of blocks, even 0 by giving a nice error
Edited by STEVAN Antoine