00001
00002
00003
00004
00005
00006
00007
00008 #ifdef USE_STD
00009 #include <cmath>
00010 using namespace std;
00011 #else
00012 #include <math.h>
00013 #endif
00014
00015 #ifdef STORM_USEF
00016 #include "rtrsmrawavdrs_.h"
00017 #include "drtrsmrawavdrs_.h"
00018 #include "irtrsmrawavdrs_.h"
00019 #include "artrsmrawavdrs1_.h"
00020 #include "dartrsmrawavdrs1_.h"
00021 #include "iartrsmrawavdrs1_.h"
00022 #endif
00023
00024 #include "stormdef.h"
00025 #define INVSQRT2 STORMDEF_MATHCONST_INVSQRT2
00026
00027 void rtrsmrawavdrs(
00028 const int& Msize,
00029 const int& mmax,
00030 const int& mrastep,
00031 const float* mracoef,
00032 const float* mracoefrs,
00033 const int& m,
00034 float& wavdrs
00035 )
00036 {
00037 #ifdef STORM_USEF
00038 rtrsmrawavdrs_(
00039 &Msize,
00040 &mmax,
00041 &mrastep, mracoef, mracoefrs,
00042 &m, &wavdrs
00043 );
00044 #else
00045
00046 wavdrs = mracoefrs[ 2*m +1 ] * pow(INVSQRT2,m);
00047
00048
00049
00050 #endif
00051 }
00052
00053
00054 void rtrsmrawavdrs(
00055 const int& Msize,
00056 const int& mmax,
00057 const int& mrastep,
00058 const double* mracoef,
00059 const double* mracoefrs,
00060 const int& m,
00061 double& wavdrs
00062 )
00063 {
00064 #ifdef STORM_USEF
00065 drtrsmrawavdrs_(
00066 &Msize,
00067 &mmax,
00068 &mrastep, mracoef, mracoefrs,
00069 &m, &wavdrs
00070 );
00071 #else
00072
00073 wavdrs = mracoefrs[ 2*m + 1 ] * pow(INVSQRT2,m);
00074
00075
00076
00077 #endif
00078 }
00079
00080
00081 void rtrsmrawavdrs(
00082 const int& Msize,
00083 const int& mmax,
00084 const int& mrastep,
00085 const int* mracoef,
00086 const int* mracoefrs,
00087 const int& m,
00088 int& wavdrs
00089 )
00090 {
00091 #ifdef STORM_USEF
00092 irtrsmrawavdrs_(
00093 &Msize,
00094 &mmax,
00095 &mrastep, mracoef, mracoefrs,
00096 &m, &wavdrs
00097 );
00098 #else
00099
00100 int tmp = mracoefrs[ 2*m + 1 ];
00101 if (tmp >= 0) {
00102 wavdrs = tmp >> m;
00103 } else {
00104 if ((tmp & 0x00000001) != 0) {
00105 wavdrs = - ( (-tmp) >> m);
00106 } else {
00107 wavdrs = - ( (-tmp) >> m) - 1;
00108 }
00109 }
00110
00111
00112
00113 #endif
00114 }
00115
00116
00117 void rtrsmrawavdrs(
00118 const int& Asize,
00119 const int& Msize,
00120 const int& amax,
00121 const int& mmax,
00122 const int& mrastep,
00123 const float* mracoef,
00124 const float* mracoefrs,
00125 const int& a,
00126 const int& m,
00127 float& wavdrs
00128 )
00129 {
00130 #ifdef STORM_USEF
00131 artrsmrawavdrs1_(
00132 &Asize, &Msize,
00133 &amax, &mmax,
00134 &mrastep, mracoef, mracoefrs,
00135 &a, &m, &wavdrs
00136 );
00137 #else
00138
00139 wavdrs = mracoefrs[ Msize*2*a + 2*m + 1 ] * pow(INVSQRT2,m);
00140
00141
00142
00143 #endif
00144 }
00145
00146
00147 void rtrsmrawavdrs(
00148 const int& Asize,
00149 const int& Msize,
00150 const int& amax,
00151 const int& mmax,
00152 const int& mrastep,
00153 const double* mracoef,
00154 const double* mracoefrs,
00155 const int& a,
00156 const int& m,
00157 double& wavdrs
00158 )
00159 {
00160 #ifdef STORM_USEF
00161 dartrsmrawavdrs1_(
00162 &Asize, &Msize,
00163 &amax, &mmax,
00164 &mrastep, mracoef, mracoefrs,
00165 &a, &m, &wavdrs
00166 );
00167 #else
00168
00169 wavdrs = mracoefrs[ Msize*2*a + 2*m + 1 ] * pow(INVSQRT2,m);
00170
00171
00172
00173 #endif
00174 }
00175
00176
00177 void rtrsmrawavdrs(
00178 const int& Asize,
00179 const int& Msize,
00180 const int& amax,
00181 const int& mmax,
00182 const int& mrastep,
00183 const int* mracoef,
00184 const int* mracoefrs,
00185 const int& a,
00186 const int& m,
00187 int& wavdrs
00188 )
00189 {
00190 #ifdef STORM_USEF
00191 iartrsmrawavdrs1_(
00192 &Asize, &Msize,
00193 &amax, &mmax,
00194 &mrastep, mracoef, mracoefrs,
00195 &a, &m, &wavdrs
00196 );
00197 #else
00198
00199 int tmp = mracoefrs[ Msize*2*a + 2*m + 1 ];
00200 if (tmp >= 0) {
00201 wavdrs = tmp >> m;
00202 } else {
00203 if ((tmp & 0x00000001) != 0) {
00204 wavdrs = - ( (-tmp) >> m);
00205 } else {
00206 wavdrs = - ( (-tmp) >> m) - 1;
00207 }
00208 }
00209
00210
00211
00212 #endif
00213 }
00214