Skip to content

Commit

Permalink
Use simplified functions to dispatch later on parenttype
Browse files Browse the repository at this point in the history
  • Loading branch information
kmp5VT committed Oct 16, 2023
1 parent 50eb9a8 commit bf86c83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions NDTensors/src/abstractarray/tensoralgebra/contract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function _contract!(
tA = 'N'
if props.permuteA
#@timeit_debug timer "_contract!: permutedims A" begin
Ap = permutedims(leaf_parenttype(AT), AT, props.PA)
Ap = permutedims(AT, props.PA)
#end # @timeit
AM = transpose(reshape(Ap, (props.dmid, props.dleft)))
else
Expand All @@ -129,7 +129,7 @@ function _contract!(
tB = 'N'
if props.permuteB
#@timeit_debug timer "_contract!: permutedims B" begin
Bp = permutedims(leaf_parenttype(BT), BT, props.PB)
Bp = permutedims(BT, props.PB)
#end # @timeit
BM = reshape(Bp, (props.dmid, props.dright))
else
Expand All @@ -147,7 +147,7 @@ function _contract!(
# ordering as A B which is the inverse of props.PC
if β 0
CM = reshape(
permutedims(leaf_parenttype(CT), CT, invperm(props.PC)), (props.dleft, props.dright)
permutedims(CT, invperm(props.PC)), (props.dleft, props.dright)
)
else
# Need to copy here since we will be permuting
Expand All @@ -170,7 +170,7 @@ function _contract!(
Cr = reshape(CM, props.newCrange)
# TODO: use invperm(pC) here?
#@timeit_debug timer "_contract!: permutedims C" begin
CT .= permutedims(leaf_parenttype(Cr), Cr, props.PC)
CT .= permutedims(Cr, props.PC)
#end # @timeit
end

Expand Down
2 changes: 1 addition & 1 deletion NDTensors/src/dense/densetensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function permutedims!(
) where {N,StoreT<:StridedArray}
RA = array(R)
TA = array(T)
RA = permutedims!(leaf_parenttype(RA), RA, leaf_parenttype(TA), TA, perm)
RA = permutedims!(RA, TA, perm)
return R
end

Expand Down

0 comments on commit bf86c83

Please sign in to comment.