From 8aeb36bac894f75fdcc5ca1b5dac631dc503498b Mon Sep 17 00:00:00 2001 From: Krishna Vedala Date: Fri, 5 Jun 2020 14:26:30 -0400 Subject: [PATCH] bug fix - first dimension of matrices points to pointers, hence get pointer size Signed-off-by: Krishna Vedala --- numerical_methods/qr_eigen_values.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/numerical_methods/qr_eigen_values.c b/numerical_methods/qr_eigen_values.c index 442264d5..1e61a6c2 100644 --- a/numerical_methods/qr_eigen_values.c +++ b/numerical_methods/qr_eigen_values.c @@ -82,9 +82,9 @@ int main(int argc, char **argv) int i, rows = mat_size, columns = mat_size; - double **A = (double **)malloc(sizeof(double) * mat_size); - double **R = (double **)malloc(sizeof(double) * mat_size); - double **Q = (double **)malloc(sizeof(double) * mat_size); + double **A = (double **)malloc(sizeof(double *) * mat_size); + double **R = (double **)malloc(sizeof(double *) * mat_size); + double **Q = (double **)malloc(sizeof(double *) * mat_size); /* number of eigen values = matrix size */ double *eigen_vals = (double *)malloc(sizeof(double) * mat_size);