forked from M-Labs/nalgebra
add checks to make sure access won't be out of bounds
This commit is contained in:
parent
19c7f19afa
commit
f77e12ff2f
@ -30,6 +30,8 @@ pub fn spmm_cs_prealloc_unchecked<T>(
|
|||||||
where
|
where
|
||||||
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
|
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
|
||||||
{
|
{
|
||||||
|
assert_eq!(c.pattern().major_dim(), a.pattern().major_dim());
|
||||||
|
assert_eq!(c.pattern().minor_dim(), b.pattern().minor_dim());
|
||||||
let some_val = Zero::zero();
|
let some_val = Zero::zero();
|
||||||
let mut scratchpad_values: Vec<T> = vec![some_val; b.pattern().minor_dim()];
|
let mut scratchpad_values: Vec<T> = vec![some_val; b.pattern().minor_dim()];
|
||||||
for i in 0..c.pattern().major_dim() {
|
for i in 0..c.pattern().major_dim() {
|
||||||
|
Loading…
Reference in New Issue
Block a user