E
Erik Borgstr?m
Hi,
I simply want to use simple matrices of ints or doubles in C++ and I
want all the good:
1) be able to use double-index, e.g. m[j]
2) not have to use pointers at all
3) do it fast
I know I could do 1&3 with ordinary int[][], but then if I want to
give my matrix as a parameter, I have to use pointers, and I find the
handling of pointers a bit difficult, so I want to avoid it.
1&2 could be done with vector<vector<int> >, but that's slow, isn't
it?
2&3 could be done with valarray, but they don't let you write m[j]
or do they?
Also, I don't want to write a class on my own, because I have to make
a bugfree and fast program, and so I prefer using a well-documented
standard class.
Is there a way to accomplish all this? Or do I ask for too much? Or
maybe vectors are not so slow after all?
thanks for your patience,
Erik
I simply want to use simple matrices of ints or doubles in C++ and I
want all the good:
1) be able to use double-index, e.g. m[j]
2) not have to use pointers at all
3) do it fast
I know I could do 1&3 with ordinary int[][], but then if I want to
give my matrix as a parameter, I have to use pointers, and I find the
handling of pointers a bit difficult, so I want to avoid it.
1&2 could be done with vector<vector<int> >, but that's slow, isn't
it?
2&3 could be done with valarray, but they don't let you write m[j]
or do they?
Also, I don't want to write a class on my own, because I have to make
a bugfree and fast program, and so I prefer using a well-documented
standard class.
Is there a way to accomplish all this? Or do I ask for too much? Or
maybe vectors are not so slow after all?
thanks for your patience,
Erik