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 66// option. This file may not be copied, modified, or distributed
77// except according to those terms.
88
9- use crate :: OwnedRepr ;
109use crate :: imp_prelude:: * ;
1110use crate :: numeric_util;
1211#[ cfg( feature = "blas" ) ]
@@ -717,16 +716,22 @@ where
717716 let dimac = a. shape ( ) [ 1 ] ;
718717 let dimbr = b. shape ( ) [ 0 ] ;
719718 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+ ) ) ;
721727 Zip :: from ( out. exact_chunks_mut ( ( dimbr, dimbc) ) )
722728 . and ( a)
723- . for_each ( |out, a| {
724- ( * a * b) . assign_to ( out) ;
729+ . for_each ( |out, & a| {
730+ ( a * b) . assign_to ( out) ;
725731 } ) ;
726732 unsafe { out. assume_init ( ) }
727733}
728734
729-
730735#[ inline( always) ]
731736/// Return `true` if `A` and `B` are the same type
732737fn same_type < A : ' static , B : ' static > ( ) -> bool {
You can’t perform that action at this time.
0 commit comments