Fig. 1: Core data structures for physical unit processing.
From: Integrating physical units into high-performance AI-driven scientific computing

a–d saiunit.Dimension enables dimensional analysis and conversion based on SI rules. a The Dimension structure represents the dimensionality of the seven base SI units shown in b. b The SI base units include: meter (m) for length, second (s) for time, kilogram (kg) for mass, ampere (A) for electric current, kelvin (K) for temperature, candela (cd) for luminous intensity, and mole (mol) for amount of substance. c Examples of Dimension instances for both base and derived dimensions. Base dimensions are represented by one-hot vectors, where the position of “1" corresponds to the relevant SI unit in b. Derived dimensions are formed by combining these vectors as described in d. d Operational rules for Dimension instances, including addition, subtraction, multiplication, division, and exponentiation. e–h saiunit.Unit provides representations for physical units. e The Unit structure is composed of a metric scale and a Dimension instance. While the default base factor is 10, the custom base factor can be specified. f The metric scale varies widely in physical worlds, ranging from pico- to tera-scale. By adding this scale prefix, Unit can represent entities as small as atoms or as large as stars. g Examples of Unit instances for representing various physical units. h Operational rules for Unit instances, including addition, subtraction, multiplication, division, and exponentiation. i–l saiunit.Quantity provides an array-based interface for unit-aware computations. i The Quantity structure is composed of a numerical value A and a Unit instance. j The numerical value A can be implemented as Python numbers, NumPy, or JAX arrays. k Examples of Quantity instances for representing physical quantities used in scientific computing. l Supported mathematical operations for Quantity include the basic arithmetic functions (e.g., addition, subtraction, multiplication, division, and exponentiation) and commonly used array functions (e.g., indexing, slicing, broadcasting), following the NumPy array syntax16.