Documentation ¶
Overview ¶
Package mtree provides advanced tools for encoding tree paths in a material format
Index ¶
- Constants
- func CommonPrefix(sep byte, paths ...string) string
- func ToPath(f *Fraction) string
- func ToPathUint(f *Fraction) []uint64
- type Float
- type Fraction
- type MPath
- type MPathProvider
- type Matrix
- type Nat
- type Rat
- type TreeNode
- func (t *TreeNode) Bytes() []byte
- func (t *TreeNode) DV() *big.Int
- func (t *TreeNode) GetMeta(name string, value interface{})
- func (t *TreeNode) NV() *big.Int
- func (t *TreeNode) Name() string
- func (t *TreeNode) SDV() *big.Int
- func (t *TreeNode) SNV() *big.Int
- func (t *TreeNode) SetBytes(b []byte)
- func (t *TreeNode) SetMPath(mpath ...uint64)
- func (t *TreeNode) SetMeta(name string, value interface{})
- func (t *TreeNode) SetName(name string)
- func (t *TreeNode) SetRat(rat *Rat)
Constants ¶
const PRECISION = 100
Variables ¶
This section is empty.
Functions ¶
func CommonPrefix ¶ added in v1.5.0
func ToPathUint ¶
Types ¶
type Fraction ¶
type Fraction struct {
// contains filtered or unexported fields
}
Fraction type
func NewFraction ¶
NewFraction from a numerator and denominator
func NewFractionFromMaterializedPath ¶
NewFractionFromMaterializedPath function
type MPath ¶
type MPath []uint64
MPath type struct
func NewMPathFromMPath ¶
NewMPathFromMPath returns a copy of a slice
type MPathProvider ¶
type MPathProvider interface { }
type Matrix ¶
func MoveSubtree ¶
type Nat ¶
An unsigned integer x of the form
x = x[n-1]*_B^(n-1) + x[n-2]*_B^(n-2) + ... + x[1]*_B + x[0]
with 0 <= x[i] < _B and 0 <= i < n is stored in a slice of length n, with the digits x[i] as the slice elements.
A number is normalized if the slice contains no leading 0 digits. During arithmetic operations, denormalized values may occur but are always normalized before returning the final result. The normalized representation of 0 is the empty or nil slice (length = 0).
type TreeNode ¶
TreeNode definition
func NewTreeNode ¶
func NewTreeNode() *TreeNode
NewTreeNode wraps a node with its rational equivalent of the mpath
func (*TreeNode) SetBytes ¶
SetBytes decodes the byte representation of the rat and applies it to the current node
func (*TreeNode) SetMPath ¶
SetMPath triggers the calculation of the rat representation and the sibling rat representation for the node