Skip to content

Commit d3d0ada

Browse files
committed
fix/restore matrixproperties
1 parent 9f48ec2 commit d3d0ada

1 file changed

Lines changed: 0 additions & 76 deletions

File tree

src/common/matrixproperties.jl

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -144,79 +144,3 @@ function _ishermitian_exact_offdiag(Al, Au, ::Val{anti}) where {anti}
144144
end
145145
return true
146146
end
147-
148-
"""
149-
ishermitian(A; isapprox_kwargs...)
150-
151-
Test whether a linear map is Hermitian, i.e. `A = A'`.
152-
The `isapprox_kwargs` can be used to control the tolerances of the equality.
153-
"""
154-
function ishermitian(A; atol::Real = 0, rtol::Real = 0, norm = LinearAlgebra.norm, kwargs...)
155-
if iszero(atol) && iszero(rtol)
156-
return ishermitian_exact(A; kwargs...)
157-
else
158-
return 2 * norm(project_antihermitian(A; kwargs...)) max(atol, rtol * norm(A))
159-
end
160-
end
161-
function ishermitian_exact(A)
162-
return A == A'
163-
end
164-
function ishermitian_exact(A::AbstractMatrix; kwargs...)
165-
return _ishermitian_exact(A, Val(false); kwargs...)
166-
end
167-
168-
"""
169-
isantihermitian(A; isapprox_kwargs...)
170-
171-
Test whether a linear map is anti-Hermitian, i.e. `A = -A'`.
172-
The `isapprox_kwargs` can be used to control the tolerances of the equality.
173-
"""
174-
function isantihermitian(A; atol::Real = 0, rtol::Real = 0, norm = LinearAlgebra.norm, kwargs...)
175-
if iszero(atol) && iszero(rtol)
176-
return isantihermitian_exact(A; kwargs...)
177-
else
178-
return 2 * norm(project_hermitian(A; kwargs...)) max(atol, rtol * norm(A))
179-
end
180-
end
181-
function isantihermitian_exact(A)
182-
return A == -A'
183-
end
184-
function isantihermitian_exact(A::AbstractMatrix; kwargs...)
185-
return _ishermitian_exact(A, Val(true); kwargs...)
186-
end
187-
188-
# block implementation of exact checks
189-
function _ishermitian_exact(A::AbstractMatrix, anti::Val; blocksize = 32)
190-
n = size(A, 1)
191-
for j in 1:blocksize:n
192-
jb = min(blocksize, n - j + 1)
193-
_ishermitian_exact_diag(view(A, j:(j + jb - 1), j:(j + jb - 1)), anti) || return false
194-
for i in 1:blocksize:(j - 1)
195-
ib = blocksize
196-
_ishermitian_exact_offdiag(
197-
view(A, i:(i + ib - 1), j:(j + jb - 1)),
198-
view(A, j:(j + jb - 1), i:(i + ib - 1)),
199-
anti
200-
) || return false
201-
end
202-
end
203-
return true
204-
end
205-
function _ishermitian_exact_diag(A, ::Val{anti}) where {anti}
206-
n = size(A, 1)
207-
@inbounds for j in 1:n
208-
@simd for i in 1:j
209-
A[i, j] == (anti ? -adjoint(A[j, i]) : adjoint(A[j, i])) || return false
210-
end
211-
end
212-
return true
213-
end
214-
function _ishermitian_exact_offdiag(Al, Au, ::Val{anti}) where {anti}
215-
m, n = size(Al) # == reverse(size(Al))
216-
@inbounds for j in 1:n
217-
@simd for i in 1:m
218-
Al[i, j] == (anti ? -adjoint(Au[j, i]) : adjoint(Au[j, i])) || return false
219-
end
220-
end
221-
return true
222-
end

0 commit comments

Comments
 (0)