Skip to content

Commit

Permalink
Merge branch 'main' into fix/operators-again
Browse files Browse the repository at this point in the history
  • Loading branch information
jfalcou authored Aug 29, 2023
2 parents acef24d + 02b32cd commit 48c3e0d
Show file tree
Hide file tree
Showing 56 changed files with 3,094 additions and 55 deletions.
74 changes: 35 additions & 39 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,66 +15,62 @@ concurrency:

jobs:

windows:
runs-on: [windows-2022]
strategy:
fail-fast: false
matrix:
cfg:
- { tool: "-T ClangCL", config: Debug }
- { tool: "-T ClangCL", config: Release }
# - { tool: , config: Debug }
# - { tool: , config: Release }
steps:
- name: Fetch current branch
uses: actions/checkout@v3
- name: Running CMake for MSVC
run: |
mkdir build && cd build
cmake -G "Visual Studio 17 2022" ${{ matrix.cfg.tool }} -A x64 ..
- name: Compiling Unit Tests
run: |
cd build
cmake --build . --target kyosu-test --config ${{ matrix.cfg.config }} --parallel 2
cmake --build . --target kyosu-test --config Release --parallel 2
- name: Running Tests
run: |
cd build
ctest -C ${{ matrix.cfg.config }} --output-on-failure
# windows:
# runs-on: [windows-2022]
# strategy:
# fail-fast: false
# matrix:
# cfg:
# - { tool: "-T ClangCL", config: Debug }
# - { tool: "-T ClangCL", config: Release }
# # - { tool: , config: Debug }
# # - { tool: , config: Release }
# steps:
# - name: Fetch current branch
# uses: actions/checkout@v3
# - name: Running CMake for MSVC
# run: |
# mkdir build && cd build
# cmake -G "Visual Studio 17 2022" ${{ matrix.cfg.tool }} -A x64 ..
# - name: Compiling Unit Tests
# run: |
# cd build
# cmake --build . --target kyosu-test --config ${{ matrix.cfg.config }} --parallel 2
# cmake --build . --target kyosu-test --config Release --parallel 2
# - name: Running Tests
# run: |
# cd build
# ctest -C ${{ matrix.cfg.config }} --output-on-failure

linux:
runs-on: [ubuntu-latest]
container:
image: ghcr.io/jfalcou/compilers:v6
runs-on: [self-hosted]
strategy:
fail-fast: false
matrix:
cfg:
- { compiler: g++-12 , opts: -O0 , linker: }
- { compiler: clang++ , opts: -O0 , linker: }
- { compiler: clang++ , opts: "-O3 -flto -DNDEBUG" , linker: }
- { compiler: g++-12 , opts: "-O3 -flto -DNDEBUG" , linker: }
- { compiler: clang++ , opts: "-O3 -flto -DNDEBUG -stdlib=libc++" , linker: -stdlib=libc++ }
- { compiler: clang++ , opts: "-O0 -stdlib=libc++" , linker: -stdlib=libc++ }
- { compiler: g++-12 , opts: "-O0 -DEVE_NO_FORCEINLINE" }
- { compiler: g++-12 , opts: "-O3 -DNDEBUG" }
- { compiler: clang++ , opts: "-O0 -DEVE_NO_FORCEINLINE" }
- { compiler: clang++ , opts: "-O3 -DNDEBUG" }
steps:
- name: Fetch current branch
uses: actions/checkout@v3
- name: Running CMake for ${{ matrix.cfg.compiler }} with ${{ matrix.cfg.opts }}
run: |
mkdir build && cd build
cmake .. -G Ninja -DCMAKE_CXX_COMPILER=${{ matrix.cfg.compiler }} -DCMAKE_CXX_FLAGS="${{ matrix.cfg.opts }}" -DCMAKE_EXE_LINKER_FLAGS=${{ matrix.cfg.linker }}
cmake .. -G Ninja -DCMAKE_CXX_COMPILER=${{ matrix.cfg.compiler }} -DCMAKE_CXX_FLAGS="${{ matrix.cfg.opts }}"
- name: Running Unit Tests
run: cd build && ninja kyosu-test -j 2 && ctest --output-on-failure -j 2
run: cd build && ninja kyosu-test -j 5 && ctest --output-on-failure -j 5

