Skip to content
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

[stdlib_math] Minor update to stdlib_math module and document #624

Merged
merged 2 commits into from
Feb 18, 2022

Conversation

zoziha
Copy link
Contributor

@zoziha zoziha commented Jan 30, 2022

  • Minor changes to the internal implementation of argd/argpi;
  • Move unit tests of arange procedure to test_stdlib_math;
  • Small update to the documentation.

Description

I found that there is some documentation in stdlib_math that needs to be updated in this PR.
Mainly related to:

  • tests of arange function;
  • is_close/all_close function FORD Links;
  • The internal implementation of argd/argpi function, and arg** function FORD Links;
  • diff function document.

Note: Since this is a somewhat minor modification, I believe it will be reviewed soon.

Copy link
Member

@milancurcic milancurcic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks. A small PR with no functional change.

doc/specs/stdlib_math.md Outdated Show resolved Hide resolved
doc/specs/stdlib_math.md Outdated Show resolved Hide resolved
And improved some stuff in stdlib_math.md.
@zoziha
Copy link
Contributor Author

zoziha commented Feb 5, 2022

According to the review comments, relevant content has been revised.

It seems that the failure of FORD CI has nothing to do with this commit.
In my local version of FORD 6.15, there is no FORD failure.
The FORD version of CI is 6.17, I don't know if it is a FORD version problem.

