2010-05-16  Joel James Adamson  <adamsonj@email.unc.edu>

	* merging diskron branch back into trunk

2010-05-14  Joel James Adamson  <adamsonj@email.unc.edu>

	* tests/tlta.c (main): now both alleles should fix, so we can use
	a static array as a "goal"; new output procedure uses snprintf and
	fprintf to avoid garbled output when using OpenMP 

	* src/rec.c (rec_mating): this function now divides frequencies by
	the total of the new frequencies

2010-05-11  Joel James Adamson  <adamsonj@email.unc.edu>

	* tests/sparse_test.c (main): maintains functionality, but now
	uses updated sparse_mat_tot

	* tests/pop_ck.c (main): now only prints if DEBUG is defined

	* src/rec.c (rec_mating): now uses the updated sparse_mat_tot

	* src/sparse.c (sparse_mat_tot): this function now computes the
	sum of the entries in the  Kronecker product of a dense matrix and
	a sparse matrix

2010-05-07  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/haploidpriv.h: removed; sparse vector operations now in
	sparse.h

	* src/sparse.c: removed sparse_vec_to_array; dig it up later if it
	becomes useful

2010-05-06  Joel James Adamson  <adamsonj@email.unc.edu>

	* configure.ac: removed system extensions; added C99;

2010-05-03  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/geno_func.c (ld_from_geno): this function calculates linkage
	disequilibrium as the deviation from random mating

	* added diseq.c which tests linkage disequilibrium function
	ld_from_geno ()

2010-04-25  Joel James Adamson  <adamsonj@email.unc.edu>

	* tests/tlta.c (main): fixed this so it only makes one call to
	sim_stop_ck (); previously I had five to check if it had fixed or
	lost either allele; this was prohibitively slow: don't let it
	happen again

	* merging all branch changes back into trunk

2010-04-24  Joel J. Adamson  <adamsonj@email.unc.edu>

	* src/rec.c (rec_mating): now alters an array of doubles passed in
	as the first argument (hoping for speed)

2010-04-23  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/rec.c (rec_total): this function now returns an heuristic
	result for the case of no recombination across the whole chromosome
	(rec_gen_table): added transcription of transposed values (the
	first clause in the if statement checks for the transpose value)
	(rec_total): corrected the starting position in the loop for the
	degenerate case

2010-04-20  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/haploid.h: changed int types to size_t where appropriate

	* src/rec.c (rec_gen_table): changed the logic of how endptr is
	assigned; now endptr is only altered when we definitely need to
	add a new link

2010-04-16  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/rec.c (rec_mating): removed OpenMP directive here; the
	library is now free of OpenMP code

	* src/sparse.c (sparse_mat_mat_kron): made this construct a while
	loop; as a for-loop it was improperly constructed

2010-04-14  Joel James Adamson  <adamsonj@email.unc.edu>

	* configure.ac: added a check for libgomp

	* src/haploidpriv.h: added an include for omp.h

2010-03-29  Joel James Adamson  <adamsonj@email.unc.edu>

	* merging sparse matrix implementation into trunk

2010-03-28  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/sparse.c (sparse_mat_mat_kron): replaced mistaken use of
	sparse with sparseptr; this was causing a weird error in tlta
	calculations

	* src/rec.c (rec_gen_table): replaced use of "sum" with a call to
	rec_total; the only other way to avoid the function call is to
	exploit the symmetry of the recombination table (either in
	calculation or in use)

2010-03-26  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/rec.c (rec_gen_table): the call to malloc now requests an
	array of properly sized pointers (sizeof (sparse_elt_t *))

	* src/mating.c (rmtable): this function now returns a matrix
	(double **)

2010-03-25  Joel James Adamson  <adamsonj@email.unc.edu>

	* Sparse matrix API is finished; a structure to hold geno, nloci,
	recombination table and mating table now exists as haploid_data_t;
	the API has not been thoroughly tested yet

	* src/sparse.c (sparse_mat_tot): this performs the necessary
	calculation for the mating step

	* src/bits.c (bits_ffs): this function is a wrapper for the
	builtin gcc function of the (almost) same name; it includes
	conditional compilation of a portable (non-GCC) version

	* src/recomb.c (rec_mating): this function performs the mating
	step, and contains an OpenMP orphan directive

