-
-
Notifications
You must be signed in to change notification settings - Fork 201
Closed
Description
I let this go stale, I'm going to fix it up so I can get it in now, the background is in pull request 1405. It needs to be two separate pull requests now, one for stan-dev/stan and one for stan-dev/math .
Fixes
- Make just one multiplication function---named "csr_matrix_times_vector"
-
csr_matrix_times_vectorneeds to be hardened. Right now, it is unsafe.-
v: check that each element is between 1 andn -
u: check that it's ordered, each element is greater than or equal to 1, that every element is less than or equal to length ofw -
z: check that each number is greater than or equal to 0. Sum is equal to length ofw. NOT doing this as the Eigen implementation I'm mirroring allows for unused entries of w. Instead:- 'z' implicitly check z by making sure calculations never run off the end of 'w' (check on "end" in code).
- 'b' implicitly checked by making sure v is checked against the number of columns.
-
- change explicit 1-index to
stan::error_index::value-- this is#defined as 1, but can be changed to 0 - Add a constructor of a dense matrix using the sparse format--named csr_to_dense_matrix
- Rename extractors to csr_extract_* this makes all functions in the group named as csr_*
- Add extractors for w/v/u/z that work from dense matrices, wrap around the sparse ones (work by going from Eigen dense to sparse then calling the usual extractors, less indexing code to maintain. These would usually be called only in transformed data block anyway. These will be:
- "csr_extract_w"
- "csr_extract_v"
- "csr_extract_u"
- "csr_extract_z"
- Follow Daniel's suggestion to split out each extractor function into a separate file with its own corresponding test file.
Reactions are currently unavailable