Reading file src/stdlib_bitsets_64.fypp
Traceback (most recent call last):
  File "/usr/local/bin/ford", line 8, in <module>
    sys.exit(run())
  File "/usr/local/Cellar/ford/6.1.7/libexec/lib/python3.9/site-packages/ford/__init__.py", line 6[34](https://github.com/fortran-lang/stdlib/runs/5075317875?check_suite_focus=true#step:6:34), in run
    main(proj_data, proj_docs, md)
  File "/usr/local/Cellar/ford/6.1.7/libexec/lib/python3.9/site-packages/ford/__init__.py", line 557, in main
    project = ford.fortran_project.Project(proj_data)
  File "/usr/local/Cellar/ford/6.1.7/libexec/lib/python3.9/site-packages/ford/fortran_project.py", line 104, in __init__
    ford.sourceform.FortranSourceFile(
  File "/usr/local/Cellar/ford/6.1.7/libexec/lib/python3.9/site-packages/ford/sourceform.py", line 1413, in __init__
    source = ford.reader.FortranReader(
  File "/usr/local/Cellar/ford/6.1.7/libexec/lib/python3.9/site-packages/ford/reader.py", line 1[36](https://github.com/fortran-lang/stdlib/runs/5075317875?check_suite_focus=true#step:6:36), in __init__
    preprocessor = preprocessor + macros + incdirs + [filename]
TypeError: can only concatenate str (not "list") to str

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

@jvdp1
Copy link
Member

jvdp1 commented Feb 13, 2022

Could you check why the actions failed please?

@zoziha zoziha marked this pull request as draft February 14, 2022 01:40
@zoziha zoziha marked this pull request as ready for review February 14, 2022 01:51
@zoziha
Copy link
Contributor Author

zoziha commented Feb 14, 2022

The ford version was updated from 6.17 to 6.18, the old bugs were patched, and the new ones appeared:

  • exclude_dir: src/tests, *.fypp inside src/tests should be ignored, but ford of this version 6.18 is trying to parse.

I'm wondering if stdlib should be selected to install the version number of ford, preferring a stable version number, such as 6.15.

It seems that the two ford documentation errors are related to ford's version update, but I don't understand python code.

Reading file src/tests/linalg/test_linalg_matrix_property_checks.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/linalg/test_linalg_matrix_property_checks.fypp
Warning: error preprocessing /Users/runner/work/stdlib/stdlib/src/tests/linalg/test_linalg_matrix_property_checks.fypp
/Users/runner/work/stdlib/stdlib/src/tests/linalg/test_linalg_matrix_property_checks.fypp:1: error: include file 'common.fypp' not found [FyppFatalError]

call check(error, is_square(A_true), "0"): Found procedure call in MODULE
call check(error, (.not. is_square(A_false)), "0"): Found procedure call in MODULE
type(error_type), allocatable, intent(out) :: error: Found variable in SOURCEFILE
call check(error, is_diagonal(A_true_s), "0"): Found procedure call in SOURCEFILE
call check(error, (.not. is_diagonal(A_false_s)), "0"): Found procedure call in SOURCEFILE
call check(error, is_diagonal(A_true_sf), "0"): Found procedure call in SOURCEFILE
call check(error, (.not. is_diagonal(A_false_sf)), "0"): Found procedure call in SOURCEFILE
call check(error, is_diagonal(A_true_ts), "0"): Found procedure call in SOURCEFILE
call check(error, (.not. is_diagonal(A_false_ts)), "0"): Found procedure call in SOURCEFILE
end subroutine test_is_diagonal_${s1}$: END statement outside of any nesting
    main(proj_data, proj_docs, md)
  File "/usr/local/Cellar/ford/6.1.8/libexec/lib/python3.9/site-packages/ford/__init__.py", line 557, in main
    project = ford.fortran_project.Project(proj_data)
  File "/usr/local/Cellar/ford/6.1.8/libexec/lib/python3.9/site-packages/ford/fortran_project.py", line 104, in __init__
    ford.sourceform.FortranSourceFile(
  File "/usr/local/Cellar/ford/6.1.8/libexec/lib/python3.9/site-packages/ford/sourceform.py", line 1427, in __init__
    FortranContainer.__init__(self, source, "")
  File "/usr/local/Cellar/ford/6.1.8/libexec/lib/python3.9/site-packages/ford/sourceform.py", line 763, in __init__
    self._cleanup()
  File "/usr/local/Cellar/ford/6.1.8/libexec/lib/python3.9/site-packages/ford/sourceform.py", line 1069, in _cleanup
    raise NotImplementedError()
NotImplementedError

@zoziha
Copy link
Contributor Author

zoziha commented Feb 14, 2022

It appears that because *.fypp in src/tests is parsed, using include explicitly currently works around this error temporarily.

Possibly related content:

Reading file src/tests/test_always_fail.f90
Reading file src/tests/test_always_skip.f90
Reading file src/tests/ascii/test_ascii.f90
Reading file src/tests/logger/test_stdlib_logger.f90
Reading file src/tests/hash_functions_perf/test_32_bit_hash_performance.f90
Reading file src/tests/hash_functions_perf/test_64_bit_hash_performance.f90
Reading file src/tests/linalg/test_linalg.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/linalg/test_linalg.fypp
Reading file src/tests/linalg/test_linalg_matrix_property_checks.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/linalg/test_linalg_matrix_property_checks.fypp
Reading file src/tests/array/test_logicalloc.f90
Reading file src/tests/stringlist/test_append_prepend.f90
Reading file src/tests/stringlist/test_insert_at.f90
Reading file src/tests/io/test_parse_mode.f90
Reading file src/tests/io/test_loadtxt_qp.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/io/test_loadtxt_qp.fypp
Reading file src/tests/io/test_getline.f90
Reading file src/tests/io/test_savetxt.f90
Reading file src/tests/io/test_savetxt_qp.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/io/test_savetxt_qp.fypp
Reading file src/tests/io/test_open.f90
Reading file src/tests/io/test_loadtxt.f90
Reading file src/tests/io/test_npy.f90
Reading file src/tests/quadrature/test_simps.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/quadrature/test_simps.fypp
Reading file src/tests/quadrature/test_gauss.f90
Reading file src/tests/quadrature/test_trapz.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/quadrature/test_trapz.fypp
Reading file src/tests/math/test_linspace.f90
Reading file src/tests/math/test_logspace.f90
Reading file src/tests/math/test_stdlib_math.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/math/test_stdlib_math.fypp
Reading file src/tests/system/test_sleep.f90
Reading file src/tests/sorting/test_sorting.f90
Reading file src/tests/bitsets/test_stdlib_bitset_large.f90
Reading file src/tests/bitsets/test_stdlib_bitset_64.f90
Reading file src/tests/selection/test_selection.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/selection/test_selection.fypp
Reading file src/tests/string/test_string_derivedtype_io.f90
Reading file src/tests/string/test_string_intrinsic.f90
Reading file src/tests/string/test_string_operator.f90
Reading file src/tests/string/test_string_match.f90
Reading file src/tests/string/test_string_to_string.f90
Reading file src/tests/string/test_string_functions.f90
Reading file src/tests/string/test_string_strip_chomp.f90
Reading file src/tests/string/test_string_assignment.f90
Reading file src/tests/hash_functions/test_hash_functions.f90
Reading file src/tests/optval/test_optval.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/optval/test_optval.fypp
Reading file src/tests/stats/test_median.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/stats/test_median.fypp
Reading file src/tests/stats/test_distribution_normal.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/stats/test_distribution_normal.fypp
Reading file src/tests/stats/test_mean_f03.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/stats/test_mean_f03.fypp
Reading file src/tests/stats/test_random.f90
Reading file src/tests/stats/test_mean.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/stats/test_mean.fypp
Reading file src/tests/stats/test_distribution_exponential.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/stats/test_distribution_exponential.fypp
Reading file src/tests/stats/test_varn.f90
Reading file src/tests/stats/test_rawmoment.f90
Reading file src/tests/stats/test_distribution_uniform.fypp
Preprocessing /Users/runner/work/stdlib/stdlib/src/tests/stats/test_distribution_uniform.fypp
Reading file src/tests/stats/test_moment.f90
Reading file src/tests/stats/test_corr.f90
Reading file src/tests/stats/test_var.f90
Reading file src/tests/stats/test_cov.f90

@jvdp1
Copy link
Member

jvdp1 commented Feb 14, 2022

Thank you @zoziha for debugging this FORD issue. This workaround seems to ok to me.
@awvwgk do you have additional comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants