 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mickey Moore Guest
|
Posted: Wed Oct 27, 2004 2:24 pm Post subject: Simple question on (std::)complex issue |
|
|
A question for a LWG committee member (or one familiar with their
activities): Has any action been taken on open issue 387
("std::complex over-encapsulated",
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html)
since the publication of WG21 document number n1589
([url]http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1589.html)?[/url]
Note that issue 387 is really two related issues, which n1589
describes as:
1. Make complex<T> layout compatible with the complex data types of
C and Fortran.
2. Enable efficient write access to the individual parts (real and
imaginary) of the complex type.
I have been running into sub-issue #2 repeatedly in a current
project.
I'll probably have other comments, but I thought I'd be certain where
things stood first.
(A prelude to those probable comments: I would re-phrase sub-issue
#2 as: Enable a *CLEAR* and efficient method of write access to the
individual parts (real and imaginary) of the complex type. In
addition to the efficiency issue, the currently required approach
needlessly obscures the code's intent.)
----------------------------------------
Mickey Moore
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Jonathan Turkanis Guest
|
Posted: Fri Oct 29, 2004 1:41 am Post subject: Re: Simple question on (std::)complex issue |
|
|
"Mickey Moore" <mgmoore (AT) austin (DOT) rr.com> wrote
| Quote: | A question for a LWG committee member (or one familiar with their
activities): Has any action been taken on open issue 387
("std::complex over-encapsulated",
|
I'll have to let someone else answer this part. I believe this issue was
mentioned briefly at the last meeting, but I don't remember what action, if
any,
was taken. Maybe I was eating a cookie. ;-)
| Quote: | http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html)
since the publication of WG21 document number n1589
([url]http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1589.html)?[/url]
Note that issue 387 is really two related issues, which n1589
describes as:
2. Enable efficient write access to the individual parts (real and
imaginary) of the complex type.
(A prelude to those probable comments: I would re-phrase sub-issue
#2 as: Enable a *CLEAR* and efficient method of write access to the
individual parts (real and imaginary) of the complex type. In
addition to the efficiency issue, the currently required approach
needlessly obscures the code's intent.)
|
In addition to the list of options considered by Howard in n1589, I'd like to
add: give std::complex a TR1 tuple interface. I.e.,
template<class T>
struct tuple_size< complex {
static const int value = 2;
};
template<class T>
struct tuple_element< 0, complex {
typedef T type;
};
template<class T>
struct tuple_element< 1, complex {
typedef T type;
};
template<int I, class T>
T& get(complex<T>&);
template<int I, class T>
const T& get(const complex<T>&);
Of course this could be adopted in conjunction with one or more of the other
alternatives.
Jonathan
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Howard Hinnant Guest
|
Posted: Fri Oct 29, 2004 2:13 pm Post subject: Re: Simple question on (std::)complex issue |
|
|
In article <2ub747F2904riU1 (AT) uni-berlin (DOT) de>,
"Jonathan Turkanis" <technews (AT) kangaroologic (DOT) com> wrote:
| Quote: | In addition to the list of options considered by Howard in n1589, I'd like to
add: give std::complex a TR1 tuple interface. I.e.,
template<class T
struct tuple_size< complex {
static const int value = 2;
};
template<class T
struct tuple_element< 0, complex {
typedef T type;
};
template<class T
struct tuple_element< 1, complex {
typedef T type;
};
template<int I, class T
T& get(complex
template<int I, class T
const T& get(const complex
Of course this could be adopted in conjunction with one or more of the other
alternatives.
|
I agree. complex makes a wonderful tuple and would address issue 2.
Additionally adding an imaginary type (as described by Thorsten in
N1612) seems like a promising addition as well, potentially doubling the
speed of operations like complex(a, b) * complex(0, c).
-Howard
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Mickey Moore Guest
|
Posted: Mon Nov 01, 2004 11:51 am Post subject: Re: Simple question on (std::)complex issue |
|
|
| Quote: | In addition to the list of options considered by Howard in n1589, I'd like to
add: give std::complex a TR1 tuple interface. I.e.,
|
I will definitely follow-up and explain my thinking at greater length
later, but my first impression is that this is needlessly
complex^H^Hicated. It's definitely worth further consideration
though.
Remember I was arguing not just about efficiency but even more about
the clarity of the code's intent.
(Remember that std:complex is probably most used by numericists, and
that some of us have to be able to explain our code to people who
still program in -- or act like they are programming in -- FORTRAN.)
---------------------------------------------
Mitchell G. (Mickey) Moore, Ph.D. (Physics)
[email]mgmoore (AT) austin (DOT) rr.com[/email]
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|