You can try out the Fortran example in this thread, particularly with
..
real :: vector(4)
type(mat_t(n=2,m=2)) :: A
type(mat_t(n=2,m=2)) :: V(4)
a_scalar = 1.0
vector = [ a_scalar, a_scalar, a_scalar, a_scalar ]
print *, exp( vector )
A = ones( A%n, A%m )
print *, exp( A )
V = [ A, A, A, A ]
print *, exp( V )
..
and ponder whether you like the idea of data transfers with derived types aka “classes” in list-directed, namelist, and DT
formatted IO statements in the same manner as intrinsic types. If yes, defined IO will be useful; otherwise, continue as usual.