changeset 230:23b062c43041

bitonicSort may success
author sugi
date Fri, 29 Mar 2013 00:38:47 +0900
parents 4ece0dca75e7
children 783946721e0d
files src/alice/test/codesegment/local/bitonicsort/OddPhase.java
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/test/codesegment/local/bitonicsort/OddPhase.java	Thu Mar 28 21:43:42 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/OddPhase.java	Fri Mar 29 00:38:47 2013 +0900
@@ -34,7 +34,7 @@
 		int count = info6.asInteger();
 		
 		int i = info.range;
-		
+		//System.out.println("CS"+i+" "+info1.key+" "+info2.key+" dataIndex "+info1.index +" count "+count);
 		Sort.quickSort(list1);
 		Sort.quickSort(list2);
 		DataList.merge(list1,list2);
@@ -47,15 +47,16 @@
 		ods.flip(info1);
 		ods.flip(info2);
 		
-		if (count==sort_count/2){
+		if (count+1>=sort_count/2){
 			
-		} else if (count%2==0&&info.lastFlag){
+		} else if (count%2==0&&info.lastFlag&&count+2<sort_count/2){
 			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];
-			new OddPhase(info0.key, f, b, count, info6.key);
+			
+			new OddPhase(info0.key, f, b, count+1, info6.key);
 			ods.update(info6.key, count+1);
 		}