2021-01-29 12:31:58 +01:00
|
|
|
|
|
|
|
[![Arduino CI](https://github.com/RobTillaart/Complex/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
2021-09-14 11:58:53 +02: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)
|
2023-10-18 17:17:06 +02:00
|
|
|
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/Complex.svg)](https://github.com/RobTillaart/Complex/issues)
|
|
|
|
|
2021-01-29 12:31:58 +01: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)
|
2023-10-18 17:17:06 +02:00
|
|
|
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/Complex.svg)](https://registry.platformio.org/libraries/robtillaart/Complex)
|
2021-01-29 12:31:58 +01:00
|
|
|
|
2021-09-14 11:58:53 +02:00
|
|
|
|
2020-11-27 11:10:47 +01:00
|
|
|
# Complex
|
|
|
|
|
2021-09-14 11:58:53 +02:00
|
|
|
Arduino library for Complex mathematical operations.
|
|
|
|
|
2020-11-27 11:10:47 +01:00
|
|
|
|
|
|
|
## Description
|
|
|
|
|
2021-09-14 11:58:53 +02: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 11:10:47 +01:00
|
|
|
|
2021-01-29 12:31:58 +01:00
|
|
|
|
|
|
|
## Interface
|
2020-11-27 11:10:47 +01:00
|
|
|
|
2023-10-18 17:17:06 +02:00
|
|
|
```cpp
|
|
|
|
#include "Complex.h"
|
|
|
|
```
|
|
|
|
|
2021-09-14 11:58:53 +02: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 11:10:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
## Note
|
2021-01-29 12:31:58 +01:00
|
|
|
|
2021-09-14 11:58:53 +02: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 11:10:47 +01:00
|
|
|
|
2021-01-29 12:31:58 +01:00
|
|
|
#### Known problem
|
|
|
|
|
2020-11-27 11:10:47 +01: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 13:19:48 +01:00
|
|
|
Also Raspberry Pico - https://github.com/RobTillaart/Complex/issues/6
|
2020-11-27 11:10:47 +01: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 11:58:53 +02:00
|
|
|
|
|
|
|
#### Solution
|
|
|
|
|
|
|
|
- Make a copy of the Complex Library and rename the folder to CComplex
|
2020-11-27 11:10:47 +01:00
|
|
|
- Rename Complex.h to CComplex.h
|
2021-09-14 11:58:53 +02:00
|
|
|
- Rename Complex.cpp to CComplex.cpp
|
2020-11-27 11:10:47 +01:00
|
|
|
- change one line in CComplex.cpp to include CComplex.h
|
2021-09-14 11:58:53 +02:00
|
|
|
- note your sketches need to include CComplex.h too.
|
|
|
|
|
|
|
|
|
|
|
|
## Future
|
|
|
|
|
2023-10-18 17:17:06 +02:00
|
|
|
#### Must
|
|
|
|
|
|
|
|
- improve documentation
|
|
|
|
|
|
|
|
#### Should
|
|
|
|
|
|
|
|
#### Could
|
|
|
|
|
2021-09-14 11:58:53 +02:00
|
|
|
- create a (8 byte) double based variant for high precision e.g. Complex8()
|
2023-10-18 17:17:06 +02:00
|
|
|
- Note that some platforms map double to float
|
|
|
|
- others support float in hardware etc.
|
|
|
|
- so expect a big difference in both memory and performance.
|
|
|
|
|
|
|
|
#### Wont
|
|
|
|
|
2021-09-14 11:58:53 +02:00
|
|
|
- create the constant **i** ??
|
2023-10-18 17:17:06 +02:00
|
|
|
- => expect conflicts with int i...
|
|
|
|
|
|
|
|
|
|
|
|
## Support
|
|
|
|
|
|
|
|
If you appreciate my libraries, you can support the development and maintenance.
|
|
|
|
Improve the quality of the libraries by providing issues and Pull Requests, or
|
|
|
|
donate through PayPal or GitHub sponsors.
|
|
|
|
|
|
|
|
Thank you,
|
2021-09-14 11:58:53 +02:00
|
|
|
|
2020-11-27 11:10:47 +01:00
|
|
|
|