diff --git a/dspl/Makefile b/dspl/Makefile index 68c8465..86717d4 100644 --- a/dspl/Makefile +++ b/dspl/Makefile @@ -4,9 +4,60 @@ include ../make.inc # C-compiler flags CFLAGS = -c -fPIC -Wall -O3 -I$(INC_DIR) -Isrc -DBUILD_LIB -D$(DEF_OS) -# DSPL src and obj files list -DSPL_SRC_FILES = $(wildcard $(DSPL_SRC_DIR)/*.c) -DSPL_OBJ_FILES = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(DSPL_SRC_FILES:.c=.o))) +# DSPL src list according to pathes +ARRAY_C = $(wildcard $(DSPL_SRC_DIR)/array/*.c) +CONV_C = $(wildcard $(DSPL_SRC_DIR)/convolution/*.c) +DFT_C = $(wildcard $(DSPL_SRC_DIR)/dft/*.c) +FILTER_C = $(wildcard $(DSPL_SRC_DIR)/filter_design/*.c) +GNUPLOT_C = $(wildcard $(DSPL_SRC_DIR)/gnuplot/*.c) +INOUT_C = $(wildcard $(DSPL_SRC_DIR)/inout/*.c) +MATH_ELLIPJ_C = $(wildcard $(DSPL_SRC_DIR)/math_ellipj/*.c) +MATH_MATRIX_C = $(wildcard $(DSPL_SRC_DIR)/math_matrix/*.c) +MATH_POLY_C = $(wildcard $(DSPL_SRC_DIR)/math_poly/*.c) +MATH_STAT_C = $(wildcard $(DSPL_SRC_DIR)/math_stat/*.c) +MATH_STD_C = $(wildcard $(DSPL_SRC_DIR)/math_std/*.c) +PSD_C = $(wildcard $(DSPL_SRC_DIR)/psd/*.c) +RANDOM_C = $(wildcard $(DSPL_SRC_DIR)/randomgen/*.c) +RESAMPLING_C = $(wildcard $(DSPL_SRC_DIR)/resampling/*.c) +SIGNALS_C = $(wildcard $(DSPL_SRC_DIR)/signals/*.c) +TYPES_C = $(wildcard $(DSPL_SRC_DIR)/types/*.c) + +# DSPL OBJ list according to pathes +ARRAY_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(ARRAY_C:.c=.o))) +CONV_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(CONV_C:.c=.o))) +DFT_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(DFT_C:.c=.o))) +FILTER_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(FILTER_C:.c=.o))) +GNUPLOT_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(GNUPLOT_C:.c=.o))) +INOUT_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(INOUT_C:.c=.o))) +MATH_ELLIPJ_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(MATH_ELLIPJ_C:.c=.o))) +MATH_MATRIX_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(MATH_MATRIX_C:.c=.o))) +MATH_POLY_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(MATH_POLY_C:.c=.o))) +MATH_STAT_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(MATH_STAT_C:.c=.o))) +MATH_STD_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(MATH_STD_C:.c=.o))) +PSD_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(PSD_C:.c=.o))) +RANDOM_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(RANDOM_C:.c=.o))) +RESAMPLING_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(RESAMPLING_C:.c=.o))) +SIGNALS_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(SIGNALS_C:.c=.o))) +TYPES_O = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(TYPES_C:.c=.o))) + + +DSPL_OBJ_FILES = $(ARRAY_O)\ + $(CONV_O)\ + $(DFT_O)\ + $(FILTER_O)\ + $(GNUPLOT_O)\ + $(INOUT_O)\ + $(MATH_ELLIPJ_O)\ + $(MATH_MATRIX_O)\ + $(MATH_POLY_O)\ + $(MATH_STAT_O)\ + $(MATH_STD_O)\ + $(PSD_O)\ + $(RANDOM_O)\ + $(RESAMPLING_O)\ + $(SIGNALS_O)\ + $(TYPES_O)\ + all: $(RELEASE_DIR)/$(LIB_NAME)\ $(EXAMPLE_BIN_DIR)/$(LIB_NAME)\ @@ -22,8 +73,39 @@ $(RELEASE_DIR)/$(LIB_NAME): $(DSPL_OBJ_FILES) $(BLAS_LIB_NAME) $(LAPACK_DOUBLE_ #Compile libdspl obj files from c sources -$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/%.c +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/array/%.c $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/convolution/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/dft/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/filter_design/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/gnuplot/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/inout/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/math_ellipj/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/math_matrix/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/math_poly/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/math_stat/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/math_std/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/psd/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/randomgen/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/resampling/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/signals/%.c + $(CC) $(CFLAGS) $< -o $@ -lm +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/types/%.c + $(CC) $(CFLAGS) $< -o $@ -lm + #Copy libdspl.dll to the examples "bin" folder $(EXAMPLE_BIN_DIR)/$(LIB_NAME):$(RELEASE_DIR)/$(LIB_NAME) diff --git a/dspl/Makefile.back b/dspl/Makefile.back new file mode 100644 index 0000000..68c8465 --- /dev/null +++ b/dspl/Makefile.back @@ -0,0 +1,65 @@ + +include ../make.inc + +# C-compiler flags +CFLAGS = -c -fPIC -Wall -O3 -I$(INC_DIR) -Isrc -DBUILD_LIB -D$(DEF_OS) + +# DSPL src and obj files list +DSPL_SRC_FILES = $(wildcard $(DSPL_SRC_DIR)/*.c) +DSPL_OBJ_FILES = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(DSPL_SRC_FILES:.c=.o))) + +all: $(RELEASE_DIR)/$(LIB_NAME)\ + $(EXAMPLE_BIN_DIR)/$(LIB_NAME)\ + $(PERFORMANCE_BIN_DIR)/$(LIB_NAME)\ + $(VERIFICATION_BIN_DIR)/$(LIB_NAME)\ + $(RELEASE_DIR)/dspl.c\ + $(RELEASE_DIR)/dspl.h + +#Build libdspl.dll or libdspl.so +$(RELEASE_DIR)/$(LIB_NAME): $(DSPL_OBJ_FILES) $(BLAS_LIB_NAME) $(LAPACK_DOUBLE_LIB_NAME) $(LAPACK_COMPLEX_LIB_NAME) + $(CC) -shared -o $(RELEASE_DIR)/$(LIB_NAME) $(DSPL_OBJ_FILES) -lm -L$(LAPACK_RELEASE_DIR) -llapack_complex -llapack_double -L$(BLAS_RELEASE_DIR) -lblas -lgfortran -lquadmath + + + +#Compile libdspl obj files from c sources +$(DSPL_OBJ_DIR)/%.o:$(DSPL_SRC_DIR)/%.c + $(CC) $(CFLAGS) $< -o $@ -lm + +#Copy libdspl.dll to the examples "bin" folder +$(EXAMPLE_BIN_DIR)/$(LIB_NAME):$(RELEASE_DIR)/$(LIB_NAME) + cp $(RELEASE_DIR)/$(LIB_NAME) $(EXAMPLE_BIN_DIR)/$(LIB_NAME) + +#Copy libdspl.dll to the performance testing "bin" folder +$(PERFORMANCE_BIN_DIR)/$(LIB_NAME):$(RELEASE_DIR)/$(LIB_NAME) + cp $(RELEASE_DIR)/$(LIB_NAME) $(PERFORMANCE_BIN_DIR)/$(LIB_NAME) + +#Copy libdspl.dll to the verification "bin" folder +$(VERIFICATION_BIN_DIR)/$(LIB_NAME):$(RELEASE_DIR)/$(LIB_NAME) + cp $(RELEASE_DIR)/$(LIB_NAME) $(VERIFICATION_BIN_DIR)/$(LIB_NAME) + +#make BLAS library +$(BLAS_LIB_NAME): + $(MAKE) -C blas + +#make LAPACK library for the real data +$(LAPACK_DOUBLE_LIB_NAME): + $(MAKE) -C lapack + +#make LAPACK library for the complex data +$(LAPACK_COMPLEX_LIB_NAME): + $(MAKE) -C lapack + +#Copy dspl.c source to the release folder +$(RELEASE_DIR)/dspl.c: + cp $(INC_DIR)/dspl.c $(RELEASE_DIR)/dspl.c + +#Copy dspl.h header to the release folder +$(RELEASE_DIR)/dspl.h: + cp $(INC_DIR)/dspl.h $(RELEASE_DIR)/dspl.h + + +clean: + rm -f $(DSPL_OBJ_DIR)/*.o + rm -f $(RELEASE_DIR)/*.a + rm -f $(RELEASE_DIR)/*.def + diff --git a/dspl/src/array.c b/dspl/src/array.c deleted file mode 100644 index b5d8c7a..0000000 --- a/dspl/src/array.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "array/array_scale_lin.c" -#include "array/concat.c" -#include "array/decimate.c" -#include "array/decimate_cmplx.c" -#include "array/find_nearest.c" -#include "array/flipip.c" -#include "array/flipip_cmplx.c" -#include "array/linspace.c" -#include "array/logspace.c" -#include "array/ones.c" -#include "array/sum.c" -#include "array/sum_sqr.c" - -#include "array/verif.c" -#include "array/verif_cmplx.c" - - - diff --git a/dspl/src/convolution.c b/dspl/src/convolution.c deleted file mode 100644 index 29996d7..0000000 --- a/dspl/src/convolution.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "convolution/conv.c" -#include "convolution/conv_cmplx.c" -#include "convolution/conv_fft.c" -#include "convolution/conv_fft_cmplx.c" -#include "convolution/filter_iir.c" \ No newline at end of file diff --git a/dspl/src/dft.c b/dspl/src/dft.c deleted file mode 100644 index 759b74e..0000000 --- a/dspl/src/dft.c +++ /dev/null @@ -1,53 +0,0 @@ - -/* -Discrete Fourier Transform Algorithms -*/ -#include "dft/dft.c" -#include "dft/dft_cmplx.c" -#include "dft/idft_cmplx.c" - -/* -Fast Fourier Transform Algrithms -*/ -#include "dft/fft.c" -#include "dft/fft_abs.c" -#include "dft/fft_abs_cmplx.c" -#include "dft/fft_cmplx.c" -#include "dft/fft_create.c" -#include "dft/fft_free.c" -#include "dft/fft_krn.c" -#include "dft/fft_mag.c" -#include "dft/fft_mag_cmplx.c" -#include "dft/fft_shift.c" -#include "dft/fft_shift_cmplx.c" -#include "dft/fft_subkernel.c" -#include "dft/ifft_cmplx.c" - - -/* -Goertzel Algorithm -*/ -#include "dft/goertzel.c" -#include "dft/goertzel_cmplx.c" - - -/* -Fourier Series and Fourier Intergral -*/ -#include "dft/fourier_series_dec.c" -#include "dft/fourier_series_dec_cmplx.c" -#include "dft/fourier_integral_cmplx.c" -#include "dft/fourier_series_rec.c" - - - - - - - - - - - - - diff --git a/dspl/src/filter_design.c b/dspl/src/filter_design.c deleted file mode 100644 index 04e6a02..0000000 --- a/dspl/src/filter_design.c +++ /dev/null @@ -1,58 +0,0 @@ - - -/* -FILTER_ANALYSIS_GROUP -*/ -#include "filter_design/group_delay.c" -#include "filter_design/filter_freq_resp.c" -#include "filter_design/freqs.c" -#include "filter_design/freqs_cmplx.c" -#include "filter_design/freqs2time.c" -#include "filter_design/freqz.c" -#include "filter_design/phase_delay.c" - - - -/* -Analog Normilized Prototypes -*/ -#include "filter_design/butter_ap.c" -#include "filter_design/butter_ap_zp.c" -#include "filter_design/cheby1_ap.c" -#include "filter_design/cheby1_ap_zp.c" -#include "filter_design/cheby2_ap.c" -#include "filter_design/cheby2_ap_wp1.c" -#include "filter_design/cheby2_ap_zp.c" -#include "filter_design/ellip_ap.c" -#include "filter_design/ellip_ap_zp.c" -#include "filter_design/filter_zp2ab.c" - - - -/* -Filters Frequency Transformation -*/ -#include "filter_design/filter_ws1.c" -#include "filter_design/low2bp.c" -#include "filter_design/low2bs.c" -#include "filter_design/low2high.c" -#include "filter_design/low2low.c" -#include "filter_design/ratcompos.c" - - -/* -FIR design -*/ -#include "filter_design/fir_linphase.c" - - -/* -IIR design -*/ -#include "filter_design/bilinear.c" -#include "filter_design/iir.c" - -/* -window functions -*/ -#include "filter_design/win.c" \ No newline at end of file diff --git a/dspl/src/gnuplot.c b/dspl/src/gnuplot.c deleted file mode 100644 index 994f834..0000000 --- a/dspl/src/gnuplot.c +++ /dev/null @@ -1,5 +0,0 @@ - -#include "gnuplot/gnuplot_close.c" -#include "gnuplot/gnuplot_cmd.c" -#include "gnuplot/gnuplot_create.c" -#include "gnuplot/gnuplot_open.c" \ No newline at end of file diff --git a/dspl/src/inout.c b/dspl/src/inout.c deleted file mode 100644 index b205620..0000000 --- a/dspl/src/inout.c +++ /dev/null @@ -1,23 +0,0 @@ - -#include "inout/addlog.c" -#include "inout/dspl_info.c" -#include "inout/readbin.c" -#include "inout/writebin.c" -#include "inout/writetxt.c" -#include "inout/writetxt_cmplx.c" -#include "inout/writetxt_int.c" -#include "inout/writetxt_3d.c" -#include "inout/writetxt_3dline.c" -#include "inout/writetxt_cmplx_re.c" -#include "inout/writetxt_cmplx_im.c" - -#include "inout/verif_data_gen.c" -#include "inout/verif_str.c" -#include "inout/verif_str_cmplx.c" - - - - - - - diff --git a/dspl/src/math_ellipj.c b/dspl/src/math_ellipj.c deleted file mode 100644 index a467ef7..0000000 --- a/dspl/src/math_ellipj.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "math_ellipj/ellip_acd.c" -#include "math_ellipj/ellip_acd_cmplx.c" -#include "math_ellipj/ellip_asn.c" -#include "math_ellipj/ellip_asn_cmplx.c" -#include "math_ellipj/ellip_cd.c" -#include "math_ellipj/ellip_cd_cmplx.c" -#include "math_ellipj/ellip_landen.c" -#include "math_ellipj/ellip_modulareq.c" -#include "math_ellipj/ellip_rat.c" -#include "math_ellipj/ellip_sn.c" -#include "math_ellipj/ellip_sn_cmplx.c" diff --git a/dspl/src/math_matrix.c b/dspl/src/math_matrix.c deleted file mode 100644 index 41835d1..0000000 --- a/dspl/src/math_matrix.c +++ /dev/null @@ -1,20 +0,0 @@ - - -#include "math_matrix/matrix_eig_cmplx.c" -#include "math_matrix/matrix_eye.c" -#include "math_matrix/matrix_eye_cmplx.c" -#include "math_matrix/matrix_mul.c" -#include "math_matrix/matrix_pinv.c" -#include "math_matrix/matrix_print.c" -#include "math_matrix/matrix_print_cmplx.c" -#include "math_matrix/matrix_svd.c" -#include "math_matrix/matrix_transpose.c" -#include "math_matrix/matrix_transpose_cmplx.c" -#include "math_matrix/matrix_transpose_hermite.c" -#include "math_matrix/vector_dot.c" - - - - - - diff --git a/dspl/src/math_poly.c b/dspl/src/math_poly.c deleted file mode 100644 index eac513d..0000000 --- a/dspl/src/math_poly.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#include "math_poly/poly_z2a_cmplx.c" -#include "math_poly/polyroots.c" -#include "math_poly/polyval.c" -#include "math_poly/polyval_cmplx.c" - - -#include "math_poly/cheby_poly1.c" -#include "math_poly/cheby_poly2.c" diff --git a/dspl/src/math_stat.c b/dspl/src/math_stat.c deleted file mode 100644 index 4c5d406..0000000 --- a/dspl/src/math_stat.c +++ /dev/null @@ -1,11 +0,0 @@ - -#include "math_stat/find_max_abs.c" -#include "math_stat/histogram.c" -#include "math_stat/histogram_norm.c" -#include "math_stat/mean.c" -#include "math_stat/mean_cmplx.c" -#include "math_stat/minmax.c" -#include "math_stat/stat_std.c" -#include "math_stat/stat_std_cmplx.c" - -#include "math_stat/xcorr.c" \ No newline at end of file diff --git a/dspl/src/math_std.c b/dspl/src/math_std.c deleted file mode 100644 index 27ab837..0000000 --- a/dspl/src/math_std.c +++ /dev/null @@ -1,24 +0,0 @@ - - -#include "math_std/acos_cmplx.c" -#include "math_std/asin_cmplx.c" -#include "math_std/bessel_i0.c" -#include "math_std/dmod.c" -#include "math_std/cos_cmplx.c" -#include "math_std/log_cmplx.c" -#include "math_std/sin_cmplx.c" -#include "math_std/sinc.c" -#include "math_std/sine_int.c" -#include "math_std/sqrt_cmplx.c" - - -/* -Numerical integration -*/ -#include "math_std/trapint.c" -#include "math_std/trapint_cmplx.c" - -/* -unwrap algorithm -*/ -#include "math_std/unwrap.c" \ No newline at end of file diff --git a/dspl/src/psd.c b/dspl/src/psd.c deleted file mode 100644 index aa7f984..0000000 --- a/dspl/src/psd.c +++ /dev/null @@ -1,22 +0,0 @@ - - - -#include "psd/psd_bartlett.c" -#include "psd/psd_bartlett_cmplx.c" -#include "psd/psd_periodogram.c" -#include "psd/psd_periodogram_cmplx.c" -#include "psd/psd_welch.c" -#include "psd/psd_welch_cmplx.c" - - - - - - - - - - - - - diff --git a/dspl/src/randomgen.c b/dspl/src/randomgen.c deleted file mode 100644 index 36be580..0000000 --- a/dspl/src/randomgen.c +++ /dev/null @@ -1,17 +0,0 @@ - -#include "randomgen/mt19937.c" -#include "randomgen/randb.c" -#include "randomgen/randb2.c" -#include "randomgen/randi.c" -#include "randomgen/randn.c" -#include "randomgen/randn_cmplx.c" -#include "randomgen/random_init.c" -#include "randomgen/randu.c" -#include "randomgen/randu_mrg32k3a.c" - - - - - - - diff --git a/dspl/src/resampling.c b/dspl/src/resampling.c deleted file mode 100644 index 0ba4f8b..0000000 --- a/dspl/src/resampling.c +++ /dev/null @@ -1,6 +0,0 @@ - - - - -#include "resampling/farrow_lagrange.c" -#include "resampling/farrow_spline.c" \ No newline at end of file diff --git a/dspl/src/signals.c b/dspl/src/signals.c deleted file mode 100644 index df3f7c0..0000000 --- a/dspl/src/signals.c +++ /dev/null @@ -1,6 +0,0 @@ - - -#include "signals/signal_pimp.c" -#include "signals/signal_saw.c" - - diff --git a/dspl/src/types.c b/dspl/src/types.c deleted file mode 100644 index 82869f6..0000000 --- a/dspl/src/types.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "types/cmplx2re.c" -#include "types/re2cmplx.c" \ No newline at end of file diff --git a/examples/src/contour_test.c b/examples/src/contour_test.c index bb01fa2..8612e65 100644 --- a/examples/src/contour_test.c +++ b/examples/src/contour_test.c @@ -9,8 +9,8 @@ typedef double point2d_t[2]; typedef point2d_t linseg_t[2]; - - + + int add_linseg(linseg_t** ls, int* lsnum, int* lscnt, point2d_t* p0, point2d_t* p1) { int n, c;