/[marvin]/marvin/src/libsip/type/contlogsignal.cc
ViewVC logotype

Diff of /marvin/src/libsip/type/contlogsignal.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by hannibal, Tue Aug 12 20:42:33 2003 UTC revision 1.5 by exos, Thu Sep 11 22:45:21 2003 UTC
# Line 40  Line 40 
40  *******************************************************************/  *******************************************************************/
41  #include "contlogsignal.hh"  #include "contlogsignal.hh"
42    
43  ContLogSignal &ContLogSignal::add ( ContLogSignal &src1, ContLogSignal &src2 )  ContLogSignal &ContLogSignal::add ( ContLogSignal &src )
44  {  {
45    int   it;    int   it;
46    int length = maximum((src1.length()), (src2.length()));    int length = maximum((src.length()), (this->length()));
47    double  *data = new double[length + 1];    double  *data = new double[length];
48    ContLogSignal *res = new ContLogSignal(data, length);    ContLogSignal *res = new ContLogSignal(data, length);
49    
50    for (it = 0; it < length; ++it)    for (it = 0; it < length; ++it)
51      (*res)[it] = src1[it] + src2[it];      (*res)[it] = src[it] + (*this)[it];
   (*res)[it] = '\0';  
52    return *res;    return *res;
53  }  }
54    
55  ContLogSignal &ContLogSignal::mult ( ContLogSignal &src1, ContLogSignal &src2 )  ContLogSignal &ContLogSignal::mult ( ContLogSignal &src )
56  {  {
57    int   i,j,k;    int   i,j,k;
58    int length = (src1.length() - 1 ) * (src2.length() - 1);    int length = (this->length() - 1 ) * (src.length() - 1);
59    double  *data = new double[length + 1];    double  *data = new double[length];
60    ContLogSignal *res = new ContLogSignal(data, length);    ContLogSignal *res = new ContLogSignal(data, length);
61    
62    for (i = 0 ; i < length; ++i)    for (i = 0 ; i < length; ++i)
63      for (j = 0, k = i; j < i && k >= 0; ++j, --k)      for (j = 0, k = i; j < i && k >= 0; ++j, --k)
64        if ( !src1[j] )        if ( !(*this)[j] )
65          (*res)[i] += 0;          (*res)[i] += 0;
66        else if ( !src2[k] )        else if ( !src[k] )
67          (*res)[i] += 0;          (*res)[i] += 0;
68        else (*res)[i] += src1[j] * src2[k];        else (*res)[i] += (*this)[j] * src[k];
   (*res)[i] = '\0';  
69    return *res;    return *res;
70  }  }
71    
 ContLogSignal &ContLogSignal::concat ( ContLogSignal &src1, ContLogSignal &src2 )  
 {  
   std::cerr << "We couldn't concatenate two logarithm continus signals" << std::endl;  
   exit (1);  
 }  
   
 ContLogSignal &ContLogSignal::hamming ( ContLogSignal &src )  
 {  
   std::cerr << "We couldn't applicate hamming on a logarithm continu signal" << std::endl;  
   exit(1);  
 }  
   
 ContLogSignal &ContLogSignal::truncate ( ContLogSignal &src, const int begin, const int end )  
 {  
   std::cerr << "We couldn't truncate a logarithm continu signal" << std::endl;  
   exit(1);  
 }  
   
72  int ContLogSignal::min ( ContLogSignal &src )  int ContLogSignal::min ( ContLogSignal &src )
73  {  {
74      std::cerr << "We couldn't search min of a logarithm continu signal" << std::endl;      std::cerr << "We couldn't search min of a logarithm continu signal" << std::endl;

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26