arrayfire / arrayfire-binary-python-wrapper

A python thin wrapper for ArrayFire library
https://arrayfire.com
BSD 3-Clause "New" or "Revised" License
2 stars 5 forks source link

Bitshift and Complexity Testing #31

Closed AzeezIsh closed 4 months ago

AzeezIsh commented 5 months ago

This PR introduces a suite of unit tests for arithmetic_operations.py and complex_operations.py located within the within the mathematical functions directory. The primary functions in this file are based around bitshifts, creating complex arrays, conjugates and imaginary/real numbers.

Standard Operations and Data Handling Tests Complex Operations for Supported Data Types: The tests confirm the ability to perform complex operations across all supported data types, with a particular focus on floating-point precision variants such as 32-bit floats as these were the only compatible data types for complex operations. Each operation's success across varied input shapes—from scalar to four-dimensional arrays—shows the library's robust handling of complex data structures. Error Handling for Unsupported Data Types: Tests are important for ensuring stability, as they check that attempting complex operations with unsupported data types (notably 64-bit floats and complex numbers) correctly raises runtime errors. Prevents undefined behavior and reinforces the library's reliability.

Parameter Variability across Operations Bit Shifting Across Data Types: Testing extends to bit shifting operations (both left and right shifts) across various data types, underlining the library's capability to manipulate bits effectively within the supported numerical range. The attention to diverse data types, including integer and boolean, highlights the library's versatility. Handling Varying Input Sizes and Shapes: The library's adaptability is further demonstrated through tests that evaluate bit shifting operations with different input sizes and shapes. These tests affirm that the library can accurately process data arrays of various dimensions, reinforcing its utility in handling real-world data complexities. Varying Shift Amounts: By experimenting with different shift amounts from negatives to extremely large numbers, and comparing outcomes across array shapes, the tests validate the library's correctness and resilience in scenarios that diverge from typical use cases. This comprehensive approach ensures the library remains reliable across a spectrum of applications.