File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 6
6
// option. This file may not be copied, modified, or distributed
7
7
// except according to those terms.
8
8
9
- use crate :: OwnedRepr ;
10
9
use crate :: imp_prelude:: * ;
11
10
use crate :: numeric_util;
12
11
#[ cfg( feature = "blas" ) ]
@@ -717,16 +716,22 @@ where
717
716
let dimac = a. shape ( ) [ 1 ] ;
718
717
let dimbr = b. shape ( ) [ 0 ] ;
719
718
let dimbc = b. shape ( ) [ 1 ] ;
720
- let mut out: Array2 < MaybeUninit < A > > = Array2 :: uninit ( ( dimar * dimbr, dimac * dimbc) ) ;
719
+ let mut out: Array2 < MaybeUninit < A > > = Array2 :: uninit ( (
720
+ dimar
721
+ . checked_mul ( dimbr)
722
+ . expect ( "Dimensions of kronecker product output array overflows usize." ) ,
723
+ dimac
724
+ . checked_mul ( dimbc)
725
+ . expect ( "Dimensions of kronecker product output array overflows usize." ) ,
726
+ ) ) ;
721
727
Zip :: from ( out. exact_chunks_mut ( ( dimbr, dimbc) ) )
722
728
. and ( a)
723
- . for_each ( |out, a| {
724
- ( * a * b) . assign_to ( out) ;
729
+ . for_each ( |out, & a| {
730
+ ( a * b) . assign_to ( out) ;
725
731
} ) ;
726
732
unsafe { out. assume_init ( ) }
727
733
}
728
734
729
-
730
735
#[ inline( always) ]
731
736
/// Return `true` if `A` and `B` are the same type
732
737
fn same_type < A : ' static , B : ' static > ( ) -> bool {
You can’t perform that action at this time.
0 commit comments