Branch Coverage

blib/lib/Math/MatrixReal.pm
Criterion Covered Total %
branch 453 726 62.4


line true false branch
94 0 1824 if @_ != 3
99 0 1824 unless $rows > 0 and $rows == int $rows
102 0 1824 unless $cols > 0 and $cols == int $cols
120 0 28 unless @_ == 2
124 0 28 unless ref $diag eq 'ARRAY'
132 0 2 unless @_ == 4
138 0 2 unless ref $diag eq 'ARRAY' and ref $lower eq 'ARRAY' and ref $upper eq 'ARRAY'
140 0 2 unless $l == $m and $n == $l + 1
147 6 26 if ($i - $j == -1) { }
8 18 elsif ($i == $j) { }
6 12 elsif ($i - $j == 1) { }
156 1 37 if @_ < 2
159 13 24 if ref $cols eq 'HASH'
160 10 27 defined $options->{'bounded_by'} ? :
166 1 6 if $rows != $cols and $options->{'symmetric'}
168 0 35 unless $rows > 0 and $rows == int $rows and ($cols > 0 and $cols == int $cols)
171 1 33 unless defined $min and defined $max and $min < $max
175 1 32 if $options->{'tridiag'} || $options->{'tridiagonal'} and $rows != $cols
178 1 31 if $options->{'diag'} || $options->{'diagonal'} and $rows != $cols
181 305 10699 $integer ? :
183 1 30 $options->{'diag'} || $options->{'diagonal'} ? :
184 24 26 abs $i - $j > 1 ? :
2 29 if $options->{'tridiag'} or $options->{'tridiagonal'}
185 12 19 $options->{'symmetric'} ? :
190 0 181 if @_ != 2
207 180 343 if ($col != $cols)
208 0 180 unless ($cols == 0)
209 180 0 if ($col > $cols)
213 0 181 unless ($string =~ /^\s*$/)
218 1 180 if ($rows == 0)
219 0 180 if ($warn)
232 0 25 @_ > 1 && ref $_[-1] eq 'HASH' ? :
244 0 30 @_ > 1 && ref $_[-1] eq 'HASH' ? :
273 0 55 unless $vector_type =~ /^(row|column)$/
278 2 53 unless &reftype($ref_to_vectors) eq 'ARRAY'
297 9 94 if ($ref eq '') { }
76 18 elsif ($ref eq 'ARRAY') { }
17 1 elsif ($ref ne 'HASH' and $current_vector->isa('Math::MatrixReal') || $current_vector->isa('Math::MatrixComplex')) { }
304 1 75 unless @array
307 43 32 if ($vector_type eq 'row') { }
328 60 40 $vector_type eq 'row' ? :
2 98 unless $vector_dims[$vector_type eq 'row' ? 0 : 1] == 1
331 59 39 $vector_type eq 'row' ? :
339 2 96 unless $length == $matrix_dim{$other_type}
355 140 113 if ($vector_type eq 'row') { }
372 0 52 if @_ != 1
396 5 0 if (defined $n) { }
397 1 4 if $n < 0
406 0 471 if @_ != 2
414 0 471 unless $rows1 == $rows2 and $cols1 == $cols2
423 5 466 if (defined $matrix2->[3])
433 0 290 if @_ != 1
445 0 13 if @_ != 1
451 0 13 unless $rows == $cols
460 1 2 unless $x1 >= 1 and $x2 >= 1 and $y1 >= 1 and $y2 >= 1
476 0 137 unless @_ == 3
480 0 137 unless $rows > 1 and $cols > 1
482 0 137 unless $r > 0 and $c > 0
484 0 137 unless $r <= $rows and $c <= $cols
498 595 2982 if ($i >= $r and $j >= $c) { }
864 2118 elsif ($i >= $r and $j < $c) { }
1260 858 elsif ($i < $r and $j < $c) { }
858 0 elsif ($i < $r and $j >= $c) { }
515 0 1 unless @_ == 3
520 0 1 unless $col1 <= $cols and $col2 <= $cols and $col1 == int $col1 and $col2 == int $col2
532 0 1 unless @_ == 3
537 0 1 unless $row1 <= $rows and $row2 <= $rows and $row1 == int $row1 and $row2 == int $row2
550 1 3 unless @_ == 3
555 1 1 if $cols1 != $cols2
556 0 1 unless $rows2 == 1
566 0 0 unless $rows == 1
568 0 0 unless $matrix->[0][0][$_]
579 0 0 $big < abs $matrix->[0][0][$j] ? :
582 0 0 unless $big
595 0 7 unless $rows == $cols
602 69 64 ($i + $j) % 2 == 0 ? :
614 0 19 if @_ != 2
621 0 19 if $row < 1 or $row > $rows
634 0 39 if @_ != 2
642 0 39 if $col < 1 or $col > $cols
654 0 2 if @_ != 1
669 0 3305 if @_ != 1
681 0 66 if @_ != 1
699 0 24 if @_ != 1
713 0 2794 if @_ != 4
718 0 2794 if $row < 1 or $row > $rows
719 0 2794 if $col < 1 or $col > $cols
727 0 3289 if @_ != 3
732 0 3289 if $row < 1 or $row > $rows
733 0 3289 if $col < 1 or $col > $cols
740 0 870 if @_ != 1
749 0 191 if @_ != 1
762 195 1148 if $sum > $max
768 0 1 unless @_ == 1
787 0 5 unless $v->is_row_vector or $v->is_col_vector
789 0 5 unless $p =~ /Inf(inity)?/i or $p >= 1
792 1 4 if ($p =~ /^(Inf|Infinity)$/i)
794 2 1 if $x > $max
805 0 1 if @_ != 1
818 4 1 if $sum > $max
825 0 1 if @_ != 2
832 0 1 unless $rows1 == $rows2 and $cols1 == $cols2
848 0 92 unless @_ == 2
853 0 92 unless ref $function
867 0 39 unless @_ == 2
872 0 39 unless ref $function
873 0 39 unless $rows == $cols
879 806 166 unless $i == $j
890 0 19 unless @_ == 1
897 0 69 if @_ != 2
903 0 69 unless $rows1 == $cols2 and $cols1 == $rows2
908 59 10 if ($rows1 == $cols1) { }
935 0 25 if @_ != 3
942 0 25 unless $rows1 == $rows2 and $rows1 == $rows3 and $cols1 == $cols2 and $cols1 == $cols3
959 0 171 if @_ != 3
966 0 171 unless $rows1 == $rows2 and $rows1 == $rows3 and $cols1 == $cols2 and $cols1 == $cols3
983 0 24 if @_ != 3
990 0 24 unless $rows1 == $rows2 and $cols1 == $cols2
1003 0 45 if @_ != 2
1010 0 45 unless $cols1 == $rows2
1029 0 21 if @_ != 2
1035 0 21 unless $rows == $cols
1036 0 21 unless $argument =~ /^[+-]?\d+$/
1038 1 20 if $argument == 1
1043 5 15 if ($argument < 0) { }
3 12 elsif ($argument == 0) { }
1046 0 5 unless (defined $inverse)
1051 5 0 if ($inverse) { }
1052 4 1 if $argument == -1
1069 10 2 if ($matrix->is_diagonal) { }
1084 2 1 if (@_ == 1)
1087 0 2 if @_ > 2
1088 0 2 unless ref $matrix eq 'Math::MatrixReal'
1091 1 499 if $e < $min
1094 1 0 $_[0] < $_[1] ? :
1099 2 1 if (@_ == 1)
1102 0 2 if @_ > 2
1103 0 2 unless ref $matrix eq 'Math::MatrixReal'
1106 17 483 if $e > $max
1110 0 1 $_[0] > $_[1] ? :
1115 0 0 if @_ != 1
1120 0 0 unless $rows == $cols
1147 0 0 if @_ != 2
1156 0 0 unless $rows == $cols
1161 0 0 unless $vector->[2] == 1
1164 0 0 unless $vector->[1] == $n
1181 0 0 if ($val > $max)
1183 0 0 if ($max != 0)
1197 0 177 if @_ != 1
1209 0 177 unless $rows == $cols
1232 2015 6468 if (($swap = abs $temp->[0][$i][$j]) > $max)
1240 3 773 if $max == 0
1241 440 333 if ($k != $row)
1256 357 416 if ($k != $col)
1274 1357 129 if ($swap != 0)
1297 0 113 if @_ != 2
1307 0 113 unless defined $LR_matrix->[3] and $rows == $cols
1312 0 113 unless $b_vector->[2] == 1
1315 0 113 unless $b_vector->[1] == $n
1340 0 665 if ($LR_matrix->[0][$i][$i] == 0) { }
1342 0 0 if ($y_vector->[0][$i][0] != 0) { }
1362 0 113 if ($dimension)
1364 0 0 if ($dimension == $n) { }
1390 0 25 if @_ != 1
1398 0 25 unless defined $matrix->[3] and $rows == $cols
1403 25 0 if ($matrix->[0][$n - 1][$n - 1] != 0) { }
1409 87 25 if ($j > 0)
1414 112 0 if (($rows, $x_vector, $cols) = $matrix->solve_LR($y_vector)) { }
1438 0 1 if @_ != 2
1444 0 1 unless $rows1 == $cols1
1447 0 1 unless $rows2 == $cols2
1450 0 1 unless $rows1 == $rows2 and $cols1 == $cols2
1460 0 172 unless @_ == 1
1465 0 172 unless $rows == $cols
1469 24 148 if ($matrix->is_upper_triangular) { }
3 145 elsif ($matrix->is_lower_triangular) { }
1481 0 145 if @_ != 1
1488 0 145 unless defined $matrix->[3] and $rows == $cols
1505 0 5 if @_ != 1
1512 0 5 unless defined $matrix->[3] and $rows == $cols
1518 4 6 if $matrix->[0][$order][$order] != 0
1525 0 2 if @_ != 2
1532 0 2 unless $cols1 == 1
1535 0 2 unless $cols2 == 1
1538 0 2 unless $rows1 == $rows2
1548 0 1 if @_ != 2
1556 0 1 unless $cols1 == 1
1559 0 1 unless $cols2 == 1
1562 0 1 unless $rows1 == $rows2
1567 0 1 unless $n == 3
1582 0 2 if @_ != 1
1588 0 2 unless $cols == 1 or $rows == 1
1591 0 2 if $rows == 1
1604 0 0 if @_ != 1
1612 0 0 unless $rows == $cols
1619 0 0 if ($matrix->[0][$i][$i] == 0)
1621 0 0 if ($ok)
1637 0 0 if ($sum > $max)
1640 0 0 unless ($ok)
1656 0 0 if ($sum > $max)
1661 0 0 if ($ok) { }
1667 0 0 if @_ != 4
1678 0 0 unless $rows1 == $cols1
1683 0 0 unless $cols2 == 1
1686 0 0 unless $cols3 == 1
1689 0 0 unless $rows2 == $n and $rows3 == $n
1692 0 0 unless $norm = $matrix->_init_iteration
1713 0 0 if ($norm > 0) { }
1725 0 0 if @_ != 4
1736 0 0 unless $rows1 == $cols1
1741 0 0 unless $cols2 == 1
1744 0 0 unless $cols3 == 1
1747 0 0 unless $rows2 == $n and $rows3 == $n
1750 0 0 unless $norm = $matrix->_init_iteration
1772 0 0 if ($norm > 0) { }
1784 0 0 if @_ != 5
1795 0 0 unless $rows1 == $cols1
1800 0 0 unless $cols2 == 1
1803 0 0 unless $cols3 == 1
1806 0 0 unless $rows2 == $n and $rows3 == $n
1809 0 0 unless $norm = $matrix->_init_iteration
1832 0 0 if ($norm > 0) { }
1864 0 814 if ($scale == 0) { }
1878 382 432 $t1 >= 0 ? :
1951 16343 45911 if ($aa > $ab) { }
1957 0 45911 if $ab == 0
1981 2020 28167 if abs($e->[$m]) + $dd == $dd
1983 1943 890 if ($m != $l)
1986 0 1943 if $iter++ >= 30
1990 945 998 $g >= 0 ? :
1999 0 28167 if ($t == 0)
2050 15 834 if ($scale == 0) { }
2064 404 430 $t >= 0 ? :
2126 2104 30156 if abs($e->[$m]) + $dd == $dd
2128 1988 939 if ($m != $l)
2130 0 1988 if $iter++ >= 30
2134 970 1018 $g >= 0 ? :
2143 0 30156 if ($t == 0)
2175 0 33 unless $rows = $cols
2177 0 33 unless $A->is_symmetric
2210 0 33 unless $rows = $cols
2212 0 33 unless $T->is_tridiagonal
2217 33 0 if ($Q) { }
2263 0 5 unless $rows = $cols
2265 0 5 unless $M->is_symmetric
2295 0 33 unless $rows = $cols
2297 0 33 unless $A->is_symmetric
2331 0 33 unless $rows = $cols
2333 0 33 unless $T->is_tridiagonal
2368 0 19 unless $rows == $cols
2370 17 2 if ($matrix->is_upper_triangular or $matrix->is_lower_triangular)
2376 2 0 if $matrix->is_symmetric
2392 0 12 unless $rows == $cols
2393 0 12 unless $M->is_symmetric
2416 0 4 unless $r == $c
2418 1 3 unless $matrix->is_symmetric
2422 2 7 if ($x <= 0)
2430 0 4 unless $r == $c
2432 1 3 unless $matrix->is_symmetric
2436 1 8 if ($x < 0)
2445 2 7 $r == 1 ? :
2450 7 4 $c == 1 ? :
2456 0 4 unless $matrix->is_quadratic
2461 4 0 abs ~$matrix * $matrix - $one < 1e-12 ? :
2468 68 32 if (shift() <= 0)
2474 75 25 if (shift() >= 0)
2481 2 5 unless $m->is_quadratic
2482 5 0 abs $m ** (int($k) + 1) - $m < 1e-12 ? :
2495 2 106 unless $rows == $cols
2501 4 23480 unless $M->[0][$i][$j] == $M->[0][$j][$i]
2512 1 71 unless $rows == $cols
2518 1600 37926 if $i == $j
2519 1530 36396 if $i + 1 == $j
2520 1529 34867 if $i - 1 == $j
2521 1 34866 if $M->[0][$i][$j]
2533 2 194 unless $rows == $cols
2537 253 393 if $i <= $j
2538 152 241 if $M->[0][$i][$j]
2550 2 154 unless $rows == $cols
2554 90 219 if $i >= $j
2555 148 71 if $M->[0][$i][$j]
2567 1 16 unless $rows == $cols
2571 91 616 if $i == $j
2572 3 613 if $M->[0][$i][$j]
2579 0 14 unless @_ == 1
2581 11 3 $matrix->[1] == $matrix->[2] ? :
2585 0 1 unless @_ == 1
2590 0 9 unless @_ == 1
2591 2 7 (shift())->[3] ? :
2600 1 1 ~$matrix * $matrix - $matrix * ~$matrix < $eps ? :
2608 1 3 unless $rows == $cols
2611 0 26 unless $m->[0][$i][$j] == -$m->[0][$j][$i]
2623 2 4 unless $m->is_symmetric
2627 1 14 if shift() < 0
2629 1 3 $neg ? :
2636 1 61 unless $m->[0][$i][$j] == 1 or $m->[0][$i][$j] == 0
2656 1 1 if ($args{'name'})
2663 4 8 if $j == $col and $i != $row
2667 0 2 if $args{'semi'}
2681 1 1 if ($args{'name'})
2688 6 6 if $j == 1
2690 6 6 if $j != $col
2691 4 8 if $j == $col and $i != $row
2716 0 2 unless ($args{'align'} =~ /^(c|l|r)$/)
2722 1 1 if ($args{'name'})
2731 4 8 if ($j == $col and $i != $row) { }
2 6 elsif ($j == $col and $i == $row) { }
2741 0 2 if ($args{'displaymath'}) { }
2756 9 10 if abs $x > $radius
2767 2 6 if ($rows == 1) { }
2 4 elsif ($columns == 1) { }
2778 4 4 wantarray ? :
2787 28 24 if ($column->element($l, 1) > $m)
2802 2 6 if ($rows == 1) { }
2 4 elsif ($columns == 1) { }
2813 4 4 wantarray ? :
2822 0 52 if ($column->element($l, 1) < $m)
2844 4 1 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
1 0 elsif (defined $argument) { }
2846 1 3 unless $orows == $arows
2850 21 30 $j < $ocols ? :
2890 169 272 if ($object->[0][$i][$j] != 0)
2911 0 25 if ($object->[0][$i][$j] != 0)
2928 3 4 !defined($precision) ? :
2929 2 5 if defined $precision and $precision == 0
2956 25 0 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
2959 23 2 if (defined $flag) { }
2982 164 0 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
2985 163 1 if (defined $flag) { }
2988 0 163 if ($flag) { }
3022 2 4 if (ref($argument) =~ /Math::MatrixReal/)
3028 2 4 if ($flag == 1) { }
3030 0 2 if (ref($argument) =~ /Math::MatrixReal/) { }
3033 0 0 unless $arows == $acols
3040 1 1 unless $mrows == $mcols
3050 2 2 if (ref($arg) =~ /Math::MatrixReal/) { }
3052 0 2 if ($arg->is_col_vector)
3055 0 2 unless $arows == $acols
3072 32 21 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
21 0 elsif (defined $argument and not ref $argument) { }
3075 0 32 if (defined $flag and $flag) { }
3086 20 1 if (defined $flag) { }
3137 9 1 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
3146 0 485 if ($object->[0][$i][$j] != $argument->[0][$i][$j])
3167 3 1 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
3171 1 2 unless $r == $rows and $c == $cols
3178 2 0 if ($object->[0][$i][$j] != $argument->[0][$i][$j])
3196 3 2 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
2 0 elsif (defined $argument and not ref $argument) { }
3199 0 3 if (defined $flag and $flag) { }
3208 0 2 if (defined $flag and $flag) { }
3224 2 0 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
0 0 elsif (defined $argument and not ref $argument) { }
3227 0 2 if (defined $flag and $flag) { }
3234 0 0 if (defined $flag and $flag) { }
3250 3 0 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
0 0 elsif (defined $argument and not ref $argument) { }
3253 0 3 if (defined $flag and $flag) { }
3260 0 0 if (defined $flag and $flag) { }
3276 2 0 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
0 0 elsif (defined $argument and not ref $argument) { }
3279 0 2 if (defined $flag and $flag) { }
3286 0 0 if (defined $flag and $flag) { }