mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
fixed MSVC related errors -
MSVC complains of valid C but invalid C++ struct initialization Signed-off-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
This commit is contained in:
parent
4d01cb2e88
commit
7b1bba8c36
@ -141,11 +141,11 @@ int save_u_matrix(const char *fname, struct array_3d *W)
|
|||||||
int to_x = min(W->dim1, i + R + 1);
|
int to_x = min(W->dim1, i + R + 1);
|
||||||
int from_y = max(0, j - R);
|
int from_y = max(0, j - R);
|
||||||
int to_y = min(W->dim2, j + R + 1);
|
int to_y = min(W->dim2, j + R + 1);
|
||||||
|
int l;
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel for reduction(+ : distance)
|
#pragma omp parallel for reduction(+ : distance)
|
||||||
#endif
|
#endif
|
||||||
for (int l = from_x; l < to_x; l++)
|
for (l = from_x; l < to_x; l++)
|
||||||
{
|
{
|
||||||
for (int m = from_y; m < to_y; m++)
|
for (int m = from_y; m < to_y; m++)
|
||||||
{
|
{
|
||||||
@ -391,7 +391,10 @@ void test1()
|
|||||||
double **X = (double **)malloc(N * sizeof(double *));
|
double **X = (double **)malloc(N * sizeof(double *));
|
||||||
|
|
||||||
// cluster nodex in 'x' * cluster nodes in 'y' * 2
|
// cluster nodex in 'x' * cluster nodes in 'y' * 2
|
||||||
struct array_3d W = {.dim1 = num_out, .dim2 = num_out, .dim3 = features};
|
struct array_3d W;
|
||||||
|
W.dim1 = num_out;
|
||||||
|
W.dim2 = num_out;
|
||||||
|
W.dim3 = features;
|
||||||
W.data = (double *)malloc(num_out * num_out * features *
|
W.data = (double *)malloc(num_out * num_out * features *
|
||||||
sizeof(double)); // assign rows
|
sizeof(double)); // assign rows
|
||||||
|
|
||||||
@ -499,7 +502,10 @@ void test2()
|
|||||||
double **X = (double **)malloc(N * sizeof(double *));
|
double **X = (double **)malloc(N * sizeof(double *));
|
||||||
|
|
||||||
// cluster nodex in 'x' * cluster nodes in 'y' * 2
|
// cluster nodex in 'x' * cluster nodes in 'y' * 2
|
||||||
struct array_3d W = {.dim1 = num_out, .dim2 = num_out, .dim3 = features};
|
struct array_3d W;
|
||||||
|
W.dim1 = num_out;
|
||||||
|
W.dim2 = num_out;
|
||||||
|
W.dim3 = features;
|
||||||
W.data = (double *)malloc(num_out * num_out * features *
|
W.data = (double *)malloc(num_out * num_out * features *
|
||||||
sizeof(double)); // assign rows
|
sizeof(double)); // assign rows
|
||||||
|
|
||||||
@ -608,7 +614,10 @@ void test3()
|
|||||||
double **X = (double **)malloc(N * sizeof(double *));
|
double **X = (double **)malloc(N * sizeof(double *));
|
||||||
|
|
||||||
// cluster nodex in 'x' * cluster nodes in 'y' * 2
|
// cluster nodex in 'x' * cluster nodes in 'y' * 2
|
||||||
struct array_3d W = {.dim1 = num_out, .dim2 = num_out, .dim3 = features};
|
struct array_3d W;
|
||||||
|
W.dim1 = num_out;
|
||||||
|
W.dim2 = num_out;
|
||||||
|
W.dim3 = features;
|
||||||
W.data = (double *)malloc(num_out * num_out * features *
|
W.data = (double *)malloc(num_out * num_out * features *
|
||||||
sizeof(double)); // assign rows
|
sizeof(double)); // assign rows
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user