@@ -388,15 +388,20 @@ function project_symmetric!(t::TensorMap, data::DenseArray)
388388 else
389389 for (f₁, f₂) in fusiontrees (t)
390390 F = convert (Array, (f₁, f₂))
391- dataslice = sview (
392- data, axes (codomain (t), f₁. uncoupled)... , axes (domain (t), f₂. uncoupled)...
393- )
394391 if FusionStyle (I) === UniqueFusion ()
392+ dataslice = sview (
393+ data, axes (codomain (t), f₁. uncoupled)... , axes (domain (t), f₂. uncoupled)...
394+ )
395395 Fscalar = first (F) # contains a single element
396396 scale! (t[f₁, f₂], dataslice, conj (Fscalar))
397397 else
398- subblock = t[f₁, f₂]
399- szbF = _interleave (size (F), size (subblock))
398+ # do everything on CPU
399+ dataslice = sview (
400+ Array (data), axes (codomain (t), f₁. uncoupled)... , axes (domain (t), f₂. uncoupled)...
401+ )
402+ arr_t = TensorMap {scalartype(t)} (Array (t. data), t. space)
403+ subblock = arr_t[f₁, f₂]
404+ szbF = _interleave (size (F), size (subblock))
400405 indset1 = ntuple (identity, numind (t))
401406 indset2 = 2 .* indset1
402407 indset3 = indset2 .- 1
@@ -408,6 +413,7 @@ function project_symmetric!(t::TensorMap, data::DenseArray)
408413 (indset1, ()),
409414 inv (dim (f₁. coupled)), false
410415 )
416+ t[f₁, f₂] .= arr_t[f₁, f₂]
411417 end
412418 end
413419 end
0 commit comments