tags:

views:

436

answers:

4

Hello,

Unfortunately I haven't much experience in C++ and I'm trying to progress myself in C++.

Firstly,I defined array of arrays so that I formed an 3x3 matrix:

array< array< double >^ >^ input = gcnew array< array< double >^ >(3);

for (j=0;j<input->Length;j++){
 input[j]=gcnew array<double>(3);

Then I assigned matrix elements to input array of arrays:

 int value=1;
for(y=0;y<(3);y++){
  for(x=0;x<(3);x++)
 {input[y][x]=value;
  value=value+1;
  }
  }

Is there a C++ function that compute inverse matrix of this input array of arrays?

Could you help me please?

Best Regards...

A: 

There are no functions in C++ to make matrix operations, you'll need to find some library to do it or implement your own.

Note that for fixed size arrays, you can use regular C/C++ arrays, like this one:

double arr[3][3];
Drakosha
A: 

Wikipedia has a list of numerical libraries in various programming languages. If the functions that you are looking for are not available you could also consider writing a wrapper function around an available Fortran or C or C++ implementation.

andreas buykx
I agree with this. There is a huge body of linear analysis code, much of it in Fortran, that will do what you want and there is no better place to start looking than Lapack on netlib.org.I would also suggest not using the array of arrays paradigm. Most of the external code will expect the array to be a block of numbers suitably set up in row or column major order. Creating or finding a class with a suitable indexing operator should not be too difficult.
Dr. Tim
+2  A: 

Look at Simple 3x3 matrix inverse code (C++).

grigy
+1 for a very good answer.
TheMachineCharmer
A: 

There is not built in C++ function to do matrix inversion (or for any other matrix calculations).

There are lots of methods for matrix inversion mentioned HERE.

If you want efficiency and ease of implementation then Guassian Elimination is probably the best.

TheMachineCharmer