@@ -32,6 +32,7 @@ module stdlib_linalg
32
32
public :: lstsq
33
33
public :: lstsq_space
34
34
public :: norm
35
+ public :: mnorm
35
36
public :: get_norm
36
37
public :: solve
37
38
public :: solve_lu
@@ -1320,6 +1321,40 @@ module stdlib_linalg
1320
1321
#:endfor
1321
1322
end interface get_norm
1322
1323
1324
+ !> Matrix norm: function interface
1325
+ interface mnorm
1326
+ #:for rk,rt,ri in RC_KINDS_TYPES
1327
+ #:for it,ii in NORM_INPUT_OPTIONS
1328
+ module function matrix_norm_${ii}$_${ri}$(a, order, err) result(nrm)
1329
+ !> Input matrix a(m,n)
1330
+ ${rt}$, intent(in), target :: a(:,:)
1331
+ !> Norm of the matrix.
1332
+ real(${rk}$) :: nrm
1333
+ !> Order of the matrix norm being computed.
1334
+ ${it}$, intent(in) :: order
1335
+ !> [optional] state return flag. On error if not requested, the code will stop
1336
+ type(linalg_state_type), intent(out), optional :: err
1337
+ end function matrix_norm_${ii}$_${ri}$
1338
+
1339
+ #:for rank in range(3, MAXRANK + 1)
1340
+ !> N-D array with optional `dim` specifier
1341
+ module function matrix_norm_${rank}$D_to_${rank-2}$D_${ii}$_${ri}$(a, order, dim, err) result(nrm)
1342
+ !> Input matrix a(m,n)
1343
+ ${rt}$, intent(in), contiguous, target :: a${ranksuffix(rank)}$
1344
+ !> Norm of the matrix.
1345
+ real(${rk}$), allocatable :: nrm${ranksuffix(rank-2)}$
1346
+ !> Order of the matrix norm being computed.
1347
+ ${it}$, intent(in) :: order
1348
+ !> [optional] dimensions of the sub-matrices the norms should be evaluated at (default = [1,2])
1349
+ integer(ilp), optional, intent(in) :: dim(2)
1350
+ !> [optional] state return flag. On error if not requested, the code will stop
1351
+ type(linalg_state_type), intent(out), optional :: err
1352
+ end function matrix_norm_${rank}$D_to_${rank-2}$D_${ii}$_${ri}$
1353
+ #:endfor
1354
+ #:endfor
1355
+ #:endfor
1356
+ end interface mnorm
1357
+
1323
1358
contains
1324
1359
1325
1360
0 commit comments