2010-03-24  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/sparse.c (sparse_mat_mat_kron): new function finds Kronecker
	product of a dense matrix and a sparse matrix; this and a sparse
	matrix-vector product is all we require for mating algorithm
	(sparse_mat_vec_mul): this is the function mentioned above

	* src/recomb.c (rec_total): this replaces the last
	Kirkpatrick-written algorithm; file name will need to change

2010-03-19  Joel James Adamson  <adamsonj@email.unc.edu>

	* tests/sparse_test.c: included header material here that is not
	part of the API yet (we'll see what's necessary after modifying
	recombination ())

	* src/sparse.c (sparse_mat_mat_mul): this function has replaced
	sparse_vec_mat_mul () completely, since matrix multiplication is
	really what I need.  This works with a small matrix, now test with
	a large matrix!
	(sparse_mat_mat_mul): replaced the while loop with a for loop;
	this is still not parallelizable, unless we implement some kind of
	walk-up procedure or array of endptrs like I tried with the
	compound vector multiplication procedure; that might still cause
	synchronization problems, however.  Trying to parallelize the
	calling code made the code significantly slower and totally
	screwed up the data

2010-03-18  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/sparse.c (sparse_mat_mat_mul): this function multiplies a
	dense matrix (an array of pointers to double) times a sparse
	matrix; this will be the basis of mating calculations

2010-03-17  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/haploid.h: added some functions from sparse.c for testing purposes

	* src/sparse.c: New data structure to totally overhaul all
	operations; this sparse matrix will be the new backbone of all
	operations.  Matrices and vectors are represented as linked lists
	where each entry contains a value, indices and a pointer to the
	next value in the list.  The difference between matrices and
	vectors is, in fact, superficial.  A row vector has 0 for all
	rows, and a column vector has 0 for all columns.  A test suite is
	in tests/sparse_test.c

2010-03-16  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/geno_func.c (genotype_to_allele): eliminated calls to
	bithacks.h functions for real this time

2010-02-24  Joel James Adamson  <adamsonj@email.unc.edu>

	* tests/pop_ck.c (main): some beautification, plus replaced "1|0"
	with "Yes|No" in last column

	* tests/tlta.c (main): changed bithacks.h macro to bits_isset

	* src/spec_func.c (euclid_dist): removed useless check for null
	pointer

2010-02-23  Joel James Adamson  <adamsonj@email.unc.edu>

	* Makefile.am (EXTRA_DIST): added pdf documentation to
	distribution

	* got rid of bithacks.h; updated all function calls and documentation

	* tests/pop_ck.c (main): this function now uses the functions from
	bits.c (all of them)

	* Makefile.am (libhaploid_la_SOURCES): added bits.c with functions
	that perform the same purposes as the macros in haploid.h

2010-02-22  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/recomb.c (zygote_genotypes): simplified the code a bit,
	using side-effect operators and removing the useless bit[k] array

	* Makefile.am (libhaploid_la_SOURCES): removed debug.c as its
	functions are not useful (now that I understand how to read hex
	digits!)

2010-02-07  Joel James Adamson  <adamsonj@email.unc.edu>

	* configure.ac: changed default behavior back to shared libraries
	added more headers to CHECK_HEADERS

	* Makefile.am (bin_PROGRAMS): promoted rec_ck to a bin_PROGRAM
	since it is a useful tool in general

2010-02-06  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/haploid.h: added GNU error.h so we can apply the error
	function in the library and applications

	* src/recomb.c (set_rec_table): added an initialization for the
	rec_table, since it held junk that happened to cause very specific
	sorts of errors (????????????); this appears to fix both the
	positive value bugs and the NANs

2010-02-05  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/recomb.c (set_rec_table): fixed an erroneous call to
	zygote_genotypes (), that had geno as the last argument instead of
	nloci; this fixes one of the bugs in the output rec_tables
	(producing positive values where they should be 0); still need to
	take care of nans

	* UPDATE: this didn't actually fix the bug; I still get the same
	behavior

	* src/debug.c (debug_print_array_double): this function returns a
	formatted string of a double precisions number referenced in an
	array; this function is arbitrarily limited by the size of the
	output array; I would like to find a more flexible way to do this
	(file a bug for this)

	* configure.ac: made static libraries default; it would be good to
	change this, but it makes the most sense for developing programs
	like rec_ck; users can still install shared libs with
	--enable-shared at ./configure time

	* Makefile.am (AM_CFLAGS): added openmp flags to CFLAGS; also
	added -Wall and -pedantic for better compiling
	(check_PROGRAMS): added rec_ck as a noinst program

