Numeric Tensor

class mechpy.core.numeric.tensor.Tensor(data)

Bases: object

Represents a general tensor object that encapsulates a NumPy array.

Attributes:

data (np.ndarray): The data stored in the tensor.

Methods:

is_symmetric: Check if the tensor is symmetric. is_second_rank: Check if the tensor is of second rank. is_fourth_rank: Check if the tensor is of fourth rank. is_3x3: Check if the tensor is a 3x3 matrix. is_6x6: Check if the tensor is a 6x6 matrix. is_3x3x3x3: Check if the tensor is a 3x3x3x3 matrix. to_3x3: Convert the tensor to a ThreeByThreeTensor. to_sym_3x3: Convert the tensor to a symmetric 3x3 tensor. to_6x6: Convert the tensor to a SixBySixTensor. from_list: Create a Tensor from a list of components.

is_symmetric()

Check if the tensor is symmetric.

Returns:

bool: True if the tensor is symmetric, False otherwise.

is_second_rank()
is_fourth_rank()
is_3x3()
is_6x6()
is_3x3x3x3()
to_3x3()
to_sym_3x3()
to_6x6()
classmethod from_list(components, shape, symmetric=False, mode=1)
class mechpy.core.numeric.tensor.ThreeByThreeTensor(data)

Bases: Tensor

shape = (3, 3)
classmethod from_list(components)
to_symmetric()
class mechpy.core.numeric.tensor.SixBySixTensor(data)

Bases: Tensor

shape = (6, 6)
classmethod from_list(components)
class mechpy.core.numeric.tensor.SymmetricThreeByThreeTensor(data)

Bases: Tensor

shape = (6, 1)
VOIGT_MAPPING = {(0, 0): 0, (0, 1): 5, (0, 2): 4, (1, 0): 5, (1, 1): 1, (1, 2): 3, (2, 0): 4, (2, 1): 3, (2, 2): 2}
INVERSE_VOIGT_MAPPING = {0: (0, 0), 1: (1, 1), 2: (2, 2), 3: (1, 2), 4: (0, 2), 5: (0, 1)}
is_symmetric()

Check if the tensor is symmetric.

Returns:

bool: True if the tensor is symmetric, False otherwise.

classmethod from_list(components)
to_general()
eigenvalues()