|
52 | 52 |
|
53 | 53 | ## showing
|
54 | 54 |
|
55 |
| -for (atype, op) in |
56 |
| - [(:(GPUArray), :(Array)), |
57 |
| - (:(LinearAlgebra.Adjoint{<:Any,<:GPUArray}), :(x->LinearAlgebra.adjoint(Array(parent(x))))), |
58 |
| - (:(LinearAlgebra.Transpose{<:Any,<:GPUArray}), :(x->LinearAlgebra.transpose(Array(parent(x)))))] |
| 55 | +for (AT, f) in |
| 56 | + (GPUArray => Array, |
| 57 | + LinearAlgebra.Adjoint{<:Any,<:GPUArray} => x->LinearAlgebra.adjoint(Array(parent(x))), |
| 58 | + LinearAlgebra.Transpose{<:Any,<:GPUArray} => x->LinearAlgebra.transpose(Array(parent(x))), |
| 59 | + SubArray{<:Any,<:Any,<:GPUArray} => x->SubArray(Array(parent(x)), parentindices(x)) |
| 60 | + ) |
59 | 61 | @eval begin
|
60 | 62 | # for display
|
61 |
| - Base.print_array(io::IO, X::($atype)) = |
62 |
| - Base.print_array(io,($op)(X)) |
| 63 | + Base.print_array(io::IO, X::$AT) = |
| 64 | + Base.print_array(io,$f(X)) |
63 | 65 |
|
64 | 66 | # for show
|
65 |
| - Base._show_nonempty(io::IO, X::($atype), prefix::String) = |
66 |
| - Base._show_nonempty(io,($op)(X),prefix) |
67 |
| - Base._show_empty(io::IO, X::($atype)) = |
68 |
| - Base._show_empty(io,($op)(X)) |
69 |
| - Base.show_vector(io::IO, v::($atype), args...) = |
70 |
| - Base.show_vector(io,($op)(v),args...) |
| 67 | + Base._show_nonempty(io::IO, X::$AT, prefix::String) = |
| 68 | + Base._show_nonempty(io,$f(X),prefix) |
| 69 | + Base._show_empty(io::IO, X::$AT) = |
| 70 | + Base._show_empty(io,$f(X)) |
| 71 | + Base.show_vector(io::IO, v::$AT, args...) = |
| 72 | + Base.show_vector(io,$f(v),args...) |
71 | 73 | end
|
72 | 74 | end
|
73 | 75 |
|
|
0 commit comments