Comments (5)
Good question.
As of today there are three ways to handle diagonal elements of symmetric matrices:
- the default behavior: create two elements, the second is zero
- create two elements, both identical
- turn off FMM symmetry handling altogether and do it yourself
These are controlled by read_options::generalize_symmetry
and read_options::generalize_coordinate_diagnonal_values
, see
There is no "just one element" option at the moment because such an option is more tricky to implement than it seems, largely because there is no way to know how many diagonal elements there are without reading the entire file.
A common next step after loading is to convert to something like CSR, with a sum of duplicate elements. Hence the default behavior works well for that.
If you don't allow explicit zeros, then use your library's method to drop those. Again, that's often called anyway since the matrix market format allows explicit zeros.
If neither of those apply, then you can do what the Python bindings do. Disable FMM symmetry generalization, then do it yourself. Since you know your datastructure, you can iterate it to count how many elements need to be added, resize the matrix in whatever way your datastructure requires, and duplicate the non-diagonal elements.
Though having written that last paragraph and scanned through the code a little, it seems possible to add that feature for most already supported bindings, including the one you're using. I'll have a crack at it.
from fast_matrix_market.
Thank you very much for your reply, I did in fact convert the read to CSR format and skipped the handling of the zero elements. What I'm thinking is that there has to be a place for FMM or user call code to add additional judgment conditions, and perhaps a configuration option could be added to weed out the extra zero elements.
from fast_matrix_market.
I added an option to handle symmetric files at the binding level, and nearly all bindings (including the triplet one you're using) no longer create those zero elements.
@Rhythmicc The change is in main
and on by default, would you be able to test that it works for you?
from fast_matrix_market.
Sure, and my test results were fine.
from fast_matrix_market.
from fast_matrix_market.
Related Issues (20)
- Add Blaze bindings
- Support precision for writing floating-point
- Add GraphBLAS bindings
- `fmm.mmread(stream)` closes stream (`scipy.io.mmread(stream)` does not) HOT 1
- Is this a valid Matrix Market format? HOT 3
- `fmm.mmread` raises `ValueError` instead of `OverflowError` when reading integers that are too large HOT 1
- Add armadillo bindings HOT 7
- add this to scipy? HOT 5
- Controlling parallelism HOT 4
- Support skipping values HOT 2
- Evaluate mmap HOT 2
- R bindings [WIP] HOT 1
- Fix macOS complex value test fails
- Test C++23 Fixed width floating-point types
- QUERY: Giving credit HOT 4
- c++/9/thread:126: undefined reference to `pthread_create' HOT 3
- Python: fix clash with scipy 1.12's version of FMM HOT 1
- Possibility to use [gtest, eigen, blaze, etc] from system-wide if they are installed in compilation time and not duplicate after installation HOT 2
- Specify STATIC in add_library
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 fast_matrix_market.