A tensor of rank 0, 1 or 2, whose components are quantities, expressed in a coordinate system, e.g. a vector, a covector, a linear map or a mass matrix.
More...
|
| | Tensor ()=default |
template<typename T0, typename... Ts>
requires (!IsSpecialization<T0, Tag>::value && !CopiesOrMoves<Tensor, T0, Ts...>) |
| | explicit (!IsValidConversion< ThisT, std::remove_cvref_t< T0 >, std::remove_cvref_t< Ts >... >::value) Tensor(T0 &&t0 |
| Ts Ts | std::forward (t0) |
| Ts Ts | std::forward (ts)...) |
| template<typename ValuesOtherT_, typename UnitsOtherT_> |
| void | setQuantities (const Quantities< ValuesOtherT_, UnitsOtherT_ > &component) |
| const QuantitiesT & | getQuantities () const & |
| QuantitiesT | getQuantities () && |
| | The quantities of a temporary are moved out of it, which avoids a copy and does not refer to the destroyed temporary.
|
| template<typename ValuesOtherT_> |
| void | setValues (const ValuesOtherT_ &values) |
| const ValuesT & | getValues () const & |
| ValuesT | getValues () && |
| template<typename IndicesOtherT_, typename QuantitiesOtherT_, typename CoordinateSystemOtherT_, typename AbsoluteOtherT_> |
| bool | isApprox (const Tensor< IndicesOtherT_, QuantitiesOtherT_, CoordinateSystemOtherT_, AbsoluteOtherT_ > &other, const ValueT precision=Precision< ValueT >::value()) const |
| | Whether the components of both tensors, which must have the same indices, coordinate system and absoluteness, are approximately equal, relatively, like Eigen's isApprox (https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#ae8443357b808cd393be1b51974213f9c): ||a - b|| <= precision * min(||a||, ||b||), in the Frobenius norm of the values, with every value matrix backend.
|
| auto | getQuantity () const |
| template<int RowIdV_, int ColIdV_> |
| auto | getQuantity () const |
template<int IdV_>
requires (Dimension<ThisT>::value <= 1 || internal::isBatch<IndicesT, QuantitiesT>) |
| auto | getQuantity () const |
| | The component with the single index IdV_ of a vector, a point or a covector, e.g. velocity.getQuantity<1>() for v^1 of a vector or a point, or w_1 of a covector: the row of a vector, a column, and the column of a covector, a row.
|
| auto | getQuantity (const int rowId, const int colId) const |
| auto | getQuantity (const int id) const |
| | The component with the single index id of a vector, a point or a covector, like getQuantity<IdV_>(), but with an index known at run time, which, like getQuantity(rowId, colId), requires all components to have the same unit.
|
template<typename QuantityT_>
requires (Dimension<ThisT>::value == 0) |
| void | setQuantity (const QuantityT_ &quantity) |
| template<int RowIdV_, int ColIdV_, typename QuantityT_> |
| void | setQuantity (const QuantityT_ &quantity) |
template<int IdV_, typename QuantityT_>
requires (Dimension<ThisT>::value <= 1 || internal::isBatch<IndicesT, QuantitiesT>) |
| void | setQuantity (const QuantityT_ &quantity) |
| | Sets the component with the single index IdV_ of a vector, a point or a covector, e.g. velocity.setQuantity<1>(speed) (see getQuantity<IdV_>()), like setQuantity<RowIdV_, ColIdV_>(), which checks the index and the unit at compile time.
|
| template<typename QuantityT_> |
| void | setQuantity (const int rowId, const int colId, const QuantityT_ &quantity) |
template<typename QuantityT_>
requires (Dimension<ThisT>::value <= 1 || internal::isBatch<IndicesT, QuantitiesT>) |
| void | setQuantity (const int id, const QuantityT_ &quantity) |
| | Sets the component with the single index id of a vector, a point or a covector, like setQuantity<IdV_>(), but with an index known at run time, which, like setQuantity(rowId, colId, quantity), requires all components to have the same unit.
|
| template<int BlockRowIdV_, int BlockColIdV_, int BlockRowsV_, int BlockColsV_> |
| auto | block () const |
| auto | transpose () const |
| | The transpose of the matrix of the components: a vector becomes a covector and vice versa, and the indices of a tensor of rank 2 are swapped, e.g. a linear map T^i_j becomes (T^T)_j^i (see Transpose<Indices<...>>).
|
| template<typename IndicesOtherT_, typename QuantitiesOtherT_, typename CoordinateSystemOtherT_, typename AbsoluteOtherT_> |
| auto | innerProduct (const Tensor< IndicesOtherT_, QuantitiesOtherT_, CoordinateSystemOtherT_, AbsoluteOtherT_ > &other) const |
| | The inner product, see innerProduct().
|
| template<typename IndicesOtherT_, typename QuantitiesOtherT_, typename CoordinateSystemOtherT_, typename AbsoluteOtherT_> |
| auto | dotProduct (const Tensor< IndicesOtherT_, QuantitiesOtherT_, CoordinateSystemOtherT_, AbsoluteOtherT_ > &other) const |
| | The dot product sum_i v_i w_i of two vectors in the same coordinate system, which must be Euclidean: it is the product with the Euclidean metric delta_ij in an orthonormal basis (see Metric).
|
| template<typename IndicesOtherT_, typename QuantitiesOtherT_, typename CoordinateSystemOtherT_, typename AbsoluteOtherT_> |
| auto | crossProduct (const Tensor< IndicesOtherT_, QuantitiesOtherT_, CoordinateSystemOtherT_, AbsoluteOtherT_ > &other) const |
| | The cross product a x b of two three-dimensional vectors in the same Euclidean coordinate system (see Metric), e.g. the torque r x F or the velocity w x r of a point of a rotating body.
|
| auto | inverse () const |
| | The matrix inverse of a tensor of rank 0 or 2, like Eigen's MatrixBase::inverse(): e.g. the inverse of a linear map T^i_j is a linear map, and the inverse of a metric g_ij, or of a mass matrix M_ij, has two upper indices, g^ij (see Inverse<Indices<...>>).
|
| auto | cwiseInverse () const |
| | The elementwise reciprocal of the components, like Eigen's ArrayBase::inverse().
|
| auto | norm () const |
| auto | squaredNorm () const |
| auto | determinant () const |
| | The determinant of a tensor of rank 0 or of a mixed tensor of rank 2, e.g. a linear map T^i_j, which is invariant.
|
| auto | hyperdeterminant () const |
| | Not implemented. The return type is deduced, so that the message is the first error (see FailOnInstantiation).
|
| auto | evaluate () const & |
| auto | evaluate () && |
template<AnyIndices IndicesT_, AnyQuantities QuantitiesT_, AnyCoordinateSystem CoordinateSystemT_, AbsoluteOrRelative AbsoluteT_>
class wuzp::Tensor< IndicesT_, QuantitiesT_, CoordinateSystemT_, AbsoluteT_ >
A tensor of rank 0, 1 or 2, whose components are quantities, expressed in a coordinate system, e.g. a vector, a covector, a linear map or a mass matrix.
- Template Parameters
-
| IndicesT_ | The indices, e.g. Indices<Up> for a vector or Indices<Down, Down> for a mass matrix (see Indices). |
| QuantitiesT_ | The components, a matrix with the first index as the row: a 1x1 matrix for rank 0, a column for a vector, a row for a covector, a square matrix for rank 2. A tensor with an upper index may also store a batch of vectors or points, one per column, e.g. a point cloud. |
| CoordinateSystemT_ | The coordinate system that the components are expressed in. Its metric, Euclidean by default, decides whether dotProduct, norm, squaredNorm, crossProduct and the transpose of a vector or a covector are defined (see Metric). |
| AbsoluteT_ | Absolute for points, Relative for vectors and all other tensors (see Absolute.hpp). Only a tensor with one upper index, a vector or a batch of vectors, can be absolute: the components of a point are those of the vector from the origin of the coordinate system to it. An absolute scalar, e.g. a time point or a temperature on the Celsius scale, is a point in a one-dimensional coordinate system whose origin is its zero, e.g. an epoch or the ice point, like the Celsius temperature t = T - T0 of the SI Brochure, section 2.3.1 (https://www.bipm.org/en/publications/si-brochure) (see TimePoint). |
Definition at line 99 of file Tensor.hpp.
template<AnyIndices IndicesT_, AnyQuantities QuantitiesT_, AnyCoordinateSystem CoordinateSystemT_, AbsoluteOrRelative AbsoluteT_>
template<typename IndicesOtherT_, typename QuantitiesOtherT_, typename CoordinateSystemOtherT_, typename AbsoluteOtherT_>
| auto wuzp::Tensor< IndicesT_, QuantitiesT_, CoordinateSystemT_, AbsoluteT_ >::crossProduct |
( |
const Tensor< IndicesOtherT_, QuantitiesOtherT_, CoordinateSystemOtherT_, AbsoluteOtherT_ > & | other | ) |
const |
|
inline |
The cross product a x b of two three-dimensional vectors in the same Euclidean coordinate system (see Metric), e.g. the torque r x F or the velocity w x r of a point of a rotating body.
It is a pseudovector, a covector density, which changes its sign under parity (Carroll, Lecture Notes on General Relativity, https://arxiv.org/abs/gr-qc/9712019, eq. 1.90): a linear transformation M maps it to (M a) x (M b) = det(M) M^-T (a x b) (https://en.wikipedia.org/wiki/Cross_product#Algebraic_properties), which is M (a x b) only for proper rotations, det(M) = 1 and M^-T = M, which the rotations guarantee (see ActiveSpatialRotation). A reflection flips its sign, and a linear transformation that is not a rotation, e.g. a scaling or a shear, does not transform it like a vector: compute the cross product of the transformed vectors instead of transforming the cross product. The result is typed as a vector, which is only right in right-handed orthonormal bases under proper rotations (see "Cross product" in DESIGN.md).
Definition at line 297 of file Tensor.hpp.