@@ -9,37 +9,43 @@ function check_input(::typeof(left_orth!), A::AbstractMatrix, VC)
99 m, n = size(A)
1010 minmn = min(m, n)
1111 V, C = VC
12- (V isa AbstractMatrix && eltype(V) == eltype(A) && size(V) == (m, minmn)) ||
13- throw(DimensionMismatch(" Isometric V must have the same eltype as A, the same number of rows and min(m, n) columns" ))
14- (C isa AbstractMatrix && eltype(C) == eltype(A) &&
15- (isempty(C) || size(C) == (minmn, n))) ||
16- throw(DimensionMismatch(" Corestriction C must have the same eltype as A, the same number of columns and min(m, n) rows" ))
12+ @assert V isa AbstractMatrix && C isa AbstractMatrix
13+ @check_size(V, (m, minmn))
14+ @check_scalar(V, A)
15+ if ! isempty(C)
16+ @check_size(C, (minmn, n))
17+ @check_scalar(C, A)
18+ end
1719 return nothing
1820end
1921function check_input(:: typeof (right_orth!), A:: AbstractMatrix , CVᴴ)
2022 m, n = size(A)
2123 minmn = min(m, n)
2224 C, Vᴴ = CVᴴ
23- (Vᴴ isa AbstractMatrix && eltype(Vᴴ) == eltype(A) && size(Vᴴ) == (minmn, n)) ||
24- throw(DimensionMismatch(" Adjoint isometric matrix Vᴴ must have the same eltype as A, the same number of columns and min(m, n) rows" ))
25- (C isa AbstractMatrix && eltype(C) == eltype(A) &&
26- (isempty(C) || size(C) == (m, minmn))) ||
27- throw(DimensionMismatch(" Corestriction C must have the same eltype as A, the same number of rows and min(m, n) columns" ))
25+ @assert C isa AbstractMatrix && Vᴴ isa AbstractMatrix
26+ if ! isempty(C)
27+ @check_size(C, (m, minmn))
28+ @check_scalar(C, A)
29+ end
30+ @check_size(Vᴴ, (minmn, n))
31+ @check_scalar(Vᴴ, A)
2832 return nothing
2933end
3034
3135function check_input(:: typeof (left_null!), A:: AbstractMatrix , N)
3236 m, n = size(A)
3337 minmn = min(m, n)
34- (N isa AbstractMatrix && eltype(N) == eltype(A) && size(N) == (m, m - minmn)) ||
35- throw(DimensionMismatch(" Isometric matrix must have the same eltype as A, the same number of rows and m - min(m, n) columns" ))
38+ @assert N isa AbstractMatrix
39+ @check_size(N, (m, m - minmn))
40+ @check_scalar(N, A)
3641 return nothing
3742end
3843function check_input(:: typeof (right_null!), A:: AbstractMatrix , Nᴴ)
3944 m, n = size(A)
4045 minmn = min(m, n)
41- (Nᴴ isa AbstractMatrix && eltype(Nᴴ) == eltype(A) && size(Nᴴ) == (n - minmn, n)) ||
42- throw(DimensionMismatch(" Adjoint isometric matrix Nᴴ must have the same eltype as A, the same number of columns and n - min(m, n) rows" ))
46+ @assert Nᴴ isa AbstractMatrix
47+ @check_size(Nᴴ, (n - minmn, n))
48+ @check_scalar(Nᴴ, A)
4349 return nothing
4450end
4551
0 commit comments