Created: 2021-07-16 Fri 19:08
presentations/SERI2021
main: push rbp mov rbp, rsp mov DWORD PTR [rbp-4], 3 mov eax, 0 pop rbp ret __static_initialization_ and_destruction_0(int, int): push rbp mov rbp, rsp sub rsp, 16 mov DWORD PTR [rbp-4], edi mov DWORD PTR [rbp-8], esi cmp DWORD PTR [rbp-4], 1 jne .L5 cmp DWORD PTR [rbp-8], 65535 jne .L5 mov edi, OFFSET FLAT:_ZStL8 __ioinit
call std::ios_base::Init::Init() [complete object constructor] mov edx, OFFSET FLAT:__dso_handle mov esi, OFFSET FLAT:_ZStL8__ioinit mov edi, OFFSET FLAT:_ZNSt8ios_base4InitD1Ev call __cxa_atexit .L5: nop leave ret _GLOBAL__sub_I_main: push rbp mov rbp, rsp mov esi, 65535 mov edi, 1 call __static_initialization_ and_destruction_0(int, int) pop rbp ret
int main () { int D.48918; { int a; a = 3; D.48918 = 0; return D.48918; } D.48918 = 0; return D.48918; } void _GLOBAL__sub_I_main.cpp () { __static_initialization_ and_destruction_0 (1, 65535); }
void __static_initialization_ and_destruction_0 (int __initialize_p, int __priority) { if (__initialize_p == 1) goto <D.48920>; else goto <D.48921>; <D.48920>: if (__priority == 65535) goto <D.48922>; else goto <D.48923>; <D.48922>: std::ios_base::Init::Init (&__ioinit); __cxxabiv1::__cxa_atexit (__dt_comp , &__ioinit, &__dso_handle); goto <D.48924>; <D.48923>: <D.48924>: goto <D.48925>; <D.48921>: <D.48925>: }
gcc
representation…#include<iostream> int main() { int a=3; return 0; }
g++ main.cpp -o file
file
binary which can be run as:./file
gcc
is just an ugly compiler…program main integer :: x = 3 + 6 print *, x end program
lfortran
has a nicer intermediate structureconda create -n lf
conda activate lf
conda install lfortran \
-c conda-forge
lfortran --show-asr consint.f90
Readme.{md,org}
LICENSE
.gitignore
$ git init # Inside project $ gibo macOS Windows Xcode Emacs \ Vim Python C++ \ CMake TeX > .gitignore $ touch readme.md $ license-generator MIT \ --author "Person" $ tree -L 2 . ├── LICENSE ├── docs │ └── pres └── readme.org 2 directories, 2 files
. ├── api-docs ├── dependencies ├── python-symengine-feedstock ├── symengine ├── symengine-bench ├── SymEngineBuilder ├── symengine.f90 ├── symengine-feedstock ├── symengine.github.io ├── symengine.hs ├── SymEngine.jl ├── symengine-paper ├── symengine.py ├── symengine.R ├── symengine.rb ├── symengine.spkg └── symengine-wheels
Language | Package |
R | pkgdown |
Python | Sphinx |
C++ | Doxygen + doxyYoda |
Julia | Documenter.jl |
Notebooks / MyST | Sphinx + myst + jupytext |
sphinx
is reasonably good for code documentation
/** * @file add.h * @author SymEngine Developers * @date 2021-02-25 * @brief Classes and functions relating to the binary operation of addition * * Created on: 2012-07-11 * * This file contains the basic binary operations defined for symbolic enties. * In particular the @ref Add class for representing addition is * @b declared here, along with the `add` and `substract` functions. */ #ifndef SYMENGINE_ADD_H #define SYMENGINE_ADD_H
/** * @brief Create an appropriate instance from dictionary quickly. * @pre The dictionary must be in canonical form. * @see `Mul` for how `Pow` gets returned. * @see `Basic` for the guarantees and expectations. * @param coef the numeric coefficient. * @param d the dictionary of the expression without the coefficient. * @return `coef` if the dictionary is empty (size 0). * @return `Mul` if the dictionary has one element which is a `Mul`. * @return `Integer` if the dictionary has one element which is a * `Integer`. * @return `Symbol` if the dictionary has one element which is a `Symbol`. * @return `Pow` if the dictionary has one element which is a `Pow`. * @return `Add` if the size of the dictionary is greater than 1. */ static RCP<const Basic> from_dict(const RCP<const Number> &coef, umap_basic_num &&d);
/** * @details This function ensures that each term in *dict* is in canonical * form. The implementation in the form of a exclusion list (defaults to * true). * * @note **Canonical form** requires the existance of both `coef` and * `dict`, so `null` coefficients and purely numerical (empty dictionaries) * are also not considered to be in canonical form. Also, the ordering is * important, it must be `(coeff, dict)` and **not** `(dict, coeff)`. * * Some **non-cannonical** forms are: * - @f$0 + x@f$. * - @f$0 + 2x@f$. * - @f$ 2 \times 3 @f$. * - @f$ x \times 0 @f$. * - @f$ 1 \times x @f$ has the wrong order. * - @f$ 3x \times 2 @f$ is actually just @f$6x@f$. */ bool Add::is_canonical(const RCP<const Number> &coef, const umap_basic_num &dict) const
docusaurus
cat irhpc.github.io/i18n/is/docusaurus-plugin-content-docs/current/intro.md
""" This function adds two numbers """ def sum(a,b): return a*b
julia
aside