|
hp2FEM
0.1
|
This file contains function prototypes. More...

Go to the source code of this file.
Functions | |
| FILE * | gk_fopen (char *, char *, const char *) |
| void | gk_fclose (FILE *) |
| gk_idx_t | gk_getline (char **lineptr, size_t *n, FILE *stream) |
| char ** | gk_readfile (char *fname, gk_idx_t *r_nlines) |
| int32_t * | gk_i32readfile (char *fname, gk_idx_t *r_nlines) |
| int64_t * | gk_i64readfile (char *fname, gk_idx_t *r_nlines) |
| int | gk_fexists (char *) |
| int | gk_dexists (char *) |
| intmax_t | gk_getfsize (char *) |
| Returns the size of the file in bytes. | |
| void | gk_getfilestats (char *fname, size_t *r_nlines, size_t *r_ntokens, size_t *r_max_nlntokens, size_t *r_nbytes) |
| char * | gk_getbasename (char *path) |
| char * | gk_getextname (char *path) |
| char * | gk_getfilename (char *path) |
| char * | gk_getpathname (char *path) |
| int | gk_mkpath (char *) |
| int | gk_rmpath (char *) |
| void | gk_AllocMatrix (void ***, size_t, size_t, size_t) |
| void | gk_FreeMatrix (void ***, size_t, size_t) |
| int | gk_malloc_init () |
| void | gk_malloc_cleanup (int showstats) |
| void * | gk_malloc (size_t nbytes, char *msg) |
| void * | gk_realloc (void *oldptr, size_t nbytes, char *msg) |
| void | gk_free (void **ptr1,...) |
| size_t | gk_GetCurMemoryUsed () |
| size_t | gk_GetMaxMemoryUsed () |
| gk_seq_t * | gk_seq_ReadGKMODPSSM (char *file_name) |
| This function reads a pssm in the format of gkmod pssm. | |
| gk_i2cc2i_t * | gk_i2cc2i_create_common (char *alphabet) |
| This function creates the localizations for the various sequences. | |
| void | gk_seq_init (gk_seq_t *seq) |
| char | gk_threetoone (char *res) |
| Converts three-letter amino acid codes to one-leter codes. | |
| void | gk_freepdbf (pdbf *p) |
| Frees the memory of a pdbf structure. | |
| pdbf * | gk_readpdbfile (char *fname) |
| Reads a pdb file into a pdbf structure. | |
| void | gk_writefullatom (pdbf *p, char *fname) |
| Writes all atoms in p in pdb-format to file fname. | |
| void | gk_writebackbone (pdbf *p, char *fname) |
| Writes out all the backbone atoms of a structure in pdb format. | |
| void | gk_writealphacarbons (pdbf *p, char *fname) |
| Writes out all the alpha carbon atoms of a structure. | |
| void | gk_showcorruption (pdbf *p) |
| Decodes the corruption bitswitch and prints any problems. | |
| void | gk_set_exit_on_error (int value) |
| void | errexit (char *,...) |
| void | gk_errexit (int signum, char *,...) |
| int | gk_sigtrap () |
| int | gk_siguntrap () |
| void | gk_sigthrow (int signum) |
| void | gk_SetSignalHandlers () |
| void | gk_UnsetSignalHandlers () |
| void | gk_NonLocalExit_Handler (int signum) |
| char * | gk_strerror (int errnum) |
| Thread-safe implementation of strerror() | |
| void | PrintBackTrace () |
| void | gk_RandomPermute (size_t, int *, int) |
| 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. | |
| int | gk_log2 (int) |
| int | gk_ispow2 (int) |
| float | gk_flog2 (float) |
| gk_wclock_t | gk_WClockSeconds (void) |
| double | gk_CPUSeconds (void) |
| char * | gk_strchr_replace (char *str, char *fromlist, char *tolist) |
| Replaces certain characters in a string. | |
| int | gk_strstr_replace (char *str, char *pattern, char *replacement, char *options, char **new_str) |
| Regex-based search-and-replace function. | |
| char * | gk_strtprune (char *, char *) |
| Prunes characters from the end of the string. | |
| char * | gk_strhprune (char *, char *) |
| Prunes characters from the beginning of the string. | |
| char * | gk_strtoupper (char *) |
| Converts a string to upper case. | |
| char * | gk_strtolower (char *) |
| Converts a string to lower case. | |
| char * | gk_strdup (char *orgstr) |
| Duplicates a string. | |
| int | gk_strcasecmp (char *s1, char *s2) |
| Case insensitive string comparison. | |
| int | gk_strrcmp (char *s1, char *s2) |
| Compare two strings in revere order. | |
| char * | gk_time2str (time_t time) |
| Converts a time_t time into a string. | |
| time_t | gk_str2time (char *str) |
| Converts a date/time string into its equivalent time_t value. | |
| int | gk_GetStringID (gk_StringMap_t *strmap, char *key) |
| void | gk_csorti (size_t, char *) |
| void | gk_csortd (size_t, char *) |
| void | gk_isorti (size_t, int *) |
| void | gk_isortd (size_t, int *) |
| void | gk_fsorti (size_t, float *) |
| void | gk_fsortd (size_t, float *) |
| void | gk_dsorti (size_t, double *) |
| void | gk_dsortd (size_t, double *) |
| void | gk_idxsorti (size_t, gk_idx_t *) |
| void | gk_idxsortd (size_t, gk_idx_t *) |
| void | gk_ckvsorti (size_t, gk_ckv_t *) |
| void | gk_ckvsortd (size_t, gk_ckv_t *) |
| void | gk_ikvsorti (size_t, gk_ikv_t *) |
| void | gk_ikvsortd (size_t, gk_ikv_t *) |
| void | gk_i32kvsorti (size_t, gk_i32kv_t *) |
| void | gk_i32kvsortd (size_t, gk_i32kv_t *) |
| void | gk_i64kvsorti (size_t, gk_i64kv_t *) |
| void | gk_i64kvsortd (size_t, gk_i64kv_t *) |
| void | gk_fkvsorti (size_t, gk_fkv_t *) |
| void | gk_fkvsortd (size_t, gk_fkv_t *) |
| void | gk_dkvsorti (size_t, gk_dkv_t *) |
| void | gk_dkvsortd (size_t, gk_dkv_t *) |
| void | gk_skvsorti (size_t, gk_skv_t *) |
| void | gk_skvsortd (size_t, gk_skv_t *) |
| void | gk_idxkvsorti (size_t, gk_idxkv_t *) |
| void | gk_idxkvsortd (size_t, gk_idxkv_t *) |
| int | gk_dfkvkselect (size_t, int, gk_fkv_t *) |
| int | gk_ifkvkselect (size_t, int, gk_fkv_t *) |
| gk_HTable_t * | HTable_Create (int nelements) |
| void | HTable_Reset (gk_HTable_t *htable) |
| void | HTable_Resize (gk_HTable_t *htable, int nelements) |
| void | HTable_Insert (gk_HTable_t *htable, int key, int val) |
| void | HTable_Delete (gk_HTable_t *htable, int key) |
| int | HTable_Search (gk_HTable_t *htable, int key) |
| int | HTable_GetNext (gk_HTable_t *htable, int key, int *val, int type) |
| int | HTable_SearchAndDelete (gk_HTable_t *htable, int key) |
| void | HTable_Destroy (gk_HTable_t *htable) |
| int | HTable_HFunction (int nelements, int key) |
| void | gk_strtokenize (char *line, char *delim, gk_Tokens_t *tokens) |
| void | gk_freetokenslist (gk_Tokens_t *tokens) |
| void | encodeblock (unsigned char *in, unsigned char *out) |
| void | decodeblock (unsigned char *in, unsigned char *out) |
| void | GKEncodeBase64 (int nbytes, unsigned char *inbuffer, unsigned char *outbuffer) |
| void | GKDecodeBase64 (int nbytes, unsigned char *inbuffer, unsigned char *outbuffer) |
| void | gk_randinit (uint64_t) |
| uint64_t | gk_randint64 (void) |
| uint32_t | gk_randint32 (void) |
| void | omp_set_num_threads (int num_threads) |
| int | omp_get_num_threads (void) |
| int | omp_get_max_threads (void) |
| int | omp_get_thread_num (void) |
| int | omp_get_num_procs (void) |
| int | omp_in_parallel (void) |
| void | omp_set_dynamic (int num_threads) |
| int | omp_get_dynamic (void) |
| void | omp_set_nested (int nested) |
| int | omp_get_nested (void) |
| gk_csr_t * | gk_csr_Create () |
| void | gk_csr_Init (gk_csr_t *mat) |
| void | gk_csr_Free (gk_csr_t **mat) |
| void | gk_csr_FreeContents (gk_csr_t *mat) |
| gk_csr_t * | gk_csr_Dup (gk_csr_t *mat) |
| gk_csr_t * | gk_csr_ExtractSubmatrix (gk_csr_t *mat, int rstart, int nrows) |
| gk_csr_t * | gk_csr_ExtractRows (gk_csr_t *mat, int nrows, int *rind) |
| gk_csr_t * | gk_csr_ExtractPartition (gk_csr_t *mat, int *part, int pid) |
| gk_csr_t ** | gk_csr_Split (gk_csr_t *mat, int *color) |
| gk_csr_t * | gk_csr_Read (char *filename, int format, int readvals, int numbering) |
| void | gk_csr_Write (gk_csr_t *mat, char *filename, int format, int writevals, int numbering) |
| gk_csr_t * | gk_csr_Prune (gk_csr_t *mat, int what, int minf, int maxf) |
| gk_csr_t * | gk_csr_LowFilter (gk_csr_t *mat, int what, int norm, float fraction) |
| gk_csr_t * | gk_csr_TopKPlusFilter (gk_csr_t *mat, int what, int topk, float keepval) |
| gk_csr_t * | gk_csr_ZScoreFilter (gk_csr_t *mat, int what, float zscore) |
| void | gk_csr_CompactColumns (gk_csr_t *mat) |
| void | gk_csr_SortIndices (gk_csr_t *mat, int what) |
| void | gk_csr_CreateIndex (gk_csr_t *mat, int what) |
| void | gk_csr_Normalize (gk_csr_t *mat, int what, int norm) |
| void | gk_csr_Scale (gk_csr_t *mat, int type) |
| void | gk_csr_ComputeSums (gk_csr_t *mat, int what) |
| void | gk_csr_ComputeSquaredNorms (gk_csr_t *mat, int what) |
| float | gk_csr_ComputeSimilarity (gk_csr_t *mat, int i1, int i2, int what, int simtype) |
| 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_find_frequent_itemsets (int ntrans, int *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) |
| float | ComputeAccuracy (int n, gk_fkv_t *list) |
| float | ComputeROCn (int n, int maxN, gk_fkv_t *list) |
| float | ComputeMedianRFP (int n, gk_fkv_t *list) |
| float | ComputeMean (int n, float *values) |
| float | ComputeStdDev (int n, float *values) |
| gk_mcore_t * | gk_mcoreCreate (size_t coresize) |
| gk_mcore_t * | gk_gkmcoreCreate () |
| void | gk_mcoreDestroy (gk_mcore_t **r_mcore, int showstats) |
| void | gk_gkmcoreDestroy (gk_mcore_t **r_mcore, int showstats) |
| void * | gk_mcoreMalloc (gk_mcore_t *mcore, size_t nbytes) |
| void | gk_mcorePush (gk_mcore_t *mcore) |
| void | gk_gkmcorePush (gk_mcore_t *mcore) |
| void | gk_mcorePop (gk_mcore_t *mcore) |
| void | gk_gkmcorePop (gk_mcore_t *mcore) |
| void | gk_mcoreAdd (gk_mcore_t *mcore, int type, size_t nbytes, void *ptr) |
| void | gk_gkmcoreAdd (gk_mcore_t *mcore, int type, size_t nbytes, void *ptr) |
| void | gk_mcoreDel (gk_mcore_t *mcore, void *ptr) |
| void | gk_gkmcoreDel (gk_mcore_t *mcore, void *ptr) |
This file contains function prototypes.
$Id: gk_proto.h 10522 2011-07-08 21:05:23Z benjamin $
| void errexit | ( | char * | f_str, |
| ... | |||
| ) |
This function prints an error message and exits
| 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.
| 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.
| n | the number of elements in the array (e.g., # of vertices) |
| range | the cardinality of the set (e.g., # of partitions) |
| array | the array that stores the per-element set membership |
| ptr | the 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. |
| ind | the array that stores consecutively which elements belong to each set. The size of this array should be n. |
| void gk_ckvsortd | ( | size_t | n, |
| gk_ckv_t * | base | ||
| ) |
Sorts an array of gk_ckv_t in decreasing order
| void gk_ckvsorti | ( | size_t | n, |
| gk_ckv_t * | base | ||
| ) |
Sorts an array of gk_ckv_t in increasing order
| void gk_csortd | ( | size_t | n, |
| char * | base | ||
| ) |
Sorts an array of chars in decreasing order
| void gk_csorti | ( | size_t | n, |
| char * | base | ||
| ) |
Sorts an array of chars in increasing order
| 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.
| mat | the matrix whose empty columns will be removed. |
| float gk_csr_ComputeSimilarity | ( | gk_csr_t * | mat, |
| int | i1, | ||
| int | i2, | ||
| int | what, | ||
| int | simtype | ||
| ) |
Computes the similarity between two rows/columns
| mat | the matrix itself. The routine assumes that the indices are sorted in increasing order. |
| i1 | is the first row/column, |
| i2 | is the second row/column, |
| what | is either GK_CSR_ROW or GK_CSR_COL indicating the type of objects between the similarity will be computed, |
| simtype | is the type of similarity and is one of GK_CSR_COS, GK_CSR_JAC, GK_CSR_MIN |
| void gk_csr_ComputeSquaredNorms | ( | gk_csr_t * | mat, |
| int | what | ||
| ) |
Computes the squared of the norms of the rows/columns
| mat | the matrix itself, |
| what | is either GK_CSR_ROW or GK_CSR_COL indicating which squared norms to compute. |
| void gk_csr_ComputeSums | ( | gk_csr_t * | mat, |
| int | what | ||
| ) |
Computes the sums of the rows/columns
| mat | the matrix itself, |
| what | is either GK_CSR_ROW or GK_CSR_COL indicating which sums to compute. |
| gk_csr_t* gk_csr_Create | ( | ) |
Allocate memory for a CSR matrix and initializes it
| void gk_csr_CreateIndex | ( | gk_csr_t * | mat, |
| int | what | ||
| ) |
Creates a row/column index from the column/row data.
| mat | the matrix itself, |
| what | is either GK_CSR_ROW or GK_CSR_COL indicating which index will be created. |
| gk_csr_t* gk_csr_Dup | ( | gk_csr_t * | mat | ) |
Returns a copy of a matrix.
| mat | is the matrix to be duplicated. |
| gk_csr_t* gk_csr_ExtractPartition | ( | gk_csr_t * | mat, |
| int * | part, | ||
| int | pid | ||
| ) |
Returns a submatrix corresponding to a specified partitioning of rows.
| mat | is the original matrix. |
| part | is the partitioning vector of the rows. |
| pid | is the partition ID that will be extracted. |
| gk_csr_t* gk_csr_ExtractRows | ( | gk_csr_t * | mat, |
| int | nrows, | ||
| int * | rind | ||
| ) |
Returns a submatrix containing a certain set of rows.
| mat | is the original matrix. |
| nrows | is the number of rows to extract. |
| rind | is the set of row numbers to extract. |
| gk_csr_t* gk_csr_ExtractSubmatrix | ( | gk_csr_t * | mat, |
| int | rstart, | ||
| int | nrows | ||
| ) |
Returns a submatrix containint a set of consecutive rows.
| mat | is the original matrix. |
| rstart | is the starting row. |
| nrows | is the number of rows from rstart to extract. |
| void gk_csr_Free | ( | gk_csr_t ** | mat | ) |
Frees all the memory allocated for matrix.
| mat | is the matrix to be freed. |
| void gk_csr_FreeContents | ( | gk_csr_t * | mat | ) |
Frees only the memory allocated for the matrix's different fields and sets them to NULL.
| mat | is the matrix whose contents will be freed. |
| 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.
| mat | the matrix itself |
| nqterms | is the number of columns in the query |
| qind | is the list of query columns |
| qval | is the list of correspodning query weights |
| simtype | is the type of similarity and is one of GK_CSR_COS, GK_CSR_JAC, GK_CSR_MIN |
| nsim | is the maximum number of requested most similar rows. If -1 is provided, then everything is returned unsorted. |
| minsim | is the minimum similarity of the requested most similar rows |
| hits | is the result set. This array should be at least of length nsim. |
| i_marker | is 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_cand | is an array of size equal to the number of rows. If NULL is provided then this array is allocated and freed internally. |
| void gk_csr_Init | ( | gk_csr_t * | mat | ) |
Initializes the matrix
| mat | is the matrix to be initialized. |
| 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.
| mat | the matrix to be prunned, |
| what | indicates if the rows (GK_CSR_ROW) or the columns (GK_CSR_COL) of the matrix will be prunned, |
| norm | indicates the norm that will be used to aggregate the weights and possible values are 1 or 2, |
| fraction | is the fraction of the overall norm that will be retained by the kept entries. |
| void gk_csr_Normalize | ( | gk_csr_t * | mat, |
| int | what, | ||
| int | norm | ||
| ) |
Normalizes the rows/columns of the matrix to be unit length.
| mat | the matrix itself, |
| what | indicates what will be normalized and is obtained by specifying GK_CSR_ROW, GK_CSR_COL, GK_CSR_ROW|GK_CSR_COL. |
| norm | indicates what norm is to normalize to, 1: 1-norm, 2: 2-norm |
| 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.
| mat | the matrix to be prunned, |
| what | indicates if the rows (GK_CSR_ROW) or the columns (GK_CSR_COL) of the matrix will be prunned, |
| minf | is the minimum number of rows (columns) that a column (row) must be present in order to be kept, |
| maxf | is the maximum number of rows (columns) that a column (row) must be present at in order to be kept. |
| 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.
| filename | is the file that stores the data. |
| format | is either GK_CSR_FMT_CLUTO or GK_CSR_FMT_CSR specifying the type of the input format. The difference between the two formats is that GK_CSR_FMT_CLUTO requires the header line, whereas GK_CSR_FMT_CSR does not. |
| readvals | is 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. |
| numbering | is 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. |
| void gk_csr_Scale | ( | gk_csr_t * | mat, |
| int | type | ||
| ) |
Applies different row scaling methods.
| mat | the matrix itself, |
| type | indicates the type of row scaling. Possible values are: GK_CSR_MAXTF, GK_CSR_SQRT, GK_CSR_LOG, GK_CSR_IDF. |
| void gk_csr_SortIndices | ( | gk_csr_t * | mat, |
| int | what | ||
| ) |
Sorts the indices in increasing order
| mat | the matrix itself, |
| what | is either GK_CSR_ROW or GK_CSR_COL indicating which set of indices to sort. |
| 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.
| mat | is the original matrix. |
| color | is 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. |
| 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.
| mat | the matrix to be prunned, |
| what | indicates if the rows (GK_CSR_ROW) or the columns (GK_CSR_COL) of the matrix will be prunned, |
| topk | is the number of the highest weight entries to keep. |
| keepval | is the weight of a term above which will be kept. This is used to select additional terms past the first topk. |
| 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.
| mat | is the matrix to be written, |
| filename | is the name of the output file. |
| format | is one of GK_CSR_FMT_CLUTO or GK_CSR_FMT_CSR specifying the format of the output file. |
| writevals | is either 1 or 0 indicating if the values will be written or not. This is only applicable when GK_CSR_FMT_CSR is used. |
| numbering | is 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. |
| 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.
| mat | the matrix to be prunned, |
| what | indicates if the rows (GK_CSR_ROW) or the columns (GK_CSR_COL) of the matrix will be prunned, |
| zscore | is the multiplicative factor over the average contribution to the length of the document. |
| 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
| void gk_dkvsortd | ( | size_t | n, |
| gk_dkv_t * | base | ||
| ) |
Sorts an array of gk_fkv_t in decreasing order
| void gk_dkvsorti | ( | size_t | n, |
| gk_dkv_t * | base | ||
| ) |
Sorts an array of gk_dkv_t in increasing order
| void gk_dsortd | ( | size_t | n, |
| double * | base | ||
| ) |
Sorts an array of doubles in decreasing order
| void gk_dsorti | ( | size_t | n, |
| double * | base | ||
| ) |
Sorts an array of doubles in increasing order
| void gk_errexit | ( | int | signum, |
| char * | f_str, | ||
| ... | |||
| ) |
This function prints an error message and raises a signum signal
| void gk_fkvsortd | ( | size_t | n, |
| gk_fkv_t * | base | ||
| ) |
Sorts an array of gk_fkv_t in decreasing order
| void gk_fkvsorti | ( | size_t | n, |
| gk_fkv_t * | base | ||
| ) |
Sorts an array of gk_fkv_t in increasing order
| void gk_FreeMatrix | ( | void *** | r_matrix, |
| size_t | ndim1, | ||
| size_t | ndim2 | ||
| ) |
This function frees a two-dimensional matrix.
| 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.
| p | is the pdbf structure to be freed. |
| void gk_fsortd | ( | size_t | n, |
| float * | base | ||
| ) |
Sorts an array of floats in decreasing order
| void gk_fsorti | ( | size_t | n, |
| float * | base | ||
| ) |
Sorts an array of floats in increasing order
| 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.
| fname | is the name of the file |
| r_nlines | is the number of lines in the file. If it is NULL, this information is not returned. |
| r_ntokens | is the number of tokens in the file. If it is NULL, this information is not returned. |
| r_max_nlntokens | is the maximum number of tokens in any line in the file. If it is NULL this information is not returned. |
| r_nbytes | is the number of bytes in the file. If it is NULL, this information is not returned. |
| 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.
| gk_idx_t gk_getline | ( | char ** | lineptr, |
| size_t * | n, | ||
| FILE * | stream | ||
| ) |
This function is the GKlib implementation of glibc's getline() function.
| 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.
This function creates an mcore. This version is used for gkmcore.
| 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.
| void gk_gkmcoreDestroy | ( | gk_mcore_t ** | r_mcore, |
| int | showstats | ||
| ) |
This function destroys an mcore. This version is for gkmcore.
| 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.
| 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.
| gk_i2cc2i_t* gk_i2cc2i_create_common | ( | char * | alphabet | ) |
This function creates the localizations for the various sequences.
| string | i.e amino acids, nucleotides, sequences |
| void gk_i32kvsortd | ( | size_t | n, |
| gk_i32kv_t * | base | ||
| ) |
Sorts an array of gk_i32kv_t in decreasing order
| void gk_i32kvsorti | ( | size_t | n, |
| gk_i32kv_t * | base | ||
| ) |
Sorts an array of gk_i32kv_t in increasing order
| 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.
| fname | is the name of the file |
| r_nlines | is the number of lines in the file. If it is NULL, this information is not returned. |
| void gk_i64kvsortd | ( | size_t | n, |
| gk_i64kv_t * | base | ||
| ) |
Sorts an array of gk_i64kv_t in decreasing order
| void gk_i64kvsorti | ( | size_t | n, |
| gk_i64kv_t * | base | ||
| ) |
Sorts an array of gk_i64kv_t in increasing order
| 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.
| fname | is the name of the file |
| r_nlines | is the number of lines in the file. If it is NULL, this information is not returned. |
| void gk_idxkvsortd | ( | size_t | n, |
| gk_idxkv_t * | base | ||
| ) |
Sorts an array of gk_idxkv_t in decreasing order
| void gk_idxkvsorti | ( | size_t | n, |
| gk_idxkv_t * | base | ||
| ) |
Sorts an array of gk_idxkv_t in increasing order
| void gk_idxsortd | ( | size_t | n, |
| gk_idx_t * | base | ||
| ) |
Sorts an array of gk_idx_t in decreasing order
| void gk_idxsorti | ( | size_t | n, |
| gk_idx_t * | base | ||
| ) |
Sorts an array of gk_idx_t in increasing order
| 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
| void gk_ikvsortd | ( | size_t | n, |
| gk_ikv_t * | base | ||
| ) |
Sorts an array of gk_ikv_t in decreasing order
| void gk_ikvsorti | ( | size_t | n, |
| gk_ikv_t * | base | ||
| ) |
Sorts an array of gk_ikv_t in increasing order
| void gk_isortd | ( | size_t | n, |
| int * | base | ||
| ) |
Sorts an array of integers in decreasing order
| void gk_isorti | ( | size_t | n, |
| int * | base | ||
| ) |
Sorts an array of integers in increasing order
| 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.
| void gk_malloc_cleanup | ( | int | showstats | ) |
This function frees the memory that has been allocated since the last call to gk_malloc_init().
| int gk_malloc_init | ( | ) |
This function initializes tracking of heap allocations.
| void gk_mcoreAdd | ( | gk_mcore_t * | mcore, |
| int | type, | ||
| size_t | nbytes, | ||
| void * | ptr | ||
| ) |
Adds a memory allocation at the end of the list.
| gk_mcore_t* gk_mcoreCreate | ( | size_t | coresize | ) |
This function creates an mcore
| 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.
| void gk_mcoreDestroy | ( | gk_mcore_t ** | r_mcore, |
| int | showstats | ||
| ) |
This function destroys an mcore.
| void* gk_mcoreMalloc | ( | gk_mcore_t * | mcore, |
| size_t | nbytes | ||
| ) |
This function allocate space from the core/heap
| void gk_mcorePop | ( | gk_mcore_t * | mcore | ) |
This function frees all mops since the last push
| 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
| void gk_randinit | ( | uint64_t | seed | ) |
Create the various random number functions
GKlib's built in random number generator for portability across different architectures
| 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.
| fname | is the name of the file |
| r_nlines | is the number of lines in the file. If it is NULL, this information is not returned. |
| 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.
| fname | is the file name to be read |
| gk_seq_t* gk_seq_ReadGKMODPSSM | ( | char * | filename | ) |
This function reads a pssm in the format of gkmod pssm.
| file_name | is the name of the pssm file |
| void gk_set_exit_on_error | ( | int | value | ) |
This function sets the gk_exit_on_error variable
| 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.
| p | is the pdb structure to write out. |
| fname | is the file name to be written. |
| 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
| int gk_sigtrap | ( | ) |
This function sets a number of signal handlers and sets the return point of a longjmp
| int gk_siguntrap | ( | ) |
This function sets the handlers for the signals to their default handlers
| void gk_skvsortd | ( | size_t | n, |
| gk_skv_t * | base | ||
| ) |
Sorts an array of gk_skv_t in decreasing order
| void gk_skvsorti | ( | size_t | n, |
| gk_skv_t * | base | ||
| ) |
Sorts an array of gk_skv_t in increasing order
| 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.
| str | is the date/time string to be converted. |
| 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.
| s1 | is the first string to be compared. |
| s2 | is the second string to be compared. |
| 1 | if the strings are identical, |
| 0 | otherwise. |
| 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.
| str | is the string whose characters will be replaced. |
| fromlist | is the set of characters to be replaced. |
| tolist | is the set of replacement characters . |
str itself. | 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():
The string that is returned must be freed by gk_free().
| orgstr | is the string that will be duplicated. |
| 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.
| str | is the string that will be trimmed. |
| rmlist | contains the set of characters that will be removed. |
str itself. | 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.
| s1 | is the first string to be compared. |
| s2 | is the second string to be compared. |
| -1,0,1,if | the s1 < s2, s1 == s2, or s1 > s2. |
| 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.
| str | is the input string on which the operation will be performed. |
| pattern | is the regular expression for the pattern to be matched for substitution. |
| replacement | is 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. |
| options | is a string specified options for the substitution operation. Currently the "i" (case insensitive) and "g" (global substitution) are supported. |
| new_str | is 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. |
newstr, which also needs to be freed afterwards. | 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.
| str | is the string whose case will be changed. |
str itself. | 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.
| str | is the string whose case will be changed. |
str itself. | 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.
| str | is the string that will be trimmed. |
| rmlist | contains the set of characters that will be removed. |
str itself. | 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
| res | is the three-letter code to be converted. |
representing the amino acid. | 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.
| time | is the time to be converted. |
| 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.
| p | is the pdb structure to write out. |
| fname | is the file name to be written. |
| 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.
| p | is the pdb structure to write out. |
| fname | is the file name to be written. |
| 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.
| p | is the pdbf structure to write out |
| fname | is the file name to be written |
1.7.6.1