function [sorted_feat_index] = feature_select(train_feat1,train_feat2,train_feat3,test_feat,cumulant_start,cumulant_end,n_decomp)

dim = size(train_feat1);
i = 1;
while(i <= dim(2))
    m_test_feat(i) = mean(test_feat(:,i));
    m_train_feat1(i) = mean(train_feat1(:,i));
    m_train_feat2(i) = mean(train_feat2(:,i));
    m_train_feat3(i) = mean(train_feat3(:,i));    
    i = i + 1;
end

i = 1;
while(i <= n_decomp+1)
    j = cumulant_start;
    index = 1;
    while(j <= cumulant_end)
        n_test_feat((i-1)*(cumulant_end-cumulant_start+1)+index) = m_test_feat((i-1)*(cumulant_end-cumulant_start+1)+index)^(1/j);
        n_train_feat1((i-1)*(cumulant_end-cumulant_start+1)+index) = m_train_feat1((i-1)*(cumulant_end-cumulant_start+1)+index)^(1/j);
        n_train_feat2((i-1)*(cumulant_end-cumulant_start+1)+index) = m_train_feat2((i-1)*(cumulant_end-cumulant_start+1)+index)^(1/j);
        n_train_feat3((i-1)*(cumulant_end-cumulant_start+1)+index) = m_train_feat3((i-1)*(cumulant_end-cumulant_start+1)+index)^(1/j);
        j = j + 1;
        index = index + 1;
    end
    i = i + 1;
end

d1 = abs(n_train_feat1 - n_test_feat);
d2 = abs(n_train_feat2 - n_test_feat);
d3 = abs(n_train_feat3 - n_test_feat);

d_overall = [d1;d2;d3];

i = 1;
while(i <= dim(2))
    dom_feat(i) = sum(d_overall(:,i)) - 2*min(d_overall(:,i));
    i = i + 1;
end
sorted_dom_feat = sort(dom_feat,'descend');
 
index = 1;
i = 1;
while(i <= dim(2))
    dummy = sorted_dom_feat(i);
    j = 1;
    while(j <= dim(2))
        if(dummy == dom_feat(j))
            sorted_feat_index(index) = j;
            index = index + 1;
            j = dim(2) + 1;
        end
        j = j + 1;
    end
    i = i + 1;
end
end