Topic: complex numbers


Author: Antonio Vieiro Varela <antonio@antispam.faraday.usc.es>
Date: 1997/10/28
Raw View
On 28 Oct 1997, Jurgen K. Singer wrote:

> I am currently working on a project where the use of complex numbers is
> essential. As a result I
> noticed some idiosyncracies in the current C++ draft standard:
>
> [...]

I am using complex numbers intensively as well. I've been browsing
a cd2/html version. I've noticed that there are *no* "inline"
declarations into the <complex.h> header file.

Does that mean we need a funcion call for just multiplying two
complex numbers?

Thanks,

Antonio


P.S.: Please remove the "antispam" tag for e-mail replies.
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: Paul Black <paul.black@vf.vodafone.co.uk>
Date: 1997/10/28
Raw View
Antonio Vieiro Varela <antonio@antispam.faraday.usc.es> wrote:
> I am using complex numbers intensively as well. I've been browsing
> a cd2/html version. I've noticed that there are *no* "inline"
> declarations into the <complex.h> header file.
>
> Does that mean we need a funcion call for just multiplying two
> complex numbers?

It's up to the implementation as whether this is the case.
An implementation could easily supply inline definitions of
functions. The standard is defining the class interface, not
how the class should be implemented.

Paul
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: "Jurgen K. Singer" <jurgen@rle-vlsi.mit.edu>
Date: 1997/10/28
Raw View
I am currently working on a project where the use of complex numbers is
essential. As a result I
noticed some idiosyncracies in the current C++ draft standard:

1. I would expect the norm of a complex number to be the usual
mathematical definition, but instead it
is the square of the 2-norm. This leads to difficulties when
implementing  generic numeric algorithms,
like numerical linear algebra solvers . (relevant section: 26.2.7)

2. Simillarly, the inner_product defined in <numeric> is the wrong (or
at least unusual) version:
 The proper scalar product of two vectors u and v of length N of complex
numbers should be
                              sum_{i=0}^{N-1}  conj(u_i) * v_i,
 that is a map from  C x C -> R
 as opposed to the implementation found in <numeric>:
                              sum_{i=0}^{N-1} u_i * v_i,
  which is a map C x C -> C
 From mathematics I would expect that
                              norm(u) ^2 = inner_product(u,u),
which is clearly not the case here.  The proper behvior can be achieved
by passing the right binary_op
 function object to inner_product, but ideally the default behavior
should be the correct one.

Does anybody know if these shortcomings are going to be rectified or
not.

-- Jurgen
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]