vsip_scalar_f vsip_vcminmgsqval_f(const vsip_cvview_f *a, vsip_scalar_vi *index);
This function finds the minimum magnitude squared value in a complex vector and returns its value while storing its index in the provided output parameter.
The function scans the input complex vector
and finds the element with the smallest magnitude squared
value (real part squared plus imaginary part squared), returning this value and storing its index in the output
parameter.
The magnitude squared is calculated as:

const vsip_cvview_p* a: Input complex vector to search for the minimum magnitude squared value.
vsip_scalar_vi* index: Pointer to an integer that will store the index of the element with the minimum magnitude squared.
Returns the minimum magnitude squared value found in the vector.
vsip_cvview_f *spectrum; vsip_scalar_f min_magnitude_sq; vsip_scalar_vi min_index; vsip_length n = 1024; // Create complex vector for spectrum data spectrum = vsip_cvcreate_f(n, VSIP_MEM_NONE); // Initialize with some complex spectrum data (e.g., FFT results) for (vsip_length i = 0; i < n; i++) { // Simulate a spectrum with mostly small values and one very small value float magnitude = (i == 123) ? 0.001f : 0.1f + 0.9f * (float)rand()/RAND_MAX; float phase = 2 * M_PI * (float)rand()/RAND_MAX; vsip_cscalar_f val = VSIP_CMPLX_F(magnitude * cos(phase), magnitude * sin(phase)); vsip_cvput_f(spectrum, i, val); } // Find the minimum magnitude squared value and its index min_magnitude_sq = vsip_vcminmgsqval_f(spectrum, &min_index); printf("Minimum magnitude squared value: %.6f\n", min_magnitude_sq); printf("Found at index: %ld\n", min_index); printf("Actual magnitude: %.6f\n", sqrt(min_magnitude_sq)); // Clean up vsip_cvalldestroy_f(spectrum);