Commit Graph

241 Commits

Author SHA1 Message Date
Andreas Longva 1b73b2f991 Link to matrix market IO in lib.rs 2021-12-01 11:07:47 +01:00
Andreas Longva 3b67afcd9b Matrix market: Extend and reword documentation, rename some types 2021-12-01 11:07:13 +01:00
Hantao Hui 1cc5c7eba6 fix doc typo 2021-11-23 16:17:06 +01:00
Hantao Hui 920bd75b82 fix typo 2021-11-18 11:42:47 +01:00
Hantao Hui 332fe8c0e4 update loading matrix market, including:
1. Several renamings
2. removed unnecessary traits
3. added support for dense matrix
4. removed unnecessary comparison when reading data line by line. (e.g.
   only read header line once)
2021-11-17 16:41:10 +01:00
Hantao Hui 7f9128c92d added reading matrix market data to sparse coomatrix 2021-11-02 10:59:59 +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 f90bb8d64a Fix wrong csr-constructor call 2021-10-18 10:59:51 +02:00
Anton 86eeb192db Add module for unit test data examples 2021-10-17 22:29:59 +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
Sébastien Crozet d1d7422761 Bump the version of nalgebra-glm, nalgebra-lapack, and nalgebra-sparse. 2021-08-08 18:07:34 +02:00
Sébastien Crozet db63f6c031 Release v0.29.0 2021-08-08 17:54:35 +02:00
Sébastien Crozet 0b9a1acea5 Fix nalgebra-sparse. 2021-08-04 18:20:55 +02:00
Sébastien Crozet dd6c40016e Remove the Copy requirement from SimdRealField. 2021-08-04 17:34:25 +02:00
Sébastien Crozet 492ed8cc8d Fix nalgebra-sparse 2021-08-03 10:58:23 +02:00
Sébastien Crozet 8c6ebf2757 Implement the single-allocator-trait approach. 2021-08-02 18:41:46 +02:00
Sébastien Crozet d34fed45bc Merge branch 'dev' into ub3 2021-08-02 18:40:33 +02:00
Violeta Hernández 2243a11e89 Added some derives 2021-07-29 12:33:45 -05:00
Rémi Lauzier c35f792b4f
Fix some warnings 2021-07-27 19:24:55 -04:00
Violeta Hernández a753d84aae cargo fmt 2021-07-17 21:50:06 -05:00
Violeta Hernández c01d591478 We have reached compilation! 2021-07-17 13:01:03 -05:00
Violeta Hernández 87fe2b30df Checkpoint #9 2021-07-16 23:17:56 -05:00
Violeta Hernández c3f869e017 Checkpoint #8 2021-07-16 01:53:28 -05:00
Crozet Sébastien ca1297acfb Release v0.28.0 2021-07-11 17:42:45 +02: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 9eb9ad603f Add `get_mut` annotations (second try) 2021-06-07 17:24:43 +02: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 dfc8ad3d6a Release v0.27.0 2021-06-02 15:15:17 +02:00
Dave Farnham 79ef862fe9 Fix docs on csc_data(), csc_data_mut() 2021-05-09 14:58:26 -06:00
Sébastien Crozet d67aec80fd
Merge pull request #885 from chammika-become/coo-reserve
CooMatrix::reserve added
2021-05-09 16:58:43 +02:00
Andreas Longva b85335bd9c Update matrixcompare version to 0.3.0
Fixes some warnings produced by earlier versions since Rust 1.51.
See https://github.com/Andlon/matrixcompare/pull/5 for more details.