macosx:
runs-on: [macos-12]
strategy:
fail-fast: false
matrix:
cfg:
- { compiler: g++-12 , opts: -O0 , linker: }
- { compiler: g++-12 , opts: "-O0 -DEVE_NO_FORCEINLINE" , linker: }
# - { compiler: g++-12 , opts: "-O3 -DNDEBUG" , linker: }
# - { compiler: clang++ , opts: -O0 , linker: }
# - { compiler: clang++ , opts: "-O0" , linker: }
# - { compiler: clang++ , opts: "-O3 -flto -DNDEBUG" , linker: }
# - { compiler: clang++ , opts: "-O3 -flto -DNDEBUG -stdlib=libc++" , linker: -stdlib=libc++ }
# - { compiler: clang++ , opts: "-O0 -stdlib=libc++" , linker: -stdlib=libc++ }
Expand Down
17 changes: 17 additions & 0 deletions include/kyosu/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@
#include <kyosu/functions/ceil.hpp>
#include <kyosu/functions/conj.hpp>
#include <kyosu/functions/convert.hpp>
#include <kyosu/functions/cosh.hpp>
#include <kyosu/functions/coth.hpp>
#include <kyosu/functions/dec.hpp>
#include <kyosu/functions/dist.hpp>
#include <kyosu/functions/exp.hpp>
#include <kyosu/functions/exp2.hpp>
#include <kyosu/functions/exp10.hpp>
#include <kyosu/functions/expm1.hpp>
#include <kyosu/functions/expmx2.hpp>
#include <kyosu/functions/expx2.hpp>
#include <kyosu/functions/exp_i.hpp>
#include <kyosu/functions/exp_ipi.hpp>
#include <kyosu/functions/floor.hpp>
#include <kyosu/functions/frac.hpp>
#include <kyosu/functions/if_else.hpp>
Expand All @@ -34,15 +44,22 @@
#include <kyosu/functions/is_not_finite.hpp>
#include <kyosu/functions/is_not_infinite.hpp>
#include <kyosu/functions/is_not_nan.hpp>
#include <kyosu/functions/is_not_real.hpp>
#include <kyosu/functions/is_real.hpp>
#include <kyosu/functions/jpart.hpp>
#include <kyosu/functions/kpart.hpp>
#include <kyosu/functions/lerp.hpp>
#include <kyosu/functions/minus.hpp>
#include <kyosu/functions/nearest.hpp>
#include <kyosu/functions/oneminus.hpp>
#include <kyosu/functions/pure.hpp>
#include <kyosu/functions/purepart.hpp>
#include <kyosu/functions/real.hpp>
#include <kyosu/functions/rec.hpp>
#include <kyosu/functions/reldist.hpp>
#include <kyosu/functions/sinh.hpp>
#include <kyosu/functions/sinhcosh.hpp>
#include <kyosu/functions/sqr_abs.hpp>
#include <kyosu/functions/sqr.hpp>
#include <kyosu/functions/tanh.hpp>
#include <kyosu/functions/trunc.hpp>
74 changes: 74 additions & 0 deletions include/kyosu/functions/cosh.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//======================================================================================================================
/*
Kyosu - Complex Without Complexes
Copyright : KYOSU Contributors & Maintainers
SPDX-License-Identifier: BSL-1.0
*/
//======================================================================================================================
#pragma once

#include <kyosu/details/invoke.hpp>
#include <eve/module/math.hpp>

namespace kyosu::tags
{
struct callable_cosh : eve::elementwise
{
using callable_tag_type = callable_cosh;

KYOSU_DEFERS_CALLABLE(cosh_);

template<eve::ordered_value T>
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::cosh(v); }

template<typename T>
KYOSU_FORCEINLINE auto operator()(T const& target) const noexcept -> decltype(eve::tag_invoke(*this, target))
{
return eve::tag_invoke(*this, target);
}

template<typename... T>
eve::unsupported_call<callable_cosh(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
};
}

