Skip to main content

Specification and Validation of Numerical Algorithms with the Gradual Contracts Pattern

  • Conference paper
  • First Online:
  • 374 Accesses

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13045))

Abstract

In this contribution we discuss the domain specific problems arising when implementing test suites for numerical algorithms. We propose a design approach based on gradual contracts and a support library to alleviate some of these issues. Gradual contracts do not need to represent a full specification of an algorithm’s interface and can include untestable mathematical concepts. This encourages the developer to express their current, possibly incomplete, understanding of the algorithm in code and allows them to use automatic test generation for further insights. We demonstrate the applicability of our approach with the example of the Newton-Raphson method.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   79.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   99.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

References

  1. Astropy testing guidelines. https://web.archive.org/web/20210610143923/https://docs.astropy.org/en/latest/development/testguide.html. Accessed 10 June 2021

  2. The Boost Test documentation. http://go.wwu.de/5femy. Accessed 11 June 2021

  3. How to write code like a scientist. http://go.wwu.de/xo8eu. Accessed 10 June 2021

  4. icontract - design-by-contract in Python3 with informative violation messages and inheritance. http://go.wwu.de/b2ws6. Accessed 19 Aug 2021

  5. Numpy testing guidelines. http://go.wwu.de/9fzha. Accessed 10 June 2021

  6. Petsc testing system. http://go.wwu.de/2mnad. Accessed 10 June 2021

  7. Pragmatic unit testing for scientific codes. http://go.wwu.de/4o1tl. Accessed 10 June 2021

  8. Stan’s user guide. http://go.wwu.de/mui45. Accessed 11 June 2021

  9. Unit testing in R. http://go.wwu.de/qw4fl. Accessed 10 June 2021

  10. Verify simulations with the method of manufactured solutions. http://go.wwu.de/f7dzl. Accessed 11 June 2021

  11. Writing tests for scientific code. http://go.wwu.de/qzi0t. Accessed 10 June 2021

  12. Mishap Investigation Board: Mars climate orbiter mishap investigation board phase I report (1999)

    Google Scholar 

  13. Dubois, P.F.: Testing scientific programs. Comput. Sci. Eng. 14(4), 69–73 (2012)

    Article  Google Scholar 

  14. Gragg, W., Tapia, R.: Optimal error bounds for the Newton-Kantorovich theorem. SIAM J. Numer. Anal. 11(1), 10–13 (1974)

    Article  MathSciNet  Google Scholar 

  15. Harris, C.R., Millman, K.J., et al.: Array programming with NumPy. Nature 585(7825), 357–362 (2020)

    Article  Google Scholar 

  16. Kanewala, U., Bieman, J.M.: Testing scientific software: a systematic literature review. Inf. Softw. Technol. 56(10), 1219–1232 (2014)

    Article  Google Scholar 

  17. MacIver, D.R., Hatfield-Dodds, Z., Contributors, M.O.: Hypothesis: a new approach to property-based testing. J. Open Source Softw. 4(43), 1891 (2019)

    Article  Google Scholar 

  18. Meyer, B.: Applying “design by contract’’. Computer 25(10), 40–51 (1992)

    Article  Google Scholar 

  19. Miller, G.: A scientist’s nightmare: software problem leads to five retractions (2006)

    Google Scholar 

  20. Wang, Q., Zhang, X., Zhang, Y., Yi, Q.: AUGEM: automatically generate high performance dense linear algebra kernels on x86 CPUs. In: SC 2013: Proceedings of the International Conference on High Performance Computing, Networking, Storage and Analysis, pp. 1–12 (2013)

    Google Scholar 

Download references

Acknowledgment

Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany’s Excellence Strategy EXC 2044 -390685587, Mathematics Münster: Dynamics-Geometry-Structure and under RA 3055/1-1: pyMOR – Nachhaltige Software zur Modell-Ordnungs-Reduktion.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to René Fritze .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 IFIP International Federation for Information Processing

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Fritze, R., Rave, S. (2022). Specification and Validation of Numerical Algorithms with the Gradual Contracts Pattern. In: Clark, D., Menendez, H., Cavalli, A.R. (eds) Testing Software and Systems. ICTSS 2021. Lecture Notes in Computer Science, vol 13045. Springer, Cham. https://doi.org/10.1007/978-3-031-04673-5_14

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-04673-5_14

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-04672-8

  • Online ISBN: 978-3-031-04673-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics