Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21ee0141ac
|
||
|
|
23114b575a
|
@@ -31,20 +31,20 @@ int set_content(int row, int column, double val) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int output() {
|
||||
for (int i = 0; i < p; i++) {
|
||||
for (int j = 0; j < n; j++) {
|
||||
printf("%lf ", get_content(i, j));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
// int output() {
|
||||
// for (int i = 0; i < p; i++) {
|
||||
// for (int j = 0; j < n; j++) {
|
||||
// printf("%lf ", get_content(i, j));
|
||||
// }
|
||||
// printf("\n");
|
||||
// }
|
||||
// printf("\n");
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
int outputZ() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
printf("%lf ", Z[i]);
|
||||
printf("%.4lf ", Z[i]);
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
@@ -75,7 +75,7 @@ int main() {
|
||||
if (base != 0) {
|
||||
double coefficient = base / diag_elem;
|
||||
set_content(row, col, -coefficient);
|
||||
for (int l = col + 1; l < n; l++) {
|
||||
for (int l = col + 1; l < col + 3; l++) {
|
||||
set_content(row, l, get_content(row, l) - coefficient * get_content(col, l));
|
||||
}
|
||||
}
|
||||
@@ -140,10 +140,11 @@ int main() {
|
||||
// outputZ();
|
||||
|
||||
// output
|
||||
for (int j = 0; j < n; j++) {
|
||||
printf("%.4lf ", Z[j]);
|
||||
}
|
||||
printf("\n");
|
||||
// for (int j = 0; j < n; j++) {
|
||||
// printf("%.4lf ", Z[j]);
|
||||
// }
|
||||
// printf("\n");
|
||||
outputZ();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user