#include
#include <Eigen/Dense>
#include <Eigen/Geometry>
#include <sys/time.h>
using namespace std;
Eigen::MatrixXd inv_3(Eigen::MatrixXd A){
double a1=A(0,0);
double b1=A(0,1);
double c1=A(0,2);
double a2=A(1,0);
double b2=A(1,1);
double c2=A(1,2);
double a3=A(2,0);
double b3=A(2,1);
double c3=A(2,3);
double C=(a1b2c3 - a1b3c2 - a2b1c3 + a2b3c1 + a3b1c2 - a3b2c1);
Eigen::MatrixXd B=Eigen::MatrixXd::Zero(3,3);
B(0,0)=(b2c3 - b3c2)/C;
B(0,1)=(b3c1 - b1c3)/C;
B(0,2)=(b1c2 - b2c1)/C;
B(1,0)=(a3c2 - a2c3)/C;
B(1,1)=(a1c3 - a3c1)/C;
B(1,2)=(a2c1 - a1c2)/C;
B(2,0)=(a2b3 - a3b2)/C;
B(2,1)=(a3b1 - a1b3)/C;
B(2,2)=(a1b2 - a2b1)/C;
B=B/C;
return B;
}
int main(){
Eigen::MatrixXd A1=Eigen::MatrixXd::Random(3,3);
//Eigen::MatrixXd A2=inv_3(A1);
//cout<<A2;
return 0;
}
sfdsd=rand(6,6)
sfdsd^-1
A=sfdsd(1:3,1:3);
B=sfdsd(1:3,4:6);
C=sfdsd(4:6,1:3);
D=sfdsd(4:6,4:6);
A_inv=inv_3(A);
B_inv=inv_3(B);
D_min_CAB_inv=inv_3(D-CA_invB)
A_inv+A_invBD_min_CAB_invCA_inv
-A_invBD_min_CAB_inv
-D_min_CAB_invCA_inv
D_min_CAB_inv