Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory access violation #2

Open
123TzTz321 opened this issue Sep 11, 2024 · 0 comments
Open

memory access violation #2

123TzTz321 opened this issue Sep 11, 2024 · 0 comments

Comments

@123TzTz321
Copy link

https://github.com/NumericalMax/Linear-Regression/blob/master/main.cpp#L109
a is lxl but https://github.com/NumericalMax/Linear-Regression/blob/master/main.cpp#L118 would point beyond

diff --git a/main.cpp b/main.cpp
index 4e306d1..7a23a44 100644
--- a/main.cpp
+++ b/main.cpp
@@ -106,7 +106,7 @@ namespace matrixOperation{
         float t;
         float **a = new float*[l];
         for(int i = 0; i < l; ++i){
-            a[i] = new float[l];
+            a[i] = new float[2*l];
         }
         for(i=0;i<l;i++){
             for(j=0;j<l;j++){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant