Home > Back-end >  C matrix multiplication results particularly outrageous
C matrix multiplication results particularly outrageous

Time:12-11

All code:

#include
#include
using namespace std;
B double B [7], [3], [3], [7], P [7] [7], [7], l S [7];
A double NBB [3], [3], w [3], [7], w [7], NBB [3], [3], [3] x, V [7];
The class leveling_adjustment {
Public:
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- to calculate height -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */

Void calculate_elevation ();

/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - error in the calculation of -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */

Void middle_error_different ();
Private:

Double H1=5.016, the H2=6.016, H3, H4, H5.
Double L13=1.359, L14=2.009, the L52=0.595;
};
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- to calculate height -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
Void leveling_adjustment: : calculate_elevation () {
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - input matrix */l
Cout & lt; <"Please input matrix" l & lt; for (int i=0; i <7. I++)
Cin & gt;> L [I];
Cout & lt; <"Please enter the s matrix" & lt; for (int i=0; i <7. I++)
Cin & gt;> S [I];
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - the input matrix B */
Cout & lt; <"Please input matrix B" & lt; for (int i=0; i <7. I++)
for (int j=0; J & lt; 3; J++) {
Cin & gt;> B [I] [j];
}
Cout & lt; <"Please input matrix b" & lt; for (int i=0; i <3; I++)
for (int j=0; J & lt; 7. J++)
Cin & gt;> B [I] [j];
Cout & lt; <"Output matrix B & lt;" for (int i=0; i <7. I++) {
for (int j=0; J & lt; 3; J++)
Cout & lt; Cout & lt; }
Cout & lt; <"Take 5 km observations of rights for the unit" & lt; for (int i=0; i <7. I++)
[I] [I]=5.0 P/S [I];
for (int i=0; i <7. I++)
for (int j=0; J & lt; 7. J++)
If (I.=j)
P [I] [j]=0;
for (int i=0; i <7. I++) {
for (int j=0; J & lt; 7. J++)
Cout & lt;

Cout & lt; }

/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- NBB matrix calculation -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- matrix calculation W -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
NBB [0] [0]=0;
for (int i=0; i <3; I++)
for (int j=0; J & lt; 7. J++)
For (int k=0; K & lt; 7. K++) {
NBB [I] [j] [I] [k] +=b * P [k] [j];
}
for (int i=0; i <3; I++)
for (int j=0; J & lt; 3; J++)
For (int k=0; K & lt; 7. K++) {
NBB [I] [j] +=NBB [j] [k] * B [k] [j];
}
Cout & lt; <"Output NBB matrix" & lt; for (int i=0; i <3; I++) {
for (int j=0; J & lt; 3; J++)
Cout & lt; Cout & lt; }
W [0] [0]=0;
W [0]=0;
for (int i=0; i <3; I++)
for (int j=0; J & lt; 7. J++)
For (int k=0; K & lt; 7. K++) {
W [I] [j] [I] [k] +=b * P [k] [j];
}
for (int i=0; i <3; I++)
for (int j=0; J & lt; 7. J++) {
[I] [j] + W=W [j] * l [j];
}
Cout & lt; <"W output matrix" & lt; for (int i=0; i <7. I++)
Cout & lt; /* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- matrix inverse NBB -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- calculation parameter correction number -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- to calculate correct number -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
Cout & lt; <"Input Nbb matrix" & lt; for (int i=0; i <3; I++)
for (int j=0; J & lt; 3; J++)
Cin & gt;> Nbb [I] [j];
X [0]=0;
for (int i=0; i <3; I++)
for (int j=0; J & lt; 3; J++)
[I] + x=Nbb [I] [j] * W [j];
V [0]=0;
for (int i=0; i <7. I++)
for (int j=0; J & lt; 3; J++)
V [I] [I] [j] +=B * x [j];
H3 [0]=H1 + L13 + V/1000;
H4=H1 + [1] L14 + V/1000;
[7] H5=H2 + L52 + V/1000;
Cout & lt; <"The third point elevation:" & lt;

Cout & lt; <"The fourth elevation:" & lt;

Cout & lt; <"The fifth elevation:" & lt;

}




May be a problem:

/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - error in the calculation of -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
Void leveling_adjustment: : middle_error_different () {
Double a0=0, a [7], a3, a4, ah, Q [3], Q=0, f [3].
A [0]=0;
for (int i=0; i <7. I++)
for (int j=0; J & lt; 7. J++)
A [I] + [j] * P=V [I] [j];
for (int j=0; J & lt; 7. J++)
A0 +=a [j] * V [j];
Cout & lt; /* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- unit weight mean error -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */

A0=SQRT (a0/4);
Cout & lt; <"Unit weight mean error is:" & lt;

/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- in the elevation error -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
A3=a0 * SQRT (Nbb [0] [0]).
Cout & lt; <"No. 3 points in the elevation error:" & lt; A4=a0 * SQRT (Nbb [1] [1]).
Cout & lt; <"4 points in the elevation error:" & lt;
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- in the elevation difference error -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */
Q [0]=0;
for (int i=0; i <3; I++)
for (int j=0; J & lt; 3; J++)
Q [I] [I] +=f * Nbb [j] [I];
for (int i=0; i <3; I++)
Q +=q [I] * f [I];

Ah=a0 * SQRT (q/4);
Cout & lt; <"No. 34 points in the elevation difference between the error:" & lt; }
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- to calculate the elevation error -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related