changeset 226:6d546924eea0

sort is success but it has bug
author sugi
date Thu, 28 Mar 2013 21:05:39 +0900
parents bc061ee5f31f
children ddacadba5095
files src/alice/test/codesegment/local/bitonicsort/DataList.java src/alice/test/codesegment/local/bitonicsort/OddPhase.java src/alice/test/codesegment/local/bitonicsort/SetInfo.java src/alice/test/codesegment/local/bitonicsort/SetTask.java src/alice/test/codesegment/local/bitonicsort/ShowData.java
diffstat 5 files changed, 13 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/test/codesegment/local/bitonicsort/DataList.java	Thu Mar 28 18:10:24 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/DataList.java	Thu Mar 28 21:05:39 2013 +0900
@@ -18,7 +18,6 @@
 	public DataList createDataList(int start, int size){
 		int[] table2 = new int[size];
 		int end = start+size-1;
-		//System.out.println(start+" "+end);
 		for (int i=start,j=0;i<end;i++,j++){
 			table2[j] = table[i];
 		}
--- a/src/alice/test/codesegment/local/bitonicsort/OddPhase.java	Thu Mar 28 18:10:24 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/OddPhase.java	Thu Mar 28 21:05:39 2013 +0900
@@ -47,19 +47,15 @@
 		ods.flip(info1);
 		ods.flip(info2);
 		
-		if (count>sort_count){
-			System.out.println(SetInfo.result[i*2]+" "+SetInfo.result[i*2+1]);
-			ods.put(SetInfo.result[i*2], list1);
-			ods.put(SetInfo.result[i*2+1], list2);
+		if (count==sort_count/2){
+			
 		} else if (count%2==0&&info.lastFlag){
-			//System.out.println(info0.key+" "+info1.key+" "+info2.key+" "+(count+2)+" "+info6.key);
 			new OddPhase(info0.key, info1.key, info2.key,count+2,info6.key);
 			ods.update(info6.key, count+2);
 		} else {
 			String f = (count%2==1) ? SetInfo.array[2*i] : SetInfo.array[2*i+1];
-			String b = (count%2==1) ? SetInfo.array[2*i+1] : SetInfo.array[2*i+2];				
-			//System.out.println(info0.key+" "+f+" "+b+" "+(count+1)+" "+info6.key);
-			new OddPhase(info0.key, f, b,count,info6.key);
+			String b = (count%2==1) ? SetInfo.array[2*i+1] : SetInfo.array[2*i+2];
+			new OddPhase(info0.key, f, b, count, info6.key);
 			ods.update(info6.key, count+1);
 		}
 		
--- a/src/alice/test/codesegment/local/bitonicsort/SetInfo.java	Thu Mar 28 18:10:24 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/SetInfo.java	Thu Mar 28 21:05:39 2013 +0900
@@ -26,12 +26,12 @@
 	}
 
 	private void create_keys() {
-		range = new String[conf.length*2];
-		array = new String[conf.length*2];
-		count = new String[conf.length*2];
-		result = new String[conf.length*2];
+		range = new String[conf.length];
+		array = new String[conf.length];
+		count = new String[conf.length];
+		result = new String[conf.length];
 		
-		for(int i = 0 ; i < conf.length*2 ; i++) {
+		for(int i = 0 ; i < conf.length ; i++) {
 			range[i] = "range" + i;
 			array[i] = "array" + i;
 			count[i] = "count" + i;
--- a/src/alice/test/codesegment/local/bitonicsort/SetTask.java	Thu Mar 28 18:10:24 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/SetTask.java	Thu Mar 28 21:05:39 2013 +0900
@@ -33,20 +33,14 @@
 			int i = 0;
 			for (i = 0;i< sort_count/2; i++){
 				// anonymas datasegmaents should be used. 
-				//System.out.print(SetInfo.range[i]);
 				ods.put(SetInfo.range[i], new RangeInfo(i,i==(sort_count/2)-1));
-				//System.out.print(SetInfo.array[i*2]+" ");
 				ods.update(SetInfo.array[i*2], list.createDataList(i*2*block_num, block_num));
-				//System.out.print(SetInfo.array[i*2+1]+" ");
 				ods.update(SetInfo.array[i*2+1], list.createDataList((i*2+1)*block_num, block_num));
 				ods.update(SetInfo.count[i], 0);
-				System.out.println(SetInfo.range[i]+" "+SetInfo.array[i*2]+" "+SetInfo.array[i*2+1]+" "+0+" "+SetInfo.count[i]);
 				new OddPhase(SetInfo.range[i],SetInfo.array[i*2],SetInfo.array[i*2+1],0,SetInfo.count[i]);
 				
 			}
-
-			ods.put("arraynum",i*2+1);
-			new ShowData(i*2);
+			new ShowData(i*2, sort_count);
 			
 		}
 		
--- a/src/alice/test/codesegment/local/bitonicsort/ShowData.java	Thu Mar 28 18:10:24 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/ShowData.java	Thu Mar 28 21:05:39 2013 +0900
@@ -8,12 +8,13 @@
 	
 	private Receiver[] info;
 	
-	public ShowData(int cnt) {
+	public ShowData(int cnt, int index) {
 		info = new Receiver[cnt];
 		for (int i= 0;i < cnt; i++)
 			info[i] = ids.create(CommandType.PEEK);
 		for (int i= 0;i < cnt; i++)
-			info[i].setKey(SetInfo.result[i]);
+			info[i].setKey(SetInfo.array[i],index);
+		
 	}
 	
 	@Override
@@ -33,7 +34,6 @@
 			System.arraycopy(dlist.table, 0, list.table, start, dlist.table.length);
 			start += dlist.table.length;
 		}
-		list.showData();
 		System.out.println("size check :"+ list.table.length);
 		Sort.check(list);
 		System.exit(0);