# Code coverage tests

This page documents the degree to which the PARI/GP source code is tested by our public test suite, distributed with the source distribution in directory src/test/. This is measured by the gcov utility; we then process gcov output using the lcov frond-end.

We test a few variants depending on Configure flags on the pari.math.u-bordeaux.fr machine (x86_64 architecture), and agregate them in the final report:

• with GMP kernel
• with GMP kernel using --mt=pthread
• with native kernel, including micro-assembler code
• with native kernel, without micro-assembler
• with native kernel, without micro-assembler, disabling GCC extensions (DISABLE_INLINE)
• with GMP kernel, emulating an x86_32 architecture at Configure time via setarch

The target is 90% coverage for all mathematical modules (given that branches depending on DEBUGLEVEL or DEBUGMEM are not covered). This script is run to produce the results below.

LCOV - code coverage report
 Current view: top level - basemath - matperm.c (source / functions) Hit Total Coverage Test: PARI/GP v2.11.0 lcov report (development 22860-5579deb0b) Lines: 78 78 100.0 % Date: 2018-07-19 05:36:41 Functions: 4 4 100.0 % Legend: Lines: hit not hit
  Line data Source code ` 1 : /* Copyright (C) 2016 The PARI group. 2 : 3 : This file is part of the PARI/GP package. 4 : 5 : PARI/GP is free software; you can redistribute it and/or modify it under the 6 : terms of the GNU General Public License as published by the Free Software 7 : Foundation. It is distributed in the hope that it will be useful, but WITHOUT 8 : ANY WARRANTY WHATSOEVER. 9 : 10 : Check the License for details. You should have received a copy of it, along 11 : with the package; see the file 'COPYING'. If not, write to the Free Software 12 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ 13 : 14 : /********************************************************************/ 15 : /** **/ 16 : /** MATRIX PERMANENT, via RYSER'S FORMULA **/ 17 : /** (initial implementation: C. Greathouse) **/ 18 : /** **/ 19 : /********************************************************************/ 20 : #include "pari.h" 21 : #include "paripriv.h" 22 : 23 : /* Ryser's formula */ 24 : GEN 25 154 : matpermanent(GEN M) 26 : { 27 : pari_sp av; 28 154 : long n = lg(M)-1, i, x, upper; 29 : GEN p, in; 30 154 : if (typ(M) != t_MAT) pari_err_TYPE("matpermanent", M); 31 154 : if (!n) return gen_1; 32 147 : if (n != nbrows(M)) pari_err_DIM("matpermanent"); 33 : #ifdef LONG_IS_64BIT /* because of vals(long x) => x <= LONG_MAX */ 34 120 : if (n > 63) pari_err_IMPL("large matrix permanent"); 35 : #else 36 20 : if (n > 31) pari_err_IMPL("large matrix permanent"); 37 : #endif 38 133 : if (n == 1) return gcopy(gcoeff(M,1,1)); 39 : 40 112 : av = avma; 41 112 : if (RgM_is_QM(M)) 42 : { 43 : GEN cM; 44 98 : M = Q_primitive_part(M, &cM); 45 98 : p = ZM_permanent(M); 46 98 : if (cM) p = gerepileupto(av, gmul(p, gpowgs(cM,n))); 47 98 : return p; 48 : } 49 : 50 14 : p = gen_0; 51 14 : in = zerovec(n); 52 14 : upper = 1L << n; 53 112 : for (x = 1; x < upper; x++) 54 : { 55 98 : long gray = x ^ (x>>1), k = vals(x); 56 98 : GEN col = gel(M,k+1); 57 98 : if (gray & (1L<>1), k = vals(x); 103 7340025 : GEN c, col = gel(M, k+1); 104 7340025 : if (gray & (1L<>1); 129 14694393 : long i, k = vals(x); 130 14694393 : GEN c, col = gel(M, k+1); 131 14694393 : if (gray & (1UL<

 Generated by: LCOV version 1.13