Skip to content

Commit

Permalink
Merge pull request #19 from MeasureTransport/add_move_coeffs
Browse files Browse the repository at this point in the history
Adding move_coeffs for TriangularMap
  • Loading branch information
dannys4 authored Jan 22, 2024
2 parents 29114fd + f9c5832 commit 27a5365
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: '1'
version: '1.9'
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
Expand Down
9 changes: 6 additions & 3 deletions src/MParT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,12 @@ end


"""
TriangularMap(maps::Vector)
TriangularMap(maps::Vector, move_coeffs::Bool = true)
Creates a `TriangularMap` from a vector of `ConditionalMapBase` objects.
The new object takes ownership of the coeffs of the maps in `maps` if
`move_coeffs` is true.
# Examples
```jldoctest

Check failure on line 330 in src/MParT.jl

View workflow job for this annotation

GitHub Actions / Documentation

doctest failure in ~/work/MParT.jl/MParT.jl/src/MParT.jl:330-340 ```jldoctest julia> dim, order = 5, 3; julia> msets = [FixedMultiIndexSet(d, order) for d in 1:dim]; julia> opts = MapOptions(); julia> components = [CreateComponent(mset, opts) for mset in msets]; julia> trimap = TriangularMap(components); ``` Subexpression: trimap = TriangularMap(components); Evaluated output: ERROR: MethodError: no method matching TriangularMap(::CxxWrap.StdLib.StdVectorAllocated{CxxWrap.StdLib.SharedPtr{MParT.ConditionalMapBase}}, ::Bool) Closest candidates are: TriangularMap(!Matched::Vector, ::Bool) @ MParT ~/work/MParT.jl/MParT.jl/src/MParT.jl:342 TriangularMap(::Union{CxxWrap.CxxWrapCore.SmartPointer{T2}, T2} where T2<:CxxWrap.StdLib.StdVectorAllocated{CxxWrap.StdLib.SharedPtr{MParT.ConditionalMapBase}}) @ MParT ~/.julia/packages/CxxWrap/IdOJa/src/CxxWrap.jl:618 Stacktrace: [1] TriangularMap(maps::Vector{CxxWrap.StdLib.SharedPtrAllocated{MParT.ConditionalMapBase}}, move_coeffs::Bool) @ MParT ~/work/MParT.jl/MParT.jl/src/MParT.jl:344 [2] TriangularMap(maps::Vector{CxxWrap.StdLib.SharedPtrAllocated{MParT.ConditionalMapBase}}) @ MParT ~/work/MParT.jl/MParT.jl/src/MParT.jl:343 [3] top-level scope @ none:1 Expected output: diff = Warning: Diff output requires color. ERROR: MethodError: no method matching TriangularMap(::CxxWrap.StdLib.StdVectorAllocated{CxxWrap.StdLib.SharedPtr{MParT.ConditionalMapBase}}, ::Bool) Closest candidates are: TriangularMap(!Matched::Vector, ::Bool) @ MParT ~/work/MParT.jl/MParT.jl/src/MParT.jl:342 TriangularMap(::Union{CxxWrap.CxxWrapCore.SmartPointer{T2}, T2} where T2<:CxxWrap.StdLib.StdVectorAllocated{CxxWrap.StdLib.SharedPtr{MParT.ConditionalMapBase}}) @ MParT ~/.julia/packages/CxxWrap/IdOJa/src/CxxWrap.jl:618 Stacktrace: [1] TriangularMap(maps::Vector{CxxWrap.StdLib.SharedPtrAllocated{MParT.ConditionalMapBase}}, move_coeffs::Bool) @ MParT ~/work/MParT.jl/MParT.jl/src/MParT.jl:344 [2] TriangularMap(maps::Vector{CxxWrap.StdLib.SharedPtrAllocated{MParT.ConditionalMapBase}}) @ MParT ~/work/MParT.jl/MParT.jl/src/MParT.jl:343 [3] top-level scope @ none:1
julia> dim, order = 5, 3;
Expand All @@ -336,9 +339,9 @@ julia> components = [CreateComponent(mset, opts) for mset in msets];
julia> trimap = TriangularMap(components);
```
"""
function TriangularMap(maps::Vector)
function TriangularMap(maps::Vector, move_coeffs::Bool = true)
maps = StdVector([map for map in maps])
TriangularMap(maps)
TriangularMap(maps, move_coeffs)
end

"""
Expand Down

0 comments on commit 27a5365

Please sign in to comment.