diff --git a/.claude/agents/algo-implementer.md b/.claude/agents/algo-implementer.md index 959dcf76..ffec7786 100644 --- a/.claude/agents/algo-implementer.md +++ b/.claude/agents/algo-implementer.md @@ -28,5 +28,5 @@ from its `roadmap///` spec into the codebase, following both exact - **No comments** (except license/`NOLINT`). Allman braces, brace-init. - **Tests**: `TEST_F` on `float`, `StrictMock` only, anonymous-namespace fixture; implement EXACTLY the spec's cases — no redundant or extra tests. -- **Embedded**: scoped `#pragma GCC push_options`/`optimize`/`pop_options` + `OPTIMIZE_FOR_SPEED` on hot paths. +- **Embedded**: no `#pragma GCC optimize`/`optimize` attribute; `OPTIMIZE_FOR_SPEED` (forced inlining) on hot paths. - **Terse**: no preamble/postamble, no plan restatement, no narration; don't re-read files; batch reads. diff --git a/.claude/agents/executor.md b/.claude/agents/executor.md index d12784ca..cea92319 100644 --- a/.claude/agents/executor.md +++ b/.claude/agents/executor.md @@ -1,6 +1,6 @@ --- name: executor -description: Implement code changes in numerical-toolbox — float-only templates, no heap, embedded pragmas, TEST_F on float, CMake wiring, docs. Needs a clear task or plan. +description: Implement code changes in numerical-toolbox — float-only templates, no heap, forced inlining on hot paths, TEST_F on float, CMake wiring, docs. Needs a clear task or plan. model: claude-sonnet-4-6 tools: [Read, Write, Edit, Bash, TodoWrite] --- diff --git a/.claude/agents/planner.md b/.claude/agents/planner.md index 30fd10e0..3f98085f 100644 --- a/.claude/agents/planner.md +++ b/.claude/agents/planner.md @@ -25,7 +25,7 @@ Canonical rules: `AGENTS.md`. Produce plans only — no code edits. - [ ] No heap; no recursion; tests too - [ ] `template` + `static_assert(std::is_floating_point_v)`; `float` only - [ ] `TEST_F` on `float` — no `TYPED_TEST`; `StrictMock` only; never plain `TEST()` - - [ ] scoped `#pragma GCC push_options`/`optimize`/`pop_options` + `OPTIMIZE_FOR_SPEED` on hot paths + - [ ] no `#pragma GCC optimize`/`optimize` attribute; `OPTIMIZE_FOR_SPEED` on hot paths - [ ] `doc/` update planned **Terse**: no preamble/postamble, no plan restatement; don't re-read files; batch reads. diff --git a/.claude/agents/reviewer.md b/.claude/agents/reviewer.md index 7a64c59f..8179420e 100644 --- a/.claude/agents/reviewer.md +++ b/.claude/agents/reviewer.md @@ -1,6 +1,6 @@ --- name: reviewer -description: Review code changes against numerical-toolbox standards — no heap, float-only templates, embedded pragmas, TEST_F on float, SOLID, docs. Does NOT modify files. +description: Review code changes against numerical-toolbox standards — no heap, float-only templates, forced inlining on hot paths, TEST_F on float, SOLID, docs. Does NOT modify files. model: claude-sonnet-4-6 tools: [Read, Bash] --- @@ -35,7 +35,7 @@ End with totals + verdict: APPROVE / REQUEST CHANGES. - [ ] `extern template` guarded by `#ifdef NUMERICAL_TOOLBOX_COVERAGE_BUILD`. **Embedded optimizations (WARNING)** -- [ ] `#pragma GCC push_options` + `optimize("O3","fast-math")` after `#pragma once`, matching `pop_options` at end of algorithm headers (no TU leak; none in test `.cpp`). +- [ ] No `#pragma GCC optimize` and no `optimize` attribute anywhere (they stop GCC inlining across the boundary). - [ ] `OPTIMIZE_FOR_SPEED` on `Filter/Compute/Update/Solve/Step`. **Namespaces (WARNING)** diff --git a/.github/agents/algo-implementer.agent.md b/.github/agents/algo-implementer.agent.md index 52855b94..51c68874 100644 --- a/.github/agents/algo-implementer.agent.md +++ b/.github/agents/algo-implementer.agent.md @@ -31,5 +31,5 @@ Authoritative rules: `AGENTS.md`. Recipe: `roadmap/DEPLOYMENT.md`. Follow both e - **No comments** (except license/`NOLINT`). Allman braces, brace-init. - **Tests**: `TEST_F` on `float`, `StrictMock` only, anonymous-namespace fixture; implement EXACTLY the spec's cases — no redundant or extra tests. -- **Embedded**: scoped `#pragma GCC push_options`/`optimize`/`pop_options` + `OPTIMIZE_FOR_SPEED` on hot paths. +- **Embedded**: no `#pragma GCC optimize`/`optimize` attribute; `OPTIMIZE_FOR_SPEED` (forced inlining) on hot paths. - **Terse**: no preamble/postamble, no plan restatement, no narration; don't re-read files; batch reads. diff --git a/.github/agents/executor.agent.md b/.github/agents/executor.agent.md index 3f16e93d..07f50f7b 100644 --- a/.github/agents/executor.agent.md +++ b/.github/agents/executor.agent.md @@ -1,5 +1,5 @@ --- -description: "Implement code changes in numerical-toolbox — float-only templates, no heap, embedded pragmas, TEST_F on float, CMake wiring, docs. Needs a clear task or plan." +description: "Implement code changes in numerical-toolbox — float-only templates, no heap, forced inlining on hot paths, TEST_F on float, CMake wiring, docs. Needs a clear task or plan." tools: [read, edit, search, execute, todo] model: "Claude Sonnet 4.6" handoffs: diff --git a/.github/agents/planner.agent.md b/.github/agents/planner.agent.md index 85c5c7ca..e6746308 100644 --- a/.github/agents/planner.agent.md +++ b/.github/agents/planner.agent.md @@ -28,7 +28,7 @@ Canonical rules: `AGENTS.md`. Produce plans only — no code edits. - [ ] No heap; no recursion; tests too - [ ] `template` + `static_assert(std::is_floating_point_v)`; `float` only - [ ] `TEST_F` on `float` — no `TYPED_TEST`; `StrictMock` only; never plain `TEST()` - - [ ] scoped `#pragma GCC push_options`/`optimize`/`pop_options` + `OPTIMIZE_FOR_SPEED` on hot paths + - [ ] no `#pragma GCC optimize`/`optimize` attribute; `OPTIMIZE_FOR_SPEED` on hot paths - [ ] `doc/` update planned **Terse**: no preamble/postamble, no plan restatement; don't re-read files; batch reads. diff --git a/.github/agents/reviewer.agent.md b/.github/agents/reviewer.agent.md index 64b6be26..5b7ac011 100644 --- a/.github/agents/reviewer.agent.md +++ b/.github/agents/reviewer.agent.md @@ -1,5 +1,5 @@ --- -description: "Review code changes against numerical-toolbox standards: no heap, float-only templates, embedded pragmas, TEST_F on float, SOLID, docs. Does NOT modify files." +description: "Review code changes against numerical-toolbox standards: no heap, float-only templates, forced inlining on hot paths, TEST_F on float, SOLID, docs. Does NOT modify files." tools: [read, search] model: "claude-sonnet-4-6" handoffs: @@ -41,7 +41,7 @@ End with totals + verdict: APPROVE / REQUEST CHANGES. - [ ] `extern template` guarded by `#ifdef NUMERICAL_TOOLBOX_COVERAGE_BUILD`. **Embedded optimizations (WARNING)** -- [ ] `#pragma GCC push_options` + `optimize("O3","fast-math")` after `#pragma once`, matching `pop_options` at end of algorithm headers (no TU leak; none in test `.cpp`). +- [ ] No `#pragma GCC optimize` and no `optimize` attribute anywhere (they stop GCC inlining across the boundary). - [ ] `OPTIMIZE_FOR_SPEED` on `Filter/Compute/Update/Solve/Step`. **Namespaces (WARNING)** diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index fbe7cdfb..f2a71873 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -6,7 +6,7 @@ Code-file specifics: `.github/instructions/` (applyTo-scoped). Deployment recipe Essentials (full detail in AGENTS.md): - **No heap** — bounded containers / `std::array` / `std::optional`; no recursion; tests too. - **Float-only** — generic `template` + `static_assert(std::is_floating_point_v)`; instantiate/test `float`; no Q15/Q31. -- **Embedded** — scoped `#pragma GCC push_options` / `optimize("O3","fast-math")` … `pop_options` (never leak to the TU) + `OPTIMIZE_FOR_SPEED` on hot paths. +- **Embedded** — no `#pragma GCC optimize` / `optimize` attribute (they block inlining); the consumer sets optimization flags per TU; `OPTIMIZE_FOR_SPEED` (forced inlining) on hot paths. - **No comments** (except license/NOLINT). Allman braces, brace-init, PascalCase/camelCase. - **Tests** — `TEST_F` on `float`, `StrictMock` only, never plain `TEST()`, no redundant cases. - **No exceptions** — `std::optional`/status enums; interfaces `virtual ~I() = default`. diff --git a/.github/instructions/numerical-cpp.instructions.md b/.github/instructions/numerical-cpp.instructions.md index 442cf557..7bd08028 100644 --- a/.github/instructions/numerical-cpp.instructions.md +++ b/.github/instructions/numerical-cpp.instructions.md @@ -1,5 +1,5 @@ --- -description: "Numerical C++ rules (float-only): no heap, bounded containers, generic template instantiated for float, embedded pragmas, Allman/brace-init, SOLID, const-correct. Canonical: AGENTS.md." +description: "Numerical C++ rules (float-only): no heap, bounded containers, generic template instantiated for float, forced inlining on hot paths, Allman/brace-init, SOLID, const-correct. Canonical: AGENTS.md." applyTo: "**/*.{hpp,cpp,h}" --- @@ -41,26 +41,11 @@ To replace a function with a platform-specific implementation, define the corres ## Embedded Optimizations -Every algorithm header MUST bracket its body with a scoped pragma, so the options never leak into the including translation unit: +Never use `#pragma GCC optimize` or the `optimize` attribute. GCC does not inline a callee whose optimization options differ from its caller's, so options set per header or per function turn every small helper on a hot path into an out-of-line call. Optimization level and floating-point flags are the consumer's, applied to whole translation units (embedded: `-O2`/`-O3` with `-ffast-math -fno-finite-math-only`). -```cpp -#pragma once +Apply `OPTIMIZE_FOR_SPEED` (from `numerical/math/CompilerOptimizations.hpp`) on hot-path methods: `Compute()`, `Filter()`, `Calculate()`, `Solve()`, `Update()`, `Step()`. It forces inlining when `NumericalToolbox_ENABLE_OPTIMIZATIONS` is defined and expands to nothing otherwise. -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - -// ... includes and header body ... - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif -``` - -The `pop_options` block is the last thing in the header. Never use the pragma in test `.cpp` files. - -Apply `OPTIMIZE_FOR_SPEED` (from `numerical/math/CompilerOptimizations.hpp`) on hot-path methods: `Compute()`, `Filter()`, `Calculate()`, `Solve()`, `Update()`, `Step()`. +Use `math::IsFinite` for finiteness checks: a consumer may still build with `-ffinite-math-only`. ## Naming diff --git a/AGENTS.md b/AGENTS.md index d094f987..0a13925e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,29 +22,18 @@ resource-constrained embedded systems. Real-time, deterministic, no heap. `infra::BoundedDeque::WithMaxSize`, `infra::BoundedList::WithMaxSize`, `std::array`, `std::optional`. Stack/static only. No recursion. **Tests too.** -## Embedded optimizations (algorithm headers) - -```cpp -#pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif -#include "numerical/math/CompilerOptimizations.hpp" - -// ... header body ... - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif -``` - -The `pop_options` block is the **last thing in the header**: the pragma must never leak into the -including translation unit (it would silently apply fast-math, e.g. folded NaN checks and -reassociation, to unrelated code). Use `math::IsFinite` for finiteness checks. Test `.cpp` files -never use the pragma. - -`OPTIMIZE_FOR_SPEED` on hot paths (`Filter/Compute/Update/Solve/Step`). Pure interfaces exempt. +## Embedded optimizations + +- **No `#pragma GCC optimize` and no `optimize` attribute**, in headers or sources. GCC does not + inline a callee whose optimization options differ from its caller's, so options set per header or + per function turn every small helper on a hot path (element access, accessors, `math::` wrappers) + into an out-of-line call. +- The optimization level and floating-point model belong to the consumer and apply to whole + translation units. For embedded targets: `-O2` or `-O3` with `-ffast-math -fno-finite-math-only`. +- `OPTIMIZE_FOR_SPEED` on hot paths (`Filter/Compute/Update/Solve/Step`). Pure interfaces exempt. + With `NumericalToolbox_ENABLE_OPTIMIZATIONS` it forces inlining (`always_inline`, `hot`, `inline`); + without it, it expands to nothing. +- Use `math::IsFinite` for finiteness checks: a consumer may still build with `-ffinite-math-only`. ## Style diff --git a/CLAUDE.md b/CLAUDE.md index 1e464645..994b533b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ Code-file specifics: `.github/instructions/`. Deployment recipe: `roadmap/DEPLOY Essentials (full detail in AGENTS.md): - **No heap** — bounded containers / `std::array` / `std::optional`; no recursion; tests too. - **Float-only** — generic `template` + `static_assert(std::is_floating_point_v)`; instantiate/test `float`; no Q15/Q31. -- **Embedded** — scoped `#pragma GCC push_options` / `optimize("O3","fast-math")` … `pop_options` (never leak to the TU) + `OPTIMIZE_FOR_SPEED` on hot paths. +- **Embedded** — no `#pragma GCC optimize` / `optimize` attribute (they block inlining); the consumer sets optimization flags per TU; `OPTIMIZE_FOR_SPEED` (forced inlining) on hot paths. - **No comments** (except license/NOLINT). Allman braces, brace-init, PascalCase/camelCase. - **Tests** — `TEST_F` on `float`, `StrictMock` only, never plain `TEST()`, no redundant cases. - **No exceptions** — `std::optional`/status enums; interfaces `virtual ~I() = default`. diff --git a/ROADMAP.md b/ROADMAP.md index 69b4bd9b..9d25061e 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -3,7 +3,7 @@ Prioritized backlog of reusable numerical components for generic embedded applications, ordered **easiest → hardest to implement** within the constraints of this library (templated on `float` / `math::Q15` / `math::Q31`, no heap, bounded containers, -`#pragma GCC optimize` + `OPTIMIZE_FOR_SPEED` hot paths, typed tests, `doc/` page). +`OPTIMIZE_FOR_SPEED` hot paths, typed tests, `doc/` page). Difficulty legend: @@ -52,7 +52,7 @@ on bounded `math::Vector`/`math::Matrix` inputs; tests are `TEST_F` on `float`. Every new component should follow the established repository conventions: - [ ] Header-only template supporting `float` / `math::Q15` / `math::Q31` (or *float-first* where noted) -- [ ] Scoped `#pragma GCC push_options` / `optimize("O3", "fast-math")` after `#pragma once`, `pop_options` at end of file; `OPTIMIZE_FOR_SPEED` on hot paths +- [ ] No `#pragma GCC optimize` / `optimize` attribute; `OPTIMIZE_FOR_SPEED` on hot paths - [ ] No heap, no recursion, bounded containers (`infra::BoundedVector`, `std::array`) - [ ] `static_assert` on supported types and dimensions - [ ] Typed tests (`TYPED_TEST`) for multi-type components; `TEST_F` for single-type; `StrictMock` only diff --git a/cmake/QemuHelpers.cmake b/cmake/QemuHelpers.cmake index 84480bcb..23e679a2 100644 --- a/cmake/QemuHelpers.cmake +++ b/cmake/QemuHelpers.cmake @@ -11,4 +11,8 @@ function(numerical_link_qemu_runtime target) hal.qemu.cortex gmock_main ) + # newlib-nano's printf has no float conversions unless _printf_float is linked. Without them the + # vsnprintf behind std::ostream << float returns a bogus length, libstdc++ allocas that many bytes, + # and the first failure message that prints a float wraps the stack pointer and locks up the core. + target_link_options(${target} PRIVATE "LINKER:--undefined=_printf_float") endfunction() diff --git a/doc/analysis/DiscreteWaveletTransform.md b/doc/analysis/DiscreteWaveletTransform.md index 8e2f517e..b7e59a89 100644 --- a/doc/analysis/DiscreteWaveletTransform.md +++ b/doc/analysis/DiscreteWaveletTransform.md @@ -115,7 +115,7 @@ $$\hat{x} = [1.0,\; 2.0,\; 3.0,\; 4.0] \checkmark$$ - **Filter length vs. signal length.** At each level the signal halves; once it equals $P$ the periodic convolution wraps completely. Stop decomposition before the signal shorter than the filter length to avoid artefacts. -- **Fast-math reordering.** With `#pragma GCC optimize("fast-math")` floating-point associativity +- **Fast-math reordering.** With `-ffast-math` floating-point associativity relaxes; reconstruction residuals may reach $10^{-5}$ rather than $10^{-7}$ for 32-bit floats. ## Variants & Generalizations diff --git a/doc/filters/passive/BiquadCascade.md b/doc/filters/passive/BiquadCascade.md index 2920bae1..42745256 100644 --- a/doc/filters/passive/BiquadCascade.md +++ b/doc/filters/passive/BiquadCascade.md @@ -94,8 +94,8 @@ Input $[1, 0, 0, \ldots]$ → output $[1, 0, 0, \ldots]$ — identity passthroug $|z| = 1$. Finite-precision rounding can move a pole just outside, causing instability. Use $Q \leq 30$ in single precision; double precision or lattice realizations for higher $Q$. - **Denormal floats**: small state values approaching the denormal range stall the FPU pipeline - on many embedded cores. Enabling flush-to-zero (FTZ) or the fast-math pragma prevents this - at the cost of negligible numerical error. + on many embedded cores. Enabling flush-to-zero (FTZ) prevents this at the cost of negligible + numerical error. - **DC gain normalization**: the RBJ low-pass has unity DC gain by construction. Gain-staging between sections is not required; each section's output is well-scaled relative to its input. diff --git a/doc/math/MatrixNorms.md b/doc/math/MatrixNorms.md index 9df1653b..4756a025 100644 --- a/doc/math/MatrixNorms.md +++ b/doc/math/MatrixNorms.md @@ -59,7 +59,7 @@ Vector $\mathbf{v} = [3,\, 4]^\top$: $\|\mathbf{v}\|_2 = 5$, and $\hat{\mathbf{v **Zero vector normalisation** — dividing by $\|\mathbf{v}\|_2 = 0$ is undefined. The implementation returns an empty optional for near-zero norms. -**Fast-math semantics** — `#pragma GCC optimize("fast-math")` may reorder floating-point operations. The norms are sums of non-negative values, so reordering does not change the sign of the result, but catastrophic cancellation can still occur for near-zero off-diagonal entries. +**Fast-math semantics** — `-ffast-math` may reorder floating-point operations. The norms are sums of non-negative values, so reordering does not change the sign of the result, but catastrophic cancellation can still occur for near-zero off-diagonal entries. **Non-square matrices** — FrobeniusNorm, OneNorm, and InfinityNorm apply to any $m \times n$ matrix. diff --git a/doc/performance-optimization/README.md b/doc/performance-optimization/README.md index adc2ef85..31699fa3 100644 --- a/doc/performance-optimization/README.md +++ b/doc/performance-optimization/README.md @@ -44,19 +44,23 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") ### Fast-Math Considerations -```cpp -// Enables aggressive floating-point optimizations -// WARNING: May change numerical behavior slightly -#pragma GCC optimize("fast-math") +```cmake +# Aggressive floating-point optimizations for whole translation units, keeping NaN/Inf checks +add_compile_options(-ffast-math -fno-finite-math-only) ``` Effects of `-ffast-math`: -- Assumes no NaN or Infinity -- Allows reordering of operations +- No `errno` from math functions, so `sqrtf` becomes a single `vsqrt.f32` +- Allows reordering of operations and reciprocal multiplication instead of division - Enables FMA (Fused Multiply-Add) instructions +- `-ffinite-math-only` (part of `-ffast-math`) assumes no NaN or Infinity and folds `std::isnan`/`std::isfinite` - May break IEEE 754 compliance -**Use only when**: You control all inputs and don't need strict IEEE behavior. +**Use only when**: You control all inputs and don't need strict IEEE behavior. Keep +`-fno-finite-math-only` unless no code relies on NaN or Infinity checks. + +Set these options for whole translation units, never per function: see +[Optimization Options Must Match Across Calls](#optimization-options-must-match-across-calls). --- @@ -135,10 +139,17 @@ inline constexpr std::array sineLUT = []() { #define HOT_FUNCTION __attribute__((hot)) // Combined macro for critical functions -#define OPTIMIZE_FOR_SPEED \ - __attribute__((always_inline, hot, optimize("-O3"), optimize("-ffast-math"))) inline +#define OPTIMIZE_FOR_SPEED __attribute__((always_inline, hot)) inline ``` +#### Optimization Options Must Match Across Calls + +GCC does not inline a function into a caller whose optimization options differ from its own. +`#pragma GCC optimize` and `__attribute__((optimize(...)))` give the functions they cover options of +their own, so every small helper such a function calls — element access, accessors, unit wrappers — +stays an out-of-line call, and the functions themselves are no longer inlined into their callers. +Choose the optimization level and floating-point flags for whole translation units instead. + ### 5. Prefer Fixed-Size Types ```cpp @@ -204,32 +215,16 @@ set(CMAKE_CXX_FLAGS_DEBUG "-Og -g" CACHE STRING "Debug flags" FORCE) - Register allocation - Still debuggable (variable inspection works) -### Solution 2: Per-File Optimization Pragmas - -```cpp -// Bracket the performance-critical code; never leave the options active for the rest of the TU -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - -// Performance-critical implementation... +### Solution 2: Per-Translation-Unit Options -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif -``` - -### Solution 3: Per-Function Attributes - -```cpp -__attribute__((optimize("-O3"))) -void CriticalFunction() { - // This function is always optimized -} +```cmake +# Build the performance-critical sources optimized while the rest stays debuggable +set_source_files_properties(Controller.cpp PROPERTIES COMPILE_OPTIONS "$<$:-O2>") ``` -**Note**: Function-level attributes don't propagate to callees. Use file-level pragmas for better results. +Every function in a translation unit shares its options, so inlining is unaffected. Do not use +`#pragma GCC optimize` or `__attribute__((optimize(...)))` instead: see +[Optimization Options Must Match Across Calls](#optimization-options-must-match-across-calls). --- @@ -430,13 +425,11 @@ struct GoodStruct { ## Quick Reference Card -### GCC Optimization Pragmas -```cpp -#pragma GCC optimize("O3") // Maximum speed -#pragma GCC optimize("Os") // Minimum size -#pragma GCC optimize("fast-math") // Aggressive FP -#pragma GCC push_options // Save current options -#pragma GCC pop_options // Restore options +### Optimization Flags (whole translation units) +```cmake +add_compile_options(-O3) # Maximum speed +add_compile_options(-Os) # Minimum size +add_compile_options(-ffast-math -fno-finite-math-only) # Aggressive FP, NaN/Inf checks kept ``` ### Function Attributes diff --git a/numerical/analysis/ConvolutionCorrelation.hpp b/numerical/analysis/ConvolutionCorrelation.hpp index 9cc3e388..c4e4aefe 100644 --- a/numerical/analysis/ConvolutionCorrelation.hpp +++ b/numerical/analysis/ConvolutionCorrelation.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/analysis/FastFourierTransform.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/ComplexNumber.hpp" @@ -159,7 +154,3 @@ namespace analysis FastFourierTransform&); #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/Decibels.hpp b/numerical/analysis/Decibels.hpp index 6574d284..23157de6 100644 --- a/numerical/analysis/Decibels.hpp +++ b/numerical/analysis/Decibels.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include @@ -49,7 +44,3 @@ namespace analysis return ToDecibels(maxRatio) - ToDecibels(minRatio); } } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/DiscreteCosineTransform.hpp b/numerical/analysis/DiscreteCosineTransform.hpp index 9dbc51b4..224ac1c6 100644 --- a/numerical/analysis/DiscreteCosineTransform.hpp +++ b/numerical/analysis/DiscreteCosineTransform.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/BoundedVector.hpp" #include "numerical/analysis/FastFourierTransform.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -113,7 +108,3 @@ namespace analysis extern template class DiscreteCosineTransform; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/DiscreteWaveletTransform.hpp b/numerical/analysis/DiscreteWaveletTransform.hpp index c54287e5..1ffdfb54 100644 --- a/numerical/analysis/DiscreteWaveletTransform.hpp +++ b/numerical/analysis/DiscreteWaveletTransform.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/BoundedVector.hpp" #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -261,7 +256,3 @@ namespace analysis extern template class DiscreteWaveletTransform; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/FastFourierTransformRadix2Impl.hpp b/numerical/analysis/FastFourierTransformRadix2Impl.hpp index acc3392d..8d56c546 100644 --- a/numerical/analysis/FastFourierTransformRadix2Impl.hpp +++ b/numerical/analysis/FastFourierTransformRadix2Impl.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/BoundedVector.hpp" #include "numerical/analysis/FastFourierTransform.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -144,7 +139,3 @@ namespace analysis extern template class FastFourierTransformRadix2Impl; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/GoertzelAlgorithm.hpp b/numerical/analysis/GoertzelAlgorithm.hpp index ad08c6e9..cea30756 100644 --- a/numerical/analysis/GoertzelAlgorithm.hpp +++ b/numerical/analysis/GoertzelAlgorithm.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/ComplexNumber.hpp" @@ -124,7 +119,3 @@ namespace analysis extern template class GoertzelAlgorithm; } #endif - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/HilbertTransform.hpp b/numerical/analysis/HilbertTransform.hpp index 8496b5bc..ccf63a76 100644 --- a/numerical/analysis/HilbertTransform.hpp +++ b/numerical/analysis/HilbertTransform.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/BoundedVector.hpp" #include "numerical/analysis/FastFourierTransform.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -165,7 +160,3 @@ namespace analysis extern template class HilbertFir; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/MelFilterbank.hpp b/numerical/analysis/MelFilterbank.hpp index 1d48d8e3..23897aab 100644 --- a/numerical/analysis/MelFilterbank.hpp +++ b/numerical/analysis/MelFilterbank.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/BoundedVector.hpp" #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -174,7 +169,3 @@ namespace analysis extern template class MelFilterbank; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/Mfcc.hpp b/numerical/analysis/Mfcc.hpp index 5c9ea755..779187c7 100644 --- a/numerical/analysis/Mfcc.hpp +++ b/numerical/analysis/Mfcc.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/BoundedVector.hpp" #include "infra/util/ReallyAssert.hpp" #include "numerical/analysis/MelFilterbank.hpp" @@ -125,7 +120,3 @@ namespace analysis extern template class Mfcc; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/PowerDensitySpectrum.hpp b/numerical/analysis/PowerDensitySpectrum.hpp index f215c429..848d6764 100644 --- a/numerical/analysis/PowerDensitySpectrum.hpp +++ b/numerical/analysis/PowerDensitySpectrum.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/analysis/FastFourierTransform.hpp" #include "numerical/analysis/windowing/Windowing.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -129,7 +124,3 @@ namespace analysis extern template class PowerSpectralDensity, test::TwiddleFactorsStub, 0>; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/RealFastFourierTransform.hpp b/numerical/analysis/RealFastFourierTransform.hpp index d4d45254..79140969 100644 --- a/numerical/analysis/RealFastFourierTransform.hpp +++ b/numerical/analysis/RealFastFourierTransform.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/BoundedVector.hpp" #include "numerical/analysis/FastFourierTransform.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -124,7 +119,3 @@ namespace analysis extern template class RealFastFourierTransform; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/SignalDetectors.hpp b/numerical/analysis/SignalDetectors.hpp index b2422eec..b60c9666 100644 --- a/numerical/analysis/SignalDetectors.hpp +++ b/numerical/analysis/SignalDetectors.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include @@ -135,7 +130,3 @@ namespace analysis extern template class RmsEnvelope; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/TwiddleFactorsTable.hpp b/numerical/analysis/TwiddleFactorsTable.hpp index 5a76d473..0909fcb2 100644 --- a/numerical/analysis/TwiddleFactorsTable.hpp +++ b/numerical/analysis/TwiddleFactorsTable.hpp @@ -5,11 +5,6 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace analysis { template @@ -42,7 +37,3 @@ namespace analysis extern template class TwiddleFactorsTable; } #endif - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/analysis/windowing/Windowing.hpp b/numerical/analysis/windowing/Windowing.hpp index 3e915c11..ef825db9 100644 --- a/numerical/analysis/windowing/Windowing.hpp +++ b/numerical/analysis/windowing/Windowing.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/QNumber.hpp" @@ -127,7 +122,3 @@ namespace windowing extern template class RectangularWindow; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/control_analysis/ContinuousToDiscrete.hpp b/numerical/control_analysis/ContinuousToDiscrete.hpp index bfc94833..f0908255 100644 --- a/numerical/control_analysis/ContinuousToDiscrete.hpp +++ b/numerical/control_analysis/ContinuousToDiscrete.hpp @@ -1,8 +1,4 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/LinearTimeInvariant.hpp" #include "numerical/math/Math.hpp" @@ -179,7 +175,3 @@ namespace control_analysis extern template class ContinuousToDiscrete; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/control_analysis/ControllabilityObservability.hpp b/numerical/control_analysis/ControllabilityObservability.hpp index 9cc3ba06..2934ed5c 100644 --- a/numerical/control_analysis/ControllabilityObservability.hpp +++ b/numerical/control_analysis/ControllabilityObservability.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/LinearTimeInvariant.hpp" #include "numerical/math/Math.hpp" @@ -243,7 +238,3 @@ namespace control_analysis math::Matrix&, std::size_t, std::size_t, float); #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/control_analysis/FrequencyResponse.hpp b/numerical/control_analysis/FrequencyResponse.hpp index 69bd9e17..0e39258d 100644 --- a/numerical/control_analysis/FrequencyResponse.hpp +++ b/numerical/control_analysis/FrequencyResponse.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/BoundedVector.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" @@ -110,7 +105,3 @@ namespace control_analysis extern template class FrequencyResponse; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/control_analysis/RootLocus.hpp b/numerical/control_analysis/RootLocus.hpp index f55f07cc..005f3649 100644 --- a/numerical/control_analysis/RootLocus.hpp +++ b/numerical/control_analysis/RootLocus.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/BoundedVector.hpp" #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -140,7 +135,3 @@ namespace control_analysis extern template class RootLocus; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/control_analysis/TransferFunctionStateSpace.hpp b/numerical/control_analysis/TransferFunctionStateSpace.hpp index b2c3d6ae..d32ae95b 100644 --- a/numerical/control_analysis/TransferFunctionStateSpace.hpp +++ b/numerical/control_analysis/TransferFunctionStateSpace.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/LinearTimeInvariant.hpp" #include "numerical/math/Matrix.hpp" @@ -167,7 +162,3 @@ namespace control_analysis extern template class TransferFunctionStateSpace; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/BangBangHysteresis.hpp b/numerical/controllers/implementations/BangBangHysteresis.hpp index 0f306b62..84a254f3 100644 --- a/numerical/controllers/implementations/BangBangHysteresis.hpp +++ b/numerical/controllers/implementations/BangBangHysteresis.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include @@ -74,7 +69,3 @@ namespace controllers extern template class BangBangHysteresis; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/DeadbeatControl.hpp b/numerical/controllers/implementations/DeadbeatControl.hpp index 5d312ebb..8934459c 100644 --- a/numerical/controllers/implementations/DeadbeatControl.hpp +++ b/numerical/controllers/implementations/DeadbeatControl.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/controllers/interfaces/StateFeedbackController.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/LinearTimeInvariant.hpp" @@ -148,7 +143,3 @@ namespace controllers extern template class DeadbeatControl; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/Feedforward2Dof.hpp b/numerical/controllers/implementations/Feedforward2Dof.hpp index 05ecd276..365001b0 100644 --- a/numerical/controllers/implementations/Feedforward2Dof.hpp +++ b/numerical/controllers/implementations/Feedforward2Dof.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/controllers/implementations/SaturationRateLimiter.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include @@ -78,7 +73,3 @@ namespace controllers extern template class Feedforward2Dof; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/GainScheduledController.hpp b/numerical/controllers/implementations/GainScheduledController.hpp index 0b2b74d3..ffe00039 100644 --- a/numerical/controllers/implementations/GainScheduledController.hpp +++ b/numerical/controllers/implementations/GainScheduledController.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include #include @@ -94,7 +89,3 @@ namespace controllers extern template class GainScheduledController; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/IntegralStateFeedbackLqi.hpp b/numerical/controllers/implementations/IntegralStateFeedbackLqi.hpp index 03a2c66e..dfc899ce 100644 --- a/numerical/controllers/implementations/IntegralStateFeedbackLqi.hpp +++ b/numerical/controllers/implementations/IntegralStateFeedbackLqi.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/controllers/implementations/Lqr.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/LinearTimeInvariant.hpp" @@ -172,7 +167,3 @@ namespace controllers extern template class IntegralStateFeedbackLqi; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/LeadLagCompensator.hpp b/numerical/controllers/implementations/LeadLagCompensator.hpp index 6379cccc..4f670381 100644 --- a/numerical/controllers/implementations/LeadLagCompensator.hpp +++ b/numerical/controllers/implementations/LeadLagCompensator.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include @@ -74,7 +69,3 @@ namespace controllers extern template class LeadLagCompensator; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/Lqg.hpp b/numerical/controllers/implementations/Lqg.hpp index 3189e9d8..b350d59b 100644 --- a/numerical/controllers/implementations/Lqg.hpp +++ b/numerical/controllers/implementations/Lqg.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/controllers/implementations/Lqr.hpp" #include "numerical/controllers/interfaces/OutputFeedbackController.hpp" #include "numerical/filters/active/KalmanFilter.hpp" @@ -103,7 +98,3 @@ namespace controllers extern template class Lqg; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/Lqr.hpp b/numerical/controllers/implementations/Lqr.hpp index 516f9288..3aca891e 100644 --- a/numerical/controllers/implementations/Lqr.hpp +++ b/numerical/controllers/implementations/Lqr.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/controllers/interfaces/StateFeedbackController.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -145,7 +140,3 @@ namespace controllers extern template class Lqr; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/LuenbergerObserver.hpp b/numerical/controllers/implementations/LuenbergerObserver.hpp index 8fdf914a..33c15f20 100644 --- a/numerical/controllers/implementations/LuenbergerObserver.hpp +++ b/numerical/controllers/implementations/LuenbergerObserver.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/LinearTimeInvariant.hpp" #include "numerical/solvers/GaussianElimination.hpp" @@ -143,7 +138,3 @@ namespace controllers extern template class LuenbergerObserver; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/Mpc.hpp b/numerical/controllers/implementations/Mpc.hpp index 0ca8b159..8004dd6a 100644 --- a/numerical/controllers/implementations/Mpc.hpp +++ b/numerical/controllers/implementations/Mpc.hpp @@ -8,11 +8,6 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace controllers { template @@ -309,7 +304,3 @@ namespace controllers extern template class Mpc; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/PidIncremental.hpp b/numerical/controllers/implementations/PidIncremental.hpp index 23189204..e822bc0b 100644 --- a/numerical/controllers/implementations/PidIncremental.hpp +++ b/numerical/controllers/implementations/PidIncremental.hpp @@ -4,11 +4,6 @@ #include "numerical/controllers/interfaces/PidDriver.hpp" #include "numerical/math/CompilerOptimizations.hpp" -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace controllers { template @@ -235,7 +230,3 @@ namespace controllers extern template class PidIncrementalSynchronous; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/controllers/implementations/SaturationRateLimiter.hpp b/numerical/controllers/implementations/SaturationRateLimiter.hpp index bf24b81b..c28abc9d 100644 --- a/numerical/controllers/implementations/SaturationRateLimiter.hpp +++ b/numerical/controllers/implementations/SaturationRateLimiter.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include #include @@ -101,7 +96,3 @@ namespace controllers extern template class SlewLimitedSaturation; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/estimators/offline/ExpectationMaximization.hpp b/numerical/estimators/offline/ExpectationMaximization.hpp index bb0c89aa..79e59430 100644 --- a/numerical/estimators/offline/ExpectationMaximization.hpp +++ b/numerical/estimators/offline/ExpectationMaximization.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/filters/active/KalmanSmoother.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" @@ -227,7 +222,3 @@ namespace estimators extern template class ExpectationMaximization<4, 2, 20>; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/estimators/offline/LinearRegression.hpp b/numerical/estimators/offline/LinearRegression.hpp index d624a34d..158381c2 100644 --- a/numerical/estimators/offline/LinearRegression.hpp +++ b/numerical/estimators/offline/LinearRegression.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/estimators/Estimator.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/solvers/QrDecomposition.hpp" @@ -77,7 +72,3 @@ namespace estimators extern template class LinearRegression; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/estimators/offline/PolynomialFitting.hpp b/numerical/estimators/offline/PolynomialFitting.hpp index d9f630fd..41b0f7d7 100644 --- a/numerical/estimators/offline/PolynomialFitting.hpp +++ b/numerical/estimators/offline/PolynomialFitting.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" #include "numerical/solvers/QrDecomposition.hpp" @@ -73,7 +68,3 @@ namespace estimators extern template class PolynomialFitting; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/estimators/offline/TotalLeastSquares.hpp b/numerical/estimators/offline/TotalLeastSquares.hpp index 655d42e0..70cf0728 100644 --- a/numerical/estimators/offline/TotalLeastSquares.hpp +++ b/numerical/estimators/offline/TotalLeastSquares.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -84,7 +79,3 @@ namespace estimators extern template class TotalLeastSquares; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/estimators/offline/YuleWalker.hpp b/numerical/estimators/offline/YuleWalker.hpp index 7fe8411b..887c6f63 100644 --- a/numerical/estimators/offline/YuleWalker.hpp +++ b/numerical/estimators/offline/YuleWalker.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" #include "numerical/math/Statistics.hpp" @@ -125,7 +120,3 @@ namespace estimators extern template class YuleWalker; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/estimators/online/LmsAdaptiveFilter.hpp b/numerical/estimators/online/LmsAdaptiveFilter.hpp index 49bffdc0..c16090d0 100644 --- a/numerical/estimators/online/LmsAdaptiveFilter.hpp +++ b/numerical/estimators/online/LmsAdaptiveFilter.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include #include @@ -121,7 +116,3 @@ namespace estimators extern template class LmsAdaptiveFilter; } #endif - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/estimators/online/RecursiveLeastSquares.hpp b/numerical/estimators/online/RecursiveLeastSquares.hpp index 1e8a38cc..f9977d66 100644 --- a/numerical/estimators/online/RecursiveLeastSquares.hpp +++ b/numerical/estimators/online/RecursiveLeastSquares.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/estimators/Estimator.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -147,7 +142,3 @@ namespace estimators extern template class RecursiveLeastSquares; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/active/AhrsMadgwickMahony.hpp b/numerical/filters/active/AhrsMadgwickMahony.hpp index bffa68df..e3cab510 100644 --- a/numerical/filters/active/AhrsMadgwickMahony.hpp +++ b/numerical/filters/active/AhrsMadgwickMahony.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Geometry3D.hpp" #include "numerical/math/Math.hpp" @@ -300,7 +295,3 @@ namespace filters extern template class AhrsFilter; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/active/AlphaBetaFilter.hpp b/numerical/filters/active/AlphaBetaFilter.hpp index 7b1de441..e801b26d 100644 --- a/numerical/filters/active/AlphaBetaFilter.hpp +++ b/numerical/filters/active/AlphaBetaFilter.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" @@ -153,7 +148,3 @@ namespace filters extern template class AlphaBetaFilter; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/active/ComplementaryFilter.hpp b/numerical/filters/active/ComplementaryFilter.hpp index a45fdcca..8d8f0946 100644 --- a/numerical/filters/active/ComplementaryFilter.hpp +++ b/numerical/filters/active/ComplementaryFilter.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include @@ -108,7 +103,3 @@ namespace filters extern template class ComplementaryFilter; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/active/ExtendedKalmanFilter.hpp b/numerical/filters/active/ExtendedKalmanFilter.hpp index 5698a204..1261fe32 100644 --- a/numerical/filters/active/ExtendedKalmanFilter.hpp +++ b/numerical/filters/active/ExtendedKalmanFilter.hpp @@ -5,11 +5,6 @@ #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/MatrixOperations.hpp" -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace filters { template @@ -126,7 +121,3 @@ namespace filters extern template class ExtendedKalmanFilter; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/active/KalmanFilter.hpp b/numerical/filters/active/KalmanFilter.hpp index bf1e45a2..4c5f6578 100644 --- a/numerical/filters/active/KalmanFilter.hpp +++ b/numerical/filters/active/KalmanFilter.hpp @@ -5,11 +5,6 @@ #include "numerical/math/LinearTimeInvariant.hpp" #include "numerical/math/MatrixOperations.hpp" -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace filters { template @@ -136,7 +131,3 @@ namespace filters extern template class KalmanFilter; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/active/KalmanFilterBase.hpp b/numerical/filters/active/KalmanFilterBase.hpp index 1b2db1db..a8b25bce 100644 --- a/numerical/filters/active/KalmanFilterBase.hpp +++ b/numerical/filters/active/KalmanFilterBase.hpp @@ -5,11 +5,6 @@ #include "numerical/math/MatrixOperations.hpp" #include "numerical/solvers/GaussianElimination.hpp" -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace filters { namespace detail @@ -176,7 +171,3 @@ namespace filters extern template class KalmanFilterBase; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/active/KalmanSmoother.hpp b/numerical/filters/active/KalmanSmoother.hpp index 416513c1..70d07d04 100644 --- a/numerical/filters/active/KalmanSmoother.hpp +++ b/numerical/filters/active/KalmanSmoother.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CholeskyDecomposition.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/LinearTimeInvariant.hpp" @@ -249,7 +244,3 @@ namespace filters extern template class KalmanSmoother<4, 2, 20>; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/active/SquareRootKalmanFilter.hpp b/numerical/filters/active/SquareRootKalmanFilter.hpp index a1c7ae18..6fd0e47b 100644 --- a/numerical/filters/active/SquareRootKalmanFilter.hpp +++ b/numerical/filters/active/SquareRootKalmanFilter.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/filters/active/KalmanFilterBase.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/GivensRotation.hpp" @@ -224,7 +219,3 @@ namespace filters extern template class SquareRootKalmanFilter; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/active/UnscentedKalmanFilter.hpp b/numerical/filters/active/UnscentedKalmanFilter.hpp index 71a87b5f..78ab6082 100644 --- a/numerical/filters/active/UnscentedKalmanFilter.hpp +++ b/numerical/filters/active/UnscentedKalmanFilter.hpp @@ -10,11 +10,6 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace filters { struct UkfParameters @@ -284,7 +279,3 @@ namespace filters extern template class UnscentedKalmanFilter; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/passive/BiquadCascade.hpp b/numerical/filters/passive/BiquadCascade.hpp index 0b0c4993..de6da899 100644 --- a/numerical/filters/passive/BiquadCascade.hpp +++ b/numerical/filters/passive/BiquadCascade.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include @@ -204,7 +199,3 @@ namespace filters::passive extern template class BiquadCascade; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/passive/CicFilter.hpp b/numerical/filters/passive/CicFilter.hpp index c456a57b..f2a6b3ea 100644 --- a/numerical/filters/passive/CicFilter.hpp +++ b/numerical/filters/passive/CicFilter.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include #include @@ -121,7 +116,3 @@ namespace filters::passive extern template class CicDecimator; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/passive/ExponentialMovingAverage.hpp b/numerical/filters/passive/ExponentialMovingAverage.hpp index a167dd94..e426ede4 100644 --- a/numerical/filters/passive/ExponentialMovingAverage.hpp +++ b/numerical/filters/passive/ExponentialMovingAverage.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include #include @@ -73,7 +68,3 @@ namespace filters::passive extern template class ExponentialMovingAverage; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/passive/Fir.hpp b/numerical/filters/passive/Fir.hpp index 7dfbeaf7..40d7dcaf 100644 --- a/numerical/filters/passive/Fir.hpp +++ b/numerical/filters/passive/Fir.hpp @@ -3,11 +3,6 @@ #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/RecursiveBuffer.hpp" -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace filters::passive { template @@ -60,7 +55,3 @@ namespace filters::passive extern template class Fir; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/passive/Iir.hpp b/numerical/filters/passive/Iir.hpp index 700f0125..34887df5 100644 --- a/numerical/filters/passive/Iir.hpp +++ b/numerical/filters/passive/Iir.hpp @@ -3,11 +3,6 @@ #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/RecursiveBuffer.hpp" -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace filters::passive { template @@ -71,7 +66,3 @@ namespace filters::passive extern template class Iir; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/passive/IirFilterDesign.hpp b/numerical/filters/passive/IirFilterDesign.hpp index 9cb59047..e675cabf 100644 --- a/numerical/filters/passive/IirFilterDesign.hpp +++ b/numerical/filters/passive/IirFilterDesign.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/filters/passive/BiquadCascade.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/ComplexNumber.hpp" @@ -512,7 +507,3 @@ namespace filters::passive extern template class IirFilterDesign; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/passive/MedianFilter.hpp b/numerical/filters/passive/MedianFilter.hpp index cc4c51b7..d9232182 100644 --- a/numerical/filters/passive/MedianFilter.hpp +++ b/numerical/filters/passive/MedianFilter.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include #include @@ -73,7 +68,3 @@ namespace filters::passive extern template class MedianFilter; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/passive/MovingAverage.hpp b/numerical/filters/passive/MovingAverage.hpp index 437b16e2..35eaf5ae 100644 --- a/numerical/filters/passive/MovingAverage.hpp +++ b/numerical/filters/passive/MovingAverage.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/RecursiveBuffer.hpp" @@ -65,7 +60,3 @@ namespace filters::passive extern template class MovingAverage; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/passive/NotchCombFilter.hpp b/numerical/filters/passive/NotchCombFilter.hpp index f1cec4eb..b1e42a76 100644 --- a/numerical/filters/passive/NotchCombFilter.hpp +++ b/numerical/filters/passive/NotchCombFilter.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include @@ -127,7 +122,3 @@ namespace filters::passive extern template class CombFilter; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/filters/passive/SavitzkyGolayFilter.hpp b/numerical/filters/passive/SavitzkyGolayFilter.hpp index 68ca7306..af91bd98 100644 --- a/numerical/filters/passive/SavitzkyGolayFilter.hpp +++ b/numerical/filters/passive/SavitzkyGolayFilter.hpp @@ -1,11 +1,6 @@ // Copyright 2024 Numerical Toolbox Contributors. All rights reserved. #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CholeskyDecomposition.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include @@ -128,7 +123,3 @@ namespace filters::passive extern template class SavitzkyGolayFilter; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/CholeskyDecomposition.hpp b/numerical/math/CholeskyDecomposition.hpp index 4424f4d3..3c2dcae4 100644 --- a/numerical/math/CholeskyDecomposition.hpp +++ b/numerical/math/CholeskyDecomposition.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -118,7 +113,3 @@ namespace math extern template class CholeskyDecomposition; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/CompilerOptimizations.hpp b/numerical/math/CompilerOptimizations.hpp index b9d1fbaa..a0c7fc00 100644 --- a/numerical/math/CompilerOptimizations.hpp +++ b/numerical/math/CompilerOptimizations.hpp @@ -1,11 +1,7 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) && defined(NumericalToolbox_ENABLE_OPTIMIZATIONS) -#define OPTIMIZE_FOR_SPEED __attribute__((always_inline, hot, optimize("-O3"), optimize("-ffast-math"))) inline -#elif defined(__clang__) && defined(NumericalToolbox_ENABLE_OPTIMIZATIONS) +#if (defined(__GNUC__) || defined(__clang__)) && defined(NumericalToolbox_ENABLE_OPTIMIZATIONS) #define OPTIMIZE_FOR_SPEED __attribute__((always_inline, hot)) inline -#elif defined(_MSC_VER) -#define OPTIMIZE_FOR_SPEED #else #define OPTIMIZE_FOR_SPEED #endif diff --git a/numerical/math/ComplexNumber.hpp b/numerical/math/ComplexNumber.hpp index 3a22cab6..2638b537 100644 --- a/numerical/math/ComplexNumber.hpp +++ b/numerical/math/ComplexNumber.hpp @@ -3,11 +3,6 @@ #include "numerical/math/QNumber.hpp" #include -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace math { template @@ -140,7 +135,3 @@ namespace math extern template class Complex; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/ConsistencyMetrics.hpp b/numerical/math/ConsistencyMetrics.hpp index 06c369d7..1014e578 100644 --- a/numerical/math/ConsistencyMetrics.hpp +++ b/numerical/math/ConsistencyMetrics.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CholeskyDecomposition.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" @@ -108,7 +103,3 @@ namespace math extern template class ConsistencyMetrics; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/Cordic.hpp b/numerical/math/Cordic.hpp index 86b08735..78509355 100644 --- a/numerical/math/Cordic.hpp +++ b/numerical/math/Cordic.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include @@ -183,7 +178,3 @@ namespace math extern template class Cordic; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/Geometry3D.hpp b/numerical/math/Geometry3D.hpp index a02be99a..340a62d5 100644 --- a/numerical/math/Geometry3D.hpp +++ b/numerical/math/Geometry3D.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -90,7 +85,3 @@ namespace math return math::Sqrt(DotProduct(v, v)); } } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/GivensRotation.hpp b/numerical/math/GivensRotation.hpp index 114f6985..91e5d21e 100644 --- a/numerical/math/GivensRotation.hpp +++ b/numerical/math/GivensRotation.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include @@ -54,7 +49,3 @@ namespace math y = newY; } } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/HouseholderTransform.hpp b/numerical/math/HouseholderTransform.hpp index e9b906c1..735a4efa 100644 --- a/numerical/math/HouseholderTransform.hpp +++ b/numerical/math/HouseholderTransform.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -82,7 +77,3 @@ namespace math } } } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/LinearTimeInvariant.hpp b/numerical/math/LinearTimeInvariant.hpp index c89a325e..f04c564f 100644 --- a/numerical/math/LinearTimeInvariant.hpp +++ b/numerical/math/LinearTimeInvariant.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" @@ -70,7 +65,3 @@ namespace math }; } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/Math.hpp b/numerical/math/Math.hpp index 89628483..eed45f71 100644 --- a/numerical/math/Math.hpp +++ b/numerical/math/Math.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include #include #include @@ -331,7 +326,3 @@ namespace math #endif #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/Matrix.hpp b/numerical/math/Matrix.hpp index f0b0bf15..18bca0e3 100644 --- a/numerical/math/Matrix.hpp +++ b/numerical/math/Matrix.hpp @@ -5,11 +5,6 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace math { template @@ -368,7 +363,3 @@ namespace math extern template class Matrix; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/MatrixExponential.hpp b/numerical/math/MatrixExponential.hpp index ae68792f..784d9d72 100644 --- a/numerical/math/MatrixExponential.hpp +++ b/numerical/math/MatrixExponential.hpp @@ -1,8 +1,4 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -187,7 +183,3 @@ namespace math extern template class MatrixExponential; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/MatrixNorms.hpp b/numerical/math/MatrixNorms.hpp index 738a9478..0c8fb225 100644 --- a/numerical/math/MatrixNorms.hpp +++ b/numerical/math/MatrixNorms.hpp @@ -1,8 +1,4 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -96,7 +92,3 @@ namespace math return result; } } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/MatrixOperations.hpp b/numerical/math/MatrixOperations.hpp index a38d185e..2fbe1ed8 100644 --- a/numerical/math/MatrixOperations.hpp +++ b/numerical/math/MatrixOperations.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" #include @@ -26,7 +21,3 @@ namespace math return a * m * a.Transpose(); } } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/QNumber.hpp b/numerical/math/QNumber.hpp index a94f5f30..e42923b3 100644 --- a/numerical/math/QNumber.hpp +++ b/numerical/math/QNumber.hpp @@ -7,11 +7,6 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace math { inline constexpr double pi = std::numbers::pi; @@ -266,7 +261,3 @@ namespace math extern template class QNumber; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/Quaternion.hpp b/numerical/math/Quaternion.hpp index d6e03f70..1903efce 100644 --- a/numerical/math/Quaternion.hpp +++ b/numerical/math/Quaternion.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Geometry3D.hpp" #include "numerical/math/Math.hpp" @@ -292,7 +287,3 @@ namespace math extern template class Quaternion; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/RecursiveBuffer.hpp b/numerical/math/RecursiveBuffer.hpp index c602884b..5a0cb4e6 100644 --- a/numerical/math/RecursiveBuffer.hpp +++ b/numerical/math/RecursiveBuffer.hpp @@ -4,11 +4,6 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace math { struct IndexRelative @@ -102,7 +97,3 @@ namespace math extern template class RecursiveBuffer; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/StepResponseMetrics.hpp b/numerical/math/StepResponseMetrics.hpp index ee404210..bf0fdb7a 100644 --- a/numerical/math/StepResponseMetrics.hpp +++ b/numerical/math/StepResponseMetrics.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -115,7 +110,3 @@ namespace math return reference - tailMean; } } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/Toeplitz.hpp b/numerical/math/Toeplitz.hpp index a6d304f5..3eec6bd5 100644 --- a/numerical/math/Toeplitz.hpp +++ b/numerical/math/Toeplitz.hpp @@ -4,11 +4,6 @@ #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace math { template @@ -169,7 +164,3 @@ namespace math extern template class ToeplitzMatrix; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/Tolerance.hpp b/numerical/math/Tolerance.hpp index d0d71684..959bbbf6 100644 --- a/numerical/math/Tolerance.hpp +++ b/numerical/math/Tolerance.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - namespace math { template @@ -13,7 +8,3 @@ namespace math return 1e-3f; } } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/TriangularSolve.hpp b/numerical/math/TriangularSolve.hpp index f2a3461e..bbd5e365 100644 --- a/numerical/math/TriangularSolve.hpp +++ b/numerical/math/TriangularSolve.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -85,7 +80,3 @@ namespace math return x; } } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/math/platform/MathArm.hpp b/numerical/math/platform/MathArm.hpp index 195436a7..8c874338 100644 --- a/numerical/math/platform/MathArm.hpp +++ b/numerical/math/platform/MathArm.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include #include #include @@ -757,7 +752,3 @@ namespace math #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/nonlinear_control/BacksteppingControl.hpp b/numerical/nonlinear_control/BacksteppingControl.hpp index 65dc0abd..3c33f5b9 100644 --- a/numerical/nonlinear_control/BacksteppingControl.hpp +++ b/numerical/nonlinear_control/BacksteppingControl.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" @@ -106,7 +101,3 @@ namespace nonlinear_control extern template class BacksteppingControl; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/nonlinear_control/FeedbackLinearization.hpp b/numerical/nonlinear_control/FeedbackLinearization.hpp index 20028745..44785605 100644 --- a/numerical/nonlinear_control/FeedbackLinearization.hpp +++ b/numerical/nonlinear_control/FeedbackLinearization.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" #include "numerical/solvers/GaussianElimination.hpp" @@ -75,7 +70,3 @@ namespace nonlinear_control extern template class FeedbackLinearization; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/nonlinear_control/ModelReferenceAdaptiveControl.hpp b/numerical/nonlinear_control/ModelReferenceAdaptiveControl.hpp index c39a2673..52e18cc4 100644 --- a/numerical/nonlinear_control/ModelReferenceAdaptiveControl.hpp +++ b/numerical/nonlinear_control/ModelReferenceAdaptiveControl.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/LinearTimeInvariant.hpp" @@ -127,7 +122,3 @@ namespace nonlinear_control extern template class ModelReferenceAdaptiveControl; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/optimization/Adam.hpp b/numerical/optimization/Adam.hpp index 5a676a35..7d792b39 100644 --- a/numerical/optimization/Adam.hpp +++ b/numerical/optimization/Adam.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/optimization/StepOptimizer.hpp" @@ -86,7 +81,3 @@ namespace optimization extern template class Adam; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/optimization/BayesianOptimization.hpp b/numerical/optimization/BayesianOptimization.hpp index b1b5cd30..b54aa85e 100644 --- a/numerical/optimization/BayesianOptimization.hpp +++ b/numerical/optimization/BayesianOptimization.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -314,7 +309,3 @@ namespace optimization extern template class BayesianOptimization<2, 20, 100>; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/optimization/GradientDescent.hpp b/numerical/optimization/GradientDescent.hpp index 75c32d0d..fd5c8405 100644 --- a/numerical/optimization/GradientDescent.hpp +++ b/numerical/optimization/GradientDescent.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/optimization/Optimizer.hpp" #include @@ -74,7 +69,3 @@ namespace optimization extern template class GradientDescent; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/optimization/Sgd.hpp b/numerical/optimization/Sgd.hpp index 9ff9df85..cb8db07c 100644 --- a/numerical/optimization/Sgd.hpp +++ b/numerical/optimization/Sgd.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/optimization/StepOptimizer.hpp" @@ -64,7 +59,3 @@ namespace optimization extern template class Sgd; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/regularization/L1.hpp b/numerical/regularization/L1.hpp index 3e6c350a..af1787fb 100644 --- a/numerical/regularization/L1.hpp +++ b/numerical/regularization/L1.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/regularization/Regularization.hpp" @@ -65,7 +60,3 @@ namespace regularization extern template class L1; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/regularization/L2.hpp b/numerical/regularization/L2.hpp index 8a363fa4..b36ce7ab 100644 --- a/numerical/regularization/L2.hpp +++ b/numerical/regularization/L2.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/regularization/Regularization.hpp" @@ -58,7 +53,3 @@ namespace regularization extern template class L2; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/robust_control/ActiveDisturbanceRejection.hpp b/numerical/robust_control/ActiveDisturbanceRejection.hpp index a2ba72b3..114e40fa 100644 --- a/numerical/robust_control/ActiveDisturbanceRejection.hpp +++ b/numerical/robust_control/ActiveDisturbanceRejection.hpp @@ -3,11 +3,6 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" @@ -159,7 +154,3 @@ namespace robust_control extern template class ActiveDisturbanceRejectionControl; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/robust_control/DisturbanceObserver.hpp b/numerical/robust_control/DisturbanceObserver.hpp index c122907b..2ed0102c 100644 --- a/numerical/robust_control/DisturbanceObserver.hpp +++ b/numerical/robust_control/DisturbanceObserver.hpp @@ -1,11 +1,6 @@ // Copyright (c) 2024, Numerical Toolbox Contributors. All rights reserved. #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/filters/passive/BiquadCascade.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/LinearTimeInvariant.hpp" @@ -163,7 +158,3 @@ namespace robust_control extern template class DisturbanceObserver; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/robust_control/HInfinityStateFeedback.hpp b/numerical/robust_control/HInfinityStateFeedback.hpp index cc5ba3d1..8a3b0a8e 100644 --- a/numerical/robust_control/HInfinityStateFeedback.hpp +++ b/numerical/robust_control/HInfinityStateFeedback.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CholeskyDecomposition.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" @@ -278,7 +273,3 @@ namespace robust_control extern template class HInfinityStateFeedback; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/robust_control/SlidingModeControl.hpp b/numerical/robust_control/SlidingModeControl.hpp index 35148388..e2bb3fce 100644 --- a/numerical/robust_control/SlidingModeControl.hpp +++ b/numerical/robust_control/SlidingModeControl.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/LinearTimeInvariant.hpp" @@ -128,7 +123,3 @@ namespace robust_control extern template class SlidingModeControl; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/ConditionNumber.hpp b/numerical/solvers/ConditionNumber.hpp index d6f057d8..efff5bfd 100644 --- a/numerical/solvers/ConditionNumber.hpp +++ b/numerical/solvers/ConditionNumber.hpp @@ -1,8 +1,4 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -37,7 +33,3 @@ namespace solvers return normA * normInv; } } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/DiscreteAlgebraicRiccatiEquation.hpp b/numerical/solvers/DiscreteAlgebraicRiccatiEquation.hpp index 895834bb..2875bbb4 100644 --- a/numerical/solvers/DiscreteAlgebraicRiccatiEquation.hpp +++ b/numerical/solvers/DiscreteAlgebraicRiccatiEquation.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" #include "numerical/math/QNumber.hpp" @@ -124,7 +119,3 @@ namespace solvers extern template class DiscreteAlgebraicRiccatiEquation; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/DormandPrince45.hpp b/numerical/solvers/DormandPrince45.hpp index 96a8361e..d0a1ba79 100644 --- a/numerical/solvers/DormandPrince45.hpp +++ b/numerical/solvers/DormandPrince45.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -254,7 +249,3 @@ namespace solvers extern template class DormandPrince45; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/DurandKerner.hpp b/numerical/solvers/DurandKerner.hpp index 2402f454..d178c6fb 100644 --- a/numerical/solvers/DurandKerner.hpp +++ b/numerical/solvers/DurandKerner.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/BoundedVector.hpp" #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" @@ -173,7 +168,3 @@ namespace solvers extern template class DurandKerner; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/GaussianElimination.hpp b/numerical/solvers/GaussianElimination.hpp index 71c9e5a0..974da0d6 100644 --- a/numerical/solvers/GaussianElimination.hpp +++ b/numerical/solvers/GaussianElimination.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" @@ -185,7 +180,3 @@ namespace solvers extern template class GaussianElimination; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/JacobiEigenSolver.hpp b/numerical/solvers/JacobiEigenSolver.hpp index 0cf89d5b..f4fb8e93 100644 --- a/numerical/solvers/JacobiEigenSolver.hpp +++ b/numerical/solvers/JacobiEigenSolver.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/GivensRotation.hpp" #include "numerical/math/Math.hpp" @@ -169,7 +164,3 @@ namespace solvers extern template class JacobiEigenSolver; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/LevinsonDurbin.hpp b/numerical/solvers/LevinsonDurbin.hpp index c1cc0ee9..d507b1ad 100644 --- a/numerical/solvers/LevinsonDurbin.hpp +++ b/numerical/solvers/LevinsonDurbin.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Toeplitz.hpp" #include "numerical/solvers/Solver.hpp" @@ -106,7 +101,3 @@ namespace solvers extern template class LevinsonDurbin; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/LuDecomposition.hpp b/numerical/solvers/LuDecomposition.hpp index b8a3bfce..23a54998 100644 --- a/numerical/solvers/LuDecomposition.hpp +++ b/numerical/solvers/LuDecomposition.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -176,7 +171,3 @@ namespace solvers extern template class LuDecomposition; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/LyapunovSylvester.hpp b/numerical/solvers/LyapunovSylvester.hpp index 94ce15ce..f75b562f 100644 --- a/numerical/solvers/LyapunovSylvester.hpp +++ b/numerical/solvers/LyapunovSylvester.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" #include "numerical/solvers/LuDecomposition.hpp" @@ -147,7 +142,3 @@ namespace solvers extern template class SylvesterSolver; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/QrDecomposition.hpp b/numerical/solvers/QrDecomposition.hpp index 1215913e..112c8df9 100644 --- a/numerical/solvers/QrDecomposition.hpp +++ b/numerical/solvers/QrDecomposition.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/GivensRotation.hpp" #include "numerical/math/HouseholderTransform.hpp" @@ -173,7 +168,3 @@ namespace solvers extern template class QrDecomposition; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/RungeKuttaIntegrators.hpp b/numerical/solvers/RungeKuttaIntegrators.hpp index a1b6fb73..63206eb1 100644 --- a/numerical/solvers/RungeKuttaIntegrators.hpp +++ b/numerical/solvers/RungeKuttaIntegrators.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Matrix.hpp" #include "numerical/solvers/OdeSystem.hpp" @@ -90,7 +85,3 @@ namespace solvers extern template class RungeKutta4; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/SingularValueDecomposition.hpp b/numerical/solvers/SingularValueDecomposition.hpp index 50a5debc..dd31a8aa 100644 --- a/numerical/solvers/SingularValueDecomposition.hpp +++ b/numerical/solvers/SingularValueDecomposition.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "infra/util/ReallyAssert.hpp" #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/GivensRotation.hpp" @@ -533,7 +528,3 @@ namespace solvers extern template class SingularValueDecomposition; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/numerical/solvers/SpectralRadius.hpp b/numerical/solvers/SpectralRadius.hpp index 3755bc36..c1fbb0d2 100644 --- a/numerical/solvers/SpectralRadius.hpp +++ b/numerical/solvers/SpectralRadius.hpp @@ -1,10 +1,5 @@ #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif - #include "numerical/math/CompilerOptimizations.hpp" #include "numerical/math/Math.hpp" #include "numerical/math/Matrix.hpp" @@ -98,7 +93,3 @@ namespace solvers extern template class SpectralRadius; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif diff --git a/roadmap/DEPLOYMENT.md b/roadmap/DEPLOYMENT.md index 6933ebbe..63ab214f 100644 --- a/roadmap/DEPLOYMENT.md +++ b/roadmap/DEPLOYMENT.md @@ -4,8 +4,7 @@ Turn one `roadmap///` spec into shipped code. Rules: `../AGENTS.md Read the spec's three files first (`implementation.md`, `tests.md`, `explanation.md`), then: 1. **Header** `numerical//.hpp` - - `#pragma once` → `#pragma GCC push_options` + `#pragma GCC optimize("O3","fast-math")` (GCC-only guard) → - `#include "numerical/math/CompilerOptimizations.hpp"`; end the file with `#pragma GCC pop_options`. + - `#pragma once` → `#include "numerical/math/CompilerOptimizations.hpp"`; no `#pragma GCC optimize`. - `template` with `static_assert(std::is_floating_point_v, " supports floating-point types");`. - Implement per `implementation.md`; `OPTIMIZE_FOR_SPEED` on the hot path(s). diff --git a/roadmap/README.md b/roadmap/README.md index 65f94079..461d7164 100644 --- a/roadmap/README.md +++ b/roadmap/README.md @@ -37,10 +37,6 @@ Header shape (mirroring existing components such as `Fir.hpp`): ```cpp #pragma once -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC push_options -#pragma GCC optimize("O3", "fast-math") -#endif #include "numerical/math/CompilerOptimizations.hpp" namespace @@ -57,10 +53,6 @@ namespace extern template class ; #endif } - -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC pop_options -#endif ``` Coverage `.cpp`: diff --git a/roadmap/math/SE3Transform/implementation.md b/roadmap/math/SE3Transform/implementation.md index 4e90173f..942b4983 100644 --- a/roadmap/math/SE3Transform/implementation.md +++ b/roadmap/math/SE3Transform/implementation.md @@ -77,8 +77,8 @@ function Log(): # inverse of Exp ## Deployment -- Header: `numerical/math/SE3Transform.hpp` — `#pragma once` → - `#pragma GCC optimize("O3","fast-math")`, `OPTIMIZE_FOR_SPEED` on `operator*`/`Apply`, and +- Header: `numerical/math/SE3Transform.hpp` — `#pragma once`, `OPTIMIZE_FOR_SPEED` on + `operator*`/`Apply`, and `extern template class SE3;` under `#ifdef NUMERICAL_TOOLBOX_COVERAGE_BUILD`. - Coverage: `numerical/math/SE3Transform.cpp` → `template class SE3;` - Test: `numerical/math/test/TestSE3Transform.cpp`