# Boost :

From: nisha kannookadan (nishak44_at_[hidden])
Date: 2007-11-20 14:36:20

Wow, Im very impressed, I already got so much answers. Thanks a lot.
I didnt realize, that there are different lists, sorry.

The Code is quite huge. But I post here, a part, which takes quite a lot of time: These are two methods for wavelet transformations:

matrix Wavelet::ttrans(matrix At, int level)
{
matrix cfe1, cfe2, cfo, cfe, c, d;
int N,s2;

N = (At.size1()+1)/2;
s2 = At.size2();
zero_matrix zer(N,s2);

for (int ii = 1; ii <= level; ii++)
{
cfo.resize(N,s2,false);
cfe.resize(N-1,s2,false);
c.resize(N-1,s2,false);
d.resize(N,s2,false);
cfo.assign(subslice(At, 0,2,N, 0,1,s2));
cfe.assign(subslice(At, 1,2,N-1, 0,1,s2));

c.assign(cfe + (subrange(cfo, 0,N-1, 0,s2)+subrange(cfo, 1,N, 0,s2))*0.5);

zer.resize(N,s2,true);
cfe1.resize(N,s2,false);
cfe2.resize(N,s2,false);
cfe1.assign(zer);
cfe2.assign(zer);

(subrange(cfe1, 0,N-1, 0,s2)).assign(cfe);
(subrange(cfe2, 1,N, 0,s2)).assign(cfe);
d.assign(cfo-(cfe1+cfe2)*0.5);

(subrange(At, 0,N-1, 0,At.size2())).assign(c);
(subrange(At, N-1,2*N-1, 0,At.size2())).assign(d);

N = N/2;
}

cfe1.clear();
cfe2.clear();
cfo.clear();
cfe.clear();
c.clear();
d.clear();

return At;

}

matrix Wavelet::itrans(matrix At,int level)
{
matrix inv_M,tmp;
vector f1,f2;
int N,m;

N = (At.size1()+1)/2;
scalar_vector e(2*N-1,1);
scalar_vector f(2*N-2,0.5);
m = At.size2();

for (int ii=1; ii<=level; ii++)
{

e.resize(2*N-1,true);
f.resize(2*N-2,true);
f1 = f;
f2 = f;
for(int jj = 0; jj < 2*N-3; jj = jj+2)
{
f2(jj) = -0.5;
f1(jj+1) = -0.5;
}

inv_M.resize(2*N-1,2*N-1,false);
inv_M = MVHF::tri_inverse(e,f1,f2);
tmp.resize(2*N-1,m);
tmp.assign(prod(inv_M,subrange(At, 0,2*N-1, 0,m)));

(subrange(At, 0,N-1, 0,At.size2())).assign(subslice(tmp, 1,2,N-1, 0,1,tmp.size2()));
(subrange(At, N-1,2*N-1, 0,At.size2())).assign(subslice(tmp, 0,2,N, 0,1,tmp.size2()));

N = N/2;
}

inv_M.clear();
tmp.clear();
f1.clear();
f2.clear();

return At;
}

I did it like that, bcuz I realized that using 'assign' does it make a bit faster,though a lot of resize is needed. I use Eclipse, so is it possible to adapt the Debugging stuff there? Or does it need to be in a makefile...yeah, I know, I dont know the basic stuff :). I read about the library binding, but I actually dont need things like svd, lu..all I need is prod,solve,element_div and the methods above. So not to freaky things, so I probabaly dont need the bindings, right?

Anyways, I thank you all very much..I never got answers so fast in a forum..I appreciate it.

_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE