Skip to content

Commit

Permalink
removed unneccisary comments and renamed variables
Browse files Browse the repository at this point in the history
  • Loading branch information
MMRROOO committed Apr 18, 2024
1 parent d4e31de commit ab58379
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
12 changes: 6 additions & 6 deletions MParT/MapFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,22 @@ namespace mpart{
unsigned int inputDim, unsigned int totalOrder, Eigen::Ref<const Eigen::RowVectorXd> centers,
MapOptions opts) {
StridedVector<const double, Kokkos::HostSpace> centersVec = ConstVecToKokkos<double, Kokkos::HostSpace>(centers);
Kokkos::View<const double*, MemorySpace> centers_d = Kokkos::create_mirror_view_and_copy(MemorySpace(), centersVec);
return CreateSigmoidComponent<MemorySpace>(inputDim, totalOrder, centers_d, opts);
Kokkos::View<const double*, MemorySpace> centers = Kokkos::create_mirror_view_and_copy(MemorySpace(), centersVec);
return CreateSigmoidComponent<MemorySpace>(inputDim, totalOrder, centers, opts);
}

template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidComponent(
FixedMultiIndexSet<MemorySpace> mset_diag,
FixedMultiIndexSet<MemorySpace> mset,
StridedVector<const double, MemorySpace> centers, MapOptions opts);

template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidComponent(
FixedMultiIndexSet<MemorySpace> mset_diag,
FixedMultiIndexSet<MemorySpace> mset,
Eigen::Ref<const Eigen::RowVectorXd> centers, MapOptions opts) {
StridedVector<const double, Kokkos::HostSpace> centersVec = ConstVecToKokkos<double, Kokkos::HostSpace>(centers);
Kokkos::View<const double*, MemorySpace> centers_d = Kokkos::create_mirror_view_and_copy(MemorySpace(), centersVec);
return CreateSigmoidComponent<MemorySpace>(mset_diag, centers_d, opts);
Kokkos::View<const double*, MemorySpace> centers = Kokkos::create_mirror_view_and_copy(MemorySpace(), centersVec);
return CreateSigmoidComponent<MemorySpace>(mset, centers, opts);
}

template<typename MemorySpace>
Expand Down
4 changes: 2 additions & 2 deletions bindings/julia/src/MapFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ void mpart::binding::MapFactoryWrapper(jlcxx::Module &mod) {
});

// CreateSigmoidComponent
mod.method("CreateSigmoidComponent", [](FixedMultiIndexSet<MemorySpace> mset_diag, jlcxx::ArrayRef<double,1> centers, MapOptions opts){
mod.method("CreateSigmoidComponent", [](FixedMultiIndexSet<MemorySpace> mset, jlcxx::ArrayRef<double,1> centers, MapOptions opts){
StridedVector<const double, MemorySpace> centersVec = JuliaToKokkos(centers);
return MapFactory::CreateSigmoidComponent<Kokkos::HostSpace>(mset_diag, centersVec, opts);
return MapFactory::CreateSigmoidComponent<Kokkos::HostSpace>(mset, centersVec, opts);
});

// CreateSigmoidTriangular
Expand Down
7 changes: 0 additions & 7 deletions src/MapFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,6 @@ std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidExpansionTemplate(
StridedVector<double, MemorySpace> centers, double edgeWidth)
{
unsigned int inputDim = mset_diag.Length();
// if(inputDim != 1 && inputDim != mset_offdiag.Length() + 1) {
// std::stringstream ss;
// ss << "Mismatched input dimensions for offdiag and diag multiindex sets\n"
// << "offdiag: " << mset_offdiag.Length() << "\n"
// << "diag: " << mset_diag.Length();
// ProcAgnosticError<std::invalid_argument>(ss.str().c_str());
// }
using Sigmoid_T = Sigmoid1d<MemorySpace, SigmoidType, EdgeType>;
using Eval_T = BasisEvaluator<BasisHomogeneity::OffdiagHomogeneous, Kokkos::pair<OffdiagEval, Sigmoid_T>, Rectifier>;
auto sigmoid = CreateSigmoid<MemorySpace, SigmoidType, EdgeType>(inputDim, centers, edgeWidth);
Expand Down
7 changes: 3 additions & 4 deletions tests/Test_MapFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,14 @@ TEST_CASE( "Testing factory method for Sigmoid Component", "[MapFactorySigmoidCo
}
}
SECTION("Create Sigmoid Component from fixed msets") {
// FixedMultiIndexSet<MemorySpace> mset_offdiag(inputDim-1, maxDegree);
// Make some arbitrary limiter
auto limiter = [maxDegree](MultiIndex const& index){
return index.Get(index.Length()-1) != 0 && index.Sum() == maxDegree;
};
FixedMultiIndexSet<MemorySpace> mset_diag = MultiIndexSet::CreateTotalOrder(inputDim, maxDegree, limiter).Fix(true);
std::shared_ptr<ConditionalMapBase<MemorySpace>> map = MapFactory::CreateSigmoidComponent<MemorySpace>(mset_diag, centers, options);
FixedMultiIndexSet<MemorySpace> mset= MultiIndexSet::CreateTotalOrder(inputDim, maxDegree, limiter).Fix(true);
std::shared_ptr<ConditionalMapBase<MemorySpace>> map = MapFactory::CreateSigmoidComponent<MemorySpace>(mset, centers, options);
REQUIRE(map != nullptr);
REQUIRE(map->numCoeffs == mset_diag.Size());
REQUIRE(map->numCoeffs == mset.Size());
}
SECTION("Create Triangular Sigmoid Map From Components") {
std::vector<std::shared_ptr<ConditionalMapBase<MemorySpace>>> maps;
Expand Down

0 comments on commit ab58379

Please sign in to comment.