Commit Graph

34 Commits

Author SHA1 Message Date
Anton Arsenij 757b99e843
CSC: Create constructor for unsorted but otherwise valid data (#1015)
* CSC: Create constructor for unsorted but otherwise valid data

* Test creating csc matrix from unsorted but valid data

* Add function for validation and sorting

* Move validation function to cs.rs

* Restore pattern unit test

* Add unit test for 'major offset out of bounds' case

* Avoid permutation allocations on 'happy path'

* Reuse allocated permutation

* Fix comments for test-data examples

* Remove unnecessary iter variable

* Set up buffers for sorting up front

* Use common apply_permutation function

* Use common compute_sort_permutation function

* Move unsafe down to unchecked call

* Add panic cases to documentation

* Remove unnecessary Zero bound

* Move buffer set up away from loop

* Lift T::Zero from cs.rs

* Improve checking if values are provided

* Simplify copying from slices & add test for wrong values length

* Check duplicates after sorting

* Fix formatting

* Check values length at the beginning

* Check length of values if values != None
2022-03-03 10:14:16 +01:00
Andreas Longva 1b73b2f991 Link to matrix market IO in lib.rs 2021-12-01 11:07:47 +01:00
Hantao Hui 7f9128c92d added reading matrix market data to sparse coomatrix 2021-11-02 10:59:59 +01:00
Rémi Lauzier c35f792b4f
Fix some warnings 2021-07-27 19:24:55 -04:00
Violeta Hernández 6e96c28ad9 Trivial doc comment improvements 2021-07-06 21:05:25 -05:00
Paul Jakob Schroeder e6e7efba8a COO: add push_matrix fn
- This function allows one to add entire dense matrices
to a sparse COO matrix.
- Added a small mention of this new function in the
example in lib.rs
2021-06-08 10:05:50 -04:00
Malte Tammena 9fb963017f Simplify default `#[must_use]` annotation 2021-06-07 16:34:03 +02:00
Malte Tammena 42a2c74571 Finish initial must_use annotations 2021-06-06 15:28:37 +02:00
Crozet Sébastien 660106255c nalgebra-sparse: re-export nalgebra. 2021-02-25 11:14:44 +01:00
Crozet Sébastien 98ae4f3818 nalgebra-sparse: reexport CooMatrix, CscMatrix, and CsrMatrix at the root of the crate. 2021-02-25 11:03:47 +01:00
Andreas Longva 2d11b90149 Address review concerns: doc link, Csr/CScMatrix::pattern docs 2021-02-01 08:41:37 +01:00
Andreas Longva bda8207ffd Rename to_value to into_value (clippy suggestion) 2021-01-26 10:11:24 +01:00
Andreas Longva 7473d54d74 rustfmt 2021-01-26 10:11:24 +01:00
Andreas Longva 7b6333e9d1 Rename some Csr/Csc/SparsityPattern methods 2021-01-26 10:11:24 +01:00
Andreas Longva afcad0ccc8 Documentation for CsrMatrix 2021-01-26 10:11:24 +01:00
Andreas Longva 74cd0283eb Partial top-level documentation 2021-01-26 10:11:24 +01:00
Andreas Longva 15c4382fa9 Docs for most items in nalgebra-sparse 2021-01-26 10:11:24 +01:00
Andreas Longva 84557d8046 Implement matrixcompare traits for sparse matrices 2021-01-26 10:11:24 +01:00
Andreas Longva aad2216c56 Initial port from nalgebra::CsCholesky factorization to CscCholesky 2021-01-26 10:11:24 +01:00
Andreas Longva dbdf5567fc Implement arithmetic operations for CSC matrices 2021-01-26 10:11:24 +01:00
Andreas Longva b59c4a3216 Refactor most of Csr/CscMatrix logic into helper type CsMatrix
Still need to update CSC API so that it mirrors CsrMatrix
in terms of get_entry and so on.
2021-01-26 10:11:24 +01:00
Andreas Longva 921686c490 Rename CsrMatrix::get(_mut) to get_entry(_mut) and change semantics 2021-01-26 10:11:24 +01:00
Andreas Longva 95ee65fa8e Implement remaining conversions (missing docs) 2021-01-26 10:11:24 +01:00
Andreas Longva 54329146c9 Initial COO <-> Dense conversion routines 2021-01-26 10:11:24 +01:00
Andreas Longva 46442d6060 Initial basic proptest support for CooMatrix (missing tests) 2021-01-26 10:11:24 +01:00
Andreas Longva ec339f9108 Implement CSC matrix basic API
The CSC matrix API mirrors the CSR matrix API. However, there
are subtle differences throughout (both in the available
methods and the implementation) that I believe makes any attempt
to avoid the duplicate effort futile.
2021-01-26 10:11:24 +01:00
Andreas Longva 082416e3ec Make SparseFormatErrorKind #[non_exhaustive] 2021-01-26 10:11:24 +01:00
Andreas Longva df1ef991f3 Test SparsityPattern and CSR try_* constructors 2021-01-26 10:11:24 +01:00
Andreas Longva ff435110b9 Implement CSR::disassemble and SparsityPattern::disassemble 2021-01-26 10:11:24 +01:00
Andreas Longva a15e78a6b7 Put COO, CSR, SparsityPattern and related types in their own modules
This mimics how std does it, e.g. std::vec::Vec. This avoids potential
problems down the road, where adding more types might clutter the
API interface and generated documentation.
2021-01-26 10:11:24 +01:00
Andreas Longva 7a5f8ef1ea Redesign error handling for CSR and SparsityPattern construction
SparsityPattern's constructor now returns a fine-grained error
enum that enumerates possible errors. We use this to build a more
user-friendly error when constructing CSR matrices.

We also overhauled the main SparseFormatError error type by
making it a struct containing a *Kind type and an underlying error
that contains the message.
2021-01-26 10:11:24 +01:00
Andreas Longva 7e94a1539a Add an (incomplete) overview of planned functionality for nalgebra-sparse
The way it is currently written is temporary, but it helps structure
the work towards an initial MVP.
2021-01-26 10:11:24 +01:00
Andreas Longva 7f5b702a49 CSR row access and iterators 2021-01-26 10:11:24 +01:00
Andreas Longva 1dbccfeb7c Initial COO implementation 2021-01-26 10:11:24 +01:00