Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/complex_vector_float.h @ 4:26cd8f1ef0b1
import spandsp-0.0.6pre17
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Fri, 25 Jun 2010 15:50:58 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:c6c5a16ce2f2 | 4:26cd8f1ef0b1 |
---|---|
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 * $Id: complex_vector_float.h,v 1.13 2009/02/04 13:18:53 steveu Exp $ | |
26 */ | |
27 | |
28 #if !defined(_SPANDSP_COMPLEX_VECTOR_FLOAT_H_) | |
29 #define _SPANDSP_COMPLEX_VECTOR_FLOAT_H_ | |
30 | |
31 #if defined(__cplusplus) | |
32 extern "C" | |
33 { | |
34 #endif | |
35 | |
36 static __inline__ void cvec_copyf(complexf_t z[], const complexf_t x[], int n) | |
37 { | |
38 int i; | |
39 | |
40 for (i = 0; i < n; i++) | |
41 z[i] = x[i]; | |
42 } | |
43 /*- End of function --------------------------------------------------------*/ | |
44 | |
45 static __inline__ void cvec_copy(complex_t z[], const complex_t x[], int n) | |
46 { | |
47 int i; | |
48 | |
49 for (i = 0; i < n; i++) | |
50 z[i] = x[i]; | |
51 } | |
52 /*- End of function --------------------------------------------------------*/ | |
53 | |
54 #if defined(HAVE_LONG_DOUBLE) | |
55 static __inline__ void cvec_copyl(complexl_t z[], const complexl_t x[], int n) | |
56 { | |
57 int i; | |
58 | |
59 for (i = 0; i < n; i++) | |
60 z[i] = x[i]; | |
61 } | |
62 /*- End of function --------------------------------------------------------*/ | |
63 #endif | |
64 | |
65 static __inline__ void cvec_zerof(complexf_t z[], int n) | |
66 { | |
67 int i; | |
68 | |
69 for (i = 0; i < n; i++) | |
70 z[i] = complex_setf(0.0f, 0.0f); | |
71 } | |
72 /*- End of function --------------------------------------------------------*/ | |
73 | |
74 static __inline__ void cvec_zero(complex_t z[], int n) | |
75 { | |
76 int i; | |
77 | |
78 for (i = 0; i < n; i++) | |
79 z[i] = complex_set(0.0, 0.0); | |
80 } | |
81 /*- End of function --------------------------------------------------------*/ | |
82 | |
83 #if defined(HAVE_LONG_DOUBLE) | |
84 static __inline__ void cvec_zerol(complexl_t z[], int n) | |
85 { | |
86 int i; | |
87 | |
88 for (i = 0; i < n; i++) | |
89 z[i] = complex_setl(0.0, 0.0); | |
90 } | |
91 /*- End of function --------------------------------------------------------*/ | |
92 #endif | |
93 | |
94 static __inline__ void cvec_setf(complexf_t z[], complexf_t *x, int n) | |
95 { | |
96 int i; | |
97 | |
98 for (i = 0; i < n; i++) | |
99 z[i] = *x; | |
100 } | |
101 /*- End of function --------------------------------------------------------*/ | |
102 | |
103 static __inline__ void cvec_set(complex_t z[], complex_t *x, int n) | |
104 { | |
105 int i; | |
106 | |
107 for (i = 0; i < n; i++) | |
108 z[i] = *x; | |
109 } | |
110 /*- End of function --------------------------------------------------------*/ | |
111 | |
112 #if defined(HAVE_LONG_DOUBLE) | |
113 static __inline__ void cvec_setl(complexl_t z[], complexl_t *x, int n) | |
114 { | |
115 int i; | |
116 | |
117 for (i = 0; i < n; i++) | |
118 z[i] = *x; | |
119 } | |
120 /*- End of function --------------------------------------------------------*/ | |
121 #endif | |
122 | |
123 SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n); | |
124 | |
125 SPAN_DECLARE(void) cvec_mul(complex_t z[], const complex_t x[], const complex_t y[], int n); | |
126 | |
127 #if defined(HAVE_LONG_DOUBLE) | |
128 SPAN_DECLARE(void) cvec_mull(complexl_t z[], const complexl_t x[], const complexl_t y[], int n); | |
129 #endif | |
130 | |
131 /*! \brief Find the dot product of two complex float vectors. | |
132 \param x The first vector. | |
133 \param y The first vector. | |
134 \param n The number of elements in the vectors. | |
135 \return The dot product of the two vectors. */ | |
136 SPAN_DECLARE(complexf_t) cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n); | |
137 | |
138 /*! \brief Find the dot product of two complex double vectors. | |
139 \param x The first vector. | |
140 \param y The first vector. | |
141 \param n The number of elements in the vectors. | |
142 \return The dot product of the two vectors. */ | |
143 SPAN_DECLARE(complex_t) cvec_dot_prod(const complex_t x[], const complex_t y[], int n); | |
144 | |
145 #if defined(HAVE_LONG_DOUBLE) | |
146 /*! \brief Find the dot product of two complex long double vectors. | |
147 \param x The first vector. | |
148 \param y The first vector. | |
149 \param n The number of elements in the vectors. | |
150 \return The dot product of the two vectors. */ | |
151 SPAN_DECLARE(complexl_t) cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n); | |
152 #endif | |
153 | |
154 /*! \brief Find the dot product of two complex float vectors, where the first is a circular buffer | |
155 with an offset for the starting position. | |
156 \param x The first vector. | |
157 \param y The first vector. | |
158 \param n The number of elements in the vectors. | |
159 \param pos The starting position in the x vector. | |
160 \return The dot product of the two vectors. */ | |
161 SPAN_DECLARE(complexf_t) cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos); | |
162 | |
163 SPAN_DECLARE(void) cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error); | |
164 | |
165 SPAN_DECLARE(void) cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error); | |
166 | |
167 #if defined(__cplusplus) | |
168 } | |
169 #endif | |
170 | |
171 #endif | |
172 /*- End of file ------------------------------------------------------------*/ |