Documentation
¶
Overview ¶
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
- func MarshalBinary[W util.BigInter](tr Trace[W]) ([]byte, error)
- func ToTrace[T word.Word[T]](tr Trace[T]) []lt.Module[T]
- type Array
- func (p *Array[T]) HasModule(name string) (uint, bool)
- func (p *Array[T]) Module(module uint) Module[T]
- func (p *Array[T]) Modules() iter.Iterator[Module[T]]
- func (p *Array[T]) RawModule(module uint) *ArrayModule[T]
- func (p *Array[T]) String() string
- func (p *Array[T]) UnmarshalBinary(data []byte) error
- func (p *Array[T]) Width() uint
- type ArrayModule
- func (p ArrayModule[T]) Descriptor() iter.Iterator[Register]
- func (p ArrayModule[T]) Height() uint
- func (p ArrayModule[T]) LimbAt(index uint) Limb
- func (p ArrayModule[T]) Limbs() iter.Iterator[Limb]
- func (p ArrayModule[T]) Name() string
- func (p ArrayModule[T]) Row(id uint) Row[T]
- func (p ArrayModule[T]) String() string
- func (p ArrayModule[T]) Width() uint
- type ArrayRow
- type Limb
- type Module
- type Register
- type Row
- type Trace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalBinary ¶
MarshalBinary encodes a row-major trace into a binary format. Lengths, counts and descriptor metadata are encoded as unsigned varints. Row data is encoded row-major, using unsigned LEB128 for each word value.
func ToTrace ¶
ToTrace converts a row-major rtrace.Trace into a column-major trace.Trace. Each limb becomes one column, named following the register splitting convention: a register backed by a single limb keeps its own name, whilst the limbs of a subdivided register are named "reg'0", "reg'1", etc. Observe that key columns are not reconstructed (every module reports zero keys), and all columns are padded with zero.
Types ¶
type Array ¶
type Array[T any] struct { // contains filtered or unexported fields }
Array provides an implementation of Trace which stores rows as an array.
func FromTrace ¶
FromTrace converts a column-major trace.Trace into a row-major rtrace.Array. Each source column becomes one register, and each register is backed by one limb using the source column data bitwidth when available.
func NewArray ¶
func NewArray[T any](modules []ArrayModule[T]) *Array[T]
NewArray constructs a row-major trace from a given set of modules.
func ParallelReduce ¶
ParallelReduce behaves exactly like Reduce, combining a sequence of aligned traces into a single trace, but reduces each module of the result concurrently using one goroutine per module.
func Reduce ¶
Reduce combines a sequence of aligned traces into a single trace. Two traces are aligned when they have the same width and modules sharing a name also share the same module index and matching register (and hence limb) descriptors. For each module, the rows of every input trace are concatenated, in trace order, into the corresponding module of the result.
func (*Array[T]) HasModule ¶
HasModule determines whether this trace has a module with the given name and, if so, what its module index is.
func (*Array[T]) RawModule ¶
func (p *Array[T]) RawModule(module uint) *ArrayModule[T]
RawModule returns a specific module in this trace.
func (*Array[T]) UnmarshalBinary ¶
UnmarshalBinary decodes a row-major trace encoded by MarshalBinary.
type ArrayModule ¶
type ArrayModule[T any] struct { // contains filtered or unexported fields }
ArrayModule describes an individual module within a row-major trace.
func NewArrayModule ¶
func NewArrayModule[T any](name string, descriptor []Register, rows ...[]T) ArrayModule[T]
NewArrayModule constructs a module with the given name, descriptor and rows. This assigns final module-wide limb identifiers and register identifiers to the descriptor.
func (ArrayModule[T]) Descriptor ¶
func (p ArrayModule[T]) Descriptor() iter.Iterator[Register]
Descriptor returns the registers describing this module.
func (ArrayModule[T]) Height ¶
func (p ArrayModule[T]) Height() uint
Height returns the height of this module, meaning the number of assigned rows.
func (ArrayModule[T]) LimbAt ¶
func (p ArrayModule[T]) LimbAt(index uint) Limb
LimbAt returns the limb with the given index.
func (ArrayModule[T]) Limbs ¶
func (p ArrayModule[T]) Limbs() iter.Iterator[Limb]
Limbs returns the limbs describing this module.
func (ArrayModule[T]) Name ¶
func (p ArrayModule[T]) Name() string
Name returns the name of this module.
func (ArrayModule[T]) Row ¶
func (p ArrayModule[T]) Row(id uint) Row[T]
Row returns a specific row within this trace module.
func (ArrayModule[T]) String ¶
func (p ArrayModule[T]) String() string
func (ArrayModule[T]) Width ¶
func (p ArrayModule[T]) Width() uint
Width returns the number of columns in this module.
type ArrayRow ¶
type ArrayRow[T any] struct { // contains filtered or unexported fields }
ArrayRow describes an individual row of data within a row-major trace module.
func NewArrayRow ¶
NewArrayRow constructs a row from the given data.
type Limb ¶
type Limb interface {
// Limb identifier.
LimbId() uint
// Register identifier.
RegisterId() uint
// Limb bitwidth. If this is none, then the limb represents a field
// element.
Bitwidth() util.Option[uint]
}
Limb describes a subdivided register limb.
type Module ¶
type Module[T any] interface { // Module name. Name() string // Descriptor returns the registers describing the columns of this module. Descriptor() iter.Iterator[Register] // Limbs returns the limbs describing the columns of this module. Limbs() iter.Iterator[Limb] // LimbAt returns the limb with the given index. LimbAt(uint) Limb // Access a given row in this module. Row(uint) Row[T] // Returns the number of columns in this module. Width() uint // Returns the height of this module. Height() uint }
Module describes a module within the trace. Every module is composed of some number of rows, and has a specific width.
type Register ¶
type Register interface {
// Register name.
Name() string
// Register bitwidth. If this is none, then this represents a "native
// register" (i.e. one backed by field elements).
Bitwidth() util.Option[uint]
// Limbs returns the limbs backing this register.
Limbs() iter.Iterator[Limb]
}
Register describes an individual register in a row-major trace module.
func NewRegister ¶
NewRegister constructs a register with the given name and limb bitwidths. If no limb bitwidths are provided, the register is treated as native and has one limb without a fixed bitwidth. Otherwise, the register bitwidth is the sum of the given limb bitwidths.
type Row ¶
type Row[T any] interface { // Get the value in a given column of this row. Get(column uint) T // Returns the number of columns in this row. Width() uint }
Row describes an individual row of data within a trace table.
type Trace ¶
type Trace[T any] interface { // Determine whether this trace has a module with the given name and, if so, // what its module index is. HasModule(name string) (uint, bool) // Access a given module in this trace. Module(uint) Module[T] // Returns an iterator over the contained modules. Modules() iter.Iterator[Module[T]] // Returns the number of modules in this trace. Width() uint }
Trace describes a set of named modules whose data is organised by row.