mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
added clamp()
This commit is contained in:
parent
82ce34dea3
commit
5c456aae28
1 changed files with 6 additions and 0 deletions
6
utils.hh
6
utils.hh
|
|
@ -22,6 +22,12 @@ AB lerp(AB a, AB b, X x)
|
||||||
return (X(1) - x) * a + x * b;
|
return (X(1) - x) * a + x * b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE clamp(TYPE x, TYPE a, TYPE b)
|
||||||
|
{
|
||||||
|
return x < a ? a : x > b ? b : x;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename TYPE>
|
template <typename TYPE>
|
||||||
TYPE normal_pdf(TYPE x, TYPE m, TYPE s)
|
TYPE normal_pdf(TYPE x, TYPE m, TYPE s)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue