added test_mix_3

This commit is contained in:
2025-11-08 16:22:30 +01:00
parent 273029e627
commit 01d644b76e
3 changed files with 48 additions and 1 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ INCLUDES += -I $(realpath .) -I $(realpath ../../)
CXX_SRCS := test_main.cpp test_buffer.cpp test_buffer_multi.cpp test_mix.cpp
LIBS := -lstdc++
LIBS := -lstdc++ -lm
run: link
@echo Running $(TARGET)
+42
View File
@@ -5,6 +5,7 @@
#include <cstdio>
#include <iostream>
#include <ostream>
int test_mix_1()
@@ -71,9 +72,50 @@ int test_mix_2()
return 0;
}
int test_mix_3()
{
const int nCh = 5;
dsp::BufferMulti<double> r_buf(nCh, 10);
for (int i=0; i < r_buf.capacity(); i++)
{
r_buf = (double)i/10 ;
++r_buf;
}
// r_buf.reset();
dsp::Buffer<double> qbuf(r_buf.quer({-2, -10, -4, 3, -3}));
dsp::Buffer<double> sbuf(nCh);
dsp::Buffer<double> s_spec = {-1, 0, -3, 2, -4};
Shuffle<double>::outOfPlace(qbuf, sbuf, s_spec);
double *q = sbuf.raw();
for (int i=0; i < nCh; i++)
{
std::cout << q[i] << " ";
}
std::cout << std::endl;
Hadamard<double, nCh>::inPlace(q);
for (int i=0; i < nCh; i++)
{
std::cout << q[i] << " ";
}
std::cout << std::endl;
Householder<double, nCh>::inPlace(q);
for (int i=0; i < nCh; i++)
{
std::cout << q[i] << " ";
}
std::cout << std::endl;
return 0;
}
int test_mix()
{
test_mix_1();
test_mix_2();
test_mix_3();
return 0;
}