Branch Coverage

blib/lib/Math/MatrixSparse.pm
Criterion Covered Total %
branch 203 782 25.9


line true false branch
122 3 1 unless $m
124 0 4 $m < $n ? :
134 3 1 if $m == $n
141 0 4 unless defined $maxcol
142 0 3 unless defined $density and $density >= 0 and $density <= 1
144 1 3 unless (defined $max)
148 0 32 unless $uniform <= $density
154 3 0 unless defined $name
159 6 1100 if $stoch->element($i, $j)
161 0 1100 if ($uniform > $density)
164 0 1100 unless $uniform <= $density
175 0 1 unless open HB, "<$filename"
190 0 1 if ($mattype =~ /^C/) { }
200 0 1 unless ($colft =~ /I/i and $rowft =~ /I/i)
207 0 1 if ($rhsline)
230 0 1 if ($mattype =~ /^P..$/i) { }
251 1 0 if ($mattype =~ /^.S.$/) { }
0 0 elsif ($mattype =~ /^.Z.$/) { }
263 0 2 unless defined $filename
264 0 2 unless open MM, "<$filename"
266 0 2 unless (/^\%\%MatrixMarket/)
269 0 2 unless (/coordinate/i)
272 0 2 if (/complex/i) { }
282 2 0 if ($specifications =~ /pattern/i)
292 0 254 if /^\%/
293 2 252 if (not $startdata) { }
304 252 0 if $ispattern
308 0 2 if ($specifications =~ /\Wsymmetric/i)
312 0 2 if ($specifications =~ /skewsymmetric/i)
325 0 0 unless open MM, ">$filename"
327 0 0 $$matrix{'special'}{'pattern'} ? :
328 0 0 if ($$matrix{'special'}{'structure'} =~ /^symmetric/i) { }
0 0 elsif ($$matrix{'special'}{'structure'} =~ /skewsymmetric/i) { }
339 0 0 if ($$matrix{'special'}{'pattern'}) { }
342 0 0 unless $matrix->element($i, $j)
358 0 155 unless defined $proto
359 154 1 if (defined $$proto{'data'})
363 0 155 defined $name ? :
378 0 16002 unless defined $i and defined $j and defined $object
379 252 15750 if $$object{'special'}{'pattern'}
380 0 16002 unless defined $x
382 0 16002 if (defined $$object{'special'} and $$object{'special'}{'shape'} =~ /diagonal/i and $i != $j) { }
0 16002 elsif ($$object{'special'}{'shape'} =~ /strictlower/i and $i <= $j) { }
1 16001 elsif ($$object{'special'}{'shape'} =~ /strictupper/i and $i >= $j) { }
0 16001 elsif ($$object{'special'}{'shape'} =~ /^lower/i and $i < $j) { }
1 32000 elsif ($$object{'special'}{'shape'} =~ /^upper/i and $i = $j) { }
385 0 0 if ($i < $j) { }
392 0 0 if ($i == $j) { }
399 0 1 if ($i == $j) { }
409 15059 943 unless $x == 1
411 216 15786 if (abs $i - $j > $$object{'special'}{'bandwidth'})
415 0 16002 if ($i != $j and defined $$object{'special'}{'structure'} and $$object{'special'}{'structure'} =~ /symmetric/i) { }
0 17110 elsif ($i == $j and $$object{'special'}{'structure'} =~ /skewsymmetric/i and $x) { }
430 0 16002 if ($$object{'special'}{'sign'} =~ /^positive/ and $x <= 0) { }
0 16002 elsif ($$object{'special'}{'sign'} =~ /^negative/ and $x >= 0) { }
2 16000 elsif ($$object{'special'}{'sign'} =~ /nonnegative/i and $x < 0) { }
0 32000 elsif ($$object{'special'}{'sign'} =~ /nonpositive/i and $x > 0) { }
431 0 0 if ($x < 0) { }
437 0 0 if ($x > 0) { }
453 515 15487 if $i > $$object{'rows'}
454 461 15541 if $j > $$object{'columns'}
463 0 0 unless defined $i and defined $j and defined $object
464 0 0 if $$object{'special'}{'pattern'}
465 0 0 unless defined $x
468 0 0 if ($$object{'special'}{'structure'} =~ /^symmetric/i) { }
0 0 elsif ($$object{'special'}{'structure'} =~ /^symmetric/i) { }
469 0 0 if ($i == $j) { }
476 0 0 if ($i == $j and $x) { }
491 0 2008 unless defined $i and defined $j
499 53538 2388 if (defined $$object{'data'}{$key}) { }
508 28023 500 if (defined $$object{'data'}{$key}) { }
528 0 0 unless $row
529 0 0 if ($persist)
530 0 0 unless defined $$matrix{'sortedrows'}
533 0 0 if (defined $$matrix{'sortedrows'})
542 0 0 if ((&splitkey($rows[$mid]))[0] < $row) { }
549 0 0 unless (&splitkey($rows[$mid]))[0] == $row
573 0 0 if $i == $row
585 0 0 if ($persist)
586 0 0 unless defined $$matrix{'sortedcols'}
588 0 0 if (defined $$matrix{'sortedcols'})
597 0 0 if ((&splitkey($cols[$mid]))[1] < $col) { }
604 0 0 unless (&splitkey($cols[$mid]))[1] == $col
626 0 0 if $j == $col
636 0 0 unless defined $object
637 0 0 $name ? :
639 0 0 unless defined $rc
640 0 0 if ($rc =~ /^r/i) { }
0 0 elsif ($rc =~ /^c/i) { }
661 7 0 if ($$left{'rows'} == $$right{'rows'} and $$left{'columns'} == $$right{'columns'}) { }
678 0 7 if (defined $$left{'name'} and defined $$right{'name'})
682 1008 1549 if (defined $$sum{'data'}{$rightkey}) { }
688 0 7 $$left{'rows'} > $$right{'rows'} ? :
690 0 7 $$left{'columns'} > $$right{'columns'} ? :
692 6 1 if ($$left{'special'}{'structure'} eq $$right{'special'}{'structure'})
695 3 4 if ($$left{'special'}{'shape'} eq $$right{'special'}{'shape'})
704 0 73 if ($switch)
707 73 0 if ($$left{'rows'} == $$right{'rows'} and $$left{'columns'} == $$right{'columns'}) { }
727 1956 572 if (defined $$diff{'data'}{$rightkey}) { }
733 0 73 if (defined $$left{'name'} and defined $$right{'name'})
736 0 73 $$left{'rows'} > $$right{'rows'} ? :
738 0 73 $$left{'columns'} > $$right{'columns'} ? :
740 73 0 if ($$left{'special'}{'structure'} eq $$right{'special'}{'structure'})
743 73 0 if ($$left{'special'}{'shape'} eq $$right{'special'}{'shape'})
762 0 3 unless $scalar
766 0 3 if defined $$product{'name'}
767 0 3 if ($scalar < 0) { }
768 0 0 if ($$matrix{'special'}{'sign'} =~ /positive/i) { }
0 0 elsif ($$matrix{'special'}{'sign'} =~ /negative/i) { }
0 0 elsif ($$matrix{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$matrix{'special'}{'sign'} =~ /nonnegative/i) { }
780 0 3 unless $scalar
786 0 0 unless $scalar
790 0 0 if ($scalar < 0)
791 0 0 if ($$matrix{'special'}{'sign'} =~ /positive/i) { }
0 0 elsif ($$matrix{'special'}{'sign'} =~ /negative/i) { }
0 0 elsif ($$matrix{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$matrix{'special'}{'sign'} =~ /nonnegative/i) { }
801 0 0 unless $scalar
809 0 0 unless (ref $right)
812 0 0 if $$left{'columns'} != $$right{'rows'}
816 0 0 if (defined $$left{'name'} and defined $$right{'name'})
823 0 0 unless $lj == $ri
826 0 0 if (defined $$product{'data'}{$thiskey}) { }
835 0 0 if ($$left{'special'}{'sign'} =~ /zero/i or $$right{'special'}{'sign'} =~ /zero/i)
841 0 0 if ($$left{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$left{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$left{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$left{'special'}{'sign'} =~ /nonnegative/i) { }
844 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
854 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
864 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
881 3 43 unless (ref $right)
884 0 43 if $$left{'columns'} != $$right{'rows'}
893 2 41 if (defined $$left{'name'} and defined $$right{'name'})
901 2309 7992 if ($lj > $lastrow)
906 2273 9106 if $ri >= $lj
912 10117 213530 if $ri > $lj
913 0 213530 if $ri < $lj
916 189508 24022 if (defined $$product{'data'}{$thiskey}) { }
925 0 43 if ($$left{'special'}{'sign'} =~ /zero/i or $$right{'special'}{'sign'} =~ /zero/i)
931 0 43 if ($$left{'special'}{'sign'} =~ /^positive/i) { }
0 43 elsif ($$left{'special'}{'sign'} =~ /nonpositive/i) { }
0 43 elsif ($$left{'special'}{'sign'} =~ /^negative/i) { }
15 28 elsif ($$left{'special'}{'sign'} =~ /nonnegative/i) { }
934 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
944 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
954 0 15 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 15 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 15 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
15 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
970 0 0 unless (ref $right)
978 0 0 if (defined $$left{'name'} and defined $$right{'name'})
986 0 0 if ($lj > $lastrow)
991 0 0 if $ri >= $lj
997 0 0 if $ri > $lj
998 0 0 if $ri < $lj
1001 0 0 if (defined $$product{'data'}{$thiskey}) { }
1010 0 0 if ($$left{'special'}{'sign'} =~ /zero/i or $$right{'special'}{'sign'} =~ /zero/i)
1016 0 0 if ($$left{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$left{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$left{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$left{'special'}{'sign'} =~ /nonnegative/i) { }
1019 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
1029 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
1039 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
1060 0 0 if (defined $$left{'name'} and defined $$right{'name'})
1067 0 0 unless $lj == $ri
1070 0 0 if (defined $$product{'data'}{$thiskey}) { }
1078 0 0 if ($$left{'special'}{'sign'} =~ /zero/i or $$right{'special'}{'sign'} =~ /zero/i)
1084 0 0 if ($$left{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$left{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$left{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$left{'special'}{'sign'} =~ /nonnegative/i) { }
1087 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
1097 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
1107 0 0 if ($$right{'special'}{'sign'} =~ /^positive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonpositive/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /^negative/i) { }
0 0 elsif ($$right{'special'}{'sign'} =~ /nonnegative/i) { }
1124 0 0 unless $rr and $rc
1130 0 0 if (defined $$left{'name'} and defined $$right{'name'})
1148 0 1 unless ($matrix->is_square)
1152 0 1 unless $power
1153 0 1 unless ($power > 0)
1157 0 1 unless ($power =~ /^[+]?\d+/)
1166 0 1 if $$matrix{'name'}
1173 0 2 unless ($matrix->is_square)
1177 0 2 unless $power
1178 0 2 unless ($power > 0)
1182 0 2 unless ($power =~ /^[+]?\d+/)
1193 3 3 if ($bit)
1198 0 2 if $$matrix{'name'}
1212 0 7 if $$matrix{'name'}
1217 0 7 if ($$matrix{'special'}{'shape'} =~ /diagonal/i) { }
0 7 elsif ($$matrix{'special'}{'shape'} =~ /^lower/i) { }
1 6 elsif ($$matrix{'special'}{'shape'} =~ /^upper/i) { }
1 5 elsif ($$matrix{'special'}{'shape'} =~ /strictupper/i) { }
1 4 elsif ($$matrix{'special'}{'shape'} =~ /strictlower/i) { }
1238 0 96 unless $$this{'data'}{$key}
1247 0 0 unless $$matrix{'data'}{$key}
1259 7 0 unless defined $offset
1262 1647 199 unless $i == $j + $offset
1274 1 0 unless defined $offset
1277 1 500 if $i == $j + $offset
1290 921 825 unless $i > $j
1305 550 452 if $i > $j
1319 924 822 unless $i < $j
1333 225 276 if $i < $j
1346 0 0 unless defined $offset
1349 0 0 unless $i == $j + $offset
1357 0 0 unless defined $offset
1360 0 0 if $i == $j + $offset
1362 0 0 if $$matrix{'special'}{'shape'} =~ /diagonal/i
1372 0 0 unless $i > $j
1382 4040 727 if $i > $j
1392 276 225 unless $i < $j
1402 0 0 if $i < $j
1448 0 0 unless $matrix->elementkey($key) > 0
1461 0 0 unless $matrix->elementkey($key) < 0
1472 0 0 if $matrix->elementkey($key) > 0
1481 0 0 if $matrix->elementkey($key) < 0
1490 0 0 unless $i1 <= $i2 and $j1 <= $j2
1494 0 0 unless $i >= $i1 and $i <= $i2
1495 0 0 unless $j >= $j1 and $j <= $j2
1503 0 0 unless $i1 <= $i2 and $j1 <= $j2
1506 0 0 if $i >= $i1 and $i <= $i2
1507 0 0 if $j >= $j1 and $j <= $j2
1515 0 0 unless $i1 <= $i2 and $j1 <= $j2
1519 0 0 unless $i >= $i1 and $i <= $i2
1520 0 0 unless $j >= $j1 and $j <= $j2
1582 0 0 unless defined $matrix
1591 0 0 if $matrix->is_symmetric
1592 0 0 if $matrix->is_skewsymmetric
1594 0 0 if $$matrix{'special'}{'field'} =~ /real/i
1596 0 0 if $$matrix{'special'}{'shape'} =~ /strict/
1597 0 0 if $$matrix{'special'}{'shape'} =~ /upper/
1598 0 0 if $$matrix{'special'}{'shape'} =~ /lower/
1599 0 0 if $matrix->is_diagonal
1600 0 0 if $matrix->is_pattern
1601 0 0 if $matrix->is_square
1617 7 864 if $i > $rows
1618 5 866 if $j > $rows
1631 0 0 if $$matrix{'special'}{'bandwidth'}
1635 0 0 if abs $i - $j > $width
1671 0 0 unless defined $matrix
1683 0 0 unless defined $matrix
1713 0 10 unless defined $left or defined $right
1714 0 10 unless defined $left
1715 0 10 unless defined $right
1725 0 3 unless defined $matrix
1730 0 0 unless defined $matrix
1736 0 1 unless defined $matrix
1737 1 0 if $$matrix{'special'}{'structure'} =~ /^symmetric/
1738 0 0 if $$matrix{'special'}{'structure'} =~ /skewsymmetric/
1747 0 0 unless $truth
1754 0 1 unless defined $matrix
1755 0 1 if $$matrix{'special'}{'structure'} =~ /^symmetric/
1756 1 0 if $$matrix{'special'}{'structure'} =~ /^skewsymmetric/
1763 0 0 unless $truth
1770 0 1 unless defined $matrix
1771 1 0 if $$matrix{'special'}{'shape'} =~ /diagonal/i
1776 0 0 unless $truth
1783 0 2 unless defined $matrix
1784 2 0 if $$matrix{'special'}{'shape'} =~ /strictlower/i
1789 0 0 unless $truth
1796 0 2 unless defined $matrix
1797 1 1 if $$matrix{'special'}{'shape'} =~ /strictupper/i
1802 0 275 unless $truth
1809 0 2 unless defined $matrix
1811 2 0 if $$matrix{'special'}{'shape'} =~ /lower/i
1815 0 0 unless $truth
1822 0 2 unless defined $matrix
1824 2 0 if $$matrix{'special'}{'shape'} =~ /upper/i
1828 0 0 unless $truth
1835 0 0 unless defined $matrix
1836 0 0 if $$matrix{'special'}{'sign'} =~ /^positive/i
1840 0 0 unless $truth
1847 0 0 unless defined $matrix
1849 0 0 if $$matrix{'special'}{'sign'} =~ /zero/i
1852 0 0 unless $truth
1861 0 0 unless defined $matrix
1864 0 0 unless $truth
1872 0 0 unless defined $matrix
1875 0 0 unless $truth
1883 0 0 unless defined $matrix
1886 0 0 unless $truth
1893 0 0 unless defined $matrix
1894 0 0 if $$matrix{'special'}{'pattern'}
1898 0 0 unless $truth
1905 0 0 unless defined $matrix
1906 0 0 if $$matrix{'special'}{'pattern'}
1910 0 0 unless $truth
1918 0 0 unless defined $matrix
1955 0 0 if ($diagonal) { }
0 0 elsif ($lower) { }
0 0 elsif ($upper) { }
1958 0 0 if ($strictlower) { }
1964 0 0 if ($strictlower) { }
1972 0 0 if ($symmetric) { }
0 0 elsif ($skewsymmetric) { }
1979 0 0 if ($zero) { }
0 0 elsif ($nonpositive) { }
0 0 elsif ($nonnegative) { }
1982 0 0 if ($negative) { }
1988 0 0 if ($positive) { }
2005 0 0 $$matrix1{'rows'} < $$matrix2{'rows'} ? :
2006 0 0 $$matrix1{'columns'} < $$matrix2{'columns'} ? :
2011 0 0 if (defined $$matrix1{'name'} and defined $$matrix2{'name'})
2022 0 0 $$matrix1{'rows'} < $$matrix2{'rows'} ? :
2023 0 0 $$matrix1{'columns'} < $$matrix2{'columns'} ? :
2028 0 0 if (defined $$matrix1{'name'} and defined $$matrix2{'name'})
2051 0 4316 if ($$matrix{'special'}{'sign'} =~ /^positive/i) { }
0 4316 elsif ($$matrix{'special'}{'sign'} =~ /^positive/i) { }
2057 0 4316 if ($$matrix{'special'}{'structure'} =~ /symmetric/i and $i != $j)
2064 3939 377 if (abs $i - $j >= $$matrix{'special'}{'bandwidth'})
2079 0 0 if $$this{'data'}{$key}
2088 0 0 if $$matrix{'data'}{$key}
2096 0 0 if $thresh < 0
2099 0 0 if abs $$this{'data'}{$key} > $thresh
2107 0 0 if $thresh < 0
2109 0 0 if abs $$matrix{'data'}{$key} > $thresh
2162 20 0 if defined $$soln{'data'}{$key}
2168 0 2 unless $steps
2173 0 1728 unless $j == 1
2181 0 0 if $lj > $i - 1
2188 33858 50814 if $uj < $i + 1
2195 2 52 if $err < $tol
2214 0 1 unless $steps
2219 1 8 if $err < $tol
2233 0 55253 unless $$a[1] <=> $$b[1]
2245 0 60271 unless $$a[2] <=> $$b[2]
2259 0 0 unless $$a[1] - $$a[2] <=> $$b[1] - $$b[2]
2270 0 0 unless $matrix->elementkey($$a[0]) <=> $matrix->elementkey($$a[0]) or $$a[1] <=> $$b[1]
2287 0 1 if $$matrix{'special'}{'shape'} =~ /diagonal/i
2297 0 2 if $$matrix{'special'}{'shape'} =~ /diagonal/i
2301 225 421 unless ($i == $j)
2338 0 0 unless defined $matrix
2340 0 0 unless ($matrix->is_nonnegative)
2348 0 0 if $matsum
2349 0 0 if $name
2356 0 0 unless defined $matrix
2358 0 0 unless ($matrix->is_nonnegative)
2366 0 0 if $matsum
2367 0 0 if $name
2375 0 0 unless defined $matrix
2376 0 0 unless ($matrix->is_nonnegative)
2387 0 0 unless $rowsums{$i}
2391 0 0 if $name
2400 0 0 unless defined $matrix
2401 0 0 unless ($matrix->is_nonnegative)
2412 0 0 unless $rowsums{$i}
2416 0 0 if $name
2423 0 0 unless defined $matrix
2424 0 0 unless ($matrix->is_nonnegative)
2438 0 0 if $name
2446 0 0 unless defined $matrix
2447 0 0 unless ($matrix->is_nonnegative)
2461 0 0 if $name
2473 0 0 if $curpos >= $uniform
2491 290224 0 if defined $i and defined $j