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  * $Id: complex_vector_float.h,v 1.10 2008/09/18 13:16:49 steveu Exp $
00026  */
00027 
00028 #if !defined(_SPANDSP_COMPLEX_VECTOR_FLOAT_H_)
00029 #define _SPANDSP_COMPLEX_VECTOR_FLOAT_H_
00030 
00031 #if defined(__cplusplus)
00032 extern "C"
00033 {
00034 #endif
00035 
00036 static __inline__ void cvec_copyf(complexf_t z[], const complexf_t x[], int n)
00037 {
00038     int i;
00039     
00040     for (i = 0;  i < n;  i++)
00041         z[i] = x[i];
00042 }
00043 /*- End of function --------------------------------------------------------*/
00044 
00045 static __inline__ void cvec_copy(complex_t z[], const complex_t x[], int n)
00046 {
00047     int i;
00048     
00049     for (i = 0;  i < n;  i++)
00050         z[i] = x[i];
00051 }
00052 /*- End of function --------------------------------------------------------*/
00053 
00054 #if defined(HAVE_LONG_DOUBLE)
00055 static __inline__ void cvec_copyl(complexl_t z[], const complexl_t x[], int n)
00056 {
00057     int i;
00058     
00059     for (i = 0;  i < n;  i++)
00060         z[i] = x[i];
00061 }
00062 /*- End of function --------------------------------------------------------*/
00063 #endif
00064 
00065 static __inline__ void cvec_zerof(complexf_t z[], int n)
00066 {
00067     int i;
00068     
00069     for (i = 0;  i < n;  i++)
00070         z[i] = complex_setf(0.0f, 0.0f);
00071 }
00072 /*- End of function --------------------------------------------------------*/
00073 
00074 static __inline__ void cvec_zero(complex_t z[], int n)
00075 {
00076     int i;
00077     
00078     for (i = 0;  i < n;  i++)
00079         z[i] = complex_set(0.0, 0.0);
00080 }
00081 /*- End of function --------------------------------------------------------*/
00082 
00083 #if defined(HAVE_LONG_DOUBLE)
00084 static __inline__ void cvec_zerol(complexl_t z[], int n)
00085 {
00086     int i;
00087     
00088     for (i = 0;  i < n;  i++)
00089         z[i] = complex_setl(0.0, 0.0);
00090 }
00091 /*- End of function --------------------------------------------------------*/
00092 #endif
00093 
00094 static __inline__ void cvec_setf(complexf_t z[], complexf_t *x, int n)
00095 {
00096     int i;
00097     
00098     for (i = 0;  i < n;  i++)
00099         z[i] = *x;
00100 }
00101 /*- End of function --------------------------------------------------------*/
00102 
00103 static __inline__ void cvec_set(complex_t z[], complex_t *x, int n)
00104 {
00105     int i;
00106     
00107     for (i = 0;  i < n;  i++)
00108         z[i] = *x;
00109 }
00110 /*- End of function --------------------------------------------------------*/
00111 
00112 #if defined(HAVE_LONG_DOUBLE)
00113 static __inline__ void cvec_setl(complexl_t z[], complexl_t *x, int n)
00114 {
00115     int i;
00116     
00117     for (i = 0;  i < n;  i++)
00118         z[i] = *x;
00119 }
00120 /*- End of function --------------------------------------------------------*/
00121 #endif
00122 
00123 /*! \brief Find the dot product of two complex float vectors.
00124     \param x The first vector.
00125     \param y The first vector.
00126     \param n The number of elements in the vectors.
00127     \return The dot product of the two vectors. */
00128 complexf_t cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n);
00129 
00130 /*! \brief Find the dot product of two complex double vectors.
00131     \param x The first vector.
00132     \param y The first vector.
00133     \param n The number of elements in the vectors.
00134     \return The dot product of the two vectors. */
00135 complex_t cvec_dot_prod(const complex_t x[], const complex_t y[], int n);
00136 
00137 #if defined(HAVE_LONG_DOUBLE)
00138 /*! \brief Find the dot product of two complex long double vectors.
00139     \param x The first vector.
00140     \param y The first vector.
00141     \param n The number of elements in the vectors.
00142     \return The dot product of the two vectors. */
00143 complexl_t cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n);
00144 #endif
00145 
00146 /*! \brief Find the dot product of two complex float vectors, where the first is a circular buffer
00147            with an offset for the starting position.
00148     \param x The first vector.
00149     \param y The first vector.
00150     \param n The number of elements in the vectors.
00151     \param pos The starting position in the x vector.
00152     \return The dot product of the two vectors. */
00153 complexf_t cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos);
00154 
00155 void cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error);
00156 
00157 void cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error);
00158 
00159 #if defined(__cplusplus)
00160 }
00161 #endif
00162 
00163 #endif
00164 /*- End of file ------------------------------------------------------------*/

Generated on Tue Oct 7 20:25:45 2008 for spandsp by  doxygen 1.5.6