Skip to content

Commit 3f39dad

Browse files
Merge pull request #85 from vpuri3/reshape
reshape of reshape is not a strided array
2 parents 855f257 + 70d73d3 commit 3f39dad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#
22
""" use Base.ReshapedArray """
33
_reshape(a, dims::NTuple{D,Int}) where{D} = reshape(a,dims)
4+
_reshape(a::ReshapedArray, dims::NTuple{D,Int}) where{D} = _reshape(a.parent, dims)
5+
46
function _reshape(a::AbstractArray, dims::NTuple{D,Int}) where{D}
57
@assert prod(dims) == length(a) "cannot reshape array of size $(size(a)) to size $dims"
68
dims == size(a) && return a
@@ -10,7 +12,6 @@ end
1012
_vec(a) = vec(a)
1113
_vec(a::AbstractVector) = a
1214
_vec(a::AbstractArray) = _reshape(a,(length(a),))
13-
_vec(a::ReshapedArray) = _vec(a.parent)
1415

1516
function _mat_sizes(L::AbstractSciMLOperator, u::AbstractArray)
1617
m, n = size(L)

0 commit comments

Comments
 (0)