namespace kyosu
{
//======================================================================================================================
//! @addtogroup functions
//! @{
//! @var cosh
//! @brief Computes the hyperbolic cosine of the argument.
//!
//! **Defined in Header**
//!
//! @code
//! #include <kyosu/functions.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace kyosu
//! {
//! template<kyosu::concepts::cayley_dickson T> constexpr T cosh(T z) noexcept;
//! template<eve::ordered_value T> constexpr T cosh(T z) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `z` : Value to process.
//!
//! **Return value**
//!
//! Returns the hyperbolic cosine of the argument.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/cosh.cpp}
//! @}
//======================================================================================================================
inline constexpr tags::callable_cosh cosh = {};
}
74 changes: 74 additions & 0 deletions include/kyosu/functions/coth.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//======================================================================================================================
/*
Kyosu - Complex Without Complexes
Copyright : KYOSU Contributors & Maintainers
SPDX-License-Identifier: BSL-1.0
*/
//======================================================================================================================
#pragma once

#include <kyosu/details/invoke.hpp>
#include <eve/module/math.hpp>

namespace kyosu::tags
{
struct callable_coth : eve::elementwise
{
using callable_tag_type = callable_coth;

KYOSU_DEFERS_CALLABLE(coth_);

template<eve::ordered_value T>
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::coth(v); }

template<typename T>
KYOSU_FORCEINLINE auto operator()(T const& target) const noexcept -> decltype(eve::tag_invoke(*this, target))
{
return eve::tag_invoke(*this, target);
}

template<typename... T>
eve::unsupported_call<callable_coth(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
};
}

namespace kyosu
{
//======================================================================================================================
//! @addtogroup functions
//! @{
//! @var coth
//! @brief Computes the hyperbolic cotangent of the argument.
//!
//! **Defined in Header**
//!
//! @code
//! #include <kyosu/functions.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace kyosu
//! {
//! template<kyosu::concepts::cayley_dickson T> constexpr T coth(T z) noexcept;
//! template<eve::ordered_value T> constexpr T coth(T z) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `z` : Value to process.
//!
//! **Return value**
//!
//! Returns the hyperbolic cotangent of the argument.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/coth.cpp}
//! @}
//======================================================================================================================
inline constexpr tags::callable_coth coth = {};
}
74 changes: 74 additions & 0 deletions include/kyosu/functions/exp.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//======================================================================================================================
/*
Kyosu - Complex Without Complexes
Copyright : KYOSU Contributors & Maintainers
SPDX-License-Identifier: BSL-1.0
*/
//======================================================================================================================
#pragma once

#include <kyosu/details/invoke.hpp>
#include <eve/module/math.hpp>

namespace kyosu::tags
{
struct callable_exp : eve::elementwise
{
using callable_tag_type = callable_exp;

KYOSU_DEFERS_CALLABLE(exp_);

template<eve::ordered_value T>
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::exp(v); }

template<typename T>
KYOSU_FORCEINLINE auto operator()(T const& target) const noexcept -> decltype(eve::tag_invoke(*this, target))
{
return eve::tag_invoke(*this, target);
}

template<typename... T>
eve::unsupported_call<callable_exp(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
};
}

namespace kyosu
{
//======================================================================================================================
//! @addtogroup functions
//! @{
//! @var exp
//! @brief Computes the exponential of the argument.
//!
//! **Defined in Header**
//!
//! @code
//! #include <kyosu/functions.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace kyosu
//! {
//! template<kyosu::concepts::cayley_dickson T> constexpr T exp(T z) noexcept;
//! template<eve::ordered_value T> constexpr T exp(T z) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `z` : Value to process.
//!
//! **Return value**
//!
//! Returns the exponential of the argument.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/exp.cpp}
//! @}
//======================================================================================================================
inline constexpr tags::callable_exp exp = {};
}
Loading

0 comments on commit 48c3e0d

Please sign in to comment.