Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jcarpent/eigenpy
  • gsaurel/eigenpy
  • stack-of-tasks/eigenpy
3 results
Show changes
Showing
with 314 additions and 0 deletions
/*
* Copyright 2020 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixComplexFloat() {
exposeType<std::complex<float> >();
exposeType<std::complex<float>, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2020 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixComplexLongDouble() {
exposeType<std::complex<long double> >();
exposeType<std::complex<long double>, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2020 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixDouble() {
exposeType<double>();
exposeType<double, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2020 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixFloat() {
exposeType<float>();
exposeType<float, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2024 INRIA
*/
#include "eigenpy/eigenpy.hpp"
#include <cstdint>
namespace eigenpy {
void exposeMatrixInt16() {
exposeType<int16_t>();
exposeType<int16_t, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2020 INRIA
*/
#include "eigenpy/eigenpy.hpp"
#include <cstdint>
namespace eigenpy {
void exposeMatrixInt32() {
exposeType<int32_t>();
exposeType<int32_t, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2020 INRIA
*/
#include "eigenpy/eigenpy.hpp"
#include <cstdint>
namespace eigenpy {
void exposeMatrixInt64() {
exposeType<int64_t>();
exposeType<int64_t, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2020 INRIA
*/
#include "eigenpy/eigenpy.hpp"
#include <cstdint>
namespace eigenpy {
void exposeMatrixInt8() {
exposeType<int8_t>();
exposeType<int8_t, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2024 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixLinuxLongLong() {
// On Linux, long long is a 64 bytes type but it's a different type than int64_t
#ifdef __linux__
exposeType<long long>();
exposeType<long long, Eigen::RowMajor>();
#endif // linux
}
} // namespace eigenpy
/*
* Copyright 2024 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixLinuxULongLong() {
// On Linux, long long is a 64 bytes type but it's a different type than int64_t
#ifdef __linux__
exposeType<unsigned long long>();
exposeType<unsigned long long, Eigen::RowMajor>();
#endif // linux
}
} // namespace eigenpy
/*
* Copyright 2020 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixLongDouble() {
exposeType<long double>();
exposeType<long double, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2024 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixMacLong() {
// On Mac, long is a 64 bytes type but it's a different type than int64_t
#ifdef __APPLE__
exposeType<long>();
exposeType<long, Eigen::RowMajor>();
#endif // Mac
}
} // namespace eigenpy
/*
* Copyright 2024 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixMacULong() {
// On Mac, long is a 64 bytes type but it's a different type than int64_t
#ifdef __APPLE__
exposeType<unsigned long>();
exposeType<unsigned long, Eigen::RowMajor>();
#endif // Mac
}
} // namespace eigenpy
/*
* Copyright 2024 INRIA
*/
#include "eigenpy/eigenpy.hpp"
#include <cstdint>
namespace eigenpy {
void exposeMatrixUInt16() {
exposeType<uint16_t>();
exposeType<uint16_t, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2024 INRIA
*/
#include "eigenpy/eigenpy.hpp"
#include <cstdint>
namespace eigenpy {
void exposeMatrixUInt32() {
exposeType<uint32_t>();
exposeType<uint32_t, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2020 INRIA
*/
#include "eigenpy/eigenpy.hpp"
#include <cstdint>
namespace eigenpy {
void exposeMatrixUInt64() {
exposeType<uint64_t>();
exposeType<uint64_t, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2020 INRIA
*/
#include "eigenpy/eigenpy.hpp"
#include <cstdint>
namespace eigenpy {
void exposeMatrixUInt8() {
exposeType<std::uint8_t>();
exposeType<std::uint8_t, Eigen::RowMajor>();
}
} // namespace eigenpy
/*
* Copyright 2024 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixWindowsLong() {
// On Windows, long is a 32 bytes type but it's a different type than int
#ifdef WIN32
exposeType<long>();
exposeType<long, Eigen::RowMajor>();
#endif // WIN32
}
} // namespace eigenpy
/*
* Copyright 2024 INRIA
*/
#include "eigenpy/eigenpy.hpp"
namespace eigenpy {
void exposeMatrixWindowsULong() {
// On Windows, long is a 32 bytes type but it's a different type than int
#ifdef WIN32
exposeType<unsigned long>();
exposeType<unsigned long, Eigen::RowMajor>();
#endif // WIN32
}
} // namespace eigenpy
/*
* Copyright 2018-2023 INRIA
*/
#include "eigenpy/numpy-type.hpp"
#include <patchlevel.h> // For PY_MAJOR_VERSION
namespace eigenpy {
NumpyType& NumpyType::getInstance() {
static NumpyType instance;
return instance;
}
bp::object NumpyType::make(PyArrayObject* pyArray, bool copy) {
return make((PyObject*)pyArray, copy);
}
bp::object NumpyType::make(PyObject* pyObj, bool /*copy*/) {
bp::object m;
m = bp::object(bp::handle<>(pyObj)); // nothing to do here
Py_INCREF(m.ptr());
return m;
}
void NumpyType::sharedMemory(const bool value) {
getInstance().shared_memory = value;
}
bool NumpyType::sharedMemory() { return getInstance().shared_memory; }
const PyTypeObject* NumpyType::getNumpyArrayType() {
return getInstance().NumpyArrayType;
}
NumpyType::NumpyType() {
pyModule = bp::import("numpy");
#if PY_MAJOR_VERSION >= 3
// TODO I don't know why this Py_INCREF is necessary.
// Without it, the destructor of NumpyType SEGV sometimes.
Py_INCREF(pyModule.ptr());
#endif
NumpyArrayObject = pyModule.attr("ndarray");
NumpyArrayType = reinterpret_cast<PyTypeObject*>(NumpyArrayObject.ptr());
shared_memory = true;
}
} // namespace eigenpy