Note that we only update dev-dependencies, so there is no API breakage.
2021-05-07 09:23:46 +02:00
Chammika Mannakkara 5d638a32b8 correct all gramatical mistakes pointed by @Andlon 2021-05-04 12:29:25 +09:00
Chammika Mannakkara c420afde9e CooMatrix::reserve added 2021-05-02 20:43:16 +09:00
Crozet Sébastien c5c6c139ab Release v0.26.0 2021-04-12 16:15:08 +02:00
Crozet Sébastien 24d546d3b6 Rename generic parameter N -> T 2021-04-11 13:57:54 +02:00
Crozet Sébastien 7fdac06365 Fix cargo metadata to allow publishing nalgebra-lapack and nalgebra-sparse. 2021-03-01 14:49:03 +01:00
Crozet Sébastien 5b9b94c610 Release v0.25.0 2021-03-01 14:25:29 +01:00
Crozet Sébastien 80aa4faa38 Fix tests for nalgebra-sparse. 2021-03-01 12:42:54 +01:00
Crozet Sébastien 6cfd2bca14 Use proptest for all nalgebra tests. 2021-02-28 17:52:14 +01:00
Crozet Sébastien 660106255c nalgebra-sparse: re-export nalgebra. 2021-02-25 11:14:44 +01:00
Crozet Sébastien c6f7cae326 Move COO, CSC, CSR constructor at the top of the impls. 2021-02-25 11:11:29 +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 66b9185ec1 Test CsrMatrix::row_iter(_mut) and CscMatrix::col_iter(_mut) 2021-02-01 14:38:11 +01:00
Andreas Longva 1ebb612d46 Test Csr/CscMatrix::{index_entry, index_entry_mut, get_entry, get_entry_mut} 2021-02-01 09:27:33 +01:00
Andreas Longva 0936c4fad9 Add tests for Csr/CscMatrix::identity 2021-02-01 08:52:13 +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 7bef417f99 Use nalgebra/proptest-support instead of /proptest in nalgebra-sparse 2021-01-26 10:11:24 +01:00
Andreas Longva e7975ce09a Rebase and update nalgebra version for nalgebra-sparse 2021-01-26 10:11:24 +01:00
Andreas Longva 7473d54d74 rustfmt 2021-01-26 10:11:24 +01:00
Andreas Longva 795d818ae5 Improve documentation of errors and panics 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 ccf1f18991 Merge SolveError into OperationError 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 cf1bd284f1 Improve ops docs 2021-01-26 10:11:24 +01:00
Andreas Longva f98e64aafd Improve docs for SparsityPattern 2021-01-26 10:11:24 +01:00
Andreas Longva cf220c9d2b Improve docs for CooMatrix 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 0bee9be6c7 Extend CSC/CSR * Dense to work for combinations of ref and owned 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 1fa0de92ae Preserve column dim type in CSR * Dense
This is necessary so that CSR * Vector == Vector (before it would
also yield a DMatrix).
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 7a083d50f7 Increase tolerance to ensure tests pass
It's possible that some particularly bad inputs cause
severe loss of significance in the triangular solves.
This is exacerbated by the fact that the way we test
the (residual) error is also prone to loss of significance,
so that the error measure itself is problematic.

We could maybe improve this in the future by using arbitrary-
precision arithmetic to remove some sources of error and testing
against appropriate bounds.
2021-01-26 10:11:24 +01:00
Andreas Longva 31c911d4fb Change proptest strategies to use DimRange 2021-01-26 10:11:24 +01:00
Andreas Longva 9cd1540496 Improve and test proptest generators
Due to a bug in proptest, we were required to pull in and modify
parts of proptest::strategy::Shuffle. Once the below PR has been merged
and released on crates.io, we can remove this code.

