Home > Back-end >  Strassen algorithm code: memory error, bosses, hand in the report immediately
Strassen algorithm code: memory error, bosses, hand in the report immediately

Time:10-06

Hand in the experiment report, immediately, get me a

# pragma once
* * matrix1 void strassen_upgraded (int n, int, int * * matrix2, int * * matrix_result)
{
If (n & lt;
=1){
The MUL (matrix1, matrix2 matrix_result, n);
}
The else
{
Int size=0;
Int * * matrix_A=NULL;
Int * * matrix_B=NULL;
Int * * matrix_RESULT=NULL;
If (n % 2!=0)
{
Size=(n + 1)/2;
Matrix_A=(int * *) realloc (matrix1, (n + 1) * sizeof (int *));
Matrix_B=(int * *) realloc (matrix2, (n + 1) * sizeof (int *));
Matrix_RESULT=(int * *) realloc (matrix_RESULT, (n + 1) * sizeof (int *));
Calloc matrix_A [n]=(int *) (n + 1, sizeof (int));
Calloc matrix_B [n]=(int *) (n + 1, sizeof (int));
Calloc matrix_RESULT [n]=(int *) (n + 1, sizeof (int));
For (int I=0; I & lt; N + 1; I++)
{
Matrix_A [I] [n]=0;
Matrix_B [I] [n]=0;
Matrix_RESULT [I] [n]=0;
}
}
The else
{
Size=n/2;
Matrix_A=(int) * * malloc (n * sizeof (int *));
For (int I=0; I & lt; n; I++)
{
Matrix_A [I]=(int *) calloc (n, sizeof (int));
}
Matrix_B=(int) * * malloc (n * sizeof (int *));
For (int I=0; I & lt; n; I++)
{
Matrix_B [I]=(int *) calloc (n, sizeof (int));
}
Matrix_RESULT=(int) * * malloc (n * sizeof (int *));
For (int I=0; I & lt; n; I++)
{
Matrix_RESULT [I]=(int *) calloc (n, sizeof (int));
}
Memmove (matrix_A matrix1, sizeof (matrix1));
Memmove (matrix_B matrix2, sizeof (matrix2));
Memmove (matrix_RESULT matrix_RESULT, sizeof (matrix_RESULT));
}
//define matrix and allocate space
Int * * A11=NULL;
A11=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
A11 [I]=(int *) calloc (size, sizeof (int));
}

Int * * A12=NULL;
A12=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
A12 [I]=(int *) calloc (size, sizeof (int));
}

Int * * A21=NULL;
A21=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
A21 [I]=(int *) calloc (size, sizeof (int));
}

Int * * A22=NULL;
A22=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
A22 [I]=(int *) calloc (size, sizeof (int));
}

Int * * bl1=NULL;
Bl1=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
Bl1 [I]=(int *) calloc (size, sizeof (int));
}

Int * * B12=NULL;
B12=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
B12 [I]=(int *) calloc (size, sizeof (int));
}

Int * * B21=NULL;
B21=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
B21 [I]=(int *) calloc (size, sizeof (int));
}

Int * * B22=NULL;
B22=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
B22 [I]=(int *) calloc (size, sizeof (int));
}

Int * * P1=NULL;
P1=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
P1 [I]=(int *) calloc (size, sizeof (int));
}

Int * * P2=NULL;
P2=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
The P2 [I]=(int *) calloc (size, sizeof (int));
}

Int * * P3=NULL;
P3=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
P3 [I]=(int *) calloc (size, sizeof (int));
}

Int * * P4=NULL;
P4=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
P4 [I]=(int *) calloc (size, sizeof (int));
}

Int * * P5=NULL;
P5=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
P5 [I]=(int *) calloc (size, sizeof (int));
}

Int * * P6=NULL;
P6=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
P6 [I]=(int *) calloc (size, sizeof (int));
}

Int * * P7=NULL;
P7=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
P7 [I]=(int *) calloc (size, sizeof (int));
}

Int * * C11=NULL;
C11=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
C11 [I]=(int *) calloc (size, sizeof (int));
}

Int * * C12=NULL;
C12=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
C12 [I]=(int *) calloc (size, sizeof (int));
}

Int * * C21=NULL;
C21=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
C21 [I]=(int *) calloc (size, sizeof (int));
}

Int * * C22=NULL;
C22=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
C22 [I]=(int *) calloc (size, sizeof (int));
}

Int * * result1=NULL;
Result1=(int) * * malloc (size * sizeof (int *));
For (int I=0; I & lt; The size; I++)
{
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull