NEML2 2.0.0
Loading...
Searching...
No Matches
Rot Class Reference

Rotation stored as modified Rodrigues parameters. More...

Detailed Description

Rotation stored as modified Rodrigues parameters.

The storage space is (3).

One way to define this convention is that the three parameters are the values of the vector n tan(theta/4) where n is the rotation axis and theta the rotation angle.

Note this is different from the standard Rodrigues parameters, which are defined by n tan(theta/2)

#include <Rot.h>

Inheritance diagram for Rot:

Public Member Functions

R2 euler_rodrigues () const
 Generate a rotation matrix using the Euler-Rodrigues formula.
 
R3 deuler_rodrigues () const
 d(R2)/d(r) – useful in constructing other derivatives
 
Rot rotate (const Rot &r) const
 Rotate.
 
R2 drotate (const Rot &r) const
 Derivative of the rotated Rodrigues vector w.r.t. the other Rodrigues vector.
 
R2 drotate_self (const Rot &r) const
 Derivative of the rotated Rodrigues vector w.r.t. this vector.
 
Rot shadow () const
 Return the shadow parameter set (a set of MRPs that define the same orientation)
 
R2 dshadow () const
 Return the derivative of the shadow map.
 
Scalar dist (const Rot &r) const
 Distance measure between two rotations, accounting for shadow mapping.
 
Scalar gdist (const Rot &r) const
 Raw distance formula, not accounting for shadown mapping.
 
Scalar dV () const
 Volume element at locations.
 
- Public Member Functions inherited from VecBase< Rot >
Rot rotate (const Rot &r) const
 Rotate using a Rodrigues vector.
 
Rot rotate (const R2 &R) const
 Rotate using a rotation matrix.
 
R2 drotate (const Rot &r) const
 Derivative of the rotated vector w.r.t. the Rodrigues vector.
 
R3 drotate (const R2 &R) const
 Derivative of the rotated vector w.r.t. the rotation matrix.
 
- Public Member Functions inherited from PrimitiveTensor< Rot, 3 >
 PrimitiveTensor ()=default
 Special member functions.
 
 PrimitiveTensor (const ATensor &tensor, Size intmd_dim)
 Construct from an ATensor and infer dynamic shape.
 
 PrimitiveTensor (const ATensor &tensor, Size dynamic_dim, Size intmd_dim)
 Construct from an ATensor and extract dynamic shape given dynamic dimension.
 
 PrimitiveTensor (const ATensor &tensor, const TraceableTensorShape &dynamic_shape, Size intmd_dim)
 Construct from an ATensor given dynamic shape.
 
 PrimitiveTensor (const TensorBase< Derived2 > &tensor)
 Copy constructor.
 
 operator neml2::Tensor () const
 Implicit conversion to a Tensor (discards information on the fixed base shape)
 
Scalar operator() (Args... i) const
 Single-element accessor.
 
- Public Member Functions inherited from TensorBase< Rot >
 TensorBase ()=default
 Default constructor.
 
 TensorBase (const ATensor &tensor, Size dynamic_dim, Size intmd_dim)
 Construct from an ATensor with given dynamic dimension.
 
 TensorBase (const ATensor &tensor, TraceableTensorShape dynamic_shape, Size intmd_dim)
 Construct from an ATensor with given dynamic shape.
 
 TensorBase (const TensorBase< Derived2 > &tensor)
 Copy constructor.
 
 TensorBase (double)=delete
 
 TensorBase (float)=delete
 
 TensorBase (int)=delete
 
Rot variable_data () const
 Variable data without function graph.
 
Rot contiguous () const
 
Rot clone () const
 Clone (take ownership)
 
Rot detach () const
 Discard function graph.
 
Rot to (const TensorOptions &options) const
 Change tensor options.
 
Rot operator- () const
 Negation.
 
Size batch_dim () const
 
Size base_dim () const
 
Size dynamic_dim () const
 
Size static_dim () const
 
Size intmd_dim () const
 
TraceableTensorShape batch_sizes () const
 
TensorShapeRef base_sizes () const
 
const TraceableTensorShapedynamic_sizes () const
 
TensorShapeRef static_sizes () const
 
TensorShapeRef intmd_sizes () const
 
TraceableSize batch_size (Size i) const
 
Size base_size (Size i) const
 
const TraceableSizedynamic_size (Size i) const
 
Size static_size (Size i) const
 
Size intmd_size (Size i) const
 
Rot dynamic_index (indexing::TensorIndicesRef indices) const
 
Rot intmd_index (indexing::TensorIndicesRef indices) const
 
neml2::Tensor base_index (indexing::TensorIndicesRef indices) const
 
Rot dynamic_slice (Size d, const indexing::Slice &index) const
 
