14.11.2012 Views

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

116 Appendix B. Documentation <strong>of</strong> <strong>the</strong> programming<br />

for (i = 0; i < 3; i++)<br />

for (j = 0; j < 3; j++)<br />

for (k = 0; k < 4; k++)<br />

a3[i][j] += a1[i][k] * a2[k][j];<br />

}<br />

void Inverse(double A[][3], double X[][3]) {<br />

float B[3][3];//<strong>the</strong> transpose <strong>of</strong> a matrix A<br />

float C[3][3];//<strong>the</strong> adjunct matrix <strong>of</strong> transpose <strong>of</strong> a matrix A not adjunct <strong>of</strong><br />

int i, j;<br />

float x, n = 0;//n is <strong>the</strong> determinant <strong>of</strong> A<br />

for (i = 0, j = 0; j < 3; j++) {<br />

if (j == 2)<br />

n += A[i][j] * A[i + 1][0] * A[i + 2][1];<br />

else if (j == 1)<br />

n += A[i][j] * A[i + 1][j + 1] * A[i + 2][0];<br />

else<br />

n += A[i][j] * A[i + 1][j + 1]<br />

* A[i + 2][j + 2];<br />

}<br />

for (i = 2, j = 0; j < 3; j++) {<br />

if (j == 2)<br />

n -= A[i][j] * A[i - 1][0] * A[i - 2][1];<br />

else if (j == 1)<br />

n -= A[i][j] * A[i - 1][j + 1] * A[i - 2][0];<br />

else<br />

n -= A[i][j] * A[i - 1][j + 1]<br />

* A[i - 2][j + 2];<br />

}<br />

if (n != 0)<br />

x = 1.0 / n;<br />

else {<br />

}<br />

for (i = 0; i < 3; i++) {<br />

for (j = 0; j < 3; j++) {<br />

}<br />

}<br />

B[i][j] = A[j][i];<br />

C[0][0] = B[1][1] * B[2][2] - (B[2][1] * B[1][2]);<br />

C[0][1] = (-1) * (B[1][0] * B[2][2] - (B[2][0]<br />

* B[1][2]));<br />

C[0][2] = B[1][0] * B[2][1] - (B[2][0] * B[1][1]);<br />

C[1][0] = (-1)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!