Skip to content

Commit

Permalink
Merge branch 'main' into dannys4/addMultiIndexTests
Browse files Browse the repository at this point in the history
  • Loading branch information
dannys4 committed Jan 30, 2024
2 parents 11b4f10 + 8195c60 commit 6151e84
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- '1.7'
- '1.8'
- '1.9'
- '1.10'
os:
- ubuntu-latest
- macos-latest
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
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"
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]
Expand Down
29 changes: 22 additions & 7 deletions src/MParT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down Expand Up @@ -134,6 +145,7 @@ quadMaxSub = 30
quadMinSub = 0
quadPts = 5
contDeriv = true
nugget = 0
```
See also [`CreateComponent`](@ref), [`TriangularMap`](@ref), [`CreateTriangular`](@ref)
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 6151e84

Please sign in to comment.