Basic matrix declaration

Hi,

I am planning to use C++ for some numerical computation and I am learning as I go along.

I would appreciate some resources that can teach me:
(i) how to create basic type of matrix such unit matrix, identity matrix etc
(ii) How to use colon operator or similar operator to do some operation on some part of matrix. Say, A is a matrix 100 x 100 and I want to do some operation on A(9:89, 2:90).
(iii) How to create sparse matrix efficiently?

Some help would be appreciated.

Regards,
Dushyant
I'm assuming you're pretty new to c++. If you're more interested in the results, or quick development, I would actually suggest you move to either fortran or matlab, as the learning curve to do this in c++ is very high. However, if you want to stick with c++, I would start by googling for c++ blas.
Thanks kev82.

I usually code in matlab. However, many time converting code to C++ help speed wise. Plus, I am planning to switch and start working in quantitative finance, C++ is certainly a valuable tools.

I am not that new to C++. I have been learning that for quite sometime. I can do most of the stuff like
I/O operations, read from excel/ txt file etc, read and write object to a file, data conversion, pointer operations, using double pointer to create matrix, using double vector to create matrix, using class and object etc. However, yes, I am still learning.

Since most likely I could be coding for numerical computation, where matrix operation would be quite common, I wanted help related to that.

Since I am not familiar to Blas, would you please give me name to relevant functions?

C++ has NO native support for matrix operations. C++ has limited support for vector operations with std::valarray, but compilers such as intel and (I believe) portland provide their own classes to do this better and faster. To utilize these you would have to learn the compiler specific classes.

You need to choose an external blas library, I know boost has one, but I don't know how good it is. As I suggested, Google will be your best bet here. Do you know anyone who works in numerical computation. It may be worth speaking to them.
Thanks kev82.
Topic archived. No new replies allowed.