我有一个函数,就是将矩阵和向量相乘:
 double *matrix_vector_multiply(int rows, int cols,
                           double **mat, double *vec)
{
    double *answer = malloc(rows * sizeof (double));
    int i,j;
    for (i=0; i<rows; rows++)
    ans[i]=0;
    for (i=0; i<rows; rows++){
        for (j=0; j<cols; cols++)
             {
            answer[i] = answer[i] + mat[i][j] * vec[j];
            }
        }
    return ans;
}
我一直得到所有输出的 0.. 关于如何修复它的任何想法?