Skip to content

Commit

Permalink
Merge pull request #333 from MeasureTransport/dannys4/fix-julia-strides
Browse files Browse the repository at this point in the history
Fix striding for eigen conversion in Julia binding
  • Loading branch information
dannys4 authored Jul 26, 2023
2 parents f6c3ebd + 5ada136 commit d666310
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bindings/julia/src/JlArrayConversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Eigen::Map<const Eigen::Matrix<int,Eigen::Dynamic, Eigen::Dynamic>,0,Eigen::Oute
int* mptr = mat.data();
unsigned int rows = size(mat,0);
unsigned int cols = size(mat,1);
return Eigen::Map<const Eigen::Matrix<int,Eigen::Dynamic, Eigen::Dynamic>,0,Eigen::OuterStride<>>(mptr, rows, cols, Eigen::OuterStride<>(std::max(rows,cols)));
return Eigen::Map<const Eigen::Matrix<int,Eigen::Dynamic, Eigen::Dynamic>,0,Eigen::OuterStride<>>(mptr, rows, cols, Eigen::OuterStride<>(rows));
}

/**
Expand Down
3 changes: 2 additions & 1 deletion bindings/julia/src/MultiIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ void mpart::binding::MultiIndexWrapper(jlcxx::Module &mod) {
.method("NumActiveForward", &MultiIndexSet::NumActiveForward)
.method("NumForward", &MultiIndexSet::NumForward)
.method("Size", &MultiIndexSet::Size)
.method("addto!", [](MultiIndexSet &mset, MultiIndex const& idx){ return mset += idx; })
.method("addto!", [](MultiIndexSet &mset, MultiIndexSet const& mset2){ return mset += mset2; })
;

mod.method("MultiIndexSet", [](jlcxx::ArrayRef<int,2> idxs) {
Expand All @@ -83,7 +85,6 @@ void mpart::binding::MultiIndexWrapper(jlcxx::Module &mod) {
mod.method("length", [](FixedMultiIndexSet<Kokkos::HostSpace> &mset){return mset.Length();});
mod.method("size", [](FixedMultiIndexSet<Kokkos::HostSpace> &mset){return mset.Size();});
mod.method("vec", [](MultiIndex const& idx){ return idx.Vector(); });
mod.method("copy", [](MultiIndexSet const& mset){ MultiIndexSet mset_copy = mset; return mset_copy;});
mod.method("==", [](MultiIndex const& idx1, MultiIndex const& idx2){ return idx1 == idx2; });
mod.method("!=", [](MultiIndex const& idx1, MultiIndex const& idx2){ return idx1 != idx2; });
mod.method("<", [](MultiIndex const& idx1, MultiIndex const& idx2){ return idx1 < idx2; });
Expand Down

0 comments on commit d666310

Please sign in to comment.