Skip to content

Commit edead13

Browse files
committed
fix reshape
1 parent fbfee35 commit edead13

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/tensors/abstracttensor.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ function project_symmetric!(t::AbstractTensorMap, data::AbstractArray)
644644
matsize = (dim(codom), dim(dom))
645645
(size(data) == arraysize || size(data) == matsize) ||
646646
throw(DimensionMismatch("input data has incompatible size for the given tensor"))
647+
data = reshape(collect(data), arraysize)
647648

648649
I = sectortype(t)
649650
if I === Trivial && t isa TensorMap

src/tensors/tensor.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,10 @@ function _TensorMap{T, A}(
219219

220220
# do projection
221221
t = _TensorMap{T, A}(undef, V)
222-
arraydata = reshape(collect(data), arraysize)
223-
t = project_symmetric!(t, arraydata)
222+
t = project_symmetric!(t, data)
224223

225224
# verify result
226-
isapprox(arraydata, convert(Array, t); atol = tol) ||
225+
isapprox(reshape(data, dims(t)), convert(Array, t); atol = tol) ||
227226
throw(ArgumentError("Data has non-zero elements at incompatible positions"))
228227

229228
return t

0 commit comments

Comments
 (0)