Alpha Squared C++ Library

The AlphaSquared C++ Library is a collection of efficient C++ classes designed especially for mathematical and scientific computing. It is pure C++ and currently runs under all Microsoft Windows platforms with both Visual C++ and Borland compilers. It can also be used in a limited capacity under Linux gcc.

The library can be licensed for external commercial use, but it is more commonly used as the foundation of projects that we develop.

We are actively seeking projects of a scientific, mathematical or medical nature.
Please contact:
Historically we have focused on projects in the Boston area.

AlphaSquared Philosophy

Graphical User Interface

Example Classes

Library Size

Recent Example Applications

Our Philosophy

The primary impediment to better software development is the difficulty of using existing software components to solve new problems. Solutions to an astronomical number of problems are already available, but software solutions are difficult to reconfigure for new problems. This is a question of evolvability, which nature herself faces in all life forms. Assembly CodeAlthough this may seem to be stretching an analogy, the issues of information storage and the tradeoff between current operation and future fitness in a changing environment are really quite similar. The current implementation must be reasonably efficient, but to avoid dead ends in the future, evolvability is just as important. The solution to evolvability is to avoid dependence on closed, and usually invariant, components. In the short term this inevitably comes at a cost, mostly in the high skills required of the developer, but it excels in the long run.

Change must be possible at all levels, from the lowest to the highest. Fortunately, the designers of C++ were careful to preserve the low level efficiency of C while extending the language to higher levels with object oriented and template constructions. Additionally, the strict type checking of C++ has DNAproved to be an excellent use of processing power for medium and large projects to uncover logical errors. The template mechanism in C++ has been unexpectedly powerful for the highest level of abstractions, stating some patterns that were thought until only recently to be nearly impossibleGOF to implement efficiently and generally.Alexandrescu 

The pure C++ implementation of algorithms, and the avoidance of platform and vendor dependencies, allow the library to evolve rapidly with the improvements in the C++ language itself.

Although we commend the portability and clarity of Java, the library is implemented in C++ because of its higher efficiency and the existence of templates which are not currently available in Java. The Java language is somewhat simpler for the beginner and intermediate level programmer, but its relatively consistent 5-10x efficiency cost relative to C++ for our applications is prohibitive. C++ templates, when used to express not only generics but also much higher level patterns, significantly increase the expressiveness of the language over Java, reducing errors, hiding implementation details, and increasing productivity. In our experience the strict object oriented style of Java is helpful for clarity and organization but becomes an impediment to expressing higher level organizational patterns. Some current work on Aspects in Java that crosscuts pure object orientation may make the language more competitive in the future.

Related link:        

Recent Applications


Statistical data mining of very large data sets. Heavily statistical, genetic algorithm based, symmetric multiprocessing. (currently proprietary)


Relativistic computation of atomic energy levels for atomic scattering potentials.


interactive stereographic molecular viewer
diatomics to DNA fragments

HTTP Server

compact efficient multithreaded platform independent WWW server

Genetic Algorithm Library

template based, nature inspired, statistical, and noise-safe optimizer


compact database specialized for local high speed access and gigabyte archives

Data Regex

grammar based search for patterns in numeric data

Surface Plot
and Chemistry Geo

simple 3D graphics for mathematical plotting and molecular structure presentation
Scientific programs

Molecular Dynamics

computation and display of atomic motion especially for atomic and molecular clusters

Gas Phase Electron Diffraction

simulator of scientific experiment
(public executable)

GPED Image Processing

image processing software for scientific 16-bit CCD data (public executable)

Molecular Dynamics ED

simulation of molecular dynamics for electron diffraction (public executable)

Paul Trap Ion Motion Simulator

simulation of radio-frequency container for charged atoms and molecules (public executable)

C60 Charge Distribution

computes possible molecular charge distributions (example application)


mass calibration for time-of-flight mass spectrometers (example application)


computation of electronic wavefunction in metallic particles (example application)
Small Projects

Self-Organized Nets

primitive classifier or cluster analysis based on neural nets


HTML generation for image sets (non-technical)

Some of these applications are not publicly available but additional information is available on request.

Example Classes

  • arrays
  • vectors
  • linked lists
  • deques
  • stacks
  • strings
  • associations
  • maps
  • pairs
  • bit set
  • scrolling buffers
  • memory buffers
  • smart pointers
  • tree nodes
  • matrices
  • sparse matrices
  • complex numbers
  • elementary statistics
  • random numbers
  • eigenvalues/matrix diagonalization/SVD
  • FFT
  • linear & non-linear curve fitting
  • numeric utilities
  • numerical function integration
  • misc math functions
  • non-linear least squares
  • polynomials
  • differential equation integration
  • function minimization
  • numerical roots
  • Gray codes
  • sequences
  • spatial coordinates
  • histograms
  • indexable objects
  • rectangles
  • histograms
  • threads
  • mutexes
  • semaphores
  • SMP support
  • TCP/IP streams
  • HTTP interface
  • HTML generation
  • simple HTTP client
  • efficient multithreaded HTTP server
  • threads
  • event handling
  • exceptions
  • class traits
  • variants
  • timers
  • abstracted OS interface
  • file and directory iterators
  • subscribers/broadcasters
  • ascii database
  • logging streams
  • abstract text classes
  • streamable/persistence interfaces

Library Size

The heavy use of C++ templates has allowed the library to increase in size only gradually over the past few years while its functionality has improved dramatically. This code reuse has also decreased programming errors by making them more likely to be evident at earlier stages. Currently the library size is approximately:


297 files

74,000 lines of code


87 files

20,500 lines of code


Projects developed with AlphaSquared

298 files

62,400 lines of code


(as of 3/2002)

Graphical User Interface

Molecular Structure Determination
click here

"The future offers very little hope for those who expect that our new mechanical slaves will offer us a world in which we may rest from thinking. Help us they may, but at the cost of supreme demands upon our honesty and our intelligence. The world of the future will be an even more demanding struggle against the limitations of our intelligence, not a comfortable hammock in which we can lie down to be waited upon by our robot slaves."

Norbert Wiener
God & Golem, Inc., 1964

Back to


Design Patterns, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (Gang of Four)


Modern C++ Design, Generic Programming and Design Patterns Applied, Andrei Alexandrescu, 2001.