Comments (1)
Sounds like a bad idea, but if you know what you are doing, you can just use the ichol(A).L.todense()
. Note that this is a colossal waste of memory and if all you want is to solve a linear system like decomposition = ichol(A); x = decomposition(b)
instead, which executes backwards substitution on the sparse
pymatting/pymatting/preconditioner/ichol.py
Line 177 in b5f03a2
Disclaimer: Bad example, don't do this!
import numpy as np
import scipy.sparse
from pymatting import ichol
# Create a symmetric, positive definite matrix
n = 100
np.random.seed(0)
A = np.random.rand(n, n)
# Remove a few values of A to make it more sparse
A[np.random.rand(*A.shape) < 0.98] = 0
A += A.T + n * np.eye(n)
A_sparse = scipy.sparse.csr_matrix(A)
decomposition = ichol(A_sparse, discard_threshold=0.0)
# This constructs a scipy.sparse.csr_matrix
L_sparse = decomposition.L
# The following is not recommended because it constructs
# a dense matrix from a sparse matrix, which is a colossal waste of memory.
# If you just want to solve a linear system like
# A x = L L^T x = b,
# call the decomposition object like `x = decomposition(b)`
L_dense = L_sparse.toarray()
# Compute element-wise mean squared error to dense Cholesky decomposition
mse = np.mean(np.square(L_dense - np.linalg.cholesky(A)))
# Should be very small
print(mse)
from pymatting.
Related Issues (20)
- [Question❓] All unknown region input HOT 11
- Make PyMatting available on conda-forge HOT 4
- How to run Alpha Matting on GPU? I couldn't find anything on it. There is GPU support but how to enable that? HOT 5
- `setup.py` should define actual dependencies HOT 5
- Tests require missing images HOT 4
- [Question❓]is there a way to speed it up? HOT 6
- [Question❓] ValueError: Conjugate gradient descent did not converge within 10000 iterations HOT 7
- ValueError: Trimap did not contain background values (values <= 0.100000) HOT 1
- здравствуйте Изображения не включены напрямую по причинам лицензирования а если по кнопки это вреде не нарушает лицензирования [Question❓] HOT 2
- Hello, the images are not included directly for licensing reasons, and if the buttons are like in the picture, it does not violate licensing. [Question❓] HOT 1
- [Question❓]how can i improve image edge quality HOT 13
- [Question❓] next release? HOT 1
- Tell us about your projects! 🚀
- [Question❓] randomness/stochasticity in `estimate_foreground_ml`? HOT 3
- [Question❓] pymatting is slow running on A100 HOT 3
- [Question❓] Foreground transparency issue HOT 2
- estimate_alpha_cf gpu or speedup[Question❓] HOT 1
- too small images in building the knn-laplacian[BUG 🐛] HOT 1
- Too long time on the first import. How can I shift this time to installation? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymatting.