Free Code

Here are bits of code and even a few complete programs you might find useful. Of course, I'd like to hear of any errors you find or corrections or improvements you make.


The code here makes up a library of routines that I use frequently. None of them are as good as libraries provided by other sources but they are free, they seem to work with any ANSI C++ compiler, and they seem to work well with each other.

What it's called What it does.
tarray.h Templates for fixed size vectors and matrices that can do
  • +,-, scalar multiplication
  • matrix-vector multiplication

The matrix classes include LU decomposition and backsubstitution routines suitable for solving most linear systems. You can have parametric vectors with components in any class that provides definitions of :

  • a copy operation,
  • =(assignment),
  • ==(test of equality),
  • +,-,
  • scalar multiplication by doubles.
llist.h This file offers a rudimentary list that expands and contracts in order to hold what is asked of it. You can manipulate the items contained in the list by using subscripts --- the [] operator.
  • Subscripted access via the [] operator
  • Search(value) returns the subscript of item holdins value or -1
  • Insert(), Append(), and Remove()
stack.h Based on the list.h class, this file provides a simple parametrized stack with
  • Push(value)
  • Pop()
  • Empty()
These files provide a rudimentary String class. They were written because I needed to write a program on SOLARIS 2.3 but had no access to GNU libc++ (which would work just fine) or documentation for SUN's libraries. (Don't ask why!)
  • Copy
  • Concatenate
  • Search (no regular expressions)
  • Replace
Code for random number routines and numerical prcedures I use most
most frequently. Included are functions for randomizing the components of a vector.
  • Gamma and Beta functions
  • Binomial and Multinomial probabilities
  • Random (uniform) doubles and ints in specified ranges
  • Randomization of vector components
  • Generating random permutations

Use these routines with vectors and arrays of doubles and ints found in
Vector and matrix classes of doubles and ints. These classes are essentially those provided in tarrays.h. They're used in several programs mentioned below.
random.h The classes defined in this file use two different random number generators (the system supplied rand() and a generator based on Knuth's subtraction method) to produce Uniform, Normal, Exponential random numbers.
splines.h These classes implement piecewise C^1 cubic splines and piecewise C^0 linear splines.

Java This file contains classes and methods needed to evaluate formulae. You can see how the code works by looking at the calculator applet. Email me if you think you need this code. I'm not making it generally available since it seems to turn up frequently in student's programming assignments. This file contains classes for an applet that lets you include the graphs of functions in an HTML document. You can see a demo of how it works in the browser test pages of the Onlne Exercises demo.Email me if you think you need this code. I'm not making it generally available since it seems to turn up frequently in student's programming assignments.
StatCalc.javaAn applet that performs simple statistical calulations. You can preview the applet.


Online Exercises This package contains the Onine Exercises system. It accepts a file written in "QuizMaker", (an extension of LaTeX) and produces a file that can be processed by LaTeX2html. It provides automatic generation of graphs, randomization of parameters, selection of questions, etc. See the Online Exercises demo page for more information.


is a program to make population genetic inferences from multilocus probe data.