From 1ca93bdfa0f38d90d0d3f779876c0986cfa486ca Mon Sep 17 00:00:00 2001 From: rob tillaart Date: Sun, 30 Oct 2022 11:11:07 +0100 Subject: [PATCH] 0.3.2 Complex --- libraries/Complex/.arduino-ci.yml | 19 ++++++- libraries/Complex/CHANGELOG.md | 65 ++++++++++++++++++++++++ libraries/Complex/README.md | 1 - libraries/Complex/complex.cpp | 36 ++++--------- libraries/Complex/complex.h | 7 ++- libraries/Complex/library.json | 2 +- libraries/Complex/library.properties | 2 +- libraries/Complex/test/unit_test_001.cpp | 13 +++-- 8 files changed, 105 insertions(+), 40 deletions(-) create mode 100644 libraries/Complex/CHANGELOG.md diff --git a/libraries/Complex/.arduino-ci.yml b/libraries/Complex/.arduino-ci.yml index e7cb4633..10c0e10b 100644 --- a/libraries/Complex/.arduino-ci.yml +++ b/libraries/Complex/.arduino-ci.yml @@ -1,3 +1,18 @@ +platforms: + rpipico: + board: rp2040:rp2040:rpipico + package: rp2040:rp2040 + gcc: + features: + defines: + - ARDUINO_ARCH_RP2040 + warnings: + flags: + +packages: + rp2040:rp2040: + url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json + compile: # Choosing to run compilation tests on 2 different Arduino platforms platforms: @@ -8,4 +23,6 @@ compile: - m4 - esp32 # - esp8266 - # - mega2560 \ No newline at end of file + # - mega2560 + - rpipico + diff --git a/libraries/Complex/CHANGELOG.md b/libraries/Complex/CHANGELOG.md new file mode 100644 index 00000000..7cf12191 --- /dev/null +++ b/libraries/Complex/CHANGELOG.md @@ -0,0 +1,65 @@ +# Change Log Complex + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + +## [0.3.2] - 2022-10-29 +- add changelog.md +- add rp2040 to build-CI +- minor edit unit test + + +## [0.3.1] - 2021-12-14 +- update library.json +- update license +- minor edits + +## [0.3.0] - 2021-11-15 +- fix #7 adding const to operators + +---- + +## [0.2.4] - 2021-10-19 +- update build-CI. + +## [0.2.3] - 2021-09-14 +- fix build-CI +- update readme.md + +## [0.2.2] - 2020-12-16 +- add arduino-ci + unit test (starter) +- setReal(), setImag() + +## [0.2.1] - 2020-06-05 +- fix library.json + +## [0.2.0] - 2020-03-29 +- #pragma once, +- create own repo + +---- + +## [0.1.12] - 2018-04-02 +- fix issue #33 double -> float + +## [0.1.11] - 2018-01-29 +- fix sin and cos formula - issue #91 + +## [0.1.10] - 2018-01-15 +- uppercase #define COMPLEX_H + +## [0.1.09] - 2016-10-15 +- added (0,0) constructor + +## [0.1.08] - 2015-06-03 +- refactor + +## [0.1.07] - 2015-06-03 +- refactor interfaces + +## [0.1.0] - 2013 +- initial version. + diff --git a/libraries/Complex/README.md b/libraries/Complex/README.md index cca074d6..d517ae11 100644 --- a/libraries/Complex/README.md +++ b/libraries/Complex/README.md @@ -47,7 +47,6 @@ Apparently the name "Complex" is already in use (reserved) by some non-AVR compi so it won't include the Complex.h file. Problem seen on Due and Teensy3.5 - #### Solution - Make a copy of the Complex Library and rename the folder to CComplex diff --git a/libraries/Complex/complex.cpp b/libraries/Complex/complex.cpp index 5b5e90b4..4229377b 100644 --- a/libraries/Complex/complex.cpp +++ b/libraries/Complex/complex.cpp @@ -1,32 +1,18 @@ // // FILE: Complex.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.3.1 +// VERSION: 0.3.2 // PURPOSE: Arduino library for Complex math // URL: https://github.com/RobTillaart/Complex // http://arduino.cc/playground/Main/ComplexMath // -// HISTORY -// 0.3.1 2021-12-14 update library.json, license, minor edits -// 0.3.0 2021-11-15 fix #7 adding const to operators -// 0.2.4 2021-10-19 update build-CI. -// 0.2.3 2021-09-14 fix build-CI + update readme -// 0.2.2 2020-12-16 add arduino-ci + unit test (starter) -// setReal, setImag -// 0.2.1 2020-06-05 fix library.json -// 0.2.0 2020-03-29 #pragma once, own repo -// 0.1.12 2018-04-02 - fix issue #33 double -> float -// 0.1.11 2018-01-29 - fix sin and cos formula - issue #91 -// 0.1.10 2018-01-15 - uppercase #define COMPLEX_H -// 0.1.09 2016-10-15 - added (0,0) constructor -// 0.1.08 2015-06-03 - refactor -// 0.1.07 2015-06-03 - refactor interfaces +// HISTORY: see changelog.md #include "Complex.h" -// PRINTING +// PRINTING size_t Complex::printTo(Print& p) const { size_t n = 0; @@ -54,7 +40,7 @@ Complex Complex::reciprocal() const } // -// EQUALITIES +// EQUALITIES // bool Complex::operator == (const Complex &c) const { @@ -69,7 +55,7 @@ bool Complex::operator != (const Complex &c) const // -// NEGATE +// NEGATE // Complex Complex::operator - () const { @@ -78,7 +64,7 @@ Complex Complex::operator - () const // -// BASIC MATH +// BASIC MATH // Complex Complex::operator + (const Complex &c) const { @@ -147,7 +133,7 @@ Complex& Complex::operator /= (const Complex &c) // -// POWER FUNCTIONS +// POWER FUNCTIONS // Complex Complex::c_sqr() const { @@ -205,7 +191,7 @@ Complex Complex::c_log10() const // -// GONIO I - SIN COS TAN +// GONIO I - SIN COS TAN // Complex Complex::c_sin() const { @@ -275,7 +261,7 @@ Complex Complex::c_atan() const // -// GONIO II - CSC SEC COT +// GONIO II - CSC SEC COT // Complex Complex::c_csc() const { @@ -314,7 +300,7 @@ Complex Complex::c_acot() const // -// GONIO HYPERBOLICUS I +// GONIO HYPERBOLICUS I // Complex Complex::c_sinh() const { @@ -371,7 +357,7 @@ Complex Complex::c_atanh() const // -// GONIO HYPERBOLICUS II +// GONIO HYPERBOLICUS II // Complex Complex::c_csch() const { diff --git a/libraries/Complex/complex.h b/libraries/Complex/complex.h index 2971c7d2..195600da 100644 --- a/libraries/Complex/complex.h +++ b/libraries/Complex/complex.h @@ -2,18 +2,17 @@ // // FILE: Complex.h // AUTHOR: Rob Tillaart -// VERSION: 0.3.1 +// VERSION: 0.3.2 // PURPOSE: Arduino library for Complex math // URL: https://github.com/RobTillaart/Complex // http://arduino.cc/playground/Main/ComplexMath -// #include "Arduino.h" #include "Printable.h" -#define COMPLEX_LIB_VERSION (F("0.3.1")) +#define COMPLEX_LIB_VERSION (F("0.3.2")) class Complex: public Printable @@ -36,7 +35,7 @@ public: void polar(const float modulus, const float phase); float phase() const { return atan2(im, re); }; float modulus() const { return hypot(re, im); }; - // conjugate is the number mirrored in x-axis + // conjugate is the number mirrored in x-axis Complex conjugate() const { return Complex(re, -im); }; Complex reciprocal() const; diff --git a/libraries/Complex/library.json b/libraries/Complex/library.json index c423fea6..aac3ebda 100644 --- a/libraries/Complex/library.json +++ b/libraries/Complex/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/Complex.git" }, - "version": "0.3.1", + "version": "0.3.2", "license": "MIT", "frameworks": "arduino", "platforms": "*", diff --git a/libraries/Complex/library.properties b/libraries/Complex/library.properties index ca140dc2..3432609c 100644 --- a/libraries/Complex/library.properties +++ b/libraries/Complex/library.properties @@ -1,5 +1,5 @@ name=Complex -version=0.3.1 +version=0.3.2 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for Complex math. diff --git a/libraries/Complex/test/unit_test_001.cpp b/libraries/Complex/test/unit_test_001.cpp index fe4a658f..e427c2a0 100644 --- a/libraries/Complex/test/unit_test_001.cpp +++ b/libraries/Complex/test/unit_test_001.cpp @@ -30,6 +30,7 @@ unittest_setup() { + fprintf(stderr, "COMPLEX_LIB_VERSION: %s\n", (char *) COMPLEX_LIB_VERSION); } @@ -40,8 +41,6 @@ unittest_teardown() unittest(test_constructor) { - fprintf(stderr, "COMPLEX_LIB_VERSION: %s\n", (char *) COMPLEX_LIB_VERSION); - Complex c1(10.0, -2.0); Complex c2(3, 0); Complex c3(-10, 4); @@ -58,7 +57,7 @@ unittest(test_constructor) assertEqual(-5.0, c4.imag()); assertEqual(0.0, c5.real()); assertEqual(0.0, c5.imag()); - + // one is a default available var. assertEqual(1.0, one.real()); assertEqual(0.0, one.imag()); @@ -74,7 +73,7 @@ unittest(test_basic_math) { Complex a(10.0, -2.5); Complex b(3, 1); - + Complex c1 = a + b; assertEqual(13, c1.real()); assertEqual(-1.5, c1.imag()); @@ -90,7 +89,7 @@ unittest(test_basic_math) Complex c4 = a / b; assertEqual(2.75, c4.real()); assertEqual(-1.75, c4.imag()); - + Complex c5 = -a; assertEqual(-10, c5.real()); assertEqual(2.5, c5.imag()); @@ -133,7 +132,7 @@ unittest(test_basic_functions) float ph = a.phase(); assertEqualFloat(-0.244979, ph, 0.0001); - + float mod = a.modulus(); assertEqualFloat(10.3078, mod, 0.0001); @@ -144,7 +143,7 @@ unittest(test_basic_functions) Complex reci = a.reciprocal(); assertEqualFloat(0.0941176, reci.real(), 0.0001); assertEqualFloat(0.0235294, reci.imag(), 0.0001); - + reci *= a; assertEqualFloat(1.0, reci.real(), 0.0001); assertEqualFloat(0, reci.imag(), 0.0001);