https://github.com/AltSysrq/proptest/pull/217
2021-01-26 10:11:24 +01:00
Andreas Longva 3eab45d81b Replace spmm_pattern with spmm_{csr/csc}_pattern 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 9b46a43c7f Add proptest regressions 2021-01-26 10:11:24 +01:00
Andreas Longva fc0c22bf78 Add CscCholesky::solve and ::solve_mut 2021-01-26 10:11:24 +01:00
Andreas Longva d6b4f1ac2f Add CscCholesky::factor_numerical 2021-01-26 10:11:24 +01:00
Andreas Longva cd9c3baead Clean up CscCholesky 2021-01-26 10:11:24 +01:00
Andreas Longva 4b395523dd Fix issue with UninitVec and zero-sized types 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 3b1303d1e0 Implement lower/upper triangular solve for CSC matrices 2021-01-26 10:11:24 +01:00
Andreas Longva c988ebb4e7 Fail test compilation if compare feature is missing 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 3453577a16 Use matrixcompare 0.2 with prop_assert_matrix_eq in Cholesky test 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 6e34c23d05 Implement Csr/CscMatrix::identity 2021-01-26 10:11:24 +01:00
Andreas Longva ea6c1451b4 Rename Op::unwrap to Op::into_inner 2021-01-26 10:11:24 +01:00
Andreas Longva 885480a634 Implement CSR/CSC * Dense std operations 2021-01-26 10:11:24 +01:00
Andreas Longva b7a7f967b8 Implement Neg, Div, DivAssign for Csr/CscMatrix 2021-01-26 10:11:24 +01:00
Andreas Longva 0b4356eb0e Implement Sub for Csr/CscMatrix 2021-01-26 10:11:24 +01:00
Andreas Longva 7aeb663165 Implement matrix-scalar multiplication 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 6a1d12705f Remove old .get() API for CscMatrix in favor of entry API
This essentially makes the API of CscMatrix analogous to
that of CsrMatrix.
2021-01-26 10:11:24 +01:00
Andreas Longva e261e7c388 Remove use of unsafe for CsLaneIterMut 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 8983027b39 Minor refactoring for sp* ops 2021-01-26 10:11:24 +01:00
Andreas Longva 66cbd26702 Add prealloc suffix to spmm_csr and spadd_csr
The suffix is intended to communicate that these methods
assume `preallocated` storage, i.e. they try to store the
result in a matrix which already has the correct sparsity
pattern for the operation.
2021-01-26 10:11:24 +01:00
Andreas Longva 4af3fcbdd3 Reorder parameters in ops to intuitive order 2021-01-26 10:11:24 +01:00
Andreas Longva 061024ab1f Improve Ops API 2021-01-26 10:11:24 +01:00
Andreas Longva fe8592fde1 Refactor ops to use new Op type instead of separate Transpose flag 2021-01-26 10:11:24 +01:00
Andreas Longva c6a8fcdee2 Simplify spadd_pattern API and name 2021-01-26 10:11:24 +01:00
Andreas Longva 6a100c085a Add proptest regressions 2021-01-26 10:11:24 +01:00
Andreas Longva b25848838b Implement CSR-CSR matrix multiplication 2021-01-26 10:11:24 +01:00
Andreas Longva d9cfe5cb3e Improve dimension assertions for spadd_csr 2021-01-26 10:11:24 +01:00
Andreas Longva 2d534a6133 Implement spmm_csr 2021-01-26 10:11:24 +01:00
Andreas Longva 9db17f00e7 Implement spmm_pattern 2021-01-26 10:11:24 +01:00
Andreas Longva c4285d9fb3 remove spmv_coo 2021-01-26 10:11:24 +01:00
Andreas Longva 41941e62c8 Implement CSR-CSR addition 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 4420237ede Implement spadd_build_pattern 2021-01-26 10:11:24 +01:00
Andreas Longva 7c68950614 Simplify transposition API in spmm_csr_dense 2021-01-26 10:11:24 +01:00
Andreas Longva 1ae03d9ebb Implement spmm_csr_dense 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 6083d24dd6 Add csr, csc, sparsity_pattern proptest generators (untested) 2021-01-26 10:11:24 +01:00
Andreas Longva 41ce9a23df Remove CooMatrix::to_dense() and `Scalar` trait bound, add ::nnz() 2021-01-26 10:11:24 +01:00
Andreas Longva f20e764edc nalgebra-sparse: Move slow tests and imports into 'slow' child module
This way it's easier to prevent accidental unused imports when
running tests without the slow-tests feature.
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 7260f05b07 Improved CooMatrix proptest strategies 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 67aba82675 Update nalgebra version for nalgebra-sparse 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 4cd47327c9 Test that CSR::disassemble avoids cloning when possible 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 d98f2d2ad7 sparse-nalgebra: Update nalgebra version 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 b1199da206 Verify data validity in try_* constructors
We can easily create the CSR and CSC constructors by using the
SparsityPattern constructors. However, one lingering problem
is giving meaningful error messages. When forwarding error messages
from the SparsityPattern constructor, the error messages must
be written in terms of "major" or "minor" dimensions, and using
general terms like "lanes", instead of "rows" and "columns".
When forwarding these messages up to CSR or CSC constructors,
they are not directly meaningful to an end user. We should find
a better solution to this problem, so that end users get
more meaningful messages.
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 41425ae52c Use inline instead of inline(always) 2021-01-26 10:11:24 +01:00
Andreas Longva b0ffd55962 Initial CSR and SparsityPattern impls (WIP) 2021-01-26 10:11:24 +01:00
Andreas Longva 1dbccfeb7c Initial COO implementation 2021-01-26 10:11:24 +01:00