Prints the elements of a matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=real_8), | intent(in), | DIMENSION(:) | :: | matrix | ||
integer, | intent(in) | :: | rows |
the logical (possibly detransposed) matrix size, not the stored size the logical (possibly detransposed) matrix size, not the stored size |
||
integer, | intent(in) | :: | cols |
the logical (possibly detransposed) matrix size, not the stored size the logical (possibly detransposed) matrix size, not the stored size |
||
integer, | intent(in) | :: | r_offset |
the logical (possibly detransposed) matrix size, not the stored size the logical (possibly detransposed) matrix size, not the stored size |
||
integer, | intent(in) | :: | c_offset |
the logical (possibly detransposed) matrix size, not the stored size the logical (possibly detransposed) matrix size, not the stored size |
||
integer, | intent(in) | :: | iunit |
the logical (possibly detransposed) matrix size, not the stored size the logical (possibly detransposed) matrix size, not the stored size |
||
logical, | intent(in), | optional | :: | tr |
specifies whether the elements are stored transposed |
|
character(len=*), | intent(in), | optional | :: | variable_name |
SUBROUTINE dbcsr_printmat_matlab_d(matrix, rows, cols, r_offset, c_offset, iunit, tr, variable_name) !! Prints the elements of a matrix. REAL(KIND=real_8), DIMENSION(:), INTENT(IN) :: matrix INTEGER, INTENT(IN) :: rows, cols, r_offset, c_offset, iunit !! the logical (possibly detransposed) matrix size, not the stored size !! the logical (possibly detransposed) matrix size, not the stored size LOGICAL, INTENT(IN), OPTIONAL :: tr !! specifies whether the elements are stored transposed CHARACTER(len=*), INTENT(in), OPTIONAL :: variable_name INTEGER :: c, c_off, m, n, r, r_off LOGICAL :: t ! --------------------------------------------------------------------------- m = rows n = cols r_off = r_offset c_off = c_offset t = .FALSE. IF (PRESENT(tr)) THEN IF (tr) THEN t = .TRUE. m = cols n = rows r_off = c_offset c_off = r_offset END IF END IF DO c = 1, cols DO r = 1, rows IF (.NOT. t) THEN IF (PRESENT(variable_name)) THEN WRITE (iunit, '(A,I4,A,I4,A,E23.16,A)') & variable_name//'(', r + r_offset - 1, ',', c + c_offset - 1, ')=', matrix(r + (c - 1)*rows), ';' ELSE WRITE (iunit, '(A,I4,A,I4,A,E23.16,A)') 'a(', r + r_offset - 1, ',', & c + c_offset - 1, ')=', matrix(r + (c - 1)*rows), ';' END IF ELSE IF (PRESENT(variable_name)) THEN WRITE (iunit, '(A,I4,A,I4,A,E23.16,A)') & variable_name//'(', r + r_offset - 1, ',', c + c_offset - 1, ')=', matrix((r - 1)*cols + c), ';' ELSE WRITE (iunit, '(A,I4,A,I4,A,E23.16,A)') 'a(', r + r_offset - 1, ',', & c + c_offset - 1, ')=', matrix((r - 1)*cols + c), ';' END IF END IF END DO END DO END SUBROUTINE dbcsr_printmat_matlab_d