Giter Site home page Giter Site logo

msimms / libmath Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 2.0 214 KB

A collection of commonly used math routines, so I don't have to write them again. Implementations in C, C++, Rust, and Python (though not so much in Python as it already has a pretty good set of libraries).

License: MIT License

C 17.14% C++ 34.76% Rust 18.26% Python 11.24% Assembly 1.48% Java 9.55% Julia 7.32% CMake 0.25%
vector-math matrix-math c cpp rust-lang haversine-distance levenshtein-distance peakfinder distance math-routines

libmath's Introduction

asm_x86-64 C C++ Rust Python 2.7|3.7 MIT license

LibMath

A collection of commonly used math routines, in C, C++, Python, Rust, and Julia programming languages.

Rationale

This is a collection of small, and quick, math routines I've written for other hobby projects over the years. I decided to organize them and place them in one library so they would be easier to reuse in the future. They're also available for anyone else that wants to use this code, instead of a larger, heaveyweight math library. There are no production project files in this library. It is just a loose collection of code. Include the files you need and ignore the ones you don't. The project files and main files are included just for testing.

Features

This library is primarily focused on C and C++. However, I have started adding Python and Rust implementations where appropriate, or when needed. As python already has a large collection of libraries, there simply isn't as much need for python implementations for many of these algorithms.

Distance Calculations

  • Hamming Distance (C, C++, Rust, Python, Julia)
  • Levenshtein Distance (C, C++, Rust, Julia)
  • Basic Euclidian Distances (C, C++, Rust, Python, Julia)
  • Haversine Distance (C, C++, Rust, Python) - Distance between points on the Earth's surface.

Graphics

  • Quadratic Bezier Curve (C++)

Linear Algebra

  • Basic Matrix Operations - with optimizations for square matrices (C, C++, Rust)
  • Basic Vector Operations (C, C++, Rust)

Statistical Functions

  • Mean, Standard Deviation, and Variance (C, C++, Rust, Python2 - unnecesary in Python3)
  • Min, Max (C, C++, Rust)

Signals Functions

  • Simple Signal Smoothing (C, C++, Python, Julia)

K-Means

  • One dimensional K-Means (C, C++, Rust, Python)

Peak Finding

  • Find peaks that rise more than one standard deviation above the mean for at least three consecutive points on the x axis. (C++, Rust, Python)

Power

  • Find the nearest power of two (C, C++, Julia)

Graphics

  • Ray Casting (Python, Rust) - Determines if a point is within a polygon.

Using

Add this respository as a submodule to your own project and then add the file you want directly to your build, or just copy the source files directly into your project. This library is just meant to be a loose collection of files that you can do whatever you want with. This way you don't have to add code for algorithms you don't need to your project.

License

This library is released under the MIT license, see LICENSE for details.

libmath's People

Contributors

msimms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.