2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Color Maps (#752)

* Color Maps

* Make color maps constexpr

[ci skip]

* Add newton fractal example

[ci skip]

* Remove some unused code.

* Make the color map base class generic in size

Fix naming convention
[ci skip]

* Begin documentation.

* Move helper functions from example into tools header

[ci skip]

* Update docs and remove non-ASCII characters from example

* Add image to docs

* Reduce size of virdis_newton_fractal from 1.31MB to 131KB

[ci skip]

* Add performance file

* Don't force linear complexity and fix CI failure for old clang versions

* Convert color_maps to free functions.

* Add missing header and remove constexpr test

* Convert tabs to spaces

[ci skip]

* Fix compile tests and make static constexpr uniform across data

* Add swatches to docs.

* Fix image links in docs

[ci skip]

Co-authored-by: Nick Thompson <nathompson7@protonmail.com>
This commit is contained in:
Matt Borland
2022-02-09 11:19:38 +01:00
committed by GitHub
parent 57cd5cae61
commit 3e950d9e3a
15 changed files with 2325 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
// (C) Copyright Matt Borland 2022.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <array>
#include <random>
#include <limits>
#include <boost/math/tools/color_maps.hpp>
#include <benchmark/benchmark.h>
template <typename Real>
void viridis_bm(benchmark::State& state)
{
std::random_device rd;
std::mt19937_64 gen(rd());
std::uniform_real_distribution<Real> dist(0, 0.125);
Real x = dist(gen);
for (auto _ : state)
{
benchmark::DoNotOptimize(boost::math::tools::viridis(x));
x += std::numeric_limits<Real>::epsilon();
}
}
BENCHMARK_TEMPLATE(viridis_bm, float);
BENCHMARK_TEMPLATE(viridis_bm, double);
BENCHMARK_MAIN();