Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,20 @@ usage.

## Required packages

These packages might be needed:
These `python` packages are needed:
* `scikit-sparse`
* `numpy`
* `scipy`

For installing [`scikit-sparse`](https://github.com/scikit-sparse/scikit-sparse),
the library `suite-sparse` is required.
As also highlighted [here](https://github.com/scikit-sparse/scikit-sparse),
there may appear problems installing `scikit-sparse` on a Mac,
which is due to the `suite-sparse` location not being installed at the right place.
For fixing this, just find out your `lib` and `include` directory of your `suite-sparse`
and use the respective `pip install` command which defines
`SUITESPARSE_INCLUDE_DIR` and `SUITESPARSE_LIBRARY_DIR` manually.

## Getting started
You can find some examples on how to use it in the test directory
`test`. See e.g. the example in `gridlod/test/test_pgexamples.py`. The
Expand Down Expand Up @@ -85,4 +94,4 @@ illustrative. Use e.g. `nosetests` to run the tests.
## Contributors

* Fredrik Hellman
* Tim Keil
* Tim Keil
4 changes: 2 additions & 2 deletions gridlod/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def evaluateCQ1(N, cq1, coordinates):
interpolationWeights = np.zeros((coordinates.shape[0], 2**d))
for localNode in range(2**d):
localNodeBinaryString = bin(localNode)[2:].zfill(d)[::-1]
localNodeBitmap = np.array([0 if bit is '0' else 1 for bit in localNodeBinaryString])
localNodeBitmap = np.array([0 if bit == '0' else 1 for bit in localNodeBinaryString])

# This computes the value of the basis function at node
# localNode for all points. It is a product of either x_k or
Expand Down Expand Up @@ -97,7 +97,7 @@ def evaluateCQ1D(N, cq1, coordinates):
interpolationWeights = np.zeros((coordinates.shape[0], 2**d, d))
for localNode in range(2**d):
localNodeBinaryString = bin(localNode)[2:].zfill(d)[::-1]
localNodeBitmap = np.array([0 if bit is '0' else 1 for bit in localNodeBinaryString])
localNodeBitmap = np.array([0 if bit == '0' else 1 for bit in localNodeBinaryString])
for dimensionToDifferentiate in range(d):
# These are the factors x_k or (1-x_k)
interpolationWeightsFactors = (1.0 - localNodeBitmap) + (2.0*localNodeBitmap - 1.0)*coordIndicesFpart
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
numpy==1.23.4
scikit-sparse==0.4.7
scipy==1.9.3