kopia lustrzana https://github.com/Dsplib/libdspl-2.0
Porównaj commity
7 Commity
524afc8c8b
...
6726287f55
Autor | SHA1 | Data |
---|---|---|
Dsplib | 6726287f55 | |
Dsplib | 35d01e6acc | |
Dsplib | 5911779771 | |
Dsplib | d18c8c4f7e | |
Dsplib | 8c8f977366 | |
Dsplib | c56c49142f | |
Dsplib | a7e76f2b65 |
|
@ -4,9 +4,60 @@ include ../make.inc
|
||||||
# C-compiler flags
|
# C-compiler flags
|
||||||
CFLAGS = -c -fPIC -Wall -O3 -I$(INC_DIR) -Isrc -DBUILD_LIB -D$(DEF_OS)
|
CFLAGS = -c -fPIC -Wall -O3 -I$(INC_DIR) -Isrc -DBUILD_LIB -D$(DEF_OS)
|
||||||
|
|
||||||
# DSPL src and obj files list
|
# DSPL src list according to pathes
|
||||||
DSPL_SRC_FILES = $(wildcard $(DSPL_SRC_DIR)/*.c)
|
ARRAY_C = $(wildcard $(DSPL_SRC_DIR)/array/*.c)
|
||||||
DSPL_OBJ_FILES = $(addprefix $(DSPL_OBJ_DIR)/,$(notdir $(DSPL_SRC_FILES:.c=.o)))
|
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)\
|
all: $(RELEASE_DIR)/$(LIB_NAME)\
|
||||||
$(EXAMPLE_BIN_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
|
#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
|
$(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
|
#Copy libdspl.dll to the examples "bin" folder
|
||||||
$(EXAMPLE_BIN_DIR)/$(LIB_NAME):$(RELEASE_DIR)/$(LIB_NAME)
|
$(EXAMPLE_BIN_DIR)/$(LIB_NAME):$(RELEASE_DIR)/$(LIB_NAME)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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"
|
|
|
@ -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"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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"
|
|
|
@ -1,5 +0,0 @@
|
||||||
|
|
||||||
#include "gnuplot/gnuplot_close.c"
|
|
||||||
#include "gnuplot/gnuplot_cmd.c"
|
|
||||||
#include "gnuplot/gnuplot_create.c"
|
|
||||||
#include "gnuplot/gnuplot_open.c"
|
|
|
@ -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"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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"
|
|
|
@ -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"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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"
|
|
|
@ -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"
|
|
|
@ -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"
|
|
|
@ -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"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "resampling/farrow_lagrange.c"
|
|
||||||
#include "resampling/farrow_spline.c"
|
|
|
@ -1,6 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "signals/signal_pimp.c"
|
|
||||||
#include "signals/signal_saw.c"
|
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#include "types/cmplx2re.c"
|
|
||||||
#include "types/re2cmplx.c"
|
|
|
@ -0,0 +1,339 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "dspl.h"
|
||||||
|
|
||||||
|
#define N 3
|
||||||
|
#define M 4
|
||||||
|
#define BSIZE 256
|
||||||
|
|
||||||
|
typedef double point2d_t[2];
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
point2d_t p[2];
|
||||||
|
int flag;
|
||||||
|
} linseg_t;
|
||||||
|
|
||||||
|
|
||||||
|
int add_linseg(linseg_t** ls, int* lsnum, int* lscnt,
|
||||||
|
point2d_t* p0, point2d_t* p1)
|
||||||
|
|
||||||
|
{
|
||||||
|
int n, c;
|
||||||
|
n = *lsnum;
|
||||||
|
c = *lscnt;
|
||||||
|
// проверяем выделение памяти.
|
||||||
|
if((n == 0) && ((*ls)==NULL))
|
||||||
|
{
|
||||||
|
n = BSIZE;
|
||||||
|
(*ls) = (linseg_t*)malloc(n * sizeof(linseg_t));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// при необходимости увеличиваем
|
||||||
|
if(c >= n)
|
||||||
|
{
|
||||||
|
n += BSIZE;
|
||||||
|
(*ls) = (linseg_t*)realloc((*ls), n * sizeof(linseg_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(*ls)[c].p[0][0] = p0[0][0];
|
||||||
|
(*ls)[c].p[0][1] = p0[0][1];
|
||||||
|
(*ls)[c].p[1][0] = p1[0][0];
|
||||||
|
(*ls)[c].p[1][1] = p1[0][1];
|
||||||
|
(*ls)[c].flag = 1;
|
||||||
|
c++;
|
||||||
|
(*lsnum) = n;
|
||||||
|
(*lscnt) = c;
|
||||||
|
|
||||||
|
return RES_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int linseg_create(double* z, double* x, double* y,
|
||||||
|
int n, int m, double lev,
|
||||||
|
linseg_t** ls, int* sz)
|
||||||
|
{
|
||||||
|
int lsnum, lscnt, t, in, im, i;
|
||||||
|
point2d_t p0 = {0};
|
||||||
|
point2d_t p1 = {0};
|
||||||
|
|
||||||
|
double dx;
|
||||||
|
double dy;
|
||||||
|
|
||||||
|
if((ls== NULL)||(z==NULL))
|
||||||
|
return ERROR_PTR;
|
||||||
|
lsnum = 0;
|
||||||
|
lscnt = 0;
|
||||||
|
|
||||||
|
for(in = 0; in < n-1; in++)
|
||||||
|
{
|
||||||
|
for(im = 0; im < m-1; im++)
|
||||||
|
{
|
||||||
|
i = in + im * n;
|
||||||
|
t = 0;
|
||||||
|
t += z[i] > lev ? 8 : 0;
|
||||||
|
t += z[i+n] > lev ? 4 : 0;
|
||||||
|
t += z[i+n+1] > lev ? 2 : 0;
|
||||||
|
t += z[i+1] > lev ? 1 : 0;
|
||||||
|
|
||||||
|
printf("%d, %d, %d\n", in, im, t);
|
||||||
|
switch(t)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
case 15:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
case 14:
|
||||||
|
// z[i,j] * (1-dx) + z[i+1, j] * dx = lev
|
||||||
|
// z[i,j] + dx *(z[i+1, j] - z[i,j]) = lev
|
||||||
|
dx = (lev - z[i]) / (z[i+1] - z[i]);
|
||||||
|
p0[0] = x[in] + dx;
|
||||||
|
p0[1] = y[im];
|
||||||
|
|
||||||
|
dy = (lev - z[i+1]) / (z[i+n+1] - z[i+1]);
|
||||||
|
p1[0] = x[in+1];
|
||||||
|
p1[1] = y[im] + dy;
|
||||||
|
add_linseg(ls, &lsnum, &lscnt, &p0, &p1);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
case 13:
|
||||||
|
dx = (lev - z[i+n]) / (z[i+n+1] - z[i+n]);
|
||||||
|
p0[0] = x[in] + dx;
|
||||||
|
p0[1] = y[im + 1];
|
||||||
|
|
||||||
|
dy = (lev - z[i+1]) / (z[i+n+1] - z[i+1]);
|
||||||
|
p1[0] = x[in + 1];
|
||||||
|
p1[1] = y[im] + dy;
|
||||||
|
add_linseg(ls, &lsnum, &lscnt, &p0, &p1);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
case 12:
|
||||||
|
dx = (lev - z[i]) / (z[i+1] - z[i]);
|
||||||
|
p0[0] = x[in] + dx;
|
||||||
|
p0[1] = y[im];
|
||||||
|
|
||||||
|
dx = (lev - z[i+n]) / (z[i+n+1] - z[i+n]);
|
||||||
|
p1[0] = x[in] + dx;
|
||||||
|
p1[1] = y[im+1];
|
||||||
|
add_linseg(ls, &lsnum, &lscnt, &p0, &p1);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
case 11:
|
||||||
|
dy = (lev - z[i]) / (z[i+n] - z[i]);
|
||||||
|
p0[0] = x[in];
|
||||||
|
p0[1] = y[im] + dy;
|
||||||
|
|
||||||
|
dx = (lev - z[i+n]) / (z[i+n+1] - z[i+n]);
|
||||||
|
p1[0] = x[in] + dx;
|
||||||
|
p1[1] = y[im + 1];
|
||||||
|
add_linseg(ls, &lsnum, &lscnt, &p0, &p1);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
dy = (lev - z[i]) / (z[i+n] - z[i]);
|
||||||
|
p0[0] = x[in];
|
||||||
|
p0[1] = y[im] + dy;
|
||||||
|
dx = (lev - z[i]) / (z[i+1] - z[i]);
|
||||||
|
p1[0] = x[in] + dx;
|
||||||
|
p1[1] = y[im];
|
||||||
|
add_linseg(ls, &lsnum, &lscnt, &p0, &p1);
|
||||||
|
|
||||||
|
dx = (lev - z[i+n]) / (z[i+n+1] - z[i+n]);
|
||||||
|
p0[0] = x[in]+dx;
|
||||||
|
p0[1] = y[im+1];
|
||||||
|
dy = (lev - z[i+1]) / (z[i+n+1] - z[i+1]);
|
||||||
|
p1[0] = x[in+1];
|
||||||
|
p1[1] = y[im] + dy;
|
||||||
|
add_linseg(ls, &lsnum, &lscnt, &p0, &p1);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
case 9:
|
||||||
|
dy = (lev - z[i]) / (z[i+n] - z[i]);
|
||||||
|
p0[0] = x[in];
|
||||||
|
p0[1] = y[im] + dy;
|
||||||
|
dy = (lev - z[i+1]) / (z[i+n+1] - z[i+1]);
|
||||||
|
p1[0] = x[in+1];
|
||||||
|
p1[1] = y[im];
|
||||||
|
add_linseg(ls, &lsnum, &lscnt, &p0, &p1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
dy = (lev - z[i]) / (z[i+n] - z[i]);
|
||||||
|
p0[0] = x[in];
|
||||||
|
p0[1] = y[im] + dy;
|
||||||
|
dx = (lev - z[i]) / (z[i+1] - z[i]);
|
||||||
|
p1[0] = x[in] + dx;
|
||||||
|
p1[1] = y[im];
|
||||||
|
add_linseg(ls, &lsnum, &lscnt, &p0, &p1);
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
dy = (lev - z[i]) / (z[i+n] - z[i]);
|
||||||
|
p0[0] = x[in];
|
||||||
|
p0[1] = y[im] + dy;
|
||||||
|
dx = (lev - z[i+n]) / (z[i+n+1] - z[i+1]);
|
||||||
|
p1[0] = x[in] + dx;
|
||||||
|
p1[1] = y[im+1];
|
||||||
|
add_linseg(ls, &lsnum, &lscnt, &p0, &p1);
|
||||||
|
|
||||||
|
dx = (lev - z[i]) / (z[i+1] - z[i]);
|
||||||
|
p0[0] = x[in]+dx;
|
||||||
|
p0[1] = y[im];
|
||||||
|
dy = (lev - z[i+1]) / (z[i+n+1] - z[i+1]);
|
||||||
|
p1[0] = x[in+1];
|
||||||
|
p1[1] = y[im] + dy;
|
||||||
|
add_linseg(ls, &lsnum, &lscnt, &p0, &p1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*ls = (linseg_t*)realloc(*ls, lscnt * sizeof(linseg_t));
|
||||||
|
*sz = lscnt;
|
||||||
|
return RES_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double dist(point2d_t* p0, point2d_t* p1)
|
||||||
|
{
|
||||||
|
double dx, dy;
|
||||||
|
dx = p0[0][0] - p1[0][0];
|
||||||
|
dy = p0[0][1] - p1[0][1];
|
||||||
|
return sqrt(dx*dx + dy*dy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int line_create(linseg_t* ls, int nls, point2d_t** line, int* np)
|
||||||
|
{
|
||||||
|
int i, j, c, n;
|
||||||
|
if(!line || !ls || !np)
|
||||||
|
return ERROR_PTR;
|
||||||
|
// printf("*line = %x, *np = %d \n", *line, *np);
|
||||||
|
i = 0;
|
||||||
|
while(!(ls[i].flag) && i < nls)
|
||||||
|
i++;
|
||||||
|
if(i==nls)
|
||||||
|
{
|
||||||
|
*np = 0;
|
||||||
|
return RES_OK;
|
||||||
|
}
|
||||||
|
//printf("i = %d, ls[%d] = [%.1f %.1f] -- [%.1f, %.1f]\n",
|
||||||
|
// i, i, ls[i].p[0][0], ls[i].p[0][1],
|
||||||
|
// ls[i].p[1][0], ls[i].p[1][1]);
|
||||||
|
n = BSIZE;
|
||||||
|
if((*line) == NULL)
|
||||||
|
(*line) = (point2d_t*)malloc(n*sizeof(point2d_t));
|
||||||
|
else
|
||||||
|
(*line) = (point2d_t*)realloc((*line), n*sizeof(point2d_t));
|
||||||
|
|
||||||
|
c = 0;
|
||||||
|
(*line)[c][0] = ls[i].p[0][0];
|
||||||
|
(*line)[c][1] = ls[i].p[0][1];
|
||||||
|
c++;
|
||||||
|
(*line)[c][0] = ls[i].p[1][0];
|
||||||
|
(*line)[c][1] = ls[i].p[1][1];
|
||||||
|
c++;
|
||||||
|
ls[i].flag = 0;
|
||||||
|
|
||||||
|
for(i = 0; i < nls; i++)
|
||||||
|
{
|
||||||
|
for(j = 0; j < nls; j++)
|
||||||
|
{
|
||||||
|
if(ls[j].flag)
|
||||||
|
{
|
||||||
|
//сравниваем с первой точкой отрезка ls[j]
|
||||||
|
if(dist((*line)+c-1, ls[j].p) < 1E-8)
|
||||||
|
{
|
||||||
|
// printf("c0 = %d, j0 = %d\n", c, j);
|
||||||
|
|
||||||
|
// проверяем выделение памяти.
|
||||||
|
// при необходимости увеличиваем
|
||||||
|
if(c>=n)
|
||||||
|
{
|
||||||
|
n += BSIZE;
|
||||||
|
(*line) = (point2d_t*)realloc(*line, n*sizeof(point2d_t));
|
||||||
|
}
|
||||||
|
//если первая точка совпадает, то добавляем
|
||||||
|
//в линию вторую точку
|
||||||
|
(*line)[c][0] = ls[j].p[1][0];
|
||||||
|
(*line)[c][1] = ls[j].p[1][1];
|
||||||
|
ls[j].flag = 0;
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ls[j].flag)
|
||||||
|
{
|
||||||
|
//сравниваем со второй точкой отрезка ls[j]
|
||||||
|
if(dist((*line)+c-1, ls[j].p+1) < 1E-8)
|
||||||
|
{
|
||||||
|
// printf("c1 = %d, j1 = %d\n", c, j);
|
||||||
|
|
||||||
|
// проверяем выделение памяти.
|
||||||
|
// при необходимости увеличиваем
|
||||||
|
if(c>=n)
|
||||||
|
{
|
||||||
|
n += BSIZE;
|
||||||
|
(*line) = (point2d_t*)realloc(*line, n*sizeof(point2d_t));
|
||||||
|
}
|
||||||
|
//если вторая точка совпадает, то добавляем
|
||||||
|
//в линию первую точку
|
||||||
|
(*line)[c][0] = ls[j].p[0][0];
|
||||||
|
(*line)[c][1] = ls[j].p[0][1];
|
||||||
|
ls[j].flag = 0;
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(*line) = (point2d_t*)realloc((*line), c*sizeof(point2d_t));
|
||||||
|
*np = c;
|
||||||
|
|
||||||
|
return RES_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
/* Matrix
|
||||||
|
z = [ 0 0 1 0;
|
||||||
|
0 1 1 0;
|
||||||
|
0 0 0 0];
|
||||||
|
in array a by columns
|
||||||
|
*/
|
||||||
|
double z[N*M] = { 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0};
|
||||||
|
double x[N] = {0.0, 1.0, 2.0};
|
||||||
|
double y[M] = {0.0, 1.0, 2.0, 3.0};
|
||||||
|
linseg_t *ls = NULL;
|
||||||
|
int nls, i, j;
|
||||||
|
point2d_t** line = NULL;
|
||||||
|
int *np = NULL;
|
||||||
|
|
||||||
|
line = (point2d_t**)malloc(10*sizeof(point2d_t*));
|
||||||
|
memset(line,0,10*sizeof(point2d_t*));
|
||||||
|
|
||||||
|
np = (int*)malloc(10*sizeof(int));
|
||||||
|
memset(np, 0, 10*sizeof(int));
|
||||||
|
|
||||||
|
linseg_create(z, x, y, N, M, 0.5, &ls, &nls);
|
||||||
|
for(i =0; i< nls; i++)
|
||||||
|
printf("%d, [%.1f %.1f] -- [%.1f %.1f]\n", i, ls[i].p[0][0], ls[i].p[0][1], ls[i].p[1][0], ls[i].p[1][1]);
|
||||||
|
|
||||||
|
|
||||||
|
i = -1;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
line_create(ls, nls, line+i, np);
|
||||||
|
for(j =0; j< np[i]; j++)
|
||||||
|
printf("%[%.1f %.1f] -- ", line[i][j][0], line[i][j][1]);
|
||||||
|
printf("\n");
|
||||||
|
}while(np[i]);
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Ładowanie…
Reference in New Issue