GithubHelp home page GithubHelp logo

moplex's Introduction

Moplex🔥

Complex types for Mojo🔥

Mojo version 24.2

Moplex provides generalized complex numbers for the mojo programming language.

Complex numbers have a real and imaginary part which can be added, multiplied, and exponentiated.

5 + 4i

The imaginary part multiplied by itself is -1

i*i = -1

Generalized Complex

Moplex also has Paraplex numbers (also called dual numbers), and Hyperplex numbers (also called hyperbolic numbers)

In Moplex, all three of these type are considered the unital hybrids, and the imaginary part is considered the antiox

They are similar to complex, in that the antiox also squares to a real number:

Paraplex numbers, written like 3+1o, has an antiox that squares to zero -> o*o = 0

Hyperplex numbers, written like 1+2x, have an antiox that squares to one -> x*x = 1

You can in fact make a number which has an antiox that squares to any real by parameterizing the Hybrid type.

This looks like: HybridInt[-2](0,1), which squares to -2

Multiplex

When adding two HybridSIMD types with differing antiox squares, it will result in a Multiplex type

Example: (1 + 1i) + (2 + 2o) = (3 + 1i + 2o)

Using in Mojo

to import and use a type, you can do:

from moplex import moprint, Complex64, Paraplex64, Hyperplex64, HybridInt, i, o, x

moprint(Complex64(-1,-2)**i)
moprint(Paraplex64(1,1) + o)
moprint(Hyperplex64(8,6) * x)
moprint(Complex64(-1,-2) + Paraplex64(1,1) + Hyperplex64(8,6))

You can also import just the antiox parts, but they dont sum together yet due to them being HybridIntLiteral type.

(only MultiplexSIMD for now)

This may change with future updates.

moplex's People

Contributors

helehex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.