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 @return none
47 */
arm_min_no_idx_f64(const float64_t * pSrc,uint32_t blockSize,float64_t * pResult)48 void arm_min_no_idx_f64(
49 const float64_t *pSrc,
50 uint32_t blockSize,
51 float64_t *pResult)
52 {
53 float64_t minValue = F64_MAX;
54 float64_t newVal;
55 uint32_t blkCnt ;
56 #if defined(ARM_MATH_NEON) && defined(__aarch64__)
57 float64x2_t minValueV , newValV ;
58 minValueV = vdupq_n_f64(F64_MAX);
59 blkCnt = blockSize >> 1U;
60 while(blkCnt > 0)
61 {
62 newValV = vld1q_f64(pSrc);
63 minValueV = vminq_f64(minValueV, newValV);
64 pSrc += 2 ;
65 blkCnt--;
66
67 }
68 minValue =vgetq_lane_f64(minValueV, 0);
69 if(minValue > vgetq_lane_f64(minValueV, 1))
70 {
71 minValue = vgetq_lane_f64(minValueV, 1);
72 }
73
74 blkCnt = blockSize & 1 ;
75 #else
76 blkCnt = blockSize;
77 #endif
78
79 while (blkCnt > 0U)
80 {
81 newVal = *pSrc++;
82
83 /* compare for the minimum value */
84 if (minValue > newVal)
85 {
86 /* Update the minimum value and it's index */
87 minValue = newVal;
88 }
89
90 blkCnt --;
91 }
92
93 *pResult = minValue;
94 }
95
96 /**
97 @} end of Min group
98 */
99