Skip to content
This repository was archived by the owner on Aug 12, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ set(LIBINCLUDE
iir/Utilities.h)

add_library(iir
SHARED
${LIBSRC}
)

target_include_directories(iir PRIVATE iir)

set_target_properties(iir PROPERTIES
SOVERSION 1
VERSION ${PROJECT_VERSION}
PUBLIC_HEADER Iir.h
PRIVATE_HEADER "${LIBINCLUDE}")
Expand All @@ -65,22 +63,3 @@ install(TARGETS iir
PRIVATE_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/iir)

configure_file(iir.pc.in iir.pc @ONLY)

add_library(iir_static
STATIC
${LIBSRC}
)

target_include_directories(iir_static PRIVATE iir)

set_target_properties(iir_static PROPERTIES
VERSION ${PROJECT_VERSION}
PUBLIC_HEADER Iir.h
PRIVATE_HEADER "${LIBINCLUDE}")

install(TARGETS iir_static
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PRIVATE_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/iir)

2 changes: 1 addition & 1 deletion demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)

add_executable (iirdemo iirdemo.cpp)
target_link_libraries(iirdemo iir_static)
target_link_libraries(iirdemo iir)
target_include_directories(iirdemo PRIVATE ..)
7 changes: 4 additions & 3 deletions iir/MathSupplement.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@ THE SOFTWARE.

#include<complex>


namespace Iir {

const double doublePi =3.1415926535897932384626433832795028841971;
const double doublePi_2 =1.5707963267948966192313216916397514420986;
const double doubleLn2 =0.69314718055994530941723212145818;//?????
const double doubleLn10 =2.3025850929940456840179914546844;//??????

template<> class DllExport std::complex<double>;
#ifdef _WIN64
template<> class DllExport std::complex<double>;
#endif
typedef std::complex<double> complex_t;
typedef std::pair<complex_t, complex_t> complex_pair_t;

Expand Down Expand Up @@ -90,7 +91,7 @@ template <typename Ty>
inline std::complex<Ty> recip (const std::complex<Ty>& c)
{
Ty n = 1.0 / std::norm (c);

return std::complex<Ty> (n * c.real(), n * c.imag());
}

Expand Down
29 changes: 0 additions & 29 deletions iir/PoleFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,6 @@ BandPassTransform::BandPassTransform (double fc,
ComplexPair p1 = transform (pair.poles.first);
ComplexPair z1 = transform (pair.zeros.first);

//
// Optimize out the calculations for conjugates for Release builds
//
#ifndef NDEBUG
ComplexPair p2 = transform (pair.poles.second);
ComplexPair z2 = transform (pair.zeros.second);
assert (p2.first == std::conj (p1.first));
assert (p2.second == std::conj (p1.second));
#endif

digital.addPoleZeroConjugatePairs (p1.first, z1.first);
digital.addPoleZeroConjugatePairs (p1.second, z1.second);
}
Expand Down Expand Up @@ -266,29 +256,10 @@ BandStopTransform::BandStopTransform (double fc,
ComplexPair z = transform (pair.zeros.first);

//
// Optimize out the calculations for conjugates for Release builds
//
#ifdef NDEBUG
// trick to get the conjugate
if (z.second == z.first)
z.second = std::conj (z.first);

#else
// Do the full calculation to verify correctness
ComplexPair pc = transform (analog[i].poles.second);
ComplexPair zc = transform (analog[i].zeros.second);

// get the conjugates into pc and zc
if (zc.first == z.first)
std::swap (zc.first, zc.second);

assert (pc.first == std::conj (p.first));
assert (pc.second == std::conj (p.second));
assert (zc.first == std::conj (z.first));
assert (zc.second == std::conj (z.second));

#endif

digital.addPoleZeroConjugatePairs (p.first, z.first);
digital.addPoleZeroConjugatePairs (p.second, z.second);
}
Expand Down
12 changes: 6 additions & 6 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ include_directories(
)

add_executable (test_butterworth butterworth.cpp)
target_link_libraries(test_butterworth iir_static)
target_link_libraries(test_butterworth iir)
add_test(TestButterworth test_butterworth)

add_executable (test_bessel bessel.cpp)
target_link_libraries(test_bessel iir_static)
target_link_libraries(test_bessel iir)
add_test(TestBessel test_bessel)

add_executable (test_chebyshev1 chebyshev1.cpp)
target_link_libraries(test_chebyshev1 iir_static)
target_link_libraries(test_chebyshev1 iir)
add_test(TestChebyshev1 test_chebyshev1)

add_executable (test_chebyshev2 chebyshev2.cpp)
target_link_libraries(test_chebyshev2 iir_static)
target_link_libraries(test_chebyshev2 iir)
add_test(TestChebyshev2 test_chebyshev2)

add_executable (test_elliptic elliptic.cpp)
target_link_libraries(test_elliptic iir_static)
target_link_libraries(test_elliptic iir)
add_test(TestElliptic test_elliptic)

add_executable (test_rbj rbj.cpp)
target_link_libraries(test_rbj iir_static)
target_link_libraries(test_rbj iir)
add_test(TestRBJ test_rbj)