1 /* ----------------------------------------------------------------------
2 * Project: CMSIS DSP Library
3 * Title: arm_min_no_idx_f64.c
4 * Description: Maximum value of a floating-point vector without returning the index
5 *
6 * $Date: 10 August 2022
7 * $Revision: V1.10.1
8 *
9 * Target Processor: Cortex-M and Cortex-A cores
10 * -------------------------------------------------------------------- */
11 /*
12 * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
13 *
14 * SPDX-License-Identifier: Apache-2.0
15 *
16 * Licensed under the Apache License, Version 2.0 (the License); you may
17 * not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
19 *
20 * www.apache.org/licenses/LICENSE-2.0
21 *
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
27 */
28
29 #include "dsp/statistics_functions.h"
30
31 /**
32 @ingroup groupStats
33 */
34
35
36 /**
37 @addtogroup Min
38 @{
39 */
40
41 /**
42 @brief Maximum value of a floating-point vector.
43 @param[in] pSrc points to the input vector
44 @param[in] blockSize number of samples in input vector
45 @param[out] pResult minimum value returned here
46 */
arm_min_no_idx_f64(const float64_t * pSrc,uint32_t blockSize,float64_t * pResult)47 ARM_DSP_ATTRIBUTE void arm_min_no_idx_f64(
48 const float64_t *pSrc,
49 uint32_t blockSize,
50 float64_t *pResult)
51 {
52 float64_t minValue = F64_MAX;
53 float64_t newVal;
54 uint32_t blkCnt ;
55 #if defined(ARM_MATH_NEON) && defined(__aarch64__)
56 float64x2_t minValueV , newValV ;
57 minValueV = vdupq_n_f64(F64_MAX);
58 blkCnt = blockSize >> 1U;
59 while(blkCnt > 0)
60 {
61 newValV = vld1q_f64(pSrc);
62 minValueV = vminq_f64(minValueV, newValV);
63 pSrc += 2 ;
64 blkCnt--;
65
66 }
67 minValue =vgetq_lane_f64(minValueV, 0);
68 if(minValue > vgetq_lane_f64(minValueV, 1))
69 {
70 minValue = vgetq_lane_f64(minValueV, 1);
71 }
72
73 blkCnt = blockSize & 1 ;
74 #else
75 blkCnt = blockSize;
76 #endif
77
78 while (blkCnt > 0U)
79 {
80 newVal = *pSrc++;
81
82 /* compare for the minimum value */
83 if (minValue > newVal)
84 {
85 /* Update the minimum value and it's index */
86 minValue = newVal;
87 }
88
89 blkCnt --;
90 }
91
92 *pResult = minValue;
93 }
94
95 /**
96 @} end of Min group
97 */
98