opensrdk_symbolic_computation/expression/tensor_expression/
assign.rs1use super::operations::{DirectProduct, DotProduct};
2use crate::{ConstantValue, Expression, TensorExpression};
3use std::collections::HashMap;
4
5impl TensorExpression {
6 pub fn assign(self, variables: &HashMap<&str, ConstantValue>) -> Expression {
7 match self {
8 TensorExpression::KroneckerDeltas(_) => self.into(),
9 TensorExpression::DotProduct {
10 terms,
11 rank_combinations,
12 } => terms
13 .into_iter()
14 .map(|t| t.assign(variables))
15 .dot_product(&rank_combinations),
16 TensorExpression::DirectProduct(terms) => terms
17 .into_iter()
18 .map(|t| t.assign(variables))
19 .direct_product(),
20 }
21 }
22}