Comments (3)
The sparsity pattern is stored as a vector of integers where:
- The first two elements are the dimensions (nrow, ncol)
- The following (ncol+1) entries are the nonzero offset for each column. Note that this means that the (ncol+3)-th entry is the total number of nonzeros (nnz)
- The last nnz entries are the row index for each nonzero. Indices are increasing for each column, with no duplicates
For a dense matrix, we have nnz=nrow * ncol, which can easily be checked, and the last part is superfluous information. So you can decrease the storage needs from (2+(ncol+1)+nrow * ncol) to (2+(ncol+1)). The problem is that every algorithm where sparsity is used needs to be specialized to handle the dense case separately. Currently, many common algorithms are, like matrix multiplication, but not all. For maintainability reasons, I would be against implementing the more compact storage (which is easy and quick to do) unless we go through all algorithms in CasADi where sparsity is being used and update them accordingly. You can of course implement it yourself in your own fork of CasADi.
It's possible to get an even more compact representation, or if you want to support something like triangular patterns or higher order tensors, by letting the third element of the sparsity vector be something else than zero. It's always zero now by definition. But again, this generation would need to be propagated everywhere in a maintainable way.
from casadi.
Okay, thanks for the feedback! I'll leave this open for now since it seems like a valid feature.
from casadi.
Okay, thanks for the feedback! I'll leave this open for now since it seems like a valid feature.
It would be a useful feature. It's usually hard to get funding for features that would "benefit a lot of users a little" as opposed to "benefit a few users a lot". That's the situation with a lot of potential core improvements.
from casadi.
Related Issues (20)
- Investigate Jacobian inconsistency HOT 5
- Bolo
- fast_newton and newton documentation mixed up.
- Explore possibility for Rust interface
- Vias
- Relocabality of CasADi HOT 5
- CasADi 3.6.6 Crashes on macOS with EXC_BAD_ACCESS (SIGKILL) HOT 1
- Implement find_functions(MX)
- OptiStack "Constraint must contain decision variables" for constraints `g(x,p) <= 0` but works for `lbx <= g(x,p) <= ubx`.
- Opti.to_function() print-options are ignored HOT 3
- DaeBuilder/FMU issue with tunable parameters HOT 2
- Casadi on Mac M1 installation issue. HOT 2
- FATROP codegen print should redirect to CASADI_PRINTF
- Cannot hash for vectors HOT 5
- how to use two mpc in one project using C++
- Cse should identify identical Functions
- FATROP / Python: Program freezes after inf evaluations HOT 2
- FATROP parallel run check
- Segmentation Fault when using graph_substitute for MX function
- race_car.cpp example crashes on Mac without explicit cast
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 casadi.