VapourSynth-llvmexpr
Loading...
Searching...
No Matches
Math.hpp File Reference
#include <format>
#include <functional>
#include <map>
#include <numbers>
#include <string>
#include <tuple>
#include <utility>
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/Verifier.h"
Include dependency graph for Math.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MathopInfo
class  MathFunctionGenerator< VectorWidth >
struct  MathFunctionImpl< VectorWidth, MathOp::Exp >
struct  MathFunctionImpl< VectorWidth, MathOp::Log >
struct  MathFunctionImpl< VectorWidth, MathOp::Sin >
struct  MathFunctionImpl< VectorWidth, MathOp::Cos >
struct  MathFunctionImpl< VectorWidth, MathOp::Tan >
struct  MathFunctionImpl< VectorWidth, MathOp::Atan >
struct  MathFunctionImpl< VectorWidth, MathOp::Atan2 >
struct  MathFunctionImpl< VectorWidth, MathOp::Acos >
struct  MathFunctionImpl< VectorWidth, MathOp::Asin >
class  MathLibraryManager

Typedefs

using SupportedVectorWidths = std::integer_sequence<int>
using SupportedMathOpsTuple

Enumerations

enum class  MathOp : std::uint8_t {
  Exp , Log , Sin , Cos ,
  Tan , Atan , Atan2 , Acos ,
  Asin
}

Functions

constexpr MathopInfo get_math_op_info (MathOp op)

Typedef Documentation

◆ SupportedMathOpsTuple

Initial value:
std::tuple<std::integral_constant<MathOp, MathOp::Exp>,
std::integral_constant<MathOp, MathOp::Log>,
std::integral_constant<MathOp, MathOp::Sin>,
std::integral_constant<MathOp, MathOp::Cos>,
std::integral_constant<MathOp, MathOp::Tan>,
std::integral_constant<MathOp, MathOp::Atan>,
std::integral_constant<MathOp, MathOp::Atan2>,
std::integral_constant<MathOp, MathOp::Acos>,
std::integral_constant<MathOp, MathOp::Asin>>

Definition at line 749 of file Math.hpp.

◆ SupportedVectorWidths

using SupportedVectorWidths = std::integer_sequence<int>

Definition at line 119 of file Math.hpp.

Enumeration Type Documentation

◆ MathOp

enum class MathOp : std::uint8_t
strong

Copyright (C) 2025 yuygfgg

This file is part of Vapoursynth-llvmexpr.

Vapoursynth-llvmexpr is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Vapoursynth-llvmexpr is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Vapoursynth-llvmexpr. If not, see https://www.gnu.org/licenses/.

The implementation of fast math functions is partially borrowed from vapoursynth which is licensed under the GNU Lesser General Public License v2.1.

Copyright (c) 2013-2020 Fredrik Mellbin

This file is part of VapourSynth.

VapourSynth is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

VapourSynth is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with VapourSynth; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

The atan implementation is from a Stack Overflow answer by user njuffa (https://stackoverflow.com/a/23097989), licensed under CC BY-SA 4.0.

The acos implementation is from https://forwardscattering.org/post/66. NOTE: No license was specified on the source website.

Enumerator
Exp 
Log 
Sin 
Cos 
Tan 
Atan 
Atan2 
Acos 
Asin 

Definition at line 69 of file Math.hpp.

69 : std::uint8_t {
70 Exp,
71 Log,
72 Sin,
73 Cos,
74 Tan,
75 Atan,
76 Atan2,
77 Acos,
78 Asin
79};
@ Sin
Definition Math.hpp:72
@ Tan
Definition Math.hpp:74
@ Atan2
Definition Math.hpp:76
@ Asin
Definition Math.hpp:78
@ Atan
Definition Math.hpp:75
@ Exp
Definition Math.hpp:70
@ Log
Definition Math.hpp:71
@ Acos
Definition Math.hpp:77
@ Cos
Definition Math.hpp:73

Function Documentation

◆ get_math_op_info()

MathopInfo get_math_op_info ( MathOp op)
constexpr

Definition at line 86 of file Math.hpp.

86 {
87 switch (op) {
88 case MathOp::Exp:
89 return {.arity = 1, .name = "fast_exp"};
90 case MathOp::Log:
91 return {.arity = 1, .name = "fast_log"};
92 case MathOp::Sin:
93 return {.arity = 1, .name = "fast_sin"};
94 case MathOp::Cos:
95 return {.arity = 1, .name = "fast_cos"};
96 case MathOp::Tan:
97 return {.arity = 1, .name = "fast_tan"};
98 case MathOp::Atan:
99 return {.arity = 1, .name = "fast_atan"};
100 case MathOp::Atan2:
101 return {.arity = 2, .name = "fast_atan2"};
102 case MathOp::Acos:
103 return {.arity = 1, .name = "fast_acos"};
104 case MathOp::Asin:
105 return {.arity = 1, .name = "fast_asin"};
106 }
107}

References Acos, Asin, Atan, Atan2, Cos, Exp, Log, Sin, and Tan.

Referenced by MathFunctionImpl< VectorWidth, MathOp::Acos >::generate(), MathFunctionImpl< VectorWidth, MathOp::Asin >::generate(), MathFunctionImpl< VectorWidth, MathOp::Atan >::generate(), MathFunctionImpl< VectorWidth, MathOp::Atan2 >::generate(), MathFunctionImpl< VectorWidth, MathOp::Cos >::generate(), MathFunctionImpl< VectorWidth, MathOp::Exp >::generate(), MathFunctionImpl< VectorWidth, MathOp::Log >::generate(), MathFunctionImpl< VectorWidth, MathOp::Sin >::generate(), and MathFunctionImpl< VectorWidth, MathOp::Tan >::generate().