Ivan Smirnov
c22fe428ed
Change str/bytes cast operators to ctors
2016-08-13 19:39:11 +01:00
Ivan Smirnov
89ec7f3e79
Add (const char *, size_t) ctors for str/bytes
2016-08-13 19:38:50 +01:00
Ivan Smirnov
fd6cede7e9
Avoid extra allocations in operator str/bytes
2016-08-13 15:46:46 +01:00
Ivan Smirnov
61e3b0bd15
Use builtin str type for recarray field names
2016-08-13 12:51:31 +01:00
Ivan Smirnov
1cdd171fbc
Add PYBIND11_STR_TYPE to represent builtin str
2016-08-13 12:51:31 +01:00
Ivan Smirnov
006d8b6621
Add casting operators between py::str / py::bytes
2016-08-13 12:51:31 +01:00
Ivan Smirnov
3768b6abf9
Use fully qualified name in PYBIND11_DESCR macro
2016-08-13 12:43:16 +01:00
Ivan Smirnov
ad5ca6d4e6
Added dtype from const char pointer ctor
2016-08-13 12:43:16 +01:00
Ivan Smirnov
c6257f8641
Allow nullptr in array ctors wherever possible
2016-08-13 12:43:16 +01:00
Ivan Smirnov
98ba98c06b
Add a simplified buffer_info ctor for 1-D case
2016-08-13 12:43:16 +01:00
Ivan Smirnov
6636ae9d4e
Also add the new ctors to py::array_t
2016-08-13 12:43:16 +01:00
Ivan Smirnov
6bb0ee1186
Add all possible ctors for py::array
2016-08-13 12:43:16 +01:00
Ivan Smirnov
d77bc8c343
Add dtype(names, offsets, formats, itemsize) ctor
2016-08-13 12:43:16 +01:00
Ivan Smirnov
fc5620afa6
Fix a segfault where func object wasn't released
2016-08-13 12:43:16 +01:00
Ivan Smirnov
01f7409550
Initial implementation of py::dtype
2016-08-13 12:43:16 +01:00
Ivan Smirnov
05cb58ade2
Cleanup: move numpy API bindings out of py::array
2016-08-13 12:43:16 +01:00
Ivan Smirnov
afb07e7e92
Code reordering / cleanup only
2016-08-13 12:43:16 +01:00
Ivan Smirnov
f9c0defed7
Add numpy wrappers for char[] and std::array<char>
2016-08-13 12:43:16 +01:00
Ivan Smirnov
103d5eadc3
Remove redundant definition
2016-08-13 12:43:16 +01:00
Ivan Smirnov
098f9aef73
Replace 4096B format buffer with std::string
2016-08-13 12:43:16 +01:00
Ivan Smirnov
b37985ee0c
Fix a comment and wrong indentation
2016-08-13 12:43:16 +01:00
Ivan Smirnov
bf2510ee86
Make buffer_info::as_pybuffer a memoryview ctor
2016-08-13 12:43:16 +01:00
Ivan Smirnov
41c3399021
Update npy_format_descriptor::name()
2016-08-13 12:43:16 +01:00
Ivan Smirnov
076b953ccd
Restore dtype equivalence sanity check
2016-08-13 12:43:16 +01:00
Ivan Smirnov
8f2f7cd61c
Various cleanup
2016-08-13 12:43:16 +01:00
Ivan Smirnov
8fa09cb871
Strip padding fields in dtypes, update the tests
2016-08-13 12:43:16 +01:00
Ivan Smirnov
13022f1b8c
Bugfix: pass struct size as itemsize to descriptor
...
Without this, partially bound structs will have incorrect itemsize.
2016-08-13 12:43:16 +01:00
Ivan Smirnov
eeb4c043f9
Change field descriptor offset type to size_t
2016-08-13 12:43:16 +01:00
Ivan Smirnov
511401599c
Use malloc insterad of calloc for numpy arrays
2016-08-13 12:43:16 +01:00
Ivan Smirnov
5412a05cf0
Rename PYBIND11_DTYPE to PYBIND11_NUMPY_DTYPE
2016-08-13 12:43:16 +01:00
Ivan Smirnov
872bd92575
Use proper type for an int literal
2016-08-13 12:43:16 +01:00
Ivan Smirnov
4c9a160a1d
Exclude double type from is_pod_struct
2016-08-13 12:43:16 +01:00
Ivan Smirnov
3b803846d5
Add a few comments throughout numpy.h
2016-08-13 12:43:16 +01:00
Ivan Smirnov
2f01f01866
Always allocate at least one element
2016-08-13 12:43:16 +01:00
Ivan Smirnov
b38ca22e94
Add a few braces for clarity
2016-08-13 12:43:16 +01:00
Ivan Smirnov
95545e6256
Change PB11_IMPL prefix to PYBIND11, add comment
2016-08-13 12:43:16 +01:00
Ivan Smirnov
7bdd74a9fb
Fix PYBIND11_DTYPE to work with MSVC compiler
2016-08-13 12:43:16 +01:00
Ivan Smirnov
5dc6c5445d
Cosmetic: fix indentation
2016-08-13 12:43:16 +01:00
Ivan Smirnov
73f56830f8
Add detail::is_pod_struct<T> helper
2016-08-13 12:43:16 +01:00
Ivan Smirnov
a0e37f250e
npy_format_descriptor::format() - fail if unbound
2016-08-13 12:43:16 +01:00
Ivan Smirnov
5a47a16e47
Revert accidental whitespace change
2016-08-13 12:43:16 +01:00
Ivan Smirnov
40eadfeb73
Make npy_format_descriptor backwards-compat
...
The typenum for non-structured types is still accessible at ::value,
and the dtype object for all types is accessible at ::dtype().
2016-08-13 12:43:16 +01:00
Ivan Smirnov
95e9b12322
Prefix the FIELD_DESCRIPTOR macro
2016-08-13 12:43:16 +01:00
Ivan Smirnov
5e71e17bdf
Make changes to format_descriptor backwards-compat
...
The format strings that are known at compile time are now accessible
via both ::value and ::format(), and format strings for everything
else is accessible via ::format(). This makes it backwards compatible.
2016-08-13 12:43:16 +01:00
Ivan Smirnov
4f164217e4
Add dtype_of<T>() function, update the tests
2016-08-13 12:43:16 +01:00
Ivan Smirnov
036e8cd32f
Remove erroneous py:: prefix in numpy.h
2016-08-13 12:43:16 +01:00
Ivan Smirnov
873d267471
Prefix all macros in numpy.h to avoid name clashes
2016-08-13 12:43:16 +01:00
Ivan Smirnov
1f54cd9209
Use object instead of ptrs in numpy descriptors
2016-08-13 12:43:16 +01:00
Ivan Smirnov
2a7acb6d55
Incref descriptors properly when creating arrays
2016-08-13 12:43:16 +01:00
Ivan Smirnov
f5b166d042
Simplify npy_format_descriptor slightly
2016-08-13 12:43:16 +01:00