Skip to content

Commit

Permalink
Removed redundant filters for normalizers.
Browse files Browse the repository at this point in the history
  • Loading branch information
frankwswang committed Dec 23, 2024
1 parent b1d3977 commit b032c6c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
24 changes: 13 additions & 11 deletions src/Integrals/Frameworks/OneBody.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
function genNormalizer(o::PrimitiveOrbCore{T, D},
paramPtr::PrimOrbParamPtr{T, D}) where {T, D}
function genNormalizer(o::PrimitiveOrbCore{T, D}, ::PrimOrbParamPtr{T, D}) where {T, D}
fCore = function (x::AbtVecOfAbtArr{T})
(AbsSqrtInvnumericalOneBodyInt)(Identity(), (o.f.apply,), (x,))
end
ParamFilterFunc(OnlyBody(fCoregetField), paramPtr.scope)
OnlyBody(fCoregetField)
end


function getNormCoeff!(cache::DimSpanDataCacheBox{T},
orbs::NonEmptyTuple{FrameworkOrb{T, D}}) where {T, D}
ptr = ChainPointer((:core, :f, :apply, :right))
paramSets = map(Base.Fix2(getfield, :param), orbs) # better than broadcasting
localParamSets = map(orbs) do orb # better than broadcasting
FilteredObject(orb.param, orb.pointer.scope)
end
normalizers = map(Base.Fix2(getField, ptr), orbs) # better than broadcasting
mapreduce(StableBinary(*, T), paramSets, normalizers, init=one(T)) do pSet, f
mapreduce(StableBinary(*, T), localParamSets, normalizers, init=one(T)) do pSet, f
getNormCoeffCore!(cache, pSet, f)
end
end
Expand All @@ -21,18 +22,19 @@ function getNormCoeff!(cache::DimSpanDataCacheBox{T}, orb::FrameworkOrb{T, D},
degree::Int) where {T, D}
ptr = ChainPointer((:core, :f, :apply, :right))
normalizer = getField(orb, ptr)
normCoeff = getNormCoeffCore!(cache, orb.param, normalizer)
normCoeff = getNormCoeffCore!(cache, FilteredObject(orb.param, orb.pointer.scope),
normalizer)
normCoeff^abs(degree)
end


function getNormCoeffCore!(cache::DimSpanDataCacheBox{T}, pSet::FlatParamSet{T},
normalizer::ReturnTyped{T, <:ParamFilterFunc}) where {T}
paramVal = cacheParam!(cache, pSet, normalizer.f.scope)
normalizer.f.apply(nothing, paramVal)::T
function getNormCoeffCore!(cache::DimSpanDataCacheBox{T}, pSource::TypedParamInput{T},
normalizer::ReturnTyped{T}) where {T}
paramVal = cacheParam!(cache, pSource)
normalizer.f(nothing, paramVal)::T
end

function getNormCoeffCore!(::DimSpanDataCacheBox{T}, ::FlatParamSet{T},
function getNormCoeffCore!(::DimSpanDataCacheBox{T}, ::TypedParamInput{T},
normalizer::Storage{T}) where {T}
normalizer.val
end
Expand Down
2 changes: 1 addition & 1 deletion src/Integrals/GaussianOrbitals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function genNormalizer(o::PrimGTOcore{T, D}, paramPtr::PrimOrbParamPtr{T, D}) wh
ns = map(x->Base.Fix2(polyGaussFuncSquaredNorm, x), angularFunc.f.m.tuple)
nCore = OnlyBody( AbsSqrtInv ChainReduce(StableBinary(*, T), VectorMemory(ns)) )
ptrTuple = (getXpnPtr(paramPtr.body),)
ParamFilterFunc(ParamSelectFunc(nCore, ptrTuple), paramPtr.scope)
ParamSelectFunc(nCore, ptrTuple)
end


Expand Down
2 changes: 1 addition & 1 deletion src/SpatialBasis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function normalizeOrbital(fCore::EvalComposedOrb{T, D},
ScaledOrbital(fCore, ReturnTyped(normalizerCore, T), paramPointer.scope)
end

const NormFuncType{T} = Union{ReturnTyped{T, <:ParamFilterFunc}, Storage{T}}
const NormFuncType{T} = Union{ReturnTyped{T}, Storage{T}}

function unpackParamFunc!(f::ComposedOrb{T}, paramSet::FlatParamSet,
paramSetId::Identifier=Identifier(paramSet)) where {T}
Expand Down

0 comments on commit b032c6c

Please sign in to comment.