@@ -90,7 +90,15 @@ function A_mul_B!(y::AbstractVector, A::CompositeMap, x::AbstractVector)
90
90
dest = Array {T} (undef, size (A. maps[2 ], 1 ))
91
91
end
92
92
for n= 2 : N- 1
93
- resize! (dest, size (A. maps[n], 1 ))
93
+ try
94
+ resize! (dest, size (A. maps[n], 1 ))
95
+ catch err
96
+ if err == ErrorException (" cannot resize array with shared data" )
97
+ dest = Array {T} (undef, size (A. maps[n], 1 ))
98
+ else
99
+ rethrow (err)
100
+ end
101
+ end
94
102
A_mul_B! (dest, A. maps[n], source)
95
103
dest, source = source, dest # alternate dest and source
96
104
end
@@ -112,7 +120,15 @@ function At_mul_B!(y::AbstractVector, A::CompositeMap, x::AbstractVector)
112
120
dest = Array {T} (undef, size (A. maps[N- 1 ], 2 ))
113
121
end
114
122
for n = N- 1 : - 1 : 2
115
- resize! (dest, size (A. maps[n], 2 ))
123
+ try
124
+ resize! (dest, size (A. maps[n], 2 ))
125
+ catch err
126
+ if err == ErrorException (" cannot resize array with shared data" )
127
+ dest = Array {T} (undef, size (A. maps[n], 2 ))
128
+ else
129
+ rethrow (err)
130
+ end
131
+ end
116
132
At_mul_B! (dest, A. maps[n], source)
117
133
dest, source = source, dest # alternate dest and source
118
134
end
@@ -134,7 +150,15 @@ function Ac_mul_B!(y::AbstractVector, A::CompositeMap, x::AbstractVector)
134
150
dest = Array {T} (undef, size (A. maps[N- 1 ], 2 ))
135
151
end
136
152
for n = N- 1 : - 1 : 2
137
- resize! (dest, size (A. maps[n], 2 ))
153
+ try
154
+ resize! (dest, size (A. maps[n], 2 ))
155
+ catch err
156
+ if err == ErrorException (" cannot resize array with shared data" )
157
+ dest = Array {T} (undef, size (A. maps[n], 2 ))
158
+ else
159
+ rethrow (err)
160
+ end
161
+ end
138
162
Ac_mul_B! (dest, A. maps[n], source)
139
163
dest, source = source, dest # alternate dest and source
140
164
end
0 commit comments