M
Michael DOUBEZ
Gianni Mariani a écrit :
A critic of what you said:
- You said: "As you can see, the FAQ bases all the claims on the
false assumption that by using [][], you cannot implement optimizations
using (,)."
- The FAQ says: "The array-of-array solution obviously works, but
it is less flexible than the operator() approach. Specifically, there
are easy performance tuning tricks that can be done with the operator()
approach that are more difficult in the [][] approach, and therefore the
[][] approach is more likely to lead to bad performance, at least in
some cases."
Do you feel the gap ? The FAQ only states that is is *easier* to
optimise the (,) solution (i.e. your compiler is more likely to yield
better performances) than [][]. This is sensible: a single function call
is easier to implement, easier to understand (for a copmpiler) than
using some proxy object for accessing data.
For software engineer using dense matrices perhaps but if you work with
a (20000 x 30000 double) sparse matrix, you rapidely drop the [][] notation.
Researcher in Computing Science using Matlab will certainly be more at
ease with the (,) interface.
surprised because, as a software engineer, I expect a row-first.
A scientist will expect a (i,j) notation and if the indices start at 1,
it is better.
All the same, X[a] calls a function and I prefer knowing it. I could
confuse it with an array (well, not really) and I hate surprises .
Michael
Daniel T. wrote:
...On Jan 3 you said, "The FAQ does state many false claims in support of
the position of using (,) over [][]." How about you state one assertion
that is in the FAQ that you think is false and let's see what happens.
Just one of the many you say exist so we don't get too distracted.
Read this post:
http://groups.google.com.au/group/comp.lang.c++/msg/c3bbd70542232ca6?dmode=source&hl=en
I explained it all paragraph by paragraph. What more do you want ?
A critic of what you said:
- You said: "As you can see, the FAQ bases all the claims on the
false assumption that by using [][], you cannot implement optimizations
using (,)."
- The FAQ says: "The array-of-array solution obviously works, but
it is less flexible than the operator() approach. Specifically, there
are easy performance tuning tricks that can be done with the operator()
approach that are more difficult in the [][] approach, and therefore the
[][] approach is more likely to lead to bad performance, at least in
some cases."
Do you feel the gap ? The FAQ only states that is is *easier* to
optimise the (,) solution (i.e. your compiler is more likely to yield
better performances) than [][]. This is sensible: a single function call
is easier to implement, easier to understand (for a copmpiler) than
using some proxy object for accessing data.
Clearly, multi-dimensional array, matricies or whaterver your favorite
name is for these things has been traditionally the [][] flavour.
For software engineer using dense matrices perhaps but if you work with
a (20000 x 30000 double) sparse matrix, you rapidely drop the [][] notation.
Researcher in Computing Science using Matlab will certainly be more at
ease with the (,) interface.
If I use it and your template specialisation is a column-first I will beLet's enumerate the reasons for [][].
1. [][] syntax is well understood by C++ programmers for manipulating
multi-dimensional properties. No surprises here !
surprised because, as a software engineer, I expect a row-first.
A scientist will expect a (i,j) notation and if the indices start at 1,
it is better.
2. X[a] will never be confused like X(a,b) as a function call to
function X.
All the same, X[a] calls a function and I prefer knowing it. I could
confuse it with an array (well, not really) and I hate surprises .
Michael