ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaSort.c File Reference
#include "gia.h"
Include dependency graph for giaSort.c:

Go to the source code of this file.

Functions

void minisat_sort (int *array, int size, int(*comp)(const void *, const void *))
 
void minisat_sort2 (int *array, int size)
 
int * Gia_SortGetTest (int nSize)
 
void Gia_SortVerifySorted (int *pArray, int nSize)
 
void Gia_SortTest ()
 
void minisat_sort3 (float *array, int *perm, int size)
 
int * Gia_SortFloats (float *pArray, int *pPerm, int nSize)
 

Function Documentation

◆ Gia_SortFloats()

int * Gia_SortFloats ( float * pArray,
int * pPerm,
int nSize )

Function*************************************************************

Synopsis [Sorts the array of floating point numbers.]

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file giaSort.c.

252{
253 int i;
254 if ( pPerm == NULL )
255 {
256 pPerm = ABC_ALLOC( int, nSize );
257 for ( i = 0; i < nSize; i++ )
258 pPerm[i] = i;
259 }
260 minisat_sort3( pArray, pPerm, nSize );
261// for ( i = 1; i < nSize; i++ )
262// assert( pArray[i-1] <= pArray[i] );
263 return pPerm;
264}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
void minisat_sort3(float *array, int *perm, int size)
Definition giaSort.c:235
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_SortGetTest()

int * Gia_SortGetTest ( int nSize)

Function*************************************************************

Synopsis [This is implementation of qsort in MiniSat.]

Description []

SideEffects []

SeeAlso []

Definition at line 144 of file giaSort.c.

145{
146 int i, * pArray;
147 srand( 0 );
148 pArray = ABC_ALLOC( int, nSize );
149 for ( i = 0; i < nSize; i++ )
150 pArray[i] = rand();
151 return pArray;
152}
Here is the caller graph for this function:

◆ Gia_SortTest()

void Gia_SortTest ( )

Definition at line 159 of file giaSort.c.

160{
161 int nSize = 100000000;
162 int * pArray;
163 abctime clk = Abc_Clock();
164
165 printf( "Sorting %d integers\n", nSize );
166 pArray = Gia_SortGetTest( nSize );
167clk = Abc_Clock();
168 qsort( pArray, (size_t)nSize, 4, (int (*)(const void *, const void *)) num_cmp1 );
169ABC_PRT( "qsort ", Abc_Clock() - clk );
170 Gia_SortVerifySorted( pArray, nSize );
171 ABC_FREE( pArray );
172
173 pArray = Gia_SortGetTest( nSize );
174clk = Abc_Clock();
175 minisat_sort( pArray, nSize, (int (*)(const void *, const void *)) num_cmp2 );
176ABC_PRT( "minisat", Abc_Clock() - clk );
177 Gia_SortVerifySorted( pArray, nSize );
178 ABC_FREE( pArray );
179
180 pArray = Gia_SortGetTest( nSize );
181clk = Abc_Clock();
182 minisat_sort2( pArray, nSize );
183ABC_PRT( "minisat with inlined comparison", Abc_Clock() - clk );
184 Gia_SortVerifySorted( pArray, nSize );
185 ABC_FREE( pArray );
186}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_FREE(obj)
Definition abc_global.h:267
int * Gia_SortGetTest(int nSize)
Definition giaSort.c:144
void Gia_SortVerifySorted(int *pArray, int nSize)
Definition giaSort.c:153
void minisat_sort2(int *array, int size)
Definition giaSort.c:128
void minisat_sort(int *array, int size, int(*comp)(const void *, const void *))
Definition giaSort.c:79
Here is the call graph for this function:

◆ Gia_SortVerifySorted()

void Gia_SortVerifySorted ( int * pArray,
int nSize )

Definition at line 153 of file giaSort.c.

154{
155 int i;
156 for ( i = 1; i < nSize; i++ )
157 assert( pArray[i-1] <= pArray[i] );
158}
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ minisat_sort()

void minisat_sort ( int * array,
int size,
int(* comp )(const void *, const void *) )

Definition at line 79 of file giaSort.c.

80{
81 sort_rec(array,size,comp);
82}
Here is the caller graph for this function:

◆ minisat_sort2()

void minisat_sort2 ( int * array,
int size )

Definition at line 128 of file giaSort.c.

129{
130 sort_rec2(array,size);
131}
Here is the caller graph for this function:

◆ minisat_sort3()

void minisat_sort3 ( float * array,
int * perm,
int size )

Definition at line 235 of file giaSort.c.

236{
237 sort_rec3(array, perm, size);
238}
Here is the caller graph for this function: