- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi I'm computing A'A for getting a squared matrix for AX=b (I would implemented it as A'AX=A'b).
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
While I was working on A'A, I got stocked. The following is my program:
char trA = 'T';
int request = 1;
int sort =0;
int columns = A->n;
std::vector C(A->n*A->n+1);
std::vector JC(A->n*A->n+1);
std::vector IC(A->m+1);
int nzmax = A->n * A->n+1;
int info = 0;
mkl_dcsrmultcsr(&trA, &request, &sort, &A->m, &A->n, &A->n, &A->v[0], &A->jv[0], &A->iv1[0], b, &A->jv[0], &A->iv1[0], &C[0], &JC[0], &IC[0], &nzmax, &info);
A was allocated and was filled in with values. The error message I got was as follows:
An unhandled exception of type 'System.AccessViolationException' occurred in OpenGL_on_a_Windows_Form.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
An unhandled exception of type 'System.AccessViolationException' occurred in OpenGL_on_a_Windows_Form.exeAdditional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Anyone could give me some ideas of what was wrong? or any other solutions for solving a non-squared matrix A for AX=b?
Thank you!
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Do you have test code that shows this problem? That will be very helpful to check this problem.
I aslo found IC is define as:
std::vector
When trA='T', IC is:
INTEGER. Array of length m + 1 when trans = 'N' or 'n', or n + 1 otherwise.
Could you please check if its length should be n+1?
Thanks,
Chao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Chao,
Thank you for helping me on this problem.
I tried n+1 but it still shows the same error message: "Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Even though I changed the size of IJ and IC to a big vector array, it still shows the same message. :-(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm sorry I found a bug in my code. In my case I have A'*A=C in replace ofA*B=C.
Therefore, I should not have any 'b' when calling the function.
The current one is:
mkl_dcsrmultcsr(&trA, &request, &sort, &A->m, &A->n, &A->n,
&A->v[0], &A->jv[0], &A->iv1[0], /* for A' */
&A->v[0], &A->jv[0], &A->iv1[0], /* for A */
&C[0], &JC[0], &IC[0], /* for C */
&nzmax, &info);
But it still shows: "Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."&nzmax, &info);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GSparseCSR C;
C.Resize(A->n, A->n, A->n * A->n);
mkl_dcsrmultcsr(&trA, &request, &sort, &A->m, &A->n, &A->n, &A->v[0], &A->jv[0], &A->iv1[0], &A->v[0], &A->jv[0], &A->iv1[0], &C.v[0], &C.jv[0], &C.iv1[0], &nzmax, &info);
I also tried the above. Still the same. :-(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The size of my array A:18580(A->m) x 2616(A->n)
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
char trA = 'T';
int request = 1;
int sort =0;
int nzmax = A->n * A->n;
int info = 0;
GSparseCSR C;
C.Resize(A->n, A->n, A->n * A->n);
mkl_dcsrmultcsr(&trA, &request, &sort, &A->m, &A->n, &A->n, &A->v[0], &A->jv[0], &A->iv2[0], &A->v[0], &A->jv[0], &A->iv2[0], &C.v[0], &C.jv[0], &C.iv2[0], &nzmax, &info);
Now it runs well, but the result values in C.jv are all zeros (info=0, the execution is successful)...
Now it runs well, but the result values in C.jv are all zeros (info=0, the execution is successful)...
I'm sure I have a good A.
I can't get why.
I can't get why.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, do you have atest code that could show the problem? I want to check if there is any code problem.
Thanks,
Chao
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page