Rot intmd_slice (Size d, const indexing::Slice &index) const
 
neml2::Tensor base_slice (Size d, const indexing::Slice &index) const
 
void dynamic_index_put_ (indexing::TensorIndicesRef indices, const ATensor &other)
 
void dynamic_index_put_ (indexing::TensorIndicesRef indices, const CScalar &v)
 
void intmd_index_put_ (indexing::TensorIndicesRef indices, const ATensor &other)
 
void intmd_index_put_ (indexing::TensorIndicesRef indices, const CScalar &v)
 
void base_index_put_ (indexing::TensorIndicesRef indices, const ATensor &other)
 
void base_index_put_ (indexing::TensorIndicesRef indices, const CScalar &v)
 
Rot dynamic_expand (const TraceableTensorShape &shape) const
 
Rot intmd_expand (TensorShapeRef shape) const
 
neml2::Tensor base_expand (TensorShapeRef shape) const
 
Rot batch_expand (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape) const
 
neml2::Tensor static_expand (TensorShapeRef intmd_shape, TensorShapeRef base_shape) const
 
Rot dynamic_expand (const TraceableSize &size, Size d) const
 
Rot intmd_expand (Size size, Size d) const
 
neml2::Tensor base_expand (Size size, Size d) const
 
Rot dynamic_expand_as (const neml2::Tensor &other) const
 
Rot intmd_expand_as (const neml2::Tensor &other) const
 
neml2::Tensor base_expand_as (const neml2::Tensor &other) const
 
Rot batch_expand_as (const neml2::Tensor &other) const
 
neml2::Tensor static_expand_as (const neml2::Tensor &other) const
 
Rot dynamic_reshape (const TraceableTensorShape &shape) const
 
Rot intmd_reshape (TensorShapeRef shape) const
 
neml2::Tensor base_reshape (TensorShapeRef shape) const
 
Rot batch_reshape (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape) const
 
neml2::Tensor static_reshape (TensorShapeRef intmd_shape, TensorShapeRef base_shape) const
 
Rot dynamic_squeeze (Size d) const
 
Rot intmd_squeeze (Size d) const
 
neml2::Tensor base_squeeze (Size d) const
 
Rot dynamic_unsqueeze (Size d, Size n=1) const
 
Rot intmd_unsqueeze (Size d, Size n=1) const
 
neml2::Tensor base_unsqueeze (Size d, Size n=1) const
 
Rot dynamic_transpose (Size d1, Size d2) const
 
Rot intmd_transpose (Size d1, Size d2) const
 
neml2::Tensor base_transpose (Size d1, Size d2) const
 
Rot dynamic_movedim (Size old_dim, Size new_dim) const
 
Rot intmd_movedim (Size old_dim, Size new_dim) const
 
neml2::Tensor base_movedim (Size old_dim, Size new_dim) const
 
Rot dynamic_flatten () const
 
Rot intmd_flatten () const
 
neml2::Tensor base_flatten () const
 
Rot batch_flatten () const
 Flatten batch dimensions.
 
neml2::Tensor static_flatten () const
 Flatten static dimensions.
 

Static Public Member Functions

static Rot identity (const TensorOptions &options=default_tensor_options())
 The identity rotation, helpfully the zero vector.
 
static Rot fill_euler_angles (const Vec &v, const std::string &angle_convention, const std::string &angle_type)
 Fill from Euler angle.
 
static Rot fill_matrix (const R2 &M)
 Fill from rotation matrix.
 
static Rot fill_rodrigues (const Scalar &rx, const Scalar &ry, const Scalar &rz)
 Fill from standard Rodrigues parameters.
 
static Rot rotation_from_to (const Vec &v1, const Vec &v2)
 Fill by forming the rotation between two vectors.
 
static Rot axis_angle (const Vec &n, const Scalar &theta)
 Fill with axis/angle pairs.
 
static Rot axis_angle_standard (const Vec &n, const Scalar &theta)
 Fill with axis/angle pairs as a standard Rodrigues parameter, then convert to MRP.
 
static Rot rand (const TensorOptions &options=default_tensor_options())
 
static Rot rand (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape, const TensorOptions &options=default_tensor_options())
 
- Static Public Member Functions inherited from PrimitiveTensor< Rot, 3 >
static Rot create (const TensorDataContainer &data, Size intmd_dim=0, const TensorOptions &options=default_tensor_options())
 Arbitrary tensor from a nested container with inferred batch dimension.
 
static Rot einsum (c10::string_view equation, TensorList tensors)
 Einstein summation along base dimensions.
 
static Rot empty (const TensorOptions &options=default_tensor_options())
 
static Rot empty (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape={}, const TensorOptions &options=default_tensor_options())
 
