Subject: Re: Convert Social Security number to six digits and back again.
From: mmacleod@henge.com (Malcolm MacLeod)
Date: Wed, 30 Oct 1996 10:28:20 GMT
"http://www.execpc.com/~ghtrout/" wrote:
>How can I convert a social security number (xxx-xx-xxxx) to a six digit
>number with the lowest chance of duplicates and the ability to convert the
>number back to the social security number. Because of the duplicates
>issue, I would like to have "alternate" numbers that could be used....maybe
>as simple as adding or subtracting 1 to the answer.
>This is for a new numeric access code I must assign to about 2500 people at
>my company. I'd sure appreciate the help of a mathematician...
I don't have the info to hand at the moment, but there are quite a
number of non-used or "disallowed" SSNs, because they are coded for
the state / region in which they are issued... it is one way that
false SSNs are detected - there are more invalid codes than valid
codes, as I recall. Do you have to have a six-digit numeric code that
is human readable / enterable? I would just convert the whole SSN to
a 4-byte (32bit) binary number, and store it as if it was character
data, or store it as an unsigned long integer. If it has to be human
readable, consider replacing some (or all) of the digits with letters,
or letters/numbers. Six characters of alpha gives you many more
combinations than the original 9 numeric characters.
Subject: The equation f(n)=n-f(f(n-1))
From: Stan Armstrong
Date: Wed, 30 Oct 1996 10:57:36 +0000
10 days or so ago a thread was started on this equation here or in
algebra help. The whole thread has been expired and regrettably I find
I din not save it. So please forgive the cross posting (if I can work
out how to do it!).
I saw the original post and one reply, which introduced Fibonacci
numbers to the problem but, IIRC, did not complete the solution.
In discussions with a colleague, Rod Gibson, I have concluded that
f(n)=INT((n+1)/g) where g is the golden ratio, (sqrt(5)+1)/2, implicit
in Fibonacci numbers. At least it is something like it. He has tested
the residuals without the INT up to n = 1 000 000
Although not sufficiently rigorous to be called a proof, the reasoning
goes as follows.
I propose a function Fib(n) which represents an integer as a quasi
binary string (qb) decomposing n into F numbers. Thus 27 which equals
21+5+1 would be represented as 10010010. (The last zero comes from the
duplication of 1 in the sequence. Changing the representation to end in
01 does not have a dramatic effect on the process.) A second function
Trun(qb) drops off the last digit in the qb and then we have an inverse
for Fib which for convenience I shall call Bif(qb).
Multiplying a Fibonacci number by g gives as the nearest integer the
next F number and dividing the previous one, since F(n)=g^n+(-g)^(-n),
(I'm quoting this from memory) so the residuals oscillate and diminish
regularly. I suggest that the original f(n) is Bif(Trun(Fib(n+1))) in
that each of the Fs is replaced by the next one down, equivalent to
multiplying each term and therefore the sum by g.
If the original posters could email me their contributions I would
review the above against their observations, which I have perhaps
remembered ill.
--
Stan Armstrong
Subject: Re: SVD
From: Konrad Hinsen
Date: 30 Oct 1996 10:58:52 +0000
jpc@a.cs.okstate.edu (John Chandler) writes:
> >1) The algorithms used in SVD are stable (more so than other matrix
> ^^^^^^^ ^^^^^
> > algorithms).
>
>
> "other" is very vague, but even so I disagree with this evaluation.
"other" means what non-experts tend to be familiar with, i.e.
factorization-based methods for solving linear equations.
> No competent practitioner would think of forming the normal equations
> for any least squares problem that could be ill-conditioned
> (which is most of them).
Unfortunately most least-squares problems are solved by people
without any special competence in this business. One important example
from my field (computational chemistry) is fitting point charges at
known positions to electrostatic potential values at some reference point.
Although this can be called a standard technique by now and has been
done by probably hundreds of people, the most commonly used program
uses normal equations. And even though people have observed stability
problems, and even considered complicated solution strategies, hardly
anyone is aware of SVD or related techniques.
And it was this kind of people that my comment was aimed at...
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire | Tel.: +33-76.88.99.28
Institut de Biologie Structurale | Fax: +33-76.88.54.94
41, av. des Martyrs | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France | Nederlands/Francais
-------------------------------------------------------------------------------
Subject: Re: Using C for number-crunching (was: Numerical solution to Schrodinger's Eq)
From: Konrad Hinsen
Date: 30 Oct 1996 11:04:35 +0000
johnp@amber.math.unm.edu (John Prentice) writes:
> on a RS6000 between Fortran 90 and C++. Fortran 77
> is obsolete and was replaced as both an American and
> an international standard five years ago (and itself
> is about to be replaced as the standard by Fortran 95).
I don't quite agree with "replaced"; after all the Fortran 77 standard
still exists. More importantly from a practical point of view is that
Fortran 90 compilers are not nearly as widespread as Fortran 77, C, or
C++ compilers. I have accounts on three computer networks in different
scientific institutions around the world. They all have Fortran 77, C,
and C++. Only one has a Fortran 90 compiler, which doesn't work due
to misinstallation, and so presumably has never been used.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire | Tel.: +33-76.88.99.28
Institut de Biologie Structurale | Fax: +33-76.88.54.94
41, av. des Martyrs | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France | Nederlands/Francais
-------------------------------------------------------------------------------
Subject: Re: Using C for number-crunching (was: Numerical solution to Schrodinger's Eq)
From: Konrad Hinsen
Date: 30 Oct 1996 11:07:48 +0000
pausch@electra.saaf.se (Paul Schlyter) writes:
> Why is a Fortran compiler allowed to assume this?
>
> Consider this piece of code:
>
> SUBROUTINE COPY(DOUBLE PRECISION A, DOUBLE PRECISION B, INTEGER N)
> DIMENSION A(N), B(N)
> INTEGER I
> DO 100 I=1,N
> 100 A(I) = B(I)
> END
>
> PROGRAM TEST(INPUT,OUTPUT,TAPE5=INPUT,TAPE6=OUTPUT)
> DOUBLE PRECISION X(100), Y(10), Z(10)
> EQUIVALENCE (X(3),Y(1)), (X(1),Z(1))
> DATA /Z/1,2,3,4,5,6,7,8,9,10/
> COPY(Y,Z,10)
> WRITE(*,*) Y
> END
>
> This exhibits exacly the same aliasing problem as in C .....
Yes, but there is a little-known rule in the Fortran 77 specification
(citing from http://www.fortran.com/fortran/stds_docs.html):
---------------------------------------------------------------------------
15.9.3.6 Restrictions on Association of Entities.
If a subprogram reference causes a dummy argument in the referenced
subprogram to become associated with another dummy argument in the
referenced subprogram, neither dummy argument may become defined
during execution of that subprogram. For example, if a subroutine is
headed by
SUBROUTINE XYZ (A,B)
and is referenced by
CALL XYZ (C,C)
the[n the dummy arguments A and B each become associated with the same
actual argument C and therefore with each other. Neither A nor B may
become defined during this execution of subroutine XYZ or by any
procedures referenced by XYZ.
If a subprogram reference causes a dummy argument to become associated
with an entity in a common block in the referenced subprogram or in a
subprogram referenced by the referenced subprogram, neither the dummy
argument nor the entity in the common block may become defined within
the subprogram or within a subprogram referenced by the referenced
subprogram. For example, if a subroutine contains the statements:
1.SUBROUTINE XYZ (A)
2.COMMON C
and is referenced by a program unit that contains the statements:
1.COMMON B
2.CALL XYZ (B)
then the dummy argument A becomes associated with the actual argument
B, which is associated with C, which is in a common block. Neither A
nor C may become defined during execution of the subroutine XYZ or by
any procedures referenced by XYZ.
---------------------------------------------------------------------------
Essentially this means that the code you have shown, although all
compilers I know would accept it, does not conform to the Fortran 77
standard.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire | Tel.: +33-76.88.99.28
Institut de Biologie Structurale | Fax: +33-76.88.54.94
41, av. des Martyrs | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France | Nederlands/Francais
-------------------------------------------------------------------------------
Subject: Re: Using C for number-crunching (was: Numerical solution to
From: mlkessle@cip.physik.uni-wuerzburg.de (Manuel Kessler)
Date: 30 Oct 1996 11:14:49 GMT
pgh@nortel.co.uk wrote:
:> As another point of comparison. Under LINIX compiling LAPACK with
:> g77 gives benchmark times of about 50% of those from CLAPACK+gcc.
:> [The README said. I haven't confirmed it.]
:>
:> If you use LINUX & gcc, f2c may have had its day.
:>
:> Peter
To spread my own experiences over the world: in conjunction with a project
to develop a set of BLAS routines (assembler-)optimized for intel pentium
i discovered that code produced by g77 (at least for intel platform) for
the typical routines coming to mind (xDOT, xAXPY and so on) is quite bad.
gcc with straightforward rewritten C-equivalents (link compatible with
FORTRAN) gives typical 20-30% speed increase over the FORTRAN ones, at
least for short vectors where memory bandwidth is not a problem due to
the builtin cache. See for this some remarks for my assembler written
BLAS routines which are available at my home page (adress see down).
(Assembler beats both C and FORTRAN for short vectors by a factor of
2-3, but that's another story!)
So, the point is, all results discussed in this thread seem to be VERY
VERY compiler/os/machine dependant, so it's a problem of compiler techno-
logy, not of the language itself. FORTRAN and FORTRAN compilers have been
used for heavy computing since '60 (i think), whereas C was used mostly
for other tasks, and C++ is not even yet standardized. With time going on
C(++)-compilers should get better and better for numerical work, and then
the advantage of much shorter developing time than with FORTRAN 77
gets more important. Don't know about FORTRAN 90(95), but i think if it
has object oriented features as another one wrote, then it's just
slightly different form C++, if you don't look at syntax.
Just my 0.02 DM!
Ciao,
Manuel
--
Manuel Kessler
Graduate Student at the University of Wuerzburg, Germany, Physics Department
SNAIL: Zeppelinstrasse 5, D-97074 Wuerzburg, Germany
EMAIL: mlkessle@cip.physik.uni-wuerzburg.de
WWW: http://cip.physik.uni-wuerzburg.de/~mlkessle
Subject: Re: Using C for number-crunching (was: Numerical solution to Schrodinger's Eq)
From: David Kastrup
Date: 30 Oct 1996 10:43:21 +0100
pausch@electra.saaf.se (Paul Schlyter) writes:
[Someone else wrote]
> > A C compiler must assume that a and b might point to partly overlapping
> > memory spaces. A Fortran compiler may assume that they don't (and I am
> > sure many Fortran programmers are not aware of the consequences of this
> > fact).
>
> Why is a Fortran compiler allowed to assume this?
> SUBROUTINE COPY(DOUBLE PRECISION A, DOUBLE PRECISION B, INTEGER N)
[...]
> END
>
> PROGRAM TEST(INPUT,OUTPUT,TAPE5=INPUT,TAPE6=OUTPUT)
> DOUBLE PRECISION X(100), Y(10), Z(10)
> EQUIVALENCE (X(3),Y(1)), (X(1),Z(1))
> DATA /Z/1,2,3,4,5,6,7,8,9,10/
> COPY(Y,Z,10)
[...]
> END
> This exhibits exacly the same aliasing problem as in C .....
Yes, but the standards differ. If you do such folly in Fortran, the
language standard permits the compiler to fall into that trap and
generate bad output. The C standard demands "correct" behaviour
nonetheless.
So the Fortran standard classifies this as a user problem, whereas the
C standard calssifies this as a compiler problem. That allows Fortran
to generate more efficient code in cases like this.
Of course this is one reason never to use EQUIVALENCE...
--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut fuer Neuroinformatik, Universitaetsstr. 150, 44780 Bochum, Germany
Subject: Partial Differential Eq. HELP
From: Vassilev Mollov
Date: Wed, 30 Oct 1996 14:38:38 +0000
I am desperate to solve the following equation:
d2f/dx2+d2f/dy2=f*a^2 ,where
d2f/dx2 and d2f/dy2 are the second partial derivatives of f(x,y);
a^2=j*b, j=sqrt(-1),b>0;
f(x,y)->0 when x and y->~ ;
f(x,0)=c , c>0;
Thank you very much in advance!
Stefan
Subject: Re: Using C for number-crunching (was: Numerical solution to Schrodinger's Eq)
From: bruns@tetibm2.ee.TU-Berlin.DE (Warner Bruns)
Date: 30 Oct 1996 16:07:59 GMT
In article <555i94$ahb@electra.saaf.se>, pausch@electra.saaf.se (Paul
Schlyter) writes:
> Consider this piece of code:
>
> SUBROUTINE COPY(DOUBLE PRECISION A, DOUBLE PRECISION B, INTEGER N)
> DIMENSION A(N), B(N)
> INTEGER I
> DO 100 I=1,N
> 100 A(I) = B(I)
> END
>
> PROGRAM TEST(INPUT,OUTPUT,TAPE5=INPUT,TAPE6=OUTPUT)
> DOUBLE PRECISION X(100), Y(10), Z(10)
> EQUIVALENCE (X(3),Y(1)), (X(1),Z(1))
> DATA /Z/1,2,3,4,5,6,7,8,9,10/
> COPY(Y,Z,10)
> WRITE(*,*) Y
> END
>
> This exhibits exacly the same aliasing problem as in C .....
>
> --
> ----------------------------------------------------------------
> Paul Schlyter, Swedish Amateur Astronomer's Society (SAAF)
> Grev Turegatan 40, S-114 38 Stockholm, SWEDEN
> e-mail: pausch@saaf.se psr@home.ausys.se
1.)
This is not Fortran,
2.)
The Fortran equivalent would be:
SUBROUTINE COPY(A, B, N)
DOUBLE PRECISION A, B
INTEGER N
DIMENSION A(N), B(N)
INTEGER I
DO 100 I=1,N
100 A(I) = B(I)
END
PROGRAM TEST
DOUBLE PRECISION X(100), Y(10), Z(10)
EQUIVALENCE (X(3),Y(1)), (X(1),Z(1))
DATA /Z/1,2,3,4,5,6,7,8,9,10/
call COPY(Y,Z,10)
WRITE(*,*) Y
END
and this Fortran equivalent is illegal.
It is just ILLEGAL to call a subprogram that modifies its arguments
in this way.
You are just not allowed to do this.
Warner Bruns
Subject: Re: Using C for number-crunching (was: Numerical solution to Schrodinger's Eq)
From: shenkin@still3.chem.columbia.edu (Peter Shenkin)
Date: 30 Oct 1996 16:30:48 GMT
In article ,
David Kastrup wrote:
>shenkin@still3.chem.columbia.edu (Peter Shenkin) writes:
>
>> However, if the C code were written as follows, the compiler would
>> know that x[] and y[] cannot overlap:
>>
>> void sizpy1( const int n, const float alpha, const float x[], float y[] ){
>> int i;
>> for( i=0; i> y[ i ] += alpha * x[ i ];
>> }
>> }
>>
>> I also const-qualified n and alpha, but it's the const qualification of
>> x[] that gives the compiler the information it needs -- namely, that
>> no part of x[] will be written to.
>
>Sorry, no payoff. It just tells the compiler that the user is not
>supposed to be varying the y array via the parameter y, but it does
>not tell the compiler that there might be no other path via which it
>might modify the array.
On reflection, I believe you are right. Unfortunately.
-P.
--
****************** In Memoriam, Bill Monroe, 1911 - 1996 ******************
* Peter S. Shenkin; Chemistry, Columbia U.; 3000 Broadway, Mail Code 3153 *
** NY, NY 10027; shenkin@columbia.edu; (212)854-5143; FAX: 678-9039 ***
MacroModel WWW page: http://www.cc.columbia.edu/cu/chemistry/mmod/mmod.html
Subject: Re: Using C for number-crunching (was: Numerical solution to Schrodinger's Eq)
From: Konrad Hinsen
Date: 30 Oct 1996 18:36:43 +0100
ags@seaman.cc.purdue.edu (Dave Seaman) writes:
> [ Example of illegal aliasing in Fortran deleted. ]
>
> >Essentially this means that the code you have shown, although all
> >compilers I know would accept it, does not conform to the Fortran 77
> >standard.
>
> Although all compilers may accept the code, they don't all give the same
> result. That's the point.
Worse, they *will* give the same result for simple cases like the one
shown, but not in more complicated cases. Meaning that people can program
in Fortran for years before being hit.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire | Tel.: +33-76.88.99.28
Institut de Biologie Structurale | Fax: +33-76.88.54.94
41, av. des Martyrs | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France | Nederlands/Francais
-------------------------------------------------------------------------------
Subject: Re: PRIME NUMBER UPTO 2^64 on CDROM?
From: "Dann Corbit"
Date: 30 Oct 1996 19:04:21 GMT
As x gets large pi(x) is approximately x/log(x).
see http://www.utm.edu/research/primes/howmany.shtml#pi_def
That gives about 415,828,534,307,635,078 (415 Quadrillion) primes.
Multiply by 64 bits per prime number gives an even larger number than
storing the individual bit positions as prime/not-prime. Plus those
primes themselves would not compress very well at all.
Malcolm MacLeod wrote in article
<55797a$7bb@henge2.henge.com>...
> >>Colbert wrote in article
> ><53c8bj$jig@decius.ultra.net>...
> >> I am currently looking of the list of ALL prime number upto 2^64. I
> >> know that some poeple working with supercomputers have had their machines
> >> compute new prime numbers around 2^11000.
> >> What I would like to know is whether somebody has effectively recorded
> >> these prime numbers on some sort of media. A CDROM with prime number
> >> only would be nice.
>
> "Dann Corbit" wrote:
> >I don't think all of the primes up to 2^64 will fit on one CD-ROM.
> >That's 18,446,744,073,709,551,616 (18 quintillion) bits.
>
> I'm not sure I agree that it is impossible. Very difficult,
> certainly... but technical data management is my specialty.
> I think I could find a way to cncode most of them onto a CDROM.
> As the numbers get bigger, the primes get farther apart. That helps.
> So... just how many primes are there below 2^64?
>
>
Subject: Re: Using C for number-crunching (was: Numerical solution to
From: nmm1@cus.cam.ac.uk (Nick Maclaren)
Date: 31 Oct 1996 00:30:35 GMT
In article ,
John Turner wrote:
>nmm1@cus.cam.ac.uk (Nick Maclaren) writes:
>
>> In article <54pdmf$kv9@news.nyu.edu>,
>> Paul J. Gans wrote:
>> >Jeff Candy (candy@mildred.ph.utexas.edu) wrote:
>> >
>> >: The speed of C code versus FORTRAN code depends most strongly (given
>> >: identical coding algorithms) on the compiler. For example, the AIX
>> >: FORTRAN compiler (IBM) is far superior to the fort77/f2c (gnu) compiler
>> >: in the UNIX/LINUX distribution.
>> >
>> >Not a fair comparison. f2c translates FORTRAN into C accurately,
>> >but with great loss of efficiency. Fort77 is still a beta compiler.
>>
>> I agree, but the beta status or otherwise is irrelevant. The fact is
>> that ANY translation via C will be inefficient, because there is no way
>> in C to specify when pointers or data structures can be assumed not to
>> be aliased. If and when fort77 translates into the new GNU intermediate
>> code, it will be possible to compare it and other compilers.
>
>Please note that g77 does *NOT* translate to C first, as some seem to
>think.
>
>To quote a post some time ago by someone else in response to a similar
>question:
>
>GNU FORTRAN compiles directly to object code but uses the back-end from
>gcc to generate code. This is a similar arrangement to that used by most
>modern vendor-supplied compilers where front-ends for different languages
>use a common back-end for optimization and code generation. The GNU
>back-end knows how to exploit superscalar architectures although the
>quality of the output code may very somewhat from that of a vendor-supplied
>compiler.
Sorry - I was being unclear. The back end from gcc was designed for C
and, despite the fact that it does some optimisations for so-called
superscalar architectures, is still basically a C back end. The new
intermediate code that I was referring to was the glint in the eye of
various GNU people about a major enhancement that would make use of the
higher-level information that is available from languages like Fortran.
I have no idea whether the code I am referring to will ever emerge, or
is even still "on the list".
Nick Maclaren,
University of Cambridge Computer Laboratory,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email: nmm1@cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
Subject: BFGS variable metric question
From: Jive Dadson
Date: Wed, 30 Oct 1996 17:34:15 +0000
Greetings Gurus!
I am developing software that requires non-linear multi-variate function
minimization. I've been using the Boyden-Fletcher-Goldfarb-Shanno variant
of the variable metric or "quasi-Newton" method from _Numerical Recipes In C_.
(Actually they call it "dfpmin", for Davidon-Fletcher-Powell, but it uses
the BFGS update rule.) I'm using that routine because for the problems
I'm working on, it is the fastest I've found -- when it works.
It has a couple of problems which I have been able to work around, but
I wonder if someone could tell me if I've done the best hack job on it.
I freely confess I don't know much about this subject.
One problem is in the line-search routine it uses. The search is not
intended to find the minimum along the line, but rather a point that is
a "good enough" improvement. Problem is, it very often fails even using
double precision. The documentation says that happens when the data is
"poorly scaled", but that's not it. It seems to happen most often when
the data is real noisy. The original code has a rather rude way of dealing
with the failure: It calls "exit". Obviously that is unacceptable.
I replaced the call to "exit" with a call to a more robust, exact
line-search routine.
The other problem is that the approximation to the Hessian matrix that
the BFGS routine builds very often becomes non-positive-definite.
I don't know why that happens, but when it does, the routine stops,
often at a bad local minimum. I hacked around that as follows: Where
the routine previously exited, I put in code to invert the matrix using
Chlomsky decomposition. If that fails, I restart the algorithm with
the Hessian approximation set back to the identity matrix, so the
routine starts over with a gradient-descent step. That seems to have
fixed that problem. Does anyone know why the Hessian approximation
might be collapsing like that? Is there a better way to fix the algorithm?
Finally, I am taking advantage of the approximate Hessian the routine
builds, using it to estimate likelihoods for models. To assure that I have
a decent approximation, I have hacked the BFGS routine so it always does
a multiple of N updates, where N is the number of dimensions. Is that
good enough? Would it be good enough just to require that it does
at least N updates?
Thanks much for any light you can shed on the subject.
J.
Subject: Re: [Q] Pentium/Pentium Pro optimized routines?
From: Brad Bell
Date: Wed, 30 Oct 1996 19:56:45 -0800
Manuel Kessler wrote:
>
> Joseph Sirosh (sirosh@cs.utexas.edu) wrote:
> :> HI! Is anybody aware of a source for BLAS routines optimized
> :> for the Pentium and Pentium Pro machines? Or a signal processing
> :> library optimized for these machines? Since these are superscalar
> :> processors, I've heard that proper optimization can greatly improve
> :> the speed of typical vector operations...
>
> Yes, i am working on this kind of thing. At now, only a subset of BLAS
> level 1 is working, exactly ddot, sdot, dcopy, scopy, dnrm2, snrm2,
> daxpy, saxpy. Depending on the amount of data, especially whether coming
> from 1st or 2nd level cache or from main memory, expect a 50-300% speed
> increase on a system comparable to mine (P-133, 256k pipelined burst,
> 32M EDO+32M FPM). I have no idea about performance on PPro, but should
> work also a lot better than original FORTRAN routines. Check out my
> home page for a version of the library for use with djgpp and some
> preliminary results. If you need it for a different compiler and/or have
> suggestions where to improve further, feel free to email me directly.
> But always have in mind that this is ALPHA code, so there might be some
> still undetected bugs.
>
> Ciao,
> Manuel
>
> --
> Manuel Kessler
> Graduate Student at the University of Wuerzburg, Germany, Physics Department
> SNAIL: Zeppelinstrasse 5, D-97074 Wuerzburg, Germany
> EMAIL: mlkessle@cip.physik.uni-wuerzburg.de
> WWW: http://cip.physik.uni-wuerzburg.de/~mlkessle
I was told that O-Matrix uses a library supplied by Intel
that includes special BLAS routines. Try contacting Harmonic Software
at harmonic@world.std.com or http://world.std.com/~harmonic
for more information. This is how they
get thier matrix multiply to be much faster than competing software.
Subject: Re: Can anyone help with a quick triangulation optimisation.
From: lpa@netcom.com (Pierre Asselin)
Date: Thu, 31 Oct 1996 03:15:40 GMT
Visual@dial.pipex.com (Mike Armstrong) writes:
>In short, does anyone have a real quick routine to calculate the angle
>at B of the line ABC?
Is this for the swap test on edge AC? You don't need angles.
>Q2
>[Pocket of excavated dirt modeled as two triangulated surfaces,
> one for the bottom of the hole and one for the top]
>In order to get the volume of the hole I currently merge the 2
>triangulations by calculating all the points where the vertices
>intercept. I then use these points to split the lower triangulation
>into a non-delaunay set which represents both sets accurately.
>The trouble is that this method is soooo slooooww.
Why merge? You have a triangulated surface z=f(x,y) representing
the bottom of the hole an another surface z=g(x,y) representing the
top. f and g are piecewise linear functions on their respective
meshes. Just calculate
V = (integral g dx dy) - (integral f dx dy)
one surface at at time, each on its own mesh.
--
--Pierre Asselin, Westminster, Colorado
lpa@netcom.com
pa@verano.sba.ca.us
Subject: Re: Using C for number-crunching (was: Numerical solution to Schrodinger's Eq)
From: molagnon@ifremer.fr (Michel OLAGNON)
Date: 31 Oct 1996 09:10:18 GMT
In article <555i94$ahb@electra.saaf.se>, pausch@electra.saaf.se (Paul Schlyter) writes:
>In article ,
>Konrad Hinsen wrote:
>
>> wayne@cs.toronto.edu (Wayne Hayes) writes:
>>
>> > Hmmm, as long as I stick to arrays (not pointers, but arrays), and
>> > scalars, I can't think of a case where aliasing would be more of a
>> > problem in C than FORTRAN. Can you give an example?
>>
>> Arrays are just pointer constants in C, so you can't avoid them when
>> e.g. calling subroutines. A trivial aliasing example in C is
>>
>> void copy(double *a, double *b, int n)
>> {
>> int i;
>> for (i = 0; i < n; i++)
>> *a++ = *b++;
>> }
>>
>> A C compiler must assume that a and b might point to partly overlapping
>> memory spaces. A Fortran compiler may assume that they don't (and I am
>> sure many Fortran programmers are not aware of the consequences of this
>> fact).
>
>Why is a Fortran compiler allowed to assume this?
>
From paragraph 12.5.2.9 of the standard:
"Note that if there is partial or complete overlap between the actual
arguments associated with two different dummy arguments of the same procedure,
the overlapped portions must not be defined, redefined, or become undefined
during the execution of the procedure."
Michel
--
| Michel OLAGNON email : Michel.Olagnon@ifremer.fr|
| IFREMER: Institut Francais de Recherches pour l'Exploitation de la Mer|
| Centre de Brest - B.P. 70 phone : +33-02-9822 4144|
| F-29280 PLOUZANE - FRANCE fax : +33-02-9822 4135|
| http://www.ifremer.fr/ditigo/molagnon/molagnon.html |
Subject: Census Problem
From: Jody Abrams
Date: Thu, 31 Oct 1996 06:43:11 GMT
I have a question for anyone who can figure it out. If you can figure the problem out
I would be most grateful. My friend and I have been working on it for sometime and
have not yet learened the answer.
The problem is:
The government census bureau is preparing to take the census of the United States in
the year 2000, and you have been hired to help them plan for counting of the American
population. Your job is to make a projection of the population so that the bureau
will know how many census takers to hire.
Your director, Dr. John Knowitall, wants you to proceed as follows. He wants you to
use the actual population data from 2 consecutive polls. He wants you to find a
quadratic function that models the population as a function of time and agrees with
the actual populations and the rates of growth of the two polls.
a. Your first task in this project is to show Dr. Knowitall that in general it is
impossible to find such a function. To do this, let t------0 be the year of the first
poll, and let t1 be the year of the second poll. Also let po and p1 denote the
population values from the polls and let r0 and r1 denote the rates of the growth
from the two polls. To simplify your computations, write your polynomial in the
variable t-t0. ( If you do not think this really does simplify the arthmetic, repat
part (a) using a polynomial in the variable t and see what kind of computations are
needed )
Being the resourceful person that you are, you realize that the difficulty was caused
by the fact the the quadratic function was a polynomial of too low a degree to allow
you to include all the information that Dr. Knowitall wants.
b. Show tha by increasing the degree of the polynomial to three, it is always
posible to fit the data to anew polynomial (the is, to find a polynomial that agrees
with the populations and the rates of growth of any two polls)
c. After completing parts (a) and (b), use the actual census datat below along with
your results from part (b) to find popualtion functions for each pair of consecutive
poll data. Use this to project the population of the United States for 2000, as
follows. First use your polynomial modeling function for each two consecutive polls
to project the population of the succeeding census and compare the results to the
actual census taken. Use all this information to make your projection for the year
2000. How confident are you of your projection? Discuss why.
Well that is the problem that has been bothering my friend and I for some time now.
We just seem to be missing a part of it. If you can figure it out or any part of it
e-mail me at jabrams@linknet.net
Thankyou very much
Jody Abrams
Subject: Re: Using C for number-crunching (was: Numerical solution to
From: gans@scholar.nyu.edu (Paul J. Gans)
Date: 31 Oct 1996 04:32:19 GMT
Jeff Candy (candy@mildred.ph.utexas.edu) wrote:
: me:
:
: > The speed of C code versus FORTRAN code depends most strongly (given
: > identical coding algorithms) on the compiler. For example, the AIX
: > FORTRAN compiler (IBM) is far superior to the fort77/f2c (gnu) compiler
: > in the UNIX/LINUX distribution.
:
: Paul J. Gans:
:
: >> Not a fair comparison.
:
: Admittedly; but whether or not it is "fair", it is a reality faced by
: anyone porting code from an RS6000 to a linux box.
:
: >> f2c translates FORTRAN into C accurately, but with great loss of
: >> efficiency. Fort77 is still a beta compiler.
:
: fort77 uses f2c.
Right. My mind degenerates. What is the name of the (beta)
FORTRAN compiler? g77?
You are quite right about the realities. But the "realities"
go further than that. No one has infinite money. If one is
running linux on an Intel box, one is not going to get super
high speed in floating point no matter what. If one is running
on an alpha, it is quite probably because one cannot affort the
"official" operating system and compilers.
For me, running linux and using C on an Intel box is a win
because (a) I can't really afford much else and (b) my
programs are mainly integer, not floating point. Of
course, this is a special case and not generally applicable.
------ Paul J. Gans [gans@scholar.chem.nyu.edu]
Subject: Re: BFGS variable metric question
From: Hans D Mittelmann
Date: Thu, 31 Oct 1996 07:43:27 -0700
Jive Dadson wrote:
>
> Greetings Gurus!
>
> I am developing software that requires non-linear multi-variate function
> minimization. I've been using the Boyden-Fletcher-Goldfarb-Shanno variant
> of the variable metric or "quasi-Newton" method from _Numerical Recipes In C_.
> (Actually they call it "dfpmin", for Davidon-Fletcher-Powell, but it uses
> the BFGS update rule.) I'm using that routine because for the problems
> I'm working on, it is the fastest I've found -- when it works.
>
> It has a couple of problems which I have been able to work around, but
> I wonder if someone could tell me if I've done the best hack job on it.
> I freely confess I don't know much about this subject.
>
> One problem is in the line-search routine it uses. The search is not
> intended to find the minimum along the line, but rather a point that is
> a "good enough" improvement. Problem is, it very often fails even using
> double precision. The documentation says that happens when the data is
> "poorly scaled", but that's not it. It seems to happen most often when
> the data is real noisy. The original code has a rather rude way of dealing
> with the failure: It calls "exit". Obviously that is unacceptable.
> I replaced the call to "exit" with a call to a more robust, exact
> line-search routine.
>
> The other problem is that the approximation to the Hessian matrix that
> the BFGS routine builds very often becomes non-positive-definite.
> I don't know why that happens, but when it does, the routine stops,
> often at a bad local minimum. I hacked around that as follows: Where
> the routine previously exited, I put in code to invert the matrix using
> Chlomsky decomposition. If that fails, I restart the algorithm with
> the Hessian approximation set back to the identity matrix, so the
> routine starts over with a gradient-descent step. That seems to have
> fixed that problem. Does anyone know why the Hessian approximation
> might be collapsing like that? Is there a better way to fix the algorithm?
>
> Finally, I am taking advantage of the approximate Hessian the routine
> builds, using it to estimate likelihoods for models. To assure that I have
> a decent approximation, I have hacked the BFGS routine so it always does
> a multiple of N updates, where N is the number of dimensions. Is that
> good enough? Would it be good enough just to require that it does
> at least N updates?
>
> Thanks much for any light you can shed on the subject.
>
> J.
Hi,
what you point out is very typical for the "recipe"-like approaches.
They are just that. The difficulties start as soon as one tries to solve
a slightly more involved example. You may peruse one of the public
domain BFGS codes, either to modify your own or to replace it. I suggest
starting with DOMIN or DOMIN_C, or toms/611 which could probably also be
easily converted to C. Both are listed in the unconstrained section of
http://plato.la.asu.edu/guide.html
Hope that helps,
--
Hans D. Mittelmann http://plato.la.asu.edu/
Arizona State University Phone: (602) 965-6595
Department of Mathematics Fax: (602) 965-0461
Tempe, AZ 85287-1804 email: mittelmann@asu.edu
Subject: Re: PRIME NUMBER UPTO 2^64 on CDROM?
From: bp887@FreeNet.Carleton.CA (Angel Garcia)
Date: 1 Nov 1996 09:35:29 GMT
Malcolm MacLeod (mmacleod@henge.com) writes:
>>>Colbert wrote in article
>><53c8bj$jig@decius.ultra.net>...
>>> I am currently looking of the list of ALL prime number upto 2^64. I
-----
>>That's 18,446,744,073,709,551,616 (18 quintillion) bits.
>
> I'm not sure I agree that it is impossible. Very difficult,
> certainly... but technical data management is my specialty.
> I think I could find a way to cncode most of them onto a CDROM.
> As the numbers get bigger, the primes get farther apart. That helps.
> So... just how many primes are there below 2^64?
>
Silly question !: Nobody knows exactly how many primes below 2^64
but if you look for approximate number... then the answer is so ridiculously
trivial that I don't dear to post it... just look to any elementary
book on Number Theory before seriously questioning about such serious
enterprise (very sound, indeed) as to put in CDrom any set of primes.
--
Angel, secretary (male) of Universitas Americae (UNIAM).
http://www.ncf.carleton.ca/~bp887
Subject: Re: non-linear equation solving
From: Hans D Mittelmann
Date: Fri, 01 Nov 1996 06:27:46 -0700
Thomas Helander wrote:
>
> We are presently trying to solve a system of non linear equations using
> Newtons method. In principal the system looks like this:
>
> F(C'',C')=(A-(dt/2)B'')C'' -R''(dt/2) -(A+(dt/2)B')C' +R'(dt/2) = 0
>
> where C"= C(x,t2) C'=(x,t1) etc..
> x is space coordinate
> t is the time, dt the timestep.
> A is the mass matrix
> B is the stiffness matrix
> R is a matrix
>
> Since C is discontinuous in x, the elements of B and R vary discontinuously.
> This seems to cause difficulties when using Newtons method, because it doesn't
> always converge. Instead the sum of squares oscillates between two values. When
> we multiply the Jacobian with a trust factor, the sum of squares decreases,
> however, the oscillations continue.
>
> We would appreciate any suggestions on how to solve this problem.
>
> __ =====================================================
> ||
> ==== Thomas Helander
> | |__
> | |-.\ Dept. of Materials Science and Engineering
> |__| \\ Div. of Physical Metallurgy
> || || The Royal Institute of Technology
> ======__| S-100 44 Stockholm,Sweden
> ________||__
> /____________\ Tel. +46 8 7908326 Fax. +46 8 100411
>
> e-mail: thomas@matsc.kth.se
> ====================================================
Hi,
are you solving your system with Newton or are you doing least squares?
There are zero-finding routines that use only continuity of the solution
such as toms666 at netlib. They may be slow. On the other hand, if you
are doing LS then you could try one of the nonlinear LS codes instead of
applying Newton yourself.
--
Hans D. Mittelmann http://plato.la.asu.edu/
Arizona State University Phone: (602) 965-6595
Department of Mathematics Fax: (602) 965-0461
Tempe, AZ 85287-1804 email: mittelmann@asu.edu