Skip to main content

Module tensor

Module tensor 

Source
Expand description

Tensor algebra operations for continuum mechanics.

Provides second-order tensors (Tensor2), fourth-order tensors (Tensor4), and a Voigt notation helper for symmetric second-order tensors.

Structs§

CpDecomposition
CP (CANDECOMP/PARAFAC) decomposition result.
DenseTensor
A dense tensor of arbitrary rank stored in row-major (C-order) layout.
KelvinTensor
Kelvin (Mandel) notation utilities for symmetric fourth-order tensors.
MandelNotation
Mandel notation for symmetric second-order tensors.
Tensor2
Second-order tensor (3×3 matrix) stored as row-major [[f64; 3]; 3].
Tensor3
Rank-3 tensor with 27 components stored as data[i][j][k].
Tensor4
Fourth-order tensor with 81 components stored as [i][j][k][l].
TensorBasis
Tensor basis transformation utilities.
TensorTrain
A tensor in Tensor Train (TT / MPS) format.
TtCore
A single Tensor Train core of shape (r_left, n, r_right).
TuckerDecomposition
Tucker decomposition result for a 3-way tensor.
VoigtTensor
Voigt notation utilities for symmetric 3×3 tensors.

Functions§

bilinear_form
Compute the bilinear form v^T A w for a Tensor2.
bulk_modulus
Compute the bulk modulus K from Lame parameters.
cauchy_stress_linear
Compute Cauchy stress from linear elasticity: sigma = C : epsilon.
compliance_from_stiffness
Compliance tensor from stiffness: S = C^{-1} in Voigt form (6×6 matrix inversion).
cp_als
Alternating Least Squares (ALS) for CP decomposition of a 3-way tensor.
cp_reconstruct
Reconstruct a DenseTensor from a CP decomposition.
cp_relative_error
Relative reconstruction error: ||T - T_approx||_F / ||T||_F.
einsum_2d
Einstein summation helper for common rank-2 tensor operations.
elasticity_stress
Compute the double inner product C :: T for a 4th-order elasticity tensor C and a symmetric second-order tensor T. Returns sigma_ij = C_ijkl T_kl.
eshelby_sphere
Build the Eshelby inclusion tensor for an isotropic matrix.
exp_tensor_pade
Approximate matrix exponential via Padé (2,2) approximation.
fourth_order_skew_identity
The 4th-order skew (antisymmetric) identity tensor: I^A_ijkl = (delta_ik delta_jl - delta_il delta_jk)/2.
fourth_order_symmetric_identity
The 4th-order symmetric identity tensor I^S_ijkl = (delta_ik delta_jl + delta_il delta_jk)/2.
general_einsum
Einstein summation over a pair of DenseTensors with explicit free and contracted indices.
hill_average
Hill average: arithmetic mean of Voigt and Reuss bounds.
invert_6x6
Invert a 6×6 matrix using Gauss–Jordan elimination.
is_symmetric_modes
Check whether a DenseTensor is symmetric under swap of two given modes.
lame_to_young_poisson
Compute the engineering Young’s modulus E and Poisson’s ratio nu from Lame parameters.
log_tensor_approx
Approximate matrix logarithm of a tensor close to identity: ln(I + X) ≈ X - X²/2 + X³/3.
neo_hookean_stiffness
Compute the 4th-order stiffness tensor for Neo-Hookean material at deformation F.
polar_decompose_right
Right polar decomposition of a non-singular 3×3 tensor F = R U.
quadratic_form
Compute the quadratic form v^T A v for a Tensor2.
reuss_average
Harmonic mean of two stiffness tensors (Reuss bound): C_Reuss = (C_a^{-1} + C_b^{-1})^{-1} / 2 (in Voigt/Kelvin form).
shear_modulus
Compute the shear modulus (= mu).
symmetrize_tensor
Build a fully symmetric DenseTensor by averaging over all permutations of indices (only for rank-2 and rank-3 tensors for now; rank-2 reduces to symmetrising a matrix).
tensor_contraction
Tensor contraction: contract modes mode_a of a and mode_b of b over their shared dimension.
tensor_outer
Compute the general outer product of two DenseTensors: result has rank = rank(a) + rank(b).
transversely_isotropic_stiffness
Build a transversely isotropic stiffness tensor given five elastic constants.
tucker_hosvd
Higher-order SVD (HOSVD) Tucker decomposition of a 3-way tensor.
tucker_reconstruct
Reconstruct a 3-way tensor from a Tucker decomposition.
vec_outer
Outer product of two 3-vectors: result_ij = a_i b_j (returns Tensor2).
voigt_average
Arithmetic mean of two stiffness tensors (Voigt bound): C_Voigt = (C_a + C_b) / 2.
young_poisson_to_lame
Compute Lame parameters from Young’s modulus E and Poisson’s ratio nu.