dtype
-
class dtype : public boost::object
dtype は ndarray の要素の型を記述するオブジェクトである。
<boost/python/numpy/dtype.hpp>
は、組み込みの C++ オブジェクトから等価な numpy.dtype Python オブジェクトを生成する、ユーザ定義型からカスタムの dtype を作成するのに必要なメソッド呼び出しを含む。
概要
namespace boost
{
namespace python
{
namespace numpy
{
class dtype : public object
{
static python::detail::new_reference convert(object::object_cref arg, bool align);
public:
// 任意の Python オブジェクトをデータ型記述子オブジェクトへ変換する。
template <typename T>
explicit dtype(T arg, bool align=false);
// 与えられたスカラーテンプレート型に相当する組み込みの numpy dtype を得る。
template <typename T> static dtype get_builtin();
// データ型のバイトサイズを返す。
int get_itemsize() const;
};
}
}
}
コンストラクタ
アクセッサ
-
int get_itemsize() const
- 戻り値
データ型のバイト数。
使用例
namespace p = boost::python;
namespace np = boost::python::numpy;
np::dtype dtype = np::dtype::get_builtin<double>();
p::tuple for_custom_dtype = p::make_tuple("ha",dtype);
np::dtype custom_dtype = np::dtype(list_for_dtype);