diff --git a/annotated.html b/annotated.html index fb6a4f642..18f3abb88 100644 --- a/annotated.html +++ b/annotated.html @@ -106,7 +106,7 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();  CBtree  Ccll  Ccompare - CComplex + CComplexClass Complex to represent complex numbers as a field  CCycleCheck  Cdouble_linked_list  CEdge diff --git a/d3/d3d/complex__numbers_8cpp__incl.map b/d3/d3d/complex__numbers_8cpp__incl.map index 911874f7f..d2df0ab02 100644 --- a/d3/d3d/complex__numbers_8cpp__incl.map +++ b/d3/d3d/complex__numbers_8cpp__incl.map @@ -1,5 +1,5 @@ - + diff --git a/d3/d3d/complex__numbers_8cpp__incl.md5 b/d3/d3d/complex__numbers_8cpp__incl.md5 index 79d5a53dd..02887a679 100644 --- a/d3/d3d/complex__numbers_8cpp__incl.md5 +++ b/d3/d3d/complex__numbers_8cpp__incl.md5 @@ -1 +1 @@ -870490ba425dafa65850e0b92a3438e5 \ No newline at end of file +3b0592b2c12d647c28b408c0e25158c6 \ No newline at end of file diff --git a/d3/d3d/complex__numbers_8cpp__incl.svg b/d3/d3d/complex__numbers_8cpp__incl.svg index 8cbd8f793..cf4ed6ba2 100644 --- a/d3/d3d/complex__numbers_8cpp__incl.svg +++ b/d3/d3d/complex__numbers_8cpp__incl.svg @@ -12,7 +12,7 @@ Node1 - + math/complex_numbers.cpp diff --git a/d4/d86/large__number_8h_source.html b/d4/d86/large__number_8h_source.html index f0078cc61..d90ffdcb5 100644 --- a/d4/d86/large__number_8h_source.html +++ b/d4/d86/large__number_8h_source.html @@ -411,7 +411,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
T inner_product(T... args)
int gcd(int num1, int num2)
Definition: gcd_iterative_euclidean.cpp:15
-
Definition: complex_numbers.cpp:19
+
Class Complex to represent complex numbers as a field.
Definition: complex_numbers.cpp:20
T move(T... args)
int main()
Main function.
Definition: fibonacci.cpp:28
std::vector< T > operator+(std::vector< T > const &A, std::vector< T > const &B)
Definition: ordinary_least_squares_regressor.cpp:198
@@ -431,10 +431,10 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
void test1()
Definition: kohonen_som_topology.cpp:359
T size(T... args)
double fit(const std::vector< double > &x, const int &y)
Definition: adaline_learning.cpp:112
-
double arg() const
Definition: complex_numbers.cpp:81
+
double arg() const
Member function to give the argument of our complex number.
Definition: complex_numbers.cpp:87
ll ans(ll n)
Definition: matrix_exponentiation.cpp:91
STL class.
-
Complex operator*(const Complex &other)
Definition: complex_numbers.cpp:108
+
Complex operator*(const Complex &other)
Operator overload of '*' on Complex class. Operator overload to be able to multiple two complex numbe...
Definition: complex_numbers.cpp:117
Definition: large_number.h:24
large_number fib(uint64_t n)
Definition: fibonacci_large.cpp:24
int main()
Definition: fibonacci_fast.cpp:51
@@ -442,11 +442,11 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
int main(int argc, char **argv)
Definition: kohonen_som_topology.cpp:566
static bool hasChildren(std::shared_ptr< TrieNode > node)
Definition: trie_modern.cpp:41
-
Complex operator-(const Complex &other)
Definition: complex_numbers.cpp:98
-
Complex(const Complex &other)
Definition: complex_numbers.cpp:55
+
Complex operator-(const Complex &other)
Operator overload of '-' on Complex class. Operator overload to be able to subtract two complex numbe...
Definition: complex_numbers.cpp:106
+
Complex(const Complex &other)
Copy Constructor.
Definition: complex_numbers.cpp:58
T emplace(T... args)
-
Complex(double x=0.f, double y=0.f, bool is_polar=false)
Definition: complex_numbers.cpp:40
-
double abs() const
Definition: complex_numbers.cpp:73
+
Complex(double x=0.f, double y=0.f, bool is_polar=false)
Complex Constructor which initialises our complex number.
Definition: complex_numbers.cpp:43
+
double abs() const
Member function to give the modulus of our complex number. Member function to which gives the absolut...
Definition: complex_numbers.cpp:79
int main(int argc, char *argv[])
Definition: large_factorial.cpp:89
void test_3d_classes(std::vector< std::valarray< double >> *data)
Definition: kohonen_som_trace.cpp:347
Definition: trie_modern.cpp:26
@@ -454,7 +454,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
int gcd(int num1, int num2)
Definition: gcd_recursive_euclidean.cpp:14
Library to perform arithmatic operations on arbitrarily large numbers.
Definition: avltree.cpp:13
-
double get_rand()
Definition: complex_numbers.cpp:186
+
double get_rand()
Function to get random numbers to generate our complex numbers for test.
Definition: complex_numbers.cpp:200
int binExpo_alt(int a, int b)
Definition: binary_exponent.cpp:42
void explore(int, vector< bool > &)
Utility function for depth first seach algorithm this function explores the vertex which is passed in...
Definition: connected_components.cpp:101
T search(T... args)
@@ -467,9 +467,9 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
Graph(unsigned int vertices, std::vector< Edge > const &edges)
Definition: cycle_check_directed_graph.cpp:90
T back(T... args)
int predict(const std::vector< double > &x, double *out=nullptr)
Definition: adaline_learning.cpp:92
-
void tests()
Definition: complex_numbers.cpp:191
+
void tests()
Definition: complex_numbers.cpp:205
Machine learning algorithms.
-
const Complex & operator=(const Complex &other)
Definition: complex_numbers.cpp:148
+
const Complex & operator=(const Complex &other)
Operator overload of '=' on Complex class. Operator overload to be able to copy RHS instance of Compl...
Definition: complex_numbers.cpp:160
bool is_square(std::vector< std::vector< T >> const &A)
Definition: ordinary_least_squares_regressor.cpp:57
int main()
Definition: gcd_recursive_euclidean.cpp:42
double update_weights(const std::valarray< double > &X, std::vector< std::vector< std::valarray< double >>> *W, std::vector< std::valarray< double >> *D, double alpha, int R)
Definition: kohonen_som_topology.cpp:193
@@ -498,7 +498,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
void depth_first_search()
Function that perfoms depth first search algorithm on graph.
Definition: connected_components.cpp:83
T clock(T... args)
int main(int argc, char **argv)
Definition: kohonen_som_trace.cpp:443
-
double real() const
Definition: complex_numbers.cpp:60
+
double real() const
Member function to get real value of our complex number. Member function (getter) to access the class...
Definition: complex_numbers.cpp:64
large_number(const large_number &a)
Definition: large_number.h:48
int fibonacci(unsigned int n)
Definition: fibonacci.cpp:17
void insert(const std::string &word)
Definition: trie_modern.cpp:109
@@ -516,7 +516,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
Definition: huffman.cpp:7
int main()
Definition: line_segment_intersection.cpp:92
int main()
Definition: connected_components.cpp:111
-
Complex operator/(const Complex &other)
Definition: complex_numbers.cpp:131
+
Complex operator/(const Complex &other)
Operator overload of '/' on Complex class. Operator overload to be able to divide two complex numbers...
Definition: complex_numbers.cpp:142
large_number & operator++()
Definition: large_number.h:175
void test1(double eta=0.01)
Definition: adaline_learning.cpp:204
node * insert(node *root, int item)
Definition: avltree.cpp:66
@@ -542,9 +542,9 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
T close(T... args)
int main()
Definition: factorial.cpp:15
void multiply(const T n)
Definition: large_number.h:258
-
Complex operator~() const
Definition: complex_numbers.cpp:120
+
Complex operator~() const
Operator overload of '~' on Complex class. Operator overload of the BITWISE NOT which gives us the co...
Definition: complex_numbers.cpp:130
T perror(T... args)
-
std::ostream & operator<<(std::ostream &os, const Complex &num)
Definition: complex_numbers.cpp:172
+
std::ostream & operator<<(std::ostream &os, const Complex &num)
Operator overload of '<<' of ostream for Complex class. Overloaded insersion operator to accommodate ...
Definition: complex_numbers.cpp:186
#define ll
Definition: matrix_exponentiation.cpp:33
T erase(T... args)
std::vector< double > weights
weights of the neural network
Definition: adaline_learning.cpp:189
@@ -562,7 +562,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
void test2()
Definition: kohonen_som_topology.cpp:439
bool on_segment(Point first_point, Point second_point, Point third_point)
Definition: line_segment_intersection.cpp:75
-
bool operator==(const Complex &a, const Complex &b)
Definition: complex_numbers.cpp:162
+
bool operator==(const Complex &a, const Complex &b)
Operator overload of '==' on Complex class. Logical Equal overload for our Complex class.
Definition: complex_numbers.cpp:175
T remove(T... args)
std::vector< unsigned char > _digits
Definition: large_number.h:285
#define endl
Definition: matrix_exponentiation.cpp:36
@@ -585,7 +585,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
int sum_of_divisor(int num)
Definition: check_amicable_pair.cpp:21
Type top()
Definition: stack.h:93
int data[MAX]
test data
Definition: hash_search.cpp:24
-
double imag() const
Definition: complex_numbers.cpp:65
+
double imag() const
Member function to get imaginary value of our complex number. Member function (getter) to access the ...
Definition: complex_numbers.cpp:70
T round(T... args)
Definition: queue.h:17
static bool test()
Definition: large_number.h:65
@@ -595,7 +595,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
T endl(T... args)
int main()
Definition: armstrong_number.cpp:77
std::vector< std::vector< float > > get_inverse(std::vector< std::vector< T >> const &A)
Definition: ordinary_least_squares_regressor.cpp:220
-
int main()
Definition: complex_numbers.cpp:253
+
int main()
Definition: complex_numbers.cpp:267
T left(T... args)
vector< vector< int > > adj
adj stores adjacency list representation of graph
Definition: connected_components.cpp:40
friend bool operator==(large_number const &a, large_number const &b)
Definition: large_number.h:155
@@ -642,7 +642,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
T malloc(T... args)
T end(T... args)
char stack[MAX]
Definition: paranthesis_matching.cpp:20
-
Complex operator+(const Complex &other)
Definition: complex_numbers.cpp:88
+
Complex operator+(const Complex &other)
Operator overload of '+' on Complex class. Operator overload to be able to add two complex numbers.
Definition: complex_numbers.cpp:95
void extendedEuclid_1(T1 A, T1 B, T1 *GCD, T2 *x, T2 *y)
Definition: extended_euclid_algorithm.cpp:41
T setw(T... args)
const double accuracy
model fit convergence accuracy
Definition: adaline_learning.cpp:188
diff --git a/d5/d67/complex__numbers_8cpp.html b/d5/d67/complex__numbers_8cpp.html index 4f514542d..a6a3c8b59 100644 --- a/d5/d67/complex__numbers_8cpp.html +++ b/d5/d67/complex__numbers_8cpp.html @@ -97,6 +97,9 @@ $(document).ready(function(){initNavTree('d5/d67/complex__numbers_8cpp.html','..
complex_numbers.cpp File Reference
+ +

An implementation of Complex Number as Objects. +More...

#include <cassert>
#include <cmath>
#include <complex>
@@ -113,15 +116,20 @@ Include dependency graph for complex_numbers.cpp:

Classes

class  Complex + Class Complex to represent complex numbers as a field. More...
  + + - + + @@ -129,34 +137,10 @@ Functions

Functions

bool operator== (const Complex &a, const Complex &b)
 Operator overload of '==' on Complex class. Logical Equal overload for our Complex class. More...
 
std::ostreamoperator<< (std::ostream &os, const Complex &num)
 Operator overload of '<<' of ostream for Complex class. Overloaded insersion operator to accommodate the printing of our complex number in their standard form. More...
 
double get_rand ()
+double get_rand ()
 Function to get random numbers to generate our complex numbers for test.
 
void tests ()
 
 

Detailed Description

-
Author
tjgurwara99
-

A basic implementation of Complex Number field as a class with operators overloaded to accommodate (mathematical) field operations.

+

An implementation of Complex Number as Objects.

+
Author
tjgurwara99
+

A basic implementation of Complex Number field as a class with operators overloaded to accommodate (mathematical) field operations.

Function Documentation

- -

◆ get_rand()

- -
-
- - - - - - - -
double get_rand ()
-
-

Function to get random numbers to generate our complex numbers for test

-
186 { return (std::rand() % 100 - 50) / 100.f; }
-
-Here is the call graph for this function:
-
-
-
-
- -
-

◆ main()

@@ -172,10 +156,10 @@ Here is the call graph for this function:

Main function

-
253  {
-
254  tests();
-
255  return 0;
-
256 }
+
267  {
+
268  tests();
+
269  return 0;
+
270 }
Here is the call graph for this function:
@@ -210,23 +194,25 @@ Here is the call graph for this function:
-

Overloaded insersion operator to accommodate the printing of our complex number in their standard form.

Parameters
+ +

Operator overload of '<<' of ostream for Complex class. Overloaded insersion operator to accommodate the printing of our complex number in their standard form.

+
Parameters
osThe console stream
numThe complex number.
-
172  {
-
173  os << "(" << num.real();
-
174  if (num.imag() < 0) {
-
175  os << " - " << -num.imag();
-
176  } else {
-
177  os << " + " << num.imag();
-
178  }
-
179  os << "i)";
-
180  return os;
-
181 }
+
186  {
+
187  os << "(" << num.real();
+
188  if (num.imag() < 0) {
+
189  os << " - " << -num.imag();
+
190  } else {
+
191  os << " + " << num.imag();
+
192  }
+
193  os << "i)";
+
194  return os;
+
195 }
Here is the call graph for this function:
@@ -261,7 +247,9 @@ Here is the call graph for this function:
-

Logical Equal overload for our Complex class.

Parameters
+ +

Operator overload of '==' on Complex class. Logical Equal overload for our Complex class.

+
Parameters
@@ -271,9 +259,9 @@ Here is the call graph for this function:
Returns
'True' If real and imaginary parts of a and b are same
'False' Otherwise.
-
162  {
-
163  return a.real() == b.real() && a.imag() == b.imag();
-
164 }
+
175  {
+
176  return a.real() == b.real() && a.imag() == b.imag();
+
177 }
Here is the call graph for this function:
@@ -298,64 +286,64 @@ Here is the call graph for this function:
aLeft hand side of our expression
bRight hand side of our expression

Tests Function

-
191  {
-
192  std::srand(std::time(nullptr));
-
193  double x1 = get_rand(), y1 = get_rand(), x2 = get_rand(), y2 = get_rand();
-
194  Complex num1(x1, y1), num2(x2, y2);
-
195  std::complex<double> cnum1(x1, y1), cnum2(x2, y2);
-
196  Complex result;
-
197  std::complex<double> expected;
-
198  // Test for addition
-
199  result = num1 + num2;
-
200  expected = cnum1 + cnum2;
-
201  assert(((void)"1 + 1i + 1 + 1i is equal to 2 + 2i but the addition doesn't "
-
202  "add up \n",
-
203  (result.real() == expected.real() &&
-
204  result.imag() == expected.imag())));
-
205  std::cout << "First test passes." << std::endl;
-
206  // Test for subtraction
-
207  result = num1 - num2;
-
208  expected = cnum1 - cnum2;
-
209  assert(((void)"1 + 1i - 1 - 1i is equal to 0 but the program says "
-
210  "otherwise. \n",
-
211  (result.real() == expected.real() &&
-
212  result.imag() == expected.imag())));
-
213  std::cout << "Second test passes." << std::endl;
-
214  // Test for multiplication
-
215  result = num1 * num2;
-
216  expected = cnum1 * cnum2;
-
217  assert(((void)"(1 + 1i) * (1 + 1i) is equal to 2i but the program says "
-
218  "otherwise. \n",
-
219  (result.real() == expected.real() &&
-
220  result.imag() == expected.imag())));
-
221  std::cout << "Third test passes." << std::endl;
-
222  // Test for division
-
223  result = num1 / num2;
-
224  expected = cnum1 / cnum2;
-
225  assert(((void)"(1 + 1i) / (1 + 1i) is equal to 1 but the program says "
-
226  "otherwise.\n",
-
227  (result.real() == expected.real() &&
-
228  result.imag() == expected.imag())));
-
229  std::cout << "Fourth test passes." << std::endl;
-
230  // Test for conjugates
-
231  result = ~num1;
-
232  expected = std::conj(cnum1);
-
233  assert(((void)"(1 + 1i) has a conjugate which is equal to (1 - 1i) but the "
-
234  "program says otherwise.\n",
-
235  (result.real() == expected.real() &&
-
236  result.imag() == expected.imag())));
-
237  std::cout << "Fifth test passes.\n";
-
238  // Test for Argument of our complex number
-
239  assert(((void)"(1 + 1i) has argument PI / 4 but the program differs from "
-
240  "the std::complex result.\n",
-
241  (num1.arg() == std::arg(cnum1))));
-
242  std::cout << "Sixth test passes.\n";
-
243  // Test for absolute value of our complex number
-
244  assert(((void)"(1 + 1i) has absolute value sqrt(2) but the program differs "
-
245  "from the std::complex result. \n",
-
246  (num1.abs() == std::abs(cnum1))));
-
247  std::cout << "Seventh test passes.\n";
-
248 }
+
205  {
+
206  std::srand(std::time(nullptr));
+
207  double x1 = get_rand(), y1 = get_rand(), x2 = get_rand(), y2 = get_rand();
+
208  Complex num1(x1, y1), num2(x2, y2);
+
209  std::complex<double> cnum1(x1, y1), cnum2(x2, y2);
+
210  Complex result;
+
211  std::complex<double> expected;
+
212  // Test for addition
+
213  result = num1 + num2;
+
214  expected = cnum1 + cnum2;
+
215  assert(((void)"1 + 1i + 1 + 1i is equal to 2 + 2i but the addition doesn't "
+
216  "add up \n",
+
217  (result.real() == expected.real() &&
+
218  result.imag() == expected.imag())));
+
219  std::cout << "First test passes." << std::endl;
+
220  // Test for subtraction
+
221  result = num1 - num2;
+
222  expected = cnum1 - cnum2;
+
223  assert(((void)"1 + 1i - 1 - 1i is equal to 0 but the program says "
+
224  "otherwise. \n",
+
225  (result.real() == expected.real() &&
+
226  result.imag() == expected.imag())));
+
227  std::cout << "Second test passes." << std::endl;
+
228  // Test for multiplication
+
229  result = num1 * num2;
+
230  expected = cnum1 * cnum2;
+
231  assert(((void)"(1 + 1i) * (1 + 1i) is equal to 2i but the program says "
+
232  "otherwise. \n",
+
233  (result.real() == expected.real() &&
+
234  result.imag() == expected.imag())));
+
235  std::cout << "Third test passes." << std::endl;
+
236  // Test for division
+
237  result = num1 / num2;
+
238  expected = cnum1 / cnum2;
+
239  assert(((void)"(1 + 1i) / (1 + 1i) is equal to 1 but the program says "
+
240  "otherwise.\n",
+
241  (result.real() == expected.real() &&
+
242  result.imag() == expected.imag())));
+
243  std::cout << "Fourth test passes." << std::endl;
+
244  // Test for conjugates
+
245  result = ~num1;
+
246  expected = std::conj(cnum1);
+
247  assert(((void)"(1 + 1i) has a conjugate which is equal to (1 - 1i) but the "
+
248  "program says otherwise.\n",
+
249  (result.real() == expected.real() &&
+
250  result.imag() == expected.imag())));
+
251  std::cout << "Fifth test passes.\n";
+
252  // Test for Argument of our complex number
+
253  assert(((void)"(1 + 1i) has argument PI / 4 but the program differs from "
+
254  "the std::complex result.\n",
+
255  (num1.arg() == std::arg(cnum1))));
+
256  std::cout << "Sixth test passes.\n";
+
257  // Test for absolute value of our complex number
+
258  assert(((void)"(1 + 1i) has absolute value sqrt(2) but the program differs "
+
259  "from the std::complex result. \n",
+
260  (num1.abs() == std::abs(cnum1))));
+
261  std::cout << "Seventh test passes.\n";
+
262 }
Here is the call graph for this function:
@@ -368,14 +356,13 @@ Here is the call graph for this function:
T srand(T... args)
-
Definition: complex_numbers.cpp:19
-
double get_rand()
Definition: complex_numbers.cpp:186
-
void tests()
Definition: complex_numbers.cpp:191
-
double real() const
Definition: complex_numbers.cpp:60
+
Class Complex to represent complex numbers as a field.
Definition: complex_numbers.cpp:20
+
double get_rand()
Function to get random numbers to generate our complex numbers for test.
Definition: complex_numbers.cpp:200
+
void tests()
Definition: complex_numbers.cpp:205
+
double real() const
Member function to get real value of our complex number. Member function (getter) to access the class...
Definition: complex_numbers.cpp:64
T real(T... args)
-
T rand(T... args)
-
double imag() const
Definition: complex_numbers.cpp:65
+
double imag() const
Member function to get imaginary value of our complex number. Member function (getter) to access the ...
Definition: complex_numbers.cpp:70
T endl(T... args)
STL class.
T imag(T... args)
diff --git a/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.map b/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.map index 330f117ac..55612c961 100644 --- a/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.map +++ b/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.md5 b/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.md5 index 41daaf95d..d75adaead 100644 --- a/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.md5 +++ b/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.md5 @@ -1 +1 @@ -ca37a02d9435e7233a8cbbacab7e0f93 \ No newline at end of file +943f96cea6cc9f8fa4d3293fd09ff5e5 \ No newline at end of file diff --git a/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.svg b/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.svg index 5d33f556a..038a08e20 100644 --- a/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.svg +++ b/d5/d67/complex__numbers_8cpp_a5a73e9d4e68af8cedb95bd0864054b89_cgraph.svg @@ -12,7 +12,7 @@ Node1 - + operator== @@ -21,7 +21,7 @@ Node2 - + Complex::imag @@ -36,7 +36,7 @@ Node3 - + Complex::real diff --git a/d5/d67/complex__numbers_8cpp_a5d4d5b8250b50703de888514c8e7a7a0_cgraph.map b/d5/d67/complex__numbers_8cpp_a5d4d5b8250b50703de888514c8e7a7a0_cgraph.map deleted file mode 100644 index 3281b50b9..000000000 --- a/d5/d67/complex__numbers_8cpp_a5d4d5b8250b50703de888514c8e7a7a0_cgraph.map +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/d5/d67/complex__numbers_8cpp_a5d4d5b8250b50703de888514c8e7a7a0_cgraph.md5 b/d5/d67/complex__numbers_8cpp_a5d4d5b8250b50703de888514c8e7a7a0_cgraph.md5 deleted file mode 100644 index 259e4737b..000000000 --- a/d5/d67/complex__numbers_8cpp_a5d4d5b8250b50703de888514c8e7a7a0_cgraph.md5 +++ /dev/null @@ -1 +0,0 @@ -5416f829a3f79a959e08abba9eb54d7a \ No newline at end of file diff --git a/d5/d67/complex__numbers_8cpp_a5d4d5b8250b50703de888514c8e7a7a0_cgraph.svg b/d5/d67/complex__numbers_8cpp_a5d4d5b8250b50703de888514c8e7a7a0_cgraph.svg deleted file mode 100644 index b249989c9..000000000 --- a/d5/d67/complex__numbers_8cpp_a5d4d5b8250b50703de888514c8e7a7a0_cgraph.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - -get_rand - - - -Node1 - - -get_rand - - - - - -Node2 - - -std::rand - - - - - -Node1->Node2 - - - - - diff --git a/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map b/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map index 2604b5f29..75edd0e8d 100644 --- a/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map +++ b/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map @@ -1,11 +1,11 @@ - + - + - + diff --git a/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 b/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 index a26b66d71..4eb8eb443 100644 --- a/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 +++ b/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 @@ -1 +1 @@ -e8b2c4319789f9b0d650e90f3c1aa2b5 \ No newline at end of file +8c47db7bb8bbea2fcd8aa2ea7e57de94 \ No newline at end of file diff --git a/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg b/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg index a59fe5eb7..59cd34018 100644 --- a/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg +++ b/d5/d67/complex__numbers_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg @@ -36,7 +36,7 @@ Node3 - + get_rand @@ -66,7 +66,7 @@ Node6 - + Complex::imag @@ -96,7 +96,7 @@ Node8 - + Complex::real diff --git a/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map index 226d7b71d..b61a5d7c6 100644 --- a/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map +++ b/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -2,11 +2,11 @@ - + - + - + diff --git a/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 index 7acb71e41..a817362e6 100644 --- a/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 +++ b/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -1 +1 @@ -67dfd20e7e976685f91d2ead82fc76b7 \ No newline at end of file +0b021bf7f8ece61887521f2fb13798ee \ No newline at end of file diff --git a/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index d9a07bee7..df0b31a50 100644 --- a/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/d5/d67/complex__numbers_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -51,7 +51,7 @@ Node4 - + get_rand @@ -81,7 +81,7 @@ Node7 - + Complex::imag @@ -111,7 +111,7 @@ Node9 - + Complex::real diff --git a/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.map b/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.map index aff3ff935..5b1dc369d 100644 --- a/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.map +++ b/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.md5 b/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.md5 index 31a76d847..91a83b306 100644 --- a/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.md5 +++ b/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.md5 @@ -1 +1 @@ -07b4cfe1294654f20f1e00a0eda9815a \ No newline at end of file +7c9bd1270f4d5ddff8ad3f6d9b0a1082 \ No newline at end of file diff --git a/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.svg b/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.svg index 9e2825050..51a9b69be 100644 --- a/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.svg +++ b/d5/d67/complex__numbers_8cpp_af738b2a6921f0a6868bb7c5b4c0d18e0_cgraph.svg @@ -12,7 +12,7 @@ Node1 - + operator<< @@ -21,7 +21,7 @@ Node2 - + Complex::imag @@ -36,7 +36,7 @@ Node3 - + Complex::real diff --git a/da/d5a/class_complex.html b/da/d5a/class_complex.html index e3095623b..483820728 100644 --- a/da/d5a/class_complex.html +++ b/da/d5a/class_complex.html @@ -98,32 +98,50 @@ $(document).ready(function(){initNavTree('da/d5a/class_complex.html','../../');
Complex Class Reference
+ +

Class Complex to represent complex numbers as a field. + More...

+ + - + + - + + + + + + + + + - + +

Public Member Functions

 Complex (double x=0.f, double y=0.f, bool is_polar=false)
 Complex Constructor which initialises our complex number. More...
 
 Complex (const Complex &other)
 Copy Constructor. More...
 
double real () const
+double real () const
 Member function to get real value of our complex number. Member function (getter) to access the class' re value.
 
double imag () const
+double imag () const
 Member function to get imaginary value of our complex number. Member function (getter) to access the class' im value.
 
double abs () const
 Member function to give the modulus of our complex number. Member function to which gives the absolute value (modulus) of our complex number. More...
 
double arg () const
 Member function to give the argument of our complex number. More...
 
Complex operator+ (const Complex &other)
 Operator overload of '+' on Complex class. Operator overload to be able to add two complex numbers. More...
 
Complex operator- (const Complex &other)
 Operator overload of '-' on Complex class. Operator overload to be able to subtract two complex numbers. More...
 
Complex operator* (const Complex &other)
 Operator overload of '*' on Complex class. Operator overload to be able to multiple two complex numbers. More...
 
Complex operator~ () const
 Operator overload of '~' on Complex class. Operator overload of the BITWISE NOT which gives us the conjugate of our complex number. NOTE: This is overloading the BITWISE operator but its not a BITWISE operation in this definition. More...
 
Complex operator/ (const Complex &other)
 Operator overload of '/' on Complex class. Operator overload to be able to divide two complex numbers. This function would throw an exception if the other number is zero. More...
 
const Complexoperator= (const Complex &other)
+const Complexoperator= (const Complex &other)
 Operator overload of '=' on Complex class. Operator overload to be able to copy RHS instance of Complex to LHS instance of Complex.
 

@@ -136,7 +154,7 @@ double 

im
 

Detailed Description

-

Class Complex to represent complex numbers as a field.

+

Class Complex to represent complex numbers as a field.

Constructor & Destructor Documentation

◆ Complex() [1/2]

@@ -177,7 +195,9 @@ double im
-

Complex Constructor which initialises the complex number which takes two arguments.

Parameters
+ +

Complex Constructor which initialises our complex number.

+

Complex Constructor which initialises the complex number which takes three arguments.

Parameters
@@ -185,16 +205,16 @@ double 
xIf the third parameter is 'true' then this x is the absolute value of the complex number, if the third parameter is 'false' then this x is the real value of the complex number (optional).
yIf the third parameter is 'true' then this y is the argument of the complex number, if the third parameter is 'false' then this y is the imaginary value of the complex number (optional).
im
-
40  {
-
41  if (!is_polar) {
-
42  re = x;
-
43  im = y;
-
44  return;
-
45  }
-
46 
-
47  re = x * std::cos(y);
-
48  im = x * std::sin(y);
-
49  }
+
43  {
+
44  if (!is_polar) {
+
45  re = x;
+
46  im = y;
+
47  return;
+
48  }
+
49 
+
50  re = x * std::cos(y);
+
51  im = x * std::sin(y);
+
52  }
Here is the call graph for this function:
@@ -227,13 +247,15 @@ Here is the call graph for this function:
-

Copy Constructor

Parameters
+ +

Copy Constructor.

+
Parameters
otherThe other number to equate our number to.
-
55 : re(other.real()), im(other.imag()) {}
+
58 : re(other.real()), im(other.imag()) {}
@@ -260,10 +282,12 @@ Here is the call graph for this function:
-

Member function to which gives the absolute value (modulus) of our complex number

Returns
\( \sqrt{z \dot \bar{z}} \) where \( z \) is our complex number.
-
73  {
-
74  return std::sqrt(this->re * this->re + this->im * this->im);
-
75  }
+ +

Member function to give the modulus of our complex number. Member function to which gives the absolute value (modulus) of our complex number.

+
Returns
\( \sqrt{z \bar{z}} \) where \( z \) is our complex number.
+
79  {
+
80  return std::sqrt(this->re * this->re + this->im * this->im);
+
81  }
Here is the call graph for this function:
@@ -295,8 +319,10 @@ Here is the call graph for this function:
-

Member function which gives the argument of our complex number.

Returns
Argument of our Complex number in radians.
-
81 { return std::atan2(this->im, this->re); }
+ +

Member function to give the argument of our complex number.

+
Returns
Argument of our Complex number in radians.
+
87 { return std::atan2(this->im, this->re); }
Here is the call graph for this function:
@@ -304,33 +330,6 @@ Here is the call graph for this function:
-
- - -

◆ imag()

- -
-
- - - - - -
- - - - - - - -
double Complex::imag () const
-
-inline
-
-

Member function (getter) to access the class' im value.

-
65 { return this->im; }
-
@@ -356,18 +355,20 @@ Here is the call graph for this function:
-

Operator overload to be able to multiple two complex numbers.

Parameters
+ +

Operator overload of '*' on Complex class. Operator overload to be able to multiple two complex numbers.

+
Parameters
otherThe other number to multiply the current number to.
Returns
result current number times other number.
-
108  {
-
109  Complex result(this->re * other.re - this->im * other.im,
-
110  this->re * other.im + this->im * other.re);
-
111  return result;
-
112  }
+
117  {
+
118  Complex result(this->re * other.re - this->im * other.im,
+
119  this->re * other.im + this->im * other.re);
+
120  return result;
+
121  }
@@ -394,17 +395,19 @@ Here is the call graph for this function:
-

Operator overload to be able to add two complex numbers.

Parameters
+ +

Operator overload of '+' on Complex class. Operator overload to be able to add two complex numbers.

+
Parameters
otherThe other number that is added to the current number.
Returns
result current number plus other number
-
88  {
-
89  Complex result(this->re + other.re, this->im + other.im);
-
90  return result;
-
91  }
+
95  {
+
96  Complex result(this->re + other.re, this->im + other.im);
+
97  return result;
+
98  }
@@ -431,17 +434,19 @@ Here is the call graph for this function:
-

Operator overload to be able to subtract two complex numbers.

Parameters
+ +

Operator overload of '-' on Complex class. Operator overload to be able to subtract two complex numbers.

+
Parameters
otherThe other number being subtracted from the current number.
Returns
result current number subtract other number
-
98  {
-
99  Complex result(this->re - other.re, this->im - other.im);
-
100  return result;
-
101  }
+
106  {
+
107  Complex result(this->re - other.re, this->im - other.im);
+
108  return result;
+
109  }
@@ -468,25 +473,27 @@ Here is the call graph for this function:
-

Operator overload to be able to divide two complex numbers. This function would throw an exception if the other number is zero.

Parameters
+ +

Operator overload of '/' on Complex class. Operator overload to be able to divide two complex numbers. This function would throw an exception if the other number is zero.

+
Parameters
otherThe other number we divide our number by.
Returns
result Current number divided by other number.
-
131  {
-
132  Complex result = *this * ~other;
-
133  double denominator =
-
134  other.real() * other.real() + other.imag() * other.imag();
-
135  if (denominator != 0) {
-
136  result = Complex(result.real() / denominator,
-
137  result.imag() / denominator);
-
138  return result;
-
139  } else {
-
140  throw std::invalid_argument("Undefined Value");
-
141  }
-
142  }
+
142  {
+
143  Complex result = *this * ~other;
+
144  double denominator =
+
145  other.real() * other.real() + other.imag() * other.imag();
+
146  if (denominator != 0) {
+
147  result = Complex(result.real() / denominator,
+
148  result.imag() / denominator);
+
149  return result;
+
150  } else {
+
151  throw std::invalid_argument("Undefined Value");
+
152  }
+
153  }
Here is the call graph for this function:
@@ -494,44 +501,6 @@ Here is the call graph for this function:
- - - -

◆ operator=()

- -
-
- - - - - -
- - - - - - - - -
const Complex& Complex::operator= (const Complexother)
-
-inline
-
-

Operator overload to be able to copy RHS instance of Complex to LHS instance of Complex

-
148  {
-
149  this->re = other.real();
-
150  this->im = other.imag();
-
151  return *this;
-
152  }
-
-Here is the call graph for this function:
-
-
-
-
-
@@ -556,38 +525,13 @@ Here is the call graph for this function:
-

Operator overload of the BITWISE NOT which gives us the conjugate of our complex number. NOTE: This is overloading the BITWISE operator but its not a BITWISE operation in this definition.

Returns
result The conjugate of our complex number.
-
120  {
-
121  Complex result(this->re, -(this->im));
-
122  return result;
-
123  }
-
-
- - -

◆ real()

-
-
- - - - - -
- - - - - - - -
double Complex::real () const
-
-inline
-
-

Member function (getter) to access the class' re value.

-
60 { return this->re; }
+

Operator overload of '~' on Complex class. Operator overload of the BITWISE NOT which gives us the conjugate of our complex number. NOTE: This is overloading the BITWISE operator but its not a BITWISE operation in this definition.

+
Returns
result The conjugate of our complex number.
+
130  {
+
131  Complex result(this->re, -(this->im));
+
132  return result;
+
133  }
@@ -596,15 +540,15 @@ Here is the call graph for this function:
-
Definition: complex_numbers.cpp:19
+
Class Complex to represent complex numbers as a field.
Definition: complex_numbers.cpp:20
T atan2(T... args)
T cos(T... args)
-
Complex(double x=0.f, double y=0.f, bool is_polar=false)
Definition: complex_numbers.cpp:40
+
Complex(double x=0.f, double y=0.f, bool is_polar=false)
Complex Constructor which initialises our complex number.
Definition: complex_numbers.cpp:43
T sqrt(T... args)
-
double real() const
Definition: complex_numbers.cpp:60
+
double real() const
Member function to get real value of our complex number. Member function (getter) to access the class...
Definition: complex_numbers.cpp:64
T sin(T... args)
-
double imag() const
Definition: complex_numbers.cpp:65
+
double imag() const
Member function to get imaginary value of our complex number. Member function (getter) to access the ...
Definition: complex_numbers.cpp:70