mas_atef

4 Reputation

2 Badges

13 years, 270 days

MaplePrimes Activity


These are questions asked by mas_atef

Hi everybody,
I would like to speed up my program because it is very slow for large input data
this program calculate arithmetic coding for input data

input:=[144,144,108,94,92,93,96,96,96,96,96,99,95,101,101,97,98,93,95,100,96,94,95,98,97,95]:
 R:=[seq(j,j=0..255)]:
# calculate frequency table 
p:=proc(x)
local k;
global cp:
cp:=0:
for k to N do
if (input[k]=x) then cp:=cp+1 fi
od:
cp/N
end:
G:=[seq(p(i),i=0..255)];

Page 1 of 1