|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Cross-platform SIMD foundation built on the DrJit library. More...
#include <momentum/common/exception.h>#include <momentum/math/transform.h>#include <drjit/array.h>#include <drjit/array_router.h>#include <drjit/matrix.h>#include <drjit/packet.h>#include <drjit/util.h>#include <Eigen/Core>#include <Eigen/Geometry>Go to the source code of this file.
Namespaces | |
| namespace | momentum |
Macros | |
| #define | DRJIT_VERSION_GE(major, minor, patch) |
| Checks if DrJit version is greater than or equal to the specified version. | |
Typedefs | |
| template<typename T> | |
| using | momentum::Packet = drjit::Packet<T, kSimdPacketSize> |
| A fixed-size SIMD packet of kSimdPacketSize elements of type T. | |
| template<typename T, int Dim> | |
| using | momentum::VectorP = drjit::Array<Packet<T>, Dim> |
| A Dim-dimensional vector where each component is a SIMD packet. | |
| template<typename T> | |
| using | momentum::Vector2P = VectorP<T, 2> |
| template<typename T> | |
| using | momentum::Vector3P = VectorP<T, 3> |
| using | momentum::ByteP = Packet<uint8_t> |
| using | momentum::UintP = Packet<uint32_t> |
| using | momentum::Vector2iP = drjit::Array<IntP, 2> |
| Integer and byte vector types. | |
| using | momentum::Vector3iP = drjit::Array<IntP, 3> |
| using | momentum::Vector3bP = drjit::Array<ByteP, 3> |
| template<typename T> | |
| using | momentum::Vector4P = VectorP<T, 4> |
| 4D vector types. | |
| using | momentum::Vector4fP = Vector4P<float> |
| using | momentum::Vector4dP = Vector4P<double> |
| template<typename T, int Dim> | |
| using | momentum::MatrixP = drjit::Matrix<Packet<T>, Dim> |
| Matrix types for SIMD packets. | |
| template<typename T> | |
| using | momentum::Matrix3P = MatrixP<T, 3> |
| template<typename T> | |
| using | momentum::Matrix4P = MatrixP<T, 4> |
| using | momentum::Matrix3fP = Matrix3P<float> |
| using | momentum::Matrix3dP = Matrix3P<double> |
| using | momentum::Matrix4fP = Matrix4P<float> |
| using | momentum::Matrix4dP = Matrix4P<double> |
Scalar packet aliases | |
| using | momentum::FloatP = Packet<float> |
| using | momentum::DoubleP = Packet<double> |
| using | momentum::IntP = Packet<int> |
Float and double 2D/3D vector packet aliases | |
| using | momentum::Vector2fP = Vector2P<float> |
| using | momentum::Vector3fP = Vector3P<float> |
| using | momentum::Vector2dP = Vector2P<double> |
| using | momentum::Vector3dP = Vector3P<double> |
Functions | |
| template<size_t Alignment> | |
| size_t | momentum::computeOffset (const Eigen::Ref< Eigen::MatrixXf > &mat) |
| Computes the offset required for the matrix data to meet the alignment requirement. | |
| template<size_t Alignment> | |
| void | momentum::checkAlignment (const Eigen::Ref< Eigen::MatrixXf > &mat, size_t offset=0) |
| Checks if the data of the matrix is aligned correctly. | |
Eigen / DrJit interop operators | |
Mixed-type arithmetic between scalar Eigen types (Vector3f, Matrix3f, Quaternionf, Transform) and DrJit packet types (Vector3fP). The core pattern for SIMD error function evaluation: a single joint transform (scalar Eigen) is applied to N constraint positions (DrJit packet) simultaneously. For example, computing N position residuals: | |
| template<typename Derived, typename S> | |
| FloatP | momentum::dot (const Eigen::MatrixBase< Derived > &v1, const Vector3P< S > &v2) |
| Computes dot product of Eigen::Vector3f and 3-vector of packets. | |
| template<typename Derived, typename S> | |
| FloatP | momentum::dot (const Vector3P< S > &v1, const Eigen::MatrixBase< Derived > &v2) |
| Computes dot product of Vector3P and Eigen::Vector3f. | |
| template<typename S, typename Derived> | |
| Vector3P< S > | momentum::operator+ (const Eigen::MatrixBase< Derived > &v1, const Vector3P< S > &v2) |
| Adds Eigen::Vector3f and Vector3P element-wise. | |
| template<typename S, typename Derived> | |
| Vector3P< S > | momentum::operator+ (const Vector3P< S > &v1, const Eigen::MatrixBase< Derived > &v2) |
| Adds Vector3P and Eigen::Vector3f element-wise. | |
| template<typename S, typename Derived> | |
| Vector3P< S > | momentum::operator- (const Eigen::MatrixBase< Derived > &v1, const Vector3P< S > &v2) |
| Subtracts Vector3P from Eigen::Vector3f element-wise. | |
| template<typename S, typename Derived> | |
| Vector3P< S > | momentum::operator- (const Vector3P< S > &v1, const Eigen::MatrixBase< Derived > &v2) |
| Subtracts Eigen::Vector3f from Vector3P element-wise. | |
| template<typename S> | |
| Vector3P< S > | momentum::operator* (const Eigen::Quaternion< S > &q, const Vector3P< S > &vec) |
| Applies quaternion rotation to each 3x1 vector in packet. | |
| template<typename S, typename Derived> | |
| Vector3P< S > | momentum::operator* (const Eigen::MatrixBase< Derived > &xf, const Vector3P< S > &vec) |
| Applies 3x3 matrix transformation to each 3x1 vector in packet. | |
| template<typename S> | |
| Vector3P< S > | momentum::operator* (const Eigen::Transform< S, 3, Eigen::Affine > &xf, const Vector3P< S > &vec) |
| Applies affine transformation to each 3x1 vector in packet. | |
| template<typename S> | |
| Vector3P< S > | momentum::operator* (const TransformT< S > &xf, const Vector3P< S > &vec) |
| Applies momentum::Transform to each 3x1 vector in packet. | |
| template<typename S, typename Derived> | |
| Vector3P< S > | momentum::cross (const Eigen::MatrixBase< Derived > &v1, const Vector3P< S > &v2) |
| Computes cross product of Eigen::Vector3f and Vector3P. | |
| template<typename S, typename Derived> | |
| Vector3P< S > | momentum::cross (const Vector3P< S > &v1, const Eigen::MatrixBase< Derived > &v2) |
| Computes cross product of Vector3P and Eigen::Vector3f. | |
Variables | |
| constexpr size_t | momentum::kSimdPacketSize = drjit::DefaultSize |
| Number of floats in the platform's default SIMD register, chosen at compile time by DrJit based on available instruction sets (4 on SSE/NEON, 8 on AVX). | |
| constexpr size_t | momentum::kSimdAlignment = kSimdPacketSize * sizeof(float) |
| Byte alignment required for the platform's default SIMD loads/stores. | |
Cross-platform SIMD foundation built on the DrJit library.
Provides fixed-width SIMD packet types and overloaded operators for interoperating between Eigen vectors/matrices/transforms and DrJit SIMD packets.
Packet sizes by target instruction set:
Key types:
Used by the SIMD error functions in character_solver_simd/ and by the rasterizer.
Definition in file simd.h.
| #define DRJIT_VERSION_GE | ( | major, | |
| minor, | |||
| patch ) |
Checks if DrJit version is greater than or equal to the specified version.
| major | Major version number |
| minor | Minor version number |
| patch | Patch version number |