Incorrect Indexing in Rader Algorithm (GNU Octave implementation) - signal-processing

Rader DFT algorithm implemented using GNU Octave (for example, length 11). I used this wikipedia article. The values obtained are correct, but they are incorrectly reindexed. I can not understand where the error is?
upd. Add function for finds the smallest generator of the group.
Fin = [1,2,3,4,5,6,7,8,9,10,11];
nfft = columns(Fin);
snfft = nfft - 1;
function [m one_per] = find_gen(p)
m = 1;
a = factor(p);
if (length(a) > 1)
m = p + 1;
one_per = [];
endif
if (m == 1)
finished = 0;
for cur = 2:p-2
not_yet = 0;
test = cur;
single_per = [1 cur];
for k = 2:p-2
test = test * cur;
test = mod(test,p);
single_per = [single_per test];
if (test == 1)
not_yet = 1;
endif
endfor
if (not_yet == 0)
m = cur;
one_per = single_per;
finished = 1;
break;
endif
endfor
endif
endfunction
q = find_gen(nfft)
p = mod((q^(nfft-2)),nfft)
Tq_idx = [];
Tq = [];
for k = 0 : snfft-1
A = mod(q^k, nfft);
Tq_idx = [A Tq_idx];
Tq = [Fin(A+1) Tq];
endfor
Tq_idx, Tq
Tp_idx = [];
Tp = [];
for k = 0 : snfft-1
A = mod(p^k, nfft);
Tp_idx = [A Tp_idx];
Tp = [Fin(A+1) Tp];
endfor
Tp_idx, Tp
Twp = [];
for k = 1 : snfft
ecpx = complex(cos(-2*pi*Tp_idx(k) / nfft),sin(-2*pi*Tp_idx(k) / nfft));
Twp = [Twp ecpx];
endfor
Tq_fft = fft(Tq);
Twp_fft = fft(Twp);
Tm_fft = Tq_fft .* Twp_fft;
Tm_ffti = ifft(Tm_fft);
Tm_ffti
Res = [Fin(1)];
for k = 1 : snfft
Res(1) += Fin(k+1);
Res = [Res (Tm_ffti(Tp_idx(k)) + Fin(1))];
endfor
Res
Fbest = fft(Fin)
Fdiff = Fbest .- Res
ResI = ifft(Res)
Result
Res =
Columns 1 through 3:
66.0000 + 0.0000i -5.5000 - 4.7658i -5.5000 - 18.7313i
Columns 4 through 6:
-5.5000 - 0.7908i -5.5000 - 8.5582i -5.5000 + 8.5582i
Columns 7 through 9:
-5.5000 + 18.7313i -5.5000 + 4.7658i -5.5000 + 0.7908i
Columns 10 and 11:
-5.5000 - 2.5118i -5.5000 + 2.5118i
Using the GNU Octave fft () internal function as standard
Fbest =
Columns 1 through 3:
66.0000 + 0.0000i -5.5000 + 18.7313i -5.5000 + 8.5582i
Columns 4 through 6:
-5.5000 + 4.7658i -5.5000 + 2.5118i -5.5000 + 0.7908i
Columns 7 through 9:
-5.5000 - 0.7908i -5.5000 - 2.5118i -5.5000 - 4.7658i
Columns 10 and 11:
-5.5000 - 8.5582i -5.5000 - 18.7313i

I fixed the error. Working code here
function [m one_per] = find_gen(p)
m = 1;
a = factor(p);
if (length(a) > 1)
m = p + 1;
one_per = [];
endif
if (m == 1)
finished = 0;
for cur = 2:p-2
not_yet = 0;
test = cur;
single_per = [1 cur];
for k = 2:p-2
test = test * cur;
test = mod(test,p);
single_per = [single_per test];
if (test == 1)
not_yet = 1;
endif
endfor
if (not_yet == 0)
m = cur;
one_per = single_per;
finished = 1;
break;
endif
endfor
endif
endfunction
function [Fout] = fast_conv (F1,F2, seq_lenght)
F1_fft = fft(F1);
F2_fft = fft(F2);
Fm_fft = F1_fft .* F2_fft;
Fout = ifft(Fm_fft);
endfunction
function [Res] = rader_algo (Fin)
nfft = columns(Fin);
snfft = nfft - 1;
q = find_gen(nfft)
p = mod((q^(nfft-2)),nfft)
Tq_idx = []; Tq = [];
for k = 0 : snfft-1
A = mod(q^k, nfft);
Tq_idx = [Tq_idx A];
Tq = [Tq Fin(A+1)];
endfor
Tq_idx, Tq
Tp_idx = []; Tp = [];
for k = 0 : snfft-1
A = mod(p^k, nfft);
Tp_idx = [Tp_idx A];
Tp = [Tp Fin(A+1)];
endfor
Tp_idx, Tp
Twp = [];
for k = 1 : snfft
ecpx = complex(cos(-2*pi*Tp_idx(k) / nfft),sin(-2*pi*Tp_idx(k) / nfft));
Twp = [Twp ecpx];
endfor
Twp
Tm_ffti = fast_conv(Tq, Twp, nfft);
Res = zeros(1, nfft);
Res(1) = Fin(1);
for k = 1 : snfft
Res(1) += Fin(k+1);
Res(Tp_idx(k)+1) = Tm_ffti(k) + Fin(1);
endfor
endfunction
Fin = [1,2,3,4,5];
Res = rader_algo (Fin)
% === VERIFY ===
Fbest = fft(Fin)
Fdiff = Fbest .- Res
ResI = ifft(Res)

Related

Please somebody help i can't deobfuscate this script [duplicate]

