diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c94f60e..cbf651a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,6 +21,7 @@ jobs: - '1.7' - '1.8' - '1.9' + - '1.10' os: - ubuntu-latest - macos-latest @@ -44,7 +45,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: diff --git a/Project.toml b/Project.toml index 38c332d..f6a74ff 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MParT" uuid = "4383ffe1-dc98-4547-9515-b1eacdbc2dac" authors = ["MIT UQGroup"] -version = "2.1.0" +version = "2.2.1" [deps] CxxWrap = "1f15a43c-97ca-5a2a-ae31-89f07a497df4" @@ -9,8 +9,8 @@ Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" MParT_jll = "bee5971c-294f-5168-9fcd-9fb3c811d495" [compat] -CxxWrap = "0.12" -MParT_jll = "2.1.0" +CxxWrap = "0.14" +MParT_jll = "2.2.2" julia = "1.6" [extras] diff --git a/src/MParT.jl b/src/MParT.jl index d46ea9f..37ea73e 100644 --- a/src/MParT.jl +++ b/src/MParT.jl @@ -3,17 +3,28 @@ module MParT using CxxWrap using MParT_jll import Libdl - @wrapmodule libmpartjl :MParT_julia_module - import Base: getindex, lastindex, show, iterate + @wrapmodule ()->libmpartjl :MParT_julia_module + import Base: getindex, lastindex, show, iterate, convert ConditionalMapBasePtr = CxxWrap.StdLib.SharedPtr{<:ConditionalMapBase} + for op = (:Evaluate, :Gradient, :Inverse, + :LogDeterminant, :LogDeterminantCoeffGrad, :LogDeterminantInputGrad, + :numCoeffs, :CoeffMap, :CoeffGrad, :SetCoeffs, :TestError) + eval(quote + $op(obj::CxxWrap.StdLib.SharedPtr, args...) = $op(obj[], args...) + end) + end function __init__() @initcxx threads = get(ENV, "KOKKOS_NUM_THREADS", nothing) - opts = isnothing(threads) ? [] : ["kokkos_num_threads", threads] - length(opts) > 0 && @info "Using MParT options: "*string(string.(opts)) - Initialize(StdVector(StdString.(opts))) + opts = StdVector{StdString}() + if !isnothing(threads) + push!(opts, StdString("kokkos_num_threads")) + push!(opts, StdString(string(threads))) + end + length(opts) > 0 && @info "Using MParT options: "*join(string.(opts),", ") + Initialize(opts) end """ @@ -134,6 +145,7 @@ quadMaxSub = 30 quadMinSub = 0 quadPts = 5 contDeriv = true +nugget = 0 ``` See also [`CreateComponent`](@ref), [`TriangularMap`](@ref), [`CreateTriangular`](@ref) @@ -320,9 +332,12 @@ end """ - TriangularMap(maps::Vector) + TriangularMap(maps::Vector, move_coeffs::Bool = true) Creates a `TriangularMap` from a vector of `ConditionalMapBase` objects. +TODO: The new object takes ownership of the coeffs of the maps in `maps` if +`move_coeffs` is true. + # Examples ```jldoctest julia> dim, order = 5, 3; @@ -336,7 +351,7 @@ 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) end