2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
[![Arduino CI](https://github.com/RobTillaart/Complex/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
2021-09-14 05:58:53 -04:00
|
|
|
[![Arduino-lint](https://github.com/RobTillaart/Complex/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/Complex/actions/workflows/arduino-lint.yml)
|
|
|
|
[![JSON check](https://github.com/RobTillaart/Complex/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/Complex/actions/workflows/jsoncheck.yml)
|
2021-01-29 06:31:58 -05:00
|
|
|
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/Complex/blob/master/LICENSE)
|
|
|
|
[![GitHub release](https://img.shields.io/github/release/RobTillaart/Complex.svg?maxAge=3600)](https://github.com/RobTillaart/Complex/releases)
|
|
|
|
|
2021-09-14 05:58:53 -04:00
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
# Complex
|
|
|
|
|
2021-09-14 05:58:53 -04:00
|
|
|
Arduino library for Complex mathematical operations.
|
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
|
|
|
|
## Description
|
|
|
|
|
2021-09-14 05:58:53 -04:00
|
|
|
This library defines the complex data type and all the common mathematical functions for it.
|
|
|
|
|
|
|
|
These functions include basic = "+ - \* /" and also power and goniometric functions.
|
|
|
|
|
|
|
|
The library implements the **Printable** interface so one can directly print the complex values
|
|
|
|
in any stream e.g. Serial.
|
2020-11-27 05:10:47 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
## Interface
|
2020-11-27 05:10:47 -05:00
|
|
|
|
2021-09-14 05:58:53 -04:00
|
|
|
See Complex.h for a full list of functions implemented.
|
|
|
|
|
|
|
|
The library uses **float** for the real and imaginary part so precision is limited.
|
|
|
|
Reasons are memory and performance, see also Future section below.
|
|
|
|
|
|
|
|
The library implements the constant **one** as this value is often used in the code.
|
2020-11-27 05:10:47 -05:00
|
|
|
|
|
|
|
|
|
|
|
## Note
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2021-09-14 05:58:53 -04:00
|
|
|
The library has a big footprint so it fills up the memory of an UNO quite fast,
|
|
|
|
especially if all functionality is used.
|
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
#### Known problem
|
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
Issue found in version 0.1.9 - https://github.com/RobTillaart/Arduino/issues/90
|
|
|
|
Class does not compile for DUE and TEENSY
|
2021-11-08 07:19:48 -05:00
|
|
|
Also Raspberry Pico - https://github.com/RobTillaart/Complex/issues/6
|
2020-11-27 05:10:47 -05:00
|
|
|
|
|
|
|
Apparently the name "Complex" is already in use (reserved) by some non-AVR compilers
|
|
|
|
so it won't include the Complex.h file. Problem seen on Due and Teensy3.5
|
|
|
|
|
2021-09-14 05:58:53 -04:00
|
|
|
|
|
|
|
#### Solution
|
|
|
|
|
|
|
|
- Make a copy of the Complex Library and rename the folder to CComplex
|
2020-11-27 05:10:47 -05:00
|
|
|
- Rename Complex.h to CComplex.h
|
2021-09-14 05:58:53 -04:00
|
|
|
- Rename Complex.cpp to CComplex.cpp
|
2020-11-27 05:10:47 -05:00
|
|
|
- change one line in CComplex.cpp to include CComplex.h
|
2021-09-14 05:58:53 -04:00
|
|
|
- note your sketches need to include CComplex.h too.
|
|
|
|
|
|
|
|
|
|
|
|
## Future
|
|
|
|
|
|
|
|
- create a (8 byte) double based variant for high precision e.g. Complex8()
|
|
|
|
Note that some platforms map double to float, others support float in hardware etc
|
|
|
|
so there is a big difference expected in both memory and performance
|
|
|
|
- create the constant **i** ??
|
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
|