OK; so add these two lines to your fpm.toml file:
[dependencies]
M_display = { git = "https://github.com/urbanjost/M_display.git" }
put this program into app/confidence_test.f90 in your fpm project directory to give it a quick test drive:
program demo_M_display
use M_display
implicit none
integer, parameter :: rk = selected_real_kind(6), n = 3
real(rk) :: a(n,n), b(n,n), x
integer i, j, k(5)
forall(i=1:n, j=1:n)
a(i,j) = exp(real(i+j-1, rk))
b(i,j) = exp(real(i**j, rk))
end forall
call disp_set(advance = 'double')
call disp('A = ', a)
call disp(b)
call disp(a(1:2,:),'f0.5')
call disp('MATRIX', a, style='UNDERLINE & NUMBER', unit=-3, digmax=4)
end program demo_M_display
and enter
fpm run confidence_test --profile release --compiler gfortran
And you should get just about any form of matrix output
you can think of, like:
A = 2.718 7.389 20.086
7.389 20.086 54.598
20.086 54.598 148.413
2.71828E+00 2.71828E+00 2.71828E+00
7.38906E+00 5.45981E+01 2.98096E+03
2.00855E+01 8.10308E+03 5.32048E+11
2.71828 7.38906 20.08554
7.38906 20.08554 54.59815
MATRIX
--------------------
1 2 3
1 2.7 7.4 20.1
2 7.4 20.1 54.6
3 20.1 54.6 148.4
and you can get rid of the confidence_test.f90 file and just add the “use M_display” and the call(s) to disp(3f) into your code optionally selecting the options you want and that should do it.
I need to clean up the github repository and add more of the original author’s examples and such but that will let you try it.
PS: The documentation is on M_display already. There is a lot of documentation but for basic use you just “call disp(array)”.