@@ -1587,24 +1587,25 @@ factorize(A::Transpose) = transpose(factorize(parent(A)))
15871587factorize (a:: Number ) = a # same as how factorize behaves on Diagonal types
15881588
15891589function getstructure (A:: StridedMatrix )
1590+ require_one_based_indexing (A)
15901591 m, n = size (A)
15911592 if m == 1 return A[1 ] end
15921593 utri = true
15931594 utri1 = true
15941595 herm = true
15951596 sym = true
1596- for j = 1 : n- 1 , i = j+ 1 : m
1597- if utri1
1597+ for j = 1 : n, i = j: m
1598+ if (j < n) && (i > j) && utri1 # indices are off-diagonal
15981599 if A[i,j] != 0
15991600 utri1 = i == j + 1
16001601 utri = false
16011602 end
16021603 end
16031604 if sym
1604- sym &= A[i,j] == A[j,i]
1605+ sym &= A[i,j] == transpose ( A[j,i])
16051606 end
16061607 if herm
1607- herm &= A[i,j] == conj (A[j,i])
1608+ herm &= A[i,j] == adjoint (A[j,i])
16081609 end
16091610 if ! (utri1| herm| sym) break end
16101611 end
@@ -1617,10 +1618,12 @@ function getstructure(A::StridedMatrix)
16171618 if ltri1
16181619 for i = 1 : n- 1
16191620 if A[i,i+ 1 ] != 0
1620- ltri & = false
1621+ ltri = false
16211622 break
16221623 end
16231624 end
1625+ else
1626+ ltri = false
16241627 end
16251628 return (utri, utri1, ltri, ltri1, sym, herm)
16261629end
@@ -1779,6 +1782,10 @@ Condition number of the matrix `M`, computed using the operator `p`-norm. Valid
17791782"""
17801783function cond (A:: AbstractMatrix , p:: Real = 2 )
17811784 if p == 2
1785+ if isempty (A)
1786+ checksquare (A)
1787+ return zero (real (eigtype (eltype (A))))
1788+ end
17821789 v = svdvals (A)
17831790 maxv = maximum (v)
17841791 return iszero (maxv) ? oftype (real (maxv), Inf ) : maxv / minimum (v)
0 commit comments