diff --git a/README.md b/README.md index c5238fa..066d968 100644 --- a/README.md +++ b/README.md @@ -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 @@ -85,4 +94,4 @@ illustrative. Use e.g. `nosetests` to run the tests. ## Contributors * Fredrik Hellman -* Tim Keil +* Tim Keil \ No newline at end of file diff --git a/gridlod/func.py b/gridlod/func.py index 1ec58dc..a4c0f19 100644 --- a/gridlod/func.py +++ b/gridlod/func.py @@ -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 @@ -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 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..87506df --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +numpy==1.23.4 +scikit-sparse==0.4.7 +scipy==1.9.3