#include "msatInt.h"
Go to the source code of this file.
Msat_IntVec_t* Msat_IntVecAlloc | ( | int | nCap | ) |
FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Allocates a vector with the given capacity.]
Description []
SideEffects []
SeeAlso []
Definition at line 45 of file msatVec.c.
00046 { 00047 Msat_IntVec_t * p; 00048 p = ALLOC( Msat_IntVec_t, 1 ); 00049 if ( nCap > 0 && nCap < 16 ) 00050 nCap = 16; 00051 p->nSize = 0; 00052 p->nCap = nCap; 00053 p->pArray = p->nCap? ALLOC( int, p->nCap ) : NULL; 00054 return p; 00055 }
Msat_IntVec_t* Msat_IntVecAllocArray | ( | int * | pArray, | |
int | nSize | |||
) |
Function*************************************************************
Synopsis [Creates the vector from an integer array of the given size.]
Description []
SideEffects []
SeeAlso []
Definition at line 68 of file msatVec.c.
00069 { 00070 Msat_IntVec_t * p; 00071 p = ALLOC( Msat_IntVec_t, 1 ); 00072 p->nSize = nSize; 00073 p->nCap = nSize; 00074 p->pArray = pArray; 00075 return p; 00076 }
Msat_IntVec_t* Msat_IntVecAllocArrayCopy | ( | int * | pArray, | |
int | nSize | |||
) |
Function*************************************************************
Synopsis [Creates the vector from an integer array of the given size.]
Description []
SideEffects []
SeeAlso []
Definition at line 89 of file msatVec.c.
00090 { 00091 Msat_IntVec_t * p; 00092 p = ALLOC( Msat_IntVec_t, 1 ); 00093 p->nSize = nSize; 00094 p->nCap = nSize; 00095 p->pArray = ALLOC( int, nSize ); 00096 memcpy( p->pArray, pArray, sizeof(int) * nSize ); 00097 return p; 00098 }
void Msat_IntVecClear | ( | Msat_IntVec_t * | p | ) |
Msat_IntVec_t* Msat_IntVecDup | ( | Msat_IntVec_t * | pVec | ) |
Function*************************************************************
Synopsis [Duplicates the integer array.]
Description []
SideEffects []
SeeAlso []
Msat_IntVec_t* Msat_IntVecDupArray | ( | Msat_IntVec_t * | pVec | ) |
Function*************************************************************
Synopsis [Transfers the array into another vector.]
Description []
SideEffects []
SeeAlso []
void Msat_IntVecFill | ( | Msat_IntVec_t * | p, | |
int | nSize, | |||
int | Entry | |||
) |
Function*************************************************************
Synopsis [Fills the vector with given number of entries.]
Description []
SideEffects []
SeeAlso []
Definition at line 174 of file msatVec.c.
00175 { 00176 int i; 00177 Msat_IntVecGrow( p, nSize ); 00178 p->nSize = nSize; 00179 for ( i = 0; i < p->nSize; i++ ) 00180 p->pArray[i] = Entry; 00181 }
void Msat_IntVecFree | ( | Msat_IntVec_t * | p | ) |
void Msat_IntVecGrow | ( | Msat_IntVec_t * | p, | |
int | nCapMin | |||
) |
Function*************************************************************
Synopsis [Resizes the vector to the given capacity.]
Description []
SideEffects []
SeeAlso []
int Msat_IntVecPop | ( | Msat_IntVec_t * | p | ) |
void Msat_IntVecPush | ( | Msat_IntVec_t * | p, | |
int | Entry | |||
) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 348 of file msatVec.c.
00349 { 00350 if ( p->nSize == p->nCap ) 00351 { 00352 if ( p->nCap < 16 ) 00353 Msat_IntVecGrow( p, 16 ); 00354 else 00355 Msat_IntVecGrow( p, 2 * p->nCap ); 00356 } 00357 p->pArray[p->nSize++] = Entry; 00358 }
int Msat_IntVecPushUnique | ( | Msat_IntVec_t * | p, | |
int | Entry | |||
) |
Function*************************************************************
Synopsis [Add the element while ensuring uniqueness.]
Description [Returns 1 if the element was found, and 0 if it was new. ]
SideEffects []
SeeAlso []
Definition at line 371 of file msatVec.c.
00372 { 00373 int i; 00374 for ( i = 0; i < p->nSize; i++ ) 00375 if ( p->pArray[i] == Entry ) 00376 return 1; 00377 Msat_IntVecPush( p, Entry ); 00378 return 0; 00379 }
void Msat_IntVecPushUniqueOrder | ( | Msat_IntVec_t * | p, | |
int | Entry, | |||
int | fIncrease | |||
) |
Function*************************************************************
Synopsis [Inserts the element while sorting in the increasing order.]
Description []
SideEffects []
SeeAlso []
Definition at line 392 of file msatVec.c.
00393 { 00394 int Entry1, Entry2; 00395 int i; 00396 Msat_IntVecPushUnique( p, Entry ); 00397 // find the p of the node 00398 for ( i = p->nSize-1; i > 0; i-- ) 00399 { 00400 Entry1 = p->pArray[i ]; 00401 Entry2 = p->pArray[i-1]; 00402 if ( fIncrease && Entry1 >= Entry2 || 00403 !fIncrease && Entry1 <= Entry2 ) 00404 break; 00405 p->pArray[i ] = Entry2; 00406 p->pArray[i-1] = Entry1; 00407 } 00408 }
int* Msat_IntVecReadArray | ( | Msat_IntVec_t * | p | ) |
int Msat_IntVecReadEntry | ( | Msat_IntVec_t * | p, | |
int | i | |||
) |
int Msat_IntVecReadEntryLast | ( | Msat_IntVec_t * | p | ) |
int Msat_IntVecReadSize | ( | Msat_IntVec_t * | p | ) |
int* Msat_IntVecReleaseArray | ( | Msat_IntVec_t * | p | ) |
void Msat_IntVecShrink | ( | Msat_IntVec_t * | p, | |
int | nSizeNew | |||
) |
void Msat_IntVecSort | ( | Msat_IntVec_t * | p, | |
int | fReverse | |||
) |
Function*************************************************************
Synopsis [Sorting the entries by their integer value.]
Description []
SideEffects []
SeeAlso []
Definition at line 439 of file msatVec.c.
00440 { 00441 if ( fReverse ) 00442 qsort( (void *)p->pArray, p->nSize, sizeof(int), 00443 (int (*)(const void *, const void *)) Msat_IntVecSortCompare2 ); 00444 else 00445 qsort( (void *)p->pArray, p->nSize, sizeof(int), 00446 (int (*)(const void *, const void *)) Msat_IntVecSortCompare1 ); 00447 }
int Msat_IntVecSortCompare1 | ( | int * | pp1, | |
int * | pp2 | |||
) | [static] |
CFile****************************************************************
FileName [msatVec.c]
PackageName [A C version of SAT solver MINISAT, originally developed in C++ by Niklas Een and Niklas Sorensson, Chalmers University of Technology, Sweden: http://www.cs.chalmers.se/~een/Satzoo.]
Synopsis [Integer vector borrowed from Extra.]
Author [Alan Mishchenko <alanmi@eecs.berkeley.edu>]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - January 1, 2004.]
Revision [
] DECLARATIONS ///
Function*************************************************************
Synopsis [Comparison procedure for two clauses.]
Description []
SideEffects []
SeeAlso []
int Msat_IntVecSortCompare2 | ( | int * | pp1, | |
int * | pp2 | |||
) | [static] |
Function*************************************************************
Synopsis [Comparison procedure for two clauses.]
Description []
SideEffects []
SeeAlso []
void Msat_IntVecWriteEntry | ( | Msat_IntVec_t * | p, | |
int | i, | |||
int | Entry | |||
) |