eiko 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
eiko-0.8.0/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Sebastian Kazmarek Præsius
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
eiko-0.8.0/PKG-INFO ADDED
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: eiko
3
+ Version: 0.8.0
4
+ Summary: Eiko: the GPU-accelerated Eikonal equation solver
5
+ Author-email: Sebastian Kazmarek Præsius <sebastian.devel@gmail.com>
6
+ License: BSD 3-Clause License
7
+
8
+ Copyright (c) 2026, Sebastian Kazmarek Præsius
9
+
10
+ Redistribution and use in source and binary forms, with or without
11
+ modification, are permitted provided that the following conditions are met:
12
+
13
+ 1. Redistributions of source code must retain the above copyright notice, this
14
+ list of conditions and the following disclaimer.
15
+
16
+ 2. Redistributions in binary form must reproduce the above copyright notice,
17
+ this list of conditions and the following disclaimer in the documentation
18
+ and/or other materials provided with the distribution.
19
+
20
+ 3. Neither the name of the copyright holder nor the names of its
21
+ contributors may be used to endorse or promote products derived from
22
+ this software without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ Project-URL: Homepage, https://github.com/sebftw/Eiko
35
+ Keywords: gpu,cuda,pytorch,jax,automatic differentiation,autodiff,time of flight,beamforming,shortest path,batch-processing,fast iterative Method,eikonal,eikonal equation,PDE,partial differential equations,scientific computing
36
+ Classifier: Development Status :: 4 - Beta
37
+ Classifier: Intended Audience :: Science/Research
38
+ Classifier: Intended Audience :: Developers
39
+ Classifier: License :: OSI Approved :: BSD License
40
+ Classifier: Operating System :: Microsoft :: Windows
41
+ Classifier: Operating System :: POSIX :: Linux
42
+ Classifier: Programming Language :: Python :: 3
43
+ Classifier: Programming Language :: Python :: 3.8
44
+ Classifier: Programming Language :: Python :: 3.9
45
+ Classifier: Programming Language :: Python :: 3.10
46
+ Classifier: Programming Language :: Python :: 3.11
47
+ Classifier: Environment :: GPU
48
+ Classifier: Environment :: GPU :: NVIDIA CUDA
49
+ Classifier: Topic :: Scientific/Engineering :: Physics
50
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
51
+ Requires-Python: >=3.8
52
+ Description-Content-Type: text/markdown
53
+ License-File: LICENSE
54
+ Requires-Dist: torch>=2.0.0
55
+ Requires-Dist: ninja
56
+ Provides-Extra: jax
57
+ Requires-Dist: jax[cuda12]; extra == "jax"
58
+ Requires-Dist: pybind11; extra == "jax"
59
+ Provides-Extra: jax-local
60
+ Requires-Dist: jax[cuda12_local]; extra == "jax-local"
61
+ Requires-Dist: pybind11; extra == "jax-local"
62
+ Provides-Extra: examples
63
+ Requires-Dist: matplotlib>=3.5.0; extra == "examples"
64
+ Requires-Dist: jax[cuda12_pip]; extra == "examples"
65
+ Requires-Dist: pybind11; extra == "examples"
66
+ Requires-Dist: optax; extra == "examples"
67
+ Requires-Dist: scipy>=1.7.0; extra == "examples"
68
+ Requires-Dist: numpy>=1.21.0; extra == "examples"
69
+ Requires-Dist: scikit-image; extra == "examples"
70
+ Requires-Dist: pyvista>=0.43.0; extra == "examples"
71
+ Requires-Dist: Pillow>=9.0.0; extra == "examples"
72
+ Provides-Extra: test
73
+ Requires-Dist: pytest>=7.0.0; extra == "test"
74
+ Requires-Dist: pytest-cov; extra == "test"
75
+ Requires-Dist: tox>=4.0.0; extra == "test"
76
+ Requires-Dist: vermin; extra == "test"
77
+ Dynamic: license-file
78
+
79
+ # Eiko
80
+ **Eiko** is a GPU-accelerated Eikonal equation solver, enabling fast
81
+ computation of the shortest time-of-flight through an arbitrary 2D or 3D medium.
82
+
83
+ A few reasons to use Eiko:
84
+ 1. Eiko is **fast** - up to 10x faster than comparable libraries.
85
+ 2. Eiko is **differentiable**, allowing it to be used with PyTorch or JAX.
86
+ 3. Eiko supports **advection**, allowing it to compute apodizations through a lens.
87
+
88
+ ![Image of example](/examples/python/comparison/fps_comparison.png "Comparison between Eiko and other solvers.")
89
+
90
+ ## Installation
91
+ ### Requirements
92
+ Because Eiko compiles custom CUDA kernels during installation, your system must have the following:
93
+ * **OS:** Linux or Windows
94
+ * **Hardware:** NVIDIA GPU
95
+ * **Compiler:**
96
+ * A C++ compiler (e.g., GCC for Linux, MSVC for Windows)
97
+ * The CUDA Toolkit (provides `nvcc`)
98
+
99
+ ### Installing for MATLAB
100
+ Run `setup.m` to install Eiko for MATLAB.
101
+
102
+ ### Installing for Python
103
+ Run
104
+ ```
105
+ pip install eiko
106
+ ```
107
+ You now have Eiko installed and ready for use.
108
+
109
+ See also [the Eiko Python installation guide](/python/PYTHON_INSTALLATION.md).
110
+
111
+ ## Quick Start
112
+ An example of how to use Eiko is shown below.
113
+ <br>
114
+ See [EXAMPLES](/examples/README.md) for many more examples.
115
+
116
+ ### MATLAB example
117
+ ```matlab
118
+ % 1. Setup grid parameters.
119
+ N = 101; % Number of grid points (NxN grid)
120
+ dx = 0.001; % Grid spacing in meters (1 mm, for example)
121
+ c = 1540; % Speed of sound in m/s (uniform medium)
122
+
123
+ % 2. Create the slowness map (1/velocity).
124
+ f = ones(N, N, 'single', 'gpuArray') / c;
125
+
126
+ % 3. Initialize the time-of-flight field.
127
+ u_init = inf(N, N, 'single', 'gpuArray'); % Unknown points set to infinity.
128
+
129
+ % Set a point source at the center of the grid to time = 0.
130
+ center_idx = ceil(N/2);
131
+ u_init(center_idx, center_idx) = 0;
132
+
133
+ % 4. Compute the numerical solution using eiko.
134
+ u_numerical = eiko(u_init, f, dx);
135
+
136
+ % 5. Visualize the result.
137
+ % Create physical coordinate axes in millimeters using dx
138
+ axis_mm = ((1:N) - center_idx) * dx * 1000;
139
+
140
+ % Set up plot.
141
+ figure;
142
+ imagesc(axis_mm, axis_mm, u_numerical * 1e6);
143
+ axis image;
144
+
145
+ % Format axes and text size.
146
+ title('Time-of-Flight Field', 'FontSize', 14, 'FontWeight', 'bold');
147
+ xlabel('x (mm)', 'FontSize', 12, 'FontWeight', 'bold');
148
+ ylabel('y (mm)', 'FontSize', 12, 'FontWeight', 'bold');
149
+
150
+ % Format colorbar.
151
+ cb = colorbar;
152
+ cb.Label.String = 'Time (\mus)';
153
+ cb.Label.FontSize = 12;
154
+ ```
155
+ For 3D inputs, call `eiko3d`.
156
+
157
+ ### Python example
158
+
159
+ ```python
160
+ from eiko import eiko
161
+
162
+ # 1. Setup device and grid parameters.
163
+ device = torch.device("cuda")
164
+ N = 101
165
+ dx = 0.001 # Grid spacing in meters (1 mm)
166
+ c = 1540.0 # Speed of sound in m/s (uniform medium)
167
+
168
+ # 2. Create the slowness map (1/velocity) on the device.
169
+ f = torch.full((N, N), 1.0 / c, dtype=torch.float32, device=device)
170
+
171
+ # 3. Initialize the time-of-flight field.
172
+ # Unknown points are set to infinity
173
+ u_init = torch.full((N, N), float('inf'), dtype=torch.float32, device=device)
174
+
175
+ # Set a point source at the center of the grid to time = 0.
176
+ center_idx = N // 2
177
+ u_init[center_idx, center_idx] = 0.0
178
+
179
+ # 4. Compute the numerical solution.
180
+ u_numerical = eiko(u_init, f, dx=dx)
181
+ ```
182
+ For 3D inputs, use `from eiko import eiko3d`.
183
+
184
+
185
+ The result should look something like this:
186
+
187
+ ![Image of example](/images/eiko_example.png "Result of the example code.")
188
+
189
+ ## Project Layout
190
+ The files are as follows:
191
+ ```
192
+ Eiko/
193
+ ├── examples/ # Example scripts (tomography, lens design, etc.).
194
+ │ ├── matlab/ # MATLAB example scripts
195
+ │ └── python/ # Python example scripts
196
+ ├── matlab/ # MATLAB Eiko library
197
+ ├── python/ # Python Eiko library
198
+ ├── src/ # Core CUDA C++ Eiko implementation and interface
199
+ ├── pyproject.toml # Python package configuration (for pip install)
200
+ ├── setup.m # MATLAB compilation and setup script
201
+ ├── THEORY.md # Mathematical background and Eikonal algorithm details
202
+ └── README.md # This file
203
+ ```
204
+ To learn more about how Eiko works, see [THEORY](THEORY.md).
205
+
206
+ ## Citing
207
+ You can cite Eiko as
208
+ ```
209
+ @misc{eiko2026,
210
+ author = {Pr{\ae}sius, Sebastian},
211
+ title = {Eiko: the GPU-accelerated Eikonal equation solver},
212
+ year = {2026},
213
+ publisher = {GitHub},
214
+ journal = {GitHub repository},
215
+ howpublished = {\url{https://github.com/sebftw/Eiko}}
216
+ }
217
+ ```
eiko-0.8.0/README.md ADDED
@@ -0,0 +1,139 @@
1
+ # Eiko
2
+ **Eiko** is a GPU-accelerated Eikonal equation solver, enabling fast
3
+ computation of the shortest time-of-flight through an arbitrary 2D or 3D medium.
4
+
5
+ A few reasons to use Eiko:
6
+ 1. Eiko is **fast** - up to 10x faster than comparable libraries.
7
+ 2. Eiko is **differentiable**, allowing it to be used with PyTorch or JAX.
8
+ 3. Eiko supports **advection**, allowing it to compute apodizations through a lens.
9
+
10
+ ![Image of example](/examples/python/comparison/fps_comparison.png "Comparison between Eiko and other solvers.")
11
+
12
+ ## Installation
13
+ ### Requirements
14
+ Because Eiko compiles custom CUDA kernels during installation, your system must have the following:
15
+ * **OS:** Linux or Windows
16
+ * **Hardware:** NVIDIA GPU
17
+ * **Compiler:**
18
+ * A C++ compiler (e.g., GCC for Linux, MSVC for Windows)
19
+ * The CUDA Toolkit (provides `nvcc`)
20
+
21
+ ### Installing for MATLAB
22
+ Run `setup.m` to install Eiko for MATLAB.
23
+
24
+ ### Installing for Python
25
+ Run
26
+ ```
27
+ pip install eiko
28
+ ```
29
+ You now have Eiko installed and ready for use.
30
+
31
+ See also [the Eiko Python installation guide](/python/PYTHON_INSTALLATION.md).
32
+
33
+ ## Quick Start
34
+ An example of how to use Eiko is shown below.
35
+ <br>
36
+ See [EXAMPLES](/examples/README.md) for many more examples.
37
+
38
+ ### MATLAB example
39
+ ```matlab
40
+ % 1. Setup grid parameters.
41
+ N = 101; % Number of grid points (NxN grid)
42
+ dx = 0.001; % Grid spacing in meters (1 mm, for example)
43
+ c = 1540; % Speed of sound in m/s (uniform medium)
44
+
45
+ % 2. Create the slowness map (1/velocity).
46
+ f = ones(N, N, 'single', 'gpuArray') / c;
47
+
48
+ % 3. Initialize the time-of-flight field.
49
+ u_init = inf(N, N, 'single', 'gpuArray'); % Unknown points set to infinity.
50
+
51
+ % Set a point source at the center of the grid to time = 0.
52
+ center_idx = ceil(N/2);
53
+ u_init(center_idx, center_idx) = 0;
54
+
55
+ % 4. Compute the numerical solution using eiko.
56
+ u_numerical = eiko(u_init, f, dx);
57
+
58
+ % 5. Visualize the result.
59
+ % Create physical coordinate axes in millimeters using dx
60
+ axis_mm = ((1:N) - center_idx) * dx * 1000;
61
+
62
+ % Set up plot.
63
+ figure;
64
+ imagesc(axis_mm, axis_mm, u_numerical * 1e6);
65
+ axis image;
66
+
67
+ % Format axes and text size.
68
+ title('Time-of-Flight Field', 'FontSize', 14, 'FontWeight', 'bold');
69
+ xlabel('x (mm)', 'FontSize', 12, 'FontWeight', 'bold');
70
+ ylabel('y (mm)', 'FontSize', 12, 'FontWeight', 'bold');
71
+
72
+ % Format colorbar.
73
+ cb = colorbar;
74
+ cb.Label.String = 'Time (\mus)';
75
+ cb.Label.FontSize = 12;
76
+ ```
77
+ For 3D inputs, call `eiko3d`.
78
+
79
+ ### Python example
80
+
81
+ ```python
82
+ from eiko import eiko
83
+
84
+ # 1. Setup device and grid parameters.
85
+ device = torch.device("cuda")
86
+ N = 101
87
+ dx = 0.001 # Grid spacing in meters (1 mm)
88
+ c = 1540.0 # Speed of sound in m/s (uniform medium)
89
+
90
+ # 2. Create the slowness map (1/velocity) on the device.
91
+ f = torch.full((N, N), 1.0 / c, dtype=torch.float32, device=device)
92
+
93
+ # 3. Initialize the time-of-flight field.
94
+ # Unknown points are set to infinity
95
+ u_init = torch.full((N, N), float('inf'), dtype=torch.float32, device=device)
96
+
97
+ # Set a point source at the center of the grid to time = 0.
98
+ center_idx = N // 2
99
+ u_init[center_idx, center_idx] = 0.0
100
+
101
+ # 4. Compute the numerical solution.
102
+ u_numerical = eiko(u_init, f, dx=dx)
103
+ ```
104
+ For 3D inputs, use `from eiko import eiko3d`.
105
+
106
+
107
+ The result should look something like this:
108
+
109
+ ![Image of example](/images/eiko_example.png "Result of the example code.")
110
+
111
+ ## Project Layout
112
+ The files are as follows:
113
+ ```
114
+ Eiko/
115
+ ├── examples/ # Example scripts (tomography, lens design, etc.).
116
+ │ ├── matlab/ # MATLAB example scripts
117
+ │ └── python/ # Python example scripts
118
+ ├── matlab/ # MATLAB Eiko library
119
+ ├── python/ # Python Eiko library
120
+ ├── src/ # Core CUDA C++ Eiko implementation and interface
121
+ ├── pyproject.toml # Python package configuration (for pip install)
122
+ ├── setup.m # MATLAB compilation and setup script
123
+ ├── THEORY.md # Mathematical background and Eikonal algorithm details
124
+ └── README.md # This file
125
+ ```
126
+ To learn more about how Eiko works, see [THEORY](THEORY.md).
127
+
128
+ ## Citing
129
+ You can cite Eiko as
130
+ ```
131
+ @misc{eiko2026,
132
+ author = {Pr{\ae}sius, Sebastian},
133
+ title = {Eiko: the GPU-accelerated Eikonal equation solver},
134
+ year = {2026},
135
+ publisher = {GitHub},
136
+ journal = {GitHub repository},
137
+ howpublished = {\url{https://github.com/sebftw/Eiko}}
138
+ }
139
+ ```
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: eiko
3
+ Version: 0.8.0
4
+ Summary: Eiko: the GPU-accelerated Eikonal equation solver
5
+ Author-email: Sebastian Kazmarek Præsius <sebastian.devel@gmail.com>
6
+ License: BSD 3-Clause License
7
+
8
+ Copyright (c) 2026, Sebastian Kazmarek Præsius
9
+
10
+ Redistribution and use in source and binary forms, with or without
11
+ modification, are permitted provided that the following conditions are met:
12
+
13
+ 1. Redistributions of source code must retain the above copyright notice, this
14
+ list of conditions and the following disclaimer.
15
+
16
+ 2. Redistributions in binary form must reproduce the above copyright notice,
17
+ this list of conditions and the following disclaimer in the documentation
18
+ and/or other materials provided with the distribution.
19
+
20
+ 3. Neither the name of the copyright holder nor the names of its
21
+ contributors may be used to endorse or promote products derived from
22
+ this software without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ Project-URL: Homepage, https://github.com/sebftw/Eiko
35
+ Keywords: gpu,cuda,pytorch,jax,automatic differentiation,autodiff,time of flight,beamforming,shortest path,batch-processing,fast iterative Method,eikonal,eikonal equation,PDE,partial differential equations,scientific computing
36
+ Classifier: Development Status :: 4 - Beta
37
+ Classifier: Intended Audience :: Science/Research
38
+ Classifier: Intended Audience :: Developers
39
+ Classifier: License :: OSI Approved :: BSD License
40
+ Classifier: Operating System :: Microsoft :: Windows
41
+ Classifier: Operating System :: POSIX :: Linux
42
+ Classifier: Programming Language :: Python :: 3
43
+ Classifier: Programming Language :: Python :: 3.8
44
+ Classifier: Programming Language :: Python :: 3.9
45
+ Classifier: Programming Language :: Python :: 3.10
46
+ Classifier: Programming Language :: Python :: 3.11
47
+ Classifier: Environment :: GPU
48
+ Classifier: Environment :: GPU :: NVIDIA CUDA
49
+ Classifier: Topic :: Scientific/Engineering :: Physics
50
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
51
+ Requires-Python: >=3.8
52
+ Description-Content-Type: text/markdown
53
+ License-File: LICENSE
54
+ Requires-Dist: torch>=2.0.0
55
+ Requires-Dist: ninja
56
+ Provides-Extra: jax
57
+ Requires-Dist: jax[cuda12]; extra == "jax"
58
+ Requires-Dist: pybind11; extra == "jax"
59
+ Provides-Extra: jax-local
60
+ Requires-Dist: jax[cuda12_local]; extra == "jax-local"
61
+ Requires-Dist: pybind11; extra == "jax-local"
62
+ Provides-Extra: examples
63
+ Requires-Dist: matplotlib>=3.5.0; extra == "examples"
64
+ Requires-Dist: jax[cuda12_pip]; extra == "examples"
65
+ Requires-Dist: pybind11; extra == "examples"
66
+ Requires-Dist: optax; extra == "examples"
67
+ Requires-Dist: scipy>=1.7.0; extra == "examples"
68
+ Requires-Dist: numpy>=1.21.0; extra == "examples"
69
+ Requires-Dist: scikit-image; extra == "examples"
70
+ Requires-Dist: pyvista>=0.43.0; extra == "examples"
71
+ Requires-Dist: Pillow>=9.0.0; extra == "examples"
72
+ Provides-Extra: test
73
+ Requires-Dist: pytest>=7.0.0; extra == "test"
74
+ Requires-Dist: pytest-cov; extra == "test"
75
+ Requires-Dist: tox>=4.0.0; extra == "test"
76
+ Requires-Dist: vermin; extra == "test"
77
+ Dynamic: license-file
78
+
79
+ # Eiko
80
+ **Eiko** is a GPU-accelerated Eikonal equation solver, enabling fast
81
+ computation of the shortest time-of-flight through an arbitrary 2D or 3D medium.
82
+
83
+ A few reasons to use Eiko:
84
+ 1. Eiko is **fast** - up to 10x faster than comparable libraries.
85
+ 2. Eiko is **differentiable**, allowing it to be used with PyTorch or JAX.
86
+ 3. Eiko supports **advection**, allowing it to compute apodizations through a lens.
87
+
88
+ ![Image of example](/examples/python/comparison/fps_comparison.png "Comparison between Eiko and other solvers.")
89
+
90
+ ## Installation
91
+ ### Requirements
92
+ Because Eiko compiles custom CUDA kernels during installation, your system must have the following:
93
+ * **OS:** Linux or Windows
94
+ * **Hardware:** NVIDIA GPU
95
+ * **Compiler:**
96
+ * A C++ compiler (e.g., GCC for Linux, MSVC for Windows)
97
+ * The CUDA Toolkit (provides `nvcc`)
98
+
99
+ ### Installing for MATLAB
100
+ Run `setup.m` to install Eiko for MATLAB.
101
+
102
+ ### Installing for Python
103
+ Run
104
+ ```
105
+ pip install eiko
106
+ ```
107
+ You now have Eiko installed and ready for use.
108
+
109
+ See also [the Eiko Python installation guide](/python/PYTHON_INSTALLATION.md).
110
+
111
+ ## Quick Start
112
+ An example of how to use Eiko is shown below.
113
+ <br>
114
+ See [EXAMPLES](/examples/README.md) for many more examples.
115
+
116
+ ### MATLAB example
117
+ ```matlab
118
+ % 1. Setup grid parameters.
119
+ N = 101; % Number of grid points (NxN grid)
120
+ dx = 0.001; % Grid spacing in meters (1 mm, for example)
121
+ c = 1540; % Speed of sound in m/s (uniform medium)
122
+
123
+ % 2. Create the slowness map (1/velocity).
124
+ f = ones(N, N, 'single', 'gpuArray') / c;
125
+
126
+ % 3. Initialize the time-of-flight field.
127
+ u_init = inf(N, N, 'single', 'gpuArray'); % Unknown points set to infinity.
128
+
129
+ % Set a point source at the center of the grid to time = 0.
130
+ center_idx = ceil(N/2);
131
+ u_init(center_idx, center_idx) = 0;
132
+
133
+ % 4. Compute the numerical solution using eiko.
134
+ u_numerical = eiko(u_init, f, dx);
135
+
136
+ % 5. Visualize the result.
137
+ % Create physical coordinate axes in millimeters using dx
138
+ axis_mm = ((1:N) - center_idx) * dx * 1000;
139
+
140
+ % Set up plot.
141
+ figure;
142
+ imagesc(axis_mm, axis_mm, u_numerical * 1e6);
143
+ axis image;
144
+
145
+ % Format axes and text size.
146
+ title('Time-of-Flight Field', 'FontSize', 14, 'FontWeight', 'bold');
147
+ xlabel('x (mm)', 'FontSize', 12, 'FontWeight', 'bold');
148
+ ylabel('y (mm)', 'FontSize', 12, 'FontWeight', 'bold');
149
+
150
+ % Format colorbar.
151
+ cb = colorbar;
152
+ cb.Label.String = 'Time (\mus)';
153
+ cb.Label.FontSize = 12;
154
+ ```
155
+ For 3D inputs, call `eiko3d`.
156
+
157
+ ### Python example
158
+
159
+ ```python
160
+ from eiko import eiko
161
+
162
+ # 1. Setup device and grid parameters.
163
+ device = torch.device("cuda")
164
+ N = 101
165
+ dx = 0.001 # Grid spacing in meters (1 mm)
166
+ c = 1540.0 # Speed of sound in m/s (uniform medium)
167
+
168
+ # 2. Create the slowness map (1/velocity) on the device.
169
+ f = torch.full((N, N), 1.0 / c, dtype=torch.float32, device=device)
170
+
171
+ # 3. Initialize the time-of-flight field.
172
+ # Unknown points are set to infinity
173
+ u_init = torch.full((N, N), float('inf'), dtype=torch.float32, device=device)
174
+
175
+ # Set a point source at the center of the grid to time = 0.
176
+ center_idx = N // 2
177
+ u_init[center_idx, center_idx] = 0.0
178
+
179
+ # 4. Compute the numerical solution.
180
+ u_numerical = eiko(u_init, f, dx=dx)
181
+ ```
182
+ For 3D inputs, use `from eiko import eiko3d`.
183
+
184
+
185
+ The result should look something like this:
186
+
187
+ ![Image of example](/images/eiko_example.png "Result of the example code.")
188
+
189
+ ## Project Layout
190
+ The files are as follows:
191
+ ```
192
+ Eiko/
193
+ ├── examples/ # Example scripts (tomography, lens design, etc.).
194
+ │ ├── matlab/ # MATLAB example scripts
195
+ │ └── python/ # Python example scripts
196
+ ├── matlab/ # MATLAB Eiko library
197
+ ├── python/ # Python Eiko library
198
+ ├── src/ # Core CUDA C++ Eiko implementation and interface
199
+ ├── pyproject.toml # Python package configuration (for pip install)
200
+ ├── setup.m # MATLAB compilation and setup script
201
+ ├── THEORY.md # Mathematical background and Eikonal algorithm details
202
+ └── README.md # This file
203
+ ```
204
+ To learn more about how Eiko works, see [THEORY](THEORY.md).
205
+
206
+ ## Citing
207
+ You can cite Eiko as
208
+ ```
209
+ @misc{eiko2026,
210
+ author = {Pr{\ae}sius, Sebastian},
211
+ title = {Eiko: the GPU-accelerated Eikonal equation solver},
212
+ year = {2026},
213
+ publisher = {GitHub},
214
+ journal = {GitHub repository},
215
+ howpublished = {\url{https://github.com/sebftw/Eiko}}
216
+ }
217
+ ```
@@ -0,0 +1,19 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ eiko.egg-info/PKG-INFO
6
+ eiko.egg-info/SOURCES.txt
7
+ eiko.egg-info/dependency_links.txt
8
+ eiko.egg-info/requires.txt
9
+ eiko.egg-info/top_level.txt
10
+ python/eiko/__init__.py
11
+ python/eiko/animate_eikonal.py
12
+ python/eiko/eiko_jax.py
13
+ python/eiko/eiko_torch.py
14
+ src/BatchedFIMSolver.cuh
15
+ src/eiko_dispatch.cuh
16
+ src/eiko_kernels.cuh
17
+ src/bindings/jax_bindings.cu
18
+ src/bindings/mex_bindings.cu
19
+ src/bindings/torch_bindings.cu
@@ -0,0 +1,27 @@
1
+ torch>=2.0.0
2
+ ninja
3
+
4
+ [examples]
5
+ matplotlib>=3.5.0
6
+ jax[cuda12_pip]
7
+ pybind11
8
+ optax
9
+ scipy>=1.7.0
10
+ numpy>=1.21.0
11
+ scikit-image
12
+ pyvista>=0.43.0
13
+ Pillow>=9.0.0
14
+
15
+ [jax]
16
+ jax[cuda12]
17
+ pybind11
18
+
19
+ [jax-local]
20
+ jax[cuda12_local]
21
+ pybind11
22
+
23
+ [test]
24
+ pytest>=7.0.0
25
+ pytest-cov
26
+ tox>=4.0.0
27
+ vermin
@@ -0,0 +1 @@
1
+ eiko