Coder Social home page Coder Social logo

iheartla's Introduction

I❤️LA: Compilable Markdown for Math

I❤️LA is a compilable markdown for math. It can generate working code in your favorite language (C++, Python, MATLAB, more to come) and LaTeX from snippets like this:

∑_i a_i b_i
where
a ∈ ℝ^n
b ∈ ℝ^n

or this:

A_ij = { 1 if (i,j) ∈ E
         0 otherwise
where
A ∈ ℝ^(n × n)
E ∈ { ℤ × ℤ }
n ∈ ℤ

or this:

[ t^3 t^2 t 1 ] [ -1  3 -3  1
                   3 -6  3  0
                  -3  3  0  0
                   1  0  0  0 ] P
where
t ∈ ℝ
P ∈ ℝ^(4 × d)

In other words, I❤️LA is a linear algebra domain specific language (DSL) that targets other languages. Write once, use everywhere.

For more, see the wiki.

Running

The easiest way to run is in the web browser. You can use the hosted version (no installation needed) or cd web and then python3 -m http.server.

The following instructions describe running the Python code directly.

To run the desktop GUI:

python3 -m iheartla

or, if installed via conda,

pythonw -m iheartla

You can also run as a command-line compiler:

python3 -m iheartla --help

Installing

You can find releases on the GitHub release page. The following instructions are for running from source.

I❤️LA depends on Python 3.x and several modules. You can install the modules via pip:

pip3 install tatsu==4.4 regex wxpython PyMuPDF==1.18.7 sympy
## For development, also install:
pip3 install graphviz cppyy numpy scipy pyinstaller

or install the Poetry dependency manager and run:

poetry install --no-root --no-dev
poetry shell

or via Anaconda or Miniconda. Miniconda is faster to install. (On Windows, choose the 64-bit Python 3.x version. Launch the Anaconda shell from the Start menu and navigate to this directory.) Then:

conda env create -f environment-{cli,gui,dev}.yml
conda activate iheartla-{cli,gui,dev}

Choose environment-{cli,gui,dev}.yml according to whether you only want the command line (cli), also the GUI (gui), or also the development test suite (dev). To update an already created environment if the environment.yml file changes or to change environments, activate and then run conda env update --file environment-{cli,gui,dev}.yml --prune.

If you are developing I❤️LA, the test suite needs a working C++ compiler and, optionally, the Graphviz graph visualization software (brew install graphviz if you're not using conda).

Output Dependencies

To use the code output for the various backends, you will need:

  • LaTeX: A working tex distribution with xelatex and pdfcrop
  • Python: NumPy and SciPy
  • MATLAB: MATLAB or Octave
  • C++: Eigen. Compilation differs on different platforms. On macOS with Homebrew eigen: c++ -I/usr/local/eigen3 output.cpp -o output
  • MATLAB: MATLAB or (untested) Octave

Unicode Fonts

DejaVu Sans Mono is a font with good Unicode support. Windows users should install it. You can download it here. The I❤️LA GUI will use it if installed.

Packaging a release

To update the browser-based compiler, run python3 setup.py sdist bdist_wheel and then copy dist/iheartla-0.0.1-py3-none-any.whl to the docs directory.

macOS: pyinstaller iheartla.spec. The output iheartla.app is placed into dist/. Whoever is packaging should run python3 -m iheartla --regenerate-grammar at least once.

iheartla's People

Contributors

pressureless avatar yig avatar alecjacobson avatar dependabot[bot] 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.