template<>
specialisation for VectorSet (of doubles)
Definition at line 39 of file ApplyOrder.h. References Impala::Core::Vector::VectorSet< ArrayT >::Get(), Impala::Core::Column::ColumnTem< ElemT >::GetData(), Impala::Core::Vector::VectorSet< ArrayT >::Set(), and Impala::Core::Column::ColumnTem< ElemT >::Size(). 00040 { 00041 typedef Vector::VectorTem<Array::Array2dScalarReal64::StorType> Type; 00042 00043 int length = orderCol->Size(); 00044 // order is copied to keep callers code simpler 00045 int* order = new int[length]; 00046 memcpy(order, orderCol->GetData(), length*sizeof(int)); 00047 00048 int i; 00049 for(i=0 ; i<length ; ++i) 00050 { 00051 if(order[i] != i) 00052 { 00053 // keep swapping until an element is put at the correct position (this will happen!) 00054 int indexFrom = i; 00055 int indexTo = order[i]; 00056 order[i] = i; 00057 Type value = data->Get(indexFrom); 00058 while(indexFrom != indexTo) 00059 { 00060 Type temp = data->Get(indexTo); 00061 data->Set(indexTo, value); 00062 value = temp; 00063 indexFrom = indexTo; 00064 indexTo = order[indexFrom]; 00065 order[indexFrom] = indexFrom; 00066 } 00067 } 00068 } 00069 }
Here is the call graph for this function:
|