courtesy of
Ken Turkowski
turk@computer.org
The source code available from this page may be freely downloaded and used in any applications for any purpose, as long as the code is used in its entirety and the copyright notice and warranty information is retained.If you make any improvements to this software, you should provide me with said improvements.
If any of this code is incorporated into a commercial product, you should notify me of this by email, and provide me with a complimentary copy of said product. :)
Index 

Polynomial Roots



Inverse Square Root  
Cube Root  
Complex Roots of a Quadratic Equation  
Real Roots of a Cubic Equation  
Complex Roots of a Polynomial Equation  
FixedPoint Square Root  
Nonlinear Functions


Real Roots of a Scalar Nonlinear Function  
Real Roots of a System of Nonlinear Functions  
FixedPoint Trigonometric Functions using CORDIC  
Linear Algebra


Linear Transformations  
Null Space, EigenVectors  
Miscellaneous Numerical Functions


Machineindependent I/O for IEEE FloatingPoint Numbers  
8Bit Unsigned FloatingPoint  
Image Processing


Zone Plate Test Pattern  
Image Rotation by ±90°, 180°  
QuickTime VR


Matrix to Display a Movie within a Panorama 
Inverse Square RootThis is useful for normalizing vectors, because it eliminates divisions. It is faster that extracting the square root and reciprocating because only as much precision is computed as needed. This was inspired by a Weitek Technical note, was coded into C by me, and was published by me in Graphics Gems V, Academic Press.
InvSqrt.c 
Cube RootThis is an efficient methods for computing the cube root of a number in single precision. I wrote this code to assist in computing quadratic forward differencing for image warps.
CubeRoot.c 
Quadratic RootsThis finds the complex roots of a quadratic equation using an algorithm that is more robust than the usual one.
FindQuadraticRoots.c 
Real Roots of a Cubic EquationThis will find the real roots of a cubic equation with real coefficients.
FindCubicRoots.c 
Complex Roots of a Polynomial Equation with Real CoefficientsThis will find all of the roots of a polynomial equation with real coefficients. I converted this to C from the Fortran code in ACM algorithm #30, Numerical Solution of the Polynomial Equation, written by K. W. Ellenberger.
FindPolynomialRoots.c 
Roots of a Nonlinear FunctionThis finds the roots of an arbitrary function. An initial guess is given for each one. I converted this to C from ACM Algorithm # 25, Real Zeros of an Arbitrary Function, written by B. Leavenworth.
FindZerosOfFunction.c 
Fixed Point Square RootThis finds the square root of a fixed point number with 30 fractional bits.
FractSqrt.c 
Nonlinear System of EquationsThis will solve a nonlinear system of equations. I converted this to C from Algol from ACM Algorithm #316, Solution of Simultaneous NonLinear Equations, written by K. M. Brown.
SolveNonlinearSystem.c 
FixedPoint Trigonometric Functions using CORDICThis module computes a variety of trigonometric functions in fixedpoint, using CORDIC iterations. I wrote this after reading the seminal paper by Walther.
Cordic.c 
General Purpose Linear TransformationsThis generalpurpose workhorse for linear transformations with arbitrary sized matrices is nearly as efficient as specialpurpose routines written for fixed sized matrices. I wrote this because I wanted to take advantage of the efficiency afforded by pointers rather than array indices, in part to simulate dedicated hardware to perform matrix multiplication.
LinearTransform.c 
Null Space of a Square MatrixThis procedure, to find the null space of a square matrix, is especially useful for finding the eigenvectores corresponding to a particular eigenvalue. I converted this to C from ACM Algorithm 270, Finding Eigenvectors by Gaussian Elimination, written by Albert Newhouse, University of Houston.
NullSpace.c 
Machineindependent I/O for IEEE floating point numbersThese routines provide machineindependent I/O for IEEE floating point numbers in single, double and extendedprecision formats (32, 64, and 80 bits, respectively), irrespective of the actual floatingpoint format used on a given machine. These routines were written by me and Malcolm Slaney, primarily to support the AIFF sampled sound format, which makes use of IEEE extended precision floating point format, as well as single and double precision. This has been used on a wide variety of platforms, including the Cray, DEC, and IBM mainframes, which did not use IEEE floatingpoint as its native floatingpoint format, as well as Intel's x86, Motorola's 680x0, Motorola PowerPC, and MIPS' microprocessors, which do use IEEE floatingpoint. Note that the extended IEEE format is not found on many IEEEcompliant processors, yet these routines can recover their values to the full precision supplied by a given machine's highest precision floating point.
ToFromIEEE.c 
8Bit Unsigned FloatingPointSometimes there is a need for a small data type with a large range, where the range is more important than the precision. This module implements several floatingpoint formats that fit into an 8bit byte. The interesting formats have a significand of 4, 5, or 6 bits.
UFloat8.c 
Zone PlateThe circular zone plate has zero horizontal and vertical frequencies at the center. Horizontal frequencies increase as you move horizontally, and vertical frequencies increase as you move vertically. These patterns are useful to:
This code was written by me and Steve Gabriel from a paper published by the BBC. We also implemented the hyperbolic zone plate, which is easier to implement, but not as intuitive to use.
ZonePlate.c 
Image Rotation by ±90°, 180°These procedures will rotate an image by ±90° or 180°, in a general image setting, where the pixel size if 8, 16, 24, or 32 bits, and the source and destination are different. A convenience wrapper is provided to specialize this for GWorlds, as found in QuickTime on the Macintosh, Windows, etc.
RotateGWorld.c 
Compute 3x3 Matrix to Immerse an Image or Movie into a QuickTime VR PanoramaWith QuickTime 4.0, a highprecision renderer is used to display QuickTime VR panoramas. This module will generate a 3x3 floatingpoint matrix that can be used to perform a projective transformation on an image or movie, so that the image appears fixed with respect to the panorama as the user pans, tilts, and zooms around the panorama.
ImmerseImageInQTVR.c 
[ My QuickTime VR Page  Computer Graphics  My Home Page ]
[ QuickTime VR Home Page  QuickTime Home Page  Apple Home Page]
last revised: