k-column combinatrila tree



Help need for problem given in next m-file. That program running on Pentium 4 (2.52 GHz) spent around 4 sec to be finished. Actually, active version of programe is indeed dll compiled version of the original m-file. My final attention is to run a program including 26 rows and up to 13 columns.
After k-column combination is generated, program has to jump in non-linear regression subprogram using Marquardt-Levenberg algorithm for calculating parameter for one set of actually measured data.
Only as a warning I have to say, Marquardt-Levenberg algorithm as m-file us 10 times more than rest of program for combination finding part.

% This program calculates three columns data so
% that each of rows contain only one '1'. Rest of data in row are '0'.
% In example given only 10 rows is calculated
%
function [j]=three_columns_v01
%
%
N=10;
j=0;
iter1=1;
iter1max=2^(N-2);
while iter1<iter1max
C1=bitget(iter1,N:-1:1)';
for z=iter1+1:-1+2^(N-1)
C2=bitget(z,N:-1:1)';
k=0;
for i=1:N;
b1=C1(i,1);
if b1==1;
k=k+C2(i,1);
end
end
if k==0
C3=bitget(2^N-1-z-iter1,N:-1:1)';
j=j+1;
x0=[C1 C2 C3];
end
end
iter1=iter1+1;
end
format long
j

Zlatko
.