added test_mix_3
This commit is contained in:
@@ -89,6 +89,11 @@ class Buffer
|
||||
return m_capacity/m_increment;
|
||||
}
|
||||
|
||||
T *raw() const
|
||||
{
|
||||
return &m_buffer[m_index];
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_index = 0;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user