Eye
This function creates an indentity matrix.
Calling example:
amat = Eye(m, DataType)
m
is the size of matrixDataType
is the data type of returned matrix. DataType can be1.0_Real32
1.0_Real64
1_Int8
1_Int16
1_Int32
1_Int64
Interface
- ܀ Interface
- ️܀ See example
- ↢
MODULE PURE FUNCTION Eye(m, DataType) RESULT(ans)
INTEGER(I4B), INTENT(IN) :: m
Int8| Int16| Int32 | Int64 | Real32 | Real64, INTENT(IN) :: DataType
Int8| Int16| Int32 | Int64 | Real32 | Real64 :: ans(m, m)
END FUNCTION Eye
This example shows the use of Eye method.
program main
use easifemBase
implicit none
CALL Display(MdEncode(eye(5, 1.0) ), "Eye (Real32) = " )
CALL Display(MdEncode(eye(5, 1 ) ), "Eye (Int32) = " )
end program main
Results
Eye (Real32) =
1 | 0 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 |
0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 1 | 0 |
0 | 0 | 0 | 0 | 1 |
Eye (Int32) =
1 | 0 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 |
0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 1 | 0 |
0 | 0 | 0 | 0 | 1 |