Skip to main content

A basic math library for vectors and matrices

Project description


A basic math library for vectors and matrices (just for 2,3, and 4 dimensions)

Yet another math library

This library is intended mainly for test purposes (integration with PyPi, ReadTheDocs, CI, python-bindings, etc.). However, we currently use it as a replacement to other more complete libraries like glm and Eigen in some projects that make heavy use of C/C++ and also require Python support through bindings.



Clone this package into your third_party dependencies:

# Replace "third_party" with your own dependencies-folder name
git clone third_party/tiny_math

The library is a template-based header-only library, so just include the headers in the include folder, e.g. in your own CMakeLists.txt:

include_directories( third_party/tiny_math/include )

Alternatively, you can use the CMake target tinymath_cpp_lib as a dependency in your own target:

add_library( my_own_awesome_library tinymath_cpp_lib )


Use the provided file:

python install

Or via PyPi:

pip install wp-tinymath

And import the tinymath package in your python files:

import tinymath as tm



#include <vector_t.h>
#include <matrix_t.h>

int main()
    // Create a vec3-float32 and show it on the console
    tinymath::Vector3f _vec = { 1.0f, 2.0f, 3.0f };
    std::cout << "vec: " << tinymath::toString( vec ) << std::endl;

    // Create a mat3 float32, show its entries and its inverse
    auto mat = tinymath::Matrix3f( { 3.0f, 9.0f, 3.0f,
                                     9.0f, 0.0f, 3.0f,
                                     2.0f, 3.0f, 8.0f } );

    std::cout << "mat:" << std::endl;
    std::cout << tinymath::toString( mat ) << std::endl;
    std::cout << "mat.inverse():" << std::endl;
    std::cout << tinymath::toString( mat.inverse() ) << std::endl;

    return 0;


import tinymath as tm

# Create a vec3-float32 and show it on the console
vec = tm.Vector3f( [1.0, 2.0, 3.0] )
print( 'vec: {}'.format( vec ) )

# Create a mat3 float32, show its entries and its inverse
mat = tm.Matrix3f( [ [ 3.0, 9.0, 3.0 ],
                     [ 9.0, 0.0, 3.0 ],
                     [ 2.0, 3.0, 8.0 ] ] );

print( "mat:" )
print( mat )
print( "mat.inverse():" )
print( mat.inverse() )

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wp-tinymath, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size wp-tinymath-0.0.3.tar.gz (198.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page