This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "nibonacci.hpp" | |
int main(int argc, char* argv[]) | |
{ | |
nibonacci<unsigned int, 2> fib = { (unsigned)1,(unsigned)1 }; | |
nibonacci<unsigned int, 3> trib = { (unsigned)1,(unsigned)1, (unsigned)1}; | |
nibonacci<unsigned int, 10> decib = { (unsigned)1,(unsigned)1, (unsigned)(2), | |
(unsigned)1,(unsigned)1, (unsigned)2, | |
(unsigned)1,(unsigned)1, (unsigned)2, | |
(unsigned)1 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "latest_cache.hpp" | |
template<typename T, std::size_t N> | |
class nibonacci { | |
public: | |
template <typename... Ts, | |
typename std::enable_if <all_same<T, Ts>::value, std::size_t>::type = 0> | |
constexpr nibonacci(Ts&&... items) noexcept : lc_{ std::forward<Ts>(items)... } {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define EXECUTE(j) \ | |
{ \ | |
__m256 floats1 = _mm256_load_ps(&datar[b + j]); \ | |
__m256 floats2 = _mm256_load_ps(&datac[b + j]); \ | |
res1 = _mm256_add_ps(res1, _mm256_mul_ps(revKernel[j], floats1)); \ | |
res2 = _mm256_add_ps(res2, _mm256_mul_ps(revKernel[j], floats2)); \ | |
} | |
// becomes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace { | |
latest_cache<unsigned int, 3> trib_cache = { (unsigned int)0,(unsigned int)0,(unsigned int)1 }; | |
} | |
unsigned int trib(unsigned int n) { | |
if (n >= trib_cache.size()) { | |
trib_cache.push_back(trib(n - 1) + trib(n - 2) + trib(n - 3)); | |
return trib_cache.back(); | |
} | |
else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <functional> | |
#include <string> | |
#include <iostream> | |
#include <mutex> | |
#include <array> | |
#include <optional> | |
template<typename T, typename... Ts> | |
using all_same = std::conjunction<std::is_same<T, Ts>...>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
class two_cache { | |
public: | |
two_cache() : first_(0), second_(1), size_(2) {} | |
void push_back(const T& item) { | |
first_ = second_; | |
second_ = item; | |
size_++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned int fib_simp(unsigned int n) { | |
if (n < 2) { | |
return n == 0 ? 0 : 1; | |
} | |
return fib_simp(n - 2) + fib_simp(n - 1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 80000 63 81 123 61 | |
16 80000 122 139 249 106 | |
24 80000 120 312 478 794 | |
32 80000 151 348 584 1085 | |
64 80000 331 574 1111 2518 | |
128 80000 760 1159 2568 5520 | |
256 80000 1611 2670 4009 11440 | |
512 80000 3346 6464 8034 23491 | |
1024 80000 7518 17963 16757 47737 | |
8 800000 628 860 1307 710 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void FIR_rev(float* data, float* output) { | |
int k, b; | |
for (int i = 0; i < 2 * FILTERSIZE; i += 2) { | |
float temp1 = 0, temp2 = 0; | |
k = 0; | |
b = i - 2 * FILTERSIZE + 2; | |
for (int j = 0; j < FILTERSIZE; j++, k += 2) { | |
if (b + k < 0) continue; | |
temp1 += filter_op[j] * data[b + k]; | |
temp2 += filter_op[j] * data[b + k + 1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void FIR(float* data, float* output) { | |
int k; | |
for (int i = 0; i < 2 * FILTERSIZE; i += 2) { | |
float temp1 = 0, temp2 = 0; | |
k = 0; | |
for (int j = 0; j < FILTERSIZE; j++, k += 2) { | |
if (i - k < 0) break; | |
temp1 += filter[j] * data[i - k]; | |
temp2 += filter[j] * data[i - k + 1]; | |
} |
NewerOlder