This question already has an answer here:
How do I de-obfuscate a Lua script?
(1 answer)
Closed 7 months ago.
How can I deobfuscate this code?
return(function(i,a,n)local k=string.char;local e=string.sub;local l=table.concat;local m=math.ldexp;local r=getfenv or function()return _ENV end;local o=select;local g=unpack or table.unpack;local j=tonumber;local function p(h)local b,c,d="","",{}local g=256;local f={}for a=0,g-1 do f[a]=k(a)end;local a=1;local function i()local b=j(e(h,a,a),36)a=a+1;local c=j(e(h,a,a+b-1),36)a=a+b;return c end;b=k(i())d[1]=b;while a<#h do local a=i()if f[a]then c=f[a]else c=b..e(b,1,1)end;f[g]=b..e(c,1,1)d[#d+1],b,g=c,c,g+1 end;return table.concat(d)end local a=(bit or bit32);local d=a and a.bxor or function(a,c)local b,d,e=1,0,10 while a>0 and c>0 do local e,f=a%2,c%2 if e~=f then d=d+b end a,c,b=(a-e)/2,(c-f)/2,b*2 end if a<c then a=c end while a>0 do local c=a%2 if c>0 then d=d+b end a,b=(a-c)/2,b*2 end return d end local function c(c,a,b)if b then local a=(c/2^(a-1))%2^((b-1)-(a-1)+1);return a-a%1;else local a=2^(a-1);return(c%(a+a)>=a)and 1 or 0;end;end;local a=1;local function b()local c,e,f,b=i(j,a,a+3);c=d(c,219)e=d(e,219)f=d(f,219)b=d(b,219)a=a+4;return(b*16777216)+(f*65536)+(e*256)+c;end;local function h()local b=d(i(j,a,a),219);a=a+1;return b;end;local function f()local c,b=i(j,a,a+2);c=d(c,219)b=d(b,219)a=a+2;return(b*256)+c;end;local function p()local d=b();local a=b();local e=1;local d=(c(a,1,20)*(2^32))+d;local b=c(a,21,31);local a=((-1)^c(a,32));if(b==0)then if(d==0)then return a*0;else b=1;e=0;end;elseif(b==2047)then return(d==0)and(a*(1/0))or(a*(0/0));end;return m(a,b-1023)*(e+(d/(2^52)));end;local m=b;local function q(b)local c;if(not b)then b=m();if(b==0)then return'';end;end;c=e(j,a,a+b-1);a=a+b;local b={}for a=1,#c do b[a]=k(d(i(e(c,a,a)),219))end return l(b);end;local a=b;local function m(...)return{...},o('#',...)end local function k()local j={};local i={};local a={};local l={[#{"1 + 1 = 111";{397;924;79;408};}]=i,[#{{872;304;136;960};"1 + 1 = 111";{552;749;880;501};}]=nil,[#{"1 + 1 = 111";{355;485;5;987};{433;30;991;664};"1 + 1 = 111";}]=a,[#{{614;792;330;18};}]=j,};local a=b()local d={}for c=1,a do local b=h();local a;if(b==3)then a=(h()~=0);elseif(b==1)then a=p();elseif(b==2)then a=q();end;d[c]=a;end;for i=1,b()do local a=h();if(c(a,1,1)==0)then local e=c(a,2,3);local g=c(a,4,6);local a={f(),f(),nil,nil};if(e==0)then a[3]=f();a[4]=f();elseif(e==1)then a[3]=b();elseif(e==2)then a[3]=b()-(2^16)elseif(e==3)then a[3]=b()-(2^16)a[4]=f();end;if(c(g,1,1)==1)then a[2]=d[a[2]]end if(c(g,2,2)==1)then a[3]=d[a[3]]end if(c(g,3,3)==1)then a[4]=d[a[4]]end j[i]=a;end end;l[3]=h();for a=1,b()do i[a-1]=k();end;return l;end;local function j(a,i,f)a=(a==true and k())or a;return(function(...)local e=a[1];local d=a[3];local l=a[2];local m=m local c=1;local h=-1;local q={};local p={...};local o=o('#',...)-1;local k={};local b={};for a=0,o do if(a>=d)then q[a-d]=p[a+1];else b[a]=p[a+#{"1 + 1 = 111";}];end;end;local a=o-d+1 local a;local d;while true do a=e[c];d=a[1];if d<=28 then if d<=13 then if d<=6 then if d<=2 then if d<=0 then b[a[2]]=i[a[3]];elseif d>1 then b[a[2]]=(a[3]~=0);else local g;local d;f[a[3]]=b[a[2]];c=c+1;a=e[c];b[a[2]]=f[a[3]];c=c+1;a=e[c];b[a[2]]();c=c+1;a=e[c];b[a[2]]=f[a[3]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];d=a[2];g=b[a[3]];b[d+1]=g;b[d]=g[a[4]];end;elseif d<=4 then if d==3 then b[a[2]]=f[a[3]];else local f;local d;b[a[2]]=(a[3]~=0);c=c+1;a=e[c];d=a[2]b[d]=b[d](g(b,d+1,a[3]))c=c+1;a=e[c];d=a[2];f=b[a[3]];b[d+1]=f;b[d]=f[a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]];c=c+1;a=e[c];b[a[2]]=a[3];c=c+1;a=e[c];d=a[2]b[d]=b[d](g(b,d+1,a[3]))c=c+1;a=e[c];d=a[2];f=b[a[3]];b[d+1]=f;b[d]=f[a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]];c=c+1;a=e[c];b[a[2]]=a[3];end;elseif d==5 then local f;local d;b[a[2]][a[3]]=a[4];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]][a[3]]=b[a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];d=a[2];f=b[a[3]];b[d+1]=f;b[d]=f[a[4]];else b[a[2]]=a[3];end;elseif d<=9 then if d<=7 then if(b[a[2]]==a[4])then c=c+1;else c=a[3];end;elseif d==8 then b[a[2]]();else b[a[2]][a[3]]=b[a[4]];end;elseif d<=11 then if d>10 then i[a[3]]=b[a[2]];else local a=a[2]b[a]=b[a](g(b,a+1,h))end;elseif d>12 then local f;local d;d=a[2]b[d]=b[d](g(b,d+1,a[3]))c=c+1;a=e[c];d=a[2];f=b[a[3]];b[d+1]=f;b[d]=f[a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]];c=c+1;a=e[c];b[a[2]]=a[3];c=c+1;a=e[c];b[a[2]]=(a[3]~=0);else if(b[a[2]]~=a[4])then c=c+1;else c=a[3];end;end;elseif d<=20 then if d<=16 then if d<=14 then local f;local d;d=a[2]b[d]=b[d](g(b,d+1,a[3]))c=c+1;a=e[c];d=a[2];f=b[a[3]];b[d+1]=f;b[d]=f[a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]];c=c+1;a=e[c];b[a[2]]=a[3];c=c+1;a=e[c];d=a[2]b[d]=b[d](g(b,d+1,a[3]))elseif d==15 then f[a[3]]=b[a[2]];else f[a[3]]=b[a[2]];end;elseif d<=18 then if d>17 then local a=a[2]b[a]=b[a]()else i[a[3]]=b[a[2]];end;elseif d>19 then local c=a[2]b[c]=b[c](g(b,c+1,a[3]))else local h=l[a[3]];local g;local d={};g=n({},{__index=function(b,a)local a=d[a];return a[1][a[2]];end,__newindex=function(c,a,b)local a=d[a]a[1][a[2]]=b;end;});for f=1,a[4]do c=c+1;local a=e[c];if a[1]==27 then d[f-1]={b,a[3]};else d[f-1]={i,a[3]};end;k[#k+1]=d;end;b[a[2]]=j(h,g,f);end;elseif d<=24 then if d<=22 then if d==21 then local c=a[2]local d,a=m(b[c](g(b,c+1,a[3])))h=a+c-1 local a=0;for c=c,h do a=a+1;b[c]=d[a];end;else local c=a[2]local d,a=m(b[c](g(b,c+1,a[3])))h=a+c-1 local a=0;for c=c,h do a=a+1;b[c]=d[a];end;end;elseif d==23 then local c=a[2];local d=b[a[3]];b[c+1]=d;b[c]=d[a[4]];else b[a[2]]=a[3];end;elseif d<=26 then if d==25 then b[a[2]]=b[a[3]][a[4]];else c=a[3];end;elseif d>27 then if(b[a[2]]==a[4])then c=c+1;else c=a[3];end;else b[a[2]]=b[a[3]];end;elseif d<=43 then if d<=35 then if d<=31 then if d<=29 then local j;local l,k;local i;local d;b[a[2]]=f[a[3]];c=c+1;a=e[c];b[a[2]]=f[a[3]];c=c+1;a=e[c];d=a[2];i=b[a[3]];b[d+1]=i;b[d]=i[a[4]];c=c+1;a=e[c];b[a[2]]=a[3];c=c+1;a=e[c];b[a[2]]=(a[3]~=0);c=c+1;a=e[c];d=a[2]l,k=m(b[d](g(b,d+1,a[3])))h=k+d-1 j=0;for a=d,h do j=j+1;b[a]=l[j];end;c=c+1;a=e[c];d=a[2]b[d]=b[d](g(b,d+1,h))c=c+1;a=e[c];d=a[2]b[d]=b[d]()c=c+1;a=e[c];b[a[2]]=(a[3]~=0);c=c+1;a=e[c];d=a[2];i=b[a[3]];b[d+1]=i;b[d]=i[a[4]];elseif d==30 then b[a[2]][a[3]]=a[4];else local c=a[2];local d=b[a[3]];b[c+1]=d;b[c]=d[a[4]];end;elseif d<=33 then if d>32 then c=a[3];else b[a[2]][a[3]]=b[a[4]];end;elseif d>34 then b[a[2]]=f[a[3]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]][a[3]]=a[4];c=c+1;a=e[c];do return end;else local c=a[2]b[c]=b[c](g(b,c+1,a[3]))end;elseif d<=39 then if d<=37 then if d>36 then local h=l[a[3]];local g;local d={};g=n({},{__index=function(b,a)local a=d[a];return a[1][a[2]];end,__newindex=function(c,a,b)local a=d[a]a[1][a[2]]=b;end;});for f=1,a[4]do c=c+1;local a=e[c];if a[1]==27 then d[f-1]={b,a[3]};else d[f-1]={i,a[3]};end;k[#k+1]=d;end;b[a[2]]=j(h,g,f);else b[a[2]]=b[a[3]];end;elseif d==38 then do return end;else local a=a[2]b[a]=b[a]()end;elseif d<=41 then if d==40 then local c=a[2]b[c](g(b,c+1,a[3]))else local c=a[2]local e={b[c](b[c+1])};local d=0;for a=c,a[4]do d=d+1;b[a]=e[d];end end;elseif d>42 then b[a[2]]=f[a[3]];else b[a[2]]=f[a[3]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]]=b[a[3]][a[4]];c=c+1;a=e[c];b[a[2]][a[3]]=a[4];c=c+1;a=e[c];do return end;end;elseif d<=50 then if d<=46 then if d<=44 then local a=a[2]b[a](b[a+1])elseif d==45 then b[a[2]][a[3]]=a[4];else b[a[2]]=j(l[a[3]],nil,f);end;elseif d<=48 then if d==47 then local a=a[2]b[a](b[a+1])else do return end;end;elseif d>49 then b[a[2]]=j(l[a[3]],nil,f);else local a=a[2]b[a]=b[a](g(b,a+1,h))end;elseif d<=54 then if d<=52 then if d==51 then b[a[2]]=(a[3]~=0);else if(b[a[2]]~=a[4])then c=c+1;else c=a[3];end;end;elseif d==53 then local c=a[2]b[c](g(b,c+1,a[3]))else b[a[2]]=i[a[3]];end;elseif d<=56 then if d>55 then b[a[2]]=b[a[3]][a[4]];else local d;d=a[2]b[d](b[d+1])c=c+1;a=e[c];b[a[2]]=f[a[3]];c=c+1;a=e[c];b[a[2]]=a[3];c=c+1;a=e[c];d=a[2]b[d](b[d+1])c=c+1;a=e[c];b[a[2]]=(a[3]~=0);c=c+1;a=e[c];i[a[3]]=b[a[2]];end;elseif d>57 then local d=a[2]local e={b[d](b[d+1])};local c=0;for a=d,a[4]do c=c+1;b[a]=e[c];end else b[a[2]]();end;c=c+1;end;end);end;return j(true,{},r())();end)(string.byte,table.insert,setmetatable);
You can use online tools like https://beautifier.io for those things.
I remarked though that the long line is obstructing the website and it's a bit hard to find the buttons.
So I add what I got from the site, actually you shouldn't trust that code but create your own version.
Furthermore you should find the original not-minified script, because that includes likely variable names that are more useful than a,b,c. ... and also comments perhaps that help to understand or use the script.
To find the original script you could search for this in the searchengine of your choice (it's in the last line):
(string.byte, table.insert, setmetatable)
About this or resembling scripts people got already suspicious:
Here the whole script:
return (function(i, a, n) local k = string.char; local e = string.sub; local l = table.concat; local m = math.ldexp; local r = getfenv or
function() return _ENV end; local o = select; local g = unpack or table.unpack; local j = tonumber; local
function p(h) local b, c, d = "", "", {}
local g = 256; local f = {}
for a = 0, g - 1 do f[a] = k(a) end;
local a = 1; local
function i() local b = j(e(h, a, a), 36) a = a + 1; local c = j(e(h, a, a + b - 1), 36) a = a + b;
return c end; b = k(i()) d[1] = b;
while a < #h do local a = i() if f[a]
then c = f[a]
else c = b..e(b, 1, 1) end; f[g] = b..e(c, 1, 1) d[#d + 1], b, g = c, c, g + 1 end;
return table.concat(d) end local a = (bit or bit32); local d = a and a.bxor or
function(a, c) local b, d, e = 1, 0, 10
while a > 0 and c > 0 do local e, f = a % 2, c % 2
if
e~ = f then d = d + b end a, c, b = (a - e) / 2, (c - f) / 2, b * 2 end
if a < c then a = c end
while a > 0 do local c = a % 2
if
c > 0 then d = d + b end a, b = (a - c) / 2, b * 2 end
return d end local
function c(c, a, b) if b then local a = (c / 2 ^ (a - 1)) % 2 ^ ((b - 1) - (a - 1) + 1);
return a - a % 1;
else local a = 2 ^ (a - 1);
return (c % (a + a) >= a) and 1 or 0; end; end; local a = 1; local
function b() local c, e, f, b = i(j, a, a + 3); c = d(c, 219) e = d(e, 219) f = d(f, 219) b = d(b, 219) a = a + 4;
return (b * 16777216) + (f * 65536) + (e * 256) + c; end; local
function h() local b = d(i(j, a, a), 219); a = a + 1;
return b; end; local
function f() local c, b = i(j, a, a + 2); c = d(c, 219) b = d(b, 219) a = a + 2;
return (b * 256) + c; end; local
function p() local d = b(); local a = b(); local e = 1; local d = (c(a, 1, 20) * (2 ^ 32)) + d; local b = c(a, 21, 31); local a = ((-1) ^ c(a, 32));
if (b == 0) then
if (d == 0) then
return a * 0;
else b = 1; e = 0; end; elseif(b == 2047) then
return (d == 0) and(a * (1 / 0)) or(a * (0 / 0)); end;
return m(a, b - 1023) * (e + (d / (2 ^ 52))); end; local m = b; local
function q(b) local c;
if (not b) then b = m();
if (b == 0) then
return ''; end; end; c = e(j, a, a + b - 1); a = a + b; local b = {}
for a = 1, #c do b[a] = k(d(i(e(c, a, a)), 219)) end
return l(b);
end; local a = b; local
function m(...) return {
...
}, o('#', ...) end local
function k() local j = {}; local i = {}; local a = {}; local l = {
[# {
"1 + 1 = 111"; {
397;
924;
79;
408
};
}] = i,
[# {
{
872;
304;
136;
960
};
"1 + 1 = 111"; {
552;
749;
880;
501
};
}] = nil,
[# {
"1 + 1 = 111"; {
355;
485;
5;
987
}; {
433;
30;
991;
664
};
"1 + 1 = 111";
}] = a,
[# {
{
614;
792;
330;
18
};
}] = j,
}; local a = b() local d = {}
for c = 1, a do local b = h();
local a;
if (b == 3) then a = (h() ~ = 0); elseif(b == 1) then a = p(); elseif(b == 2) then a = q(); end; d[c] = a; end;
for i = 1, b() do local a = h();
if (c(a, 1, 1) == 0) then local e = c(a, 2, 3); local g = c(a, 4, 6); local a = {
f(),
f(),
nil,
nil
};
if (e == 0) then a[3] = f(); a[4] = f(); elseif(e == 1) then a[3] = b(); elseif(e == 2) then a[3] = b() - (2 ^ 16) elseif(e == 3) then a[3] = b() - (2 ^ 16) a[4] = f(); end;
if (c(g, 1, 1) == 1) then a[2] = d[a[2]] end
if (c(g, 2, 2) == 1) then a[3] = d[a[3]] end
if (c(g, 3, 3) == 1) then a[4] = d[a[4]] end j[i] = a; end end; l[3] = h();
for a = 1, b() do i[a - 1] = k();
end;
return l; end; local
function j(a, i, f) a = (a == true and k()) or a;
return (function(...) local e = a[1]; local d = a[3]; local l = a[2]; local m = m local c = 1; local h = -1; local q = {}; local p = {
...
}; local o = o('#', ...) - 1; local k = {}; local b = {};
for a = 0, o do
if (a >= d) then q[a - d] = p[a + 1];
else b[a] = p[a + # {
"1 + 1 = 111";
}];
end; end; local a = o - d + 1 local a; local d;
while true do a = e[c];
d = a[1];
if d <= 28 then
if d <= 13 then
if d <= 6 then
if d <= 2 then
if d <= 0 then b[a[2]] = i[a[3]]; elseif d > 1 then b[a[2]] = (a[3] ~ = 0);
else local g; local d; f[a[3]] = b[a[2]]; c = c + 1; a = e[c]; b[a[2]] = f[a[3]]; c = c + 1; a = e[c]; b[a[2]](); c = c + 1; a = e[c]; b[a[2]] = f[a[3]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; d = a[2]; g = b[a[3]]; b[d + 1] = g; b[d] = g[a[4]]; end; elseif d <= 4 then
if d == 3 then b[a[2]] = f[a[3]];
else local f; local d; b[a[2]] = (a[3] ~ = 0); c = c + 1; a = e[c]; d = a[2] b[d] = b[d](g(b, d + 1, a[3])) c = c + 1; a = e[c]; d = a[2]; f = b[a[3]]; b[d + 1] = f; b[d] = f[a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]]; c = c + 1; a = e[c]; b[a[2]] = a[3]; c = c + 1; a = e[c]; d = a[2] b[d] = b[d](g(b, d + 1, a[3])) c = c + 1; a = e[c]; d = a[2]; f = b[a[3]]; b[d + 1] = f; b[d] = f[a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]]; c = c + 1; a = e[c]; b[a[2]] = a[3]; end; elseif d == 5 then local f; local d; b[a[2]][a[3]] = a[4]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]][a[3]] = b[a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; d = a[2]; f = b[a[3]]; b[d + 1] = f; b[d] = f[a[4]];
else b[a[2]] = a[3]; end; elseif d <= 9 then
if d <= 7 then
if (b[a[2]] == a[4]) then c = c + 1;
else c = a[3]; end; elseif d == 8 then b[a[2]]();
else b[a[2]][a[3]] = b[a[4]]; end; elseif d <= 11 then
if d > 10 then i[a[3]] = b[a[2]];
else local a = a[2] b[a] = b[a](g(b, a + 1, h)) end; elseif d > 12 then local f; local d; d = a[2] b[d] = b[d](g(b, d + 1, a[3])) c = c + 1; a = e[c]; d = a[2]; f = b[a[3]]; b[d + 1] = f; b[d] = f[a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]]; c = c + 1; a = e[c]; b[a[2]] = a[3]; c = c + 1; a = e[c]; b[a[2]] = (a[3] ~ = 0);
else if (b[a[2]] ~ = a[4]) then c = c + 1;
else c = a[3]; end; end; elseif d <= 20 then
if d <= 16 then
if d <= 14 then local f; local d; d = a[2] b[d] = b[d](g(b, d + 1, a[3])) c = c + 1; a = e[c]; d = a[2]; f = b[a[3]]; b[d + 1] = f; b[d] = f[a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]]; c = c + 1; a = e[c]; b[a[2]] = a[3]; c = c + 1; a = e[c]; d = a[2] b[d] = b[d](g(b, d + 1, a[3])) elseif d == 15 then f[a[3]] = b[a[2]];
else f[a[3]] = b[a[2]]; end; elseif d <= 18 then
if d > 17 then local a = a[2] b[a] = b[a]()
else i[a[3]] = b[a[2]]; end; elseif d > 19 then local c = a[2] b[c] = b[c](g(b, c + 1, a[3]))
else local h = l[a[3]]; local g; local d = {}; g = n({}, {
__index = function(b, a) local a = d[a];
return a[1][a[2]];end,
__newindex = function(c, a, b) local a = d[a] a[1][a[2]] = b;end;
});
for f = 1, a[4] do c = c + 1;
local a = e[c];
if a[1] == 27 then d[f - 1] = {
b,
a[3]
};
else d[f - 1] = {
i,
a[3]
}; end; k[#k + 1] = d; end; b[a[2]] = j(h, g, f); end; elseif d <= 24 then
if d <= 22 then
if d == 21 then local c = a[2] local d, a = m(b[c](g(b, c + 1, a[3]))) h = a + c - 1 local a = 0;
for c = c, h do a = a + 1;
b[c] = d[a]; end;
else local c = a[2] local d, a = m(b[c](g(b, c + 1, a[3]))) h = a + c - 1 local a = 0;
for c = c, h do a = a + 1;
b[c] = d[a]; end; end; elseif d == 23 then local c = a[2]; local d = b[a[3]]; b[c + 1] = d; b[c] = d[a[4]];
else b[a[2]] = a[3]; end; elseif d <= 26 then
if d == 25 then b[a[2]] = b[a[3]][a[4]];
else c = a[3]; end; elseif d > 27 then
if (b[a[2]] == a[4]) then c = c + 1;
else c = a[3]; end;
else b[a[2]] = b[a[3]]; end; elseif d <= 43 then
if d <= 35 then
if d <= 31 then
if d <= 29 then local j; local l, k; local i; local d; b[a[2]] = f[a[3]]; c = c + 1; a = e[c]; b[a[2]] = f[a[3]]; c = c + 1; a = e[c]; d = a[2]; i = b[a[3]]; b[d + 1] = i; b[d] = i[a[4]]; c = c + 1; a = e[c]; b[a[2]] = a[3]; c = c + 1; a = e[c]; b[a[2]] = (a[3] ~ = 0); c = c + 1; a = e[c]; d = a[2] l, k = m(b[d](g(b, d + 1, a[3]))) h = k + d - 1 j = 0;
for a = d, h do j = j + 1;
b[a] = l[j]; end; c = c + 1; a = e[c]; d = a[2] b[d] = b[d](g(b, d + 1, h)) c = c + 1; a = e[c]; d = a[2] b[d] = b[d]() c = c + 1; a = e[c]; b[a[2]] = (a[3] ~ = 0); c = c + 1; a = e[c]; d = a[2]; i = b[a[3]]; b[d + 1] = i; b[d] = i[a[4]]; elseif d == 30 then b[a[2]][a[3]] = a[4];
else local c = a[2]; local d = b[a[3]]; b[c + 1] = d; b[c] = d[a[4]]; end; elseif d <= 33 then
if d > 32 then c = a[3];
else b[a[2]][a[3]] = b[a[4]]; end; elseif d > 34 then b[a[2]] = f[a[3]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]][a[3]] = a[4]; c = c + 1; a = e[c]; do return end;
else local c = a[2] b[c] = b[c](g(b, c + 1, a[3])) end; elseif d <= 39 then
if d <= 37 then
if d > 36 then local h = l[a[3]]; local g; local d = {}; g = n({}, {
__index = function(b, a) local a = d[a];
return a[1][a[2]];end,
__newindex = function(c, a, b) local a = d[a] a[1][a[2]] = b;end;
});
for f = 1, a[4] do c = c + 1;
local a = e[c];
if a[1] == 27 then d[f - 1] = {
b,
a[3]
};
else d[f - 1] = {
i,
a[3]
}; end; k[#k + 1] = d; end; b[a[2]] = j(h, g, f);
else b[a[2]] = b[a[3]]; end; elseif d == 38 then do return end;
else local a = a[2] b[a] = b[a]() end; elseif d <= 41 then
if d == 40 then local c = a[2] b[c](g(b, c + 1, a[3]))
else local c = a[2] local e = {
b[c](b[c + 1])
}; local d = 0;
for a = c, a[4] do d = d + 1;
b[a] = e[d]; end end; elseif d > 42 then b[a[2]] = f[a[3]];
else b[a[2]] = f[a[3]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]] = b[a[3]][a[4]]; c = c + 1; a = e[c]; b[a[2]][a[3]] = a[4]; c = c + 1; a = e[c]; do return end;
end; elseif d <= 50 then
if d <= 46 then
if d <= 44 then local a = a[2] b[a](b[a + 1]) elseif d == 45 then b[a[2]][a[3]] = a[4];
else b[a[2]] = j(l[a[3]], nil, f); end; elseif d <= 48 then
if d == 47 then local a = a[2] b[a](b[a + 1])
else
do return end;
end; elseif d > 49 then b[a[2]] = j(l[a[3]], nil, f);
else local a = a[2] b[a] = b[a](g(b, a + 1, h)) end; elseif d <= 54 then
if d <= 52 then
if d == 51 then b[a[2]] = (a[3] ~ = 0);
else if (b[a[2]] ~ = a[4]) then c = c + 1;
else c = a[3]; end; end; elseif d == 53 then local c = a[2] b[c](g(b, c + 1, a[3]))
else b[a[2]] = i[a[3]]; end; elseif d <= 56 then
if d > 55 then b[a[2]] = b[a[3]][a[4]];
else local d; d = a[2] b[d](b[d + 1]) c = c + 1; a = e[c]; b[a[2]] = f[a[3]]; c = c + 1; a = e[c]; b[a[2]] = a[3]; c = c + 1; a = e[c]; d = a[2] b[d](b[d + 1]) c = c + 1; a = e[c]; b[a[2]] = (a[3] ~ = 0); c = c + 1; a = e[c]; i[a[3]] = b[a[2]]; end; elseif d > 57 then local d = a[2] local e = {
b[d](b[d + 1])
}; local c = 0;
for a = d, a[4] do c = c + 1;
b[a] = e[c]; end
else b[a[2]](); end; c = c + 1; end; end); end;
return j(true, {}, r())(); end)(string.byte, table.insert, setmetatable);
One interesting page is showing that this or a resembling script (concerning the snippet I extracted above to search in searchengines) was used for obstruction already, read this forum thread about it:
https://devforum.roblox.com/t/ironbrew-de-obfuscation-is-it-possible/739114

