a tensor of rank R in a reference frame, or a list of them
Syntax
T = tensor(M, cs)
The coefficients in a crystal frame.
T = tensor(M, cs, rank=2, name='strain', unit='%')
The rank, a name and a unit.
T = tensor(v)
A vector as a tensor of rank one.
T = tensor(rot)
A rotation as its matrix, rank two.
C = tensor(V, rank=4)
A 6 x 6 Voigt matrix.
S = tensor(V, rank=4, doubleConvention=True)
With the factors of two of the compliance.
C = tensor(V, rank=4, Kelvin=True)
A matrix in the Kelvin notation.
Description
The coefficients M are an array whose last R indices have dimension three, the dimensions
in front of them the shape of the list; the rank, when not given, is the number of trailing
dimensions of size three. A 6 x 6 matrix is read as the Voigt matrix of a rank four tensor,
a 3 x 6 matrix as that of a rank three one. Rotating the tensor, or an orientation acting on
it, ori * T, transforms the coefficients, which is what the texture averages build on.
The frame is a crystalFrame or a specimenFrame, given positionally or as frame=; without one the tensor is in the default specimen frame. T.M gives the coefficients back, T.rank, T.frame (T.CS) and T.isSymmetric what they say. The physical tensors, stiffnessTensor, complianceTensor, strainTensor, stressTensor, …, are subclasses fixing the rank and the Voigt convention.
Input
M |
array of the coefficients, (…, 3, …, 3), a Voigt matrix (…, 6, 6), a vector3d or a rotation |
cs |
crystalFrame or specimenFrame the coefficients refer to |
Keywords
| keyword | default | description |
|---|---|---|
rank |
the rank of the tensor, read from the shape of M when not given | |
doubleConvention |
read and write a Voigt matrix with the factors of two off the diagonal, as is usual for the compliance | |
frame |
the reference frame of the coefficients, instead of giving it positionally | |
density |
the mass density of the material, carried along (the wave velocities use it) | |
unit |
the physical unit of the coefficients, a string carried along | |
name |
the name of the tensor, carried along | |
Kelvin |
read a 6 x 6 matrix in the Kelvin (Mandel) notation | |
dtype |
the NumPy type of the coefficients |
Output
T |
tensor |
Properties
M |
full Cartesian coefficient array with rank trailing axes of length three |
rank |
number of tensor indices, independent of the number of tensors in a list |
frame |
reference frame of the coefficients |
CS |
alias for the tensor reference frame |
doubleConvention |
Voigt convention used for shear-component factors |
density |
material mass density, when provided |
unit |
physical unit label carried by the tensor |
name |
descriptive tensor label |
shape |
shape of the tensor list, excluding tensor-component axes |
See also
stiffnessTensor, strainTensor, stressTensor, tensor.rotate, TensorDefinition
Members
| antiSym | the antisymmetric part (T - T^t) / 2 of a rank two tensor |
| cat | the list of the tensors, MATLAB’s [T1, T2] |
| checkSymmetry | whether the tensor is invariant under every element of the group of its frame |
| colon | the double contraction A : B, the last two indices of A against the first two of B, MATLAB’s A:B |
| CS | the frame the tensor is written in, MATLAB’s T.CS |
| ctranspose | the transpose swaps the indices of a rank two and the pairs of a rank four |
| det | the determinant of a rank two tensor |
| directionalMagnitude | the magnitude of a tensor in the direction v, the tensor contracted with the unit direction on every index, T_i1…iR v_i1 .. |
| double | the coordinates of the images of an embedding in their orthonormal basis, one row per orientation, e.double() |
| eig | diagonalise rank-two tensors or rank-four tensors in Voigt notation |
| eigvals | the eigenvalues in ascending order, of a rank two tensor or of the Voigt matrix of a rank four |
| EinsteinSum | the contraction of tensors, vectors, rotations or arrays over the indices they share |
| eq | whether two tensors of one rank and shape agree coefficientwise within rtol and atol |
| expm | the matrix exponential of a rank two tensor, or of a rank four one through its Kelvin matrix, the class kept |
| export | write a map to the file the extension names |
| eye | the identity tensor, of rank two the unit matrix, of rank four the symmetric identity on rank two tensors |
| frame | the frame the tensor is written in, a crystal frame or the specimen frame |
| horzcat | the list of the tensors, MATLAB’s [T1, T2] |
| inv | the inverse: rank two by the matrix, rank four through the Voigt matrix, which swaps the convention and with it the class, a stiffness inverting to a compliance |
| isSkewSymmetric | whether every tensor equals minus its transpose, up to a relative 1e-6 |
| isSymmetric | whether every tensor of rank two or four equals its transpose, up to a relative 1e-6 |
| leviCivita | the Levi-Civita symbol, the rank three tensor of the signs of the permutations of (1, 2, 3) |
| load | stiffnessTensor.load(fname): the tensor of a file as the class it is called on |
| logm | the matrix logarithm of a rank two tensor, or of a rank four one through its Kelvin matrix, the class kept |
| M | the coefficients as an array of shape (…, 3, …, 3), the rank’s indices last |
| mean | the mean of a list of tensors, over all of them or along axes, weighted or not |
| minus | |
| mrdivide | |
| mtimes | scale a tensor, multiply rank-two tensors, or contract an elastic tensor with a strain |
| ne | Return self!=value |
| norm | the Frobenius norm of every tensor, over all its coefficients |
| normalize | the tensors divided by their Frobenius norms |
| ones | a tensor of ones of the rank of the class, or a list of them |
| plot | plot(x, …) draws x as its kind is drawn |
| plus | |
| polar | factor a rank-two tensor into an orthogonal part and symmetric stretch tensors |
| rand | a random tensor with the symmetries its class and frame ask for |
| rdivide | |
| rotate | the tensor turned by a rotation, an orthogonal transform or an orientation |
| sqrtm | the matrix square root of a rank two tensor, or of a rank four one through its Kelvin matrix, the class kept |
| subsref | |
| sum | the sum of a list of tensors, over all of them or along axes |
| svd | the singular value decomposition: of a rank two tensor the left singular vectors, the singular values from the largest and the right singular vectors, T v_k = s_k u_k |
| sym | symmetrise a tensor over permutations of its Cartesian indices |
| symmetrise | the mean over the group of the frame, and whether the tensor is invariant under it |
| T | the transpose, the indices of a rank two and the index pairs of a rank four swapped |
| tensor | a tensor of rank R in a reference frame, or a list of them |
| times | MATLAB’s .*: the product of corresponding coefficients, the rank kept |
| trace | the trace of a rank two tensor, or of the Voigt matrix of a rank four one |
| transformReferenceFrame | the same coefficients read in another frame, the numbers changed by the rigid part of the transition between the two bases |
| transpose | the transpose swaps the indices of a rank two and the pairs of a rank four |
| uminus | |
| vertcat | the list of the tensors, MATLAB’s [T1, T2] |
| Voigt | convert tensor coefficients to compact Voigt notation |
| zeros | a tensor of zeros of the rank of the class, or a list of them |
Used on
OrientationEmbeddings, TensorArithmetics, TensorDefinition, TensorVisualisation
MATLAB’s tensor_index
source
Citing this page.
This page is part of the documentation of
MTEX, a free and open
source MATLAB toolbox for analyzing and modeling crystallographic textures.
It was written by The MTEX Developers and is published at
https://mtex-toolbox.github.io/tensor_index_py.html.
If you use MTEX, or reuse text or figures from this page, in your research,
please cite
F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63
BibTeX
@article{bachmann2010mtex,
author = {F. Bachmann and R. Hielscher and H. Schaeben},
title = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
journal = {Solid State Phenomena},
volume = {160},
pages = {63-68},
year = {2010},
doi = {10.4028/www.scientific.net/SSP.160.63},
url = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}
Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.