| Home | About | Links | Problems | Independent Source Files | Contact |
These are a series of independent source files. All of these files are included in my BaseCode, but could easily be used independently of it. All code comes with a simple file containing a main() function that demonstrates using the code. Unless otherwise stated, the example file should be compiled by itself.
This is mostly equivalent in function to STL's vector class, but contains fewer functions and is not as optimized. It is more useful for me to use a Vector class I wrote myself since I have more control and understanding of its inner workings. Its source is in ArrayVector.h and ArrayVector.cpp because I use Vector.h and Vector.cpp for 3D and 4D space vectors.
ArrayVector.h, Web Version
ArrayVector.cpp, Web Version
ArrayVectorExample.cpp, Web Version
Like the Vector class, this is mostly equivalent in function to STL's linked list class, but contains fewer functions and is not as optimized. It is pretty much what you would expect from a linked list class. It can dump the data it contains into a Vector of the same type, so it needs to have the Vector source code above as well.
LinkedList.h, Web Version
LinkedList.cpp, Web Version
LinkedListExample.cpp, Web Version
These are structures to handle (x, y, z) and (x, y, z, w) vectors, where all variables are real numbers. When using DirectX, you have access to the D3DXVECTOR2, D3DXVECTOR3, D3DXVECTOR4, and D3DXMATRIX classes, among several others. These types of structures are very useful and used constantly in almost all graphics programming applications ever written. However, they are ovbiously not cross-platform, so I decided to write my own. I have not found myself using 2-D vectors often enough to bother with a seperate structure for it, and instead use 3D vectors with zero z-component.
Vector.h, Web Version
Vector.cpp, Web Version
VectorExample.cpp, Web Version
This is a simple 4x4 matrix class that handles matrix multiplication, inversion, a large number of transformation types, 3 or 4 vector times a matrix multiplication, and several other typical matrix features. It can convert back and forth between the D3DXMATRIX type, but you have to #define USE_DIRECTX for it to do so; by default you don't need anything related to DirectX to use the class.
Matrix.h, Web Version
Matrix.cpp, Web Version
MatrixExample.cpp, Web Version
This is a simple sparse matrix class. A sparse matrix is a potentially very large matrix, in which almost all the rows and columns are zero. It is very useful for certain problems, such as finite-element simulations or automatically solving for texture coordinates across a surface mesh. For an example of the sparse matrix class, see the LinearSolver class.
SparseMatrix.h, Web Version
SparseMatrix.cpp, Web Version
This is a class that solves the equation Ax = b, where A is a very large sparse N x N matrix, and x and b are N x 1 column vectors. It works quite fast, although it uses only diagonal preconditioning, and uses the biconjugate gradient descent algorithm. While designed for massive, sparse systems (say 100000x100000) with fewer than 100 elements in each row/column, it also works very fast for smaller, dense systems.
LinearSolver.h, Web Version
LinearSolver.cpp, Web Version
LinearSolverExample.cpp, Web Version
This is a relatively small class for doing non-linear minimization of an error function given a number of variables that affect the error function. This was origionally written for a neural network class, but has applications in countless areas. Normally, you'd want to use a professional optimizer to handle hundreds upon thousands of variables. This class will only run at reasonable speeds for around a hundred variables, and perhaps not even that if the error function takes a long time to compute. The example demonstrates using the optimizer to find the best 4th degree polynomial passing through 10 (x, y) pairs (this is actually a linear problem and thus an exact solution exists, but the optimizer treats all functions as if they are non-linear.) Note that the optimizer class uses the Vector class (ArrayVector.h/ArrayVector.cpp) to store the array of variables.
Optimizer.h, Web Version
Optimizer.cpp, Web Version
OptimizerExample.cpp, Web Version
last updated: 09 May 2005 © 2005 by Matthew Fisher