Commit Graph

2673 Commits

Author SHA1 Message Date
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
Andreas Longva
646f62a293 rustfmt (nalgebra) 2021-01-26 09:49:01 +01:00