static Rot zeros (const TensorOptions &options=default_tensor_options())
 
static Rot zeros (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape={}, const TensorOptions &options=default_tensor_options())
 
static Rot ones (const TensorOptions &options=default_tensor_options())
 
static Rot ones (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape={}, const TensorOptions &options=default_tensor_options())
 
static Rot full (const CScalar &init, const TensorOptions &options=default_tensor_options())
 
static Rot full (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape, const CScalar &init, const TensorOptions &options=default_tensor_options())
 
static Rot rand (const TensorOptions &options=default_tensor_options())
 
static Rot rand (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape, const TensorOptions &options=default_tensor_options())
 
static Rot fill (Args &&... args)
 
- Static Public Member Functions inherited from TensorBase< Rot >
static Rot empty_like (const Rot &other)
 
static Rot zeros_like (const Rot &other)
 Zero tensor like another, i.e. same batch and base shapes, same tensor options, etc.
 
static Rot ones_like (const Rot &other)
 Unit tensor like another, i.e. same batch and base shapes, same tensor options, etc.
 
static Rot full_like (const Rot &other, const CScalar &init)
 
static Rot rand_like (const Rot &other)
 

Additional Inherited Members

- Public Types inherited from PrimitiveTensor< Rot, 3 >
using base_sizes_sequence
 Base shape sequence.
 
- Static Public Attributes inherited from PrimitiveTensor< Rot, 3 >
static const TensorShape const_base_sizes
 The base shape.
 
static constexpr Size const_base_dim
 The base dim.
 
static constexpr Size const_base_numel
 The base numel.
 
- Protected Member Functions inherited from PrimitiveTensor< Rot, 3 >
void validate_shapes_and_dims () const
 Validate shapes and dimensions.
 
- Protected Member Functions inherited from TensorBase< Rot >
void validate_shapes_and_dims () const
 Validate shapes and dimensions.
 

Member Function Documentation

◆ axis_angle()

Rot axis_angle ( const Vec & n,
const Scalar & theta )
staticnodiscard

Fill with axis/angle pairs.

◆ axis_angle_standard()

Rot axis_angle_standard ( const Vec & n,
const Scalar & theta )
staticnodiscard

Fill with axis/angle pairs as a standard Rodrigues parameter, then convert to MRP.

◆ deuler_rodrigues()

R3 deuler_rodrigues ( ) const

d(R2)/d(r) – useful in constructing other derivatives

◆ dist()

Scalar dist ( const Rot & r) const

Distance measure between two rotations, accounting for shadow mapping.

◆ drotate()

R2 drotate ( const Rot & r) const

Derivative of the rotated Rodrigues vector w.r.t. the other Rodrigues vector.

◆ drotate_self()

R2 drotate_self ( const Rot & r) const

Derivative of the rotated Rodrigues vector w.r.t. this vector.

◆ dshadow()

R2 dshadow ( ) const

Return the derivative of the shadow map.

◆ dV()

Scalar dV ( ) const

Volume element at locations.

◆ euler_rodrigues()

R2 euler_rodrigues ( ) const

Generate a rotation matrix using the Euler-Rodrigues formula.

◆ fill_euler_angles()

Rot fill_euler_angles ( const Vec & v,
const std::string & angle_convention,
const std::string & angle_type )
staticnodiscard

Fill from Euler angle.

◆ fill_matrix()

Rot fill_matrix ( const R2 & M)
staticnodiscard

Fill from rotation matrix.

◆ fill_rodrigues()

Rot fill_rodrigues ( const Scalar & rx,
const Scalar & ry,
const Scalar & rz )
staticnodiscard

Fill from standard Rodrigues parameters.

◆ gdist()

Scalar gdist ( const Rot & r) const

Raw distance formula, not accounting for shadown mapping.

◆ identity()

Rot identity ( const TensorOptions & options = default_tensor_options())
staticnodiscard

The identity rotation, helpfully the zero vector.

◆ rand() [1/2]

Rot rand ( const TensorOptions & options = default_tensor_options())
staticnodiscard

Fill random orientations following uniform distribution in SO(3)

◆ rand() [2/2]

Rot rand ( const TraceableTensorShape & dynamic_shape,
TensorShapeRef intmd_shape,
const TensorOptions & options = default_tensor_options() )
staticnodiscard

◆ rotate()

Rot rotate ( const Rot & r) const

Rotate.

◆ rotation_from_to()

Rot rotation_from_to ( const Vec & v1,
const Vec & v2 )
staticnodiscard

Fill by forming the rotation between two vectors.

◆ shadow()

Rot shadow ( ) const

Return the shadow parameter set (a set of MRPs that define the same orientation)