Skip to content

Commit 2999cfe

Browse files
committed
Concrete type for ColVecs
1 parent 89c6669 commit 2999cfe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/utils.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ end
1515
1616
A lightweight box for an `AbstractMatrix` to make it behave like a vector of vectors.
1717
"""
18-
struct ColVecs{T, TX<:AbstractMatrix{T}} <: AbstractVector{SubArray}
18+
struct ColVecs{T, TX<:AbstractMatrix{T}, S} <: AbstractVector{S}
1919
X::TX
20-
ColVecs(X::TX) where {T, TX<:AbstractMatrix{T}} = new{T, TX}(X)
20+
function ColVecs(X::TX) where {T, TX<:AbstractMatrix{T}}
21+
S = typeof(view(X, :, 1))
22+
new{T, TX, S}(X)
23+
end
2124
end
2225

2326
Base.size(D::ColVecs) = (size(D.X, 2),)

0 commit comments

Comments
 (0)