diff --git a/d0/d01/smallest__circle_8cpp.html b/d0/d01/smallest__circle_8cpp.html index b84af5d4b..3dabe67d4 100644 --- a/d0/d01/smallest__circle_8cpp.html +++ b/d0/d01/smallest__circle_8cpp.html @@ -172,28 +172,28 @@ The function returns the radius of the circle and prints the coordinated of the
96 // for every subsequent point in the list
97 for (size_t j = i + 1; j < P.size(); j++)
98 // for every subsequent point in the list
-
99 for (size_t k = j + 1; k < P.size(); k++) {
+
99 for (size_t k = j + 1; k < P.size(); k++) {
100 // here, we now have picked three points from the given set of
101 // points that we can use
102 // viz., P[i], P[j] and P[k]
103 C.x = -0.5 * ((P[i].y * (P[j].x * P[j].x + P[j].y * P[j].y -
-
104 P[k].x * P[k].x - P[k].y * P[k].y) +
+
104 P[k].x * P[k].x - P[k].y * P[k].y) +
105 P[j].y * (P[k].x * P[k].x + P[k].y * P[k].y -
106 P[i].x * P[i].x - P[i].y * P[i].y) +
-
107 P[k].y * (P[i].x * P[i].x + P[i].y * P[i].y -
+
107 P[k].y * (P[i].x * P[i].x + P[i].y * P[i].y -
108 P[j].x * P[j].x - P[j].y * P[j].y)) /
-
109 (P[i].x * (P[j].y - P[k].y) +
+
109 (P[i].x * (P[j].y - P[k].y) +
110 P[j].x * (P[k].y - P[i].y) +
-
111 P[k].x * (P[i].y - P[j].y)));
+
111 P[k].x * (P[i].y - P[j].y)));
112 C.y = 0.5 * ((P[i].x * (P[j].x * P[j].x + P[j].y * P[j].y -
-
113 P[k].x * P[k].x - P[k].y * P[k].y) +
+
113 P[k].x * P[k].x - P[k].y * P[k].y) +
114 P[j].x * (P[k].x * P[k].x + P[k].y * P[k].y -
115 P[i].x * P[i].x - P[i].y * P[i].y) +
-
116 P[k].x * (P[i].x * P[i].x + P[i].y * P[i].y -
+
116 P[k].x * (P[i].x * P[i].x + P[i].y * P[i].y -
117 P[j].x * P[j].x - P[j].y * P[j].y)) /
-
118 (P[i].x * (P[j].y - P[k].y) +
+
118 (P[i].x * (P[j].y - P[k].y) +
119 P[j].x * (P[k].y - P[i].y) +
-
120 P[k].x * (P[i].y - P[j].y)));
+
120 P[k].x * (P[i].y - P[j].y)));
121 R = (LenghtLine(P[i], P[j]) * LenghtLine(P[j], P[k]) *
122 LenghtLine(P[k], P[i])) /
123 (4 * TriangleArea(P[i], P[j], P[k]));
@@ -226,8 +226,8 @@ The function returns the radius of the circle and prints the coordinated of the
150 return minR;
151}
std::cout
+
numerical_methods::simpson_method::k
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
std::endl
T endl(T... args)
-
numerical_methods::midpoint_rule::k
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
std::vector::size
T size(T... args)
LenghtLine
double LenghtLine(const Point &A, const Point &B)
Definition: smallest_circle.cpp:37
TriangleArea
double TriangleArea(const Point &A, const Point &B, const Point &C)
Definition: smallest_circle.cpp:54
diff --git a/d0/d01/smallest__circle_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph.svg b/d0/d01/smallest__circle_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph.svg index c072bbbf3..7f693e43e 100644 --- a/d0/d01/smallest__circle_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph.svg +++ b/d0/d01/smallest__circle_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph.svg @@ -1,7 +1,7 @@ - diff --git a/d0/d01/smallest__circle_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph_org.svg b/d0/d01/smallest__circle_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph_org.svg index e0f5a9998..71a2ef85e 100644 --- a/d0/d01/smallest__circle_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph_org.svg +++ b/d0/d01/smallest__circle_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - diff --git a/d0/d01/smallest__circle_8cpp_a6d0455dd5c30adda100e95f0423c786e_cgraph_org.svg b/d0/d01/smallest__circle_8cpp_a6d0455dd5c30adda100e95f0423c786e_cgraph_org.svg index b3b062acd..6b817c557 100644 --- a/d0/d01/smallest__circle_8cpp_a6d0455dd5c30adda100e95f0423c786e_cgraph_org.svg +++ b/d0/d01/smallest__circle_8cpp_a6d0455dd5c30adda100e95f0423c786e_cgraph_org.svg @@ -1,7 +1,7 @@ - - - diff --git a/d0/d01/smallest__circle_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg b/d0/d01/smallest__circle_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg index 7e12bb786..009961780 100644 --- a/d0/d01/smallest__circle_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg +++ b/d0/d01/smallest__circle_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d0/d01/smallest__circle_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d0/d01/smallest__circle_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index 11b03d5e1..0e1ab80b0 100644 --- a/d0/d01/smallest__circle_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/d0/d01/smallest__circle_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - diff --git a/d0/d08/realtime__stats_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph_org.svg b/d0/d08/realtime__stats_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph_org.svg index a0de5227b..208d811bb 100644 --- a/d0/d08/realtime__stats_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph_org.svg +++ b/d0/d08/realtime__stats_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - data_struc
215 data_structures::SkipList lst;
216
217 for (int j = 0; j < (1 << (data_structures::MAX_LEVEL + 1)); j++) {
-
218 int k = (std::rand() % (1 << (data_structures::MAX_LEVEL + 2)) + 1);
+
218 int k = (std::rand() % (1 << (data_structures::MAX_LEVEL + 2)) + 1);
219 lst.insertElement(k, &j);
220 }
221
@@ -183,7 +183,7 @@ constexpr float data_struc
Definition: skip_list.cpp:55
void insertElement(int key, void *value)
Definition: skip_list.cpp:90
void displayList()
Definition: skip_list.cpp:191
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
constexpr int MAX_LEVEL
Maximum level of skip list.
Definition: skip_list.cpp:27
T rand(T... args)
T srand(T... args)
diff --git a/d0/d5a/skip__list_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d0/d5a/skip__list_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index 5febdaaf5..c01b86677 100644 --- a/d0/d5a/skip__list_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/d0/d5a/skip__list_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - - diff --git a/d0/d65/namespacedouble__hashing_a28083ecac6eb94b643281875c8665931_cgraph_org.svg b/d0/d65/namespacedouble__hashing_a28083ecac6eb94b643281875c8665931_cgraph_org.svg index 2c0a1e8af..99d3b3077 100644 --- a/d0/d65/namespacedouble__hashing_a28083ecac6eb94b643281875c8665931_cgraph_org.svg +++ b/d0/d65/namespacedouble__hashing_a28083ecac6eb94b643281875c8665931_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d0/d65/namespacedouble__hashing_a5d06e4598569526294f10104875f6824_cgraph_org.svg b/d0/d65/namespacedouble__hashing_a5d06e4598569526294f10104875f6824_cgraph_org.svg index c7b0657b9..b9f186290 100644 --- a/d0/d65/namespacedouble__hashing_a5d06e4598569526294f10104875f6824_cgraph_org.svg +++ b/d0/d65/namespacedouble__hashing_a5d06e4598569526294f10104875f6824_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - diff --git a/d0/d65/namespacedouble__hashing_a9c652b2e467e5d250dfe3bed83b12560_cgraph_org.svg b/d0/d65/namespacedouble__hashing_a9c652b2e467e5d250dfe3bed83b12560_cgraph_org.svg index f62c08cab..28e0f1a37 100644 --- a/d0/d65/namespacedouble__hashing_a9c652b2e467e5d250dfe3bed83b12560_cgraph_org.svg +++ b/d0/d65/namespacedouble__hashing_a9c652b2e467e5d250dfe3bed83b12560_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d0/d65/namespacedouble__hashing_af4981819aae8bc7e7beeaef02615e30d_cgraph_org.svg b/d0/d65/namespacedouble__hashing_af4981819aae8bc7e7beeaef02615e30d_cgraph_org.svg index 135cd2bc7..a25b21b6d 100644 --- a/d0/d65/namespacedouble__hashing_af4981819aae8bc7e7beeaef02615e30d_cgraph_org.svg +++ b/d0/d65/namespacedouble__hashing_af4981819aae8bc7e7beeaef02615e30d_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
false if solution does not exist
58 {
-
59 int k = 0, xnext = 0, ynext = 0;
+
59 int k = 0, xnext = 0, ynext = 0;
60
61 if (mov == V * V) {
62 return true;
63 }
64
-
65 for (k = 0; k < V; k++) {
-
66 xnext = x + xmov[k];
-
67 ynext = y + ymov[k];
+
65 for (k = 0; k < V; k++) {
+
66 xnext = x + xmov[k];
+
67 ynext = y + ymov[k];
68
69 if (issafe<V>(xnext, ynext, sol)) {
70 sol[xnext][ynext] = mov;
@@ -344,7 +344,7 @@ template<size_t V>
78 }
79 return false;
80}
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
void mov(tower *From, tower *To)
Definition: tower_of_hanoi.cpp:39
Here is the call graph for this function:
diff --git a/d1/d2a/knight__tour_8cpp_aaa47356d98676cf5315d978f741e29c9_cgraph.svg b/d1/d2a/knight__tour_8cpp_aaa47356d98676cf5315d978f741e29c9_cgraph.svg index e30a103c1..96145c229 100644 --- a/d1/d2a/knight__tour_8cpp_aaa47356d98676cf5315d978f741e29c9_cgraph.svg +++ b/d1/d2a/knight__tour_8cpp_aaa47356d98676cf5315d978f741e29c9_cgraph.svg @@ -1,7 +1,7 @@ - - - - - - -
118 if (p != -1) {
119 t_depth[u] = 1 + t_depth[p];
120 }
-
121 for (int k = 1; k < t_maxlift; k++) {
+
121 for (int k = 1; k < t_maxlift; k++) {
122 if (t_par[u][k - 1] != -1) {
-
123 t_par[u][k] = t_par[t_par[u][k - 1]][k - 1];
+
123 t_par[u][k] = t_par[t_par[u][k - 1]][k - 1];
124 }
125 }
126
@@ -407,7 +407,7 @@ template<typename X >
131 }
132 }
void dfs_lca(int u, int p=-1)
Utility function to populate the t_par vector.
Definition: heavy_light_decomposition.cpp:116
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
Here is the call graph for this function:
@@ -637,10 +637,10 @@ template<typename X >
237 if (a == b) {
238 return a;
239 }
-
240 for (int k = t_maxlift - 1; k >= 0; k--) {
+
240 for (int k = t_maxlift - 1; k >= 0; k--) {
241 if (t_par[a][k] != t_par[b][k]) {
-
242 a = t_par[a][k];
-
243 b = t_par[b][k];
+
242 a = t_par[a][k];
+
243 b = t_par[b][k];
244 }
245 }
246 return t_par[a][0];
@@ -700,12 +700,12 @@ template<typename X >
Returns
void
200 {
-
201 for (int k = 0; k < t_maxlift; k++) {
+
201 for (int k = 0; k < t_maxlift; k++) {
202 if (*p == -1) {
203 return;
204 }
205 if (dist & 1) {
-
206 *p = t_par[*p][k];
+
206 *p = t_par[*p][k];
207 }
208 dist >>= 1;
209 }
diff --git a/d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree_a04cd96efaba147b19d3afc769b90ff70_cgraph.svg b/d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree_a04cd96efaba147b19d3afc769b90ff70_cgraph.svg index 55acd4881..591172518 100644 --- a/d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree_a04cd96efaba147b19d3afc769b90ff70_cgraph.svg +++ b/d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree_a04cd96efaba147b19d3afc769b90ff70_cgraph.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
309
310 int v1 = 0, v2 = 0, e = 0;
311 std::cin >> v1 >> v2 >> e; // vertices of left side, right side and edges
-
312 HKGraph g(v1, v2);
+
312 HKGraph g(v1, v2);
313 int u = 0, v = 0;
314 for (int i = 0; i < e; ++i)
315 {
316 std::cin >> u >> v;
-
317 g.addEdge(u, v);
+
317 g.addEdge(u, v);
318 }
319
-
320 int res = g.hopcroftKarpAlgorithm();
+
320 int res = g.hopcroftKarpAlgorithm();
321 std::cout << "Maximum matching is " << res <<"\n";
322
323 return 0;
@@ -197,8 +197,8 @@ Algorithm
Represents Bipartite graph for Hopcroft Karp implementation.
Definition: hopcroft_karp.cpp:67
+
double g(double x)
Another test function.
Definition: composite_simpson_rule.cpp:113
void tests()
Definition: hopcroft_karp.cpp:255
-
double g(double x)
A function g(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:97
Here is the call graph for this function:
diff --git a/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg b/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg index 8bcf0d8f1..6ccf2f68f 100644 --- a/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg +++ b/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg @@ -1,7 +1,7 @@ - - - - - -

Namespaces

namespace  numerical_methods - for io operations
+ for std::map container
  namespace  runge_kutta  Functions for Runge Kutta fourth order method.
@@ -283,7 +283,7 @@ Here is the call graph for this function:
66
67 auto n = static_cast<uint64_t>((x - init_x) / h);
68 // used a vector container for the variables
-
69 std::vector<double> k(4, 0.0);
+
69 std::vector<double> k(4, 0.0);
70
71 // Iterate for number of iterations
72
@@ -291,10 +291,10 @@ Here is the call graph for this function:
74 for (int i = 1; i <= n; ++i) {
75 // Apply Runge Kutta Formulas
76 // to find next value of y
-
77 k[0] = h * change(init_x, y);
-
78 k[1] = h * change(init_x + 0.5 * h, y + 0.5 * k[0]);
-
79 k[2] = h * change(init_x + 0.5 * h, y + 0.5 * k[1]);
-
80 k[3] = h * change(init_x + h, y + k[2]);
+
77 k[0] = h * change(init_x, y);
+
78 k[1] = h * change(init_x + 0.5 * h, y + 0.5 * k[0]);
+
79 k[2] = h * change(init_x + 0.5 * h, y + 0.5 * k[1]);
+
80 k[3] = h * change(init_x + h, y + k[2]);
81
82 // Update next value of y
83
@@ -307,8 +307,8 @@ Here is the call graph for this function:
90
91 return y;
92}
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
int h(int key)
Definition: hash_search.cpp:45
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
static double change(double x, double y)
for using the vector container
Definition: rungekutta.cpp:33
diff --git a/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.svg b/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.svg index cbc4be006..315c915f3 100644 --- a/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.svg +++ b/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.svg @@ -1,7 +1,7 @@ - - - diff --git a/d1/daa/random__pivot__quick__sort_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg b/d1/daa/random__pivot__quick__sort_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg index 54b6d6681..be594d746 100644 --- a/d1/daa/random__pivot__quick__sort_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg +++ b/d1/daa/random__pivot__quick__sort_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - diff --git a/d1/daa/random__pivot__quick__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg b/d1/daa/random__pivot__quick__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg index 5e12e132b..33b5cafe8 100644 --- a/d1/daa/random__pivot__quick__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg +++ b/d1/daa/random__pivot__quick__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg @@ -1,7 +1,7 @@ - - - -
31 {
-
32 return (l->freq > r->freq);
+
32 return (l->freq > r->freq);
33 }
-
double l(double x)
A function l(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:109
+
double l(double x)
Another test function.
Definition: composite_simpson_rule.cpp:117
diff --git a/d1/dbb/n__choose__r_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg b/d1/dbb/n__choose__r_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg index 6f576ed66..18ca2f882 100644 --- a/d1/dbb/n__choose__r_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg +++ b/d1/dbb/n__choose__r_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg @@ -1,7 +1,7 @@ - - - - - - - - - - -
-

for io operations +

for std::map container More...

@@ -106,15 +106,15 @@ Functions

 

Detailed Description

-

for io operations

+

for std::map container

Numerical Methods.

-

for std::map container

for std::vector

+

for io operations

+

for assert for math functions for integer allocation for std::atof for std::function for IO operations

+

Numerical algorithms/methods

for math operations

Numerical methods

for assert for mathematical-related functions for storing points and coefficents for IO operations

-

Numerical algorithms/methods

-

for assert for math functions for integer allocation for std::atof for std::function for IO operations

Numerical algorithms/methods

Function Documentation

diff --git a/d1/de0/namespacenumerical__methods_a158fd271b9a53e8f3f60b08b18857150_cgraph.svg b/d1/de0/namespacenumerical__methods_a158fd271b9a53e8f3f60b08b18857150_cgraph.svg index 02fbddc03..9994f0a37 100644 --- a/d1/de0/namespacenumerical__methods_a158fd271b9a53e8f3f60b08b18857150_cgraph.svg +++ b/d1/de0/namespacenumerical__methods_a158fd271b9a53e8f3f60b08b18857150_cgraph.svg @@ -1,7 +1,7 @@ - - - - diff --git a/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph_org.svg b/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph_org.svg index 39865105e..bb608db98 100644 --- a/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph_org.svg +++ b/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - -
61 // First insert the new key at the end
62 heap_size++;
63 int i = heap_size - 1;
-
64 harr[i] = k;
+
64 harr[i] = k;
65
66 // Fix the min heap property if it is violated
67 while (i != 0 && harr[parent(i)] > harr[i]) {
@@ -378,7 +378,7 @@ Here is the call graph for this function:
70 }
71}
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
Here is the call graph for this function:
@@ -434,11 +434,11 @@ Here is the call graph for this function:

to heapify a subtree with the root at given index

A recursive method to heapify a subtree with the root at given index This method assumes that the subtrees are already heapified

113 {
-
114 int l = left(i);
+
114 int l = left(i);
115 int r = right(i);
116 int smallest = i;
117 if (l < heap_size && harr[l] < harr[i])
-
118 smallest = l;
+
118 smallest = l;
119 if (r < heap_size && harr[r] < harr[smallest])
120 smallest = r;
121 if (smallest != i) {
@@ -448,7 +448,7 @@ Here is the call graph for this function:
125}
int left(int i)
Definition: binaryheap.cpp:31
int right(int i)
Definition: binaryheap.cpp:34
-
double l(double x)
A function l(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:109
+
double l(double x)
Another test function.
Definition: composite_simpson_rule.cpp:117
Here is the call graph for this function:
diff --git a/d2/d05/class_min_heap_a37ac126eabb0c3ce04047172abccca29_cgraph.svg b/d2/d05/class_min_heap_a37ac126eabb0c3ce04047172abccca29_cgraph.svg index d508c969c..ddc1b1fcb 100644 --- a/d2/d05/class_min_heap_a37ac126eabb0c3ce04047172abccca29_cgraph.svg +++ b/d2/d05/class_min_heap_a37ac126eabb0c3ce04047172abccca29_cgraph.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - diff --git a/d2/d23/neural__network_8cpp__incl_org.svg b/d2/d23/neural__network_8cpp__incl_org.svg index fe238da22..9377926c8 100644 --- a/d2/d23/neural__network_8cpp__incl_org.svg +++ b/d2/d23/neural__network_8cpp__incl_org.svg @@ -1,7 +1,7 @@ - -
85 {
86 uint32_t i = left; /* i --> index of left sub-array */
87 uint32_t j = mid + 1; /* j --> index for right sub-array */
-
88 uint32_t k = left; /* k --> index for resultant array temp */
+
88 uint32_t k = left; /* k --> index for resultant array temp */
89 uint32_t inv_count = 0; // inversion count
90
91 while ((i <= mid) && (j <= right)) {
92 if (arr[i] <= arr[j]) {
-
93 temp[k++] = arr[i++];
+
93 temp[k++] = arr[i++];
94 } else {
-
95 temp[k++] = arr[j++];
+
95 temp[k++] = arr[j++];
96 inv_count +=
97 (mid - i +
98 1); // tricky; may vary depending on selection of sub-array
@@ -331,19 +331,19 @@ template<typename T >
100 }
101 // Add remaining elements from the larger subarray to the end of temp
102 while (i <= mid) {
-
103 temp[k++] = arr[i++];
+
103 temp[k++] = arr[i++];
104 }
105 while (j <= right) {
-
106 temp[k++] = arr[j++];
+
106 temp[k++] = arr[j++];
107 }
108 // Copy temp[] to arr[]
-
109 for (k = left; k <= right; k++) {
-
110 arr[k] = temp[k];
+
109 for (k = left; k <= right; k++) {
+
110 arr[k] = temp[k];
111 }
112 return inv_count;
113}
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
T left(T... args)
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
diff --git a/d2/d26/count__inversions_8cpp_a3332498eabf6579ef059c0d0e9f4ec80_cgraph.svg b/d2/d26/count__inversions_8cpp_a3332498eabf6579ef059c0d0e9f4ec80_cgraph.svg index cd47f5d06..8f822f701 100644 --- a/d2/d26/count__inversions_8cpp_a3332498eabf6579ef059c0d0e9f4ec80_cgraph.svg +++ b/d2/d26/count__inversions_8cpp_a3332498eabf6579ef059c0d0e9f4ec80_cgraph.svg @@ -1,7 +1,7 @@ - - - - -
197// parallelize on threads
198#pragma omp for
199#endif
-
200 for (int k = i; k < COLUMNS; k++) {
+
200 for (int k = i; k < COLUMNS; k++) {
201 for (int kk = 0; kk < ROWS; kk++) {
-
202 col_vector2[kk] = A[kk][k];
+
202 col_vector2[kk] = A[kk][k];
203 }
-
204 R[0][i][k] = (col_vector * col_vector2).sum();
+
204 R[0][i][k] = (col_vector * col_vector2).sum();
205 }
206 }
207}
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
T sum(const std::vector< std::valarray< T > > &A)
Definition: vector_ops.hpp:232
std::valarray< T > vector_proj(const std::valarray< T > &a, const std::valarray< T > &b)
Definition: qr_decompose.h:104
double vector_mag(const std::valarray< T > &a)
Definition: qr_decompose.h:92
diff --git a/d2/d3b/namespaceqr__algorithm_a257425cb2365359da51c6fe6741834d8_cgraph.svg b/d2/d3b/namespaceqr__algorithm_a257425cb2365359da51c6fe6741834d8_cgraph.svg index 2beadc8f6..bf724334a 100644 --- a/d2/d3b/namespaceqr__algorithm_a257425cb2365359da51c6fe6741834d8_cgraph.svg +++ b/d2/d3b/namespaceqr__algorithm_a257425cb2365359da51c6fe6741834d8_cgraph.svg @@ -1,7 +1,7 @@ - - diff --git a/d2/d3b/namespaceqr__algorithm_a28e2fa3e803abaea6c568dc45d69d8cc_cgraph_org.svg b/d2/d3b/namespaceqr__algorithm_a28e2fa3e803abaea6c568dc45d69d8cc_cgraph_org.svg index 65ac124d1..503f21d24 100644 --- a/d2/d3b/namespaceqr__algorithm_a28e2fa3e803abaea6c568dc45d69d8cc_cgraph_org.svg +++ b/d2/d3b/namespaceqr__algorithm_a28e2fa3e803abaea6c568dc45d69d8cc_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - diff --git a/d2/d4b/spirograph_8cpp__incl_org.svg b/d2/d4b/spirograph_8cpp__incl_org.svg index 05d864314..4323aef52 100644 --- a/d2/d4b/spirograph_8cpp__incl_org.svg +++ b/d2/d4b/spirograph_8cpp__incl_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - diff --git a/d2/d58/neural__network_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg b/d2/d58/neural__network_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg index 3cc48d822..949227361 100644 --- a/d2/d58/neural__network_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg +++ b/d2/d58/neural__network_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d2/d58/neural__network_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d2/d58/neural__network_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index 93cafa31d..2b41d7fb4 100644 --- a/d2/d58/neural__network_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/d2/d58/neural__network_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - -
412 std::swap(a, b);
413 }
414 while (Tree<X>::t_depth[a] >= Tree<X>::t_depth[b]) {
-
415 int l = h_label[h_parent[a]];
+
415 int l = h_label[h_parent[a]];
416 int r = h_label[a];
- +
419 }
420 ret = SG<X>::combine(ret, SG<X>::query(l, r));
421 a = Tree<X>::t_par[h_parent[a]][0];
@@ -318,7 +318,7 @@ template<typename X >
X sret_init
inital query return value
Definition: heavy_light_decomposition.cpp:264
std::vector< int > t_depth
a vector to store the depth of a node,
Definition: heavy_light_decomposition.cpp:88
std::vector< std::vector< int > > t_par
a matrix to store every node's 2^kth parent
Definition: heavy_light_decomposition.cpp:87
-
double l(double x)
A function l(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:109
+
double l(double x)
Another test function.
Definition: composite_simpson_rule.cpp:117
T swap(T... args)
Here is the call graph for this function:
diff --git a/d2/d8a/classrange__queries_1_1heavy__light__decomposition_1_1_h_l_d_a0579062b384e54b611b80c6337c7f2c8_cgraph.svg b/d2/d8a/classrange__queries_1_1heavy__light__decomposition_1_1_h_l_d_a0579062b384e54b611b80c6337c7f2c8_cgraph.svg index fc7dda386..9344db846 100644 --- a/d2/d8a/classrange__queries_1_1heavy__light__decomposition_1_1_h_l_d_a0579062b384e54b611b80c6337c7f2c8_cgraph.svg +++ b/d2/d8a/classrange__queries_1_1heavy__light__decomposition_1_1_h_l_d_a0579062b384e54b611b80c6337c7f2c8_cgraph.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - diff --git a/d2/de9/heavy__light__decomposition_8cpp_a34b8683a2b429de5cce57e6d733ec817_cgraph_org.svg b/d2/de9/heavy__light__decomposition_8cpp_a34b8683a2b429de5cce57e6d733ec817_cgraph_org.svg index 7b3f8f041..a3ba188e8 100644 --- a/d2/de9/heavy__light__decomposition_8cpp_a34b8683a2b429de5cce57e6d733ec817_cgraph_org.svg +++ b/d2/de9/heavy__light__decomposition_8cpp_a34b8683a2b429de5cce57e6d733ec817_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d2/de9/heavy__light__decomposition_8cpp_a458410412185a5f09199deaff7157a8d_cgraph_org.svg b/d2/de9/heavy__light__decomposition_8cpp_a458410412185a5f09199deaff7157a8d_cgraph_org.svg index 7475b346d..6839856d5 100644 --- a/d2/de9/heavy__light__decomposition_8cpp_a458410412185a5f09199deaff7157a8d_cgraph_org.svg +++ b/d2/de9/heavy__light__decomposition_8cpp_a458410412185a5f09199deaff7157a8d_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d2/de9/heavy__light__decomposition_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d2/de9/heavy__light__decomposition_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index c22ec1e2c..8e8850674 100644 --- a/d2/de9/heavy__light__decomposition_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/d2/de9/heavy__light__decomposition_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d2/de9/heavy__light__decomposition_8cpp_af31ec5409537703d9c8a47350386b32a_cgraph_org.svg b/d2/de9/heavy__light__decomposition_8cpp_af31ec5409537703d9c8a47350386b32a_cgraph_org.svg index c0c978644..0c9df7bcf 100644 --- a/d2/de9/heavy__light__decomposition_8cpp_af31ec5409537703d9c8a47350386b32a_cgraph_org.svg +++ b/d2/de9/heavy__light__decomposition_8cpp_af31ec5409537703d9c8a47350386b32a_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - diff --git a/d3/d1a/hill__cipher_8cpp__incl_org.svg b/d3/d1a/hill__cipher_8cpp__incl_org.svg index 428efd90d..66670ee2e 100644 --- a/d3/d1a/hill__cipher_8cpp__incl_org.svg +++ b/d3/d1a/hill__cipher_8cpp__incl_org.svg @@ -1,7 +1,7 @@ - - - - - - diff --git a/d3/d24/qr__decomposition_8cpp_a840291bc02cba5474a4cb46a9b9566fe_cgraph_org.svg b/d3/d24/qr__decomposition_8cpp_a840291bc02cba5474a4cb46a9b9566fe_cgraph_org.svg index 22d017a7d..b5605f9d9 100644 --- a/d3/d24/qr__decomposition_8cpp_a840291bc02cba5474a4cb46a9b9566fe_cgraph_org.svg +++ b/d3/d24/qr__decomposition_8cpp_a840291bc02cba5474a4cb46a9b9566fe_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + +Algorithms_in_C++: simpson_method Namespace Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ 1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
simpson_method Namespace Reference
+
+
+ +

Contains the Simpson's method implementation. +More...

+

Detailed Description

+

Contains the Simpson's method implementation.

+
+
+ + + + diff --git a/d3/d78/floyd__cycle__detection__algo_8cpp__incl.svg b/d3/d78/floyd__cycle__detection__algo_8cpp__incl.svg index 8f9ee968c..53d07d368 100644 --- a/d3/d78/floyd__cycle__detection__algo_8cpp__incl.svg +++ b/d3/d78/floyd__cycle__detection__algo_8cpp__incl.svg @@ -1,7 +1,7 @@ - - - - - - diff --git a/d3/d80/z__function_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d3/d80/z__function_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index 811f0fab1..91e6390bc 100644 --- a/d3/d80/z__function_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/d3/d80/z__function_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - diff --git a/d3/d84/word__break_8cpp_afe4dcd6fd5282e535685361cba645d7c_cgraph_org.svg b/d3/d84/word__break_8cpp_afe4dcd6fd5282e535685361cba645d7c_cgraph_org.svg index 21c120dfb..b738f1310 100644 --- a/d3/d84/word__break_8cpp_afe4dcd6fd5282e535685361cba645d7c_cgraph_org.svg +++ b/d3/d84/word__break_8cpp_afe4dcd6fd5282e535685361cba645d7c_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - diff --git a/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a02df91964915ca97609d35f847faff5f_cgraph_org.svg b/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a02df91964915ca97609d35f847faff5f_cgraph_org.svg index 654911164..0b1a98721 100644 --- a/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a02df91964915ca97609d35f847faff5f_cgraph_org.svg +++ b/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a02df91964915ca97609d35f847faff5f_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a11f0d016dff7f7e62b3dddb9fdf47805_cgraph_org.svg b/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a11f0d016dff7f7e62b3dddb9fdf47805_cgraph_org.svg index 7b24e15e9..629ee4532 100644 --- a/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a11f0d016dff7f7e62b3dddb9fdf47805_cgraph_org.svg +++ b/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a11f0d016dff7f7e62b3dddb9fdf47805_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - diff --git a/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a5da1be3f5b5d967ebb36a201f3ebad11_cgraph_org.svg b/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a5da1be3f5b5d967ebb36a201f3ebad11_cgraph_org.svg index 988802c54..97668d60d 100644 --- a/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a5da1be3f5b5d967ebb36a201f3ebad11_cgraph_org.svg +++ b/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a5da1be3f5b5d967ebb36a201f3ebad11_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a61dd051a74e5f36c8dc03dae8dca6ef4_cgraph_org.svg b/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a61dd051a74e5f36c8dc03dae8dca6ef4_cgraph_org.svg index 4db3713f0..ea72fdb75 100644 --- a/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a61dd051a74e5f36c8dc03dae8dca6ef4_cgraph_org.svg +++ b/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_a61dd051a74e5f36c8dc03dae8dca6ef4_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - diff --git a/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_ad37e29e2a4a6cc0eb65cbd5595e1da95_cgraph_org.svg b/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_ad37e29e2a4a6cc0eb65cbd5595e1da95_cgraph_org.svg index 5c03c2b93..cdd29b134 100644 --- a/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_ad37e29e2a4a6cc0eb65cbd5595e1da95_cgraph_org.svg +++ b/d3/d95/classdata__structures_1_1tree__234_1_1_tree234_ad37e29e2a4a6cc0eb65cbd5595e1da95_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - -
64 prototype.size() -
65 1); // Index that we shift in text to find the substring
66 while (i < text.size()) {
-
67 int j = i, k = 0;
+
67 int j = i, k = 0;
68 bool flag = true;
69
70 for (int z = static_cast<int>(prototype.size() - 1); z >= 0 && flag;
71 z--) { // Checking if all characters of substring are equal with all characters of string
72 if (text[j] == prototype[z]) {
-
73 k++;
+
73 k++;
74 j--;
75 } else {
76 flag = false; // If two characters are not equal set flag to false and break from loop
@@ -266,8 +266,8 @@ false if text string does not contain prototype string
90 }
91 return false;
92}
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
std::unordered_map< char, int > findShiftTable(const std::string &prototype)
Definition: horspool.cpp:26
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
Here is the call graph for this function:
diff --git a/d3/dfe/horspool_8cpp_a1a9c3aa55ccc79d0f47d50c580997336_cgraph.svg b/d3/dfe/horspool_8cpp_a1a9c3aa55ccc79d0f47d50c580997336_cgraph.svg index 89ddcedda..b7b5af626 100644 --- a/d3/dfe/horspool_8cpp_a1a9c3aa55ccc79d0f47d50c580997336_cgraph.svg +++ b/d3/dfe/horspool_8cpp_a1a9c3aa55ccc79d0f47d50c580997336_cgraph.svg @@ -1,7 +1,7 @@ - - - - + + + + + + +Algorithms_in_C++: numerical_methods/composite_simpson_rule.cpp File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ 1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
composite_simpson_rule.cpp File Reference
+
+
+ +

Implementation of the Composite Simpson Rule for the approximation. +More...

+
#include <cassert>
+#include <cmath>
+#include <cstdint>
+#include <cstdlib>
+#include <functional>
+#include <iostream>
+#include <map>
+
+Include dependency graph for composite_simpson_rule.cpp:
+
+
+
+
+
+ + + + + + + +

+Namespaces

namespace  numerical_methods
 for std::map container
 
namespace  simpson_method
 Contains the Simpson's method implementation.
 
+ + + + + + + + + + + + + + + + + + + + + +

+Functions

double numerical_methods::simpson_method::evaluate_by_simpson (std::int32_t N, double h, double a, std::function< double(double)> func)
 
double numerical_methods::simpson_method::f (double x)
 A function f(x) that will be used to test the method. More...
 
double numerical_methods::simpson_method::g (double x)
 Another test function. More...
 
double numerical_methods::simpson_method::k (double x)
 Another test function. More...
 
double numerical_methods::simpson_method::l (double x)
 Another test function. More...
 
static void test (std::int32_t N, double h, double a, double b, bool used_argv_parameters)
 Self-test implementations. More...
 
int main (int argc, char **argv)
 Main function. More...
 
+

Detailed Description

+

Implementation of the Composite Simpson Rule for the approximation.

+

The following is an implementation of the Composite Simpson Rule for the approximation of definite integrals. More info -> wiki: https://en.wikipedia.org/wiki/Simpson%27s_rule#Composite_Simpson's_rule

+

The idea is to split the interval in an EVEN number N of intervals and use as interpolation points the xi for which it applies that xi = x0 + i*h, where h is a step defined as h = (b-a)/N where a and b are the first and last points of the interval of the integration [a, b].

+

We create a table of the xi and their corresponding f(xi) values and we evaluate the integral by the formula: I = h/3 * {f(x0) + 4*f(x1) + 2*f(x2) + ... + 2*f(xN-2) + 4*f(xN-1) + f(xN)}

+

That means that the first and last indexed i f(xi) are multiplied by 1, the odd indexed f(xi) by 4 and the even by 2.

+

In this program there are 4 sample test functions f, g, k, l that are evaluated in the same interval.

+

Arguments can be passed as parameters from the command line argv[1] = N, argv[2] = a, argv[3] = b

+

N must be even number and a<b.

+

In the end of the main() i compare the program's result with the one from mathematical software with 2 decimal points margin.

+

Add sample function by replacing one of the f, g, k, l and the assert

+
Author
ggkogkou
+

Function Documentation

+ +

◆ evaluate_by_simpson()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
double numerical_methods::simpson_method::evaluate_by_simpson (std::int32_t N,
double h,
double a,
std::function< double(double)> func 
)
+
+
67 {
+ +
69 data_table; // Contains the data points. key: i, value: f(xi)
+
70 double xi = a; // Initialize xi to the starting point x0 = a
+
71
+
72 // Create the data table
+
73 double temp;
+
74 for (std::int32_t i = 0; i <= N; i++) {
+
75 temp = func(xi);
+
76 data_table.insert(
+
77 std::pair<std::int32_t, double>(i, temp)); // add i and f(xi)
+
78 xi += h; // Get the next point xi for the next iteration
+
79 }
+
80
+
81 // Evaluate the integral.
+
82 // Remember: f(x0) + 4*f(x1) + 2*f(x2) + ... + 2*f(xN-2) + 4*f(xN-1) + f(xN)
+
83 double evaluate_integral = 0;
+
84 for (std::int32_t i = 0; i <= N; i++) {
+
85 if (i == 0 || i == N)
+
86 evaluate_integral += data_table.at(i);
+
87 else if (i % 2 == 1)
+
88 evaluate_integral += 4 * data_table.at(i);
+
89 else
+
90 evaluate_integral += 2 * data_table.at(i);
+
91 }
+
92
+
93 // Multiply by the coefficient h/3
+
94 evaluate_integral *= h / 3;
+
95
+
96 // If the result calculated is nan, then the user has given wrong input
+
97 // interval.
+
98 assert(!std::isnan(evaluate_integral) &&
+
99 "The definite integral can't be evaluated. Check the validity of "
+
100 "your input.\n");
+
101 // Else return
+
102 return evaluate_integral;
+
103}
+
T at(T... args)
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition: sparse_table.cpp:47
+
int h(int key)
Definition: hash_search.cpp:45
+
T insert(T... args)
+ +
T isnan(T... args)
+ + +
+
+
+ +

◆ f()

+ +
+
+ + + + + + + + +
double numerical_methods::simpson_method::f (double x)
+
+ +

A function f(x) that will be used to test the method.

+
Parameters
+ + +
xThe independent variable xi
+
+
+
Returns
the value of the dependent variable yi = f(xi)
+
111{ return std::sqrt(x) + std::log(x); }
+
T log(T... args)
+
T sqrt(T... args)
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ g()

+ +
+
+ + + + + + + + +
double numerical_methods::simpson_method::g (double x)
+
+ +

Another test function.

+
113{ return std::exp(-x) * (4 - std::pow(x, 2)); }
+
T exp(T... args)
+
T pow(T... args)
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ k()

+ +
+
+ + + + + + + + +
double numerical_methods::simpson_method::k (double x)
+
+ +

Another test function.

+
Examples
/Users/runner/work/C-Plus-Plus/C-Plus-Plus/numerical_methods/rungekutta.cpp.
+
+
115{ return std::sqrt(2 * std::pow(x, 3) + 3); }
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ l()

+ +
+
+ + + + + + + + +
double numerical_methods::simpson_method::l (double x)
+
+ +

Another test function.

+
117{ return x + std::log(2 * x + 1); }
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ main()

+ +
+
+ + + + + + + + + + + + + + + + + + +
int main (int argc,
char ** argv 
)
+
+ +

Main function.

+
Parameters
+ + + +
argccommandline argument count (ignored)
argvcommandline array of arguments (ignored)
+
+
+
Returns
0 on exit
+

Number of intervals to divide the integration interval. MUST BE EVEN

+

Starting and ending point of the integration in the real axis

+

Step, calculated by a, b and N

+
168 {
+
169 std::int32_t N = 16; /// Number of intervals to divide the integration
+
170 /// interval. MUST BE EVEN
+
171 double a = 1, b = 3; /// Starting and ending point of the integration in
+
172 /// the real axis
+
173 double h; /// Step, calculated by a, b and N
+
174
+
175 bool used_argv_parameters =
+
176 false; // If argv parameters are used then the assert must be omitted
+
177 // for the tst cases
+
178
+
179 // Get user input (by the command line parameters or the console after
+
180 // displaying messages)
+
181 if (argc == 4) {
+
182 N = std::atoi(argv[1]);
+
183 a = (double)std::atof(argv[2]);
+
184 b = (double)std::atof(argv[3]);
+
185 // Check if a<b else abort
+
186 assert(a < b && "a has to be less than b");
+
187 assert(N > 0 && "N has to be > 0");
+
188 if (N < 16 || a != 1 || b != 3)
+
189 used_argv_parameters = true;
+
190 std::cout << "You selected N=" << N << ", a=" << a << ", b=" << b
+
191 << std::endl;
+
192 } else
+
193 std::cout << "Default N=" << N << ", a=" << a << ", b=" << b
+
194 << std::endl;
+
195
+
196 // Find the step
+
197 h = (b - a) / N;
+
198
+
199 test(N, h, a, b, used_argv_parameters); // run self-test implementations
+
200
+
201 return 0;
+
202}
+
T atof(T... args)
+
T atoi(T... args)
+ +
static void test(std::int32_t N, double h, double a, double b, bool used_argv_parameters)
Self-test implementations.
Definition: composite_simpson_rule.cpp:130
+
T endl(T... args)
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ test()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static void test (std::int32_t N,
double h,
double a,
double b,
bool used_argv_parameters 
)
+
+static
+
+ +

Self-test implementations.

+
Parameters
+ + + + + + +
Nis the number of intervals
his the step
ais x0
bis the end of the interval
used_argv_parametersis 'true' if argv parameters are given and 'false' if not
+
+
+
131 {
+
132 // Call the functions and find the integral of each function
+
133 double result_f = numerical_methods::simpson_method::evaluate_by_simpson(
+
134 N, h, a, numerical_methods::simpson_method::f);
+
135 assert((used_argv_parameters || (result_f >= 4.09 && result_f <= 4.10)) &&
+
136 "The result of f(x) is wrong");
+
137 std::cout << "The result of integral f(x) on interval [" << a << ", " << b
+
138 << "] is equal to: " << result_f << std::endl;
+
139
+
140 double result_g = numerical_methods::simpson_method::evaluate_by_simpson(
+
141 N, h, a, numerical_methods::simpson_method::g);
+
142 assert((used_argv_parameters || (result_g >= 0.27 && result_g <= 0.28)) &&
+
143 "The result of g(x) is wrong");
+
144 std::cout << "The result of integral g(x) on interval [" << a << ", " << b
+
145 << "] is equal to: " << result_g << std::endl;
+
146
+
147 double result_k = numerical_methods::simpson_method::evaluate_by_simpson(
+
148 N, h, a, numerical_methods::simpson_method::k);
+
149 assert((used_argv_parameters || (result_k >= 9.06 && result_k <= 9.07)) &&
+
150 "The result of k(x) is wrong");
+
151 std::cout << "The result of integral k(x) on interval [" << a << ", " << b
+
152 << "] is equal to: " << result_k << std::endl;
+
153
+
154 double result_l = numerical_methods::simpson_method::evaluate_by_simpson(
+
155 N, h, a, numerical_methods::simpson_method::l);
+
156 assert((used_argv_parameters || (result_l >= 7.16 && result_l <= 7.17)) &&
+
157 "The result of l(x) is wrong");
+
158 std::cout << "The result of integral l(x) on interval [" << a << ", " << b
+
159 << "] is equal to: " << result_l << std::endl;
+
160}
+
+
+
+
+
+ + + + diff --git a/d4/d18/composite__simpson__rule_8cpp.js b/d4/d18/composite__simpson__rule_8cpp.js new file mode 100644 index 000000000..2fd43b295 --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp.js @@ -0,0 +1,9 @@ +var composite__simpson__rule_8cpp = +[ + [ "f", "d4/d18/composite__simpson__rule_8cpp.html#a4251b4df4748a0b9c43a48f61bdd2397", null ], + [ "g", "d4/d18/composite__simpson__rule_8cpp.html#a2f67508d5f392b0321772169342c98ad", null ], + [ "k", "d4/d18/composite__simpson__rule_8cpp.html#a1b74d828b33760094906797042b89442", null ], + [ "l", "d4/d18/composite__simpson__rule_8cpp.html#a6d8df83a6f26ce24a75d3b358b7f5b8a", null ], + [ "main", "d4/d18/composite__simpson__rule_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627", null ], + [ "test", "d4/d18/composite__simpson__rule_8cpp.html#a2ae48a41e43dc6ab11b962742349646e", null ] +]; \ No newline at end of file diff --git a/d4/d18/composite__simpson__rule_8cpp_a1b74d828b33760094906797042b89442_cgraph.map b/d4/d18/composite__simpson__rule_8cpp_a1b74d828b33760094906797042b89442_cgraph.map new file mode 100644 index 000000000..bfe34e792 --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a1b74d828b33760094906797042b89442_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/d4/d18/composite__simpson__rule_8cpp_a1b74d828b33760094906797042b89442_cgraph.md5 b/d4/d18/composite__simpson__rule_8cpp_a1b74d828b33760094906797042b89442_cgraph.md5 new file mode 100644 index 000000000..0eba06b45 --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a1b74d828b33760094906797042b89442_cgraph.md5 @@ -0,0 +1 @@ +607b767bed0a2213e6466cdfe0b5b0ab \ No newline at end of file diff --git a/d4/d18/composite__simpson__rule_8cpp_a1b74d828b33760094906797042b89442_cgraph.svg b/d4/d18/composite__simpson__rule_8cpp_a1b74d828b33760094906797042b89442_cgraph.svg new file mode 100644 index 000000000..c24a970db --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a1b74d828b33760094906797042b89442_cgraph.svg @@ -0,0 +1,59 @@ + + + + + + +numerical_methods::simpson_method::k + + + +Node1 + + +numerical_methods:: +simpson_method::k + + + + + +Node1->Node1 + + + + + +Node2 + + +std::pow + + + + + +Node1->Node2 + + + + + +Node3 + + +std::sqrt + + + + + +Node1->Node3 + + + + + diff --git a/d4/d18/composite__simpson__rule_8cpp_a2f67508d5f392b0321772169342c98ad_cgraph.map b/d4/d18/composite__simpson__rule_8cpp_a2f67508d5f392b0321772169342c98ad_cgraph.map new file mode 100644 index 000000000..6347c2155 --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a2f67508d5f392b0321772169342c98ad_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/d4/d18/composite__simpson__rule_8cpp_a2f67508d5f392b0321772169342c98ad_cgraph.md5 b/d4/d18/composite__simpson__rule_8cpp_a2f67508d5f392b0321772169342c98ad_cgraph.md5 new file mode 100644 index 000000000..fa9201cf2 --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a2f67508d5f392b0321772169342c98ad_cgraph.md5 @@ -0,0 +1 @@ +d989500da0adab6a067180ffe52e4dc6 \ No newline at end of file diff --git a/d4/d18/composite__simpson__rule_8cpp_a2f67508d5f392b0321772169342c98ad_cgraph.svg b/d4/d18/composite__simpson__rule_8cpp_a2f67508d5f392b0321772169342c98ad_cgraph.svg new file mode 100644 index 000000000..1c9f5735f --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a2f67508d5f392b0321772169342c98ad_cgraph.svg @@ -0,0 +1,59 @@ + + + + + + +numerical_methods::simpson_method::g + + + +Node1 + + +numerical_methods:: +simpson_method::g + + + + + +Node1->Node1 + + + + + +Node2 + + +std::exp + + + + + +Node1->Node2 + + + + + +Node3 + + +std::pow + + + + + +Node1->Node3 + + + + + diff --git a/d4/d18/composite__simpson__rule_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.map b/d4/d18/composite__simpson__rule_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.map new file mode 100644 index 000000000..838c83191 --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.map @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/d4/d18/composite__simpson__rule_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.md5 b/d4/d18/composite__simpson__rule_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.md5 new file mode 100644 index 000000000..a04176599 --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.md5 @@ -0,0 +1 @@ +31883ba25d50e8ff81b5ca655a19f4ba \ No newline at end of file diff --git a/d4/d18/composite__simpson__rule_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.svg b/d4/d18/composite__simpson__rule_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.svg new file mode 100644 index 000000000..25f22711b --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.svg @@ -0,0 +1,97 @@ + + + + + + +main + + + +Node1 + + +main + + + + + +Node2 + + +std::atof + + + + + +Node1->Node2 + + + + + +Node3 + + +std::atoi + + + + + +Node1->Node3 + + + + + +Node4 + + +std::endl + + + + + +Node1->Node4 + + + + + +Node5 + + +h + + + + + +Node1->Node5 + + + + + +Node6 + + +test + + + + + +Node1->Node6 + + + + + diff --git a/d4/d18/composite__simpson__rule_8cpp_a4251b4df4748a0b9c43a48f61bdd2397_cgraph.map b/d4/d18/composite__simpson__rule_8cpp_a4251b4df4748a0b9c43a48f61bdd2397_cgraph.map new file mode 100644 index 000000000..9ea8321ac --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a4251b4df4748a0b9c43a48f61bdd2397_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/d4/d18/composite__simpson__rule_8cpp_a4251b4df4748a0b9c43a48f61bdd2397_cgraph.md5 b/d4/d18/composite__simpson__rule_8cpp_a4251b4df4748a0b9c43a48f61bdd2397_cgraph.md5 new file mode 100644 index 000000000..465882ebe --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a4251b4df4748a0b9c43a48f61bdd2397_cgraph.md5 @@ -0,0 +1 @@ +4eb53c9d9cde3bd8f71d36bd077bb538 \ No newline at end of file diff --git a/d4/d18/composite__simpson__rule_8cpp_a4251b4df4748a0b9c43a48f61bdd2397_cgraph.svg b/d4/d18/composite__simpson__rule_8cpp_a4251b4df4748a0b9c43a48f61bdd2397_cgraph.svg new file mode 100644 index 000000000..92be68c3f --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a4251b4df4748a0b9c43a48f61bdd2397_cgraph.svg @@ -0,0 +1,59 @@ + + + + + + +numerical_methods::simpson_method::f + + + +Node1 + + +numerical_methods:: +simpson_method::f + + + + + +Node1->Node1 + + + + + +Node2 + + +std::log + + + + + +Node1->Node2 + + + + + +Node3 + + +std::sqrt + + + + + +Node1->Node3 + + + + + diff --git a/d4/d18/composite__simpson__rule_8cpp_a6d8df83a6f26ce24a75d3b358b7f5b8a_cgraph.map b/d4/d18/composite__simpson__rule_8cpp_a6d8df83a6f26ce24a75d3b358b7f5b8a_cgraph.map new file mode 100644 index 000000000..a101f43ea --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a6d8df83a6f26ce24a75d3b358b7f5b8a_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/d4/d18/composite__simpson__rule_8cpp_a6d8df83a6f26ce24a75d3b358b7f5b8a_cgraph.md5 b/d4/d18/composite__simpson__rule_8cpp_a6d8df83a6f26ce24a75d3b358b7f5b8a_cgraph.md5 new file mode 100644 index 000000000..67dfe2118 --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a6d8df83a6f26ce24a75d3b358b7f5b8a_cgraph.md5 @@ -0,0 +1 @@ +89624d1d159d81587955a3f775cccc71 \ No newline at end of file diff --git a/d4/d18/composite__simpson__rule_8cpp_a6d8df83a6f26ce24a75d3b358b7f5b8a_cgraph.svg b/d4/d18/composite__simpson__rule_8cpp_a6d8df83a6f26ce24a75d3b358b7f5b8a_cgraph.svg new file mode 100644 index 000000000..273daf7cc --- /dev/null +++ b/d4/d18/composite__simpson__rule_8cpp_a6d8df83a6f26ce24a75d3b358b7f5b8a_cgraph.svg @@ -0,0 +1,44 @@ + + + + + + +numerical_methods::simpson_method::l + + + +Node1 + + +numerical_methods:: +simpson_method::l + + + + + +Node1->Node1 + + + + + +Node2 + + +std::log + + + + + +Node1->Node2 + + + + + diff --git a/d4/d1f/merge__insertion__sort_8cpp__incl.svg b/d4/d1f/merge__insertion__sort_8cpp__incl.svg index 0b0f9f310..b1158b568 100644 --- a/d4/d1f/merge__insertion__sort_8cpp__incl.svg +++ b/d4/d1f/merge__insertion__sort_8cpp__incl.svg @@ -1,7 +1,7 @@ - - - - - - - diff --git a/d4/d26/durand__kerner__roots_8cpp__incl_org.svg b/d4/d26/durand__kerner__roots_8cpp__incl_org.svg index b67206630..0b9652dce 100644 --- a/d4/d26/durand__kerner__roots_8cpp__incl_org.svg +++ b/d4/d26/durand__kerner__roots_8cpp__incl_org.svg @@ -1,7 +1,7 @@ - - - diff --git a/d4/d2f/fcfs__scheduling_8cpp__incl_org.svg b/d4/d2f/fcfs__scheduling_8cpp__incl_org.svg index 23c997a2e..050bfbc2c 100644 --- a/d4/d2f/fcfs__scheduling_8cpp__incl_org.svg +++ b/d4/d2f/fcfs__scheduling_8cpp__incl_org.svg @@ -1,7 +1,7 @@ - - - - - diff --git a/d4/d32/inorder__successor__of__bst_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg b/d4/d32/inorder__successor__of__bst_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg index 4b04e427a..6ec4f8554 100644 --- a/d4/d32/inorder__successor__of__bst_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg +++ b/d4/d32/inorder__successor__of__bst_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - diff --git a/d4/d32/inorder__successor__of__bst_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg b/d4/d32/inorder__successor__of__bst_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg index 5e12e132b..33b5cafe8 100644 --- a/d4/d32/inorder__successor__of__bst_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg +++ b/d4/d32/inorder__successor__of__bst_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - diff --git a/d4/d60/kohonen__som__trace_8cpp__incl_org.svg b/d4/d60/kohonen__som__trace_8cpp__incl_org.svg index cb597aa77..90b741d01 100644 --- a/d4/d60/kohonen__som__trace_8cpp__incl_org.svg +++ b/d4/d60/kohonen__som__trace_8cpp__incl_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/d4/db6/reverse__binary__tree_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d4/db6/reverse__binary__tree_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index c1732b7ba..4842a7df4 100644 --- a/d4/db6/reverse__binary__tree_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/d4/db6/reverse__binary__tree_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - diff --git a/d4/dd2/namespacequadratic__probing_a312143ed316d48978084c025ff8d9768_cgraph_org.svg b/d4/dd2/namespacequadratic__probing_a312143ed316d48978084c025ff8d9768_cgraph_org.svg index 55352288e..6d92c01b9 100644 --- a/d4/dd2/namespacequadratic__probing_a312143ed316d48978084c025ff8d9768_cgraph_org.svg +++ b/d4/dd2/namespacequadratic__probing_a312143ed316d48978084c025ff8d9768_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - diff --git a/d4/dd2/namespacequadratic__probing_a69fe1f7c36fe004ba83eef2ca82e7e30_cgraph_org.svg b/d4/dd2/namespacequadratic__probing_a69fe1f7c36fe004ba83eef2ca82e7e30_cgraph_org.svg index 3f151f08f..14c53ab3a 100644 --- a/d4/dd2/namespacequadratic__probing_a69fe1f7c36fe004ba83eef2ca82e7e30_cgraph_org.svg +++ b/d4/dd2/namespacequadratic__probing_a69fe1f7c36fe004ba83eef2ca82e7e30_cgraph_org.svg @@ -1,7 +1,7 @@ - - - diff --git a/d4/dd2/namespacequadratic__probing_ada6f1f44f7e83b0094fbcbe170788486_cgraph_org.svg b/d4/dd2/namespacequadratic__probing_ada6f1f44f7e83b0094fbcbe170788486_cgraph_org.svg index 9d7126ee8..d39ee919e 100644 --- a/d4/dd2/namespacequadratic__probing_ada6f1f44f7e83b0094fbcbe170788486_cgraph_org.svg +++ b/d4/dd2/namespacequadratic__probing_ada6f1f44f7e83b0094fbcbe170788486_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - -
379 }
380 if (i < num_out) { // only add new arrays if i < num_out
381 W[i] = std::vector<std::valarray<double>>(num_out);
-
382 for (int k = 0; k < num_out; k++) {
-
383 W[i][k] = std::valarray<double>(features);
+
382 for (int k = 0; k < num_out; k++) {
+
383 W[i][k] = std::valarray<double>(features);
384#ifdef _OPENMP
385#pragma omp for
386#endif
387 for (j = 0; j < features; j++) {
388 // preallocate with random initial weights
-
389 W[i][k][j] = _random(-10, 10);
+
389 W[i][k][j] = _random(-10, 10);
390 }
391 }
392 }
@@ -336,12 +336,12 @@ Here is the call graph for this function:
398 kohonen_som(X, &W, 1e-4); // train the SOM
399 save_u_matrix("w12.csv", W); // save the resultant weights
400}
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition: sparse_table.cpp:47
int save_2d_data(const char *fname, const std::vector< std::valarray< double > > &X)
Definition: kohonen_som_topology.cpp:65
double _random(double a, double b)
Definition: kohonen_som_topology.cpp:53
void test_2d_classes(std::vector< std::valarray< double > > *data)
Definition: kohonen_som_topology.cpp:330
T max(T... args)
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
int save_u_matrix(const char *fname, const std::vector< std::vector< std::valarray< double > > > &W)
Definition: kohonen_som_topology.cpp:142
void kohonen_som(const std::vector< std::valarray< double > > &X, std::vector< std::vector< std::valarray< double > > > *W, double alpha_min)
Definition: kohonen_som_topology.cpp:269
@@ -387,14 +387,14 @@ Here is the call graph for this function:
461 }
462 if (i < num_out) { // only add new arrays if i < num_out
463 W[i] = std::vector<std::valarray<double>>(num_out);
-
464 for (int k = 0; k < num_out; k++) {
-
465 W[i][k] = std::valarray<double>(features);
+
464 for (int k = 0; k < num_out; k++) {
+
465 W[i][k] = std::valarray<double>(features);
466#ifdef _OPENMP
467#pragma omp for
468#endif
469 for (j = 0; j < features; j++) {
470 // preallocate with random initial weights
-
471 W[i][k][j] = _random(-10, 10);
+
471 W[i][k][j] = _random(-10, 10);
472 }
473 }
474 }
@@ -448,14 +448,14 @@ Here is the call graph for this function:
547 }
548 if (i < num_out) { // only add new arrays if i < num_out
549 W[i] = std::vector<std::valarray<double>>(num_out);
-
550 for (int k = 0; k < num_out; k++) {
-
551 W[i][k] = std::valarray<double>(features);
+
550 for (int k = 0; k < num_out; k++) {
+
551 W[i][k] = std::valarray<double>(features);
552#ifdef _OPENMP
553#pragma omp for
554#endif
555 for (j = 0; j < features; j++) {
556 // preallocate with random initial weights
-
557 W[i][k][j] = _random(-10, 10);
+
557 W[i][k][j] = _random(-10, 10);
558 }
559 }
560 }
diff --git a/d4/def/kohonen__som__topology_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph.svg b/d4/def/kohonen__som__topology_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph.svg index 58867f662..44eba3f25 100644 --- a/d4/def/kohonen__som__topology_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph.svg +++ b/d4/def/kohonen__som__topology_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph.svg @@ -1,7 +1,7 @@ - diff --git a/d4/def/kohonen__som__topology_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph_org.svg b/d4/def/kohonen__som__topology_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph_org.svg index 100b8d0ca..b90842545 100644 --- a/d4/def/kohonen__som__topology_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph_org.svg +++ b/d4/def/kohonen__som__topology_8cpp_a0283886819c7c140a023582b7269e2d0_cgraph_org.svg @@ -1,7 +1,7 @@ - - - diff --git a/d4/def/kohonen__som__topology_8cpp_a1440a7779ac56f47a3f355ce4a8c7da0_cgraph_org.svg b/d4/def/kohonen__som__topology_8cpp_a1440a7779ac56f47a3f355ce4a8c7da0_cgraph_org.svg index 1a67ff572..0941177cd 100644 --- a/d4/def/kohonen__som__topology_8cpp_a1440a7779ac56f47a3f355ce4a8c7da0_cgraph_org.svg +++ b/d4/def/kohonen__som__topology_8cpp_a1440a7779ac56f47a3f355ce4a8c7da0_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d4/def/kohonen__som__topology_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph_org.svg b/d4/def/kohonen__som__topology_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph_org.svg index 5b4cb5912..65a8bf13e 100644 --- a/d4/def/kohonen__som__topology_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph_org.svg +++ b/d4/def/kohonen__som__topology_8cpp_a3c04138a5bfe5d72780bb7e82a18e627_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - diff --git a/d4/def/kohonen__som__topology_8cpp_a6d0455dd5c30adda100e95f0423c786e_cgraph_org.svg b/d4/def/kohonen__som__topology_8cpp_a6d0455dd5c30adda100e95f0423c786e_cgraph_org.svg index 61950afd0..7f49e7c1a 100644 --- a/d4/def/kohonen__som__topology_8cpp_a6d0455dd5c30adda100e95f0423c786e_cgraph_org.svg +++ b/d4/def/kohonen__som__topology_8cpp_a6d0455dd5c30adda100e95f0423c786e_cgraph_org.svg @@ -1,7 +1,7 @@ -
291 std::vector<std::valarray<double>> current_pass = X;
292 details.emplace_back(X);
293 for (const auto &l : layers) {
-
294 current_pass = multiply(current_pass, l.kernel);
-
295 current_pass = apply_function(current_pass, l.activation_function);
+
294 current_pass = multiply(current_pass, l.kernel);
+
295 current_pass = apply_function(current_pass, l.activation_function);
296 details.emplace_back(current_pass);
297 }
298 return details;
299 }
+
double l(double x)
Another test function.
Definition: composite_simpson_rule.cpp:117
T emplace_back(T... args)
-
double l(double x)
A function l(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:109
std::vector< std::valarray< T > > multiply(const std::vector< std::valarray< T > > &A, const std::vector< std::valarray< T > > &B)
Definition: vector_ops.hpp:460
std::vector< std::valarray< T > > apply_function(const std::vector< std::valarray< T > > &A, T(*func)(const T &))
Definition: vector_ops.hpp:329
diff --git a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a2be1b52bb9f57486f9a436f35c9089c0_cgraph.svg b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a2be1b52bb9f57486f9a436f35c9089c0_cgraph.svg index 003f6854e..535621cd6 100644 --- a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a2be1b52bb9f57486f9a436f35c9089c0_cgraph.svg +++ b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a2be1b52bb9f57486f9a436f35c9089c0_cgraph.svg @@ -1,7 +1,7 @@ - diff --git a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a2be1b52bb9f57486f9a436f35c9089c0_cgraph_org.svg b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a2be1b52bb9f57486f9a436f35c9089c0_cgraph_org.svg index d344a94e2..ff6274b2d 100644 --- a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a2be1b52bb9f57486f9a436f35c9089c0_cgraph_org.svg +++ b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a2be1b52bb9f57486f9a436f35c9089c0_cgraph_org.svg @@ -1,7 +1,7 @@ - - - diff --git a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a36494e26ff36d6e15c1022bb9a1ee848_cgraph_org.svg b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a36494e26ff36d6e15c1022bb9a1ee848_cgraph_org.svg index a6e89baee..242fc935d 100644 --- a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a36494e26ff36d6e15c1022bb9a1ee848_cgraph_org.svg +++ b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a36494e26ff36d6e15c1022bb9a1ee848_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a3b9eac1824d365dce715fb17c33cb96f_cgraph_org.svg b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a3b9eac1824d365dce715fb17c33cb96f_cgraph_org.svg index 4ddaa79a4..f7e4b2e0a 100644 --- a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a3b9eac1824d365dce715fb17c33cb96f_cgraph_org.svg +++ b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a3b9eac1824d365dce715fb17c33cb96f_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - diff --git a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a5172a6791b9bd24f4232bab8d6b81fff_cgraph_org.svg b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a5172a6791b9bd24f4232bab8d6b81fff_cgraph_org.svg index 7babec360..2f45dc941 100644 --- a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a5172a6791b9bd24f4232bab8d6b81fff_cgraph_org.svg +++ b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a5172a6791b9bd24f4232bab8d6b81fff_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - diff --git a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a650c677fd6512665741ddd9b7983275d_cgraph_org.svg b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a650c677fd6512665741ddd9b7983275d_cgraph_org.svg index 11e223b2c..6c1ae1fde 100644 --- a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a650c677fd6512665741ddd9b7983275d_cgraph_org.svg +++ b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a650c677fd6512665741ddd9b7983275d_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a88bf9023ab3d4cdb61cf707c7cdfc86b_cgraph_org.svg b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a88bf9023ab3d4cdb61cf707c7cdfc86b_cgraph_org.svg index 59721cfc6..85b249ed3 100644 --- a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a88bf9023ab3d4cdb61cf707c7cdfc86b_cgraph_org.svg +++ b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_a88bf9023ab3d4cdb61cf707c7cdfc86b_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_aec648ea4f40bd71123b5f907a681dd8e_cgraph_org.svg b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_aec648ea4f40bd71123b5f907a681dd8e_cgraph_org.svg index 991a0554b..01002e854 100644 --- a/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_aec648ea4f40bd71123b5f907a681dd8e_cgraph_org.svg +++ b/d4/df4/classmachine__learning_1_1neural__network_1_1_neural_network_aec648ea4f40bd71123b5f907a681dd8e_cgraph_org.svg @@ -1,7 +1,7 @@ - - -
128 r = c;
129 }
130
-
131 int k = 1;
+
131 int k = 1;
132
133 while (k <= r) {
134 if (k == 1) {
@@ -336,7 +336,7 @@ Here is the call graph for this function:
143 all_projection[i] = 0; /// First initialised to zero
144 }
145
-
146 int l = 1;
+
146 int l = 1;
147 while (l < k) {
149 temp{}; /// to store previous projected array
@@ -344,7 +344,7 @@ Here is the call graph for this function:
151 /// previous array will change
152 factor = projection(A[k - 1], B[l - 1], c);
153 for (int i = 0; i < c; ++i) {
-
154 temp[i] = B[l - 1][i] * factor; /// projected array created
+
154 temp[i] = B[l - 1][i] * factor; /// projected array created
155 }
156 for (int j = 0; j < c; ++j) {
157 all_projection[j] =
@@ -352,23 +352,23 @@ Here is the call graph for this function:
159 temp[j]; /// we take the projection with all the
160 /// previous vector and add them.
161 }
-
162 l++;
+
162 l++;
163 }
164 for (int i = 0; i < c; ++i) {
-
165 B[k - 1][i] =
-
166 A[k - 1][i] -
+
165 B[k - 1][i] =
+
166 A[k - 1][i] -
167 all_projection[i]; /// subtract total projection vector
168 /// from the input vector
169 }
170 }
-
171 k++;
+
171 k++;
172 }
173 display(r, c, B); // for displaying orthogoanlised vectors
174}
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
+
double l(double x)
Another test function.
Definition: composite_simpson_rule.cpp:117
double projection(const std::array< double, 10 > &x, const std::array< double, 10 > &y, const int &c)
Definition: gram_schmidt.cpp:79
-
double l(double x)
A function l(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:109
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
Here is the call graph for this function:
diff --git a/d5/d33/gram__schmidt_8cpp_a46e459aff5eafffb5ad9ceb129b4d274_cgraph.svg b/d5/d33/gram__schmidt_8cpp_a46e459aff5eafffb5ad9ceb129b4d274_cgraph.svg index ed16a667f..4a819d64d 100644 --- a/d5/d33/gram__schmidt_8cpp_a46e459aff5eafffb5ad9ceb129b4d274_cgraph.svg +++ b/d5/d33/gram__schmidt_8cpp_a46e459aff5eafffb5ad9ceb129b4d274_cgraph.svg @@ -1,7 +1,7 @@ - - diff --git a/d5/d33/gram__schmidt_8cpp_aa31ca28f60c880802462335eedc5d91f_cgraph_org.svg b/d5/d33/gram__schmidt_8cpp_aa31ca28f60c880802462335eedc5d91f_cgraph_org.svg index 77f197258..b6fe22fff 100644 --- a/d5/d33/gram__schmidt_8cpp_aa31ca28f60c880802462335eedc5d91f_cgraph_org.svg +++ b/d5/d33/gram__schmidt_8cpp_aa31ca28f60c880802462335eedc5d91f_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - diff --git a/d5/d45/sublist__search_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg b/d5/d45/sublist__search_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg index 0525e343b..432351d69 100644 --- a/d5/d45/sublist__search_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg +++ b/d5/d45/sublist__search_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - diff --git a/d5/d45/sublist__search_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg b/d5/d45/sublist__search_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg index 5e12e132b..33b5cafe8 100644 --- a/d5/d45/sublist__search_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg +++ b/d5/d45/sublist__search_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg @@ -1,7 +1,7 @@ - - -
51 arr[k] = R[j];
52 j++;
53 }
-
54 k++;
+
54 k++;
55 }
56
57 delete[] L;
58 delete[] R;
59}
-
double k(double x)
A function k(x) that will be used to test the method.
Definition: midpoint_integral_method.cpp:103
+
double k(double x)
Another test function.
Definition: composite_simpson_rule.cpp:115
diff --git a/d5/d4c/group__sorting_gaa8dca7b867074164d5f45b0f3851269d_cgraph.svg b/d5/d4c/group__sorting_gaa8dca7b867074164d5f45b0f3851269d_cgraph.svg index 0dbc3f6f5..38dbcce65 100644 --- a/d5/d4c/group__sorting_gaa8dca7b867074164d5f45b0f3851269d_cgraph.svg +++ b/d5/d4c/group__sorting_gaa8dca7b867074164d5f45b0f3851269d_cgraph.svg @@ -1,7 +1,7 @@ - - - - - - - - diff --git a/d5/d58/persistent__seg__tree__lazy__prop_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg b/d5/d58/persistent__seg__tree__lazy__prop_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg index cac1a9690..2a14c44f3 100644 --- a/d5/d58/persistent__seg__tree__lazy__prop_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg +++ b/d5/d58/persistent__seg__tree__lazy__prop_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg @@ -1,7 +1,7 @@ - - diff --git a/d5/d58/persistent__seg__tree__lazy__prop_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d5/d58/persistent__seg__tree__lazy__prop_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index 5e29e9349..7744d432d 100644 --- a/d5/d58/persistent__seg__tree__lazy__prop_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/d5/d58/persistent__seg__tree__lazy__prop_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -1,7 +1,7 @@ - - - - - - - - - - - - - -