lzz 77 compression image rgb

if I insert an image of size (205,205) the algorithm compresses it very quickly. But if I insert a larger image, the algorithm takes a very long time to compress it.
my intention would be to optimize the code and consequently speed up the compression phase
do you have any suggestions?
library
from PIL import Image
import numpy as np
from cv2 import cv2
**function of compression**
def lz77Compress (image,sw,lab):
img = cv2.imread(image)
flat = np.array(img).flatten()
row = img.shape[0]
col = img.shape[1]
ch = img.shape[2]
tot = row * col * ch
slidingWindows = sw
lookAhead = lab
array of tuple and char
encodedTuple = np.array([], dtype=np.uint16)
encodedChar = np.array([], dtype=np.uint8)
**# Lunghezza del Search Buffer**
sbSize = slidingWindows - lookAhead
for it in range(sbSize):
encodedTuple = np.append(encodedTuple, (0, 0))
encodedChar = np.append(encodedChar, flat[it])
**# pointer in the Search Buffer**
sbPointer = 0
while sbPointer < tot :
max_match = 0
max_match_go_back = 0
selChar = sbPointer + sbSize
# corrispondenza del carattere in Sb da lookAd
encodeCharacters = flat[selChar]
**#sequenza vuota[]**
seqY = np.array([],dtype=np.int16)
for i in range(sbPointer,sbPointer + sbSize):
if(flat[i] == encodeCharacters):
seqY = np.append(seqY,i)
**check of corrispondence and insert in encodedtuple and encodedChar**
if(seqY.size == 0 ):
encodedTuple = np.append(encodedTuple,(0,0))
encodedChar = np.append (encodedChar,encodeCharacters)
else:
for j in seqY:
**size of corrisponddence**
matchLenght= 0
returnBack= selChar - j
it = 0
while selChar + it < tot :
if flat[it + j] == flat[selChar + it]:
matchLenght +=1
it +=1
**# if there is not corrispondence*
else:
break
if matchLenght>max_match:
max_match = matchLenght
returnBack= max_match_go_back
encodedTuple = np.append(encodedTuple,(max_match_go_back,max_match))
encodedChar = np.append(encodedChar,flat[selChar + max_match - 1])
sbPointer+= 1 +max_match
**save encoedTupe and encodedChar and image size for the compression**
np.save("encodedTuple", encodedTuple)
np.save("encodedChar", encodedChar)
print("File compresso in : Copressed.txt")
output = open("Compressed.txt","w+")
output.write(str(c))

math library is missing in the latest update of Logitech G-Hub

local delay = math.random(25, 50)
[string "LuaVM"]:5: attempt to index a nil value (global 'math')
I can't use math.random anymore is there any way to fix this ?
If math library is missed you can insert the following code block at the beginning of your script.
It will not fix the whole math library, but only some of the most frequently used functions (including math.random).
It will also fix the following errors:
bad argument #1 to 'Sleep' (number has no integer representation)
attempt to call a nil value (field 'getn')
do
local state_8, state_45, cached_bits, cached_bits_qty = 2, 0, 0, 0
local prev_width, prev_bits_in_factor, prev_k = 0
for c in GetDate():gmatch"." do
state_45 = state_45 % 65537 * 23456 + c:byte()
end
local function get_53_random_bits()
local value53 = 0
for shift = 26, 27 do
local p = 2^shift
state_45 = (state_45 * 233 + 7161722017421) % 35184372088832
repeat state_8 = state_8 * 76 % 257 until state_8 ~= 1
local r = state_8 % 32
local n = state_45 / 2^(13 - (state_8 - r) / 32)
n = (n - n%1) % 2^32 / 2^r
value53 = value53 * p + ((n%1 * 2^32) + (n - n%1)) % p
end
return value53
end
for j = 1, 10 do get_53_random_bits() end
local function get_random_bits(number_of_bits)
local pwr_number_of_bits = 2^number_of_bits
local result
if number_of_bits <= cached_bits_qty then
result = cached_bits % pwr_number_of_bits
cached_bits = (cached_bits - result) / pwr_number_of_bits
else
local new_bits = get_53_random_bits()
result = new_bits % pwr_number_of_bits
cached_bits = (new_bits - result) / pwr_number_of_bits * 2^cached_bits_qty + cached_bits
cached_bits_qty = 53 + cached_bits_qty
end
cached_bits_qty = cached_bits_qty - number_of_bits
return result
end
table = table or {}
table.getn = table.getn or function(x) return #x end
math = math or {}
math.huge = math.huge or 1/0
math.abs = math.abs or function(x) return x < 0 and -x or x end
math.floor = math.floor or function(x) return x - x%1 end
math.ceil = math.ceil or function(x) return x + (-x)%1 end
math.min = math.min or function(x, y) return x < y and x or y end
math.max = math.max or function(x, y) return x > y and x or y end
math.sqrt = math.sqrt or function(x) return x^0.5 end
math.pow = math.pow or function(x, y) return x^y end
math.frexp = math.frexp or
function(x)
local e = 0
if x == 0 then
return x, e
end
local sign = x < 0 and -1 or 1
x = x * sign
while x >= 1 do
x = x / 2
e = e + 1
end
while x < 0.5 do
x = x * 2
e = e - 1
end
return x * sign, e
end
math.exp = math.exp or
function(x)
local e, t, k, p = 0, 1, 1
repeat e, t, k, p = e + t, t * x / k, k + 1, e
until e == p
return e
end
math.log = math.log or
function(x)
assert(x > 0)
local a, b, c, d, e, f = x < 1 and x or 1/x, 0, 0, 1, 1
repeat
repeat
c, d, e, f = c + d, b * d / e, e + 1, c
until c == f
b, c, d, e, f = b + 1 - a * c, 0, 1, 1, b
until b <= f
return a == x and -f or f
end
math.log10 = math.log10 or
function(x)
return math.log(x) / 2.3025850929940459
end
math.random = math.random or
function(m, n)
if m then
if not n then
m, n = 1, m
end
local k = n - m + 1
if k < 1 or k > 2^53 then
error("Invalid arguments for function 'random()'", 2)
end
local width, bits_in_factor, modk
if k == prev_k then
width, bits_in_factor = prev_width, prev_bits_in_factor
else
local pwr_prev_width = 2^prev_width
if k > pwr_prev_width / 2 and k <= pwr_prev_width then
width = prev_width
else
width = 53
local width_low = -1
repeat
local w = (width_low + width) / 2
w = w - w%1
if k <= 2^w then
width = w
else
width_low = w
end
until width - width_low == 1
prev_width = width
end
bits_in_factor = 0
local bits_in_factor_high = width + 1
while bits_in_factor_high - bits_in_factor > 1 do
local bits_in_new_factor = (bits_in_factor + bits_in_factor_high) / 2
bits_in_new_factor = bits_in_new_factor - bits_in_new_factor%1
if k % 2^bits_in_new_factor == 0 then
bits_in_factor = bits_in_new_factor
else
bits_in_factor_high = bits_in_new_factor
end
end
prev_k, prev_bits_in_factor = k, bits_in_factor
end
local factor, saved_bits, saved_bits_qty, pwr_saved_bits_qty = 2^bits_in_factor, 0, 0, 2^0
k = k / factor
width = width - bits_in_factor
local pwr_width = 2^width
local gap = pwr_width - k
repeat
modk = get_random_bits(width - saved_bits_qty) * pwr_saved_bits_qty + saved_bits
local modk_in_range = modk < k
if not modk_in_range then
local interval = gap
saved_bits = modk - k
saved_bits_qty = width - 1
pwr_saved_bits_qty = pwr_width / 2
repeat
saved_bits_qty = saved_bits_qty - 1
pwr_saved_bits_qty = pwr_saved_bits_qty / 2
if pwr_saved_bits_qty <= interval then
if saved_bits < pwr_saved_bits_qty then
interval = nil
else
interval = interval - pwr_saved_bits_qty
saved_bits = saved_bits - pwr_saved_bits_qty
end
end
until not interval
end
until modk_in_range
return m + modk * factor + get_random_bits(bits_in_factor)
else
return get_53_random_bits() / 2^53
end
end
local orig_Sleep = Sleep
function Sleep(x)
return orig_Sleep(x - x%1)
end
end

differential evolution global minimum problem

Im trying to get the global minimum of a non linear function with linear constraints. I share you the code:
rho = 1.0
g = 9.8
C = 1.0 #roughness coefficient
J = rho*g/(float(1e6)) #constant of function
capacity = [0.3875, 0.607, 0.374] #Supply data
demand = [0.768, 0.315, 0.38,] #Demand data
m= len(capacity)
n = len(demand)
x0 = np.array(m*n*[0.01]) #Initial point for algorithm
# In[59]:
#READ L AND d FROM ARCGIS !!!
L = (314376.57, 277097.9663, 253756.9869 ,265786.5632, 316712.6028, 232857.1468, 112063.9914, 135762.94, 131152.8206)
h= (75, 75, 75, 75, 75, 75, 1320,75,75)
K = np.zeros(m*n)
N=np.zeros(m*n)
# In[60]:
#Each path has its own L,d, therefore, own constant
# In[61]:
#np.seterr(all='ignore')
def diameter(x):
d = 1.484
if x >= 0.276:
d = 1.484
elif x >= 0.212:
d = 1.299
elif x >= 0.148:
d = 1.086
elif x >= 0.0975:
d = 0.881
elif x >= 0.079:
d = 0.793
elif x >= 0.062:
d = 0.705
elif x >= 0.049:
d = 0.626
elif x >= 0.038:
d = 0.555
elif x >= 0.030:
d = 0.494
elif x >= 0.024:
d = 0.441
elif x >= 0.0198:
d = 0.397
elif x >= 0.01565:
d = 0.353
elif x >= 0.0123:
d = 0.313
elif x >= 0.0097:
d = 0.278
elif x >= 0.0077:
d = 0.247
elif x >= 0.0061:
d = 0.22
elif x >= 0.0049:
d = 0.198
elif x >= 0.00389:
d = 0.176
elif x >= 0.0032:
d = 0.159
elif x >= 0.0025:
d = 0.141
elif x >= 0:
d = 0.123
return d
#Definition of Objetive function
def objective(x):
sum_obj = 0.0
for i in range(len(L)):
K = 10.674*L[i]/(C**1.852*diameter(x[i])**4.871)
N[i] = K*x[i]**2.852*J+x[i]*J*h[i]
sum_obj = sum_obj + N[i]
return sum_obj
print(str(objective(x0)))
#Definition of the constraints
GB=[]
for i in range(m):
GB.append(n*i*[0]+n*[1]+(m-1-i)*n*[0])
P=[]
for i in range(n):
P.append(m*(i*[0]+[1]+(n-1-i)*[0]))
DU=np.array(GB+P)
lb = np.array(m*[0] + demand) # Supply
ub = np.array(capacity + n*[np.inf]) # Demand
# In[62]:
b = (0, 1)
bnds = []
for i in range(m*n):
bnds.append(b)
cons = LinearConstraint(DU,lb,ub)
solution = differential_evolution(objective,x0,cons,bnds)
x = solution.x
# show initial objective
print('Initial SSE Objective: ' + str(objective(x0)))
# show final objective
print('Final SSE Objective: ' + str(objective(x)))
# print solution
print('Solution Supply to Demand:')
print('Q = ' + str(((np.around(x,6)).reshape(10,18))))
I dont know why, but when I run appear the following:
"if strategy in self._binomial:
TypeError: unhashable type: 'list'
Anyone have gotten the same mistake ? Its my first time trying to solve optimization problem, so I need a little bit of help. Any advice is welcome !!
Thanks a lot !
You're not calling differential_evolution correctly. For your example you should call it as:
differential_evolution(objective, bnds, contraints=(cons,))
(I'm not sure if there are additional problems)

backpropagation algorithm in matlab

I'm writing a back propagation algorithm in matlab. But I can not get to write a good solution. I read a book Haykin and read some topics in Internet, how make it other people. I understand from door to door this algorithm in theory, but I have a much of error in practice. I have a NaN in my code.
You can see here.
I'm trying classification some points on plate. These are three ellipses, which are placed one inside the other.
I wrote this function. The second layer learn, but first layer dont learn.
function [E, W_1, W_2, B_1, B_2, X_3] = update(W_1, W_2, B_1, B_2, X_1, T, alpha)
V_1 = W_1 * X_1 + B_1;
X_2 = tansig(V_1);
V_2 = W_2 * X_2 + B_2;
X_3 = tansig(V_2);
E = 1 / 2 * sum((T - X_3) .^ 2);
dE = (T - X_3);
for j = 1 : size(X_2, 1)
delta_2_sum = 0;
for i = 1 : size(X_3, 1)
delta_2 = dE(i, 1) * dtansig(1, V_2(i, 1) );
W_2_tmp(i, j) = W_2(i, j) - alpha * delta_2 * X_2(j, 1);
B_2_tmp(i, 1) = B_2(i, 1) - alpha * delta_2;
end;
end;
for k = 1 : size(X_1, 1)
for j = 1 : size(X_2, 1)
delta_2_sum = 0;
for i = 1 : size(X_3, 1)
delta_2 = dE(i, 1) * dtansig(1, V_2(i, 1) );
delta_2_sum = delta_2_sum + W_2(i, j) * delta_2;
end;
delta_1 = delta_2_sum * dtansig(1, V_1(j, 1) );
W_1_tmp(j, k) = W_1(j, k) - alpha * delta_1 * X_1(k, 1);
B_1_tmp(j, 1) = B_1(j, 1) - alpha * delta_1;
end;
end;
if (min(W_1) < -10000 )
X = 1;
end;
B_1 = B_1_tmp;
B_2 = B_2_tmp;
W_1 = W_1_tmp
W_2 = W_2_tmp;
end
I wrote another variant code. And this code don't work. I calculated this code with 1-dimensional vector as input and as output. And I don't have truth result.
What can I do?
I use matlab nntool interface. But my backprop was written my hand.
How I can testing my code?
function [net] = backProp(net, epoch, alpha)
for u = 1 : epoch % Число эпох
for p = 1 : size(net.userdata{1, 1}, 2)
% Учим по всем элементам выборки
[~, ~, ~, De, Df, f] = frontProp(net, p, 1);
for l = size(net.LW, 1) : -1 : 1 % Обходим слои
if (size(net.LW, 1) == l )
delta{l} = De .* Df{l};
else
% size(delta{l + 1})
% size(net.LW{l + 1})
delta{l} = Df{l} .* (delta{l + 1}' * net.LW{l + 1} )';
end;
if (l == 1)
net.IW{l} + alpha * delta{l} * f{l}'
net.IW{l} = net.IW{l} + alpha * delta{l} * f{l}';
else
net.LW{l} + alpha * delta{l} * f{l}'
net.LW{l} = net.LW{l} + alpha * delta{l} * f{l}';
end;
end;
end;
end;
end

Resources