Skip to content

allow np.float32 precision instead of default float64 or higher #230

@sdancette

Description

@sdancette

Is your feature request related to a problem? Please describe.
I need to perform (fast) quaternion calculation on (very) large datasets with float32 precision instead of float64.

Describe the solution you'd like
I need quat.as_quat_array( q_array ) to generate an array with float32 precision. And any quaternion algebra (multiplication, conjugate etc...) based on such array to also return the result with float32 precision.

Describe alternatives you've considered
... my own functions implementing basic quaternion algebra based on np.float32 arrays... but slower (in their pure numpy version) and with a less compact syntax such as qc = q_mult(qa, qb).

Additional context
In the 3D imaging community, volumes of 1024^3 voxels are common. In the sub-community dealing with the imaging of crystals, there's a quaternion behind each voxel. (Most commercial or academic softwares store crystallographic orientations as so-called 'Bunge' Euler angles, a flavor of the ZXZ convention, but I won't debate this here...).
So, an array of 1024^3 quaternion is already 16G in memory in float32 precision. Multiply it by 3 at least to deal with the inputs and output of the example q_mult() function above, then you get the picture of the memory problem with most computers.
Now, in such community, the angular precision of experimental systems is 0.01° at best (most of the time rather in the order of 1°). So float32 precision is usually more than enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions