Skip to content

Commit

Permalink
Batch: add op BatchOperation_Divide, functions Batch_Float64Array
Browse files Browse the repository at this point in the history
… and `Batch_Int32Array`.
  • Loading branch information
PMeira committed Mar 10, 2024
1 parent 64b5297 commit d837fd2
Show file tree
Hide file tree
Showing 5 changed files with 351 additions and 104 deletions.
5 changes: 4 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# Versions 0.14.x

## Version 0.14.3 (next, unreleased)
## Version 0.14.3 (next, unreleased -- 2024-03-10)

- API/YMatrix: check for valid circuit in a few more functions.
- API/Circuit: adjust `SetActiveElement` to be more conformant with the official version, i.e., returns -1 for non-circuit elements.
Expand All @@ -29,6 +29,9 @@
- API/CircuitElement (classic): call Alt implementation for `Open`/`Close`/`IsOpen` to reduce code duplication.
- API/Capacitors: fix `Close` (same issue as CE).
- Header/Alt: fix `dss_obj_float64_int32_func_t` (returns `double`, not `int32_t`).
- API/Batch:
- Implement `BatchOperation_Divide`; needed for integers, and could be slightly better for floats, even though it's a tiny bit slower in modern processors.
- Generalize `Batch_SetFloat64Array`/`Batch_SetIn32Array` to `Batch_Float64Array`/`Batch_In32Array`. This allows dropping the basic batch operations to the engine for array values, and allow for future optimizations in C++. In the current Pascal codebase, this is still better than running the operations on user-side due to memory layout and potential extra memory allocations when running on user-side.

## Version 0.14.2 (2024-02-26)

Expand Down
22 changes: 21 additions & 1 deletion include/dss_capi.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ extern "C" {
enum BatchOperation {
BatchOperation_Set = 0,
BatchOperation_Multiply = 1,
BatchOperation_Increment = 2
BatchOperation_Increment = 2,
BatchOperation_Divide = 3
};

/// The values themselves are subject to change in future versions,
Expand Down Expand Up @@ -7615,9 +7616,19 @@ extern "C" {
DSS_CAPI_DLL void Batch_Int32(void** batch, int32_t batchSize, int32_t Index, int32_t Operation, int32_t Value, int32_t setterFlags);
DSS_CAPI_DLL void Batch_SetString(void** batch, int32_t batchSize, int32_t Index, const char* Value, int32_t setterFlags);
DSS_CAPI_DLL void Batch_SetObject(void** batch, int32_t batchSize, int32_t Index, const void *Value, int32_t setterFlags);
DSS_CAPI_DLL void Batch_Float64Array(void** batch, int32_t batchSize, int32_t Index, int32_t Operation, double* Value, int32_t setterFlags);
DSS_CAPI_DLL void Batch_Int32Array(void** batch, int32_t batchSize, int32_t Index, int32_t Operation, int32_t* Value, int32_t setterFlags);

/*!
DEPRECATED: use `Batch_Float64Array` with `Operation=BatchOperation_Set` instead
*/
DSS_CAPI_DLL void Batch_SetFloat64Array(void** batch, int32_t batchSize, int32_t Index, double* Value, int32_t setterFlags);

/*!
DEPRECATED: use `Batch_Int32Array` with `Operation=BatchOperation_Set` instead
*/
DSS_CAPI_DLL void Batch_SetInt32Array(void** batch, int32_t batchSize, int32_t Index, int32_t* Value, int32_t setterFlags);

DSS_CAPI_DLL void Batch_SetStringArray(void** batch, int32_t batchSize, int32_t Index, const char** Value, int32_t setterFlags);
DSS_CAPI_DLL void Batch_SetObjectArray(void** batch, int32_t batchSize, int32_t Index, const void** Value, int32_t setterFlags);

Expand All @@ -7640,7 +7651,16 @@ extern "C" {
DSS_CAPI_DLL void Batch_SetStringS(void** batch, int32_t batchSize, const char* Name, const char* Value, int32_t setterFlags);
DSS_CAPI_DLL void Batch_SetObjectS(void** batch, int32_t batchSize, const char* Name, const void* Value, int32_t setterFlags);

DSS_CAPI_DLL void Batch_Float64ArrayS(void** batch, int32_t batchSize, const char* Name, int32_t Operation, double* Value, int32_t setterFlags);
/*!
DEPRECATED: use `Batch_Int32ArrayS` with `Operation=BatchOperation_Set` instead
*/
DSS_CAPI_DLL void Batch_SetFloat64ArrayS(void** batch, int32_t batchSize, const char* Name, double* Value, int32_t setterFlags);

DSS_CAPI_DLL void Batch_Int32ArrayS(void** batch, int32_t batchSize, const char* Name, int32_t Operation, int32_t* Value, int32_t setterFlags);
/*!
DEPRECATED: use `Batch_Int32ArrayS` with `Operation=BatchOperation_Set` instead
*/
DSS_CAPI_DLL void Batch_SetInt32ArrayS(void** batch, int32_t batchSize, const char* Name, int32_t* Value, int32_t setterFlags);
DSS_CAPI_DLL void Batch_SetStringArrayS(void** batch, int32_t batchSize, const char* Name, const char** Value, int32_t setterFlags);
DSS_CAPI_DLL void Batch_SetObjectArrayS(void** batch, int32_t batchSize, const char* Name, const void** Value, int32_t setterFlags);
Expand Down
11 changes: 11 additions & 0 deletions include/dss_capi_ctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -7163,11 +7163,22 @@ extern "C" {



/*!
*/

/*!
*/






/*!
*/

/*!
*/

/*!
Use this if you experience issues with your languages normal threads.
Expand Down
Loading

0 comments on commit d837fd2

Please sign in to comment.