Functions
gk_proto.h File Reference

This file contains function prototypes. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

float ComputeAccuracy (int n, gk_fkv_t *list)
 
float ComputeMean (int n, float *values)
 
float ComputeMedianRFP (int n, gk_fkv_t *list)
 
float ComputeROCn (int n, int maxN, gk_fkv_t *list)
 
float ComputeStdDev (int n, float *values)
 
void decodeblock (unsigned char *in, unsigned char *out)
 
void encodeblock (unsigned char *in, unsigned char *out)
 
void errexit (char *,...)
 
void gk_AllocMatrix (void ***, size_t, size_t, size_t)
 
void gk_array2csr (size_t n, size_t range, int *array, int *ptr, int *ind)
 Converts an element-based set membership into a CSR-format set-based membership. More...
 
void gk_ckvsortd (size_t, gk_ckv_t *)
 
void gk_ckvsorti (size_t, gk_ckv_t *)
 
double gk_CPUSeconds (void)
 
void gk_csortd (size_t, char *)
 
void gk_csorti (size_t, char *)
 
void gk_csr_CompactColumns (gk_csr_t *mat)
 
float gk_csr_ComputeSimilarity (gk_csr_t *mat, int i1, int i2, int what, int simtype)
 
void gk_csr_ComputeSquaredNorms (gk_csr_t *mat, int what)
 
void gk_csr_ComputeSums (gk_csr_t *mat, int what)
 
gk_csr_tgk_csr_Create ()
 
void gk_csr_CreateIndex (gk_csr_t *mat, int what)
 
gk_csr_tgk_csr_Dup (gk_csr_t *mat)
 
gk_csr_tgk_csr_ExtractPartition (gk_csr_t *mat, int *part, int pid)
 
gk_csr_tgk_csr_ExtractRows (gk_csr_t *mat, int nrows, int *rind)
 
gk_csr_tgk_csr_ExtractSubmatrix (gk_csr_t *mat, int rstart, int nrows)
 
void gk_csr_Free (gk_csr_t **mat)
 
void gk_csr_FreeContents (gk_csr_t *mat)
 
int gk_csr_GetSimilarRows (gk_csr_t *mat, int nqterms, int *qind, float *qval, int simtype, int nsim, float minsim, gk_fkv_t *hits, int *_imarker, gk_fkv_t *i_cand)
 
void gk_csr_Init (gk_csr_t *mat)
 
gk_csr_tgk_csr_LowFilter (gk_csr_t *mat, int what, int norm, float fraction)
 
void gk_csr_Normalize (gk_csr_t *mat, int what, int norm)
 
gk_csr_tgk_csr_Prune (gk_csr_t *mat, int what, int minf, int maxf)
 
gk_csr_tgk_csr_Read (char *filename, int format, int readvals, int numbering)
 
void gk_csr_Scale (gk_csr_t *mat, int type)
 
void gk_csr_SortIndices (gk_csr_t *mat, int what)
 
gk_csr_t ** gk_csr_Split (gk_csr_t *mat, int *color)
 
gk_csr_tgk_csr_TopKPlusFilter (gk_csr_t *mat, int what, int topk, float keepval)
 
void gk_csr_Write (gk_csr_t *mat, char *filename, int format, int writevals, int numbering)
 
gk_csr_tgk_csr_ZScoreFilter (gk_csr_t *mat, int what, float zscore)
 
int gk_dexists (char *)
 
int gk_dfkvkselect (size_t, int, gk_fkv_t *)
 
void gk_dkvsortd (size_t, gk_dkv_t *)
 
void gk_dkvsorti (size_t, gk_dkv_t *)
 
double * gk_dreadfilebin (char *fname, ssize_t *r_nelmnts)
 
void gk_dsortd (size_t, double *)
 
void gk_dsorti (size_t, double *)
 
void gk_errexit (int signum, char *,...)
 
void gk_fclose (FILE *)
 
int gk_fexists (char *)
 
void gk_find_frequent_itemsets (int ntrans, ssize_t *tranptr, int *tranind, int minfreq, int maxfreq, int minlen, int maxlen, void(*process_itemset)(void *stateptr, int nitems, int *itemind, int ntrans, int *tranind), void *stateptr)
 
void gk_fkvsortd (size_t, gk_fkv_t *)
 
void gk_fkvsorti (size_t, gk_fkv_t *)
 
float gk_flog2 (float)
 
FILE * gk_fopen (char *, char *, const char *)
 
float * gk_freadfilebin (char *fname, ssize_t *r_nelmnts)
 
void gk_free (void **ptr1,...)
 
void gk_FreeMatrix (void ***, size_t, size_t)
 
void gk_freepdbf (pdbf *p)
 Frees the memory of a pdbf structure. More...
 
void gk_freetokenslist (gk_Tokens_t *tokens)
 
void gk_fsortd (size_t, float *)
 
void gk_fsorti (size_t, float *)
 
size_t gk_fwritefilebin (char *fname, size_t n, float *a)
 
char * gk_getbasename (char *path)
 
size_t gk_GetCurMemoryUsed ()
 
char * gk_getextname (char *path)
 
char * gk_getfilename (char *path)
 
void gk_getfilestats (char *fname, size_t *r_nlines, size_t *r_ntokens, size_t *r_max_nlntokens, size_t *r_nbytes)
 
intmax_t gk_getfsize (char *)
 Returns the size of the file in bytes. More...
 
gk_idx_t gk_getline (char **lineptr, size_t *n, FILE *stream)
 
size_t gk_GetMaxMemoryUsed ()
 
char * gk_getpathname (char *path)
 
int gk_GetStringID (gk_StringMap_t *strmap, char *key)
 
void gk_gkmcoreAdd (gk_mcore_t *mcore, int type, size_t nbytes, void *ptr)
 
gk_mcore_tgk_gkmcoreCreate ()
 
void gk_gkmcoreDel (gk_mcore_t *mcore, void *ptr)
 
void gk_gkmcoreDestroy (gk_mcore_t **r_mcore, int showstats)
 
void gk_gkmcorePop (gk_mcore_t *mcore)
 
void gk_gkmcorePush (gk_mcore_t *mcore)
 
void gk_graph_ComputeBestFOrdering (gk_graph_t *graph, int v, int type, int32_t **r_perm, int32_t **r_iperm)
 
void gk_graph_ComputeBestFOrdering0 (gk_graph_t *graph, int v, int type, int32_t **r_perm, int32_t **r_iperm)
 
void gk_graph_ComputeBFSOrdering (gk_graph_t *graph, int v, int32_t **r_perm, int32_t **r_iperm)
 
gk_graph_tgk_graph_Create ()
 
gk_graph_tgk_graph_Dup (gk_graph_t *graph)
 
gk_graph_tgk_graph_ExtractSubgraph (gk_graph_t *graph, int vstart, int nvtxs)
 
int gk_graph_FindComponents (gk_graph_t *graph, int32_t *cptr, int32_t *cind)
 
void gk_graph_Free (gk_graph_t **graph)
 
void gk_graph_FreeContents (gk_graph_t *graph)
 
void gk_graph_Init (gk_graph_t *graph)
 
gk_graph_tgk_graph_Read (char *filename, int format, int isfewgts, int isfvwgts, int isfvsizes)
 
gk_graph_tgk_graph_Reorder (gk_graph_t *graph, int32_t *perm, int32_t *iperm)
 
void gk_graph_SingleSourceShortestPaths (gk_graph_t *graph, int v, void **r_sps)
 
void gk_graph_Write (gk_graph_t *graph, char *filename, int format)
 
gk_i2cc2i_tgk_i2cc2i_create_common (char *alphabet)
 This function creates the localizations for the various sequences. More...
 
void gk_i32kvsortd (size_t, gk_i32kv_t *)
 
void gk_i32kvsorti (size_t, gk_i32kv_t *)
 
int32_tgk_i32readfile (char *fname, gk_idx_t *r_nlines)
 
int32_tgk_i32readfilebin (char *fname, ssize_t *r_nelmnts)
 
void gk_i64kvsortd (size_t, gk_i64kv_t *)
 
void gk_i64kvsorti (size_t, gk_i64kv_t *)
 
int64_tgk_i64readfile (char *fname, gk_idx_t *r_nlines)
 
int64_tgk_i64readfilebin (char *fname, ssize_t *r_nelmnts)
 
void gk_idxkvsortd (size_t, gk_idxkv_t *)
 
void gk_idxkvsorti (size_t, gk_idxkv_t *)
 
