Module validation

Module validation 

Source
Expand description

Contains functions and structs related to parsing an einsum-formatted string

This module has the implementation of Contraction and SizedContraction. SizedContraction is used throughout the library to store the details of a full contraction (corresponding to a string supplied by the caller) or a mini-contraction (corresponding to a simplification of a single tensor or a pairwise contraction between two tensors) produced by the optimizer in order to perform the full contraction.

Structsยง

Contraction
A Contraction contains the result of parsing an einsum-formatted string.
EinsumParse ๐Ÿ”’
The result of running an einsum-formatted string through the regex.
SizedContraction
A SizedContraction contains a Contraction as well as a HashMap<char, usize> specifying the axis lengths for each index in the contraction.

Traitsยง

OutputSizeMethods ๐Ÿ”’
Enables OutputSize::from_contraction_and_shapes()

Functionsยง

get_operand_shapes ๐Ÿ”’
Returns a vector holding one Vec<usize> for each operand.
parse_einsum_string ๐Ÿ”’
Runs an input string through a regex and convert it to an EinsumParse.
validate
Wrapper around Contraction::new().
validate_and_optimize_order
Create a SizedContraction and then optimize the order in which pairs of inputs will be contracted.
validate_and_size
Wrapper around SizedContraction::new().

Type Aliasesยง

OutputSize
Alias for HashMap<char, usize>. Contains the axis lengths for all indices in the contraction. Contrary to the name, does not only hold the sizes for output indices.