@@ -533,12 +533,50 @@ module stdlib_linalg
533
533
interface svdvals
534
534
!! version: experimental
535
535
!!
536
+ !! Computes the singular values of a `real` or `complex` 2d matrix.
537
+ !!
538
+ !!### Summary
539
+ !!
540
+ !! Function interface for computing the array of singular values from the singular value decomposition
541
+ !! of a `real` or `complex` 2d matrix.
542
+ !!
536
543
!!### Description
537
544
!!
545
+ !! This interface provides methods for computing the singular values a 2d matrix.
546
+ !! Supported data types include `real` and `complex`. The function returns a `real` array of
547
+ !! singular values, with size [min(m,n)].
538
548
!!
549
+ !!@note The solution is based on LAPACK's singular value decomposition `*GESDD` methods.
550
+ !!@note BLAS/LAPACK backends do not currently support extended precision (``xdp``).
551
+ !!
552
+ !!### Example
553
+ !!
554
+ !!```fortran
555
+ !! real(sp) :: a(2,3), s(2)
556
+ !! a = reshape([3,2, 2,3, 2,-2],[2,3])
557
+ !!
558
+ !! s = svdvals(A)
559
+ !! print *, 'singular values = ',s
560
+ !!```
561
+ !!
539
562
#:for rk,rt,ri in RC_KINDS_TYPES
540
563
#:if rk!="xdp"
541
564
module function stdlib_linalg_svdvals_${ri}$(a,err) result(s)
565
+ !!### Summary
566
+ !! Compute singular values \(S \) from the singular-value decomposition of a matrix \( A = U \cdot S \cdot \V^T \).
567
+ !!
568
+ !!### Description
569
+ !!
570
+ !! This function returns the array of singular values from the singular value decomposition of a `real`
571
+ !! or `complex` matrix \( A = U \cdot S \cdot V^T \).
572
+ !!
573
+ !! param: a Input matrix of size [m,n].
574
+ !! param: err [optional] State return flag.
575
+ !!
576
+ !!### Return value
577
+ !!
578
+ !! param: s `real` array of size [min(m,n)] returning a list of singular values.
579
+ !!
542
580
!> Input matrix A[m,n]
543
581
${rt}$, intent(in), target :: a(:,:)
544
582
!> [optional] state return flag. On error if not requested, the code will stop
0 commit comments