[][src]Module ndarray_einsum_beta::validation

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 Definitions

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.