fix link references from fork to main repo

This commit is contained in:
Krishna Vedala 2020-06-28 11:22:42 -04:00
parent d5d68d5842
commit b833e27964
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7
7 changed files with 212 additions and 216 deletions

View File

@ -1,15 +1,15 @@
# The Algorithms - C # {#mainpage}
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/kvedala/C)
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/TheAlgorithms/C)
[![Gitter chat](https://img.shields.io/badge/Chat-Gitter-ff69b4.svg?label=Chat&logo=gitter&style=flat-square)](https://gitter.im/TheAlgorithms)
[![contributions welcome](https://img.shields.io/static/v1.svg?label=Contributions&message=Welcome&color=0059b3&style=flat-square)](https://github.com/kvedala/C-Plus-Plus/blob/master/CONTRIBUTING.md) 
![GitHub repo size](https://img.shields.io/github/repo-size/kvedala/C-Plus-Plus?color=red&style=flat-square)
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/kvedala/C?color=green&style=flat-square)
![Doxygen CI](https://github.com/kvedala/C/workflows/Doxygen%20CI/badge.svg)
![Awesome CI Workflow](https://github.com/kvedala/C/workflows/Awesome%20CI%20Workflow/badge.svg)
[![contributions welcome](https://img.shields.io/static/v1.svg?label=Contributions&message=Welcome&color=0059b3&style=flat-square)](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md) 
![GitHub repo size](https://img.shields.io/github/repo-size/TheAlgorithms/C-Plus-Plus?color=red&style=flat-square)
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/TheAlgorithms/C?color=green&style=flat-square)
![Doxygen CI](https://github.com/TheAlgorithms/C/workflows/Doxygen%20CI/badge.svg)
![Awesome CI Workflow](https://github.com/TheAlgorithms/C/workflows/Awesome%20CI%20Workflow/badge.svg)
[Online Documentation](https://kvedala.github.io/C).
[Online Documentation](https://TheAlgorithms.github.io/C).
Click on [Files menu](https://kvedala.github.io/C/files.html) to see the list of all the files documented with the code.
Click on [Files menu](https://TheAlgorithms.github.io/C/files.html) to see the list of all the files documented with the code.
All the code can be executed and tested online: [![using Google Colab Notebook](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/gist/kvedala/27f1b0b6502af935f6917673ec43bcd7/plot-durand_kerner-log.ipynb)

View File

@ -11,7 +11,7 @@
* data points in a much higher dimesional space by creating an equivalent in a
* 2-dimensional space.
* <img alt="Trained topological maps for the test cases in the program"
* src="https://raw.githubusercontent.com/kvedala/C/docs/images/machine_learning/kohonen/2D_Kohonen_SOM.svg"
* src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/machine_learning/kohonen/2D_Kohonen_SOM.svg"
* />
* \warning MSVC 2019 compiler generates code that does not execute as expected.
* However, MinGW, Clang for GCC and Clang for MSVC compilers on windows perform
@ -339,8 +339,7 @@ void kohonen_som(double **X, struct array_3d *W, int num_samples,
}
putchar('\n');
for (int i = 0; i < num_out; i++)
free(D[i]);
for (int i = 0; i < num_out; i++) free(D[i]);
free(D);
}
@ -372,7 +371,8 @@ void test_2d_classes(double *const *data, int N)
#endif
for (i = 0; i < N; i++)
{
int class = rand() % num_classes; // select a random class for the point
int class =
rand() % num_classes; // select a random class for the point
// create random coordinates (x,y,z) around the centre of the class
data[i][0] = _random(centres[class][0] - R, centres[class][0] + R);
@ -437,8 +437,7 @@ void test1()
kohonen_som(X, &W, N, features, num_out, 1e-4); // train the SOM
save_u_matrix("w12.csv", &W); // save the resultant weights
for (int i = 0; i < N; i++)
free(X[i]);
for (int i = 0; i < N; i++) free(X[i]);
free(X);
free(W.data);
}
@ -471,7 +470,8 @@ void test_3d_classes1(double *const *data, int N)
#endif
for (i = 0; i < N; i++)
{
int class = rand() % num_classes; // select a random class for the point
int class =
rand() % num_classes; // select a random class for the point
// create random coordinates (x,y,z) around the centre of the class
data[i][0] = _random(centres[class][0] - R, centres[class][0] + R);
@ -536,8 +536,7 @@ void test2()
kohonen_som(X, &W, N, features, num_out, 1e-4); // train the SOM
save_u_matrix("w22.csv", &W); // save the resultant weights
for (int i = 0; i < N; i++)
free(X[i]);
for (int i = 0; i < N; i++) free(X[i]);
free(X);
free(W.data);
}
@ -574,7 +573,8 @@ void test_3d_classes2(double *const *data, int N)
#endif
for (i = 0; i < N; i++)
{
int class = rand() % num_classes; // select a random class for the point
int class =
rand() % num_classes; // select a random class for the point
// create random coordinates (x,y,z) around the centre of the class
data[i][0] = _random(centres[class][0] - R, centres[class][0] + R);
@ -638,8 +638,7 @@ void test3()
kohonen_som(X, &W, N, features, num_out, 0.01); // train the SOM
save_u_matrix("w32.csv", &W); // save the resultant weights
for (int i = 0; i < N; i++)
free(X[i]);
for (int i = 0; i < N; i++) free(X[i]);
free(X);
free(W.data);
}

View File

@ -245,7 +245,7 @@ void test_circle(double *const *data, int N)
* "w12.csv" title "w2"
* ```
* ![Sample execution
* output](https://raw.githubusercontent.com/kvedala/C/docs/images/machine_learning/kohonen/test1.svg)
* output](https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/machine_learning/kohonen/test1.svg)
*/
void test1()
{
@ -270,8 +270,7 @@ void test1()
#pragma omp for
#endif
// preallocate with random initial weights
for (j = 0; j < features; j++)
W[i][j] = _random(-1, 1);
for (j = 0; j < features; j++) W[i][j] = _random(-1, 1);
}
}
@ -280,7 +279,8 @@ void test1()
save_nd_data("w11.csv", W, num_out,
features); // save initial random weights
kohonen_som_tracer(X, W, N, features, num_out, 0.1); // train the SOM
save_nd_data("w12.csv", W, num_out, features); // save the resultant weights
save_nd_data("w12.csv", W, num_out,
features); // save the resultant weights
for (int i = 0; i < max(num_out, N); i++)
{
@ -342,7 +342,7 @@ void test_lamniscate(double *const *data, int N)
* "w22.csv" title "w2"
* ```
* ![Sample execution
* output](https://raw.githubusercontent.com/kvedala/C/docs/images/machine_learning/kohonen/test2.svg)
* output](https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/machine_learning/kohonen/test2.svg)
*/
void test2()
{
@ -363,8 +363,7 @@ void test2()
#pragma omp for
#endif
// preallocate with random initial weights
for (j = 0; j < features; j++)
W[i][j] = _random(-1, 1);
for (j = 0; j < features; j++) W[i][j] = _random(-1, 1);
}
}
@ -373,7 +372,8 @@ void test2()
save_nd_data("w21.csv", W, num_out,
features); // save initial random weights
kohonen_som_tracer(X, W, N, features, num_out, 0.01); // train the SOM
save_nd_data("w22.csv", W, num_out, features); // save the resultant weights
save_nd_data("w22.csv", W, num_out,
features); // save the resultant weights
for (int i = 0; i < max(num_out, N); i++)
{
@ -414,7 +414,8 @@ void test_3d_classes(double *const *data, int N)
#endif
for (i = 0; i < N; i++)
{
int class = rand() % num_classes; // select a random class for the point
int class =
rand() % num_classes; // select a random class for the point
// create random coordinates (x,y,z) around the centre of the class
data[i][0] = _random(centres[class][0] - R, centres[class][0] + R);
@ -445,7 +446,7 @@ void test_3d_classes(double *const *data, int N)
* "w32.csv" title "w2"
* ```
* ![Sample execution
* output](https://raw.githubusercontent.com/kvedala/C/docs/images/machine_learning/kohonen/test3.svg)
* output](https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/machine_learning/kohonen/test3.svg)
*/
void test3()
{
@ -466,8 +467,7 @@ void test3()
#pragma omp for
#endif
// preallocate with random initial weights
for (j = 0; j < features; j++)
W[i][j] = _random(-1, 1);
for (j = 0; j < features; j++) W[i][j] = _random(-1, 1);
}
}
@ -476,7 +476,8 @@ void test3()
save_nd_data("w31.csv", W, num_out,
features); // save initial random weights
kohonen_som_tracer(X, W, N, features, num_out, 0.01); // train the SOM
save_nd_data("w32.csv", W, num_out, features); // save the resultant weights
save_nd_data("w32.csv", W, num_out,
features); // save the resultant weights
for (int i = 0; i < max(num_out, N); i++)
{
@ -524,7 +525,8 @@ int main(int argc, char **argv)
end_clk = clock();
printf("Test 3 completed in %.4g sec\n",
get_clock_diff(start_clk, end_clk));
printf("(Note: Calculated times include: creating test sets, training "
printf(
"(Note: Calculated times include: creating test sets, training "
"model and writing files to disk.)\n\n");
return 0;
}

View File

@ -21,10 +21,10 @@
* Sample implementation results to compute approximate roots of the equation
* \f$x^4-1=0\f$:\n
* <img
* src="https://raw.githubusercontent.com/kvedala/C/docs/images/numerical_methods/durand_kerner_error.svg"
* src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/numerical_methods/durand_kerner_error.svg"
* width="400" alt="Error evolution during root approximations computed every
* iteration."/> <img
* src="https://raw.githubusercontent.com/kvedala/C/docs/images/numerical_methods/durand_kerner_roots.svg"
* src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/numerical_methods/durand_kerner_roots.svg"
* width="400" alt="Roots evolution - shows the initial approximation of the
* roots and their convergence to a final approximation along with the iterative
* approximations" />
@ -53,8 +53,7 @@ long double complex poly_function(double *coeffs, unsigned int degree,
long double complex out = 0.;
unsigned int n;
for (n = 0; n < degree; n++)
out += coeffs[n] * cpow(x, degree - n - 1);
for (n = 0; n < degree; n++) out += coeffs[n] * cpow(x, degree - n - 1);
return out;
}
@ -102,7 +101,8 @@ int main(int argc, char **argv)
if (argc < 2)
{
printf("Please pass the coefficients of the polynomial as commandline "
printf(
"Please pass the coefficients of the polynomial as commandline "
"arguments.\n");
return 0;
}
@ -224,8 +224,7 @@ int main(int argc, char **argv)
if (iter % 500 == 0)
{
printf("Iter: %lu\t", iter);
for (n = 0; n < degree - 1; n++)
printf("\t%s", complex_str(s0[n]));
for (n = 0; n < degree - 1; n++) printf("\t%s", complex_str(s0[n]));
printf("\t\tabsolute average change: %.4g\n", tol_condition);
}
@ -241,8 +240,7 @@ end:
#endif
printf("\nIterations: %lu\n", iter);
for (n = 0; n < degree - 1; n++)
printf("\t%s\n", complex_str(s0[n]));
for (n = 0; n < degree - 1; n++) printf("\t%s\n", complex_str(s0[n]));
printf("absolute average change: %.4g\n", tol_condition);
printf("Time taken: %.4g sec\n",
(end_time - start_time) / (double)CLOCKS_PER_SEC);

View File

@ -22,7 +22,7 @@
* The computation results are stored to a text file `forward_euler.csv` and the
* exact soltuion results in `exact.csv` for comparison.
* <img
* src="https://raw.githubusercontent.com/kvedala/C/docs/images/numerical_methods/ode_forward_euler.svg"
* src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/numerical_methods/ode_forward_euler.svg"
* alt="Implementation solution"/>
*
* To implement [Van der Pol
@ -83,8 +83,7 @@ void forward_euler_step(const double dx, const double *x, double *y, double *dy)
{
int o;
problem(x, y, dy);
for (o = 0; o < order; o++)
y[o] += dx * dy[o];
for (o = 0; o < order; o++) y[o] += dx * dy[o];
}
/**

View File

@ -21,7 +21,7 @@
* \f}
* The computation results are stored to a text file `midpoint_euler.csv` and
* the exact soltuion results in `exact.csv` for comparison. <img
* src="https://raw.githubusercontent.com/kvedala/C/docs/images/numerical_methods/ode_midpoint_euler.svg"
* src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/numerical_methods/ode_midpoint_euler.svg"
* alt="Implementation solution"/>
*
* To implement [Van der Pol
@ -86,13 +86,11 @@ void midpoint_euler_step(double dx, double *x, double *y, double *dy)
double tmp_x = (*x) + 0.5 * dx;
double tmp_y[order];
int o;
for (o = 0; o < order; o++)
tmp_y[o] = y[o] + 0.5 * dx * dy[o];
for (o = 0; o < order; o++) tmp_y[o] = y[o] + 0.5 * dx * dy[o];
problem(&tmp_x, tmp_y, dy);
for (o = 0; o < order; o++)
y[o] += dx * dy[o];
for (o = 0; o < order; o++) y[o] += dx * dy[o];
}
/**

View File

@ -21,7 +21,7 @@
* \f}
* The computation results are stored to a text file `semi_implicit_euler.csv`
* and the exact soltuion results in `exact.csv` for comparison. <img
* src="https://raw.githubusercontent.com/kvedala/C/docs/images/numerical_methods/ode_semi_implicit_euler.svg"
* src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/numerical_methods/ode_semi_implicit_euler.svg"
* alt="Implementation solution"/>
*
* To implement [Van der Pol
@ -33,7 +33,7 @@
* dy[1] = mu * (1.f - y[0] * y[0]) * y[1] - y[0];
* ```
* <a href="https://en.wikipedia.org/wiki/Van_der_Pol_oscillator"><img
* src="https://raw.githubusercontent.com/kvedala/C/docs/images/numerical_methods/van_der_pol_implicit_euler.svg"
* src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/numerical_methods/van_der_pol_implicit_euler.svg"
* alt="Van der Pol Oscillator solution"/></a>
*
* \see ode_forward_euler.c, ode_midpoint_euler.c