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

Quaternion. More...

Detailed Description

Quaternion.

Our convention is (s, q1, q2, q3), i.e. the scalar part first

#include <Quaternion.h>

Inheritance diagram for Quaternion:

Public Member Functions

 Quaternion (const Rot &r)
 
R2 rotation_matrix () const
 Convert to rotation matrix.
 
Scalar dist (const Quaternion &other) const
 Distance measure between two quaternions.
 
- Public Member Functions inherited from PrimitiveTensor< Quaternion, 4 >
 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< Quaternion >
 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
 
Quaternion variable_data () const
 Variable data without function graph.
 
Quaternion contiguous () const
 
Quaternion clone () const
 Clone (take ownership)
 
Quaternion detach () const
 Discard function graph.
 
Quaternion to (const TensorOptions &options) const
 Change tensor options.
 
Quaternion 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
 
Quaternion dynamic_index (indexing::TensorIndicesRef indices) const
 
Quaternion intmd_index (indexing::TensorIndicesRef indices) const
 
neml2::Tensor base_index (indexing::TensorIndicesRef indices) const
 
Quaternion dynamic_slice (Size d, const indexing::Slice &index) const
 
Quaternion 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)
 
Quaternion dynamic_expand (const TraceableTensorShape &shape) const
 
Quaternion intmd_expand (TensorShapeRef shape) const
 
neml2::Tensor base_expand (TensorShapeRef shape) const
 
Quaternion batch_expand (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape) const
 
neml2::Tensor static_expand (TensorShapeRef intmd_shape, TensorShapeRef base_shape) const
 
Quaternion dynamic_expand (const TraceableSize &size, Size d) const
 
Quaternion intmd_expand (Size size, Size d) const
 
neml2::Tensor base_expand (Size size, Size d) const
 
Quaternion dynamic_expand_as (const neml2::Tensor &other) const
 
Quaternion intmd_expand_as (const neml2::Tensor &other) const
 
neml2::Tensor base_expand_as (const neml2::Tensor &other) const
 
Quaternion batch_expand_as (const neml2::Tensor &other) const
 
neml2::Tensor static_expand_as (const neml2::Tensor &other) const
 
Quaternion dynamic_reshape (const TraceableTensorShape &shape) const
 
Quaternion intmd_reshape (TensorShapeRef shape) const
 
neml2::Tensor base_reshape (TensorShapeRef shape) const
 
Quaternion batch_reshape (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape) const
 
neml2::Tensor static_reshape (TensorShapeRef intmd_shape, TensorShapeRef base_shape) const
 
Quaternion dynamic_squeeze (Size d) const
 
Quaternion intmd_squeeze (Size d) const
 
neml2::Tensor base_squeeze (Size d) const
 
Quaternion dynamic_unsqueeze (Size d, Size n=1) const
 
Quaternion intmd_unsqueeze (Size d, Size n=1) const
 
neml2::Tensor base_unsqueeze (Size d, Size n=1) const
 
Quaternion dynamic_transpose (Size d1, Size d2) const
 
Quaternion intmd_transpose (Size d1, Size d2) const
 
neml2::Tensor base_transpose (Size d1, Size d2) const
 
Quaternion dynamic_movedim (Size old_dim, Size new_dim) const
 
Quaternion intmd_movedim (Size old_dim, Size new_dim) const
 
neml2::Tensor base_movedim (Size old_dim, Size new_dim) const
 
Quaternion dynamic_flatten () const
 
Quaternion intmd_flatten () const
 
neml2::Tensor base_flatten () const
 
Quaternion batch_flatten () const
 Flatten batch dimensions.
 
neml2::Tensor static_flatten () const
 Flatten static dimensions.
 

Additional Inherited Members

- Public Types inherited from PrimitiveTensor< Quaternion, 4 >
using base_sizes_sequence
 Base shape sequence.
 
- Static Public Member Functions inherited from PrimitiveTensor< Quaternion, 4 >
static Quaternion 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 Quaternion einsum (c10::string_view equation, TensorList tensors)
 Einstein summation along base dimensions.
 
static Quaternion empty (const TensorOptions &options=default_tensor_options())
 
static Quaternion empty (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape={}, const TensorOptions &options=default_tensor_options())
 
static Quaternion zeros (const TensorOptions &options=default_tensor_options())
 
static Quaternion zeros (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape={}, const TensorOptions &options=default_tensor_options())
 
static Quaternion ones (const TensorOptions &options=default_tensor_options())
 
static Quaternion ones (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape={}, const TensorOptions &options=default_tensor_options())
 
static Quaternion full (const CScalar &init, const TensorOptions &options=default_tensor_options())
 
static Quaternion full (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape, const CScalar &init, const TensorOptions &options=default_tensor_options())
 
static Quaternion rand (const TensorOptions &options=default_tensor_options())
 
static Quaternion rand (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape, const TensorOptions &options=default_tensor_options())
 
static Quaternion fill (Args &&... args)
 
- Static Public Member Functions inherited from TensorBase< Quaternion >
static Quaternion empty_like (const Quaternion &other)
 
static Quaternion zeros_like (const Quaternion &other)
 Zero tensor like another, i.e. same batch and base shapes, same tensor options, etc.
 
static Quaternion ones_like (const Quaternion &other)
 Unit tensor like another, i.e. same batch and base shapes, same tensor options, etc.
 
static Quaternion full_like (const Quaternion &other, const CScalar &init)
 
static Quaternion rand_like (const Quaternion &other)
 
- Static Public Attributes inherited from PrimitiveTensor< Quaternion, 4 >
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< Quaternion, 4 >
void validate_shapes_and_dims () const
 Validate shapes and dimensions.
 
- Protected Member Functions inherited from TensorBase< Quaternion >
void validate_shapes_and_dims () const
 Validate shapes and dimensions.
 

Constructor & Destructor Documentation

◆ Quaternion()

Quaternion ( const Rot & r)

Member Function Documentation

◆ dist()

Scalar dist ( const Quaternion & other) const

Distance measure between two quaternions.

◆ rotation_matrix()

R2 rotation_matrix ( ) const

Convert to rotation matrix.