| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 500 人关注过本帖
标题:matlab程序优化
只看楼主 加入收藏
无心失落
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-6-8
收藏
 问题点数:0 回复次数:0 
matlab程序优化
y=rand(1,8,65536);
j=1;
i=1;
p=0;
q=0;
for a=1:4;
    for b=1:4;
        for c=1:4;
            for d=1:4;
                for e=1:4;
                    for f=1:4;
                        for g=1:4;
                            for h=1:4;
                                y(:,:,j)=[a b c d e f g h];
                                j=j+1;
                            end
                        end
                    end
                end
            end
        end
    end
end
x=rand(1,8,390625);
for a1=0:4;
    for a2=0:4;
        for a3=0:4;
            for a4=0:4;
                for a5=0:4;
                    for a6=0:4;
                        for a7=0:4;
                            for a8=0:4;
                                x(:,:,i)=[a1 a2 a3 a4 a5 a6 a7 a8];
                                i=i+1;
                            end
                        end
                    end
                end
            end
        end
    end
end
for b1=1:390625;
    for b2=1:390625;
        for b3=1:390625;
            for b4=1:390625;
                for b5=1:390625;
                    for b6=1:390625;
                        for b7=1:390625;
                            for b8=1:390625;
                                X=[x(:,:,b1);x(:,:,b2);x(:,:,b3);x(:,:,b4);x(:,:,b5);x(:,:,b6);x(:,:,b7);x(:,:,b8)];
                                if  rem(det(X),5)~=0;
                                    p=p+1;
                                    for r=1:65536;
                                        z=y(:,:,r)*X;
                                        if rem(z(1),5)~=0&&rem(z(2),5)~=0&&rem(z(3),5)~=0&&rem(z(4),5)~=0&&rem(z(5),5)~=0&&rem(z(6),5)~=0&&rem(z(7),5)~=0&&rem(z(8),5)~=0;
                                            q=q+1;
                                            break
                                        end
                                    end
                                end
                            end
                        end
                    end
                end
            end
        end
    end
end
if p==q;
    'True'
else
    'Wrong'
end
我这个程序编的循环太多,能不能帮忙计算或者优化一下计算,电脑实在跑不出来。
搜索更多相关主题的帖子: matlab 
2011-06-10 00:01
快速回复:matlab程序优化
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018629 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved