|
31 | 31 |
|
32 | 32 | TArray{T}(d::Integer...) where T = TArray(T, d) |
33 | 33 | TArray{T}(::UndefInitializer, d::Integer...) where T = TArray(T, d) |
| 34 | +TArray{T}(::UndefInitializer, dim::NTuple{N,Int}) where {T,N} = TArray(T, dim) |
34 | 35 | TArray{T,N}(d::Vararg{<:Integer,N}) where {T,N} = TArray(T, d) |
35 | 36 | TArray{T,N}(::UndefInitializer, d::Vararg{<:Integer,N}) where {T,N} = TArray{T,N}(d) |
36 | 37 | TArray{T,N}(dim::NTuple{N,Int}) where {T,N} = TArray(T, dim) |
@@ -136,7 +137,7 @@ function Base.show(io::IO, ::MIME"text/plain", x::TArray) |
136 | 137 | arr = x.orig_task.storage[x.ref][2] |
137 | 138 | @warn "Here shows the originating task's storage, " * |
138 | 139 | "not the current task's storage. " * |
139 | | - "Please explictly call show(::TArray) to display the current task's version of a TArray." |
| 140 | + "Please explicitly call show(::TArray) to display the current task's version of a TArray." |
140 | 141 | show(io, MIME("text/plain"), arr) |
141 | 142 | end |
142 | 143 |
|
@@ -220,13 +221,14 @@ Base.:-(x::TArray) = (- _get(x)) |> localize |
220 | 221 | Base.transpose(x::TArray) = transpose(_get(x)) |> localize |
221 | 222 | Base.adjoint(x::TArray) = adjoint(_get(x)) |> localize |
222 | 223 | Base.repeat(x::TArray; kw...) = repeat(_get(x); kw...) |> localize |
223 | | -Base.hcat(x::TArray, rest...) = hcat(_get(x), _get.(rest)...) |> localize |
224 | | -Base.hcat(x::AbstractArray, y::TArray, rest...) = hcat(x, _get(y), _get.(rest)...) |> localize |
225 | | -Base.vcat(x::TArray, rest...) = vcat(_get(x), _get.(rest)...) |> localize |
226 | | -Base.vcat(x::AbstractArray, y::TArray, rest...) = vcat(x, _get(y), _get.(rest)...) |> localize |
227 | | -Base.cat(x::TArray, rest...; dims) = cat(_get(x), _get.(rest)...; dims = dims) |> localize |
228 | | -Base.cat(x::AbstractArray, y::TArray, rest...; dims) = |
229 | | - cat(x, _get(y), _get.(rest)...; dims = dims) |> localize |
| 224 | + |
| 225 | +Base.hcat(xs::Union{TArray{T,1}, TArray{T,2}}...) where T = |
| 226 | + hcat(_get.(xs)...) |> localize |
| 227 | +Base.vcat(xs::Union{TArray{T,1}, TArray{T,2}}...) where T = |
| 228 | + vcat(_get.(xs)...) |> localize |
| 229 | +Base.cat(xs::Union{TArray{T,1}, TArray{T,2}}...; dims) where T = |
| 230 | + cat(_get.(xs)...; dims = dims) |> localize |
| 231 | + |
230 | 232 |
|
231 | 233 | Base.reshape(x::TArray, dims::Union{Colon,Int}...) = reshape(_get(x), dims) |> localize |
232 | 234 | Base.reshape(x::TArray, dims::Tuple{Vararg{Union{Int,Colon}}}) = |
@@ -256,6 +258,9 @@ Base.:*(x::TArray, y::TArray) = _get(x) * _get(y) |> localize |
256 | 258 | Base.:*(x::AbstractArray, y::TArray) = x * _get(y) |> localize |
257 | 259 | Base.:*(x::TArray, y::AbstractArray) = _get(x) * y |> localize |
258 | 260 |
|
| 261 | +# broadcast |
| 262 | +Base.BroadcastStyle(::Type{TArray{T, N}}) where {T, N} = Broadcast.ArrayStyle{TArray}() |
| 263 | +Broadcast.broadcasted(::Broadcast.ArrayStyle{TArray}, f, args...) = f.(_get.(args)...) |> localize |
259 | 264 |
|
260 | 265 | import LinearAlgebra |
261 | 266 | import LinearAlgebra: \, /, inv, det, logdet, logabsdet, norm |
|
0 commit comments