NumPower / numpower

PHP extension for efficient scientific computing and array manipulation with GPU support
https://numpower.org
Other
185 stars 4 forks source link

Broadcasting updates, binominal random initializer and bug fixes #38

Closed henrique-borba closed 1 year ago

henrique-borba commented 1 year ago

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Broadcast improvements

The commits below basically implements broadcasting for NDArray_Greater, NDArray_LessEqual, NDArray_Equal and NDArray_Maximum. It also upgrades the NDArray_Broadcast function to support more variations.

feat: NDArray_IsBroadcastable and NDArray_Broadcast now properly hand… feat: NDArray_Greater broadcast. feat: NDArray_LessEqual and NDArray_GreaterEqual broadcast. fix: NDArray_Maximum not using broadcasted variables.

Bug fixes

NDArray methods were ignoring the object type and was causing segmentation fault when a incompatible object was passed as an argument. This checks if the input object is actually an NDArray (just reusing the GDImage object checking) fix: ZVAL_TO_NDARRAY not checking class name. Causing segmentation fa… Slicing was broken because of signature mismatch fix: zpp mismatch arginfo in NDArray_Slice

New methods

Binominal random initializer feat: Implemented binominal random initializer. NDArray::expand_dims to expand the shape of an array. feat: NDArray::expand_dims implementation.