Skip to content

Commit 05eefaa

Browse files
committed
update Readme
1 parent 4081fd7 commit 05eefaa

File tree

1 file changed

+69
-22
lines changed

1 file changed

+69
-22
lines changed

README.md

Lines changed: 69 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,87 @@ Lean is an expressive functional programming language that allows to formalize t
1010
- Catalogization of numerical methods.
1111

1212
In short, mathematics is the ultimate abstraction for numerical computing and Lean can understand mathematics. Hopefully, using Lean will allow us to create really powerful and extensible library for scientific computing.
13-
14-
# Documentation
1513

16-
Manual:
17-
- [Scientific Computing in Lean](https://lecopivo.github.io/scientific-computing-lean/)
18-
19-
Working in progress book on scientific computing in Lean.
2014

21-
Presentations:
22-
- [Automatic Differentiation in Lean - Lean Together 2024](https://www.youtube.com/watch?v=Kjx5KvB8FL8)(30min)
15+
## Documentation
2316

24-
Overview and motivation behind automatic differentiation in Lean, examples of forward and reverse mode AD.
25-
- [Scientific Computing in Lean - Lean for Scientists and Engineers 2024](https://umbc.webex.com/umbc/ldr.php?RCID=fdb070fac47f174fcecf60a96960eacc)(2h)
17+
### Manual
18+
- [Scientific Computing in Lean](https://lecopivo.github.io/scientific-computing-lean/)
19+
_A work-in-progress book on scientific computing in Lean._
2620

27-
Overview and motivation behind SciLean, working with n-dimensional arrays and symbolic/automatic differentiation.
28-
29-
# Installation and running examples/tests
21+
### Presentations
22+
- [Automatic Differentiation in Lean – Lean Together 2024 (30min)](https://www.youtube.com/watch?v=Kjx5KvB8FL8)
23+
Motivation and examples of forward and reverse mode AD in Lean.
3024

31-
As we are using Lean programming language, you need Lean's version manager =elan=. Follow its installation [instructions](https://github.com/leanprover/elan#installation).
25+
- [Scientific Computing in Lean – Lean for Scientists and Engineers 2024 (2h)](https://www.youtube.com/watch?v=X1oEV5SsFJ8)
26+
Overview of SciLean, n-dimensional arrays, symbolic computation, and automatic differentiation.
3227

33-
Getting and building SciLean simply:
34-
```
28+
- [Scientific Computing in Lean – Seminar at Cambridge University (09 May 2024)](https://www.youtube.com/watch?v=O12SZqIwYCk)
29+
Covers optimization through differential equations, basic probabilistic programming, and the Walk on Spheres algorithm.
30+
31+
32+
## Using SciLean
33+
34+
### Prerequisites
35+
36+
SciLean relies on **OpenBLAS** for accelerating numerical computations.
37+
You’ll need to have it installed on your system:
38+
39+
- **Ubuntu**:
40+
```bash
41+
sudo apt-get install libopenblas-dev
42+
```
43+
- **macOS**:
44+
```bash
45+
brew install openblas
46+
```
47+
- **Windows**: Currently not officially supported.
48+
49+
50+
### Building SciLean
51+
52+
Clone and build the library with:
53+
54+
```bash
3555
git clone https://github.com/lecopivo/SciLean.git
3656
cd SciLean
3757
lake exe cache get
3858
lake build
3959
```
4060

41-
To run examples:
42-
```
43-
lake build HarmonicOscillator && .lake/build/bin/HarmonicOscillator
44-
lake build WaveEquation && .lake/build/bin/WaveEquation
61+
62+
### Setting Up Your Project with SciLean
63+
64+
To use `SciLean` in your own Lean project:
65+
66+
1. Add a `require` statement for `scilean`.
67+
2. Set `moreLinkArgs` to point to your OpenBLAS library.
68+
69+
Here’s an example `lakefile.lean` for a project named `foo`:
70+
71+
```lean
72+
import Lake
73+
open Lake DSL System
74+
75+
def linkArgs :=
76+
if System.Platform.isWindows then
77+
panic! "Windows is not supported!"
78+
else if System.Platform.isOSX then
79+
#["-L/opt/homebrew/opt/openblas/lib", "-L/usr/local/opt/openblas/lib", "-lblas"]
80+
else -- Linux
81+
#["-L/usr/lib/x86_64-linux-gnu/", "-lblas", "-lm"]
82+
83+
package foo {
84+
moreLinkArgs := linkArgs
85+
}
86+
87+
require leanblas from git "https://github.com/lecopivo/SciLean" @ "v4.18.0"
88+
89+
@[default_target]
90+
lean_lib Foo {
91+
roots := #[`Foo]
92+
}
4593
```
46-
Other examples in =examples= directory do not currently work.
4794

95+
> **Note:** If your project uses `mathlib`, ensure compatibility with the `scilean` version. Alternatively, omit the explicit `mathlib` requirement, SciLean brings in a compatible version as a transitive dependency.
4896
49-
To get an idea how SciLean works have a look at explanation of the harmonic oscillator [example](https://lecopivo.github.io/scientific-computing-lean/Examples/Harmonic-Oscillator/#Scientific-Computing-in-Lean--Examples--Harmonic-Oscillator).

0 commit comments

Comments
 (0)