[Scilab-users] Advice from Scilab community (including parallelization)
Paul Carrico
paul.carrico at free.fr
Sat Oct 26 19:56:04 CEST 2013
Thanks Samuel
brillant
Much less complicated than I developed
. And much much faster !!!!!
paul
De : users [mailto:users-bounces at lists.scilab.org] De la part de Samuel
Gougeon
Envoyé : samedi 26 octobre 2013 15:19
À : International users mailing list for Scilab.
Objet : Re: [Scilab-users] Advice from Scilab community (including
parallelization)
Le 26/10/2013 11:08, Paul Carrico a écrit :
printf("Search for duplicates............\n");
//tic()
for i = 1 : (number_of_blocks + k)
printf("block ref %d/%d ...\n",i,(number_of_blocks+k));
tic()
for j = 1 : (number_of_blocks + k)
s2 = "...
if (j == i) then , ...
[nb,loc] = members(splited" + string(i) + ",splited" + string(j)
+ ", ""rows"",""shuffle"",""last"") , ...
splited" + string(j) + "(loc(find(nb >= 2)),:) = [] , ....
else , ...
[nb,loc] = members(splited" + string(i) + ",splited" + string(j)
+ ", ""rows"",""shuffle"") , ...
splited" + string(j) + "(loc(find(nb >= 1)),:) = [] , ....
end , ...
";
execstr(s2);
end
time=toc();
printf("..... time on this loop= %g\n",time)
end
//time = toc()
Removing lines duplicated through permutations may be done without members()
but using the same remark & strategy:
// generating an example
m = grand(10,2,"uin",0,2)
// for each line, sorting the columns :
ms = gsort(m,"c","i")
// Then applying unique() row-wise:
[mu, k] = unique(ms,"r")
// Finally picking the related rows in the original matrix:
m(k,:)
-->m = grand(10,2,"uin",0,2)
m =
0. 1.
2. 2.
2. 0.
2. 1.
1. 1.
0. 0.
1. 1.
1. 2.
1. 0.
0. 2.
-->ms = gsort(m,"c","i")
ms =
0. 1.
2. 2.
0. 2.
1. 2.
1. 1.
0. 0.
1. 1.
1. 2.
0. 1.
0. 2.
-->[mu, k] = unique(ms,"r")
k =
6.
9.
3.
5.
8.
2.
mu =
0. 0.
0. 1.
0. 2.
1. 1.
1. 2.
2. 2.
-->m(k,:)
ans =
0. 0.
1. 0.
2. 0.
1. 1.
1. 2.
2. 2.
---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20131026/a9811b1c/attachment.htm>
More information about the users
mailing list