diff --git a/matriz.c b/matriz.c index 9c9395f461efb6097bc893f849602f9ce6a1ca3c..50106e38e815d313a4cac152ebad206141a0353a 100644 --- a/matriz.c +++ b/matriz.c @@ -43,11 +43,11 @@ static inline double generateRandomB( ) MatPtr geraMatPtr (int m, int n, int zerar) { - MatPtr matriz = (double **) malloc(m*sizeof(double)); + MatPtr matriz = (double **) malloc(m * sizeof(double *)); if (matriz) { for (int i=0; i < m; ++i) { - if (matriz[i] = (double *) malloc(n*sizeof(double))) + if (matriz[i] = (double *) malloc(n * sizeof(double))) for (int j=0; matriz[i] && j < n; ++j) { if (zerar) matriz[i][j] = 0.0; else matriz[i][j] = generateRandomA(i, j); @@ -281,22 +281,3 @@ void prnVetor (Vetor vet, int n) printf(SEP_RES); } -/** - * Funcao prodEscalar: Calcula o produto escalar entre 2 vetores - * @param v1 vetor com 'n' elementos - * @param v2 vetor com 'n' elementos - * @param n nĂºmero de elementos dos vetores - * @return Valor do produto escalar - */ - -double prodEscalar (Vetor v1, Vetor v2, int n) -{ - double prod = 0.0; - - for (int i=0; i < n; ++i) - prod += v1[i]*v2[i]; - - return prod; -} - -