void gk_idxsortd (size_t, gk_idx_t *)
 
void gk_idxsorti (size_t, gk_idx_t *)
 
int gk_ifkvkselect (size_t, int, gk_fkv_t *)
 
void gk_ikvsortd (size_t, gk_ikv_t *)
 
void gk_ikvsorti (size_t, gk_ikv_t *)
 
void gk_isortd (size_t, int *)
 
void gk_isorti (size_t, int *)
 
int gk_ispow2 (int)
 
int gk_log2 (int)
 
void * gk_malloc (size_t nbytes, char *msg)
 
void gk_malloc_cleanup (int showstats)
 
int gk_malloc_init ()
 
void gk_mcoreAdd (gk_mcore_t *mcore, int type, size_t nbytes, void *ptr)
 
gk_mcore_tgk_mcoreCreate (size_t coresize)
 
void gk_mcoreDel (gk_mcore_t *mcore, void *ptr)
 
void gk_mcoreDestroy (gk_mcore_t **r_mcore, int showstats)
 
void * gk_mcoreMalloc (gk_mcore_t *mcore, size_t nbytes)
 
void gk_mcorePop (gk_mcore_t *mcore)
 
void gk_mcorePush (gk_mcore_t *mcore)
 
int gk_mkpath (char *)
 
void gk_NonLocalExit_Handler (int signum)
 
void gk_randinit (uint64_t)
 
uint32_t gk_randint32 (void)
 
uint64_t gk_randint64 (void)
 
void gk_RandomPermute (size_t, int *, int)
 
char ** gk_readfile (char *fname, gk_idx_t *r_nlines)
 
pdbfgk_readpdbfile (char *fname)
 Reads a pdb file into a pdbf structure. More...
 
void * gk_realloc (void *oldptr, size_t nbytes, char *msg)
 
int gk_rmpath (char *)
 
int gk_rw_PageRank (gk_csr_t *mat, float lamda, float eps, int max_niter, float *pr)
 
void gk_seq_init (gk_seq_t *seq)
 
gk_seq_tgk_seq_ReadGKMODPSSM (char *file_name)
 This function reads a pssm in the format of gkmod pssm. More...
 
void gk_set_exit_on_error (int value)
 
void gk_SetSignalHandlers ()
 
void gk_showcorruption (pdbf *p)
 Decodes the corruption bitswitch and prints any problems. More...
 
void gk_sigthrow (int signum)
 
int gk_sigtrap ()
 
int gk_siguntrap ()
 
void gk_skvsortd (size_t, gk_skv_t *)
 
void gk_skvsorti (size_t, gk_skv_t *)
 
time_t gk_str2time (char *str)
 Converts a date/time string into its equivalent time_t value. More...
 
int gk_strcasecmp (char *s1, char *s2)
 Case insensitive string comparison. More...
 
char * gk_strchr_replace (char *str, char *fromlist, char *tolist)
 Replaces certain characters in a string. More...
 
char * gk_strdup (char *orgstr)
 Duplicates a string. More...
 
char * gk_strerror (int errnum)
 Thread-safe implementation of strerror() More...
 
char * gk_strhprune (char *, char *)
 Prunes characters from the beginning of the string. More...
 
int gk_strrcmp (char *s1, char *s2)
 Compare two strings in revere order. More...
 
int gk_strstr_replace (char *str, char *pattern, char *replacement, char *options, char **new_str)
 Regex-based search-and-replace function. More...
 
void gk_strtokenize (char *line, char *delim, gk_Tokens_t *tokens)
 
char * gk_strtolower (char *)
 Converts a string to lower case. More...
 
char * gk_strtoupper (char *)
 Converts a string to upper case. More...
 
char * gk_strtprune (char *, char *)
 Prunes characters from the end of the string. More...
 
char gk_threetoone (char *res)
 Converts three-letter amino acid codes to one-leter codes. More...
 
char * gk_time2str (time_t time)
 Converts a time_t time into a string. More...
 
void gk_UnsetSignalHandlers ()
 
gk_wclock_t gk_WClockSeconds (void)
 
void gk_writealphacarbons (pdbf *p, char *fname)
 Writes out all the alpha carbon atoms of a structure. More...
 
void gk_writebackbone (pdbf *p, char *fname)
 Writes out all the backbone atoms of a structure in pdb format. More...
 
void gk_writefullatom (pdbf *p, char *fname)
 Writes all atoms in p in pdb-format to file fname. More...
 
void gk_zkvsortd (size_t, gk_zkv_t *)
 
void gk_zkvsorti (size_t, gk_zkv_t *)
 
void GKDecodeBase64 (int nbytes, unsigned char *inbuffer, unsigned char *outbuffer)
 
void GKEncodeBase64 (int nbytes, unsigned char *inbuffer, unsigned char *outbuffer)
 
gk_HTable_tHTable_Create (int nelements)
 
void HTable_Delete (gk_HTable_t *htable, int key)
 
void HTable_Destroy (gk_HTable_t *htable)
 
int HTable_GetNext (gk_HTable_t *htable, int key, int *val, int type)
 
int HTable_HFunction (int nelements, int key)
 
void HTable_Insert (gk_HTable_t *htable, int key, int val)
 
void HTable_Reset (gk_HTable_t *htable)
 
void HTable_Resize (gk_HTable_t *htable, int nelements)
 
int HTable_Search (gk_HTable_t *htable, int key)
 
int HTable_SearchAndDelete (gk_HTable_t *htable, int key)
 
int omp_get_dynamic (void)
 
int omp_get_max_threads (void)
 
int omp_get_nested (void)
 
int omp_get_num_procs (void)
 
int omp_get_num_threads (void)
 
int omp_get_thread_num (void)
 
int omp_in_parallel (void)
 
void omp_set_dynamic (int num_threads)
 
void omp_set_nested (int nested)
 
void omp_set_num_threads (int num_threads)
 
void PrintBackTrace ()
 

Detailed Description

This file contains function prototypes.

Date
Started 3/27/2007
Author
George
Version
$Id: gk_proto.h 12591 2012-09-01 19:03:15Z karypis $ 

Definition in file gk_proto.h.

Function Documentation

◆ ComputeAccuracy()

float ComputeAccuracy ( int  n,
gk_fkv_t *  list 
)

Definition at line 16 of file evaluate.c.

◆ ComputeMean()

float ComputeMean ( int  n,
float *  values 
)

Definition at line 107 of file evaluate.c.

◆ ComputeMedianRFP()

float ComputeMedianRFP ( int  n,
gk_fkv_t *  list 
)

Definition at line 81 of file evaluate.c.

◆ ComputeROCn()

float ComputeROCn ( int  n,
int  maxN,
gk_fkv_t *  list 
)

Definition at line 47 of file evaluate.c.

◆ ComputeStdDev()

float ComputeStdDev ( int  n,
float *  values 
)

Definition at line 121 of file evaluate.c.

◆ decodeblock()

void decodeblock ( unsigned char *  in,
unsigned char *  out 
)

Definition at line 46 of file b64.c.

◆ encodeblock()

void encodeblock ( unsigned char *  in,
unsigned char *  out 
)

Definition at line 28 of file b64.c.

◆ errexit()

void errexit ( char *  f_str,
  ... 
)

This function prints an error message and exits

Definition at line 53 of file error.c.

◆ gk_AllocMatrix()

void gk_AllocMatrix ( void ***  r_matrix,
size_t  elmlen,
size_t  ndim1,
size_t  ndim2 
)

Define the set of memory allocation routines for each data type

This function allocates a two-dimensional matrix.

Definition at line 53 of file memory.c.

◆ gk_array2csr()

void gk_array2csr ( size_t  n,
size_t  range,
int array,
int ptr,
int ind 
)

Converts an element-based set membership into a CSR-format set-based membership.

For example, it takes an array such as part[] that stores where each element belongs to and returns a pair of arrays (pptr[], pind[]) that store in CSF format the list of elements belonging in each partition.

