lpm@lanl.ARPA (06/18/85)
I am working on a crystallographic data analysis program, and
need an algorithm for reducing a 3 component vector to its lowest
integer representation, if such a representation exists. That
is, given the vector
(8.999 -2*8.999 0)
I would want the result
(1 -2 0)
The algorithm must be able to recognize numbers "close to" in-
tegers, since this will all be computerized (double precision on
an IBM PC with 8087 chip.)
I have been given an algorithm that is supposed to work, but it
is not very fast or elegant. This algorithm involves multiplying
the vector by the number formed by the product of the primes up
to 17, truncating about the last 6 digits, and dividing through
by the various primes one at a time to find when 3 integers oc-
cur. Then this procedure is repeated to make sure the lowest has
been found, and take care of some rare things that happen and
foul up the result.
I would appreciate any help, or even a source in some language (I
am using C).
Lauren McGavran
Computer Research and Applications
MS B265
PO Box 1663
Los Alamos National Laboratory
Los Alamos, New Mexico 87545