Skip to main content

Mutant Accuracy Testing for Assessing the Implementation of Numerical Algorithms

  • Conference paper
  • First Online:
Numerical Software Verification (NSV 2019)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 11652))

Included in the following conference series:

  • 361 Accesses

Abstract

Despite their widespread use, implementations of numerical computing algorithms are generally tested manually with fuzzily defined thresholds determining success or failure. Modern software testing methods, such as automated regression testing, are difficult to apply because both test oracles and algorithm output are approximate. Based on the observation that high accuracy numerical algorithms appear to be fragile by design to errors in their parameters, we propose to compare the error of target implementations to mutated versions of themselves with the expectation that the mutants will suffer degraded accuracy. We test the idea on Matlab implementations of some basic numerical algorithms, and find that most mutants are worse while the few which are better show a distinctive pattern of mutation.

This work was supported by National Science and Engineering Research Council of Canada (NSERC) Discovery Grant RGPIN-2017-04543 and an Undergraduate Student Research Award (USRA).

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.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

Institutional subscriptions

Notes

  1. 1.

    These quantities may be known when it comes time to solve a particular problem, but outside of introductory numerical analysis courses most problems are solved by calling a library routine or legacy implementation; consequently, those who design, implement and test such routines should not assume knowledge of these values.

References

  1. Ascher, U.M., Greif, C.: A First Course on Numerical Methods. SIAM (2011)

    Google Scholar 

  2. de Dinechin, F., Lauter, C.Q., Melquiond, G.: Assisted verification of elementary functions using Gappa. In: ACM Symposium on Applied Computing, pp. 1318–1322 (2006). https://doi.org/10.1145/1141277.1141584

  3. Grcar, J.: John von Neumann’s analysis of Gaussian elimination and the origins of modern numerical analysis. SIAM Rev. 53(4), 607–682 (2011). https://doi.org/10.1137/080734716

    Article  MathSciNet  MATH  Google Scholar 

  4. Guest, C., McKean, M., Shearer, H., Reiner, R.: This is spinal tap. film (1984). Director: Rob Reiner, producer: Karen Murphy

    Google Scholar 

  5. Heath, M.T.: Scientific Computing: An Introductory Survey. SIAM (2018)

    Google Scholar 

  6. Hook, D., Kelly, D.: Mutation sensitivity testing. Comput. Sci. Eng. 11(6), 40–47 (2009)

    Article  Google Scholar 

  7. Howden, W.E.: Theoretical and empirical studies of program testing. In: Proceedings of the 3rd International Conference on Software Engineering, pp. 305–311 (1978)

    Article  Google Scholar 

  8. Howden, W.E.: Weak mutation testing and completeness of test sets. IEEE Trans. Softw. Eng. 4, 371–379 (1982)

    Article  Google Scholar 

  9. Jézéquel, F., Chesneaux, J.M.: CADNA: a library for estimating round-off error propagation. Comput. Phys. Commun. 178(12), 933–955 (2008). https://doi.org/10.1016/j.cpc.2008.02.003

    Article  MATH  Google Scholar 

  10. Knupp, P., Salari, K.: Verification of Computer Codes in Computational Science and Engineering. Chapman & Hall/CRC, Boca Raton (2002)

    Book  Google Scholar 

  11. Nedialkov, N.S.: VNODE-LP: a validated solver for initial value problems in ordinary differential equations. Technical report CAS-06-06-NN, Department of Computing and Software, McMaster University (2006)

    Google Scholar 

  12. Oberkampf, W.L., Roy, C.J.: Verification and Validation in Scientific Computing. Cambridge University Press, Cambridge (2010)

    Book  Google Scholar 

  13. Roy, C.J.: Review of code and solution verification procedures for computational simulation. J. Comput. Phys. 205(1), 131–156 (2005)

    Article  Google Scholar 

  14. Von Neumann, J., Goldstine, H.H.: Numerical inverting of matrices of high order. Bull. Am. Math. Soc. 53(11), 1021–1099 (1947)

    Article  MathSciNet  Google Scholar 

  15. Wikipedia contributors: Sign test—Wikipedia, the free encyclopedia (2019). https://en.wikipedia.org/wiki/Sign_test. Accessed 30 Apr 2019

Download references

Acknowledgements

The authors would like to thank Kevin Jayamanna for doing related preliminary work in his undergrad thesis, and Daniel Hook for providing MATmute to the community.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ian M. Mitchell .

Editor information

Editors and Affiliations

A Numerical Algorithms

A Numerical Algorithms

Our implementations are based on the descriptions in [1]. In this section we briefly describe each of the algorithms, the error measurement for that algorithm, and the test case generation procedure.

1.1 A.1 Simpson’s Method

The definite integral problem is to evaluate

$$ I = \int _a^b f(x)\,dx $$

for a specified \(a,b \in \mathbb {R}\) and scalar function f(x).

Simpson’s method is a fourth order accurate method that is used to approximate definite integrals. It is given by:

$$I_{Simp} = \frac{b-a}{6}\left[ f(a) + 4f\left( \frac{b+a}{2}\right) + f(b)\right] $$

Composite Simpson’s method involves dividing the domain of integration into subintervals called “panels,” applying Simpson’s method to each panel, and summing the result. Let r, the number of panels, be even. The formula is

$$S_{comp}=\frac{h}{3}\left[ f(a) + 2\sum _{k=1}^{r/2-1} f(t_{2k}) + 4 \sum _{k=1}^{r/2} f(t_{2k-1}) + f(b)\right] $$

where \(t_i = a+ih\), \(i = \{1, 2, ..., r\}\).

For analysis purposes, we define the error as the absolute value of the difference between the algorithm’s output and the (floating point approximation of the) analytic answer. It can be shown that composite Simpson’s method has an error bound of

$$\frac{\Vert f^{(4)}\Vert _\infty }{180}(b-a)h^4.$$

A typical 3-line implementation of composite Simpson’s method in Matlab generates 180–190 mutants using MATmute, of which roughly 120–130 are viable.

Test cases are generated either using pen-and-paper integration, or by MMS.

1.2 A.2 Complete Cubic Spline

A cubic spline is a continuously differentiable, piecewise cubic scalar function v(x) that interpolates points \(\{(x_1,f(x_1)), ..., (x_n,f(x_n))\}\), meaning that \(v(x_i) = f(x_i)\). We call the spline “complete” because the derivatives at the endpoints \(f'(x_1)\) and \(f'(x_n)\) are also provided, and we choose v(x) such that \(v'(x_1) = f'(x_1)\) and \(v'(x_n) = f'(x_n)\).

For analysis purposes, we generate a set of test points between the interpolation points, compute the difference between the value of the interpolant and the value of the original function at these test points, and report the greatest absolute difference across all test points as the error.

MATmute generates roughly 680–700 mutants from our 30-line implementation of a complete cubic spline.

For this problem analytic solutions are trivial to construct: We pick a function f and a set of points \(\{x_i\}\). Then, we use \(\{x_i\}\) and \(\{f(x_i)\}\) as the input to our cubic spline algorithm. The exact answers can be obtained directly from the function f.

1.3 A.3 Runge-Kutta Schemes

Runge-Kutta methods are used to solve initial value problems for ordinary differential equations. This class of problems is defined by:

$$\begin{aligned} \frac{dx(t)}{dt} = f(x, t) \text { such that } x(t_0) = x_0, \end{aligned}$$

where f(x) and \(x_0\) are specified. While x(t) may be a vector in general, for our purposes we considered only scalar cases.

We used the classic fourth order accurate Runge-Kutta method. It is given by the following set of update formulae:

$$ \begin{aligned} y_{n+1}&= y_n + \frac{1}{6}(k_1 + k_2 + k_3 + k_4), \\ k_1&= hf(t_n,y_n), \\ k_2&= hf(t_n+h/2,y_n+k_1/2), \\ k_3&= hf(t_n+h/2,y_n+k_2/2), \\ k_4&= hf(t_n+h,y_n+k_3), \end{aligned} $$

where \(y_n\) is the approximation at time \(t_n\) and a fixed stepsize h has been assumed.

For analysis purposes, we define the error in our Runge-Kutta implementation as the absolute value of the difference between the algorithm’s output and the analytic answer at a final time.

MATmute generates roughly 480–500 mutants from a typical 4th order Runge-Kutta implementation.

Test cases are generated by MMS: Starting with a function for x(t), supply

$$ f(x,t) = \frac{dx(t)}{dt} \text { and } x_0 = x(t_0) $$

as the inputs.

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Wu, R.(., Mitchell, I.M. (2019). Mutant Accuracy Testing for Assessing the Implementation of Numerical Algorithms. In: Zamani, M., Zufferey, D. (eds) Numerical Software Verification. NSV 2019. Lecture Notes in Computer Science(), vol 11652. Springer, Cham. https://doi.org/10.1007/978-3-030-28423-7_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-28423-7_9

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-28422-0

  • Online ISBN: 978-3-030-28423-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics