3218 lines
143 KiB
C
Executable File
3218 lines
143 KiB
C
Executable File
/****************************************************************************
|
|
|
|
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
|
|
|
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
|
be copied by any method or incorporated into another program without
|
|
the express written consent of Aerospace C.Power. This Information or any portion
|
|
thereof remains the property of Aerospace C.Power. The Information contained herein
|
|
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
|
liability for its use in any way and conveys no license or title under
|
|
any patent or copyright and makes no representation or warranty that this
|
|
Information is free from patent or copyright infringement.
|
|
|
|
****************************************************************************/
|
|
#ifndef VECTOR_FUNCTION_H
|
|
#define VECTOR_FUNCTION_H
|
|
/* os shim includes */
|
|
#include "os_types.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** \defgroup vector function API
|
|
* @brief vector function APIs
|
|
* Vector inner product, accumulation and pointwise functions, including add, sub, mul, shift, bitwise logic, comparison, and cast.
|
|
*/
|
|
|
|
/** @addtogroup vector_function_APIs
|
|
* @{
|
|
*/
|
|
|
|
/* @brief vector_add_int8() - add 2 vectors
|
|
out[i] = va[i] + vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_add_const_int8() - add a constant to a vector
|
|
out[i] = va[i] + const_add
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_add: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_const_int8(int8_t *va, int8_t const_add, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_int8() - subtract function, as below
|
|
out[i] = va[i] - vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_int8() - subtract a constant from a vector
|
|
out[i] = va[i] - const_sub
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_const_int8(int8_t *va, int8_t const_sub, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_int8() - subtract a vector from a constant vector
|
|
out[i] = const_sub - va[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_sub_int8(int8_t *va, int8_t const_sub, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int8() - multiply function, as below
|
|
out[i] = va[i] * vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int8(int8_t *va, int8_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int8() - multiply a vector by a constant
|
|
out[i] = va[i] * constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int8(int8_t *va, int8_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int8_high_8bit() - multiply function, only reserve the higher 8bits, as below
|
|
out[i] = (va[i] * vb[i]) >> 8
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int8_high_8bit(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int8_high_8bit() - multiply a vector by a constant, only reserve the higher 8bits, as below
|
|
out[i] = (va[i] * constant) >> 8
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int8_high_8bit(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int8_low_8bit() - multiply function, only reserve the lower 8bits, as below
|
|
out[i] = (va[i] * vb[i]) & 0xff
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int8_low_8bit(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int8_low_8bit() - multiply a vector by a constant, only reserve the lower 8bits, as below
|
|
out[i] = (va[i] * constant) 0xff
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int8_low_8bit(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_int8() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_int8(int8_t *va, int8_t *vb, int8_t *vadd, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_int8_to_int32() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_int8_to_int32(int8_t *va, int8_t *vb, int32_t *vadd, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_int8() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_int8(int8_t *va, int8_t *vb, int8_t *vsub, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_int8_to_int32() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_int8_to_int32(int8_t *va, int8_t *vb, int32_t *vsub, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_int8() - max operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_const_int8() - max operation pointwise, as below
|
|
out[i] = va[i] > const_max ? va[i] : const_max
|
|
* @param va: input vector in the formula above
|
|
* @param const_max: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_const_int8(int8_t *va, int8_t const_max, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_int8() - min operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_const_int8() - min operation pointwise, as below
|
|
out[i] = va[i] > const_min ? va[i] : const_min
|
|
* @param va: input vector in the formula above
|
|
* @param const_min: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_const_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_int8() - comparison operation pointwise, as below
|
|
out[i] = va[i] == vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_const_int8() - comparison operation pointwise, as below
|
|
out[i] = va[i] == constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_const_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_int8() - comparison operation pointwise, as below
|
|
out[i] = va[i] != vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_const_int8() - comparison operation pointwise, as below
|
|
out[i] = va[i] != constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_const_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_int8() - comparison operation pointwise, as below
|
|
out[i] = va[i] < vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_const_int8() - comparison operation pointwise, as below
|
|
out[i] = va[i] < constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_const_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_less_than_int8() - comparison operation pointwise, as below
|
|
out[i] = constant < va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_less_than_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_int8() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_const_int8() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_const_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_greater_or_equal_int8() - comparison operation pointwise, as below
|
|
out[i] = constant >= va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_greater_or_equal_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_int8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_const_int8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_const_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_int8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_const_int8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_const_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_int8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_const_int8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_const_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_int8() - bitwise logic operation pointwise, as below
|
|
out[i] = ~(va[i] ^ vb[i])
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_int8(int8_t *va, int8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_const_int8() - bitwise logic operation pointwise, as below
|
|
out[i] = ~(va[i] ^ constant)
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_const_int8(int8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_int8() - left shift operation pointwise, as below
|
|
out[i] = va[i] << vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_int8(int8_t *va, uint8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_int8() - left operation pointwise, as below
|
|
out[i] = va[i] << constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_const_int8(int8_t *va, uint8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_int8() - left operation pointwise, as below
|
|
out[i] = constant << va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_left_shift_int8(uint8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_right_shift_int8() - logic right shift operation pointwise, as below
|
|
out[i] = (int8_t)((uint8_t)va[i] >> vb[i])
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_right_shift_int8(int8_t *va, uint8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_right_shift_const_int8() - logic right shift operation pointwise, as below
|
|
out[i] = (int8_t)((uint8_t)va[i] >> constant)
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_right_shift_const_int8(int8_t *va, uint8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_logic_right_shift_int8() - logic right shift operation pointwise, as below
|
|
out[i] = (int8_t)((uint8_t)constant >> va[i])
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_logic_right_shift_int8(uint8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_arithmatic_right_shift_int8() - arithmatic right shift operation pointwise, as below
|
|
out[i] = va[i] >> vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_arithmatic_right_shift_int8(int8_t *va, uint8_t *vb, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_arithmatic_right_shift_const_int8() - arithmatic right shift operation pointwise, as below
|
|
out[i] = va[i] >> constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_arithmatic_right_shift_const_int8(int8_t *va, uint8_t constant, int8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_arithmatic_right_shift_int8() - arithmatic right shift operation pointwise, as below
|
|
out[i] = constant >> va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_arithmatic_right_shift_int8(uint8_t *va, int8_t constant, int8_t *out, uint32_t len);
|
|
|
|
|
|
/* @brief vector_add_uint8() - add 2 vectors
|
|
out[i] = va[i] + vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_add_const_uint8() - add a constant to a vector
|
|
out[i] = va[i] + const_add
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_add: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_const_uint8(uint8_t *va, uint8_t const_add, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_uint8() - subtract function, as below
|
|
out[i] = va[i] - vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_uint8() - subtract a constant from a vector
|
|
out[i] = va[i] - const_sub
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_const_uint8(uint8_t *va, uint8_t const_sub, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_uint8() - subtract a vector from a constant vector
|
|
out[i] = const_sub - va[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_sub_uint8(uint8_t *va, uint8_t const_sub, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint8() - multiply function, as below
|
|
out[i] = va[i] * vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint8(uint8_t *va, uint8_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint8() - multiply a vector by a constant
|
|
out[i] = va[i] * constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint8(uint8_t *va, uint8_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint8_high_8bit() - multiply function, only reserve the higher 8bits, as below
|
|
out[i] = (va[i] * vb[i]) >> 8
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint8_high_8bit(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint8_high_8bit() - multiply a vector by a constant, only reserve the higher 8bits, as below
|
|
out[i] = (va[i] * constant) >> 8
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint8_high_8bit(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint8_low_8bit() - multiply function, only reserve the lower 8bits, as below
|
|
out[i] = (va[i] * vb[i]) & 0xff
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint8_low_8bit(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint8_low_8bit() - multiply a vector by a constant, only reserve the lower 8bits, as below
|
|
out[i] = (va[i] * constant) 0xff
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint8_low_8bit(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_uint8() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_uint8(uint8_t *va, uint8_t *vb, uint8_t *vadd, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_uint8_to_uint32() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_uint8_to_uint32(uint8_t *va, uint8_t *vb, uint32_t *vadd, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_uint8() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_uint8(uint8_t *va, uint8_t *vb, uint8_t *vsub, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_uint8_to_uint32() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_uint8_to_uint32(uint8_t *va, uint8_t *vb, uint32_t *vsub, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_uint8() - max operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_const_uint8() - max operation pointwise, as below
|
|
out[i] = va[i] > const_max ? va[i] : const_max
|
|
* @param va: input vector in the formula above
|
|
* @param const_max: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_const_uint8(uint8_t *va, uint8_t const_max, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_uint8() - min operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_const_uint8() - min operation pointwise, as below
|
|
out[i] = va[i] > const_min ? va[i] : const_min
|
|
* @param va: input vector in the formula above
|
|
* @param const_min: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_uint8() - comparison operation pointwise, as below
|
|
out[i] = va[i] == vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_const_uint8() - comparison operation pointwise, as below
|
|
out[i] = va[i] == constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_uint8() - comparison operation pointwise, as below
|
|
out[i] = va[i] != vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_const_uint8() - comparison operation pointwise, as below
|
|
out[i] = va[i] != constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_uint8() - comparison operation pointwise, as below
|
|
out[i] = va[i] < vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_const_uint8() - comparison operation pointwise, as below
|
|
out[i] = va[i] < constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_less_than_uint8() - comparison operation pointwise, as below
|
|
out[i] = constant < va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_less_than_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_uint8() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_const_uint8() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_greater_or_equal_uint8() - comparison operation pointwise, as below
|
|
out[i] = constant >= va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_greater_or_equal_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_uint8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_const_uint8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_uint8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_const_uint8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_uint8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_const_uint8() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_uint8() - bitwise logic operation pointwise, as below
|
|
out[i] = (va[i] ^ vb[i])
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_const_uint8() - bitwise logic operation pointwise, as below
|
|
out[i] = (va[i] ^ constant)
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_uint8() - left shift operation pointwise, as below
|
|
out[i] = va[i] << vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_uint8() - left operation pointwise, as below
|
|
out[i] = va[i] << constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_uint8() - left operation pointwise, as below
|
|
out[i] = constant << va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_left_shift_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_right_shift_uint8() - right shift operation pointwise, as below
|
|
out[i] = va[i] >> vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_right_shift_uint8(uint8_t *va, uint8_t *vb, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_right_shift_const_uint8() - right shift operation pointwise, as below
|
|
out[i] = va[i] >> constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_right_shift_const_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_right_shift_uint8() - right shift operation pointwise, as below
|
|
out[i] = constant >> va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_right_shift_uint8(uint8_t *va, uint8_t constant, uint8_t *out, uint32_t len);
|
|
|
|
|
|
/* @brief vector_add_int16() - add 2 vectors
|
|
out[i] = va[i] + vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_add_const_int16() - add a constant to a vector
|
|
out[i] = va[i] + const_add
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_add: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_const_int16(int16_t *va, int16_t const_add, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_int16() - subtract function, as below
|
|
out[i] = va[i] - vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_int16() - subtract a constant from a vector
|
|
out[i] = va[i] - const_sub
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_const_int16(int16_t *va, int16_t const_sub, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_int16() - subtract a vector from a constant vector
|
|
out[i] = const_sub - va[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_sub_int16(int16_t *va, int16_t const_sub, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int16() - multiply function, as below
|
|
out[i] = va[i] * vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int16(int16_t *va, int16_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int16() - multiply a vector by a constant
|
|
out[i] = va[i] * constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int16(int16_t *va, int16_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int16_high_16bit() - multiply function, only reserve the higher 16 bits, as below
|
|
out[i] = (va[i] * vb[i]) >> 16
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int16_high_16bit(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int16_high_16bit() - multiply a vector by a constant, only reserve the higher 16 bits, as below
|
|
out[i] = (va[i] * constant) >> 16
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int16_high_16bit(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int16_low_16bit() - multiply function, only reserve the lower 16 bits, as below
|
|
out[i] = (va[i] * vb[i]) & 0xffff
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int16_low_16bit(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int16_low_16bit() - multiply a vector by a constant, only reserve the lower 16 bits, as below
|
|
out[i] = (va[i] * constant) 0xffff
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int16_low_16bit(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_int16() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_int16(int16_t *va, int16_t *vb, int16_t *vadd, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_int16_to_int64() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_int16_to_int64(int16_t *va, int16_t *vb, int64_t *vadd, int64_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_int16() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_int16(int16_t *va, int16_t *vb, int16_t *vsub, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_int16_to_int64() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_int16_to_int64(int16_t *va, int16_t *vb, int64_t *vsub, int64_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_int16() - max operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_const_int16() - max operation pointwise, as below
|
|
out[i] = va[i] > const_max ? va[i] : const_max
|
|
* @param va: input vector in the formula above
|
|
* @param const_max: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_const_int16(int16_t *va, int16_t const_max, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_int16() - min operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_const_int16() - min operation pointwise, as below
|
|
out[i] = va[i] > const_min ? va[i] : const_min
|
|
* @param va: input vector in the formula above
|
|
* @param const_min: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_const_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_int16() - comparison operation pointwise, as below
|
|
out[i] = va[i] == vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_const_int16() - comparison operation pointwise, as below
|
|
out[i] = va[i] == constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_const_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_int16() - comparison operation pointwise, as below
|
|
out[i] = va[i] != vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_const_int16() - comparison operation pointwise, as below
|
|
out[i] = va[i] != constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_const_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_int16() - comparison operation pointwise, as below
|
|
out[i] = va[i] < vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_const_int16() - comparison operation pointwise, as below
|
|
out[i] = va[i] < constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_const_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_less_than_int16() - comparison operation pointwise, as below
|
|
out[i] = constant < va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_less_than_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_int16() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_const_int16() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_const_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_greater_or_equal_int16() - comparison operation pointwise, as below
|
|
out[i] = constant >= va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_greater_or_equal_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_int16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_const_int16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_const_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_int16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_const_int16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_const_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_int16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_const_int16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_const_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_int16() - bitwise logic operation pointwise, as below
|
|
out[i] = (va[i] ^ vb[i])
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_int16(int16_t *va, int16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_const_int16() - bitwise logic operation pointwise, as below
|
|
out[i] = (va[i] ^ constant)
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_const_int16(int16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_int16() - left shift operation pointwise, as below
|
|
out[i] = va[i] << vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_int16(int16_t *va, uint16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_int16() - left operation pointwise, as below
|
|
out[i] = va[i] << constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_const_int16(int16_t *va, uint16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_int16() - left operation pointwise, as below
|
|
out[i] = constant << va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_left_shift_int16(uint16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_right_shift_int16() - logic right shift operation pointwise, as below
|
|
out[i] = (int16_t)((uint16_t)va[i] >> vb[i])
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_right_shift_int16(int16_t *va, uint16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_right_shift_const_int16() - logic right shift operation pointwise, as below
|
|
out[i] = (int16_t)((uint16_t)va[i] >> constant)
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_right_shift_const_int16(int16_t *va, uint16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_logic_right_shift_int16() - logic right shift operation pointwise, as below
|
|
out[i] = (int16_t)((uint16_t)constant >> va[i])
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_logic_right_shift_int16(uint16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_arithmatic_right_shift_int16() - arithmatic right shift operation pointwise, as below
|
|
out[i] = va[i] >> vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_arithmatic_right_shift_int16(int16_t *va, uint16_t *vb, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_arithmatic_right_shift_const_int16() - arithmatic right shift operation pointwise, as below
|
|
out[i] = va[i] >> constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_arithmatic_right_shift_const_int16(int16_t *va, uint16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_arithmatic_right_shift_int16() - arithmatic right shift operation pointwise, as below
|
|
out[i] = constant >> va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_arithmatic_right_shift_int16(uint16_t *va, int16_t constant, int16_t *out, uint32_t len);
|
|
|
|
/* @brief () - get higher 8 bits from a 16-bit vector, as below
|
|
out[i] = in[i] >> 8
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_high_half_bits_int16(int16_t *in, int8_t *out, uint32_t len);
|
|
|
|
/* @brief () - get lower 8 bits from a 16-bit vector, as below
|
|
out[i] = in[i] & 0xff
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_low_half_bits_int16(int16_t *in, int8_t *out, uint32_t len);
|
|
|
|
/* @brief () - get lower 8 bits and higher 8 bits from a 16-bit vector, as below
|
|
high[i] = in[i] >> 8
|
|
low[i] = in[i] & 0xff
|
|
* @param in: input vector in the formula above
|
|
* @param high: output vector in the formula above
|
|
* @param low: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_high_and_low_half_bits_int16(int16_t *in, int8_t *high, int8_t *low, uint32_t len);
|
|
|
|
/* @brief vector_add_uint16() - add 2 vectors
|
|
out[i] = va[i] + vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_add_const_uint16() - add a constant to a vector
|
|
out[i] = va[i] + const_add
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_add: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_const_uint16(uint16_t *va, uint16_t const_add, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_uint16() - subtract function, as below
|
|
out[i] = va[i] - vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_uint16() - subtract a constant from a vector
|
|
out[i] = va[i] - const_sub
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_const_uint16(uint16_t *va, uint16_t const_sub, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_uint16() - subtract a vector from a constant vector
|
|
out[i] = const_sub - va[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_sub_uint16(uint16_t *va, uint16_t const_sub, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint16() - multiply function, as below
|
|
out[i] = va[i] * vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint16(uint16_t *va, uint16_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint16() - multiply a vector by a constant
|
|
out[i] = va[i] * constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint16(uint16_t *va, uint16_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint16_high_16bit() - multiply function, only reserve the higher 16 bits, as below
|
|
out[i] = (va[i] * vb[i]) >> 16
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint16_high_16bit(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint16_high_16bit() - multiply a vector by a constant, only reserve the higher 16 bits, as below
|
|
out[i] = (va[i] * constant) >> 16
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint16_high_16bit(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint16_low_16bit() - multiply function, only reserve the lower 16 bits, as below
|
|
out[i] = (va[i] * vb[i]) & 0xffff
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint16_low_16bit(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint16_low_16bit() - multiply a vector by a constant, only reserve the lower 16 bits, as below
|
|
out[i] = (va[i] * constant) 0xffff
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint16_low_16bit(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_uint16() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_uint16(uint16_t *va, uint16_t *vb, uint16_t *vadd, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_uint16_to_uint64() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_uint16_to_uint64(uint16_t *va, uint16_t *vb, uint64_t *vadd, uint64_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_uint16() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_uint16(uint16_t *va, uint16_t *vb, uint16_t *vsub, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_uint16_to_uint64() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_uint16_to_uint64(uint16_t *va, uint16_t *vb, uint64_t *vsub, uint64_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_uint16() - max operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_const_uint16() - max operation pointwise, as below
|
|
out[i] = va[i] > const_max ? va[i] : const_max
|
|
* @param va: input vector in the formula above
|
|
* @param const_max: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_const_uint16(uint16_t *va, uint16_t const_max, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_uint16() - min operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_const_uint16() - min operation pointwise, as below
|
|
out[i] = va[i] > const_min ? va[i] : const_min
|
|
* @param va: input vector in the formula above
|
|
* @param const_min: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_uint16() - comparison operation pointwise, as below
|
|
out[i] = va[i] == vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_const_uint16() - comparison operation pointwise, as below
|
|
out[i] = va[i] == constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_uint16() - comparison operation pointwise, as below
|
|
out[i] = va[i] != vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_const_uint16() - comparison operation pointwise, as below
|
|
out[i] = va[i] != constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_uint16() - comparison operation pointwise, as below
|
|
out[i] = va[i] < vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_const_uint16() - comparison operation pointwise, as below
|
|
out[i] = va[i] < constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_less_than_uint16() - comparison operation pointwise, as below
|
|
out[i] = constant < va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_less_than_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_uint16() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_const_uint16() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_greater_or_equal_uint16() - comparison operation pointwise, as below
|
|
out[i] = constant >= va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_greater_or_equal_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_uint16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_const_uint16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_uint16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_const_uint16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_uint16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_const_uint16() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_uint16() - bitwise logic operation pointwise, as below
|
|
out[i] = (va[i] ^ vb[i])
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_const_uint16() - bitwise logic operation pointwise, as below
|
|
out[i] = (va[i] ^ constant)
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_uint16() - left shift operation pointwise, as below
|
|
out[i] = va[i] << vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_uint16() - left operation pointwise, as below
|
|
out[i] = va[i] << constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_uint16() - left operation pointwise, as below
|
|
out[i] = constant << va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_left_shift_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_right_shift_uint16() - right shift operation pointwise, as below
|
|
out[i] = va[i] >> vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_right_shift_uint16(uint16_t *va, uint16_t *vb, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_right_shift_const_uint16() - right shift operation pointwise, as below
|
|
out[i] = va[i] >> constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_right_shift_const_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_right_shift_uint16() - right shift operation pointwise, as below
|
|
out[i] = constant >> va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_right_shift_uint16(uint16_t *va, uint16_t constant, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief () - get higher 8 bits from a 16-bit vector, as below
|
|
out[i] = in[i] >> 8
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_high_half_bits_uint16(uint16_t *in, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief () - get lower 8 bits from a 16-bit vector, as below
|
|
out[i] = in[i] & 0xff
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_low_half_bits_uint16(uint16_t *in, uint8_t *out, uint32_t len);
|
|
|
|
/* @brief () - get lower 8 bits and higher 8 bits from a 16-bit vector, as below
|
|
high[i] = in[i] >> 8
|
|
low[i] = in[i] & 0xff
|
|
* @param in: input vector in the formula above
|
|
* @param high: output vector in the formula above
|
|
* @param low: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_high_and_low_half_bits_uint16(uint16_t *in, uint8_t *high, uint8_t *low, uint32_t len);
|
|
|
|
|
|
/* @brief vector_add_int32() - add 2 vectors
|
|
out[i] = va[i] + vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_add_const_int32() - add a constant to a vector
|
|
out[i] = va[i] + const_add
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_add: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_const_int32(int32_t *va, int32_t const_add, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_int32() - subtract function, as below
|
|
out[i] = va[i] - vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_int32() - subtract a constant from a vector
|
|
out[i] = va[i] - const_sub
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_const_int32(int32_t *va, int32_t const_sub, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_int32() - subtract a vector from a constant vector
|
|
out[i] = const_sub - va[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_sub_int32(int32_t *va, int32_t const_sub, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int32() - multiply function, as below
|
|
out[i] = va[i] * vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int32(int32_t *va, int32_t *vb, int64_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int32() - multiply a vector by a constant
|
|
out[i] = va[i] * constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int32(int32_t *va, int32_t constant, int64_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int32_high_8bit() - multiply function, only reserve the higher 8bits, as below
|
|
out[i] = (va[i] * vb[i]) >> 32
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int32_high_32bit(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int32_high_8bit() - multiply a vector by a constant, only reserve the higher 8bits, as below
|
|
out[i] = (va[i] * constant) >> 32
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int32_high_32bit(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int32_low_8bit() - multiply function, only reserve the lower 8bits, as below
|
|
out[i] = (va[i] * vb[i]) & 0xffffffff
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int32_low_32bit(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int32_low_8bit() - multiply a vector by a constant, only reserve the lower 8bits, as below
|
|
out[i] = (va[i] * constant) 0xffffffff
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int32_low_32bit(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_int32() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_int32(int32_t *va, int32_t *vb, int32_t *vadd, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_int32() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_int32(int32_t *va, int32_t *vb, int32_t *vsub, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_int32() - max operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_const_int32() - max operation pointwise, as below
|
|
out[i] = va[i] > const_max ? va[i] : const_max
|
|
* @param va: input vector in the formula above
|
|
* @param const_max: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_const_int32(int32_t *va, int32_t const_max, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_int32() - min operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_const_int32() - min operation pointwise, as below
|
|
out[i] = va[i] > const_min ? va[i] : const_min
|
|
* @param va: input vector in the formula above
|
|
* @param const_min: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_const_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_int32() - comparison operation pointwise, as below
|
|
out[i] = va[i] == vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_const_int32() - comparison operation pointwise, as below
|
|
out[i] = va[i] == constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_const_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_int32() - comparison operation pointwise, as below
|
|
out[i] = va[i] != vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_const_int32() - comparison operation pointwise, as below
|
|
out[i] = va[i] != constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_const_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_int32() - comparison operation pointwise, as below
|
|
out[i] = va[i] < vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_const_int32() - comparison operation pointwise, as below
|
|
out[i] = va[i] < constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_const_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_less_than_int32() - comparison operation pointwise, as below
|
|
out[i] = constant < va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_less_than_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_int32() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_const_int32() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_const_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_greater_or_equal_int32() - comparison operation pointwise, as below
|
|
out[i] = constant >= va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_greater_or_equal_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_int32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_const_int32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_const_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_int32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_const_int32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_const_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_int32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_const_int32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_const_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_int32() - bitwise logic operation pointwise, as below
|
|
out[i] = (va[i] ^ vb[i])
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_int32(int32_t *va, int32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_const_int32() - bitwise logic operation pointwise, as below
|
|
out[i] = (va[i] ^ constant)
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_const_int32(int32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_int32() - left shift operation pointwise, as below
|
|
out[i] = va[i] << vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_int32(int32_t *va, uint32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_int32() - left operation pointwise, as below
|
|
out[i] = va[i] << constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_const_int32(int32_t *va, uint32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_int32() - left operation pointwise, as below
|
|
out[i] = constant << va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_left_shift_int32(uint32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_right_shift_int32() - logic right shift operation pointwise, as below
|
|
out[i] = (int32_t)((uint32_t)va[i] >> vb[i])
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_right_shift_int32(int32_t *va, uint32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_right_shift_const_int32() - logic right shift operation pointwise, as below
|
|
out[i] = (int32_t)((uint32_t)va[i] >> constant)
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_right_shift_const_int32(int32_t *va, uint32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_logic_right_shift_int32() - logic right shift operation pointwise, as below
|
|
out[i] = (int32_t)((uint32_t)constant >> va[i])
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_logic_right_shift_int32(uint32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_arithmatic_right_shift_int32() - arithmatic right shift operation pointwise, as below
|
|
out[i] = va[i] >> vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_arithmatic_right_shift_int32(int32_t *va, uint32_t *vb, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_arithmatic_right_shift_const_int32() - arithmatic right shift operation pointwise, as below
|
|
out[i] = va[i] >> constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_arithmatic_right_shift_const_int32(int32_t *va, uint32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_arithmatic_right_shift_int32() - arithmatic right shift operation pointwise, as below
|
|
out[i] = constant >> va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_arithmatic_right_shift_int32(uint32_t *va, int32_t constant, int32_t *out, uint32_t len);
|
|
|
|
/* @brief () - get higher 16 bits from a 32-bit vector, as below
|
|
out[i] = in[i] >> 16
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_high_half_bits_int32(int32_t *in, int16_t *out, uint32_t len);
|
|
|
|
/* @brief () - get lower 16 bits from a 32-bit vector, as below
|
|
out[i] = in[i] & 0xffff
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_low_half_bits_int32(int32_t *in, int16_t *out, uint32_t len);
|
|
|
|
/* @brief () - get lower 16 bits and higher 16 bits from a 32-bit vector, as below
|
|
high[i] = in[i] >> 16
|
|
low[i] = in[i] & 0xffff
|
|
* @param in: input vector in the formula above
|
|
* @param high: output vector in the formula above
|
|
* @param low: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_high_and_low_half_bits_int32(int32_t *in, int16_t *high, int16_t *low, uint32_t len);
|
|
|
|
/* @brief vector_add_uint32() - add 2 vectors
|
|
out[i] = va[i] + vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_add_const_uint32() - add a constant to a vector
|
|
out[i] = va[i] + const_add
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_add: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_const_uint32(uint32_t *va, uint32_t const_add, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_uint32() - subtract function, as below
|
|
out[i] = va[i] - vb[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_uint32() - subtract a constant from a vector
|
|
out[i] = va[i] - const_sub
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_const_uint32(uint32_t *va, uint32_t const_sub, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_uint32() - subtract a vector from a constant vector
|
|
out[i] = const_sub - va[i]
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_sub_uint32(uint32_t *va, uint32_t const_sub, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint32() - multiply function, as below
|
|
out[i] = va[i] * vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint32(uint32_t *va, uint32_t *vb, uint64_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint32() - multiply a vector by a constant
|
|
out[i] = va[i] * constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint32(uint32_t *va, uint32_t constant, uint64_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint32_high_8bit() - multiply function, only reserve the higher 8bits, as below
|
|
out[i] = (va[i] * vb[i]) >> 8
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint32_high_32bit(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint32_high_8bit() - multiply a vector by a constant, only reserve the higher 8bits, as below
|
|
out[i] = (va[i] * constant) >> 32
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint32_high_32bit(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint32_low_8bit() - multiply function, only reserve the lower 8bits, as below
|
|
out[i] = (va[i] * vb[i]) & 0xffffffff
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint32_low_32bit(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint32_low_8bit() - multiply a vector by a constant, only reserve the lower 8bits, as below
|
|
out[i] = (va[i] * constant) 0xffffffff
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint32_low_32bit(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_uint32() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_uint32(uint32_t *va, uint32_t *vb, uint32_t *vadd, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_uint32_to_uint64() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
no overflow in multiplying, might overflow in add
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_uint32_to_uint64(uint32_t *va, uint32_t *vb, uint64_t *vadd, uint64_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_uint32() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_uint32(uint32_t *va, uint32_t *vb, uint32_t *vsub, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_uint32_to_uint64() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
no overflow in multiplying, might overflow in sub
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_uint32_to_uint64(uint32_t *va, uint32_t *vb, uint64_t *vsub, uint64_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_uint32() - max operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_const_uint32() - max operation pointwise, as below
|
|
out[i] = va[i] > const_max ? va[i] : const_max
|
|
* @param va: input vector in the formula above
|
|
* @param const_max: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_const_uint32(uint32_t *va, uint32_t const_max, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_uint32() - min operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_const_uint32() - min operation pointwise, as below
|
|
out[i] = va[i] > const_min ? va[i] : const_min
|
|
* @param va: input vector in the formula above
|
|
* @param const_min: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_uint32() - comparison operation pointwise, as below
|
|
out[i] = va[i] == vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_const_uint32() - comparison operation pointwise, as below
|
|
out[i] = va[i] == constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_uint32() - comparison operation pointwise, as below
|
|
out[i] = va[i] != vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_const_uint32() - comparison operation pointwise, as below
|
|
out[i] = va[i] != constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_uint32() - comparison operation pointwise, as below
|
|
out[i] = va[i] < vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_const_uint32() - comparison operation pointwise, as below
|
|
out[i] = va[i] < constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_less_than_uint32() - comparison operation pointwise, as below
|
|
out[i] = constant < va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_less_than_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_uint32() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_const_uint32() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_greater_or_equal_uint32() - comparison operation pointwise, as below
|
|
out[i] = constant >= va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_greater_or_equal_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_uint32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_and_const_uint32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] & constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_and_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_uint32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_or_const_uint32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] | constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_or_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_uint32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xor_const_uint32() - bitwise logic operation pointwise, as below
|
|
out[i] = va[i] ^ constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xor_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_uint32() - bitwise logic operation pointwise, as below
|
|
out[i] = (va[i] ^ vb[i])
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_logic_xnor_const_uint32() - bitwise logic operation pointwise, as below
|
|
out[i] = (va[i] ^ constant)
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_logic_xnor_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_uint32() - left shift operation pointwise, as below
|
|
out[i] = va[i] << vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_uint32() - left operation pointwise, as below
|
|
out[i] = va[i] << constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_left_shift_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_left_shift_const_uint32() - left operation pointwise, as below
|
|
out[i] = constant << va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_left_shift_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_right_shift_uint32() - right shift operation pointwise, as below
|
|
out[i] = va[i] >> vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_right_shift_uint32(uint32_t *va, uint32_t *vb, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_right_shift_const_uint32() - right shift operation pointwise, as below
|
|
out[i] = va[i] >> constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_right_shift_const_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_right_shift_uint32() - right shift operation pointwise, as below
|
|
out[i] = constant >> va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_right_shift_uint32(uint32_t *va, uint32_t constant, uint32_t *out, uint32_t len);
|
|
|
|
/* @brief () - get higher 8 bits from a 16-bit vector, as below
|
|
out[i] = in[i] >> 16
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_high_half_bits_uint32(uint32_t *in, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief () - get lower 8 bits from a 16-bit vector, as below
|
|
out[i] = in[i] & 0xffff
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_low_half_bits_uint32(uint32_t *in, uint16_t *out, uint32_t len);
|
|
|
|
/* @brief () - get lower 8 bits and higher 8 bits from a 16-bit vector, as below
|
|
high[i] = in[i] >> 16
|
|
low[i] = in[i] & 0xffff
|
|
* @param in: input vector in the formula above
|
|
* @param high: output vector in the formula above
|
|
* @param low: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_high_and_low_half_bits_uint32(uint32_t *in, uint16_t *high, uint16_t *low, uint32_t len);
|
|
|
|
|
|
/* @brief vector_add_float() - add 2 vectors
|
|
out[i] = va[i] + vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_float(float_t *va, float_t *vb, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_add_const_float() - add a constant to a vector
|
|
out[i] = va[i] + const_add
|
|
* @param va: input vector in the formula above
|
|
* @param const_add: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_add_const_float(float_t *va, float_t const_add, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_float() - subtract function, as below
|
|
out[i] = va[i] - vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_float(float_t *va, float_t *vb, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_float() - subtract a constant from a vector
|
|
out[i] = va[i] - const_sub
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_sub_const_float(float_t *va, float_t const_sub, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_sub_const_float() - subtract a vector from a constant vector
|
|
out[i] = const_sub - va[i]
|
|
* @param va: input vector in the formula above
|
|
* @param const_sub: const in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_sub_float(float_t *va, float_t const_sub, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_float() - multiply function, as below
|
|
out[i] = va[i] * vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_float(float_t *va, float_t *vb, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_float() - multiply a vector by a constant
|
|
out[i] = va[i] * constant
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_float(float_t *va, float_t constant, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_add_float() - add the product of 2 vectors to another vector, as below
|
|
out[i] = (va[i] * vb[i]) + vadd[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vadd: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_add_float(float_t *va, float_t *vb, float_t *vadd, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_mul_sub_float() - subtract the product of 2 vectors from another vector, as below
|
|
out[i] = vsub[i] - (va[i] * vb[i])
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param vsub: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_mul_sub_float(float_t *va, float_t *vb, float_t *vsub, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_float() - max operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_float(float_t *va, float_t *vb, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_max_const_float() - max operation pointwise, as below
|
|
out[i] = va[i] > const_max ? va[i] : const_max
|
|
* @param va: input vector in the formula above
|
|
* @param const_max: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_max_const_float(float_t *va, float_t const_max, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_float() - min operation pointwise, as below
|
|
out[i] = va[i] > vb[i] ? va[i] : vb[i]
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_float(float_t *va, float_t *vb, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_min_const_float() - min operation pointwise, as below
|
|
out[i] = va[i] > const_min ? va[i] : const_min
|
|
* @param va: input vector in the formula above
|
|
* @param const_min: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_min_const_float(float_t *va, float_t constant, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_float() - comparison operation pointwise, as below
|
|
out[i] = va[i] == vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_float(float_t *va, float_t *vb, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_equal_const_float() - comparison operation pointwise, as below
|
|
out[i] = va[i] == constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_equal_const_float(float_t *va, float_t constant, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_float() - comparison operation pointwise, as below
|
|
out[i] = va[i] != vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_float(float_t *va, float_t *vb, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_not_equal_const_float() - comparison operation pointwise, as below
|
|
out[i] = va[i] != constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_not_equal_const_float(float_t *va, float_t constant, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_float() - comparison operation pointwise, as below
|
|
out[i] = va[i] < vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_float(float_t *va, float_t *vb, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_less_than_const_float() - comparison operation pointwise, as below
|
|
out[i] = va[i] < constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_less_than_const_float(float_t *va, float_t constant, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_less_than_float() - comparison operation pointwise, as below
|
|
out[i] = constant < va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_less_than_float(float_t *va, float_t constant, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_float() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= vb[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_float(float_t *va, float_t *vb, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_greater_or_equal_const_float() - comparison operation pointwise, as below
|
|
out[i] = va[i] >= constant ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_greater_or_equal_const_float(float_t *va, float_t constant, float_t *out, uint32_t len);
|
|
|
|
/* @brief vector_const_greater_or_equal_float() - comparison operation pointwise, as below
|
|
out[i] = constant >= va[i] ? 1 : 0
|
|
* @param va: input vector in the formula above
|
|
* @param constant: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_const_greater_or_equal_float(float_t *va, float_t constant, float_t *out, uint32_t len);
|
|
|
|
|
|
/* @brief vector_multiply_int8_right_shift_saturation() - multiply function, as below
|
|
out[i] = (va[i] * vb[i]) >> right_shift
|
|
saturation included, i.e. output elements out of range [-128, 127] will be set to -128 or 127
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int8_right_shift_saturation(int8_t *va, int8_t *vb, int8_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int8_right_shift_saturation() - multiply a vector by a constant
|
|
out[i] = (va[i] * constant) >> right_shift
|
|
saturation included, i.e. output elements out of range [-128, 127] will be set to -128 or 127
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int8_right_shift_saturation(int8_t *va, int8_t constant, int8_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint8_right_shift_saturation() - multiply function, as below
|
|
out[i] = (va[i] * vb[i]) >> right_shift
|
|
saturation included, i.e. output elements out of range [0, 255] will be set to 0 or 255
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint8_right_shift_saturation(uint8_t *va, uint8_t *vb, uint8_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint8_right_shift_saturation() - multiply a vector by a constant
|
|
out[i] = (va[i] * constant) >> right_shift
|
|
saturation included, i.e. output elements out of range [0, 255] will be set to 0 or 255
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint8_right_shift_saturation(uint8_t *va, uint8_t constant, uint8_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int16_right_shift_saturation() - multiply function, as below
|
|
out[i] = (va[i] * vb[i]) >> right_shift
|
|
saturation included, i.e. output elements out of range [-32768, 32767] will be set to -32768 or 32767
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int16_right_shift_saturation(int16_t *va, int16_t *vb, int16_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int16_right_shift_saturation() - multiply a vector by a constant
|
|
out[i] = (va[i] * constant) >> right_shift
|
|
saturation included, i.e. output elements out of range [-32768, 32767] will be set to -32768 or 32767
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int16_right_shift_saturation(int16_t *va, int16_t constant, int16_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint16_right_shift_saturation() - multiply function, as below
|
|
out[i] = (va[i] * vb[i]) >> right_shift
|
|
saturation included, i.e. output elements out of range [0, 65535] will be set to 0 or 65535
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint16_right_shift_saturation(uint16_t *va, uint16_t *vb, uint16_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint16_right_shift_saturation() - multiply a vector by a constant
|
|
out[i] = (va[i] * constant) >> right_shift
|
|
saturation included, i.e. output elements out of range [0, 65535] will be set to 0 or 65535
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint16_right_shift_saturation(uint16_t *va, uint16_t constant, uint16_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_int32_right_shift_saturation() - multiply function, as below
|
|
out[i] = (va[i] * vb[i]) >> right_shift
|
|
saturation included, i.e. output elements out of range [-2147483648, 2147483647] will be set to -2147483648 or 2147483647
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_int32_right_shift_saturation(int32_t *va, int32_t *vb, int32_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_int32_right_shift_saturation() - multiply a vector by a constant
|
|
out[i] = (va[i] * constant) >> right_shift
|
|
saturation included, i.e. output elements out of range [-2147483648, 2147483647] will be set to -2147483648 or 2147483647
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_int32_right_shift_saturation(int32_t *va, int32_t constant, int32_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_uint32_right_shift_saturation() - multiply function, as below
|
|
out[i] = (va[i] * vb[i]) >> right_shift
|
|
saturation included, i.e. output elements out of range [0, 4294967295] will be set to 0 or 4294967295
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_uint32_right_shift_saturation(uint32_t *va, uint32_t *vb, uint32_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
/* @brief vector_multiply_const_uint32_right_shift_saturation() - multiply a vector by a constant
|
|
out[i] = (va[i] * constant) >> right_shift
|
|
saturation included, i.e. output elements out of range [0, 4294967295] will be set to 0 or 4294967295
|
|
* @param va: input vector in the formula above
|
|
* @param constant: constant in the formula
|
|
* @param out: output vector in the formula above
|
|
* @param right_shift: right shift number in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_multiply_const_uint32_right_shift_saturation(uint32_t *va, uint32_t constant, uint32_t *out, uint8_t right_shift, uint32_t len);
|
|
|
|
|
|
/* @brief vector_int8_to_float() - cast a vector of type of int8 to float, as below
|
|
out[i] = ((float)in[i] + center) * scale
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param center: param in the formula above
|
|
* @param scale: param in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_int8_to_float(int8_t *in, float *out, float center, float scale, uint32_t len);
|
|
|
|
/* @brief vector_uint8_to_float() - cast a vector of type of uint8 to float, as below
|
|
out[i] = ((float)in[i] + center) * scale
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param center: param in the formula above
|
|
* @param scale: param in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_uint8_to_float(uint8_t *in, float *out, float center, float scale, uint32_t length);
|
|
|
|
/* @brief vector_int16_to_float() - cast a vector of type of int16 to float, as below
|
|
out[i] = ((float)in[i] + center) * scale
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param center: param in the formula above
|
|
* @param scale: param in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_int16_to_float(int16_t *in, float *out, float center, float scale, uint32_t len);
|
|
|
|
/* @brief vector_uint16_to_float() - cast a vector of type of uint16 to float, as below
|
|
out[i] = ((float)in[i] + center) * scale
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param center: param in the formula above
|
|
* @param scale: param in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_uint16_to_float(uint16_t *in, float *out, float center, float scale, uint32_t length);
|
|
|
|
/* @brief vector_float_to_int8() - cast a vector of type of float to int8, as below
|
|
out[i] = (int8_t)floor(clamp((in[i] - center) * scale, -128.0, 127.0))
|
|
where clamp(x, l, h) = max(min(x, h), l)
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param center: param in the formula above
|
|
* @param scale: param in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_float_to_int8(float *in, int8_t *out, float center, float scale, uint32_t len);
|
|
|
|
/* @brief vector_float_to_uint8() - cast a vector of type of float to int8, as below
|
|
out[i] = (uint8_t)floor(clamp((in[i] - center) * scale, 0.0, 255.0))
|
|
where clamp(x, l, h) = max(min(x, h), l)
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param center: param in the formula above
|
|
* @param scale: param in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_float_to_uint8(float *in, uint8_t *out, float center, float scale, uint32_t len);
|
|
|
|
/* @brief vector_float_to_int16() - cast a vector of type of float to int16, as below
|
|
out[i] = (int16_t)floor(clamp((in[i] - center) * scale, -32768.0, 32767.0))
|
|
where clamp(x, l, h) = max(min(x, h), l)
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param center: param in the formula above
|
|
* @param scale: param in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_float_to_int16(float *in, int16_t *out, float center, float scale, uint32_t len);
|
|
|
|
/* @brief vector_float_to_uint16() - cast a vector of type of float to int8, as below
|
|
out[i] = (uint16_t)floor(clamp((in[i] - center) * scale, 0.0, 65535.0))
|
|
where clamp(x, l, h) = max(min(x, h), l)
|
|
* @param in: input vector in the formula above
|
|
* @param out: output vector in the formula above
|
|
* @param center: param in the formula above
|
|
* @param scale: param in the formula above
|
|
* @param len: length of the vectors
|
|
*/
|
|
void vector_float_to_uint16(float *in, uint16_t *out, float center, float scale, uint32_t len);
|
|
|
|
|
|
/* @brief vector_inner_product_int8() - calculate inner product of 2 vector, as below
|
|
out = sum(va[i] * vb[i]), where sum is done on the index i
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param len: length of the vectors
|
|
* @return: out shown above
|
|
*/
|
|
int32_t vector_inner_product_int8(int8_t *va, int8_t *vb, uint32_t len);
|
|
|
|
/* @brief vector_inner_product_uint8() - calculate inner product of 2 vector, as below
|
|
out = sum(va[i] * vb[i]), where sum is done on the index i
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param len: length of the vectors
|
|
* @return: out shown above
|
|
*/
|
|
uint32_t vector_inner_product_uint8(uint8_t *va, uint8_t *vb, uint32_t len);
|
|
|
|
/* @brief vector_inner_product_int16() - calculate inner product of 2 vector, as below
|
|
out = sum(va[i] * vb[i]), where sum is done on the index i
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param len: length of the vectors
|
|
* @return: out shown above
|
|
*/
|
|
int64_t vector_inner_product_int16(int16_t *va, int16_t *vb, uint32_t len);
|
|
|
|
/* @brief vector_inner_product_int16() - calculate inner product of 2 vector, as below
|
|
out = sum(va[i] * vb[i]), where sum is done on the index i
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param len: length of the vectors
|
|
* @return: out shown above
|
|
*/
|
|
uint64_t vector_inner_product_uint16(uint16_t *va, uint16_t *vb, uint32_t len);
|
|
|
|
/* @brief vector_inner_product_int32() - calculate inner product of 2 vector, as below
|
|
out = sum(va[i] * vb[i]), where sum is done on the index i
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param len: length of the vectors
|
|
* @return: out shown above
|
|
*/
|
|
int32_t vector_inner_product_int32(int32_t *va, int32_t *vb, uint32_t len);
|
|
|
|
/* @brief vector_inner_product_uint32() - calculate inner product of 2 vector, as below
|
|
out = sum(va[i] * vb[i]), where sum is done on the index i
|
|
no saturation, overflow might happen
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param len: length of the vectors
|
|
* @return: out shown above
|
|
*/
|
|
uint32_t vector_inner_product_uint32(uint32_t *va, uint32_t *vb, uint32_t len);
|
|
|
|
/* @brief vector_inner_product_float() - calculate inner product of 2 vector, as below
|
|
out = sum(va[i] * vb[i]), where sum is done on the index i
|
|
* @param va: input vector in the formula above
|
|
* @param vb: input vector in the formula above
|
|
* @param len: length of the vectors
|
|
* @return: out shown above
|
|
*/
|
|
float vector_inner_product_float(float *va, float *vb, uint32_t len);
|
|
|
|
|
|
/* @brief vector_maximum_element_int8() - find the maximum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param max_index: saving the index of maximum element
|
|
* @param max: saving the maximum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_maximum_element_int8(int8_t *v, uint16_t *max_index, int8_t *max, uint16_t length);
|
|
|
|
/* @brief vector_maximum_element_uint8() - find the maximum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param max_index: saving the index of maximum element
|
|
* @param max: saving the maximum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_maximum_element_uint8(uint8_t *v, uint16_t *max_index, uint8_t *max, uint16_t length);
|
|
|
|
/* @brief vector_maximum_element_int16() - find the maximum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param max_index: saving the index of maximum element
|
|
* @param max: saving the maximum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_maximum_element_int16(int16_t *v, uint16_t *max_index, int16_t *max, uint16_t length);
|
|
|
|
/* @brief vector_maximum_element_uint16() - find the maximum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param max_index: saving the index of maximum element
|
|
* @param max: saving the maximum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_maximum_element_uint16(uint16_t *v, uint16_t *max_index, uint16_t *max, uint16_t length);
|
|
|
|
/* @brief vector_maximum_element_int32() - find the maximum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param max_index: saving the index of maximum element
|
|
* @param max: saving the maximum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_maximum_element_int32(int32_t *v, uint32_t *max_index, int32_t *max, uint32_t length);
|
|
|
|
/* @brief vector_maximum_element_uint32() - find the maximum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param max_index: saving the index of maximum element
|
|
* @param max: saving the maximum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_maximum_element_uint32(uint32_t *v, uint32_t *max_index, uint32_t *max, uint32_t length);
|
|
|
|
/* @brief vector_maximum_element_float() - find the maximum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param max_index: saving the index of maximum element
|
|
* @param max: saving the maximum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_maximum_element_float(float *v, uint32_t *max_index, float *max, uint32_t length);
|
|
|
|
/* @brief vector_minimum_element_int8() - find the minimum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param min_index: saving the index of minimum element
|
|
* @param min: saving the minimum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_minimum_element_int8(int8_t *v, uint16_t *min_index, int8_t *min, uint16_t length);
|
|
|
|
/* @brief vector_minimum_element_uint8() - find the minimum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param min_index: saving the index of minimum element
|
|
* @param min: saving the minimum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_minimum_element_uint8(uint8_t *v, uint16_t *min_index, uint8_t *min, uint16_t length);
|
|
|
|
/* @brief vector_minimum_element_int16() - find the minimum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param min_index: saving the index of minimum element
|
|
* @param min: saving the minimum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_minimum_element_int16(int16_t *v, uint16_t *min_index, int16_t *min, uint16_t length);
|
|
|
|
/* @brief vector_minimum_element_uint16() - find the minimum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param min_index: saving the index of minimum element
|
|
* @param min: saving the minimum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_minimum_element_uint16(uint16_t *v, uint16_t *min_index, uint16_t *min, uint16_t length);
|
|
|
|
/* @brief vector_minimum_element_int32() - find the minimum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param min_index: saving the index of minimum element
|
|
* @param min: saving the minimum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_minimum_element_int32(int32_t *v, uint32_t *min_index, int32_t *min, uint32_t length);
|
|
|
|
/* @brief vector_minimum_element_uint32() - find the minimum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param min_index: saving the index of minimum element
|
|
* @param min: saving the minimum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_minimum_element_uint32(uint32_t *v, uint32_t *min_index, uint32_t *min, uint32_t length);
|
|
|
|
/* @brief vector_minimum_element_float() - find the minimum element in a given vector, whose length should be larger than 4
|
|
* @param v: the given vector
|
|
* @param min_index: saving the index of minimum element
|
|
* @param min: saving the minimum value
|
|
* @param length: length of the vector
|
|
*/
|
|
void vector_minimum_element_float(float *v, uint32_t *min_index, float *min, uint32_t length);
|
|
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif |