@@ -488,6 +488,7 @@ ${loop_variables_end(rank-1," "*12)}$
488
488
call parse_norm_type(order,norm_request,err_)
489
489
call lange_task_request(norm_request,lange_task,err_)
490
490
if (err_%error()) then
491
+ allocate(nrm${emptyranksuffix(rank-2)}$)
491
492
call linalg_error_handling(err_,err)
492
493
return
493
494
endif
@@ -496,7 +497,7 @@ ${loop_variables_end(rank-1," "*12)}$
496
497
s = shape(a,kind=ilp)
497
498
498
499
! Check if input column data is contiguous
499
- contiguous_data = dims(1)==1
500
+ contiguous_data = all(dims==[1,2])
500
501
501
502
! Matrix norm size
502
503
m = s(dims(1))
@@ -505,20 +506,17 @@ ${loop_variables_end(rank-1," "*12)}$
505
506
! Get packed data with norm dimensions as 1:2
506
507
if (contiguous_data) then
507
508
508
- ! Collapse everything before the 1st dimension as apack's dim #1
509
- ! Set size==1 for all unused trailing dimensions
510
- spack = [product(s(1:dims(2)-1)),s(dims(2):),(1_ilp,j=1,dims(2)-2)]
511
-
512
509
! Reshape without moving data
513
- apack${shape_from_array_data('spack',rank)}$ => a
510
+ spack = s
511
+ apack => a
514
512
515
513
else
516
514
517
515
! Dimension permutations to map dims(1),dims(2) => 1:2
518
516
perm = [dims,pack(dim_range, dim_range/=dims(1) .and. dim_range/=dims(2))]
519
517
iperm(perm) = dim_range
520
518
spack = s(perm)
521
- apack = reshape(a, shape=spack, order=iperm)
519
+ allocate( apack,source= reshape(a, shape=spack, order=iperm))
522
520
523
521
endif
524
522
0 commit comments