Skip to content
This repository

A standalone and lightweight C library

tree: 91dad44653

Fetching latest commit…

Cannot retrieve the latest commit at this time


Klib is a standalone and lightweight C library. Most components are independent
of external libraries, except the standard C library, and independent of each
other. To use a component of this library, you only need to copy one or two
files to your souce code tree without worrying about library dependencies.

Klib strives for efficiency and a small memory footprint. Some components, such
as khash.h, kbtree.h, ksort.h and kvec.h, are among the most efficient
implementations of similar algorithms or data structures, and use less memory
than many others.


khash.h         Generic hash table
kbtree.h        Generic B-tree
ksort.h         Generic sort
kseq.h          Generic stream buffer plus a FASTA/Q parser
kvec.h          Generic vector
klist.h         Generic single-linked list plus a memory pool
kstring.{h,c}   String library
ksa.c           Constructing suffix arrays for strings with multiple sentinels
knetfile.{h,c}  Random access to remote files
kopen.c         Smart stream opening

kfunc.c         Special mathematical functions
krand.{h,c}     Pseudo-random number generator mt19937
kmin.{h,c}      Derivative-free non-linear programming
khmm.{h,c}      Basic HMM library
ksw.(h,c}       Smith-Waterman using SSE2
knhx.{h,c}      Newick format parser

lua/            Miscellaneous Lua libraries


Most of the source codes are released under the MIT/X11 or the BSD license.

Something went wrong with that request. Please try again.