2010-01-29  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/recomb.c (set_rec_table): removed the else-arm of the if
	after checking for NAN (makes nesting too deep)

	* src/debug.c (debug_printbits): changed filename to debug.c;
	changed function name to debug_printbits

2010-01-20  Joel James Adamson  <adamsonj@email.unc.edu>

	* src/recomb.c (rec_prob): removed get_bit () and replaced its
	only call with B_IS_SET
	(rec_prob): changed this to ? notation to get a single line
	(zygote_genotypes): removed gratuitous use of pointer

	* Makefile.am: eliminated target-specific LDADD variables

	* src/bits.c (printbits): new file and new function that displays
	a printed binary representation of an unsigned integer; this
	should be useful in debugging; see also tests/pop_ck.c

2010-01-19  Joel James Adamson  <adamsonj@email.unc.edu>

	* Makefile.am: eliminated INCLUDES or its modern alternative
	AM_CPPFLAGS as DEFAULT_INCLUDES already defined as -I.  

	* src/haploidpriv.h: added an #include directive for bithacks.h.
	Note: this is a compile-time directive for the library; the
	directive in haploid.h is for compile-time of applications, and
	therefore the directive in haploid.h uses brackets instead of
	quotation marks

2010-01-15  Joel James Adamson  <adamsonj@email.unc.edu>

	* tests/pop_ck.c (main): added a test for POP

	* src/haploid.h: POP computes the number of set bits of an integer

2010-01-11  Joel James Adamson  <adamsonj@email.unc.edu>

	* el/haploid-bug-collect.el (haploid-bug-collect): this function
	will scan a buffer and collect bug info and insert it into the
	Org-Mode file BUGS

2010-01-09  Joel James Adamson  <adamsonj@email.unc.edu>

	* configure.ac: generated by autoscan and edited by me

	* src/haploidpriv.h: added include for config.h

	* Makefile.am (lib_LTLIBRARIES): changing the name of the library
	to "libhaploid"

2010-01-08  Joel James Adamson  <adamsonj@email.unc.edu>

	* configure.in: added m4 directory (see Makefile.am); replaced
	AC_PROG_RANLIB with AC_PROG_LIBTOOL

	* Makefile.am (LDADD): made adjustments for building and
	installing as a shared library
	(ACLOCAL_AMFLAGS): added m4 directory to this variable
	(haploid_TEXINFOS): added dependency for building info file; this
	builds haploid.info just fine, but will not include
	fdl-$VERSION.texi into the distribution with `make dist'.
	Therefore `make distcheck' fails

	* tests/tlta.c (main): changed header to two newlines to
	facilitate graphing with gnuplot

2010-01-07  Joel James Adamson  <adamsonj@email.unc.edu>

	* haplib/haplib.h: inserted include for bithacks

	* Makefile.am (info_TEXINFOS): changed filename to reflect new
	name of TeXinfo file

	* haplib/haplibpriv.h: added fenv.h

	* haplib/recomb.c (set_rec_table): added a test for a NAN such
	that if we get garbage for zygote_prob we return FE_INVALID after
	obtaining zygote_prob

2010-01-04  Joel James Adamson  <adamsonj@email.unc.edu>

	* doc/haploid.texinfo: skeleton of texinfo file

	* doc: added doc directory 

	* tlta.c: adjusted calls to library functions to reflect new
	prototypes

	* haplib: library functions now take variable-length arrays as
	arguments.  Removed declarations of GENO and NLOCI from
	haplibpriv.h

2010-01-03  Joel James Adamson  <adamsonj@email.unc.edu>

	* tests/tlta.c: moved functions to library (now this file only
	needs two functions of its own)

	* haplib/haplib.h: added prototypes for functions in mating.c and
	geno_func.c

	* Makefile.am (libhaplib_a_SOURCES): added sources for mating.c
	and geno_func.c

	* haplib/mating.c: added this file for creating mating tables;
	only entry now is rmtable ()

	* haplib/geno_func.c: added this file for special genetic
	functions

	* haplib/bithacks.h: moved to ./haplib

	* tests/tlta.c: declared rect outside main
	(main): initialized rect here.  Everything appears to be working
	now.

	* haplib/haplibpriv.h: fixed some headers

	* Makefile.am (LDADD): removed links to gsl

	* haplib/spec_func.c (euclid_dist): removed call to malloc; not
	needed; just initialize array with len

	* haplib/haplibpriv.h: removed dependence on gsl as it was just
	hangin' things up

	* haplib/recomb.c (set_rec_table): changed over to array notation
	completely; I realized that these are not variable length arrays,
	since GENO and NLOCI are known at compile time (they are
	preprocessed!).  Did away with troubling, potentially time-saving
	trick of setting a single element equal to one and the rest to
	zero.  Just make sure that (manually) uninitialized entries are
	indeed set to zero; still mirroring the cases for j < i.
	(recombination): changed arguments to array notation

	* tests/tlta.c (main): initialized srand () with a literal so as
	to make a good test
	(genotype_to_allele): added this function to generate allele
	frequencies from genotypes
	(rmtable): switched to array notation

	* haplib/spec_func.c (gen_mean): switched to array notation; not
	sure if this was really the problem, but the code is much clearer

