53struct IsUnitMatrix : std::false_type {};
54template <
int RowsV_,
int ColsV_,
typename... UnitsT_>
55struct IsUnitMatrix<
TypeMatrixImpl<
MatrixSize<RowsV_, ColsV_>, std::tuple<UnitsT_...>>> : std::bool_constant<(AnyUnit<UnitsT_> && ...)> {};
58struct IsMatrixSize : std::false_type {};
59template <
int RowsV_,
int ColsV_>
60struct IsMatrixSize<
MatrixSize<RowsV_, ColsV_>> : std::true_type {};
78template <AnyMatrixSize MatrixSizeT_, ArithmeticValue ValueT_,
typename ImplementationT_>
88template <
template <
typename,
int,
int>
typename ValueMatrixT_>
91template <AnyValuesWrapper ValuesT_, AnyUnitMatrix UnitsT_>
104concept UpOrDown = std::same_as<T, Up> || std::same_as<T, Down>;
113template <AnyIndices IndicesT_, AnyQuantities QuantitiesT_, AnyCoordinateSystem CoordinateSystemT_, AbsoluteOrRelative AbsoluteT_>
144template <
template <
typename,
int,
int>
typename ValueMatrixT_,
typename ValueT_,
int RowsV_,
int ColsV_>
145using ImplementationOf =
typename ValueMatrixT_<ValueT_, RowsV_, ColsV_>::ImplementationT;
152template <
typename ResultT_,
typename TraitT_,
typename EvaluatedT_>
154 std::same_as<ResultT_, typename TraitT_::type> && std::same_as<typename Evaluate<AccessImplementation<ResultT_>>::type, EvaluatedT_> &&
155 std::move_constructible<ResultT_> &&
156 (std::same_as<ResultT_, EvaluatedT_> ||
157 (std::constructible_from<EvaluatedT_, ResultT_> && std::constructible_from<EvaluatedT_, const ResultT_&>));
160template <
typename ImplementationT_,
typename ArgsTupleT_>
161struct IsInitializable : std::false_type {};
162template <
typename ImplementationT_,
typename... ArgsT_>
164 Initialize<ImplementationT_, std::tuple<ArgsT_...>>::run(std::declval<ImplementationT_&>(), std::declval<ArgsT_>()...);
166struct IsInitializable<ImplementationT_, std::tuple<ArgsT_...>> : std::true_type {};
173template <
typename ImplementationT_,
typename ValueT_>
174concept BackendFloatingPointMatrix =
175 !std::floating_point<ValueT_> ||
requires(
const ImplementationT_& impl, ImplementationT_& target,
const ValueT_ value) {
179 } -> std::same_as<bool>;
184template <
typename ValueT_>
185struct IdentityFunction {
186 ValueT_ operator()(
const ValueT_ value)
const {
return value; }
193template <
typename ImplementationT_,
template <
typename,
int,
int>
typename ValueMatrixT_,
typename ValueT_,
int RowsV_,
int ColsV_>
194concept BackendMatrix =
198 std::default_initializable<ImplementationT_> && std::move_constructible<ImplementationT_> &&
199 requires(
const ImplementationT_& impl, ImplementationT_& target,
200 const ImplementationOf<ValueMatrixT_, ValueT_, ColsV_, RowsV_>& transposed,
const ValueT_ value,
const int index,
201 std::ostream& stream) {
203 requires IsInitializable<ImplementationT_, HomogeneousTuple<RowsV_ * ColsV_, ValueT_>>::value;
206 } -> TraitResult<Evaluate<AccessImplementation<ImplementationT_>>, ImplementationT_>;
207 requires std::same_as<typename Rebind<AccessImplementation<ImplementationT_>, ValueT_, RowsV_, ColsV_>::type, ImplementationT_>;
208 requires std::same_as<typename Rebind<AccessImplementation<ImplementationT_>, ValueT_, 1, 1>::type,
209 ImplementationOf<ValueMatrixT_, ValueT_, 1, 1>>;
218 } -> std::same_as<bool>;
223 requires std::same_as<
226 ValueT_, RowsV_, ColsV_>::type,
233 } -> TraitResult<Negation<AccessImplementation<ImplementationT_>>, ImplementationT_>;
235 Product<AccessImplementation<ImplementationT_>, ValueT_>::value(impl, value)
236 } -> TraitResult<Product<AccessImplementation<ImplementationT_>, ValueT_>, ImplementationT_>;
241 Division<AccessImplementation<ImplementationT_>, ValueT_>::value(impl, value)
242 } -> TraitResult<Division<AccessImplementation<ImplementationT_>, ValueT_>, ImplementationT_>;
248 } -> TraitResult<CwiseInverse<AccessImplementation<ImplementationT_>>, ImplementationT_>;
251 } -> TraitResult<CwiseFunction<AccessImplementation<ImplementationT_>, IdentityFunction<ValueT_>>, ImplementationT_>;
254 } -> TraitResult<Transpose<AccessImplementation<ImplementationT_>>, ImplementationOf<ValueMatrixT_, ValueT_, ColsV_, RowsV_>>;
257 } -> TraitResult<Block<AccessImplementation<ImplementationT_>, 0, 0, RowsV_, 1>, ImplementationOf<ValueMatrixT_, ValueT_, RowsV_, 1>>;
259 InnerProduct<AccessImplementation<ImplementationT_>,
261 } -> TraitResult<InnerProduct<AccessImplementation<ImplementationT_>,
263 ImplementationOf<ValueMatrixT_, ValueT_, RowsV_, RowsV_>>;
268 BackendFloatingPointMatrix<ImplementationT_, ValueT_>;
271template <
template <
typename,
int,
int>
typename ValueMatrixT_,
typename ValueT_,
int RowsV_,
int ColsV_>
272concept BackendMatrixOfSize =
274 BackendMatrix<ImplementationOf<ValueMatrixT_, ValueT_, RowsV_, ColsV_>, ValueMatrixT_, ValueT_, RowsV_, ColsV_>;
278template <
template <
typename,
int,
int>
typename ValueMatrixT_,
typename ValueT_>
279concept BackendVectorProducts =
280 requires(
const ImplementationOf<ValueMatrixT_, ValueT_, 3, 1>& vector,
const ImplementationOf<ValueMatrixT_, ValueT_, 1, 3>& covector) {
284 } -> TraitResult<CrossProduct<AccessImplementation<ImplementationOf<ValueMatrixT_, ValueT_, 3, 1>>,
286 ImplementationOf<ValueMatrixT_, ValueT_, 3, 1>>;
288 OuterProduct<AccessImplementation<ImplementationOf<ValueMatrixT_, ValueT_, 3, 1>>,
290 } -> TraitResult<OuterProduct<AccessImplementation<ImplementationOf<ValueMatrixT_, ValueT_, 3, 1>>,
292 ImplementationOf<ValueMatrixT_, ValueT_, 3, 3>>;
296template <
template <
typename,
int,
int>
typename ValueMatrixT_,
typename ValueT_>
297concept BackendValues = BackendMatrixOfSize<ValueMatrixT_, ValueT_, 1, 1> && BackendMatrixOfSize<ValueMatrixT_, ValueT_, 3, 1> &&
298 BackendMatrixOfSize<ValueMatrixT_, ValueT_, 1, 3> && BackendMatrixOfSize<ValueMatrixT_, ValueT_, 3, 3> &&
299 BackendVectorProducts<ValueMatrixT_, ValueT_>;
302template <
template <
typename,
int,
int>
typename ValueMatrixT_,
typename ValueT_,
int DimensionV_>
303concept BackendInverse =
requires(
const ImplementationOf<ValueMatrixT_, ValueT_, DimensionV_, DimensionV_>& impl) {
306 } -> TraitResult<Inverse<AccessImplementation<ImplementationOf<ValueMatrixT_, ValueT_, DimensionV_, DimensionV_>>>,
307 ImplementationOf<ValueMatrixT_, ValueT_, DimensionV_, DimensionV_>>;
311template <
template <
typename,
int,
int>
typename ValueMatrixT_,
typename ValueT_,
int DimensionV_>
312concept BackendDeterminant =
requires(
const ImplementationOf<ValueMatrixT_, ValueT_, DimensionV_, DimensionV_>& impl) {
315 } -> std::same_as<ValueT_>;
337template <
template <
typename,
int,
int>
typename ValueMatrixT_>
345template <
template <
typename,
int,
int>
typename ValueMatrixT_>
348 internal::BackendInverse<ValueMatrixT_, double, 3> && internal::BackendDeterminant<ValueMatrixT_, double, 1> &&
349 internal::BackendDeterminant<ValueMatrixT_, double, 3> && internal::BackendDeterminant<ValueMatrixT_, int, 1> &&
350 internal::BackendDeterminant<ValueMatrixT_, int, 3>;
355template <
typename LhsT_,
typename RhsT_>
356using UnitProduct =
typename Product<LhsT_, RhsT_>::type;
359template <
typename LhsT_,
typename RhsT_>
360using UnitQuotient =
typename Division<LhsT_, RhsT_>::type;
363template <
typename UnitsT_>
364concept ConsistentUnits =
371 std::same_as<typename UnitsT_::Angle, typename UnitsT_::Dimensionless> &&
372 std::same_as<typename Identity<typename UnitsT_::Length>::type,
typename UnitsT_::Dimensionless> &&
373 std::same_as<typename Power<typename UnitsT_::Length, Integer<2>>::type,
typename UnitsT_::Area> &&
375 std::same_as<typename Power<typename UnitsT_::Area, Rational<1, 2>>::type,
typename UnitsT_::Length> &&
376 std::same_as<UnitProduct<typename UnitsT_::Area, typename UnitsT_::Length>,
typename UnitsT_::Volume> &&
377 std::same_as<UnitQuotient<typename UnitsT_::Length, typename UnitsT_::Time>,
typename UnitsT_::Velocity> &&
378 std::same_as<UnitQuotient<typename UnitsT_::Velocity, typename UnitsT_::Time>,
typename UnitsT_::Acceleration> &&
379 std::same_as<typename Inverse<typename UnitsT_::Time>::type,
typename UnitsT_::Frequency> &&
380 std::same_as<UnitQuotient<typename UnitsT_::Angle, typename UnitsT_::Time>,
typename UnitsT_::AngularVelocity> &&
381 std::same_as<UnitQuotient<typename UnitsT_::AngularVelocity, typename UnitsT_::Time>,
typename UnitsT_::AngularAcceleration> &&
385 std::same_as<UnitProduct<typename UnitsT_::AngularVelocity, typename UnitsT_::Length>,
typename UnitsT_::Velocity> &&
386 std::same_as<UnitProduct<typename UnitsT_::AngularAcceleration, typename UnitsT_::Length>,
typename UnitsT_::Acceleration> &&
387 std::same_as<UnitProduct<typename UnitsT_::AngularVelocity, typename UnitsT_::Velocity>,
typename UnitsT_::Acceleration> &&
388 std::same_as<UnitProduct<typename UnitsT_::AngularVelocity, typename UnitsT_::AngularVelocity>,
389 typename UnitsT_::AngularAcceleration> &&
390 std::same_as<UnitProduct<typename UnitsT_::Mass, typename UnitsT_::Acceleration>,
typename UnitsT_::Force> &&
391 std::same_as<UnitProduct<typename UnitsT_::Force, typename UnitsT_::Length>,
typename UnitsT_::Energy> &&
393 std::same_as<UnitProduct<typename UnitsT_::Length, typename UnitsT_::Force>,
typename UnitsT_::Torque> &&
394 std::same_as<typename UnitsT_::Torque, typename UnitsT_::Energy>;
408template <
typename UnitsT_>
410 typename UnitsT_::Dimensionless;
411 typename UnitsT_::Angle;
412 typename UnitsT_::Length;
413 typename UnitsT_::Mass;
414 typename UnitsT_::Time;
415 typename UnitsT_::Area;
416 typename UnitsT_::Volume;
417 typename UnitsT_::Velocity;
418 typename UnitsT_::Acceleration;
419 typename UnitsT_::Frequency;
420 typename UnitsT_::AngularVelocity;
421 typename UnitsT_::AngularAcceleration;
422 typename UnitsT_::Force;
423 typename UnitsT_::Energy;
424 typename UnitsT_::Torque;
425} && internal::ConsistentUnits<UnitsT_>;
Container to store quantities.
A tensor of rank 0, 1 or 2, whose components are quantities, expressed in a coordinate system,...
Wrapper for the actual implementation of a value container.
Absolute or Relative: whether a tensor is a point or a vector.
Any coordinate system: a specialization of CoordinateSystem, including the intermediate ones of trans...
Any indices of a tensor: a specialization of Indices, e.g. Indices<Up, Down>.
Any size of a matrix: a MatrixSize with rows and columns.
Any quantity matrix: a specialization of Quantities, including Quantity.
Any tensor: a specialization of Tensor, including points, vectors and their aliases.
Any unit matrix: a TypeMatrix of units.
Any unit of any units backend: a specialization of Unit.
The alias template ValueMatrix<ValueT_, RowsV_, ColsV_> of any value matrix backend,...
Any value matrix: a specialization of ValuesWrapper.
An arithmetic type, e.g. int, float or double: the type of the elements of value matrices.
A coordinate system with the Euclidean metric, the default, e.g. CoordinateSystem<World>: the coordin...
A value matrix backend that also provides the matrix inverse (Inverse) of floating point matrices,...
A coordinate system with the Minkowski metric, e.g. CoordinateSystem<Spacetime, Minkowski>: an inerti...
The units of a units backend, e.g. AccessUnits<AccessImplementation<double>>: the base and derived un...
Up or Down: whether an index of a tensor is upper (contravariant) or lower (covariant).
A value matrix backend, given as its alias template ValueMatrix<ValueT_, RowsV_, ColsV_>,...
Type wrapper which is used to access traits partially specialized in the implementation header files.
Element access of a matrix of a value matrix backend: get(impl, row, col) returns an element,...
Copies a matrix of a value matrix backend: value returns the copy, which must not share its values wi...
A function applied to every element of a matrix, like Eigen's DenseBase::unaryExpr(): value(impl,...
The elementwise reciprocal of a matrix, like Eigen's ArrayBase::inverse() or cwiseInverse().
A lower, or covariant, index, e.g. of a covector w_i, whose components transform with the inverse of ...
The Euclidean metric delta_ij of a coordinate system with orthonormal axes, e.g. of space in Cartesia...
The indices of a tensor, in their order, e.g. Indices<Up, Down> for a linear map T^i_j,...
Initializes an allocated matrix of a value matrix backend with its elements, row by row: run(impl,...
The inverse: the matrix inverse of a matrix, like Eigen's MatrixBase::inverse(), and the reciprocal o...
Whether T is a specialization of Template.
The Minkowski metric eta = diag(1, -1, ..., -1) of an inertial frame of special relativity,...
Moves a matrix of a value matrix backend: construct returns the moved matrix, assign moves it into an...
The negation is performed elementwise.
The evaluated type of another value type and size, of the same backend as T: e.g. the 1x1 values of a...
Allocates a default constructed matrix of a value matrix backend for the size MatrixSizeT_: run(impl)...
A matrix of the types in the std::tuple Types, row by row, of the size MatrixSizeT_,...
An upper, or contravariant, index, e.g. of a vector v^i, whose components transform like the coordina...