Skip to content
Snippets Groups Projects
Commit f2e017f5 authored by Armando Luiz Nicolini Delgado's avatar Armando Luiz Nicolini Delgado :nerd:
Browse files

Onde estava 'i*m' em matrizes MatRow, deve ser 'i*n'

parent e38b7a95
No related branches found
No related tags found
No related merge requests found
...@@ -96,8 +96,8 @@ MatRow geraMatRow (int m, int n, int zerar) ...@@ -96,8 +96,8 @@ MatRow geraMatRow (int m, int n, int zerar)
if (matriz) { if (matriz) {
for (int i=0; i < m; ++i) { for (int i=0; i < m; ++i) {
for (int j=0; j < n; ++j) { for (int j=0; j < n; ++j) {
if (zerar) matriz[i*m + j] = 0.0; if (zerar) matriz[i*n + j] = 0.0;
else matriz[i*m + j] = generateRandomA(i, j); else matriz[i*n + j] = generateRandomA(i, j);
} }
} }
} }
...@@ -184,7 +184,7 @@ void multMatRowVet (MatRow mat, Vetor v, int m, int n, Vetor res) ...@@ -184,7 +184,7 @@ void multMatRowVet (MatRow mat, Vetor v, int m, int n, Vetor res)
if (res) { if (res) {
for (int i=0; i < m; ++i) for (int i=0; i < m; ++i)
for (int j=0; j < n; ++j) for (int j=0; j < n; ++j)
res[i] += mat[m*i + j] * v[j]; res[i] += mat[n*i + j] * v[j];
} }
} }
...@@ -261,7 +261,7 @@ void prnMatRow (MatRow mat, int m, int n) ...@@ -261,7 +261,7 @@ void prnMatRow (MatRow mat, int m, int n)
{ {
for (int i=0; i < m; ++i) { for (int i=0; i < m; ++i) {
for (int j=0; j < n; ++j) for (int j=0; j < n; ++j)
printf(DBL_FIELD, mat[m*i + j]); printf(DBL_FIELD, mat[n*i + j]);
printf("\n"); printf("\n");
} }
printf(SEP_RES); printf(SEP_RES);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment