David Stansby
c596e4985d
Make CSR/CSC matrix examples more self contained
2022-10-14 13:52:56 +01:00
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
Fabian Loeschner
99eb8c1589
Revert "Rename nrows/ncols args for try_from_*_data functions for consistency"
...
This reverts commit 2a3e657b56
.
2022-01-13 10:28:00 +01:00
Fabian Loeschner
89f1e855bb
Revert "Fix panic in SparsityPattern::try_from_* if major index is out of bounds"
...
This reverts commit 12afe2917af4c30fc4a17316e453d0830072642c to avoid conflict with #1015 .
2022-01-11 10:35:07 +01:00
Fabian Loeschner
38989ed5f0
Move sparse matrix serialization to separate files
2022-01-11 10:35:07 +01:00
Fabian Löschner
583fde05fe
Add comment explaining intermediate types for serialization
2022-01-11 10:35:07 +01:00
Fabian Löschner
fe70a80e41
Partial revert "Use custom serde errors, make all sparse errs lowercase"
2022-01-11 10:35:07 +01:00
Fabian Löschner
647455dadd
Move serialization code to submodules
2022-01-11 10:35:07 +01:00
Fabian Löschner
837ded932e
Replace usage of Cow with generic type
2022-01-11 10:35:07 +01:00
Fabian Löschner
9b87fa4ffa
Add cfg attribute to Cow imports
2022-01-11 10:35:07 +01:00
Fabian Löschner
a8fa7f71c0
Unify separate (de)serialization helper structs by using Cow<'a, [T]>
2022-01-11 10:35:07 +01:00
Fabian Loeschner
7e67d920a7
Use custom serde errors, make all sparse errs lowercase w/o punctuation
2022-01-11 10:35:07 +01:00
Fabian Loeschner
e9b7718292
Fix panic in SparsityPattern::try_from_* if major index is out of bounds
2022-01-11 10:35:07 +01:00
Fabian Loeschner
e2c33b48ac
Simplify Deserialize bound
2022-01-11 10:35:07 +01:00
Fabian Loeschner
2a3e657b56
Rename nrows/ncols args for try_from_*_data functions for consistency
2022-01-11 10:35:07 +01:00
Fabian Loeschner
40d8a904a3
Implement Serialize, Deserialize for Csc, Coo; move helper out of impls
2022-01-11 10:35:07 +01:00
Fabian Loeschner
18b694dad2
Move serialization helper structs into trait impls
2022-01-11 10:35:07 +01:00
Fabian Löschner
f9aca24b15
Implement Serialize and Deserialize for CsrMatrix
2022-01-11 10:35:07 +01:00
Anton
89416baace
Bring apply permutation function back to serial.rs
2021-10-20 20:28:38 +02:00
Anton
752d1f300d
Permute values without unnecessary allocation
2021-10-20 01:50:42 +02:00
Anton
4b41be75b0
Add tests for some csr matrix related failure cases
2021-10-14 23:18:34 +02:00
Anton
4a97989738
Improve checking requirements for sorting column indices
2021-10-11 23:01:12 +02:00
Anton
469765a4e5
Apply permutation
2021-10-08 00:36:40 +02:00
Anton
a2a55cddca
Check first and last offsets before sorting column indices
2021-10-05 00:07:04 +02:00
Anton
9e85c9e2b6
CSR/CSC: Provide constructor for unsorted but otherwise valid data
2021-10-03 14:59:28 +02: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
Malte Tammena
38e9a5da33
Annotate get_mut
/slice
-like functions with #[must_use]
2021-06-07 17:15:36 +02: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
c6f7cae326
Move COO, CSC, CSR constructor at the top of the impls.
2021-02-25 11:11:29 +01:00
Andreas Longva
2d11b90149
Address review concerns: doc link, Csr/CScMatrix::pattern docs
2021-02-01 08:41:37 +01:00
Andreas Longva
7473d54d74
rustfmt
2021-01-26 10:11:24 +01:00
Andreas Longva
5d5ed5be0b
Various minor doc and comment fixes
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
e8a35ddb62
CSC docs and improved CSR docs
2021-01-26 10:11:24 +01:00
Andreas Longva
afcad0ccc8
Documentation for CsrMatrix
2021-01-26 10:11:24 +01:00
Andreas Longva
cb0f9a5190
Add Csr/CscMatrix::pattern_and_values_mut()
2021-01-26 10:11:24 +01:00
Andreas Longva
c43a2b1679
Impl Csr/CscMatrix::into_pattern_and_values
2021-01-26 10:11:24 +01:00
Andreas Longva
e655fed4fa
Replace Arc<SparsityPattern> with SparsityPattern
...
After much deliberation, I have come to the conclusion that the
benefits do not really outweigh the added complexity. Even though
the added complexity is relatively minor, it makes it somewhat
more complicated to inter-op with other sparse linear algebra
libraries in the future.
2021-01-26 10:11:24 +01:00
Andreas Longva
ef3477f411
Remove Zero bound for transpose and impl SparsityPattern::transpose
2021-01-26 10:11:24 +01:00
Andreas Longva
5869f784e5
Implement CsrMatrix/CscMatrix::filter and associated helpers
...
Includes ::lower_triangle(), ::upper_triangle() and
::diagonal_matrix().
2021-01-26 10:11:24 +01:00
Andreas Longva
6e34c23d05
Implement Csr/CscMatrix::identity
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
830df6d07b
Implement Csr/CscMatrix::transpose()
2021-01-26 10:11:24 +01:00
Andreas Longva
8b7b836a37
Make CsrMatrix/CscMatrix::pattern() return reference
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
df1ef991f3
Test SparsityPattern and CSR try_* constructors
2021-01-26 10:11:24 +01:00