| 1 |
! { dg-do compile } |
| 2 |
|
| 3 |
module data_func_mod |
| 4 |
implicit none |
| 5 |
integer, parameter :: sp = 4 |
| 6 |
type :: data_type |
| 7 |
real(kind=sp), pointer, dimension(:, :) :: data => null() |
| 8 |
integer :: nr_rows = 0, nr_cols = 0 |
| 9 |
end type data_type |
| 10 |
|
| 11 |
contains |
| 12 |
|
| 13 |
function get_row(this, i) result(row) |
| 14 |
implicit none |
| 15 |
type(data_type), intent(in) :: this |
| 16 |
integer, intent(in) :: i |
| 17 |
real(kind=sp), dimension(this%nr_cols) :: row |
| 18 |
row = this%data(:, i) |
| 19 |
end function get_row |
| 20 |
|
| 21 |
subroutine print_matrix(m, i, fmt_str) |
| 22 |
implicit none |
| 23 |
class(data_type), intent(in) :: m |
| 24 |
integer, intent(in) :: i |
| 25 |
character(len=20), intent(in) :: fmt_str |
| 26 |
write (unit=6, fmt=fmt_str) get_row(m, i) |
| 27 |
end subroutine print_matrix |
| 28 |
|
| 29 |
end module data_func_mod |