GithubHelp home page GithubHelp logo

forfudan / numojo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mojo-numerics-and-algorithms-group/numojo

0.0 0.0 0.0 2.2 MB

A numerics library for the Mojo programming language

License: Apache License 2.0

Mojo 100.00%

numojo's Introduction

Logo

NuMojo

NuMojo is a library for numerical computing in Mojo 🔥 similar to NumPy, SciPy in Python.
Explore the docs»

Table of Contents
  1. About The Project
  2. Goals/Roadmap
  3. Usage
  4. How to install
  5. Contributing
  6. Warnings
  7. License
  8. Acknowledgments

About the project

What NuMojo is

NuMojo intends to capture a wide swath of numerics capability present in the Python packages NumPy, SciPy and Scikit.

NuMojo intends to try and get the most out of the capabilities of Mojo including vectorization, parallelization, and GPU acceleration(once available). Currently, NuMojo extends (most of) the standard library math functions to work on tensor inputs. NuMojo intends to try and get the most out of the capabilities of Mojo including vectorization, parallelization, and GPU acceleration(once available). Currently, NuMojo extends (most of) the standard library math functions to work on tensor inputs.

NuMojo intends to be a building block for other Mojo packages that need fast math under the hood without the added weight of a ML back and forward propagation system

What NuMojo is not

NuMojo is not a machine learning library, it will never include back-propagation in the base library.

Goals / Roadmap

For a detailed roadmap, please refer to the Roadmap.md file.

Our main goal is to implement a fast, comprehensive numerics library in Mojo. Following are some brief long-term goals,

Long term goals

  • Linear Algebra
    • Native n-dimensional array types
    • Vectorized, Parallelized math operations
    • Array manipulation - vstack, slicing, concat etc.
  • Calculus
    • Integration & Derivatives etc
  • Optimizers
  • Function approximators
  • Sorting

Usage

An example goes as follows.

import numojo as nm

fn main() raises:
    # Generate two 1000x1000 matrices with random float64 values
    var A = nm.NDArray[nm.f64](shape=List[Int](1000,1000), random=True)
    var B = nm.NDArray[nm.f64](1000,1000, random=True)

    # Print AB
    print(nm.linalg.matmul_parallelized(A, B))

Please find all the available functions here

How to install

There are two approach to install and use the Numojo package.

Build package

This approach invovles building a standalone package file mojopkg.

  1. Clone the repository.
  2. Build the package using mojo pacakge numojo
  3. Move the numojo.mojopkg into the directory containing the your code.

Inlcude NuMojo's path for compiler and LSP

This approach does not require buiding a package file. Instead, when you compile your code, you can include the path of NuMojo reporsitory with the following command:

mojo run -I "../NuMojo" example.mojo

This is more flexible as you are able to edit the NuMojo source files when testing your code.

In order to allow VSCode LSP to resolve the imported numojo package, you can:

  1. Go to preference page of VSCode.
  2. Got to Mojo › Lsp: Include Dirs
  3. Click add item and write the path where the Numojo repository is located, e.g. /Users/Name/Programs/NuMojo.
  4. Restart the Mojo LSP server.

Now VSCode can show function hints for the Numojo pakcage!

Contributing

Any contributions you make are greatly appreciated. For more details and guidelines on contributions, please check here

Warnings

This library is still very much a work in progress and may change at any time.

License

Distributed under the Apache 2.0 License with LLVM Exceptions. See LICENSE and the LLVM License for more information.

Acknowledgements

numojo's People

Contributors

shivasankarka avatar madalex1997 avatar forfudan 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.