Skip to content

Commit 92f2b21

Browse files
committed
2 parents 155e1d2 + 45d4e11 commit 92f2b21

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,40 @@
22
[![Build Status](https://github.com/janbruedigam/GraphBasedSystems.jl/workflows/CI/badge.svg)](https://github.com/janbruedigam/GraphBasedSystems.jl/actions?query=workflow%3ACI)
33
[![codecov](https://codecov.io/gh/janbruedigam/GraphBasedSystems.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/janbruedigam/GraphBasedSystems.jl)
44

5-
An experimental package for efficiently solving linear systems of equations based on graph properties.
5+
A package for efficiently solving linear systems of equations based on graph properties. Any matrix representing an underlying real-world system can be represented by a graph, for example a mechanical system, checmical molecules, neural networks, ... The code of the package is currently used for the robotics simulator [Dojo.jl](https://github.com/dojo-sim/Dojo.jl)
6+
7+
By providing the adjacency matrix of a graph-based system, the `GraphBasedSystems` package can automatically exploit the existing sparsity when solving the linear system to speed up calculations. Currently, the LU and LDU decomposition/backsubstitution are implemented.
8+
9+
```julia
10+
using GraphBasedSystems
11+
12+
graph_matrix = [ # The adjacency matrix for the underlying graph
13+
0 1 1 0
14+
1 0 1 0
15+
1 1 0 1
16+
0 0 1 0
17+
]
18+
19+
dimensions = [2; 3; 0; 1] # The dimension of row/column
20+
21+
system = System{Float64}(graph_matrix, dimensions) # The resulting linear system
22+
23+
for entry in system.matrix_entries.nzval # Randomize all matrix entries
24+
GraphBasedSystems.randomize!(entry)
25+
end
26+
system.matrix_entries[1,2].value = rand(2,3) # Directly set the value of a matrix entry
27+
28+
for entry in system.vector_entries # Randomize all vector entries
29+
GraphBasedSystems.randomize!(entry)
30+
end
31+
system.vector_entries[4].value = rand(1) # Directly set the value of a vector entry
32+
33+
A = full_matrix(system) # Inspect the matrix
34+
b = full_vector(system) # Inspect the vector
35+
36+
lu_solve!(system) # Solve the system inplace
37+
38+
x = full_vector(system) # Inspect the result
39+
x - A\b # Compare to classical implementation
40+
41+
```

0 commit comments

Comments
 (0)