mafs 0.1.0

Fast maths for tiny projects. With SIMD but just for x86
Documentation
  • Coverage
  • 100%
    59 out of 59 items documented6 out of 6 items with examples
  • Size
  • Source code size: 58.82 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.76 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • alucas2/mafs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • alucas2

A Tiny SIMD Vector Crate 🏹

🚩 Works only on the x86_64 CPU architecture with the AVX2 and FMA extensions!

They can be enabled by putting these lines inside .cargo/config.toml, located either at the root of your project or in the installation directory of cargo:

[build]

rustflags = ["-Ctarget-feature=+avx2,+fma"]

Highlights

  • The motivation behind this crate is to provide fast vectors for small computer graphics projects.
  • Straightforward implementation without macro trickery. Explore the source code to see how everything is done!

Data types

  • Double precision:
    • Dvec2 - 2D vector
    • Dvec4 - 4D vector
    • Dmat4 - 4x4 matrix
  • Single precision:
    • Fvec2 - 2D vector (this one is not SIMD)
    • Fvec4 - 4D vetcor
    • Fmat4 - 4x4 matrix

Available operations

  • Arithmetics (+, -, * and /):
    • Add, subtract, multiply or divide two vectors, or a vector with a scalar, componentwise.
    • Add or subtract two matrices.
    • Multiply two matrices.
    • Multiply a matrix by a vector.
  • Methods:
    • Operations on one vector: componentwise floor
    • Operations on two vectors: dot product, cross product, componentwise minimum and maximum.
    • Reduce a single vector: minimun and maximum across all components.
    • Invert a matrix that belongs to SE(3), i.e. a transformation matrix.
    • Transpose a matrix.

Crate features

  • Enable the crate feature bytemuck to mark all vectors as Plain Old Data.