Add method to numpy::dtype to set byteorder
- Lingua principale
- C++
- Stelle
- 537
- Fork
- 223
- Merge medio
- 11h 22m
- PR unite (30g)
- 2
Descrizione
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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- api
- Tipo di issue
- Funzionalità
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100