The easiest way to normalize a vector in place is something like
int n = 3;
float v[3] = {1, 2, 3};
cblas_sscal(n, 1.0 / cblas_snrm2(n, v, 1), v, 1);
You need
#include <cblas.h>
or
#include <vblas.h>
(or both). Note that some functions are located in the "matrix" section when they work with vectors.
vDSP, . "-" . , :
vDSP_dotpr(), sqrt() vDSP_vsdiv()vDSP_dotpr(), vrsqrte_f32() vDSP_vsmul() (vrsqrte_f32() NEON GCC, , armv7).vDSP_rmsqv(), sqrt(n) vDSP_vsdiv()
, , , "" vDSP " " ( 4096/8192) "" . 1024 -, 3 - -, , .
vDSP 1024 2 - 3 - . :
vDSP_vdist() , vDSP_vdiv(). vDSP_vdist() 2.vDSP_vsq(), , vDSP_vadd() , , vDSP_vsqrt() vDSP_vrsqrt() vDSP_vmul() vDSP_vdiv(), . vDSP_vsqrt() vDSP_vrsqrt().- , , . , .
, 1024 , .
:
- "2-" "3-", " " .
- n - , L1. ;
32K ( , / 16K), 8192 . , , , , , ; 1024 2048 , , . , ...