Parameters
n
the number of elements in the array (e.g., # of vertices)
range
the cardinality of the set (e.g., # of partitions)
arraythe array that stores the per-element set membership
ptrthe array that will store the starting indices in ind for the elements of each set. This is filled by the routine and its size should be at least range+1.
indthe array that stores consecutively which elements belong to each set. The size of this array should be n.

Definition at line 62 of file GKlib/util.c.

◆ gk_ckvsortd()

void gk_ckvsortd ( size_t  n,
gk_ckv_t *  base 
)

Sorts an array of gk_ckv_t in decreasing order

Definition at line 146 of file sort.c.

◆ gk_ckvsorti()

void gk_ckvsorti ( size_t  n,
gk_ckv_t *  base 
)

Sorts an array of gk_ckv_t in increasing order

Definition at line 135 of file sort.c.

◆ gk_CPUSeconds()

double gk_CPUSeconds ( void  )

Definition at line 36 of file timers.c.

◆ gk_csortd()

void gk_csortd ( size_t  n,
char *  base 
)

Sorts an array of chars in decreasing order

Definition at line 34 of file sort.c.

◆ gk_csorti()

void gk_csorti ( size_t  n,
char *  base 
)

Sorts an array of chars in increasing order

Definition at line 23 of file sort.c.

◆ gk_csr_CompactColumns()

void gk_csr_CompactColumns ( gk_csr_t mat)

Compacts the column-space of the matrix by removing empty columns. As a result of the compaction, the column numbers are renumbered. The compaction operation is done in place and only affects the row-based representation of the matrix. The new columns are ordered in decreasing frequency.

Parameters
matthe matrix whose empty columns will be removed.

Definition at line 1098 of file csr.c.

◆ gk_csr_ComputeSimilarity()

float gk_csr_ComputeSimilarity ( gk_csr_t mat,
int  i1,
int  i2,
int  what,
int  simtype 
)

Computes the similarity between two rows/columns

Parameters
matthe matrix itself. The routine assumes that the indices are sorted in increasing order.
i1is the first row/column,
i2is the second row/column,
whatis either GK_CSR_ROW or GK_CSR_COL indicating the type of objects between the similarity will be computed,
simtypeis the type of similarity and is one of GK_CSR_COS, GK_CSR_JAC, GK_CSR_MIN, GK_CSR_AMIN
Returns
the similarity between the two rows/columns.

Definition at line 1694 of file csr.c.

◆ gk_csr_ComputeSquaredNorms()

void gk_csr_ComputeSquaredNorms ( gk_csr_t mat,
int  what 
)

Computes the squared of the norms of the rows/columns

Parameters
matthe matrix itself,
whatis either GK_CSR_ROW or GK_CSR_COL indicating which squared norms to compute.

Definition at line 1643 of file csr.c.

◆ gk_csr_ComputeSums()

void gk_csr_ComputeSums ( gk_csr_t mat,
int  what 
)

Computes the sums of the rows/columns

Parameters
matthe matrix itself,
whatis either GK_CSR_ROW or GK_CSR_COL indicating which sums to compute.

Definition at line 1597 of file csr.c.

◆ gk_csr_Create()

gk_csr_t* gk_csr_Create ( )

Allocate memory for a CSR matrix and initializes it

Returns
the allocated matrix. The various fields are set to NULL.

Definition at line 19 of file csr.c.

◆ gk_csr_CreateIndex()

void gk_csr_CreateIndex ( gk_csr_t mat,
int  what 
)

Creates a row/column index from the column/row data.

Parameters
matthe matrix itself,
whatis either GK_CSR_ROW or GK_CSR_COL indicating which index will be created.

Definition at line 1223 of file csr.c.

◆ gk_csr_Dup()

gk_csr_t* gk_csr_Dup ( gk_csr_t mat)

Returns a copy of a matrix.

Parameters
matis the matrix to be duplicated.
Returns
the newly created copy of the matrix.

Definition at line 80 of file csr.c.

◆ gk_csr_ExtractPartition()

gk_csr_t* gk_csr_ExtractPartition ( gk_csr_t mat,
int part,
int  pid 
)

Returns a submatrix corresponding to a specified partitioning of rows.

Parameters
matis the original matrix.
partis the partitioning vector of the rows.
pidis the partition ID that will be extracted.
Returns
the row structure of the newly created submatrix.

Definition at line 230 of file csr.c.

◆ gk_csr_ExtractRows()

gk_csr_t* gk_csr_ExtractRows ( gk_csr_t mat,
int  nrows,
int rind 
)

Returns a submatrix containing a certain set of rows.

Parameters
matis the original matrix.
nrowsis the number of rows to extract.
rindis the set of row numbers to extract.
Returns
the row structure of the newly created submatrix.

Definition at line 191 of file csr.c.

◆ gk_csr_ExtractSubmatrix()

gk_csr_t* gk_csr_ExtractSubmatrix ( gk_csr_t mat,
int  rstart,
int  nrows 
)

Returns a submatrix containint a set of consecutive rows.

Parameters
matis the original matrix.
rstartis the starting row.
nrowsis the number of rows from rstart to extract.
Returns
the row structure of the newly created submatrix.

Definition at line 135 of file csr.c.

◆ gk_csr_Free()

void gk_csr_Free ( gk_csr_t **  mat)

Frees all the memory allocated for matrix.

Parameters
matis the matrix to be freed.

Definition at line 48 of file csr.c.

◆ gk_csr_FreeContents()

void gk_csr_FreeContents ( gk_csr_t mat)

Frees only the memory allocated for the matrix's different fields and sets them to NULL.

Parameters
matis the matrix whose contents will be freed.

Definition at line 63 of file csr.c.

◆ gk_csr_GetSimilarRows()

int gk_csr_GetSimilarRows ( gk_csr_t mat,
int  nqterms,
int qind,
float *  qval,
int  simtype,
int  nsim,
float  minsim,
gk_fkv_t *  hits,
int i_marker,
gk_fkv_t *  i_cand 
)

Finds the n most similar rows (neighbors) to the query using cosine similarity.

Parameters
matthe matrix itself
nqtermsis the number of columns in the query
qindis the list of query columns
qvalis the list of correspodning query weights
simtypeis the type of similarity and is one of GK_CSR_COS, GK_CSR_JAC, GK_CSR_MIN, GK_CSR_AMIN
nsimis the maximum number of requested most similar rows. If -1 is provided, then everything is returned unsorted.
minsimis the minimum similarity of the requested most similar rows
hitsis the result set. This array should be at least of length nsim.
i_markeris an array of size equal to the number of rows whose values are initialized to -1. If NULL is provided then this array is allocated and freed internally.
i_candis an array of size equal to the number of rows. If NULL is provided then this array is allocated and freed internally.
Returns
the number of identified most similar rows, which can be smaller than the requested number of nnbrs in those cases in which there are no sufficiently many neighbors.

Definition at line 1866 of file csr.c.

◆ gk_csr_Init()

void gk_csr_Init ( gk_csr_t mat)

Initializes the matrix

Parameters
matis the matrix to be initialized.

Definition at line 36 of file csr.c.

◆ gk_csr_LowFilter()

gk_csr_t* gk_csr_LowFilter ( gk_csr_t mat,
int  what,
int  norm,
float  fraction 
)

Eliminates certain entries from the rows/columns of the matrix. The filtering takes place by keeping only the highest weight entries whose sum accounts for a certain fraction of the overall weight of the row/column.

Parameters
matthe matrix to be prunned,
whatindicates if the rows (GK_CSR_ROW) or the columns (GK_CSR_COL) of the matrix will be prunned,
normindicates the norm that will be used to aggregate the weights and possible values are 1 or 2,
fractionis the fraction of the overall norm that will be retained by the kept entries.
Returns
the filtered matrix consisting only of its row-based structure. The input matrix is not modified.

Definition at line 759 of file csr.c.

◆ gk_csr_Normalize()

void gk_csr_Normalize ( gk_csr_t mat,
int  what,
int  norm 
)

Normalizes the rows/columns of the matrix to be unit length.

Parameters
matthe matrix itself,
whatindicates what will be normalized and is obtained by specifying GK_CSR_ROW, GK_CSR_COL, GK_CSR_ROW|GK_CSR_COL.
normindicates what norm is to normalize to, 1: 1-norm, 2: 2-norm

Definition at line 1319 of file csr.c.

◆ gk_csr_Prune()

gk_csr_t* gk_csr_Prune ( gk_csr_t mat,
int  what,
int  minf,
int  maxf 
)

Prunes certain rows/columns of the matrix. The prunning takes place by analyzing the row structure of the matrix. The prunning takes place by removing rows/columns but it does not affect the numbering of the remaining rows/columns.

Parameters
matthe matrix to be prunned,
whatindicates if the rows (GK_CSR_ROW) or the columns (GK_CSR_COL) of the matrix will be prunned,
minfis the minimum number of rows (columns) that a column (row) must be present in order to be kept,
maxfis the maximum number of rows (columns) that a column (row) must be present at in order to be kept.
Returns
the prunned matrix consisting only of its row-based structure. The input matrix is not modified.

Definition at line 669 of file csr.c.

◆ gk_csr_Read()

gk_csr_t* gk_csr_Read ( char *  filename,
int  format,
int  readvals,
int  numbering 
)

Reads a CSR matrix from the supplied file and stores it the matrix's forward structure.

Parameters
filenameis the file that stores the data.
formatis either GK_CSR_FMT_METIS, GK_CSR_FMT_CLUTO, GK_CSR_FMT_CSR, GK_CSR_FMT_BINROW, GK_CSR_FMT_BINCOL specifying the type of the input format. The GK_CSR_FMT_CSR does not contain a header line, whereas the GK_CSR_FMT_BINROW is a binary format written by gk_csr_Write() using the same format specifier.
readvalsis either 1 or 0, indicating if the CSR file contains values or it does not. It only applies when GK_CSR_FMT_CSR is used.
numberingis either 1 or 0, indicating if the numbering of the indices start from 1 or 0, respectively. If they start from 1, they are automatically decreamented during input so that they will start from 0. It only applies when GK_CSR_FMT_CSR is used.
Returns
the matrix that was read.

Definition at line 349 of file csr.c.

◆ gk_csr_Scale()

void gk_csr_Scale ( gk_csr_t mat,
int  type 
)

Applies different row scaling methods.

Parameters
matthe matrix itself,
typeindicates the type of row scaling. Possible values are: GK_CSR_MAXTF, GK_CSR_SQRT, GK_CSR_LOG, GK_CSR_IDF, GK_CSR_MAXTF2.

Definition at line 1386 of file csr.c.

◆ gk_csr_SortIndices()

void gk_csr_SortIndices ( gk_csr_t mat,
int  what 
)

Sorts the indices in increasing order

Parameters
matthe matrix itself,
whatis either GK_CSR_ROW or GK_CSR_COL indicating which set of indices to sort.

Definition at line 1146 of file csr.c.

◆ gk_csr_Split()

gk_csr_t** gk_csr_Split ( gk_csr_t mat,
int color 
)

Splits the matrix into multiple sub-matrices based on the provided color array.

Parameters
matis the original matrix.
coloris an array of size equal to the number of non-zeros in the matrix (row-wise structure). The matrix is split into as many parts as the number of colors. For meaningfull results, the colors should be numbered consecutively starting from 0.
Returns
an array of matrices for each supplied color number.

Definition at line 277 of file csr.c.

◆ gk_csr_TopKPlusFilter()

gk_csr_t* gk_csr_TopKPlusFilter ( gk_csr_t mat,
int  what,
int  topk,
float  keepval 
)

Eliminates certain entries from the rows/columns of the matrix. The filtering takes place by keeping only the highest weight top-K entries along each row/column and those entries whose weight is greater than a specified value.

Parameters
matthe matrix to be prunned,
whatindicates if the rows (GK_CSR_ROW) or the columns (GK_CSR_COL) of the matrix will be prunned,
topkis the number of the highest weight entries to keep.
keepvalis the weight of a term above which will be kept. This is used to select additional terms past the first topk.
Returns
the filtered matrix consisting only of its row-based structure. The input matrix is not modified.

Definition at line 901 of file csr.c.

◆ gk_csr_Write()

void gk_csr_Write ( gk_csr_t mat,
char *  filename,
int  format,
int  writevals,
int  numbering 
)

Writes the row-based structure of a matrix into a file.

Parameters
matis the matrix to be written,
filenameis the name of the output file.
formatis one of: GK_CSR_FMT_CLUTO, GK_CSR_FMT_CSR, GK_CSR_FMT_BINROW, GK_CSR_FMT_BINCOL.
writevalsis either 1 or 0 indicating if the values will be written or not. This is only applicable when GK_CSR_FMT_CSR is used.
numberingis either 1 or 0 indicating if the internal 0-based numbering will be shifted by one or not during output. This is only applicable when GK_CSR_FMT_CSR is used.

Definition at line 591 of file csr.c.

◆ gk_csr_ZScoreFilter()

gk_csr_t* gk_csr_ZScoreFilter ( gk_csr_t mat,
int  what,
float  zscore 
)

Eliminates certain entries from the rows/columns of the matrix. The filtering takes place by keeping only the terms whose contribution to the total length of the document is greater than a user-splied multiple over the average.

This routine assumes that the vectors are normalized to be unit length.

Parameters
matthe matrix to be prunned,
whatindicates if the rows (GK_CSR_ROW) or the columns (GK_CSR_COL) of the matrix will be prunned,
zscoreis the multiplicative factor over the average contribution to the length of the document.
Returns
the filtered matrix consisting only of its row-based structure. The input matrix is not modified.

Definition at line 1031 of file csr.c.

◆ gk_dexists()

int gk_dexists ( char *  )

Definition at line 35 of file fs.c.

◆ gk_dfkvkselect()

int gk_dfkvkselect ( size_t  n,
int  topk,
gk_fkv_t *  cand 
)

This function puts the 'topk' largest values in the beginning of the array

Definition at line 20 of file fkvkselect.c.

◆ gk_dkvsortd()

void gk_dkvsortd ( size_t  n,
gk_dkv_t *  base 
)

Sorts an array of gk_fkv_t in decreasing order

Definition at line 278 of file sort.c.

◆ gk_dkvsorti()

void gk_dkvsorti ( size_t  n,
gk_dkv_t *  base 
)

Sorts an array of gk_dkv_t in increasing order

Definition at line 267 of file sort.c.

◆ gk_dreadfilebin()

double* gk_dreadfilebin ( char *  fname,
ssize_t r_nelmnts 
)

This function reads the contents of a binary file and returns it in the form of an array of double.

Parameters
fnameis the name of the file
r_nlinesis the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 354 of file GKlib/io.c.

◆ gk_dsortd()

void gk_dsortd ( size_t  n,
double *  base 
)

Sorts an array of doubles in decreasing order

Definition at line 100 of file sort.c.

◆ gk_dsorti()

void gk_dsorti ( size_t  n,
double *  base 
)

Sorts an array of doubles in increasing order

Definition at line 89 of file sort.c.

◆ gk_errexit()

void gk_errexit ( int  signum,
char *  f_str,
  ... 
)

This function prints an error message and raises a signum signal

Definition at line 76 of file error.c.

◆ gk_fclose()

void gk_fclose ( FILE *  )

Definition at line 44 of file GKlib/io.c.

◆ gk_fexists()

int gk_fexists ( char *  )

Definition at line 21 of file fs.c.

◆ gk_find_frequent_itemsets()

void gk_find_frequent_itemsets ( int  ntrans,
ssize_t tranptr,
int tranind,
int  minfreq,
int  maxfreq,
int  minlen,
int  maxlen,
void(*)(void *stateptr, int nitems, int *itemind, int ntrans, int *tranind)  process_itemset,
void *  stateptr 
)

◆ gk_fkvsortd()

void gk_fkvsortd ( size_t  n,
gk_fkv_t *  base 
)

Sorts an array of gk_fkv_t in decreasing order

Definition at line 256 of file sort.c.

◆ gk_fkvsorti()

void gk_fkvsorti ( size_t  n,
gk_fkv_t *  base 
)

Sorts an array of gk_fkv_t in increasing order

Definition at line 245 of file sort.c.

◆ gk_flog2()

float gk_flog2 ( float  )

Definition at line 104 of file GKlib/util.c.

◆ gk_fopen()

FILE* gk_fopen ( char *  ,
char *  ,
const char *   
)

Definition at line 24 of file GKlib/io.c.

◆ gk_freadfilebin()

float* gk_freadfilebin ( char *  fname,
ssize_t r_nelmnts 
)

This function reads the contents of a binary file and returns it in the form of an array of float.

Parameters
fnameis the name of the file
r_nlinesis the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 292 of file GKlib/io.c.

◆ gk_free()

void gk_free ( void **  ptr1,
  ... 
)

Definition at line 202 of file memory.c.

◆ gk_FreeMatrix()

void gk_FreeMatrix ( void ***  r_matrix,
size_t  ndim1,
size_t  ndim2 
)

This function frees a two-dimensional matrix.

Definition at line 79 of file memory.c.

◆ gk_freepdbf()

void gk_freepdbf ( pdbf p)

Frees the memory of a pdbf structure.

This function takes a pdbf pointer and frees all the memory below it.

Parameters
pis the pdbf structure to be freed.

Definition at line 105 of file pdb.c.

◆ gk_freetokenslist()

void gk_freetokenslist ( gk_Tokens_t tokens)

Definition at line 73 of file tokenizer.c.

◆ gk_fsortd()

void gk_fsortd ( size_t  n,
float *  base 
)

Sorts an array of floats in decreasing order

Definition at line 78 of file sort.c.

◆ gk_fsorti()

void gk_fsorti ( size_t  n,
float *  base 
)

Sorts an array of floats in increasing order

Definition at line 67 of file sort.c.

◆ gk_fwritefilebin()

size_t gk_fwritefilebin ( char *  fname,
size_t  n,
float *  a 
)

This function writes the contents of an array into a binary file.

Parameters
fnameis the name of the file
nthe number of elements in the array.
athe array to be written out.

Definition at line 331 of file GKlib/io.c.

◆ gk_getbasename()

char* gk_getbasename ( char *  path)

Definition at line 135 of file fs.c.

◆ gk_GetCurMemoryUsed()

size_t gk_GetCurMemoryUsed ( )

Definition at line 233 of file memory.c.

◆ gk_getextname()

char* gk_getextname ( char *  path)

Definition at line 159 of file fs.c.

◆ gk_getfilename()

char* gk_getfilename ( char *  path)

Definition at line 173 of file fs.c.

◆ gk_getfilestats()

void gk_getfilestats ( char *  fname,
size_t r_nlines,
size_t r_ntokens,
size_t r_max_nlntokens,
size_t r_nbytes 
)

This function gets some basic statistics about the file.

Parameters
fnameis the name of the file
r_nlinesis the number of lines in the file. If it is NULL, this information is not returned.
r_ntokensis the number of tokens in the file. If it is NULL, this information is not returned.
r_max_nlntokensis the maximum number of tokens in any line in the file. If it is NULL this information is not returned.
r_nbytesis the number of bytes in the file. If it is NULL, this information is not returned.

Definition at line 79 of file fs.c.

◆ gk_getfsize()

intmax_t gk_getfsize ( char *  filename)

Returns the size of the file in bytes.

This function returns the size of a file as a 64 bit integer. If there were any errors in stat'ing the file, -1 is returned.

Note
That due to the -1 return code, the maximum file size is limited to 63 bits (which I guess is okay for now).

Definition at line 55 of file fs.c.

◆ gk_getline()

gk_idx_t gk_getline ( char **  lineptr,
size_t n,
FILE *  stream 
)

This function is the GKlib implementation of glibc's getline() function.

Returns
-1 if the EOF has been reached, otherwise it returns the number of bytes read.

Definition at line 57 of file GKlib/io.c.

◆ gk_GetMaxMemoryUsed()

size_t gk_GetMaxMemoryUsed ( )

Definition at line 246 of file memory.c.

◆ gk_getpathname()

char* gk_getpathname ( char *  path)

◆ gk_GetStringID()

int gk_GetStringID ( gk_StringMap_t strmap,
char *  key 
)

Definition at line 519 of file string.c.

◆ gk_gkmcoreAdd()

void gk_gkmcoreAdd ( gk_mcore_t mcore,
int  type,
size_t  nbytes,
void *  ptr 
)

Adds a memory allocation at the end of the list. This is the gkmcore version.

Definition at line 309 of file mcore.c.

◆ gk_gkmcoreCreate()

gk_mcore_t* gk_gkmcoreCreate ( )

This function creates an mcore. This version is used for gkmcore.

Definition at line 43 of file mcore.c.

◆ gk_gkmcoreDel()

void gk_gkmcoreDel ( gk_mcore_t mcore,
void *  ptr 
)

This function deletes the mop associated with the supplied pointer. The mop has to be a heap allocation, otherwise it fails violently. This is the gkmcore version.

Definition at line 373 of file mcore.c.

◆ gk_gkmcoreDestroy()

void gk_gkmcoreDestroy ( gk_mcore_t **  r_mcore,
int  showstats 
)

This function destroys an mcore. This version is for gkmcore.

Definition at line 103 of file mcore.c.

◆ gk_gkmcorePop()

void gk_gkmcorePop ( gk_mcore_t mcore)

This function frees all mops since the last push. This version is for poping the gkmcore and it uses free instead of gk_free.

Definition at line 237 of file mcore.c.

◆ gk_gkmcorePush()

void gk_gkmcorePush ( gk_mcore_t mcore)

This function sets a marker in the stack of malloc ops to be used subsequently for freeing purposes. This is the gkmcore version.

Definition at line 187 of file mcore.c.

◆ gk_graph_ComputeBestFOrdering()

void gk_graph_ComputeBestFOrdering ( gk_graph_t graph,
int  v,
int  type,
int32_t **  r_perm,
int32_t **  r_iperm 
)

This function computes a permutation of the vertices based on a best-first-traversal. It can be used for re-ordering the graph to reduce its bandwidth for better cache locality.

Parameters
[IN]graph is the graph structure.
[IN]v is the starting vertex of the best-first traversal.
[IN]type indicates the criteria to use to measure the 'bestness' of a vertex.
[OUT]perm[i] stores the ID of vertex i in the re-ordered graph.
[OUT]iperm[i] stores the ID of the vertex that corresponds to the ith vertex in the re-ordered graph.
Note
The perm or iperm (but not both) can be NULL, at which point, the corresponding arrays are not returned. Though the program works fine when both are NULL, doing that is not smart. The returned arrays should be freed with gk_free().

Definition at line 887 of file GKlib/graph.c.

◆ gk_graph_ComputeBestFOrdering0()

void gk_graph_ComputeBestFOrdering0 ( gk_graph_t graph,
int  v,
int  type,
int32_t **  r_perm,
int32_t **  r_iperm 
)

This function computes a permutation of the vertices based on a best-first-traversal. It can be used for re-ordering the graph to reduce its bandwidth for better cache locality.

Parameters
[IN]graph is the graph structure.
[IN]v is the starting vertex of the best-first traversal.
[IN]type indicates the criteria to use to measure the 'bestness' of a vertex.
[OUT]perm[i] stores the ID of vertex i in the re-ordered graph.
[OUT]iperm[i] stores the ID of the vertex that corresponds to the ith vertex in the re-ordered graph.
Note
The perm or iperm (but not both) can be NULL, at which point, the corresponding arrays are not returned. Though the program works fine when both are NULL, doing that is not smart. The returned arrays should be freed with gk_free().

Definition at line 762 of file GKlib/graph.c.

◆ gk_graph_ComputeBFSOrdering()

void gk_graph_ComputeBFSOrdering ( gk_graph_t graph,
int  v,
int32_t **  r_perm,
int32_t **  r_iperm 
)

This function computes a permutation of the vertices based on a breadth-first-traversal. It can be used for re-ordering the graph to reduce its bandwidth for better cache locality. The algorithm used is a simplified version of the method used to find the connected components.

Parameters
[IN]graph is the graph structure
[IN]v is the starting vertex of the BFS
[OUT]perm[i] stores the ID of vertex i in the re-ordered graph.
[OUT]iperm[i] stores the ID of the vertex that corresponds to the ith vertex in the re-ordered graph.
Note
The perm or iperm (but not both) can be NULL, at which point, the corresponding arrays are not returned. Though the program works fine when both are NULL, doing that is not smart. The returned arrays should be freed with gk_free().

Definition at line 665 of file GKlib/graph.c.

◆ gk_graph_Create()

gk_graph_t* gk_graph_Create ( )

Allocate memory for a graph and initializes it

Returns
the allocated graph. The various fields are set to NULL.

Definition at line 19 of file GKlib/graph.c.

◆ gk_graph_Dup()

gk_graph_t* gk_graph_Dup ( gk_graph_t graph)

Returns a copy of a graph.

Parameters
graphis the graph to be duplicated.
Returns
the newly created copy of the graph.

Definition at line 340 of file GKlib/graph.c.

◆ gk_graph_ExtractSubgraph()

gk_graph_t* gk_graph_ExtractSubgraph ( gk_graph_t graph,
int  vstart,
int  nvtxs 
)

Returns a subgraph containing a set of consecutive vertices.

Parameters
graphis the original graph.
vstartis the starting vertex.
nvtxsis the number of vertices from vstart to extract.
Returns
the newly created subgraph.

Definition at line 391 of file GKlib/graph.c.

◆ gk_graph_FindComponents()

int gk_graph_FindComponents ( gk_graph_t graph,
int32_t cptr,
int32_t cind 
)

This function finds the connected components in a graph.

Parameters
graphis the graph structure
cptris the ptr structure of the CSR representation of the components. The length of this vector must be graph->nvtxs+1.
cindis the indices structure of the CSR representation of the components. The length of this vector must be graph->nvtxs.
Returns
the number of components that it found.
Note
The cptr and cind parameters can be NULL, in which case only the number of connected components is returned.

Definition at line 572 of file GKlib/graph.c.

◆ gk_graph_Free()

void gk_graph_Free ( gk_graph_t **  graph)

Frees all the memory allocated for a graph.

Parameters
graphis the graph to be freed.

Definition at line 48 of file GKlib/graph.c.

◆ gk_graph_FreeContents()

void gk_graph_FreeContents ( gk_graph_t graph)

Frees only the memory allocated for the graph's different fields and sets them to NULL.

Parameters
graphis the graph whose contents will be freed.

Definition at line 63 of file GKlib/graph.c.

◆ gk_graph_Init()

void gk_graph_Init ( gk_graph_t graph)

Initializes the graph.

Parameters
graphis the graph to be initialized.

Definition at line 36 of file GKlib/graph.c.

◆ gk_graph_Read()

gk_graph_t* gk_graph_Read ( char *  filename,
int  format,
int  isfewgts,
int  isfvwgts,
int  isfvsizes 
)

Reads a sparse graph from the supplied file

Parameters
filenameis the file that stores the data.
formatis the graph format. The supported values are: GK_GRAPH_FMT_METIS.
isfewgtsis 1 if the edge-weights should be read as floats
isfvwgtsis 1 if the vertex-weights should be read as floats
isfvsizesis 1 if the vertex-sizes should be read as floats
Returns
the graph that was read.

Definition at line 85 of file GKlib/graph.c.

◆ gk_graph_Reorder()

gk_graph_t* gk_graph_Reorder ( gk_graph_t graph,
int32_t perm,
int32_t iperm 
)

Returns a graph that has been reordered according to the permutation.

Parameters
[IN]graph is the graph to be re-ordered.
[IN]perm is the new ordering of the graph's vertices
[IN]iperm is the original ordering of the re-ordered graph's vertices
Returns
the newly created copy of the graph.
Note
Either perm or iperm can be NULL but not both.

Definition at line 460 of file GKlib/graph.c.

◆ gk_graph_SingleSourceShortestPaths()

void gk_graph_SingleSourceShortestPaths ( gk_graph_t graph,
int  v,
void **  r_sps 
)

This function computes the single-source shortest path lengths from the root node to all the other nodes in the graph. If the graph is not connected then, the sortest part to the vertices in the other components is -1.

Parameters
[IN]graph is the graph structure.
[IN]v is the root of the single-source shortest path computations.
[IN]type indicates the criteria to use to measure the 'bestness' of a vertex.
[OUT]sps[i] stores the length of the shortest path from v to vertex i. If no such path exists, then it is -1. Note that the returned array will be either an array of int32_t or an array of floats. The specific type is determined by the existance of non NULL iadjwgt and fadjwgt arrays. If both of these arrays exist, then priority is given to iadjwgt.
Note
The returned array should be freed with gk_free().

Definition at line 1084 of file GKlib/graph.c.

◆ gk_graph_Write()

void gk_graph_Write ( gk_graph_t graph,
char *  filename,
int  format 
)

Writes a graph into a file.

Parameters
graphis the graph to be written,
filenameis the name of the output file.
formatis one of GK_GRAPH_FMT_METIS specifying the format of the output file.

Definition at line 277 of file GKlib/graph.c.

◆ gk_i2cc2i_create_common()

gk_i2cc2i_t* gk_i2cc2i_create_common ( char *  alphabet)

This function creates the localizations for the various sequences.

Parameters
stringi.e amino acids, nucleotides, sequences
Returns
gk_i2cc2i_t variable

Definition at line 48 of file seq.c.

◆ gk_i32kvsortd()

void gk_i32kvsortd ( size_t  n,
gk_i32kv_t *  base 
)

Sorts an array of gk_i32kv_t in decreasing order

Definition at line 190 of file sort.c.

◆ gk_i32kvsorti()

void gk_i32kvsorti ( size_t  n,
gk_i32kv_t *  base 
)

Sorts an array of gk_i32kv_t in increasing order

Definition at line 179 of file sort.c.

◆ gk_i32readfile()

int32_t* gk_i32readfile ( char *  fname,
gk_idx_t r_nlines 
)

This function reads the contents of a file and returns it in the form of an array of int32_t.

Parameters
fnameis the name of the file
r_nlinesis the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 139 of file GKlib/io.c.

◆ gk_i32readfilebin()

int32_t* gk_i32readfilebin ( char *  fname,
ssize_t r_nelmnts 
)

This function reads the contents of a binary file and returns it in the form of an array of int32_t.

Parameters
fnameis the name of the file
r_nlinesis the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 214 of file GKlib/io.c.

◆ gk_i64kvsortd()

void gk_i64kvsortd ( size_t  n,
gk_i64kv_t *  base 
)

Sorts an array of gk_i64kv_t in decreasing order

Definition at line 212 of file sort.c.

◆ gk_i64kvsorti()

void gk_i64kvsorti ( size_t  n,
gk_i64kv_t *  base 
)

Sorts an array of gk_i64kv_t in increasing order

Definition at line 201 of file sort.c.

◆ gk_i64readfile()

int64_t* gk_i64readfile ( char *  fname,
gk_idx_t r_nlines 
)

This function reads the contents of a file and returns it in the form of an array of int64_t.

Parameters
fnameis the name of the file
r_nlinesis the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 177 of file GKlib/io.c.

◆ gk_i64readfilebin()

int64_t* gk_i64readfilebin ( char *  fname,
ssize_t r_nelmnts 
)

This function reads the contents of a binary file and returns it in the form of an array of int64_t.

Parameters
fnameis the name of the file
r_nlinesis the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 253 of file GKlib/io.c.

◆ gk_idxkvsortd()

void gk_idxkvsortd ( size_t  n,
gk_idxkv_t *  base 
)

Sorts an array of gk_idxkv_t in decreasing order

Definition at line 322 of file sort.c.

◆ gk_idxkvsorti()

void gk_idxkvsorti ( size_t  n,
gk_idxkv_t *  base 
)

Sorts an array of gk_idxkv_t in increasing order

Definition at line 311 of file sort.c.

◆ gk_idxsortd()

void gk_idxsortd ( size_t  n,
gk_idx_t base 
)

Sorts an array of gk_idx_t in decreasing order

Definition at line 122 of file sort.c.

◆ gk_idxsorti()

void gk_idxsorti ( size_t  n,
gk_idx_t base 
)

Sorts an array of gk_idx_t in increasing order

Definition at line 111 of file sort.c.

◆ gk_ifkvkselect()

int gk_ifkvkselect ( size_t  n,
int  topk,
gk_fkv_t *  cand 
)

This function puts the 'topk' smallest values in the beginning of the array

Definition at line 84 of file fkvkselect.c.

◆ gk_ikvsortd()

void gk_ikvsortd ( size_t  n,
gk_ikv_t *  base 
)

Sorts an array of gk_ikv_t in decreasing order

Definition at line 168 of file sort.c.

◆ gk_ikvsorti()

void gk_ikvsorti ( size_t  n,
gk_ikv_t *  base 
)

Sorts an array of gk_ikv_t in increasing order

Definition at line 157 of file sort.c.

◆ gk_isortd()

void gk_isortd ( size_t  n,
int base 
)

Sorts an array of integers in decreasing order

Definition at line 56 of file sort.c.

◆ gk_isorti()

void gk_isorti ( size_t  n,
int base 
)

Sorts an array of integers in increasing order

Definition at line 45 of file sort.c.

◆ gk_ispow2()

int gk_ispow2 ( int  )

Definition at line 95 of file GKlib/util.c.

◆ gk_log2()

int gk_log2 ( int  )

Definition at line 83 of file GKlib/util.c.

◆ gk_malloc()

void* gk_malloc ( size_t  nbytes,
char *  msg 
)

This function is my wrapper around malloc that provides the following enhancements over malloc: It always allocates one byte of memory, even if 0 bytes are requested. This is to ensure that checks of returned values do not lead to NULL due to 0 bytes requested. It zeros-out the memory that is allocated. This is for a quick init of the underlying datastructures.

Definition at line 140 of file memory.c.

◆ gk_malloc_cleanup()

void gk_malloc_cleanup ( int  showstats)

This function frees the memory that has been allocated since the last call to gk_malloc_init().

Definition at line 118 of file memory.c.

◆ gk_malloc_init()

int gk_malloc_init ( )

This function initializes tracking of heap allocations.

Definition at line 99 of file memory.c.

◆ gk_mcoreAdd()

void gk_mcoreAdd ( gk_mcore_t mcore,
int  type,
size_t  nbytes,
void *  ptr 
)

Adds a memory allocation at the end of the list.

Definition at line 265 of file mcore.c.

◆ gk_mcoreCreate()

gk_mcore_t* gk_mcoreCreate ( size_t  coresize)

This function creates an mcore

Definition at line 18 of file mcore.c.

◆ gk_mcoreDel()

void gk_mcoreDel ( gk_mcore_t mcore,
void *  ptr 
)

This function deletes the mop associated with the supplied pointer. The mop has to be a heap allocation, otherwise it fails violently.

Definition at line 345 of file mcore.c.

◆ gk_mcoreDestroy()

void gk_mcoreDestroy ( gk_mcore_t **  r_mcore,
int  showstats 
)

This function destroys an mcore.

Definition at line 67 of file mcore.c.

◆ gk_mcoreMalloc()

void* gk_mcoreMalloc ( gk_mcore_t mcore,
size_t  nbytes 
)

This function allocate space from the core/heap

Definition at line 140 of file mcore.c.

◆ gk_mcorePop()

void gk_mcorePop ( gk_mcore_t mcore)

This function frees all mops since the last push

Definition at line 198 of file mcore.c.

◆ gk_mcorePush()

void gk_mcorePush ( gk_mcore_t mcore)

This function sets a marker in the stack of malloc ops to be used subsequently for freeing purposes

Definition at line 175 of file mcore.c.

◆ gk_mkpath()

int gk_mkpath ( char *  )

Definition at line 207 of file fs.c.

◆ gk_NonLocalExit_Handler()

void gk_NonLocalExit_Handler ( int  signum)

Definition at line 165 of file error.c.

◆ gk_randinit()

void gk_randinit ( uint64_t  seed)

Create the various random number functions

GKlib's built in random number generator for portability across different architectures

Definition at line 71 of file random.c.

◆ gk_randint32()

uint32_t gk_randint32 ( void  )

Definition at line 125 of file random.c.

◆ gk_randint64()

uint64_t gk_randint64 ( void  )

Definition at line 84 of file random.c.

◆ gk_RandomPermute()

void gk_RandomPermute ( size_t  ,
int ,
int   
)

Definition at line 20 of file GKlib/util.c.

◆ gk_readfile()

char** gk_readfile ( char *  fname,
gk_idx_t r_nlines 
)

This function reads the contents of a text file and returns it in the form of an array of strings.

Parameters
fnameis the name of the file
r_nlinesis the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 103 of file GKlib/io.c.

◆ gk_readpdbfile()

pdbf* gk_readpdbfile ( char *  fname)

Reads a pdb file into a pdbf structure.

This function allocates a pdbf structure and reads the file fname into that structure.

Parameters
fnameis the file name to be read
Returns
A filled pdbf structure.

Definition at line 132 of file pdb.c.

◆ gk_realloc()

void* gk_realloc ( void *  oldptr,
size_t  nbytes,
char *  msg 
)

Definition at line 172 of file memory.c.

◆ gk_rmpath()

int gk_rmpath ( char *  )

Definition at line 219 of file fs.c.

◆ gk_rw_PageRank()

int gk_rw_PageRank ( gk_csr_t mat,
float  lamda,
float  eps,
int  max_niter,
float *  pr 
)

Computes the (personalized) page-rank of the vertices in a graph.

Parameters
matis the matrix storing the graph.
lamdais the restart probability.
epsis the error tolerance for convergance.
max_niteris the maximum number of allowed iterations.
pron entry stores the restart distribution of the vertices. This allows for the computation of personalized page-rank scores by appropriately setting that parameter. On return, pr stores the computed page ranks.
Returns
the number of iterations that were performed.

Definition at line 29 of file rw.c.

◆ gk_seq_init()

void gk_seq_init ( gk_seq_t seq)

Definition at line 27 of file seq.c.

◆ gk_seq_ReadGKMODPSSM()

gk_seq_t* gk_seq_ReadGKMODPSSM ( char *  filename)

This function reads a pssm in the format of gkmod pssm.

Parameters
file_nameis the name of the pssm file
Returns
gk_seq_t

Definition at line 83 of file seq.c.

◆ gk_set_exit_on_error()

void gk_set_exit_on_error ( int  value)

This function sets the gk_exit_on_error variable

Definition at line 42 of file error.c.

◆ gk_SetSignalHandlers()

void gk_SetSignalHandlers ( )

Definition at line 144 of file error.c.

◆ gk_showcorruption()

void gk_showcorruption ( pdbf p)

Decodes the corruption bitswitch and prints any problems.

Due to the totally unreliable nature of the pdb format, reading a pdb file stores a corruption bitswitch, and this function decodes that switch and prints the result on stdout.

Parameters
pis the pdb structure to write out.
fnameis the file name to be written.

Definition at line 435 of file pdb.c.

◆ gk_sigthrow()

void gk_sigthrow ( int  signum)

This function is the custome signal handler, which all it does is to perform a longjump to the most recent saved environment

Definition at line 134 of file error.c.

◆ gk_sigtrap()

int gk_sigtrap ( )

This function sets a number of signal handlers and sets the return point of a longjmp

Definition at line 97 of file error.c.

◆ gk_siguntrap()

int gk_siguntrap ( )

This function sets the handlers for the signals to their default handlers

Definition at line 115 of file error.c.

◆ gk_skvsortd()

void gk_skvsortd ( size_t  n,
gk_skv_t *  base 
)

Sorts an array of gk_skv_t in decreasing order

Definition at line 300 of file sort.c.

◆ gk_skvsorti()

void gk_skvsorti ( size_t  n,
gk_skv_t *  base 
)

Sorts an array of gk_skv_t in increasing order

Definition at line 289 of file sort.c.

◆ gk_str2time()

time_t gk_str2time ( char *  str)

Converts a date/time string into its equivalent time_t value.

This function takes date and/or time specification and converts it in the equivalent time_t representation. The conversion is done using the strptime() function. The format that gk_str2time() understands is mm/dd/yyyy hh:mm:ss, in which the hours are in military time.

Parameters
stris the date/time string to be converted.
Returns
If the conversion was successful it returns the time, otherwise it returns -1.

Definition at line 499 of file string.c.

◆ gk_strcasecmp()

int gk_strcasecmp ( char *  s1,
char *  s2 
)

Case insensitive string comparison.

This function compares two strings for equality by ignoring the case of the strings.

Warning
This function is not equivalent to a case-insensitive strcmp() function, as it does not return ordering information.
Todo:
Remove the above warning.
Parameters
s1is the first string to be compared.
s2is the second string to be compared.
Return values
1if the strings are identical,
0otherwise.

Definition at line 405 of file string.c.

◆ gk_strchr_replace()

char* gk_strchr_replace ( char *  str,
char *  fromlist,
char *  tolist 
)

Replaces certain characters in a string.

This function takes a string and replaces all the characters in the fromlist with the corresponding characters from the tolist. That is, each occurence of fromlist[i] is replaced by tolist[i]. If the tolist is shorter than fromlist, then the corresponding characters are deleted. The modifications on str are done in place. It tries to provide a functionality similar to Perl's tr// function.

Parameters
stris the string whose characters will be replaced.
fromlistis the set of characters to be replaced.
tolistis the set of replacement characters .
Returns
A pointer to str itself.

Definition at line 37 of file string.c.

◆ gk_strdup()

char* gk_strdup ( char *  orgstr)

Duplicates a string.

This function is a replacement for C's standard strdup() function. The key differences between the two are that gk_strdup():

  • uses the dynamic memory allocation routines of GKlib.
  • it correctly handles NULL input strings.

The string that is returned must be freed by gk_free().

Parameters
orgstris the string that will be duplicated.
Returns
A pointer to the newly created string.
See also
gk_free()

Definition at line 372 of file string.c.

◆ gk_strerror()

char* gk_strerror ( int  errnum)

Thread-safe implementation of strerror()

Definition at line 174 of file error.c.

◆ gk_strhprune()

char* gk_strhprune ( char *  str,
char *  rmlist 
)

Prunes characters from the beginning of the string.

This function removes any starting characters that are included in the rmlist. The trimming stops at the first character that is not in rmlist. This function can be used to removed leading spaces, tabs, etc. This is a distructive operation as it modifies the string.

Parameters
stris the string that will be trimmed.
rmlistcontains the set of characters that will be removed.
Returns
A pointer to str itself.
See also
gk_strtprune()

Definition at line 291 of file string.c.

◆ gk_strrcmp()

int gk_strrcmp ( char *  s1,
char *  s2 
)

Compare two strings in revere order.

This function is similar to strcmp but it performs the comparison as if the two strings were reversed.

Parameters
s1is the first string to be compared.
s2is the second string to be compared.
Return values
-1,0,1,ifthe s1 < s2, s1 == s2, or s1 > s2.

Definition at line 433 of file string.c.

◆ gk_strstr_replace()

int gk_strstr_replace ( char *  str,
char *  pattern,
char *  replacement,
char *  options,
char **  new_str 
)

Regex-based search-and-replace function.

This function is a C implementation of Perl's s// regular-expression based substitution function.

Parameters
stris the input string on which the operation will be performed.
patternis the regular expression for the pattern to be matched for substitution.
replacementis the replacement string, in which the possible captured pattern substrings are referred to as $1, $2, ..., $9. The entire matched pattern is refered to as $0.
optionsis a string specified options for the substitution operation. Currently the "i" (case insensitive) and "g" (global substitution) are supported.
new_stris a reference to a pointer that will store a pointer to the newly created string that results from the substitutions. This string is allocated via gk_malloc() and needs to be freed using gk_free(). The string is returned even if no substitutions were performed.
Returns
If successful, it returns 1 + the number of substitutions that were performed. Thus, if no substitutions were performed, the returned value will be 1. Otherwise it returns 0. In case of error, a meaningful error message is returned in newstr, which also needs to be freed afterwards.

Definition at line 94 of file string.c.

◆ gk_strtokenize()

void gk_strtokenize ( char *  line,
char *  delim,
gk_Tokens_t tokens 
)

Definition at line 22 of file tokenizer.c.

◆ gk_strtolower()

char* gk_strtolower ( char *  str)

Converts a string to lower case.

This function converts a string to lower case. This operation modifies the string itself.

Parameters
stris the string whose case will be changed.
Returns
A pointer to str itself.
See also
gk_strtoupper()

Definition at line 348 of file string.c.

◆ gk_strtoupper()

char* gk_strtoupper ( char *  str)

Converts a string to upper case.

This function converts a string to upper case. This operation modifies the string itself.

Parameters
stris the string whose case will be changed.
Returns
A pointer to str itself.
See also
gk_strtolower()

Definition at line 328 of file string.c.

◆ gk_strtprune()

char* gk_strtprune ( char *  str,
char *  rmlist 
)

Prunes characters from the end of the string.

This function removes any trailing characters that are included in the rmlist. The trimming stops at the last character (i.e., first character from the end) that is not in rmlist.
This function can be used to removed trailing spaces, newlines, etc. This is a distructive operation as it modifies the string.

Parameters
stris the string that will be trimmed.
rmlistcontains the set of characters that will be removed.
Returns
A pointer to str itself.
See also
gk_strhprune()

Definition at line 254 of file string.c.

◆ gk_threetoone()

char gk_threetoone ( char *  res)

Converts three-letter amino acid codes to one-leter codes.

This function takes a three letter * and converts it to a single

Parameters
resis the three-letter code to be converted.
Returns
A representing the amino acid.

Definition at line 24 of file pdb.c.

◆ gk_time2str()

char* gk_time2str ( time_t  time)

Converts a time_t time into a string.

This function takes a time_t-specified time and returns a string-formated representation of the corresponding time. The format of the string is mm/dd/yyyy hh:mm:ss, in which the hours are in military time.

Parameters
timeis the time to be converted.
Returns
It returns a pointer to a statically allocated string that is over-written in successive calls of this function. If the conversion failed, it returns NULL.

Definition at line 470 of file string.c.

◆ gk_UnsetSignalHandlers()

void gk_UnsetSignalHandlers ( )

Definition at line 154 of file error.c.

◆ gk_WClockSeconds()

gk_wclock_t gk_WClockSeconds ( void  )

Definition at line 19 of file timers.c.

◆ gk_writealphacarbons()

void gk_writealphacarbons ( pdbf p,
char *  fname 
)

Writes out all the alpha carbon atoms of a structure.

This function takes a pdbf structure p and writes only the alpha carbon atoms to a filename fname.

Parameters
pis the pdb structure to write out.
fnameis the file name to be written.

Definition at line 413 of file pdb.c.

◆ gk_writebackbone()

void gk_writebackbone ( pdbf p,
char *  fname 
)

Writes out all the backbone atoms of a structure in pdb format.

This function takes a pdbf structure p and writes only the backbone atoms to a filename fname.

Parameters
pis the pdb structure to write out.
fnameis the file name to be written.

Definition at line 392 of file pdb.c.

◆ gk_writefullatom()

void gk_writefullatom ( pdbf p,
char *  fname 
)

Writes all atoms in p in pdb-format to file fname.

This function takes a pdbf structure and writes out all the atom information to file fname.

Parameters
pis the pdbf structure to write out
fnameis the file name to be written

Definition at line 371 of file pdb.c.

◆ gk_zkvsortd()

void gk_zkvsortd ( size_t  n,
gk_zkv_t *  base 
)

Sorts an array of gk_zkv_t in decreasing order

Definition at line 234 of file sort.c.

◆ gk_zkvsorti()

void gk_zkvsorti ( size_t  n,
gk_zkv_t *  base 
)

Sorts an array of gk_zkv_t in increasing order

Definition at line 223 of file sort.c.

◆ GKDecodeBase64()

void GKDecodeBase64 ( int  nbytes,
unsigned char *  inbuffer,
unsigned char *  outbuffer 
)

Definition at line 85 of file b64.c.

◆ GKEncodeBase64()

void GKEncodeBase64 ( int  nbytes,
unsigned char *  inbuffer,
unsigned char *  outbuffer 
)

Definition at line 64 of file b64.c.

◆ HTable_Create()

gk_HTable_t* HTable_Create ( int  nelements)

Definition at line 16 of file htable.c.

◆ HTable_Delete()

void HTable_Delete ( gk_HTable_t htable,
int  key 
)

Definition at line 107 of file htable.c.

◆ HTable_Destroy()

void HTable_Destroy ( gk_HTable_t htable)

Definition at line 235 of file htable.c.

◆ HTable_GetNext()

int HTable_GetNext ( gk_HTable_t htable,
int  key,
int val,
int  type 
)

Definition at line 162 of file htable.c.

◆ HTable_HFunction()

int HTable_HFunction ( int  nelements,
int  key 
)

Definition at line 244 of file htable.c.

◆ HTable_Insert()

void HTable_Insert ( gk_HTable_t htable,
int  key,
int  val 
)

Definition at line 74 of file htable.c.

◆ HTable_Reset()

void HTable_Reset ( gk_HTable_t htable)

Definition at line 33 of file htable.c.

◆ HTable_Resize()

void HTable_Resize ( gk_HTable_t htable,
int  nelements 
)

Definition at line 46 of file htable.c.

◆ HTable_Search()

int HTable_Search ( gk_HTable_t htable,
int  key 
)

Definition at line 135 of file htable.c.

◆ HTable_SearchAndDelete()

int HTable_SearchAndDelete ( gk_HTable_t htable,
int  key 
)

Definition at line 200 of file htable.c.

◆ omp_get_dynamic()

int omp_get_dynamic ( void  )

◆ omp_get_max_threads()

int omp_get_max_threads ( void  )

◆ omp_get_nested()

int omp_get_nested ( void  )

◆ omp_get_num_procs()

int omp_get_num_procs ( void  )

◆ omp_get_num_threads()

int omp_get_num_threads ( void  )

◆ omp_get_thread_num()

int omp_get_thread_num ( void  )

◆ omp_in_parallel()

int omp_in_parallel ( void  )

◆ omp_set_dynamic()

void omp_set_dynamic ( int  num_threads)

◆ omp_set_nested()

void omp_set_nested ( int  nested)

◆ omp_set_num_threads()

void omp_set_num_threads ( int  num_threads)

◆ PrintBackTrace()

void PrintBackTrace ( )

Definition at line 197 of file error.c.



gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:09:47