14 char *pad_spaces(
char *buf, uint8_t count) {
19 void format_double(
double d,
char *buffer, uint8_t width, uint8_t precision) {
20 int pad = width - 6 - precision;
21 pad = pad > 0 ? pad : 0;
22 buffer = pad_spaces(buffer, pad);
23 dtostre(d, buffer, precision - 1, DTOSTR_ALWAYS_SIGN);
32 void format_double(
double d,
char *buf, uint8_t width, uint8_t precision) {
33 int len = snprintf(buf, width + 1,
"%*.*e", (
int)width, (
int)precision, d);
43 #ifndef NO_ARDUINO_PRINT_SUPPORT
48 void Matrix::print(Print &print, uint8_t precision, uint8_t width)
const {
49 precision = precision > 0 ? precision : 6;
50 width = width > 0 ? width : precision + 9;
51 char *buffer =
new char[width + 1];
52 for (
size_t r = 0; r <
rows(); ++r) {
53 for (
size_t c = 0; c <
cols(); ++c) {
Preprocessor logic for configuring the library to make it compatible with the Arduino environment.
std::ostream & operator<<(std::ostream &os, const HouseholderQR &qr)
Print the Q and R matrices of a HouseholderQR object.
size_t rows() const
Get the number of rows of the matrix.
size_t cols() const
Get the number of columns of the matrix.
void print(std::ostream &os, uint8_t precision=0, uint8_t width=0) const
Print a matrix.
void format_double(double d, char *buf, uint8_t width, uint8_t precision)