spandsp 0.0.6

vector_float.h
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * 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_VECTOR_FLOAT_H_)
27#define _SPANDSP_VECTOR_FLOAT_H_
28
29#if defined(__cplusplus)
30 extern "C"
31{
32#endif
33
34SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n);
35
36SPAN_DECLARE(void) vec_copy(double z[], const double x[], int n);
37
38#if defined(HAVE_LONG_DOUBLE)
39SPAN_DECLARE(void) vec_copyl(long double z[], const long double x[], int n);
40#endif
41
42SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n);
43
44SPAN_DECLARE(void) vec_negate(double z[], const double x[], int n);
45
46#if defined(HAVE_LONG_DOUBLE)
47SPAN_DECLARE(void) vec_negatel(long double z[], const long double x[], int n);
48#endif
49
50SPAN_DECLARE(void) vec_zerof(float z[], int n);
51
52SPAN_DECLARE(void) vec_zero(double z[], int n);
53
54#if defined(HAVE_LONG_DOUBLE)
55SPAN_DECLARE(void) vec_zerol(long double z[], int n);
56#endif
57
58SPAN_DECLARE(void) vec_setf(float z[], float x, int n);
59
60SPAN_DECLARE(void) vec_set(double z[], double x, int n);
61
62#if defined(HAVE_LONG_DOUBLE)
63SPAN_DECLARE(void) vec_setl(long double z[], long double x, int n);
64#endif
65
66SPAN_DECLARE(void) vec_addf(float z[], const float x[], const float y[], int n);
67
68SPAN_DECLARE(void) vec_add(double z[], const double x[], const double y[], int n);
69
70#if defined(HAVE_LONG_DOUBLE)
71SPAN_DECLARE(void) vec_addl(long double z[], const long double x[], const long double y[], int n);
72#endif
73
74SPAN_DECLARE(void) vec_scaledxy_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n);
75
76SPAN_DECLARE(void) vec_scaledxy_add(double z[], const double x[], double x_scale, const double y[], double y_scale, int n);
77
78#if defined(HAVE_LONG_DOUBLE)
79SPAN_DECLARE(void) vec_scaledxy_addl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n);
80#endif
81
82SPAN_DECLARE(void) vec_scaledy_addf(float z[], const float x[], const float y[], float y_scale, int n);
83
84SPAN_DECLARE(void) vec_scaledy_add(double z[], const double x[], const double y[], double y_scale, int n);
85
86#if defined(HAVE_LONG_DOUBLE)
87SPAN_DECLARE(void) vec_scaledy_addl(long double z[], const long double x[], const long double y[], long double y_scale, int n);
88#endif
89
90SPAN_DECLARE(void) vec_subf(float z[], const float x[], const float y[], int n);
91
92SPAN_DECLARE(void) vec_sub(double z[], const double x[], const double y[], int n);
93
94#if defined(HAVE_LONG_DOUBLE)
95SPAN_DECLARE(void) vec_subl(long double z[], const long double x[], const long double y[], int n);
96#endif
97
98SPAN_DECLARE(void) vec_scaledxy_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n);
99
100SPAN_DECLARE(void) vec_scaledxy_sub(double z[], const double x[], double x_scale, const double y[], double y_scale, int n);
101
102#if defined(HAVE_LONG_DOUBLE)
103SPAN_DECLARE(void) vec_scaledxy_subl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n);
104#endif
105
106SPAN_DECLARE(void) vec_scaledx_subf(float z[], const float x[], float x_scale, const float y[], int n);
107
108SPAN_DECLARE(void) vec_scaledx_sub(double z[], const double x[], double x_scale, const double y[], int n);
109
110#if defined(HAVE_LONG_DOUBLE)
111SPAN_DECLARE(void) vec_scaledx_subl(long double z[], const long double x[], long double x_scale, const long double y[], int n);
112#endif
113
114SPAN_DECLARE(void) vec_scaledy_subf(float z[], const float x[], const float y[], float y_scale, int n);
115
116SPAN_DECLARE(void) vec_scaledy_sub(double z[], const double x[], const double y[], double y_scale, int n);
117
118#if defined(HAVE_LONG_DOUBLE)
119SPAN_DECLARE(void) vec_scaledy_subl(long double z[], const long double x[], const long double y[], long double y_scale, int n);
120#endif
121
122SPAN_DECLARE(void) vec_scalar_mulf(float z[], const float x[], float y, int n);
123
124SPAN_DECLARE(void) vec_scalar_mul(double z[], const double x[], double y, int n);
125
126#if defined(HAVE_LONG_DOUBLE)
127SPAN_DECLARE(void) vec_scalar_mull(long double z[], const long double x[], long double y, int n);
128#endif
129
130SPAN_DECLARE(void) vec_scalar_addf(float z[], const float x[], float y, int n);
131
132SPAN_DECLARE(void) vec_scalar_add(double z[], const double x[], double y, int n);
133
134#if defined(HAVE_LONG_DOUBLE)
135SPAN_DECLARE(void) vec_scalar_addl(long double z[], const long double x[], long double y, int n);
136#endif
137
138SPAN_DECLARE(void) vec_scalar_subf(float z[], const float x[], float y, int n);
139
140SPAN_DECLARE(void) vec_scalar_sub(double z[], const double x[], double y, int n);
141
142#if defined(HAVE_LONG_DOUBLE)
143SPAN_DECLARE(void) vec_scalar_subl(long double z[], const long double x[], long double y, int n);
144#endif
145
146SPAN_DECLARE(void) vec_mulf(float z[], const float x[], const float y[], int n);
147
148SPAN_DECLARE(void) vec_mul(double z[], const double x[], const double y[], int n);
149
150#if defined(HAVE_LONG_DOUBLE)
151SPAN_DECLARE(void) vec_mull(long double z[], const long double x[], const long double y[], int n);
152#endif
153
154/*! \brief Find the dot product of two float vectors.
155 \param x The first vector.
156 \param y The first vector.
157 \param n The number of elements in the vectors.
158 \return The dot product of the two vectors. */
159SPAN_DECLARE(float) vec_dot_prodf(const float x[], const float y[], int n);
160
161/*! \brief Find the dot product of two double vectors.
162 \param x The first vector.
163 \param y The first vector.
164 \param n The number of elements in the vectors.
165 \return The dot product of the two vectors. */
166SPAN_DECLARE(double) vec_dot_prod(const double x[], const double y[], int n);
167
168#if defined(HAVE_LONG_DOUBLE)
169/*! \brief Find the dot product of two long double vectors.
170 \param x The first vector.
171 \param y The first vector.
172 \param n The number of elements in the vectors.
173 \return The dot product of the two vectors. */
174SPAN_DECLARE(long double) vec_dot_prodl(const long double x[], const long double y[], int n);
175#endif
176
177/*! \brief Find the dot product of two float vectors, where the first is a circular buffer
178 with an offset for the starting position.
179 \param x The first vector.
180 \param y The first vector.
181 \param n The number of elements in the vectors.
182 \param pos The starting position in the x vector.
183 \return The dot product of the two vectors. */
184SPAN_DECLARE(float) vec_circular_dot_prodf(const float x[], const float y[], int n, int pos);
185
186SPAN_DECLARE(void) vec_lmsf(const float x[], float y[], int n, float error);
187
188SPAN_DECLARE(void) vec_circular_lmsf(const float x[], float y[], int n, int pos, float error);
189
190#if defined(__cplusplus)
191}
192#endif
193
194#endif
195/*- End of file ------------------------------------------------------------*/