@@ -9,17 +9,21 @@ module la_eye
99 implicit none(type,external)
1010 private
1111
12- !> Function interface
12+ !> Constructs the identity matrix.
13+ !! This interface provides procedures to generate an identity matrix of a given size.
14+ !! The resulting matrix has 1s on the diagonal and 0s elsewhere.
1315 public :: eye
16+
1417 public :: diag
1518
16- ! Numpy: eye(N, M=None, k=0, dtype=<class 'float'>, order='C', *, device=None, like=None)
17- ! Numpy: identity(n, dtype=None, *, like=None) --> square matrices only
18- ! Scipy: eye(m, n=None, k=0, dtype=<class 'float'>, format=None) --> sparse only
19- ! IMSL: EYE(N)
20-
21- ! Identity interface
2219 interface eye
20+ !> Procedure for creating an identity matrix.
21+ !! - **Inputs:**
22+ !! - `m` (integer): Number of rows.
23+ !! - `n` (integer, optional): Number of columns. Defaults to `m` if not provided.
24+ !! - `mold` (datatype, optional): Data type used to define the matrix elements. Defaults to `real(real64)`.
25+ !! - **Outputs:**
26+ !! - Identity matrix of specified size and type.
2327 #:for epref,esuf,earg,epresent in FUNCTION_INTERFACES
2428 #:for rk,rt,ri in ALL_KINDS_TYPES
2529 module procedure la_eye_${ri}$${esuf}$
@@ -41,13 +45,15 @@ module la_eye
4145
4246 #:for epref,esuf,earg,epresent in FUNCTION_INTERFACES
4347 #:for rk,rt,ri in ALL_KINDS_TYPES
44- ! Return diagonal eye matrix of size N
45- ${epref}$function la_eye_${ri}$${esuf}$(m,n,mold${earg}$) result(eye)
46- !> Number of rows
48+ !> Function to construct an identity matrix of size `m x n`.
49+ !! This function returns a diagonal identity matrix, with the diagonal elements
50+ !! equal to 1 and all other elements set to 0.
51+ ${epref}$function la_eye_${ri}$${esuf}$(m, n, mold${earg}$) result(eye)
52+ !> Number of rows of the identity matrix.
4753 integer(ilp), intent(in) :: m
48- !> Number of columns (optional)
54+ !> Number of columns of the identity matrix (optional).
4955 integer(ilp), optional, intent(in) :: n
50- !> Datatype. Used to define the return type. Defaults to real(real64)
56+ !> Data type, used to define the return type. Defaults to ` real(real64)`.
5157 #:if rt=='real(dp)'
5258 ${rt}$, optional, intent(in) :: mold
5359 #:else
0 commit comments