Introduce function srsran_vec_sc_sum_fff

This function adds a float scalar to all elements of a float vector.
master
dvdgrgrtt 3 years ago committed by dvdgrgrtt
parent b44c593162
commit bae6f13c89

@ -162,6 +162,9 @@ SRSRAN_API void srsran_vec_sub_ccc(const cf_t* x, const cf_t* y, cf_t* z, const
SRSRAN_API void srsran_vec_sub_sss(const int16_t* x, const int16_t* y, int16_t* z, const uint32_t len);
SRSRAN_API void srsran_vec_sub_bbb(const int8_t* x, const int8_t* y, int8_t* z, const uint32_t len);
/* sum a scalar to all elements of a vector */
SRSRAN_API void srsran_vec_sc_sum_fff(const float* x, float h, float* z, uint32_t len);
/* scalar product */
SRSRAN_API void srsran_vec_sc_prod_cfc(const cf_t* x, const float h, cf_t* z, const uint32_t len);
SRSRAN_API void srsran_vec_sc_prod_fcc(const float* x, const cf_t h, cf_t* z, const uint32_t len);

@ -39,6 +39,8 @@ SRSRAN_API void srsran_vec_add_fff_simd(const float* x, const float* y, float* z
SRSRAN_API void srsran_vec_sub_fff_simd(const float* x, const float* y, float* z, int len);
SRSRAN_API void srsran_vec_sc_sum_fff_simd(const float* x, float h, float* z, int len);
/* SIMD Vector Scalar Product */
SRSRAN_API void srsran_vec_sc_prod_cfc_simd(const cf_t* x, const float h, cf_t* y, const int len);

@ -53,6 +53,12 @@ void srsran_vec_sub_bbb(const int8_t* x, const int8_t* y, int8_t* z, const uint3
srsran_vec_sub_bbb_simd(x, y, z, len);
}
/* sum a scalar to all elements of a vector */
void srsran_vec_sc_sum_fff(const float* x, float h, float* z, uint32_t len)
{
srsran_vec_sc_sum_fff_simd(x, h, z, len);
}
// Noise estimation in chest_dl, interpolation
void srsran_vec_sub_ccc(const cf_t* x, const cf_t* y, cf_t* z, const uint32_t len)
{

@ -712,6 +712,36 @@ void srsran_vec_sub_fff_simd(const float* x, const float* y, float* z, const int
}
}
void srsran_vec_sc_sum_fff_simd(const float* x, float h, float* z, int len)
{
int i = 0;
#if SRSRAN_SIMD_F_SIZE
const simd_f_t hh = srsran_simd_f_set1(h);
if (SRSRAN_IS_ALIGNED(x) && SRSRAN_IS_ALIGNED(z)) {
for (; i < len - SRSRAN_SIMD_F_SIZE + 1; i += SRSRAN_SIMD_F_SIZE) {
simd_f_t xx = srsran_simd_f_load(&x[i]);
simd_f_t zz = srsran_simd_f_add(xx, hh);
srsran_simd_f_store(&z[i], zz);
}
} else {
for (; i < len - SRSRAN_SIMD_F_SIZE + 1; i += SRSRAN_SIMD_F_SIZE) {
simd_f_t xx = srsran_simd_f_loadu(&x[i]);
simd_f_t zz = srsran_simd_f_add(xx, hh);
srsran_simd_f_storeu(&z[i], zz);
}
}
#endif
for (; i < len; i++) {
z[i] = x[i] + h;
}
}
cf_t srsran_vec_dot_prod_ccc_simd(const cf_t* x, const cf_t* y, const int len)
{
int i = 0;

Loading…
Cancel
Save