Commit Graph

54 Commits

Author SHA1 Message Date
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
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 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 0bee9be6c7 Extend CSC/CSR * Dense to work for combinations of ref and owned 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 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 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 aad2216c56 Initial port from nalgebra::CsCholesky factorization to CscCholesky 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 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 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 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 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 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