2010-01-01  Joel James Adamson  <adamsonj@email.unc.edu>

	* tests/tlta.c (main): changed scheme for generating initial
	conditions; now generated on-the-fly instead of once at the
	beginning
	(allele_to_genotype): added this function (could be transferred to
	library); only useful for initial frequencies!

	* tests/bithacks.h: added this file for tlta; 

2009-12-31  Joel James Adamson  <adamsonj@email.unc.edu>

	* tests/tlta.c (next_gen): changed some objects from pointers to
	arrays; since we have variable-length arrays we don't need dynamic
	allocation really

	* haplib/recomb.c (set_rec_table): zyg is now a 2-member array, as
	I realized that for each mask you get two genotypes (or you dont
	because mask 0 represents no recombination).  Also changed
	mask_lim back to 2^(NLOCI - 1)
	(recombination): put this back into array notation; compiles but
	still segfaults (same line?)
	(recombination): changed formal parameter F from double * F[GENO]
	to double F[GENO][GENO]; made corresponding change in haplib.h

2009-12-30  Joel James Adamson  <adamsonj@email.unc.edu>

	* haplib/recomb.c (get_bit): changed order of arguments, as
	Kirkpatrick's version seemed unnatural (the index should come
	second)

	* tests/tlta.c (next_gen): populated 2d array of double * with
	calloc before passing to set_rec_table

	* tests/sim_stop.c (GENO): defined GENO before including haplib.h

	* haplib/haplib.h: changed prototype of set_rec_table to accept
	double * 2d array; same change to recombination prototype.
	haplib.h  must come after a definition of GENO and NLOCI (how
	non-standard is this?); otherwise we create incomplete element
	type definitions for rec_table

2009-12-29  Joel James Adamson  <adamsonj@email.unc.edu>

	* haplib/spec_func.c (sim_stop_ck): no longer makes non-local
	exit; that doesn't make sense when we want to return to main for a
	new set of initial conditions; now returns 0 or 1

	* haplib/recomb.c (set_rec_table): changed to reflect algorithm
	detailed in BUGS (see entry for recomb.c:194)

	* Makefile.am (AM_CFLAGS): added -ggdb; be sure to use
	CFLAGS='-O0' on the command line to disable optimization when
	debugging

2009-12-26  Joel James Adamson  <adamsonj@email.unc.edu>

	* haplib/haplib.h: same changes as for haplibpriv.h (see below)

	* configure.in: reconciled version numbers to 0.01
	Added system extension macro for _GNU_SOURCE

	* haplib/haplibpriv.h: removed _GNU_SOURCE macro from this file;
	put it into configure.in

2009-12-16  Joel J. Adamson  <adamsonj@email.unc.edu>

	* haplib/haplibpriv.h: added default definitions for NLOCI and
	GENO using #ifndef; conditional compilation is not called for in
	this case (see TODO)

