Skip to content

Commit 31cb5eb

Browse files
committed
complex format: add brackets i.e. (0.0,1.0) instead of 0.0 1.0
1 parent e7398a0 commit 31cb5eb

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

src/stdlib_linalg_state.fypp

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,18 @@ module stdlib_linalg_state
362362
!> Numeric types
363363
#:for k1, t1 in KINDS_TYPES
364364
type is (${t1}$)
365-
#:if 'real' in t1
366-
write (buffer,FMT_REAL_${k1}$) aa
367-
#:elif 'complex' in t1
368-
write (buffer,FMT_COMPLEX_${k1}$) aa
365+
#:if 'complex' in t1
366+
write (buffer, FMT_REAL_${k1}$) aa%re
367+
write (buffer2,FMT_REAL_${k1}$) aa%im
368+
msg = trim(msg)//sep(:ls)//'('//trim(adjustl(buffer))//','//trim(adjustl(buffer2))//')'
369369
#:else
370+
#:if 'real' in t1
371+
write (buffer,FMT_REAL_${k1}$) aa
372+
#:else
370373
write (buffer,'(i0)') aa
371-
#:endif
374+
#:endif
372375
msg = trim(msg)//sep(:ls)//trim(adjustl(buffer))
376+
#:endif
373377

374378
#:endfor
375379
class default
@@ -411,21 +415,30 @@ module stdlib_linalg_state
411415
!> Numeric types
412416
#:for k1, t1 in KINDS_TYPES
413417
type is (${t1}$)
414-
#:if 'real' in t1
415-
buffer_format = FMT_REAL_${k1}$
416-
#:elif 'complex' in t1
417-
buffer_format = FMT_COMPLEX_${k1}$
418+
#:if 'complex' in t1
419+
write (buffer,FMT_REAL_${k1}$) aa(1)%re
420+
write (buffer2,FMT_REAL_${k1}$) aa(1)%im
421+
msg = trim(msg)//'('//trim(adjustl(buffer))//','//trim(adjustl(buffer2))//')'
422+
do j = 2,size(a)
423+
write (buffer,FMT_REAL_${k1}$) aa(j)%re
424+
write (buffer2,FMT_REAL_${k1}$) aa(j)%im
425+
msg = trim(msg)//sep(:ls)//'('//trim(adjustl(buffer))//','//trim(adjustl(buffer2))//')'
426+
end do
418427
#:else
428+
#:if 'real' in t1
429+
buffer_format = FMT_REAL_${k1}$
430+
#:else
419431
buffer_format = '(i0)'
420-
#:endif
432+
#:endif
433+
421434
write (buffer,buffer_format) aa(1)
422435
msg = trim(msg)//adjustl(buffer)
423436
do j = 2,size(a)
424437
write (buffer,buffer_format) aa(j)
425438
msg = trim(msg)//sep(:ls)//adjustl(buffer)
426439
end do
427440
msg = trim(msg)//sep(:ls)//trim(adjustl(buffer))
428-
441+
#:endif
429442
#:endfor
430443
class default
431444
msg = trim(msg)//' <ERROR: INVALID TYPE>'

0 commit comments

Comments
 (0)