Branch Coverage

blib/lib/Math/MatrixReal.pm
Criterion Covered Total %
branch 437 724 60.3


line true false branch
94 0 1772 if @_ != 3
99 0 1772 unless $rows > 0 and $rows == int $rows
102 0 1772 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'} ? :
165 1 36 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
174 1 32 if $$options{'tridiag'} || $$options{'tridiagonal'} and $rows != $cols
177 1 31 if $$options{'diag'} || $$options{'diagonal'} and $rows != $cols
181 305 10677 $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 175 if @_ != 2
207 174 341 if ($col != $cols)
208 0 174 unless ($cols == 0)
209 174 0 if ($col > $cols)
213 0 175 unless ($string =~ /^\s*$/)
218 1 174 if ($rows == 0)
219 0 174 if ($warn)
232 0 25 @_ > 1 && ref $_[-1] eq 'HASH' ? :
244 0 28 @_ > 1 && ref $_[-1] eq 'HASH' ? :
273 0 53 unless $vector_type =~ /^(row|column)$/
278 2 51 unless reftype $ref_to_vectors eq 'ARRAY'
297 9 90 if ($ref eq '') { }
72 18 elsif ($ref eq 'ARRAY') { }
17 1 elsif ($ref ne 'HASH' and $current_vector->isa('Math::MatrixReal') || $current_vector->isa('Math::MatrixComplex')) { }
304 1 71 unless @array
307 39 32 if ($vector_type eq 'row') { }
328 56 40 $vector_type eq 'row' ? :
2 94 unless $vector_dims[$vector_type eq 'row' ? 0 : 1] == 1
331 55 39 $vector_type eq 'row' ? :
338 2 92 unless $length == $matrix_dim{$other_type}
355 130 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 15 if @_ != 2
621 0 15 if $row < 1 or $row > $rows
634 0 11 if @_ != 2
642 0 11 if $col < 1 or $col > $cols
654 0 3283 if @_ != 1
666 0 66 if @_ != 1
684 0 24 if @_ != 1
698 0 2784 if @_ != 4
703 0 2784 if $row < 1 or $row > $rows
704 0 2784 if $col < 1 or $col > $cols
712 0 3091 if @_ != 3
717 0 3091 if $row < 1 or $row > $rows
718 0 3091 if $col < 1 or $col > $cols
725 0 850 if @_ != 1
734 0 191 if @_ != 1
747 195 1148 if $sum > $max
753 0 1 unless @_ == 1
772 0 5 unless $v->is_row_vector or $v->is_col_vector
774 0 5 unless $p =~ /Inf(inity)?/i or $p >= 1
777 1 4 if ($p =~ /^(Inf|Infinity)$/i)
779 2 1 if $x > $max
790 0 1 if @_ != 1
803 4 1 if $sum > $max
810 0 1 if @_ != 2
817 0 1 unless $rows1 == $rows2 and $cols1 == $cols2
833 0 92 unless @_ == 2
838 0 92 unless ref $function
852 0 39 unless @_ == 2
857 0 39 unless ref $function
858 0 39 unless $rows == $cols
864 806 166 unless $i == $j
875 0 19 unless @_ == 1
882 0 57 if @_ != 2
888 0 57 unless $rows1 == $cols2 and $cols1 == $rows2
893 55 2 if ($rows1 == $cols1) { }
920 0 25 if @_ != 3
927 0 25 unless $rows1 == $rows2 and $rows1 == $rows3 and $cols1 == $cols2 and $cols1 == $cols3
944 0 171 if @_ != 3
951 0 171 unless $rows1 == $rows2 and $rows1 == $rows3 and $cols1 == $cols2 and $cols1 == $cols3
968 0 24 if @_ != 3
975 0 24 unless $rows1 == $rows2 and $cols1 == $cols2
988 0 45 if @_ != 2
995 0 45 unless $cols1 == $rows2
1014 0 21 if @_ != 2
1020 0 21 unless $rows == $cols
1021 0 21 unless $argument =~ /^[+-]?\d+$/
1023 1 20 if $argument == 1
1028 5 15 if ($argument < 0) { }
3 12 elsif ($argument == 0) { }
1031 0 5 unless (defined $inverse)
1036 5 0 if ($inverse) { }
1037 4 1 if $argument == -1
1054 10 2 if ($matrix->is_diagonal) { }
1069 2 1 if (@_ == 1)
1072 0 2 if @_ > 2
1073 0 2 unless ref $matrix eq 'Math::MatrixReal'
1076 8 492 if $e < $min
1079 1 0 $_[0] < $_[1] ? :
1084 2 1 if (@_ == 1)
1087 0 2 if @_ > 2
1088 0 2 unless ref $matrix eq 'Math::MatrixReal'
1091 10 490 if $e > $max
1095 0 1 $_[0] > $_[1] ? :
1100 0 0 if @_ != 1
1105 0 0 unless $rows == $cols
1132 0 0 if @_ != 2
1141 0 0 unless $rows == $cols
1146 0 0 unless $$vector[2] == 1
1149 0 0 unless $$vector[1] == $n
1166 0 0 if ($val > $max)
1168 0 0 if ($max != 0)
1182 0 177 if @_ != 1
1194 0 177 unless $rows == $cols
1217 1786 6697 if (($swap = abs $$temp[0][$i][$j]) > $max)
1225 3 773 if $max == 0
1226 346 427 if ($k != $row)
1241 393 380 if ($k != $col)
1259 1357 129 if ($swap != 0)
1282 0 113 if @_ != 2
1292 0 113 unless defined $$LR_matrix[3] and $rows == $cols
1297 0 113 unless $$b_vector[2] == 1
1300 0 113 unless $$b_vector[1] == $n
1325 0 665 if ($$LR_matrix[0][$i][$i] == 0) { }
1327 0 0 if ($$y_vector[0][$i][0] != 0) { }
1347 0 113 if ($dimension)
1349 0 0 if ($dimension == $n) { }
1375 0 25 if @_ != 1
1383 0 25 unless defined $$matrix[3] and $rows == $cols
1388 25 0 if ($$matrix[0][$n - 1][$n - 1] != 0) { }
1394 87 25 if ($j > 0)
1399 112 0 if (($rows, $x_vector, $cols) = $matrix->solve_LR($y_vector)) { }
1423 0 1 if @_ != 2
1429 0 1 unless $rows1 == $cols1
1432 0 1 unless $rows2 == $cols2
1435 0 1 unless $rows1 == $rows2 and $cols1 == $cols2
1445 0 172 unless @_ == 1
1450 0 172 unless $rows == $cols
1454 24 148 if ($matrix->is_upper_triangular) { }
3 145 elsif ($matrix->is_lower_triangular) { }
1466 0 145 if @_ != 1
1473 0 145 unless defined $$matrix[3] and $rows == $cols
1490 0 5 if @_ != 1
1497 0 5 unless defined $$matrix[3] and $rows == $cols
1503 4 6 if $$matrix[0][$order][$order] != 0
1510 0 2 if @_ != 2
1517 0 2 unless $cols1 == 1
1520 0 2 unless $cols2 == 1
1523 0 2 unless $rows1 == $rows2
1533 0 1 if @_ != 2
1541 0 1 unless $cols1 == 1
1544 0 1 unless $cols2 == 1
1547 0 1 unless $rows1 == $rows2
1552 0 1 unless $n == 3
1567 0 2 if @_ != 1
1573 0 2 unless $cols == 1 or $rows == 1
1576 0 2 if $rows == 1
1589 0 0 if @_ != 1
1597 0 0 unless $rows == $cols
1604 0 0 if ($$matrix[0][$i][$i] == 0)
1606 0 0 if ($ok)
1622 0 0 if ($sum > $max)
1625 0 0 unless ($ok)
1641 0 0 if ($sum > $max)
1646 0 0 if ($ok) { }
1652 0 0 if @_ != 4
1663 0 0 unless $rows1 == $cols1
1668 0 0 unless $cols2 == 1
1671 0 0 unless $cols3 == 1
1674 0 0 unless $rows2 == $n and $rows3 == $n
1677 0 0 unless $norm = $matrix->_init_iteration
1698 0 0 if ($norm > 0) { }
1710 0 0 if @_ != 4
1721 0 0 unless $rows1 == $cols1
1726 0 0 unless $cols2 == 1
1729 0 0 unless $cols3 == 1
1732 0 0 unless $rows2 == $n and $rows3 == $n
1735 0 0 unless $norm = $matrix->_init_iteration
1757 0 0 if ($norm > 0) { }
1769 0 0 if @_ != 5
1780 0 0 unless $rows1 == $cols1
1785 0 0 unless $cols2 == 1
1788 0 0 unless $cols3 == 1
1791 0 0 unless $rows2 == $n and $rows3 == $n
1794 0 0 unless $norm = $matrix->_init_iteration
1817 0 0 if ($norm > 0) { }
1849 0 814 if ($scale == 0) { }
1863 422 392 $t1 >= 0 ? :
1936 17613 42521 if ($aa > $ab) { }
1942 0 42521 if $ab == 0
1966 2046 27060 if abs($$e[$m]) + $dd == $dd
1968 1914 890 if ($m != $l)
1971 0 1914 if $iter++ >= 30
1975 1170 744 $g >= 0 ? :
1984 0 27060 if ($t == 0)
2035 15 834 if ($scale == 0) { }
2049 435 399 $t >= 0 ? :
2111 2127 29204 if abs($$e[$m]) + $dd == $dd
2113 1956 939 if ($m != $l)
2115 0 1956 if $iter++ >= 30
2119 1174 782 $g >= 0 ? :
2128 0 29204 if ($t == 0)
2160 0 33 unless $rows = $cols
2162 0 33 unless $A->is_symmetric
2195 0 33 unless $rows = $cols
2197 0 33 unless $T->is_tridiagonal
2202 33 0 if ($Q) { }
2248 0 5 unless $rows = $cols
2250 0 5 unless $M->is_symmetric
2280 0 33 unless $rows = $cols
2282 0 33 unless $A->is_symmetric
2316 0 33 unless $rows = $cols
2318 0 33 unless $T->is_tridiagonal
2353 0 19 unless $rows == $cols
2355 17 2 if ($matrix->is_upper_triangular or $matrix->is_lower_triangular)
2361 2 0 if $matrix->is_symmetric
2377 0 12 unless $rows == $cols
2378 0 12 unless $M->is_symmetric
2401 0 4 unless $r == $c
2403 1 3 unless $matrix->is_symmetric
2407 2 7 if ($x <= 0)
2415 0 4 unless $r == $c
2417 1 3 unless $matrix->is_symmetric
2421 1 8 if ($x < 0)
2430 2 7 $r == 1 ? :
2435 7 4 $c == 1 ? :
2441 0 4 unless $matrix->is_quadratic
2446 4 0 abs ~$matrix * $matrix - $one < 1e-12 ? :
2453 68 32 if (shift() <= 0)
2459 75 25 if (shift() >= 0)
2466 2 5 unless $m->is_quadratic
2467 5 0 abs $m ** (int($k) + 1) - $m < 1e-12 ? :
2480 2 106 unless $rows == $cols
2486 4 23480 unless $$M[0][$i][$j] == $$M[0][$j][$i]
2497 1 71 unless $rows == $cols
2503 1600 37926 if $i == $j
2504 1530 36396 if $i + 1 == $j
2505 1529 34867 if $i - 1 == $j
2506 1 34866 if $$M[0][$i][$j]
2518 2 194 unless $rows == $cols
2522 253 393 if $i <= $j
2523 152 241 if $$M[0][$i][$j]
2535 2 154 unless $rows == $cols
2539 90 219 if $i >= $j
2540 148 71 if $$M[0][$i][$j]
2552 1 16 unless $rows == $cols
2556 91 616 if $i == $j
2557 3 613 if $$M[0][$i][$j]
2564 0 14 unless @_ == 1
2566 11 3 $$matrix[1] == $$matrix[2] ? :
2570 0 1 unless @_ == 1
2575 0 9 unless @_ == 1
2576 2 7 (shift())->[3] ? :
2585 1 1 ~$matrix * $matrix - $matrix * ~$matrix < $eps ? :
2593 1 3 unless $rows == $cols
2596 0 26 unless $$m[0][$i][$j] == -$$m[0][$j][$i]
2608 2 4 unless $m->is_symmetric
2612 1 14 if shift() < 0
2614 1 3 $neg ? :
2621 1 61 unless $$m[0][$i][$j] == 1 or $$m[0][$i][$j] == 0
2641 1 1 if ($args{'name'})
2648 4 8 if $j == $col and $i != $row
2652 0 2 if $args{'semi'}
2666 1 1 if ($args{'name'})
2673 6 6 if $j == 1
2675 6 6 if $j != $col
2676 4 8 if $j == $col and $i != $row
2701 0 2 unless ($args{'align'} =~ /^(c|l|r)$/)
2707 1 1 if ($args{'name'})
2716 4 8 if ($j == $col and $i != $row) { }
2 6 elsif ($j == $col and $i == $row) { }
2726 0 2 if ($args{'displaymath'}) { }
2741 9 10 if abs $x > $radius
2752 0 0 if ($rows == 1) { }
0 0 elsif ($columns == 1) { }
2763 0 0 wantarray ? :
2772 0 0 if ($column->element($l, 1) > $m)
2787 0 0 if ($rows == 1) { }
0 0 elsif ($columns == 1) { }
2798 0 0 wantarray ? :
2807 0 0 if ($column->element($l, 1) < $m)
2829 4 1 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
1 0 elsif (defined $argument) { }
2831 1 3 unless $orows == $arows
2835 21 30 $j < $ocols ? :
2875 165 262 if ($$object[0][$i][$j] != 0)
2896 0 25 if ($$object[0][$i][$j] != 0)
2913 3 4 !defined($precision) ? :
2914 2 5 if defined $precision and $precision == 0
2941 25 0 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
2944 23 2 if (defined $flag) { }
2967 164 0 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
2970 163 1 if (defined $flag) { }
2973 0 163 if ($flag) { }
3007 2 4 if (ref($argument) =~ /Math::MatrixReal/)
3013 2 4 if ($flag == 1) { }
3015 0 2 if (ref($argument) =~ /Math::MatrixReal/) { }
3018 0 0 unless $arows == $acols
3025 1 1 unless $mrows == $mcols
3035 2 2 if (ref($arg) =~ /Math::MatrixReal/) { }
3037 0 2 if ($arg->is_col_vector)
3040 0 2 unless $arows == $acols
3057 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) { }
3060 0 32 if (defined $flag and $flag) { }
3071 20 1 if (defined $flag) { }
3122 9 1 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
3131 0 485 if ($$object[0][$i][$j] != $$argument[0][$i][$j])
3152 3 1 if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { }
3156 1 2 unless $r == $rows and $c == $cols
3163 2 0 if ($$object[0][$i][$j] != $$argument[0][$i][$j])
3181 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) { }
3184 0 3 if (defined $flag and $flag) { }
3193 0 2 if (defined $flag and $flag) { }
3209 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) { }
3212 0 2 if (defined $flag and $flag) { }
3219 0 0 if (defined $flag and $flag) { }
3235 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) { }
3238 0 3 if (defined $flag and $flag) { }
3245 0 0 if (defined $flag and $flag) { }
3261 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) { }
3264 0 2 if (defined $flag and $flag) { }
3271 0 0 if (defined $flag and $flag) { }