2009-12-15  Joel J. Adamson  <adamsonj@email.unc.edu>

	* tests/sim_stop.c (main): added another condition to the while
	loop, so that if the iteration goes for more than a million the
	test fails (i.e. sim_stop_ck isn't kicking in); this will be more
	important once sim_stop_ck can accept other functions for its
	distance criterion

	* Makefile.am (AM_CFLAGS): added this variable to enforce gnu99
	standard

	* haplib/haplibpriv.h: none of the (function) declarations in this
	file were necessary; recombination might be necessary later, but
	as of now, nothing calls it.  

	* haplib/recomb.c: switched around order of functions so that
	helper functions are clearly before their callers, this way they
	don't clutter the header file
	(zygote_genotypes): changed type; added much commentary; removed
	double for-loop (no need to initialize all of bit to zero; if we
	really needed to do that we could use calloc)
	(set_rec_table): removed zyg_ck commensurate with void type of
	zygote_genotypes (); this may be totally irresponsible
	programming, but I can't think of what (semantically) will go
	wrong with zygote_genotypes ()!

2009-12-11  Joel J. Adamson  <adamsonj@email.unc.edu>

	* haplib/recomb.c (set_rec_table): set length of *zyg using calloc
	to 2; checking the value of zygote_genotypes; this check still
	doesn't do anything: zygote_genotypes only returns 0.  I'm trying
	to think of things that could go wrong.  The function should still
	return int.

2009-12-10  Joel J. Adamson  <adamsonj@email.unc.edu>

	* tests/sim_stop.c (main): made this a while loop instead of a
	do-while loop; the reason the test (semantically) failed is
	because is started with n = 1.  1^2 is still 1, thus oldarray and
	simarray were identical to start with.  This now compiles and runs
	successfully

	* Makefile.am (TESTS): removed subdirectory from filename

2009-12-09  Joel J. Adamson  <adamsonj@email.unc.edu>

	* Makefile.am (sim_stop_LDADD): added this variable and made
	sim_stop link properly (see 2009-11-30)

2009-11-30  Joel James Adamson  <adamsonj@email.unc.edu>

	* tests/sim_stop.c (main): changed a few things to fit with GNU
	Coding standards.  This is not linking.

	* haplib/haplib.h: moved a few headers from haplibpriv.h to haplib.h

	* Makefile.am (check_PROGRAMS): added this target; sim_stop still
	not linking

2009-11-26  Joel James Adamson  <adamsonj@email.unc.edu>

	* haplib/recomb.c (set_rec_table): calculating position to augment
	in rec_table by pointer arithmetic; this is superior to using
	arrays for a few reasons.  

2009-11-24  Joel J. Adamson  <adamsonj@email.unc.edu>

	* haplib/recomb.c: put all "doc string" comments inside function
	tags, and indented; added page breaks including a page break at
	the end.
	(recombination): reformatted do-while loop to conform to GNU CS
	(recombination): added postfix increment operator to rec_table in
	line 212
	(zygote_genotypes): added integer return value to zygote_genotypes ()
	(set_rec_table): checking return value of zygote_genotypes ()

2009-11-19  Joel J. Adamson  <adamsonj@email.unc.edu>

	* haplib/haplib.h: removed prototypes internal to library; added
	an external prototype for sim_stop_ck

	* Makefile.am (libhaplib_a_SOURCES): setting up for library
	with tests instead a single binary

	* haplib/recomb.c (recombination): completely redid iteration, so
	that now the whole process takes place in one += call.  This
	routine now compiles without syntactic error.  Put a test case in
	TODO. 

2009-11-18  Joel J. Adamson  <adamsonj@email.unc.edu>

	* haplib/recomb.c (rec_prob): added r as an argument to this
	function.  Kirkpatrick sez: /* The pairwise recombination rates
	r[0],r[1],...,r[nLoci-1] are declared and initialized external to
	this routine.  */  They should not be, so that we can use this
	function on multiple r tables in a single program.
	(get_bit): made static inline
	(get_bit): casted calls to pow as integers; I still feel like
	there must be a library function for this somewhere, something
	that has already been debugged.  Put a test case in TODO

2009-11-17  Joel J. Adamson  <adamsonj@email.unc.edu>

	* haplib/tests/sim_stop.c (main): created test for sim_stop_ck;
	not tested yet!!!!

	* haplib/spec_func.c (sim_stop_ck): added first testing version of this
	function.  Uses an internal function to check for closeness then
	exits if below tolerance.  This is to stop having to code this
	every damn time.
	
2009-11-13  Joel J. Adamson  <adamsonj@email.unc.edu>

	* func.h: removed Xstate_t definition; the new paradigm doesn't
	justify it

	* recomb.c (recombination ()): changed indices to variables and
	macros (len in L162) and gave recombination two arguments, double
	* rec_table and double * F.  Allocating xt using calloc () and
	made a fatal error for a failed return from calloc ().

	(set_rec_table (double * rec_table)): now accepts a pointer to the
	recombination table; removed debugging code (should be part of
	test, not in function itself)

Copyright 2009, 2010 Joel James Adamson <adamsonj@email.unc.edu> 	
