`tensor`

Syntax

- t := tensor(<m><,n2><,n3><,n4><,n5><,n6>)
Gets a new tensor type.

- How this is is created and initialize depends on the type (if any) passed as an argument
- If no types are passed, then a default tensor (all components zero) is created.
- If one to six numbers (integers or floats) are passed, then the tensor is initialized in the component order xx, yy, zz, xy, xz, yz.
- If a list is given, then up to the first six elements of the list are converted to floats and used to initialize the tensor components in the same order.
- If a matrix is given, then it must be a 3x3 matrix. It is made symmetric (diagonal elements averaged) and returned as a tensor.
- If a 3-D vector is given, then the diagonal components of the tensor (xx,yy,zz) are initialized the (x,y,z) components of the vector. The xy, xz, and yz components will be zero.
- If an array is given then, then how the array elements are converted to a tensor depends on the array size and dimension.
- A 3x3 array is converted to a tensor as a matrix, with the diagonal elements averaged.
- A 2x2 array is converted as a 2D tensor, with the xy elements averaged and the zz, xz, and yz components assumed to be zero.
- A 1D array 6 elements long is converted to a tensor in the order xx, yy, zz, xy, xz, yz.
- A 1D array 4 elements long is converted to a tensor in the order xx, yy, zz xy, with xz=0 and yz=0.
- A 1D array 3 elements long is converted to a tensor in the order xx, yy, xy with zz=0, xz=0, and yz=0.

Returns: t - A new tensor object Arguments: m - One of five types than can be used to create a new tensor type. n2 - An optional number representing the yy component. n3 - An optional number representing the zz component. n4 - An optional number representing the xy component. n5 - An optional number representing the xz component. n6 - An optional number representing the yz component.

Was this helpful? ... | FLAC3D © 2019, Itasca | Updated: May 17, 2022 |