summaryrefslogtreecommitdiffstats
path: root/scilab/modules/metanet
diff options
context:
space:
mode:
authorAllan CORNET <allan.cornet@scilab.org>2009-09-22 15:44:17 +0200
committerAllan CORNET <allan.cornet@scilab.org>2009-09-22 15:44:17 +0200
commit306b89a962d13ff24eedbf7095de4454383cc05e (patch)
tree1ea27bfc173dec1d64c51ccd22281cc87ed7d3b1 /scilab/modules/metanet
parente03f566873db0f48a072af452a3812a572e82f39 (diff)
downloadscilab-306b89a962d13ff24eedbf7095de4454383cc05e.zip
scilab-306b89a962d13ff24eedbf7095de4454383cc05e.tar.gz
replaces sort by gsort
Diffstat (limited to 'scilab/modules/metanet')
-rw-r--r--scilab/modules/metanet/macros/graph_tools/graph_simp.sci2
-rw-r--r--scilab/modules/metanet/macros/graph_tools/knapsack.sci8
-rw-r--r--scilab/modules/metanet/macros/graph_tools/make_graph.sci2
-rw-r--r--scilab/modules/metanet/macros/graph_tools/mat_2_graph.sci4
-rw-r--r--scilab/modules/metanet/macros/graph_tools/neighbors.sci2
5 files changed, 9 insertions, 9 deletions
diff --git a/scilab/modules/metanet/macros/graph_tools/graph_simp.sci b/scilab/modules/metanet/macros/graph_tools/graph_simp.sci
index ca786c3..1b4c592 100644
--- a/scilab/modules/metanet/macros/graph_tools/graph_simp.sci
+++ b/scilab/modules/metanet/macros/graph_tools/graph_simp.sci
@@ -19,7 +19,7 @@ function g1=graph_simp(g)
19 [ir ic]=find(ta==he); 19 [ir ic]=find(ta==he);
20 ta(ic)=[];he(ic)=[]; 20 ta(ic)=[];he(ic)=[];
21 p=round(log(n)/log(10));q=10^(p+4); 21 p=round(log(n)/log(10));q=10^(p+4);
22 w=ta'*q+he';[w1 iw]=sort(w); 22 w=ta'*q+he';[w1 iw]=gsort(w);
23 ww=w1(2:$)-w1(1:($-1)); 23 ww=w1(2:$)-w1(1:($-1));
24 [ir ic]=find(ww==0); 24 [ir ic]=find(ww==0);
25 index=iw(ir); 25 index=iw(ir);
diff --git a/scilab/modules/metanet/macros/graph_tools/knapsack.sci b/scilab/modules/metanet/macros/graph_tools/knapsack.sci
index 95f355b..da311e4 100644
--- a/scilab/modules/metanet/macros/graph_tools/knapsack.sci
+++ b/scilab/modules/metanet/macros/graph_tools/knapsack.sci
@@ -42,13 +42,13 @@ function [earn,ind]=knapsack(profit,weight,capa,bck)
42 weight = matrix(weight,1,-1) 42 weight = matrix(weight,1,-1)
43 capa = matrix(capa,1,-1) 43 capa = matrix(capa,1,-1)
44 //preprocess the data 44 //preprocess the data
45 [s,k]=sort(profit./weight); 45 [s,k]=gsort(profit./weight);
46 [ss,kk]=sort(-k); 46 [ss,kk]=gsort(-k);
47 p=profit(k);w=weight(k); 47 p=profit(k);w=weight(k);
48 np1=n+1; 48 np1=n+1;
49 m=size(capa,2); 49 m=size(capa,2);
50 [s1,k1]=sort(capa); 50 [s1,k1]=gsort(capa);
51 [s2,k2]=sort(k1); 51 [s2,k2]=gsort(k1);
52 kap=s1($:-1:1); 52 kap=s1($:-1:1);
53 mn=m*n;mnp1=m*np1; 53 mn=m*n;mnp1=m*np1;
54 [xstar,vstar]=m6knapsk(n,m,np1,mn,mnp1,p,w,kap,bck); 54 [xstar,vstar]=m6knapsk(n,m,np1,mn,mnp1,p,w,kap,bck);
diff --git a/scilab/modules/metanet/macros/graph_tools/make_graph.sci b/scilab/modules/metanet/macros/graph_tools/make_graph.sci
index fd9b6aa..d4fee6a 100644
--- a/scilab/modules/metanet/macros/graph_tools/make_graph.sci
+++ b/scilab/modules/metanet/macros/graph_tools/make_graph.sci
@@ -45,7 +45,7 @@ function g=make_graph(name,directed,n,tail,head)
45 nodename=string(1:n) 45 nodename=string(1:n)
46 else 46 else
47 ij=[tail' head']; 47 ij=[tail' head'];
48 tri=[ij(:,1)' ij(:,2)'];[atri,indic]=sort(-tri); 48 tri=[ij(:,1)' ij(:,2)'];[atri,indic]=gsort(-tri);
49 atri=-atri; 49 atri=-atri;
50 n1=size(atri,2); 50 n1=size(atri,2);
51 atri1=atri-[0 atri(1:n1-1)]; 51 atri1=atri-[0 atri(1:n1-1)];
diff --git a/scilab/modules/metanet/macros/graph_tools/mat_2_graph.sci b/scilab/modules/metanet/macros/graph_tools/mat_2_graph.sci
index dd2483b..459f594 100644
--- a/scilab/modules/metanet/macros/graph_tools/mat_2_graph.sci
+++ b/scilab/modules/metanet/macros/graph_tools/mat_2_graph.sci
@@ -47,9 +47,9 @@ function g=mat_2_graph(a,directed,mat)
47 end 47 end
48 48
49 he=ij(itab,:); ta=ij(jtab,:) 49 he=ij(itab,:); ta=ij(jtab,:)
50 [s,k]=sort(he(:,2)); he=he(k,:); he=he(:,1) 50 [s,k]=gsort(he(:,2)); he=he(k,:); he=he(:,1)
51 ma=prod(size(k)); he=he(ma:-1:1) 51 ma=prod(size(k)); he=he(ma:-1:1)
52 [s,k]=sort(ta(:,2)); ta=ta(k,:); ta=ta(:,1) 52 [s,k]=gsort(ta(:,2)); ta=ta(k,:); ta=ta(:,1)
53 ma=prod(size(k)); ta=ta(ma:-1:1) 53 ma=prod(size(k)); ta=ta(ma:-1:1)
54 g=make_graph('foo',1,n,he',ta') 54 g=make_graph('foo',1,n,he',ta')
55 55
diff --git a/scilab/modules/metanet/macros/graph_tools/neighbors.sci b/scilab/modules/metanet/macros/graph_tools/neighbors.sci
index 1a18236..401e83c 100644
--- a/scilab/modules/metanet/macros/graph_tools/neighbors.sci
+++ b/scilab/modules/metanet/macros/graph_tools/neighbors.sci
@@ -21,5 +21,5 @@ function d=neighbors(i,g)
21 d1=he(ic); 21 d1=he(ic);
22 [ir,ic]=find(he==i); 22 [ir,ic]=find(he==i);
23 d2=ta(ic); 23 d2=ta(ic);
24 d=-sort(-[d1 d2]); 24 d=-gsort(-[d1 d2]);
25endfunction 25endfunction