-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pretty printing of matrices (and multidimensional arrays) #40
Comments
My preference is for a format like Julia 's one. It would be also a similar format as savetxt. |
One prior art - Algorithm 892: DISPMODULE, a Fortran 95 module for pretty-printing matrices The code can be downloaded from netlib: http://netlib.org/toms/892.zip |
Thank you for mentioning this librabry. It seems to be quite complete and flexible. Could we use it (with some modernisations) in |
Code published in TOMS is under the ACM Software License Agreement which allows usage for non-commercial purposes. I think that it is not compatible with what we want to achieve here. I know Scipy contains the TOMS 748 algorithm. I checked and it looks like they wrote their own implementation. |
Yes, unfortunately we can't use their code. But we can at least learn from their thought process when designing their API.
…On Wed, Dec 25, 2019, at 4:18 AM, Ivan wrote:
Code published in TOMS is under the ACM Software License Agreement
<https://www.acm.org/publications/policies/software-copyright-notice>
which allows usage for non-commercial purposes. I think that it is not
compatible with what we want to achieve here.
I know Scipy contains the TOMS 748
<https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.toms748.html> algorithm. I checked and it looks like they wrote their own implementation.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#40?email_source=notifications&email_token=AAAFAWHHON7IYCGO345O3XTQ2M6RLA5CNFSM4J6NHD4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHUIVQQ#issuecomment-568888002>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAFAWDSHGHXBI7DIL2DO4TQ2M6RLANCNFSM4J6NHD4A>.
|
I had a look at the DISPMODULE API and it is indeed very nice and flexible supporting different formats (e.g. with a title, numbered rows and columns, precision, separators) and even printing several matrices adjacent to one another. Taking a peak inside I can say that it would be beneficial to first start work on our own string module to handle conversion of reals/integers/logicals to character strings and some tools to parse format strings. |
I agree with that. I would also add that I think it would be goood to first take a discussion on the issue #35 , because it will be the same problem for this issue #40 (i.e., printing matrices of different kinds). |
Currently the standard Fortran's
print *, A
prints a 2D arrayA
as a 1D list of numbers. Rather, I would likestdlib
to have a functionprint_array
(we can discuss a better name) that would print the array as NumPy:or Julia:
Julia can also use nice unicode characters for ... and vertical ... if the array is too large.
Then we should use this function at
stdlib/src/tests/loadtxt/test_loadtxt.f90
Line 21 in ae5591f
Then compilers can perhaps optionally use such
print_array
as default in the Fortran's languageprint
statement.The text was updated successfully, but these errors were encountered: