complex_vector_float.h

00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * complex_vector_float.h
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2003 Steve Underwood
00009  *
00010  * All rights reserved.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 2.1,
00014  * as published by the Free Software Foundation.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  */
00025 
00026 #if !defined(_SPANDSP_COMPLEX_VECTOR_FLOAT_H_)
00027 #define _SPANDSP_COMPLEX_VECTOR_FLOAT_H_
00028 
00029 #if defined(__cplusplus)
00030 extern "C"
00031 {
00032 #endif
00033 
00034 static __inline__ void cvec_copyf(complexf_t z[], const complexf_t x[], int n)
00035 {
00036     int i;
00037     
00038     for (i = 0;  i < n;  i++)
00039         z[i] = x[i];
00040 }
00041 /*- End of function --------------------------------------------------------*/
00042 
00043 static __inline__ void cvec_copy(complex_t z[], const complex_t x[], int n)
00044 {
00045     int i;
00046     
00047     for (i = 0;  i < n;  i++)
00048         z[i] = x[i];
00049 }
00050 /*- End of function --------------------------------------------------------*/
00051 
00052 #if defined(HAVE_LONG_DOUBLE)
00053 static __inline__ void cvec_copyl(complexl_t z[], const complexl_t x[], int n)
00054 {
00055     int i;
00056     
00057     for (i = 0;  i < n;  i++)
00058         z[i] = x[i];
00059 }
00060 /*- End of function --------------------------------------------------------*/
00061 #endif
00062 
00063 static __inline__ void cvec_zerof(complexf_t z[], int n)
00064 {
00065     int i;
00066     
00067     for (i = 0;  i < n;  i++)
00068         z[i] = complex_setf(0.0f, 0.0f);
00069 }
00070 /*- End of function --------------------------------------------------------*/
00071 
00072 static __inline__ void cvec_zero(complex_t z[], int n)
00073 {
00074     int i;
00075     
00076     for (i = 0;  i < n;  i++)
00077         z[i] = complex_set(0.0, 0.0);
00078 }
00079 /*- End of function --------------------------------------------------------*/
00080 
00081 #if defined(HAVE_LONG_DOUBLE)
00082 static __inline__ void cvec_zerol(complexl_t z[], int n)
00083 {
00084     int i;
00085     
00086     for (i = 0;  i < n;  i++)
00087         z[i] = complex_setl(0.0, 0.0);
00088 }
00089 /*- End of function --------------------------------------------------------*/
00090 #endif
00091 
00092 static __inline__ void cvec_setf(complexf_t z[], complexf_t *x, int n)
00093 {
00094     int i;
00095     
00096     for (i = 0;  i < n;  i++)
00097         z[i] = *x;
00098 }
00099 /*- End of function --------------------------------------------------------*/
00100 
00101 static __inline__ void cvec_set(complex_t z[], complex_t *x, int n)
00102 {
00103     int i;
00104     
00105     for (i = 0;  i < n;  i++)
00106         z[i] = *x;
00107 }
00108 /*- End of function --------------------------------------------------------*/
00109 
00110 #if defined(HAVE_LONG_DOUBLE)
00111 static __inline__ void cvec_setl(complexl_t z[], complexl_t *x, int n)
00112 {
00113     int i;
00114     
00115     for (i = 0;  i < n;  i++)
00116         z[i] = *x;
00117 }
00118 /*- End of function --------------------------------------------------------*/
00119 #endif
00120 
00121 SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n);
00122 
00123 SPAN_DECLARE(void) cvec_mul(complex_t z[], const complex_t x[], const complex_t y[], int n);
00124 
00125 #if defined(HAVE_LONG_DOUBLE)
00126 SPAN_DECLARE(void) cvec_mull(complexl_t z[], const complexl_t x[], const complexl_t y[], int n);
00127 #endif
00128 
00129 /*! \brief Find the dot product of two complex float vectors.
00130     \param x The first vector.
00131     \param y The first vector.
00132     \param n The number of elements in the vectors.
00133     \return The dot product of the two vectors. */
00134 SPAN_DECLARE(complexf_t) cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n);
00135 
00136 /*! \brief Find the dot product of two complex double vectors.
00137     \param x The first vector.
00138     \param y The first vector.
00139     \param n The number of elements in the vectors.
00140     \return The dot product of the two vectors. */
00141 SPAN_DECLARE(complex_t) cvec_dot_prod(const complex_t x[], const complex_t y[], int n);
00142 
00143 #if defined(HAVE_LONG_DOUBLE)
00144 /*! \brief Find the dot product of two complex long double vectors.
00145     \param x The first vector.
00146     \param y The first vector.
00147     \param n The number of elements in the vectors.
00148     \return The dot product of the two vectors. */
00149 SPAN_DECLARE(complexl_t) cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n);
00150 #endif
00151 
00152 /*! \brief Find the dot product of two complex float vectors, where the first is a circular buffer
00153            with an offset for the starting position.
00154     \param x The first vector.
00155     \param y The first vector.
00156     \param n The number of elements in the vectors.
00157     \param pos The starting position in the x vector.
00158     \return The dot product of the two vectors. */
00159 SPAN_DECLARE(complexf_t) cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos);
00160 
00161 SPAN_DECLARE(void) cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error);
00162 
00163 SPAN_DECLARE(void) cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error);
00164 
00165 #if defined(__cplusplus)
00166 }
00167 #endif
00168 
00169 #endif
00170 /*- End of file ------------------------------------------------------------*/

Generated on Fri Apr 15 16:14:38 2011 for spandsp by  doxygen 1.4.7