File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -76,10 +76,13 @@ void G3Vector<int64_t>::save(A &ar, const unsigned v) const
7676}
7777
7878template <typename V, typename T=typename V::value_type>
79- auto vector_from_python (const py::array_t <T> &buf) {
79+ auto vector_from_python (const py::array_t <T> &buf, bool contiguous= true ) {
8080 if (buf.ndim () != 1 )
8181 throw py::type_error (" Only valid 1D buffers can be copied to a vector" );
8282
83+ if (contiguous)
84+ return std::make_shared<V>(buf.data (), buf.data () + buf.size ());
85+
8386 auto rbuf = buf.template unchecked <1 >();
8487 auto vec = std::make_shared<V>(rbuf.shape (0 ));
8588
@@ -90,7 +93,7 @@ auto vector_from_python(const py::array_t<T> &buf) {
9093
9194template <typename V>
9295auto time_vector_from_python (const py::array &buf) {
93- return vector_from_python<V, G3TimeStamp>(buf);
96+ return vector_from_python<V, G3TimeStamp>(buf, false );
9497}
9598
9699template <typename V>
You can’t perform that action at this time.
0 commit comments