boostorg / boostorg/python

Add method to numpy::dtype to set byteorder

未關閉
#230 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C++
星號
537
分支
223
平均合併
11 小時 22 分鐘
30 天內合併 PR
2

描述

I've taken a look at `numpy/dtype.hpp`, and there does not appear to be any way to set the byte order of the array being constructed. The workaround I am currently using (which requires adding the numpy C API to my build and including the headers in my source) is the following:

```
np::dtype scalarDtype = np::dtype::get_builtin();
reinterpret_cast(scalarDtype.ptr())->byteorder = '>';
```

So it should be as simple as adding a method to dtype to allow the user to set the byteorder on the underlying numpy struct.

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Start in numpy/dtype.hpp and review the existing dtype methods and how the underlying NumPy descriptor is exposed. Add the requested byte-order operation without requiring callers to include the NumPy C API, then verify that the dtype's byte order changes as requested.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
cpp
領域
api
Issue 類型
功能
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。