PAL 1D Arrays: Boolean and Integer Operations

Basic Boolean, integer, and short-vector initialization, copying, arithmetic, counting, sorting, and conversion helpers.

PAL 1D Arrays: Boolean and Integer Operations — 15 functions

KiratPal1DIntSortAscend

Signature
T_INT KiratPal1DIntSortAscend(T_INT* piSrcDest, T_INT iSize);
Description
Sorts the array in ascending order.
Mathematical operation
\(y_{(0)}\le y_{(1)}\le\cdots\le y_{(N-1)}\), where \(y\) is a permutation of the input elements.
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalAdd1DIntTo1DInt

Signature
T_INT KiratPalAdd1DIntTo1DInt(T_INT* piDestination, T_INT* piVector, T_INT iSize);
Description
Adds scalar, vector, or array values element-wise; ToDest writes to a separate destination, while Acc accumulates into an existing destination.
Mathematical operation
\(d_i\leftarrow d_i+s_i\) (or \(+c\) for a scalar source).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalAddIntTo1DInt

Signature
T_INT KiratPalAddIntTo1DInt(T_INT* piDest, T_INT iValue, T_INT iSize);
Description
Adds scalar, vector, or array values element-wise; ToDest writes to a separate destination, while Acc accumulates into an existing destination.
Mathematical operation
\(d_i\leftarrow d_i+c\).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalCopy1DBool

Signature
T_INT KiratPalCopy1DBool(const T_BOOL* pbSource, T_BOOL* pbDestination, T_INT iSize);
Description
Copies the specified data or subrange to the destination.
Mathematical operation
\(D_{\mathbf i}\leftarrow S_{\mathbf i}\) element-wise (with type conversion where indicated by the function name).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalCopy1DInt

Signature
T_INT KiratPalCopy1DInt(const T_INT* piSource, T_INT* piDestination, T_INT iSize);
Description
Copies the specified data or subrange to the destination.
Mathematical operation
\(D_{\mathbf i}\leftarrow S_{\mathbf i}\) element-wise (with type conversion where indicated by the function name).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalGetMax1DInt

Signature
T_INT KiratPalGetMax1DInt(const T_INT* piVector, T_INT iSize);
Description
Returns the largest value in the array.
Mathematical operation
\(y=\max_{\mathbf i}x_{\mathbf i}\).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalGetNumTrues­AndIndex1DBool

Signature
T_INT KiratPalGetNumTruesAndIndex1DBool(const T_BOOL* pbSource, T_INT iSize, T_INT* iIndex);
Description
Counts true Boolean values and writes their indices to a destination array.
Mathematical operation
\(N_T=\sum_i\mathbf1[b_i=\mathrm{true}]\); the function also stores the indices for which the indicator is 1.
Supported implementations
  • ANSI C - portable reference implementation

KiratPalIntShuffle

Signature
void KiratPalIntShuffle(T_INT* piInOut, T_INT iSize);
Description
Pseudo-randomly shuffles the order of the elements.
Mathematical operation
\(y_i=x_{\pi(i)}\) for a pseudo-random permutation \(\pi\).
Supported implementations
  • ANSI C - portable reference implementation

KiratPalSet1DBoolToValue

Signature
T_INT KiratPalSet1DBoolToValue(T_BOOL* pbDestination, T_INT iSize, T_BOOL bValue);
Description
Sets all elements of the array to a constant value.
Mathematical operation
\(d_{\mathbf i}\leftarrow c\) for every array index \(\mathbf i\).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalSet1DIntToValue

Signature
T_INT KiratPalSet1DIntToValue(T_INT* piDestination, T_INT iSize, T_INT iValue);
Description
Sets all elements of the array to a constant value.
Mathematical operation
\(d_{\mathbf i}\leftarrow c\) for every array index \(\mathbf i\).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalSet1DIntToZero

Signature
T_INT KiratPalSet1DIntToZero(T_INT* piDestination, T_INT iSize);
Description
Sets all elements of the array to zero.
Mathematical operation
\(d_{\mathbf i}\leftarrow0\) for every array index \(\mathbf i\).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalSet1DShortToZero

Signature
T_INT KiratPalSet1DShortToZero(T_SHORT* psDestination, T_INT iSize);
Description
Sets all elements of the array to zero.
Mathematical operation
\(d_{\mathbf i}\leftarrow0\) for every array index \(\mathbf i\).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalSubtract1DInt­From1DInt

Signature
T_INT KiratPalSubtract1DIntFrom1DInt(T_INT* piDestination, T_INT* piVector, T_INT iSize);
Description
Subtracts scalar, vector, or array values element-wise; “A from B” means B−A mathematically.
Mathematical operation
\(d_i\leftarrow d_i-x_i\).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support

KiratPalSumUp1DBoolVector­ToScalar

Signature
T_INT KiratPalSumUp1DBoolVectorToScalar(const T_BOOL* pbSource, T_INT iSize);
Description
Sums array elements; variants sum values, magnitudes, powers, or Boolean true values.
Mathematical operation
\(s=\sum_i\mathbf1[b_i=\mathrm{true}]\) (or the analogous sum over all matrix indices).
Supported implementations
  • ANSI C - portable reference implementation

KiratPalSumUp1DIntVector­ToScalar

Signature
T_INT KiratPalSumUp1DIntVectorToScalar(const T_INT* piSource, T_INT iSize);
Description
Sums array elements; variants sum values, magnitudes, powers, or Boolean true values.
Mathematical operation
\(s=\sum_i x_i\).
Supported implementations
  • ANSI C - portable reference implementation
  • Intel/AMD processors - Intel IPP library support