spandsp: complex_vector_float.h Source File

spandsp 0.0.6

complex_vector_float.h
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * complex_vector_float.h
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2003 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 2.1,
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#if !defined(_SPANDSP_COMPLEX_VECTOR_FLOAT_H_)
27#define _SPANDSP_COMPLEX_VECTOR_FLOAT_H_
28
29#if defined(__cplusplus)
30extern "C"
31{
32#endif
33
34static __inline__ void cvec_copyf(complexf_t z[], const complexf_t x[], int n)
35{
36 int i;
37
38 for (i = 0; i < n; i++)
39 z[i] = x[i];
40}
41/*- End of function --------------------------------------------------------*/
42
43static __inline__ void cvec_copy(complex_t z[], const complex_t x[], int n)
44{
45 int i;
46
47 for (i = 0; i < n; i++)
48 z[i] = x[i];
49}
50/*- End of function --------------------------------------------------------*/
51
52#if defined(HAVE_LONG_DOUBLE)
53static __inline__ void cvec_copyl(complexl_t z[], const complexl_t x[], int n)
54{
55 int i;
56
57 for (i = 0; i < n; i++)
58 z[i] = x[i];
59}
60/*- End of function --------------------------------------------------------*/
61#endif
62
63static __inline__ void cvec_zerof(complexf_t z[], int n)
64{
65 int i;
66
67 for (i = 0; i < n; i++)
68 z[i] = complex_setf(0.0f, 0.0f);
69}
70/*- End of function --------------------------------------------------------*/
71
72static __inline__ void cvec_zero(complex_t z[], int n)
73{
74 int i;
75
76 for (i = 0; i < n; i++)
77 z[i] = complex_set(0.0, 0.0);
78}
79/*- End of function --------------------------------------------------------*/
80
81#if defined(HAVE_LONG_DOUBLE)
82static __inline__ void cvec_zerol(complexl_t z[], int n)
83{
84 int i;
85
86 for (i = 0; i < n; i++)
87 z[i] = complex_setl(0.0, 0.0);
88}
89/*- End of function --------------------------------------------------------*/
90#endif
91
92static __inline__ void cvec_setf(complexf_t z[], complexf_t *x, int n)
93{
94 int i;
95
96 for (i = 0; i < n; i++)
97 z[i] = *x;
98}
99/*- End of function --------------------------------------------------------*/
100
101static __inline__ void cvec_set(complex_t z[], complex_t *x, int n)
102{
103 int i;
104
105 for (i = 0; i < n; i++)
106 z[i] = *x;
107}
108/*- End of function --------------------------------------------------------*/
109
110#if defined(HAVE_LONG_DOUBLE)
111static __inline__ void cvec_setl(complexl_t z[], complexl_t *x, int n)
112{
113 int i;
114
115 for (i = 0; i < n; i++)
116 z[i] = *x;
117}
118/*- End of function --------------------------------------------------------*/
119#endif
120
121SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n);
122
123SPAN_DECLARE(void) cvec_mul(complex_t z[], const complex_t x[], const complex_t y[], int n);
124
125#if defined(HAVE_LONG_DOUBLE)
126SPAN_DECLARE(void) cvec_mull(complexl_t z[], const complexl_t x[], const complexl_t y[], int n);
127#endif
128
129/*! \brief Find the dot product of two complex float vectors.
130 \param x The first vector.
131 \param y The first vector.
132 \param n The number of elements in the vectors.
133 \return The dot product of the two vectors. */
134SPAN_DECLARE(complexf_t) cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n);
135
136/*! \brief Find the dot product of two complex double vectors.
137 \param x The first vector.
138 \param y The first vector.
139 \param n The number of elements in the vectors.
140 \return The dot product of the two vectors. */
141SPAN_DECLARE(complex_t) cvec_dot_prod(const complex_t x[], const complex_t y[], int n);
142
143#if defined(HAVE_LONG_DOUBLE)
144/*! \brief Find the dot product of two complex long double vectors.
145 \param x The first vector.
146 \param y The first vector.
147 \param n The number of elements in the vectors.
148 \return The dot product of the two vectors. */
149SPAN_DECLARE(complexl_t) cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n);
150#endif
151
152/*! \brief Find the dot product of two complex float vectors, where the first is a circular buffer
153 with an offset for the starting position.
154 \param x The first vector.
155 \param y The first vector.
156 \param n The number of elements in the vectors.
157 \param pos The starting position in the x vector.
158 \return The dot product of the two vectors. */
159SPAN_DECLARE(complexf_t) cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos);
160
161SPAN_DECLARE(void) cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error);
162
163SPAN_DECLARE(void) cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error);
164
165#if defined(__cplusplus)
166}
167#endif
168
169#endif
170/*- End of file ------------------------------------------------------------*/
cvec_dot_prodf
complexf_t cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n)
Find the dot product of two complex float vectors.
Definition complex_vector_float.c:126
cvec_circular_dot_prodf
complexf_t cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos)
Find the dot product of two complex float vectors, where the first is a circular buffer with an offse...
Definition complex_vector_float.c:173
cvec_dot_prod
complex_t cvec_dot_prod(const complex_t x[], const complex_t y[], int n)
Find the dot product of two complex double vectors.
Definition complex_vector_float.c:141
complex_t
Definition complex.h:54
complexf_t
Definition complex.h:43