├── .gitignore ├── LICENSE ├── README.md ├── data ├── clustering │ └── self_tuning_paper_clustering_data.mat ├── faces │ └── readme.txt ├── images │ ├── Shepp_logan_1024x1024.png │ ├── barbara_gray_512x512.png │ ├── cameraman_gray_512x512.tif │ ├── jetplane_gray_512x512.tif │ ├── lake_gray_512x512.tif │ ├── lena_gray_512x512.tif │ ├── peppers_gray_512x512.tif │ └── pirate_gray_512x512.tif └── matrix_market │ ├── abb313.mtx │ ├── bfwb398.mtx │ ├── cryg10000.mtx │ └── illc1850.mtx ├── docs ├── Makefile ├── _static │ ├── css │ │ ├── custom.css │ │ └── theme_overrides.css │ ├── disqus.js │ ├── list.txt │ └── mathconf.js ├── _templates │ ├── breadcrumbs.html │ └── layout.html ├── autobuild.bat ├── book │ ├── clustering.rst │ ├── clustering │ │ ├── clustering_utilities.rst │ │ ├── comparing_clusterings.rst │ │ ├── demo_clustering_comparison_1.m │ │ ├── demo_clustering_error_hungarian.m │ │ ├── demo_normalized_random_walk.m │ │ ├── demo_pointsets_on_line.m │ │ ├── demo_spectral_clustering_1.m │ │ ├── demo_spectral_clustering_2.m │ │ ├── demo_unnormalized_spectral_clustering.m │ │ ├── expectation_maximization.rst │ │ ├── images │ │ │ ├── alg_k_means_clustering.png │ │ │ ├── demo_sc_1_clustered.png │ │ │ ├── demo_sc_1_scaled.png │ │ │ ├── demo_sc_1_unscaled.png │ │ │ ├── simple_unnormalized_singular_values.png │ │ │ ├── st3_nrw_clustered_data.png │ │ │ ├── st3_nrw_distances.png │ │ │ ├── st3_nrw_laplacian.png │ │ │ ├── st3_nrw_raw_data.png │ │ │ ├── st3_nrw_similarity.png │ │ │ ├── st3_nrw_singular_values.png │ │ │ └── st3_nrw_sv_changes.png │ │ ├── intro.rst │ │ ├── k_means.rst │ │ ├── spectral_clustering.rst │ │ └── spectral_clustering_demos.rst │ ├── complexity.rst │ ├── complexity │ │ ├── basic.rst │ │ ├── images │ │ │ └── alg_mgs.png │ │ ├── intro.rst │ │ ├── omp.rst │ │ └── sorting.rst │ ├── compressive_sensing.rst │ ├── compressive_sensing │ │ ├── demo_gaussian_1.m │ │ ├── demo_random_matrix_rank.m │ │ ├── examples.rst │ │ ├── gaussian.rst │ │ ├── images │ │ │ ├── demo_gaussian_1.png │ │ │ ├── demo_gaussian_1_norm_hist.png │ │ │ ├── demo_gaussian_1_singular_values.png │ │ │ ├── piecewise_polynomial │ │ │ │ ├── dictionary.png │ │ │ │ ├── measurements.png │ │ │ │ ├── recovery_matrix.png │ │ │ │ ├── representation.png │ │ │ │ ├── representation_sorted.png │ │ │ │ ├── sensing_matrix.png │ │ │ │ └── signal.png │ │ │ ├── rademacher_coherence_bound.png │ │ │ └── rademacher_rand_vec_tail_bound.png │ │ ├── introduction.rst │ │ ├── nullspace.rst │ │ ├── rademacher.rst │ │ ├── rip.rst │ │ ├── rip_matrices.rst │ │ ├── rip_nsp.rst │ │ └── subgaussian.rst │ ├── convex_analysis.rst │ ├── convex_analysis │ │ └── convex_sets.rst │ ├── data_analysis.rst │ ├── data_analysis │ │ └── pca.rst │ ├── dce.rst │ ├── dce │ │ ├── bht.rst │ │ ├── em.rst │ │ ├── features.rst │ │ ├── graphical_models.rst │ │ ├── kernels.rst │ │ ├── linear_classification.rst │ │ ├── linear_regression.rst │ │ ├── linear_regression │ │ │ ├── demo_sinewave_lin_reg.m │ │ │ ├── demo_sinusoid_lin_reg_poly_degree_rmse.m │ │ │ ├── demo_sinusoid_lin_reg_poly_degrees.m │ │ │ └── demo_sinusoid_polyfit_vs_linreg.m │ │ ├── rvm.rst │ │ ├── sample_data.rst │ │ ├── sample_data │ │ │ ├── demo_sinewave1.m │ │ │ ├── demo_sinewave2.m │ │ │ └── images │ │ │ │ ├── sinewave_1.png │ │ │ │ └── sinewave_2.png │ │ └── svm.rst │ ├── diclearn.rst │ ├── diclearn │ │ └── diclearn.rst │ ├── ecg.rst │ ├── ecg │ │ ├── demo_heartrate.m │ │ ├── demo_qrs_detection_symlet_1.m │ │ ├── demo_synthetic.m │ │ └── intro.rst │ ├── geometry.rst │ ├── geometry │ │ └── algebraic_geometry.rst │ ├── linear_algebra.rst │ ├── linear_algebra │ │ ├── affine.rst │ │ ├── complex_space.rst │ │ ├── demo_principal_angles.m │ │ ├── euclidean_space.rst │ │ ├── inner_product_spaces.rst │ │ ├── matrix_factorizations.rst │ │ ├── principal_angles.rst │ │ ├── transformations.rst │ │ └── vector_spaces.rst │ ├── matrices.rst │ ├── matrices │ │ ├── eigen_values.rst │ │ ├── intro.rst │ │ ├── invertible_matrices.rst │ │ ├── matrix_calculus.rst │ │ ├── matrix_norms.rst │ │ ├── rank_span_independence.rst │ │ ├── singular_values.rst │ │ ├── trace_det.rst │ │ └── unitary_matrices.rst │ ├── opt.rst │ ├── opt │ │ ├── images │ │ │ ├── quadratic_with_restricted_domain.png │ │ │ └── shrinkage.png │ │ └── soft_thresholding.rst │ ├── probability.rst │ ├── probability │ │ ├── complex_variable.rst │ │ ├── dist_bernaulli.rst │ │ ├── distribution_gaussian.rst │ │ ├── expectation.rst │ │ ├── gaussian_random_vector.rst │ │ ├── inequalities_basic.rst │ │ ├── random_variables.rst │ │ ├── random_vectors.rst │ │ └── two_variables.rst │ ├── pursuit.rst │ ├── pursuit │ │ ├── cosamp │ │ │ └── index.rst │ │ ├── demo_sparse_bigaussian.m │ │ ├── demo_sparse_biuniform.m │ │ ├── demo_sparse_gaussian.m │ │ ├── demo_sparse_rademacher.m │ │ ├── demo_sparse_uniform.m │ │ ├── greedy_prelude.rst │ │ ├── htp │ │ │ └── index.rst │ │ ├── iht │ │ │ └── index.rst │ │ ├── images │ │ │ ├── demo_sparse_bigaussian_1.png │ │ │ ├── demo_sparse_biuniform_1.png │ │ │ ├── demo_sparse_biuniform_2.png │ │ │ ├── demo_sparse_gaussian_1.png │ │ │ ├── demo_sparse_rademacher_1.png │ │ │ └── demo_sparse_uniform_1.png │ │ ├── mp │ │ │ ├── algorithm.rst │ │ │ ├── demo_mp_partial_hadamard_10x20_k_3.m │ │ │ ├── fast_mp.rst │ │ │ ├── images │ │ │ │ └── alg_matching_pursuit.png │ │ │ └── index.rst │ │ ├── ols │ │ │ └── index.rst │ │ ├── omp │ │ │ ├── algorithm.rst │ │ │ ├── batch_omp.rst │ │ │ ├── demo_fast_batch_omp.m │ │ │ ├── demo_fast_omp.m │ │ │ ├── demo_hadamard.m │ │ │ ├── erc_conditions.rst │ │ │ ├── fast_omp.rst │ │ │ ├── images │ │ │ │ ├── algorithm_batch_omp.png │ │ │ │ ├── algorithm_omp_x_alpha_version.png │ │ │ │ └── algorithm_orthogonal_matching_pursuit.png │ │ │ ├── index.rst │ │ │ └── sparse_approximation_conditions.rst │ │ └── testing_framework.rst │ ├── real_analysis.rst │ ├── real_analysis │ │ └── metric_spaces.rst │ ├── set_theory.rst │ ├── set_theory │ │ ├── countable_uncountable.rst │ │ ├── functions.rst │ │ ├── intro.rst │ │ ├── relations.rst │ │ └── sets.rst │ ├── signal_processing.rst │ ├── signal_processing │ │ ├── dct.rst │ │ ├── demo_dtmf_4507.m │ │ ├── demo_rle.m │ │ ├── dtmf.rst │ │ ├── images │ │ │ ├── dtmf_4507.png │ │ │ ├── dtmf_4507_envelope.png │ │ │ ├── dtmf_4507_periodogram.png │ │ │ ├── dtmf_4507_pulses.png │ │ │ ├── dtmf_4507_spectrogram.png │ │ │ ├── dtmf_4507_spectrogram_50ms.png │ │ │ ├── dtmf_4507_spectrogram_50ms_40ms_50db.png │ │ │ └── dtmf_4507_spectrogram_50ms_40ms_50db_reassigned.png │ │ └── rle.rst │ ├── sparse_signal_models.rst │ ├── sparse_signal_models │ │ ├── babel.rst │ │ ├── coherence.rst │ │ ├── compressible.rst │ │ ├── demo_dirac_dct_1.m │ │ ├── demo_dirac_hadamard_1.m │ │ ├── demo_partial_hadamard_spark.m │ │ ├── demo_wmp_dicts.m │ │ ├── dictionary_analysis.rst │ │ ├── dictionary_representations.rst │ │ ├── dirac_dct_dict.rst │ │ ├── dirac_hadamard_dict.rst │ │ ├── images │ │ │ ├── demo_dirac_dct_1.png │ │ │ ├── demo_dirac_dct_babel.png │ │ │ ├── demo_dirac_hadamard_1.png │ │ │ ├── demo_dirac_hadamard_babel.png │ │ │ ├── spark_naive_algorithm.png │ │ │ ├── sparse_representation_framework.png │ │ │ ├── underdetermined_system.png │ │ │ ├── underdetermined_system_l1_balls.png │ │ │ ├── underdetermined_system_l2_balls.png │ │ │ ├── wmp_dirac_dct_N_32.png │ │ │ ├── wmp_sym4_dct_N_256.png │ │ │ └── wmp_sym4_wpsym4_dct_N_256.png │ │ ├── norms.rst │ │ ├── outline.rst │ │ ├── spark.rst │ │ ├── underdetermined.rst │ │ └── wavelet_toolbox_dictionaries.rst │ ├── subspace_clustering.rst │ ├── subspace_clustering │ │ ├── alg_em_k_subspaces.rst │ │ ├── alg_generalized_pca.rst │ │ ├── alg_k_plane.rst │ │ ├── alg_k_subspace.rst │ │ ├── alg_matrix_factorization.rst │ │ ├── alg_ssc.rst │ │ ├── alg_ssc_bp.rst │ │ ├── alg_ssc_mc_omp.rst │ │ ├── alg_ssc_omp.rst │ │ ├── algorithms.rst │ │ ├── app_motion_segmentation.rst │ │ ├── demo_random_subspaces.m │ │ ├── demo_spr.m │ │ ├── demo_ssc_bp_random_subspaces.m │ │ ├── demo_ssc_omp_mnist.m │ │ ├── demo_ssc_omp_random_subspaces.m │ │ ├── demo_uniform_points.m │ │ ├── demo_uniform_points_multiple_subspaces.m │ │ ├── images │ │ │ ├── alg_spr_admm_linear.png │ │ │ ├── alg_ssc.png │ │ │ ├── alg_ssc_mc_omp.png │ │ │ ├── random_subspace_a_3d.png │ │ │ ├── random_subspace_a_b_3d.png │ │ │ └── uniform_points_2d_subspace.png │ │ ├── intro.rst │ │ ├── mnist.rst │ │ ├── notation.rst │ │ ├── performance_metrics.rst │ │ ├── spr_admm.rst │ │ ├── synthetic_data.rst │ │ └── yale_faces.rst │ ├── wavelets.rst │ └── wavelets │ │ ├── fundamentals.rst │ │ ├── fundamentals │ │ └── essentials.rst │ │ ├── matlab_wavelet_toolbox.rst │ │ └── wavelet_toolbox │ │ ├── daubechies.rst │ │ ├── demo_db4.m │ │ ├── demo_db4_noisdopp_dwt.m │ │ ├── demo_db4_noisdopp_swt.m │ │ ├── demo_db4_noisdopp_wavedec.m │ │ ├── demo_db4_noisdopp_wavedec_per.m │ │ ├── demo_db4_wavelet_basis.m │ │ ├── images │ │ ├── db4_filters.png │ │ ├── noisdoop_db4_l4_swt.png │ │ ├── noisdopp.png │ │ ├── noisdopp_db4_decomposition.png │ │ ├── noisdopp_db4_l4_appcoeffs.png │ │ ├── noisdopp_db4_l4_appcoeffs_per.png │ │ ├── noisdopp_db4_l4_decomposition.png │ │ ├── noisdopp_db4_l4_decomposition_per.png │ │ └── wavelet_basis_db4_level_4_N_1024.png │ │ └── wavelet_toolbox_intro.rst ├── buildhtml.bat ├── conf.py ├── copy_references.bat ├── demos │ ├── basic_cs.rst │ ├── dirac_dct.rst │ ├── images │ │ ├── cs_l_1_minimization_solution.png │ │ ├── cs_matching_pursuit_solution.png │ │ ├── cs_orthogonal_matching_pursuit_solution.png │ │ ├── dct_256.png │ │ ├── dirac_dct_256.png │ │ ├── dirac_dct_l_1_solution.png │ │ ├── dirac_dct_mp_solution.png │ │ ├── dirac_dct_omp_solution.png │ │ ├── gaussian_matrix.png │ │ ├── guassian_sensing_matrix_histogram.pdf │ │ ├── guassian_sensing_matrix_histogram.png │ │ ├── impulse_cosine_combination_signal.png │ │ ├── impulse_cosine_dct_basis.png │ │ ├── impulse_cosine_dirac_dct.png │ │ ├── k_sparse_biuniform_signal.png │ │ ├── k_sparse_gaussian_signal.png │ │ ├── measurement_vector_biuniform.png │ │ └── measurement_vector_biuniform_noisy.png │ └── index.rst ├── exercises │ ├── images │ │ ├── OMP_gaussian_dict_gaussian_data_k_vs_min_m.png │ │ ├── OMP_gaussian_dict_gaussian_data_phase_transition.png │ │ ├── dirac_dct_256.png │ │ ├── gaussian_matrix.png │ │ ├── k_sparse_biuniform_signal.png │ │ ├── measurement_vector_biuniform.png │ │ ├── omp_algorithm.png │ │ └── proxy_vector.png │ └── index.rst ├── extensions │ ├── admonitions.py │ ├── disqus.py │ ├── environments.py │ ├── todo.py │ └── youtube.py ├── images │ └── union_of_subspaces.png ├── index.rst ├── intro.rst ├── latex │ ├── algorithms │ │ ├── alg_batch_omp.tex │ │ ├── alg_mgs.tex │ │ ├── alg_mp.tex │ │ ├── alg_omp.tex │ │ ├── alg_omp_rip.tex │ │ ├── alg_spr_admm_linear.tex │ │ ├── alg_ssc.tex │ │ └── alg_ssc_mc_omp.tex │ ├── article_algorithms.tex │ └── article_diagrams.tex ├── library │ ├── combinatorics.rst │ ├── commons │ │ ├── comparison.rst │ │ ├── index.rst │ │ ├── matrix.rst │ │ ├── norms.rst │ │ ├── number.rst │ │ ├── print.rst │ │ ├── recovery.rst │ │ ├── signals.rst │ │ └── sparse.rst │ ├── dictionaries.rst │ ├── external.rst │ ├── factorization.rst │ ├── graphics.rst │ ├── index.rst │ ├── mex.rst │ ├── noise.rst │ ├── pursuit │ │ ├── bp.rst │ │ ├── cosamp.rst │ │ ├── index.rst │ │ ├── joint │ │ │ ├── comp.rst │ │ │ └── index.rst │ │ ├── mp.rst │ │ └── omp.rst │ ├── synthetic.rst │ └── vectorspace.rst ├── make.bat ├── notes.txt ├── openhtml.bat ├── scripts.rst ├── sksrrcs.bib ├── start.rst └── zzzreferences.rst ├── examples ├── clustering │ ├── sparse_subspace_clustering │ │ ├── ex_ssc_three_disjoint_subspaces.m │ │ ├── ex_ssc_two_subspaces.m │ │ ├── ssc_l1 │ │ │ ├── ex_mahdi_noisy_test.m │ │ │ ├── ex_ssc_hopkins.m │ │ │ └── ex_ssc_two_subspaces_mahdi.m │ │ └── ssc_omp │ │ │ ├── SimulateSSCOMP_3Spaces.m │ │ │ ├── bench_phase_transition_snr_signals.m │ │ │ ├── bench_phase_transition_theta_signals.m │ │ │ ├── ex_snr_ssc_omp_three_disjoint_subspaces.m │ │ │ ├── ex_ssc_omp_three_disjoint_subspaces.m │ │ │ ├── print_phase_transition_snr_signals.m │ │ │ └── print_phase_transition_theta_signals.m │ └── spectral_clustering │ │ ├── ex_cluster_count_estimation_eig_vec_rot.m │ │ └── ex_spectral_clustering_self_tuning_paper_data.m ├── commons │ ├── ex_nonsparse_signal_comparison.m │ ├── ex_sparse_signal_comparison.m │ └── sparse │ │ ├── ex_partial_svd_compose_1.m │ │ ├── ex_sample_sparse_mat_1.m │ │ └── ex_update_sparse_data.m ├── data │ ├── hopkins155 │ │ ├── ex_subspace_angles.m │ │ └── ex_svds.m │ ├── random_signals │ │ └── ex_random_gaussian_signals.m │ ├── signals │ │ ├── ex_multitone.m │ │ └── ex_picket_fence.m │ └── yale_faces │ │ ├── ex_downsample_rpca_faces.m │ │ ├── ex_faces_omp_rep.m │ │ ├── ex_omp_approx.m │ │ ├── ex_omp_rep_subspace_angles.m │ │ ├── ex_omp_rep_svds.m │ │ ├── ex_pair_of_subjects_neighbor_analysis.m │ │ ├── ex_run_rpca.m │ │ ├── ex_subspace_angles.m │ │ ├── ex_svds.m │ │ ├── ex_yale_angles_analysis.m │ │ ├── ex_yale_faces.m │ │ ├── print_principal_angles.m │ │ └── print_svd_data.m ├── dictionary │ ├── equiangular_tight_frames │ │ └── ex_sts_to_etf.m │ ├── ex_gaussian_dict_properties.m │ ├── grassmannian_frames │ │ ├── ex_grassmannian_coherence.m │ │ └── ex_grassmannian_frame_via_alternate_projections.m │ ├── learning │ │ ├── barbara │ │ │ ├── barbara_problem.m │ │ │ └── ex_train_barbara_ksvd.m │ │ ├── ksvd │ │ │ ├── ex_dict_learn_ksvd.m │ │ │ ├── ex_dict_learn_ksvd_cc.m │ │ │ └── print_dict_learn_ksvd.m │ │ └── mod │ │ │ ├── ex_dict_learn_mod.m │ │ │ └── print_dict_learn_mod.m │ └── sensing_matrices │ │ ├── ex_generate_sample_sensing_matrices.m │ │ ├── ex_partial_dct_1.m │ │ ├── ex_partial_dft_1.m │ │ ├── print_gaussian_sensing_matrix.m │ │ └── print_rademacher_sensing_matrix.m ├── discrete │ └── ex_steiner_system_2.m ├── ex_dirac_dct_two_ortho_basis.m ├── ex_dirac_dct_two_ortho_basis.mlx ├── ex_simple_compressed_sensing_demo.m ├── graphics │ ├── ex_blackman_frequency_response.m │ ├── ex_display_dictionary_atoms.m │ ├── ex_display_matrices.m │ ├── ex_draw_norm_balls_2d.m │ ├── ex_multiple_figure.m │ ├── ex_plot_circles.m │ ├── ex_plot_discrete_signal.m │ ├── ex_plot_filter_response.m │ ├── ex_plot_poles_zeros.m │ ├── ex_plot_polyhedron.m │ ├── ex_plot_quadratic_form.m │ └── level_curves │ │ ├── ex_level_curve_3d_f_x_y.m │ │ └── ex_level_curve_f_x_y.m ├── image_processing │ └── ex_show_test_images.m ├── init.m ├── linear_algebra │ ├── eigen_values │ │ ├── ex_orth_iters_1.m │ │ ├── ex_power_method_1.m │ │ └── ex_qr_1.m │ ├── givens │ │ ├── ex_givens_qr_1.m │ │ ├── ex_givens_rot_1.m │ │ └── ex_planerot_1.m │ ├── hessenberg │ │ ├── ex_backsearch_triu.m │ │ ├── ex_build_hess_form_1.m │ │ ├── ex_givens_hess_qr_1.m │ │ ├── ex_qr_rq_1.m │ │ └── ex_repeat_qr_rq_1.m │ ├── house │ │ ├── ex_house_4_columns.m │ │ ├── ex_house_bidiag_1.m │ │ ├── ex_house_qr_1.m │ │ ├── ex_house_qr_back_accum_1.m │ │ ├── ex_house_qr_pivot_1.m │ │ ├── ex_house_qr_pivot_singular_1.m │ │ └── ex_wy_house_4_cols.m │ ├── qr │ │ └── ex_mgs_1.m │ ├── schur │ │ ├── ex_backsearch_1.m │ │ ├── ex_francis_step_1.m │ │ └── ex_qr_hessenberg_basic_1.m │ ├── svd │ │ ├── bd │ │ │ └── ex_spx_bd_svd_1.m │ │ └── lanczos │ │ │ ├── ex_bd1.m │ │ │ ├── ex_bdpro_propack.m │ │ │ ├── ex_lansvd_k_subspaces.m │ │ │ ├── ex_mex_bd.m │ │ │ ├── ex_spx_bdpro_1.m │ │ │ ├── ex_spx_lansvd.m │ │ │ ├── ex_spx_lansvd_illc1850.m │ │ │ ├── mat_selector.m │ │ │ ├── mat_simple_1.m │ │ │ ├── propack_lanbdpro.m │ │ │ ├── spx_bdpro.m │ │ │ └── spx_lansvd.m │ ├── triangular │ │ ├── ex_back_col_1.m │ │ ├── ex_back_col_2.m │ │ ├── ex_back_row_1.m │ │ ├── ex_forward_col_1.m │ │ ├── ex_forward_row_1.m │ │ ├── ex_gaxpy_lu_1.m │ │ ├── ex_outer_lu_1.m │ │ └── ex_rect_lu_1.m │ └── vector_spaces │ │ ├── ex_disjoint_ss3_etf_subspaces_principal_angles.m │ │ ├── ex_disjoint_three_spaces.m │ │ └── ex_principal_angle_hadamard.m ├── optimization │ ├── convex_optimization │ │ ├── conjugate_gradient │ │ │ ├── ex_cg_least_square.m │ │ │ └── ex_conjugate_gradients.m │ │ └── steepest_descent │ │ │ └── ex_steepest_descent.m │ ├── least_squares │ │ ├── ex_house_qr_ls_1.m │ │ └── ex_normal_equations_1.m │ └── roots │ │ └── ex_newton_1.m ├── pursuit │ ├── ex_proxy_vector.m │ ├── fast │ │ ├── demo_compare_speed_omp_chol_mex.m │ │ ├── demo_fast_omp_1.m │ │ └── demo_fast_omp_2.m │ ├── joint_recovery │ │ ├── bp_mmv │ │ │ ├── ex_bp_mmv_l2_l1_norm.m │ │ │ └── ex_bp_mmv_multi_signals.m │ │ ├── chen2006theoretical │ │ │ ├── ex_fig_1_a_rand_dict_omp_bp_with_k.m │ │ │ ├── ex_fig_1_b_dirac_hadamard_dict_omp_bp_with_k.m │ │ │ ├── print_fig_1_a_rand_dict_omp_bp_with_k.m │ │ │ └── print_fig_1_b_hadamard_dict_omp_bp_with_k.m │ │ ├── davies2012rank │ │ │ ├── ex_fig_1_ra_omp.m │ │ │ ├── ex_fig_1_ra_ormp.m │ │ │ ├── ex_fig_1_ra_thresholding.m │ │ │ ├── ex_fig_2_comparison.m │ │ │ ├── print_fig_1.m │ │ │ └── print_fig_2.m │ │ ├── eldar2010average │ │ │ ├── ex_fig_1_a_mc_recovery_l_2_1_min_with_k.m │ │ │ ├── ex_fig_1_b_mc_recovery_somp_with_k.m │ │ │ ├── ex_fig_1_c_mc_recovery_thresholding_with_k.m │ │ │ ├── ex_fig_2_a_mc_recovery_bp_with_k.m │ │ │ ├── ex_fig_2_b_mc_recovery_somp_with_k.m │ │ │ ├── ex_fig_2_c_mc_recovery_thresholding_with_k.m │ │ │ ├── ex_model_1_l2_l1_min_recovery.m │ │ │ ├── model_1_data.m │ │ │ ├── model_2_data.m │ │ │ ├── model_3_data.m │ │ │ ├── print_fig_1_a_mc_recovery_somp_with_k.m │ │ │ ├── print_fig_1_b_mc_recovery_somp_with_k.m │ │ │ ├── print_fig_1_c_mc_recovery_thresholding_with_k.m │ │ │ ├── print_fig_2_b_mc_recovery_somp_with_k.m │ │ │ └── print_fig_2_c_mc_recovery_thresholding_with_k.m │ │ ├── music_mmv │ │ │ └── ex_music_mmv.m │ │ ├── omp_mmv │ │ │ ├── ex_omp_mmv_multi_signals.m │ │ │ └── ex_omp_mmv_one_signal.m │ │ ├── rank_aware_omp │ │ │ ├── ex_ra_omp.m │ │ │ └── ex_ra_ormp.m │ │ ├── rank_aware_thresholding │ │ │ └── ex_rank_aware_thresholding.m │ │ ├── thresholding │ │ │ └── ex_thresholding_mmv.m │ │ └── tropp2006algorithms │ │ │ ├── ex_figure_1_type_2_s_2.m │ │ │ ├── ex_figure_2_type_2_s_1.m │ │ │ ├── ex_figure_3_type_3_noisy.m │ │ │ ├── print_figure_1_type_2_s_2.m │ │ │ ├── print_figure_2_type_2_s_1.m │ │ │ └── print_figure_3.m │ └── single_recovery │ │ ├── cosamp │ │ ├── ex_phase_transition.m │ │ └── solve_cosamp.m │ │ ├── hard_thresholding_pursuit │ │ ├── ex_htp_1.m │ │ └── foucart2011hard │ │ │ ├── ex_fig_1.m │ │ │ └── print_fig_1.m │ │ ├── orthogonal_least_squares │ │ ├── ex_ols_1.m │ │ ├── ex_phase_transition_gaussian_dict_gaussian_data.m │ │ └── print_phase_transition_gaussian_dict_gaussian_data.m │ │ └── orthogonal_matching_pursuit │ │ ├── ex_omp_1.m │ │ ├── ex_omp_chol_1.m │ │ ├── ex_phase_transition_gaussian_dict_gaussian_data.m │ │ └── print_phase_transition_gaussian_dict_gaussian_data.m ├── signal_processing │ └── transforms │ │ └── ex_stft_multi_tone.m ├── statistics │ └── detection │ │ ├── compressive_detector │ │ └── ex_compressive_detector.m │ │ ├── ex_basic_detector.m │ │ ├── ex_bht_constant_signal_with_noise_optimum_risk_curve.m │ │ ├── ex_bht_zero_mean_gaussian_signals_diff_sigma.m │ │ └── ex_roc_constant_signal_with_awgn_bht.m └── wavelet │ ├── basic │ ├── ex_coiflets.m │ ├── ex_daubechies_wavelets.m │ ├── ex_haar_wavelets.m │ └── ex_symmlets.m │ └── local_sine_cosine_bases │ └── ex_project_square.m ├── experiments ├── README.md ├── admm │ ├── basis_pursuit │ │ ├── test_bp_1.m │ │ ├── test_bpdn_admm_gaussian_dict.m │ │ ├── test_bpic_admm_gaussian_dict.m │ │ ├── test_l1_admm_gaussian_dict.m │ │ └── test_partial_basis_1d.m │ ├── least_absolute_deviations │ │ ├── test_lad_1.m │ │ └── test_lad_2.m │ └── lrsd │ │ └── ex_lrsd_1.m ├── atom_ranking_in_greedy_pursuit │ ├── Contents.m │ ├── ar_omp.m │ ├── ar_solver.m │ ├── atom_ranked_omp.m │ ├── ex_ar_omp_phase_transition_gaussian_dict_gaussian_data.m │ ├── ex_barbara_image.m │ ├── ex_compare_algorithms.m │ ├── ex_compare_omp_with_multiple_omp_ar_versions.m │ ├── ex_fast_omp_ar_1.m │ ├── ex_fast_omp_ar_pta_gauss_dict_data.m │ ├── ex_fast_omp_ar_verification.m │ ├── ex_fast_omp_speed_test.m │ ├── ex_omp_1.m │ ├── ex_omp_phase_transition_gaussian_dict_gaussian_data.m │ ├── fast_omp_ar_solver.m │ ├── omp.m │ ├── print_all_graphs.m │ ├── print_ar_omp_phase_transition_gaussian_dict_gaussian_data.m │ ├── print_compare_algorithms_at_fixed_m_n.m │ ├── print_compare_multi_algorithms_at_fixed_m_n.m │ ├── print_fast_omp_ar_pta_gauss_dict_data.m │ ├── print_omp_phase_transition_gaussian_dict_gaussian_data.m │ └── review_sample.m ├── comp │ ├── ex_barbara_comp_compression.m │ ├── ex_image_comp.m │ ├── ex_image_comp_sliding.m │ └── ex_uniform_multi_subspace.m ├── cosamp_mmv │ ├── ex_comparison_with_s.m │ ├── ex_cosamp_mmv.m │ ├── ex_mmv_phase_transition_noiseless_s_16.m │ ├── ex_mmv_phase_transition_noiseless_s_2.m │ ├── ex_mmv_phase_transition_noiseless_s_32.m │ ├── ex_mmv_phase_transition_noiseless_s_4.m │ ├── ex_mmv_phase_transition_noiseless_s_8.m │ ├── ex_mmv_phase_transition_snr_30db_s_16.m │ ├── ex_mmv_phase_transition_snr_30db_s_2.m │ ├── ex_mmv_phase_transition_snr_30db_s_32.m │ ├── ex_mmv_phase_transition_snr_30db_s_4.m │ ├── ex_mmv_phase_transition_snr_30db_s_8.m │ ├── ex_mmv_phase_transition_snr_40db_s_16.m │ ├── ex_mmv_phase_transition_snr_40db_s_2.m │ ├── ex_mmv_phase_transition_snr_40db_s_32.m │ ├── ex_mmv_phase_transition_snr_40db_s_4.m │ ├── ex_mmv_phase_transition_snr_40db_s_8.m │ ├── ex_ra_mmv_phase_transition_noiseless_s_16.m │ ├── ex_ra_mmv_phase_transition_noiseless_s_2.m │ ├── ex_ra_mmv_phase_transition_noiseless_s_32.m │ ├── ex_ra_mmv_phase_transition_noiseless_s_4.m │ ├── ex_ra_mmv_phase_transition_noiseless_s_8.m │ ├── ex_ra_mmv_phase_transition_snr_20db_s_16.m │ ├── ex_ra_mmv_phase_transition_snr_20db_s_2.m │ ├── ex_ra_mmv_phase_transition_snr_20db_s_4.m │ ├── ex_ra_mmv_phase_transition_snr_20db_s_8.m │ ├── ex_ra_mmv_phase_transition_snr_30db_s_16.m │ ├── ex_ra_mmv_phase_transition_snr_30db_s_2.m │ ├── ex_ra_mmv_phase_transition_snr_30db_s_4.m │ ├── ex_ra_mmv_phase_transition_snr_30db_s_8.m │ ├── ex_ra_mmv_phase_transition_snr_40db_s_16.m │ ├── ex_ra_mmv_phase_transition_snr_40db_s_2.m │ ├── ex_ra_mmv_phase_transition_snr_40db_s_4.m │ ├── ex_ra_mmv_phase_transition_snr_40db_s_8.m │ ├── ex_smv_phase_transition_noiseless.m │ ├── ex_smv_phase_transition_snr_20db.m │ ├── ex_smv_phase_transition_snr_30db.m │ ├── ex_smv_phase_transition_snr_40db.m │ ├── ex_spx_cosamp_vs_ss_cosamp.m │ ├── print_comparison_with_s.m │ ├── print_mmv_phase_transition_noiseless_s_16.m │ ├── print_mmv_phase_transition_noiseless_s_2.m │ ├── print_mmv_phase_transition_noiseless_s_4.m │ ├── print_mmv_phase_transition_noiseless_s_8.m │ ├── print_mmv_phase_transition_snr_30db_s_16.m │ ├── print_mmv_phase_transition_snr_30db_s_2.m │ ├── print_mmv_phase_transition_snr_30db_s_4.m │ ├── print_mmv_phase_transition_snr_30db_s_8.m │ ├── print_mmv_phase_transition_snr_40db_s_16.m │ ├── print_mmv_phase_transition_snr_40db_s_2.m │ ├── print_mmv_phase_transition_snr_40db_s_4.m │ ├── print_mmv_phase_transition_snr_40db_s_8.m │ ├── print_ra_mmv_phase_transition_noiseless_s_16.m │ ├── print_ra_mmv_phase_transition_noiseless_s_2.m │ ├── print_ra_mmv_phase_transition_noiseless_s_4.m │ ├── print_ra_mmv_phase_transition_noiseless_s_8.m │ ├── print_ra_mmv_phase_transition_snr_30db_s_16.m │ ├── print_ra_mmv_phase_transition_snr_30db_s_2.m │ ├── print_ra_mmv_phase_transition_snr_30db_s_4.m │ ├── print_ra_mmv_phase_transition_snr_30db_s_8.m │ ├── print_ra_mmv_phase_transition_snr_40db_s_16.m │ ├── print_ra_mmv_phase_transition_snr_40db_s_2.m │ ├── print_ra_mmv_phase_transition_snr_40db_s_4.m │ ├── print_ra_mmv_phase_transition_snr_40db_s_8.m │ ├── print_smv_phase_transition_noiseless.m │ ├── print_smv_phase_transition_snr_20db.m │ ├── print_smv_phase_transition_snr_30db.m │ ├── print_smv_phase_transition_snr_40db.m │ └── print_spx_cosamp_vs_ss_cosamp.m ├── ecg │ └── mit200 │ │ ├── periodogram_mit200.m │ │ ├── spectrogram_mit200.m │ │ └── view_mit200.m ├── fast_batch_omp │ ├── ex_batch_omp_speed_profile.m │ ├── ex_batch_omp_verification.m │ └── ex_fast_batch_omp_speed_test.m ├── fast_flipped_omp_spr │ ├── ex_compare_with_chong_1.m │ └── ex_compare_with_chong_2.m ├── fast_omp_chol │ ├── ex_c_omp_ls_1.m │ ├── ex_c_omp_ls_verification.m │ ├── ex_fast_omp_speed_profile.m │ ├── ex_fast_omp_speed_test.m │ ├── ex_fast_omp_verification.m │ ├── ex_phase_transition_gaussian_dict_gaussian_data.m │ └── print_phase_transition_gaussian_dict_gaussian_data.m ├── gomp │ ├── ex_c_gomp_1.m │ ├── ex_c_gomp_2.m │ ├── ex_c_gomp_3.m │ ├── ex_c_omp_vs_c_gomp.m │ ├── ex_cmp_m_vs_c_gomp.m │ ├── ex_compare_algorithms.m │ ├── ex_gomp_1.m │ ├── ex_gomp_2.m │ └── print_compare_algorithms.m ├── gomp_mmv │ ├── ex_c_gomp_mmv.m │ ├── ex_comparison_with_k_s.m │ ├── ex_comparison_with_s.m │ ├── ex_gomp_mmv.m │ ├── k_s_l │ │ ├── ex_comparison_k_s_l.m │ │ └── print_comparison_k_s_l.m │ ├── print_comparison_with_k_s.m │ ├── print_comparison_with_s.m │ └── speed_tests │ │ └── ex_gomp_mmv_speed_test.m ├── lrsc │ ├── README │ └── vidal │ │ ├── ex_lrsc_clean_relaxed.m │ │ ├── ex_lrsc_noisy_exact.m │ │ ├── ex_lrsc_noisy_relaxed.m │ │ └── prepare_data.m ├── matrix_completion │ └── ccs_svt │ │ └── test_mc_1.m ├── mc_omp │ ├── ex_compare_algorithms.m │ ├── ex_mc_omp_1.m │ ├── ex_mc_omp_2.m │ └── print_compare_algorithms.m ├── optimization │ └── cg │ │ ├── compare_cg_speed.m │ │ ├── profile_fast_cg.m │ │ └── test_cg.m ├── pursuit │ ├── cosamp │ │ └── test_cosamp.m │ └── mp │ │ ├── compare_mp_speeds.m │ │ └── test_mp.m ├── quickselect │ └── quickselect_vs_sort_speed_test.m ├── sparse_representation_clustering │ ├── ex_barbara_src_orth.m │ └── ex_src_and_ssc_two_subspaces.m ├── spr_admm │ ├── ex_spr_admm_affine_1.m │ └── ex_spr_admm_linear_1.m ├── ssc_batch_omp │ ├── ex_batch_flipped_omp_1.m │ ├── ex_batch_flipped_omp_2.m │ ├── ex_batch_omp_spr_1.m │ ├── ex_batch_omp_spr_2.m │ ├── ex_mnist_1.m │ ├── ex_mnist_speed_test.m │ ├── ex_omp_ks_1.m │ ├── ex_omp_ks_2.m │ ├── ex_omp_spr_1.m │ ├── ex_omp_spr_2.m │ ├── ex_ssc_batch_omp_1.m │ ├── ex_ssc_batch_omp_three_disjoint_subspaces.m │ ├── ex_ssc_omp_spr_1.m │ ├── ex_subspace_preservation_verification.m │ └── print_mnist_speed_test.m ├── ssc_gomp │ ├── ex_gomp_spr_1.m │ └── ex_gomp_spr_2.m ├── ssc_hopkins155 │ ├── check_hopkins.m │ ├── ex_one_problem.m │ ├── ex_ssc_l1.m │ ├── ex_ssc_l1_mahdi.m │ ├── ex_ssc_mc_omp.m │ ├── ex_ssc_nn_omp.m │ ├── ex_ssc_omp.m │ ├── ssc_l1.m │ ├── ssc_l1_mahdi.m │ ├── ssc_mc_omp.m │ ├── ssc_nn_omp.m │ └── ssc_omp.m ├── ssc_mc_omp │ ├── bench_ssc_mc_omp.m │ ├── create_config.m │ ├── ex_analyze_neighbors.m │ ├── ex_ssc_mc_omp.m │ ├── print_bench_ssc_mc_omp.m │ └── ssc_mc_omp.m ├── ssc_mnist_digits │ ├── Contents.m │ ├── bench_ssc_batch_omp.m │ ├── bench_ssc_mc_omp.m │ ├── bench_ssc_omp.m │ ├── check_digits.m │ ├── compare_clustering_results.m │ ├── create_config.m │ ├── demo_ssc_omp.m │ ├── ex_cmp_chong_our_ssc_omp_run.m │ ├── ex_cmp_chong_our_ssc_omp_setup.m │ ├── ex_ssc_mc_omp.m │ ├── ex_ssc_omp.m │ ├── ex_test_digits.m │ ├── load_db.m │ ├── merge_results.m │ ├── print_bench_ssc_batch_omp.m │ ├── print_bench_ssc_mc_omp.m │ ├── print_bench_ssc_omp.m │ ├── ssc_batch_omp.m │ ├── ssc_mc_omp.m │ └── ssc_omp.m ├── ssc_nn_omp │ ├── ex_ssc_nn_omp_demo.m │ └── ex_ssc_nn_omp_noisy_test.m ├── ssc_subspace_preservation_test │ ├── bench_ssc_l1.m │ ├── bench_ssc_nn_omp.m │ ├── bench_ssc_omp.m │ ├── bench_ssc_tomp.m │ ├── demo_ssc_mc_omp.m │ ├── demo_ssc_tomp.m │ ├── ex_ssc_l1_mahdi.m │ ├── ex_ssc_nn_omp.m │ ├── ex_ssc_omp.m │ ├── plot_bench_multiple_results.m │ ├── plot_bench_results.m │ ├── plots │ │ ├── clustering_accuracy.pdf │ │ ├── clustering_accuracy.png │ │ ├── subspace_preserving_representation_perc.pdf │ │ ├── subspace_preserving_representation_perc.png │ │ ├── subspace_representation_error_perc.pdf │ │ └── subspace_representation_error_perc.png │ ├── print_bench_multiple_algorithms.m │ ├── print_bench_ssc_nn_omp.m │ ├── print_bench_ssc_omp.m │ ├── readme.txt │ ├── ssc_l1.m │ ├── ssc_l1_mahdi.m │ ├── ssc_nn_omp.m │ ├── ssc_omp.m │ └── ssc_tomp.m ├── ssc_yale_faces │ ├── bench_ssc_mc_omp.m │ ├── check_yale_faces.m │ ├── compare_clustering_results.m │ ├── create_config.m │ ├── ex_ssc_l1.m │ ├── ex_ssc_l1_mahdi.m │ ├── ex_ssc_mc_omp.m │ ├── ex_ssc_nn_omp.m │ ├── ex_ssc_omp.m │ ├── ex_two_subjects.m │ ├── ex_two_subjects_chong.m │ ├── merge_results.m │ ├── print_bench_ssc_mc_omp.m │ ├── ssc_l1.m │ ├── ssc_l1_mahdi.m │ ├── ssc_mc_omp.m │ ├── ssc_nn_omp.m │ └── ssc_omp.m └── subspace_clustering │ └── noise_test │ ├── ex_ssc_l1_mahdi.m │ ├── ex_ssc_nn_omp.m │ ├── ex_ssc_omp.m │ ├── print_results.m │ ├── simulate_noisy_signals.m │ ├── ssc_l1_mahdi.m │ ├── ssc_nn_omp.m │ └── ssc_omp.m ├── library ├── +spx │ ├── +cluster │ │ ├── +lrsc │ │ │ ├── clean_relaxed.m │ │ │ ├── noisy_exact.m │ │ │ ├── noisy_relaxed.m │ │ │ ├── poly_thresh_closed_form.m │ │ │ └── poly_thresh_numeric.m │ │ ├── +spectral │ │ │ ├── Clustering.m │ │ │ ├── EigVecRot.m │ │ │ └── simple.m │ │ ├── +ssc │ │ │ ├── +util │ │ │ │ ├── bench_subspace_preservation.m │ │ │ │ ├── merge_bench_subspace_preservation_results.m │ │ │ │ ├── print_subspace_preservation_results.m │ │ │ │ └── simulate_subspace_preservation.m │ │ │ ├── OMP_REPR_METHOD.m │ │ │ ├── SSC_L1.m │ │ │ ├── SSC_MC_OMP.m │ │ │ ├── SSC_NN_OMP.m │ │ │ ├── SSC_OMP.m │ │ │ ├── SSC_TOMP.m │ │ │ ├── batch_flipped_chol_omp.m │ │ │ ├── batch_flipped_omp.m │ │ │ ├── flipped_omp.m │ │ │ ├── mc_omp.m │ │ │ ├── spr_admm.m │ │ │ ├── spr_admm_outliers.m │ │ │ └── spr_cvx.m │ │ ├── ClusterComparison.m │ │ ├── gpca │ │ │ └── SPX_GPCA.m │ │ ├── kmeans.m │ │ ├── similarity.m │ │ ├── sparse_representation_clustering │ │ │ └── SPX_SparseRepClustering.m │ │ └── subspace.m │ ├── +commons │ │ ├── PhaseTransitionConfiguration.m │ │ ├── SignalsComparison.m │ │ ├── SparseRecoveryProblemDescription.m │ │ ├── SparseSignalsComparison.m │ │ ├── core.m │ │ ├── distance.m │ │ ├── signals.m │ │ └── sparse.m │ ├── +data │ │ ├── +image │ │ │ ├── ChongMNISTDigits.m │ │ │ ├── ChongYaleFaces.m │ │ │ ├── EhsanYaleFaces.m │ │ │ └── YaleFaces.m │ │ ├── +motion │ │ │ └── Hopkins155.m │ │ ├── +noise │ │ │ └── Basic.m │ │ ├── +synthetic │ │ │ ├── MultiSubspaceSignalGenerator.m │ │ │ ├── MultiToneSignalGenerator.m │ │ │ ├── SparseSignalGenerator.m │ │ │ ├── dict_learn_problems.m │ │ │ ├── func.m │ │ │ ├── images.m │ │ │ ├── lowrank.m │ │ │ ├── recovery_problems.m │ │ │ └── subspaces.m │ │ ├── local.m │ │ ├── mtx_mkt.m │ │ ├── standard_images.m │ │ └── synthetic.m │ ├── +dict │ │ ├── CompositeOperator.m │ │ ├── DCTBasis.m │ │ ├── DFTBasis.m │ │ ├── MatrixOperator.m │ │ ├── Operator.m │ │ ├── PartialDCT.m │ │ ├── PartialDFT.m │ │ ├── Properties.m │ │ ├── Unitary.m │ │ ├── babel.m │ │ ├── coherence.m │ │ ├── comparison.m │ │ ├── etf.m │ │ ├── grassmannian.m │ │ ├── rip.m │ │ ├── simple.m │ │ └── spark.m │ ├── +dictlearn │ │ ├── DictionaryLearningFramework.m │ │ ├── DictionaryLearningTracker.m │ │ ├── KSVD_CC_OMP.m │ │ ├── KSVD_OMP.m │ │ └── MOD_OMP.m │ ├── +discrete │ │ ├── arrangements.m │ │ ├── combinations_with_replacement.m │ │ ├── number.m │ │ ├── set.m │ │ └── steiner_system.m │ ├── +dsp │ │ ├── SPX_ShortTermFourierTransform.m │ │ ├── dct.m │ │ ├── digital_communication │ │ │ ├── SPX_MatchedFilter.m │ │ │ └── SPX_Modulator.m │ │ ├── dst.m │ │ ├── dtmf.m │ │ ├── dtmf_detector.m │ │ └── runlength.m │ ├── +ecg │ │ ├── heartrate.m │ │ └── synthetic.m │ ├── +fast │ │ ├── batch_flipped_omp_spr.m │ │ ├── batch_omp.m │ │ ├── batch_omp_spr.m │ │ ├── bdhizsqr_svd.m │ │ ├── cg.m │ │ ├── gomp.m │ │ ├── gomp_mmv.m │ │ ├── gomp_spr.m │ │ ├── hungarian.m │ │ ├── lansvd.m │ │ ├── mp.m │ │ ├── omp.m │ │ ├── omp_ar.m │ │ ├── omp_spr.m │ │ ├── partial_svd_compose.m │ │ ├── private │ │ │ ├── _guidelines.rst │ │ │ ├── argcheck.c │ │ │ ├── argcheck.h │ │ │ ├── batch_flipped_omp_spr.c │ │ │ ├── batch_omp.c │ │ │ ├── batch_omp_spr.c │ │ │ ├── gomp.c │ │ │ ├── gomp_mmv.c │ │ │ ├── gomp_spr.c │ │ │ ├── make.m │ │ │ ├── mex_amub.cpp │ │ │ ├── mex_batch_flipped_omp_spr.c │ │ │ ├── mex_batch_flipped_omp_spr.m │ │ │ ├── mex_batch_omp.c │ │ │ ├── mex_batch_omp.m │ │ │ ├── mex_batch_omp_spr.c │ │ │ ├── mex_batch_omp_spr.m │ │ │ ├── mex_bdsqr.cpp │ │ │ ├── mex_cg.cpp │ │ │ ├── mex_cosamp.cpp │ │ │ ├── mex_demo_func_handle.cpp │ │ │ ├── mex_gomp.c │ │ │ ├── mex_gomp.m │ │ │ ├── mex_gomp_mmv.c │ │ │ ├── mex_gomp_mmv.m │ │ │ ├── mex_gomp_spr.c │ │ │ ├── mex_gomp_spr.m │ │ │ ├── mex_hungarian.cpp │ │ │ ├── mex_lansvd.cpp │ │ │ ├── mex_linsolve.c │ │ │ ├── mex_linsolve.m │ │ │ ├── mex_mp.cpp │ │ │ ├── mex_mult_mat_mat.c │ │ │ ├── mex_mult_mat_mat.m │ │ │ ├── mex_mult_mat_t_mat.c │ │ │ ├── mex_mult_mat_t_mat.m │ │ │ ├── mex_mult_mat_t_vec.c │ │ │ ├── mex_mult_mat_t_vec.m │ │ │ ├── mex_mult_mat_vec.c │ │ │ ├── mex_mult_mat_vec.m │ │ │ ├── mex_omp_ar.c │ │ │ ├── mex_omp_ar.m │ │ │ ├── mex_omp_chol.c │ │ │ ├── mex_omp_chol.m │ │ │ ├── mex_omp_spr.c │ │ │ ├── mex_omp_spr.m │ │ │ ├── mex_partial_svd_compose.cpp │ │ │ ├── mex_partial_svd_compose.m │ │ │ ├── mex_quickselect.c │ │ │ ├── mex_quickselect.m │ │ │ ├── mex_sparse_demo.cpp │ │ │ ├── mex_sqrt_times.cpp │ │ │ ├── mex_svd_bd_hizsqr.cpp │ │ │ ├── mex_test_blas.c │ │ │ ├── mex_test_blas.m │ │ │ ├── mex_update_sparse_data.cpp │ │ │ ├── omp.c │ │ │ ├── omp.h │ │ │ ├── omp_ar.c │ │ │ ├── omp_profile.c │ │ │ ├── omp_profile.h │ │ │ ├── omp_spr.c │ │ │ ├── omp_util.c │ │ │ ├── spx_assignment.cpp │ │ │ ├── spx_assignment.hpp │ │ │ ├── spx_cg.cpp │ │ │ ├── spx_cg.hpp │ │ │ ├── spx_cosamp.cpp │ │ │ ├── spx_lanbd.cpp │ │ │ ├── spx_lanbd.hpp │ │ │ ├── spx_lansvd.cpp │ │ │ ├── spx_lansvd.hpp │ │ │ ├── spx_matarr.cpp │ │ │ ├── spx_matarr.hpp │ │ │ ├── spx_matching_pursuit.cpp │ │ │ ├── spx_matrix.cpp │ │ │ ├── spx_matrix.hpp │ │ │ ├── spx_operator.cpp │ │ │ ├── spx_operator.hpp │ │ │ ├── spx_pursuit.cpp │ │ │ ├── spx_pursuit.hpp │ │ │ ├── spx_qr.cpp │ │ │ ├── spx_qr.hpp │ │ │ ├── spx_rand.cpp │ │ │ ├── spx_rand.hpp │ │ │ ├── spx_svd.cpp │ │ │ ├── spx_svd.hpp │ │ │ ├── spx_vector.cpp │ │ │ ├── spx_vector.hpp │ │ │ ├── spxalg.c │ │ │ ├── spxalg.h │ │ │ ├── spxblas.c │ │ │ ├── spxblas.h │ │ │ ├── spxla.c │ │ │ ├── spxla.h │ │ │ ├── test_func_handle_pair.m │ │ │ ├── test_lansvd.m │ │ │ ├── test_nneg_eig_compose.m │ │ │ └── test_svd_bd_hizsqr.m │ │ ├── quickselect.m │ │ └── update_sparse_data.m │ ├── +graphics │ │ ├── Figures.m │ │ ├── canvas.m │ │ ├── display.m │ │ ├── draw.m │ │ ├── figure.m │ │ ├── multi_basis_dict_movie.m │ │ ├── plot.m │ │ ├── rgb.m │ │ └── suptitle.m │ ├── +io │ │ ├── +latex │ │ │ └── Matrix.m │ │ ├── latex.m │ │ ├── print.m │ │ ├── rst.m │ │ └── scirust.m │ ├── +la │ │ ├── +svd │ │ │ └── lanczos.m │ │ ├── affine.m │ │ ├── arnoldi.m │ │ ├── chol.m │ │ ├── eig.m │ │ ├── givens.m │ │ ├── hessenberg.m │ │ ├── house.m │ │ ├── krylov.m │ │ ├── lanczos.m │ │ ├── lu.m │ │ ├── pca.m │ │ ├── qr.m │ │ ├── schur.m │ │ ├── spaces.m │ │ ├── svd.m │ │ └── tris.m │ ├── +ml │ │ ├── +features │ │ │ └── polynomial.m │ │ └── +models │ │ │ └── +linear │ │ │ └── LinearRegression.m │ ├── +opt │ │ ├── +admm │ │ │ ├── bp.m │ │ │ ├── lad.m │ │ │ └── lrsd_yy.m │ │ ├── +completion │ │ │ └── ccs_svt.m │ │ ├── convex_optimization │ │ │ ├── conjugate_gradient │ │ │ │ ├── SPX_CGLeastSquare.m │ │ │ │ ├── SPX_ConjugateDescent.m │ │ │ │ └── tests │ │ │ │ │ ├── test_cg_ls.m │ │ │ │ │ └── test_conjugate_gradients.m │ │ │ └── steepest_descent │ │ │ │ ├── SPX_SteepestDescent.m │ │ │ │ └── tests │ │ │ │ └── test_steepest_descent.m │ │ ├── ls.m │ │ ├── projections.m │ │ ├── roots.m │ │ ├── shrinkage.m │ │ └── sv_shrinkage.m │ ├── +prob │ │ ├── SPX_IT.m │ │ └── tests │ │ │ ├── test_it.m │ │ │ └── test_prob.m │ ├── +pursuit │ │ ├── +joint │ │ │ ├── BasisPursuit.m │ │ │ ├── ClusterOMP.m │ │ │ ├── CoSaMP.m │ │ │ ├── GOMP.m │ │ │ ├── MUSIC.m │ │ │ ├── OrthogonalMatchingPursuit.m │ │ │ ├── RankAwareOMP.m │ │ │ ├── RankAwareORMP.m │ │ │ ├── RankAwareThresholding.m │ │ │ └── Thresholding.m │ │ ├── +single │ │ │ ├── BasisPursuit.m │ │ │ ├── CoSaMP.m │ │ │ ├── GOMP.m │ │ │ ├── HardThresholdingPursuit.m │ │ │ ├── L1_ADMM_YZ.m │ │ │ ├── MC_OMP.m │ │ │ ├── MatchingPursuit.m │ │ │ ├── OrthogonalLeastSquares.m │ │ │ ├── OrthogonalMatchingPursuit.m │ │ │ ├── mp.m │ │ │ └── omp_chol.m │ │ ├── PhaseTransitionAnalysis.m │ │ └── SPX_PhaseTransitionAnalysisOld.m │ ├── +ssp │ │ ├── CompressiveDetector.m │ │ ├── bht.m │ │ └── bht_sim.m │ ├── +wavelet │ │ ├── baylkin.m │ │ ├── coiflet.m │ │ ├── daubechies.m │ │ ├── ddrefinement.m │ │ ├── haar.m │ │ ├── lcs.m │ │ ├── meyer.m │ │ ├── shrinkage.m │ │ ├── symm.m │ │ ├── transform.m │ │ └── vaidyanathan.m │ ├── cache_dir.m │ ├── cluster.m │ ├── contents.m │ ├── data_dir.m │ ├── dsp.m │ ├── fs.m │ ├── graphics.m │ ├── image.m │ ├── io.m │ ├── la.m │ ├── lang.m │ ├── locate.m │ ├── locate_examples.m │ ├── log.m │ ├── matrix.m │ ├── norm.m │ ├── probability.m │ ├── readme.m │ ├── rmse.m │ ├── root_dir.m │ ├── snr.m │ ├── sparse.m │ ├── ssp.m │ ├── stats.m │ ├── vector.m │ └── wavelet.m ├── __init__.py ├── ext │ ├── README.md │ ├── bestMap.m │ ├── cgsolve.m │ ├── csvd.m │ ├── demo_lmsvd.m │ ├── export_fig │ │ ├── .ignore │ │ │ ├── ghostscript.txt │ │ │ └── gs_font_path.txt │ │ ├── ImageSelection.class │ │ ├── ImageSelection.java │ │ ├── LICENSE │ │ ├── README.md │ │ ├── append_pdfs.m │ │ ├── copyfig.m │ │ ├── crop_borders.m │ │ ├── eps2pdf.m │ │ ├── export_fig.m │ │ ├── fix_lines.m │ │ ├── ghostscript.m │ │ ├── im2gif.m │ │ ├── isolate_axes.m │ │ ├── license.txt │ │ ├── pdf2eps.m │ │ ├── pdftops.m │ │ ├── print2array.m │ │ ├── print2eps.m │ │ ├── read_write_entire_textfile.m │ │ ├── user_string.m │ │ └── using_hg2.m │ ├── hungarian.m │ ├── ini2struct │ │ ├── license.txt │ │ └── spx_ini2struct.m │ ├── isalmost.m │ ├── kmeanspp.m │ ├── knee_pt.m │ ├── lmsvd.m │ ├── lsqi.m │ ├── mminfo.m │ ├── mmread.m │ ├── mmwrite.m │ ├── pythag.m │ ├── randcs.m │ └── timeit.m ├── pathsetup.py ├── summarize_library.py └── tests │ ├── clustering │ ├── assignment │ │ └── test_hungarian.m │ ├── spectral │ │ ├── test_simple_spectral_cluster.m │ │ └── test_spectral_cluster.m │ ├── ssc │ │ └── test_ssc.m │ ├── test_cluster_comparison.m │ ├── test_kmeans_pp.m │ ├── test_similarity.m │ └── test_subspaces.m │ ├── commons │ ├── test_lang.m │ ├── test_signals.m │ ├── test_spx_checks.m │ ├── test_spx_norms.m │ └── test_spx_vector.m │ ├── data │ ├── image │ │ ├── test_ehsan_yale_faces.m │ │ └── test_yale_faces.m │ ├── synthetic │ │ ├── test_dict_learn.m │ │ └── test_sparse_sig_gen.m │ ├── test_basic_noise.m │ └── test_standard_images.m │ ├── dict │ ├── test_dictionaries.m │ ├── test_dictionary_comparison.m │ └── test_operator.m │ ├── dsp │ ├── test_dct.m │ └── test_dst.m │ ├── fast │ ├── test_batch_omp.m │ ├── test_batch_omp_spr.m │ └── test_fast_omp_chol.m │ ├── io │ └── test_io.m │ ├── la │ ├── svd │ │ ├── test_bdhizsqr.m │ │ └── test_lansvd.m │ ├── test_chol.m │ ├── test_householder.m │ ├── test_spaces.m │ └── test_svd.m │ ├── pursuit │ └── single │ │ ├── long │ │ └── test_l1_recovery.m │ │ ├── test_cosamp.m │ │ ├── test_mp.m │ │ ├── test_omp.m │ │ └── test_omp_chol.m │ ├── runalltests.m │ ├── ssp │ └── test_ssp.m │ ├── stats │ └── test_statistics.m │ └── wavelet │ ├── test_beylkin.m │ ├── test_coiflet.m │ ├── test_daubechies.m │ ├── test_haar.m │ ├── test_lcs_base.m │ ├── test_symmlet.m │ ├── test_vaidyanathan.m │ ├── test_wavelet.m │ └── test_wl_transform.m ├── readthedocs.yml ├── requirements.txt ├── run_all_unit_tests.m ├── spx_defaults.ini ├── spx_get_env.m ├── spx_setup.m └── startup.m /.gitignore: -------------------------------------------------------------------------------- 1 | docs/_build/ 2 | bin/ 3 | *.mat 4 | spx_local.ini 5 | *.pyc 6 | output.txt 7 | examples/pursuit/single_recovery/diary 8 | library/listing.txt 9 | scratch.txt 10 | *.swp 11 | *.mexw64 12 | *.html 13 | *.gz 14 | *.aux 15 | *.pdf 16 | *.synctex(busy) 17 | *.mp4 18 | *.log 19 | -------------------------------------------------------------------------------- /data/clustering/self_tuning_paper_clustering_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/data/clustering/self_tuning_paper_clustering_data.mat -------------------------------------------------------------------------------- /data/faces/readme.txt: -------------------------------------------------------------------------------- 1 | This directory is placeholder for maintaining images and their databases. 2 | The images / databases are not checked in the GITHUB repository. They 3 | should be obtained from appropriate sources. 4 | 5 | We are providing the names of files which are expected here. 6 | 7 | 8 | YaleBCrop025.mat: This file can be obtained from SSC_ADMM_v1.1.zip provided by Ehsan Elhamifar, 2012. 9 | 10 | ExtendedYaleB.mat : is from SSCOMP_Code.zip provided by Chong You. https://sites.google.com/site/chongyou1987/ 11 | -------------------------------------------------------------------------------- /data/images/Shepp_logan_1024x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/data/images/Shepp_logan_1024x1024.png -------------------------------------------------------------------------------- /data/images/barbara_gray_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/data/images/barbara_gray_512x512.png -------------------------------------------------------------------------------- /data/images/cameraman_gray_512x512.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/data/images/cameraman_gray_512x512.tif -------------------------------------------------------------------------------- /data/images/jetplane_gray_512x512.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/data/images/jetplane_gray_512x512.tif -------------------------------------------------------------------------------- /data/images/lake_gray_512x512.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/data/images/lake_gray_512x512.tif -------------------------------------------------------------------------------- /data/images/lena_gray_512x512.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/data/images/lena_gray_512x512.tif -------------------------------------------------------------------------------- /data/images/peppers_gray_512x512.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/data/images/peppers_gray_512x512.tif -------------------------------------------------------------------------------- /data/images/pirate_gray_512x512.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/data/images/pirate_gray_512x512.tif -------------------------------------------------------------------------------- /docs/_static/css/theme_overrides.css: -------------------------------------------------------------------------------- 1 | .wy-nav-content { 2 | max-width: 1050px 3 | } 4 | -------------------------------------------------------------------------------- /docs/_static/disqus.js: -------------------------------------------------------------------------------- 1 | var disqus_shortname; 2 | var disqus_identifier; 3 | (function() {{ 4 | var disqus_thread = $("#disqus_thread"); 5 | disqus_shortname = disqus_thread.data('disqus-shortname'); 6 | disqus_identifier = disqus_thread.data('disqus-identifier'); 7 | var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; 8 | dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; 9 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); 10 | }})(); 11 | -------------------------------------------------------------------------------- /docs/_templates/breadcrumbs.html: -------------------------------------------------------------------------------- 1 | {%- extends "sphinx_rtd_theme/breadcrumbs.html" %} 2 | 3 | {% block breadcrumbs_aside %} 4 | {% endblock %} 5 | -------------------------------------------------------------------------------- /docs/autobuild.bat: -------------------------------------------------------------------------------- 1 | sphinx-autobuild --port=9102 . _build\html -------------------------------------------------------------------------------- /docs/book/clustering.rst: -------------------------------------------------------------------------------- 1 | Data Clustering 2 | ======================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | clustering/intro 8 | clustering/k_means 9 | clustering/spectral_clustering 10 | clustering/expectation_maximization 11 | clustering/spectral_clustering_demos 12 | clustering/clustering_utilities 13 | clustering/comparing_clusterings 14 | 15 | -------------------------------------------------------------------------------- /docs/book/clustering/demo_clustering_comparison_1.m: -------------------------------------------------------------------------------- 1 | clc; close all; clearvars; 2 | 3 | % Original data 4 | % A = [1 1 1 1 1 2 2 2 3 3 3 3 4 4]; 5 | % B = [2 3 2 2 2 4 4 4 3 3 3 3 1 2]; 6 | 7 | % shuffled data 8 | A = [2 1 3 2 4 2 1 1 1 1 4 3 3 3]; 9 | B = [4 2 3 4 2 4 2 2 3 2 1 3 3 3]; 10 | comparer = spx.cluster.ClusterComparison(A, B); 11 | 12 | -------------------------------------------------------------------------------- /docs/book/clustering/demo_clustering_error_hungarian.m: -------------------------------------------------------------------------------- 1 | clc; close all; clearvars; 2 | 3 | % Original data 4 | % A = [1 1 1 1 1 2 2 2 3 3 3 3 4 4]; 5 | % B = [2 3 2 2 2 4 4 4 3 3 3 3 1 2]; 6 | 7 | % shuffled data 8 | A = [2 1 3 2 4 2 1 1 1 1 4 3 3 3]; 9 | B = [4 2 3 4 2 4 2 2 3 2 1 3 3 3]; 10 | 11 | num_labels = numel(A) 12 | 13 | mapped_B = bestMap(A, B)' 14 | 15 | mistakes = A ~= mapped_B 16 | 17 | num_mistakes = sum(mistakes) 18 | 19 | clustering_error = num_mistakes / num_labels 20 | 21 | clustering_error_perc = clustering_error * 100 22 | 23 | clustering_acc_perc = 100 -clustering_error_perc 24 | 25 | -------------------------------------------------------------------------------- /docs/book/clustering/demo_spectral_clustering_2.m: -------------------------------------------------------------------------------- 1 | W = [ones(4) zeros(4); zeros(4) ones(4)]; 2 | num_clusters = 2; 3 | labels = [1 1 1 1 2 2 2 2]; 4 | singular_values = [4 4 4 4 4 4 0 0]'; 5 | spx.cluster.spectral.simple.unnormalized(W); 6 | -------------------------------------------------------------------------------- /docs/book/clustering/images/alg_k_means_clustering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/alg_k_means_clustering.png -------------------------------------------------------------------------------- /docs/book/clustering/images/demo_sc_1_clustered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/demo_sc_1_clustered.png -------------------------------------------------------------------------------- /docs/book/clustering/images/demo_sc_1_scaled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/demo_sc_1_scaled.png -------------------------------------------------------------------------------- /docs/book/clustering/images/demo_sc_1_unscaled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/demo_sc_1_unscaled.png -------------------------------------------------------------------------------- /docs/book/clustering/images/simple_unnormalized_singular_values.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/simple_unnormalized_singular_values.png -------------------------------------------------------------------------------- /docs/book/clustering/images/st3_nrw_clustered_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/st3_nrw_clustered_data.png -------------------------------------------------------------------------------- /docs/book/clustering/images/st3_nrw_distances.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/st3_nrw_distances.png -------------------------------------------------------------------------------- /docs/book/clustering/images/st3_nrw_laplacian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/st3_nrw_laplacian.png -------------------------------------------------------------------------------- /docs/book/clustering/images/st3_nrw_raw_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/st3_nrw_raw_data.png -------------------------------------------------------------------------------- /docs/book/clustering/images/st3_nrw_similarity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/st3_nrw_similarity.png -------------------------------------------------------------------------------- /docs/book/clustering/images/st3_nrw_singular_values.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/st3_nrw_singular_values.png -------------------------------------------------------------------------------- /docs/book/clustering/images/st3_nrw_sv_changes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/clustering/images/st3_nrw_sv_changes.png -------------------------------------------------------------------------------- /docs/book/complexity.rst: -------------------------------------------------------------------------------- 1 | Computational Complexity 2 | ============================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | complexity/intro 8 | complexity/basic 9 | complexity/omp 10 | complexity/sorting 11 | -------------------------------------------------------------------------------- /docs/book/complexity/images/alg_mgs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/complexity/images/alg_mgs.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing.rst: -------------------------------------------------------------------------------- 1 | Compressive Sensing 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | compressive_sensing/introduction 8 | compressive_sensing/nullspace 9 | compressive_sensing/rip 10 | compressive_sensing/rip_nsp 11 | compressive_sensing/rip_matrices 12 | compressive_sensing/subgaussian 13 | compressive_sensing/rademacher 14 | compressive_sensing/gaussian 15 | compressive_sensing/examples 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/book/compressive_sensing/demo_gaussian_1.m: -------------------------------------------------------------------------------- 1 | close all; clearvars; clc; 2 | rng('default'); 3 | % Length of each signal 4 | N = 1000; 5 | % The number of measurements 6 | M = 100; 7 | 8 | % The sensing matrix 9 | Phi = spx.dict.simple.gaussian_mtx(M, N, false); 10 | 11 | figure; 12 | imagesc(Phi); 13 | colorbar; 14 | 15 | export_fig images/demo_gaussian_1.png -r120 -nocrop; 16 | 17 | 18 | column_norms = spx.norm.norms_l2_cw(Phi); 19 | figure; 20 | hist(column_norms); 21 | export_fig images/demo_gaussian_1_norm_hist.png -r120 -nocrop; 22 | 23 | 24 | % singular values 25 | singular_values = svd(Phi); 26 | figure; 27 | plot(singular_values); 28 | ylim([0, 5]); 29 | grid; 30 | export_fig images/demo_gaussian_1_singular_values.png -r120 -nocrop; 31 | -------------------------------------------------------------------------------- /docs/book/compressive_sensing/demo_random_matrix_rank.m: -------------------------------------------------------------------------------- 1 | M = 6; 2 | N = 20; 3 | trials = 10000; 4 | n_full_rank = 0; 5 | for i=1:trials 6 | % Create a random matrix of size M x N 7 | A = rand(M,N); 8 | % Obtain its rank 9 | R = rank(A); 10 | % Check whether the rank equals M or not 11 | if R == M 12 | n_full_rank = n_full_rank + 1; 13 | end 14 | end 15 | fprintf('Number of trials: %d\n',trials); 16 | fprintf('Number of full rank matrices: %d\n',n_full_rank); 17 | percentage = n_full_rank*100/trials; 18 | fprintf('Percentage of full rank matrices: %.2f %%\n', percentage); 19 | 20 | -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/demo_gaussian_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/demo_gaussian_1.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/demo_gaussian_1_norm_hist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/demo_gaussian_1_norm_hist.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/demo_gaussian_1_singular_values.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/demo_gaussian_1_singular_values.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/piecewise_polynomial/dictionary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/piecewise_polynomial/dictionary.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/piecewise_polynomial/measurements.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/piecewise_polynomial/measurements.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/piecewise_polynomial/recovery_matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/piecewise_polynomial/recovery_matrix.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/piecewise_polynomial/representation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/piecewise_polynomial/representation.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/piecewise_polynomial/representation_sorted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/piecewise_polynomial/representation_sorted.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/piecewise_polynomial/sensing_matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/piecewise_polynomial/sensing_matrix.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/piecewise_polynomial/signal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/piecewise_polynomial/signal.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/rademacher_coherence_bound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/rademacher_coherence_bound.png -------------------------------------------------------------------------------- /docs/book/compressive_sensing/images/rademacher_rand_vec_tail_bound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/compressive_sensing/images/rademacher_rand_vec_tail_bound.png -------------------------------------------------------------------------------- /docs/book/convex_analysis.rst: -------------------------------------------------------------------------------- 1 | Convex Analysis 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | convex_analysis/convex_sets 8 | -------------------------------------------------------------------------------- /docs/book/data_analysis.rst: -------------------------------------------------------------------------------- 1 | Data Analysis 2 | =================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | data_analysis/pca 8 | 9 | -------------------------------------------------------------------------------- /docs/book/dce.rst: -------------------------------------------------------------------------------- 1 | Machine Learning 2 | ============================================ 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | dce/sample_data 8 | dce/features 9 | dce/linear_regression 10 | dce/linear_classification 11 | dce/bht 12 | dce/kernels 13 | dce/svm 14 | dce/rvm 15 | dce/graphical_models 16 | dce/em 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/book/dce/em.rst: -------------------------------------------------------------------------------- 1 | Expectation Maximization 2 | ============================= 3 | -------------------------------------------------------------------------------- /docs/book/dce/graphical_models.rst: -------------------------------------------------------------------------------- 1 | Graphical Models 2 | ====================== 3 | -------------------------------------------------------------------------------- /docs/book/dce/kernels.rst: -------------------------------------------------------------------------------- 1 | Kernel Methods 2 | ================= 3 | -------------------------------------------------------------------------------- /docs/book/dce/linear_classification.rst: -------------------------------------------------------------------------------- 1 | Linear Models for Classification 2 | ====================================== 3 | 4 | .. highlight:: matlab 5 | -------------------------------------------------------------------------------- /docs/book/dce/linear_regression.rst: -------------------------------------------------------------------------------- 1 | Linear Models for Regression 2 | ============================== 3 | 4 | .. highlight:: matlab 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | -------------------------------------------------------------------------------- /docs/book/dce/rvm.rst: -------------------------------------------------------------------------------- 1 | Relevance Vector Machines 2 | =============================== 3 | -------------------------------------------------------------------------------- /docs/book/dce/sample_data.rst: -------------------------------------------------------------------------------- 1 | Sample Data 2 | =============== 3 | 4 | .. highlight:: matlab 5 | 6 | 7 | Sinusoids 8 | ----------------------- 9 | 10 | 11 | Constructing a sinusoid with noise:: 12 | 13 | n = 10; 14 | sigma = 0.25; 15 | [x, y] = spx.data.synthetic.func.sinusoid('n', n, 'sigma', sigma); 16 | 17 | 18 | .. image:: sample_data/images/sinewave_1.png 19 | 20 | 21 | Sinusoid with four cycles:: 22 | 23 | n = 25; 24 | sigma = 0.25; 25 | x_min = 0; 26 | x_max = 2; 27 | f = 2; 28 | [x, y] = spx.data.synthetic.func.sinusoid('n', n, 'sigma', sigma, 'min', x_min, 'max', x_max, 'f', f); 29 | 30 | .. image:: sample_data/images/sinewave_2.png 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/book/dce/sample_data/demo_sinewave1.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | rng default; 5 | 6 | n = 10; 7 | sigma = 0.25; 8 | [x, y] = spx.data.synthetic.func.sinusoid('n', n, 'sigma', sigma); 9 | 10 | scatter(x, y); 11 | hold on; 12 | 13 | [x, y, res] = spx.data.synthetic.func.sinusoid('n', 500, 'sigma', 0); 14 | plot(x, y); 15 | 16 | xlim([res.min - .1, res.max + 0.1]); 17 | ylim([-1.2, 1.2]); 18 | 19 | grid 'on'; 20 | legend({'noisy', 'clean'}); 21 | 22 | title(sprintf('Sine wave with noise $\\sigma=%0.2f$', sigma),'interpreter','latex'); 23 | saveas(gcf, 'images/sinewave_1.png'); -------------------------------------------------------------------------------- /docs/book/dce/sample_data/demo_sinewave2.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | rng default; 5 | 6 | n = 25; 7 | sigma = 0.25; 8 | x_min = 0; 9 | x_max = 2; 10 | f = 2; 11 | [x, y] = spx.data.synthetic.func.sinusoid('n', n, 'sigma', sigma, 'min', x_min, 'max', x_max, 'f', f); 12 | 13 | scatter(x, y); 14 | hold on; 15 | 16 | [x, y, res] = spx.data.synthetic.func.sinusoid('n', 500, 'sigma', 0, 'min', x_min, 'max', x_max, 'f', f); 17 | plot(x, y); 18 | 19 | xlim([res.min - .1, res.max + 0.1]); 20 | ylim([-1.2, 1.2]); 21 | 22 | grid 'on'; 23 | legend({'noisy', 'clean'}); 24 | 25 | title(sprintf('Sine wave with noise $\\sigma=%0.2f$', sigma),'interpreter','latex'); 26 | saveas(gcf, 'images/sinewave_2.png'); -------------------------------------------------------------------------------- /docs/book/dce/sample_data/images/sinewave_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/dce/sample_data/images/sinewave_1.png -------------------------------------------------------------------------------- /docs/book/dce/sample_data/images/sinewave_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/dce/sample_data/images/sinewave_2.png -------------------------------------------------------------------------------- /docs/book/dce/svm.rst: -------------------------------------------------------------------------------- 1 | Support Vector Machines 2 | ============================ 3 | -------------------------------------------------------------------------------- /docs/book/diclearn.rst: -------------------------------------------------------------------------------- 1 | Dictionary Learning 2 | =============================== 3 | 4 | THIS CHAPTER IS NOT DEVELOPED YET. 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | diclearn/diclearn 10 | -------------------------------------------------------------------------------- /docs/book/diclearn/diclearn.rst: -------------------------------------------------------------------------------- 1 | Dictionary Learning 2 | ================================ 3 | 4 | UNDER DEVELOPMENT 5 | 6 | 7 | .. highlight:: matlab 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/book/ecg.rst: -------------------------------------------------------------------------------- 1 | ECG 2 | ==================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | ecg/intro 8 | -------------------------------------------------------------------------------- /docs/book/ecg/demo_heartrate.m: -------------------------------------------------------------------------------- 1 | load mit200; 2 | 3 | annotated_times = tm(ann); 4 | beat = diff(annotated_times); 5 | heart_rate = mean(60./beat); 6 | fprintf('Heart rate: %.2f\n', heart_rate); -------------------------------------------------------------------------------- /docs/book/ecg/demo_synthetic.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | 5 | x = spx.ecg.synthetic.simple_multiple(500, 10); 6 | figure; 7 | plot(x); 8 | xlabel('Time'); 9 | ylabel('Amplitude'); 10 | grid on; -------------------------------------------------------------------------------- /docs/book/geometry.rst: -------------------------------------------------------------------------------- 1 | Geometry 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | geometry/algebraic_geometry 8 | -------------------------------------------------------------------------------- /docs/book/linear_algebra.rst: -------------------------------------------------------------------------------- 1 | Linear Algebra 2 | ==================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | linear_algebra/vector_spaces 8 | linear_algebra/transformations 9 | linear_algebra/inner_product_spaces 10 | linear_algebra/euclidean_space 11 | linear_algebra/complex_space 12 | linear_algebra/affine 13 | linear_algebra/matrix_factorizations 14 | linear_algebra/principal_angles 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/book/matrices.rst: -------------------------------------------------------------------------------- 1 | Matrix Algebra 2 | ================================================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | matrices/intro 8 | matrices/rank_span_independence 9 | matrices/invertible_matrices 10 | matrices/trace_det 11 | matrices/unitary_matrices 12 | matrices/eigen_values 13 | matrices/singular_values 14 | matrices/matrix_norms 15 | matrices/matrix_calculus 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/book/opt.rst: -------------------------------------------------------------------------------- 1 | Numerical Optimization 2 | =============================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | opt/soft_thresholding 8 | 9 | -------------------------------------------------------------------------------- /docs/book/opt/images/quadratic_with_restricted_domain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/opt/images/quadratic_with_restricted_domain.png -------------------------------------------------------------------------------- /docs/book/opt/images/shrinkage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/opt/images/shrinkage.png -------------------------------------------------------------------------------- /docs/book/probability.rst: -------------------------------------------------------------------------------- 1 | Probability and Random Variables 2 | =================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | probability/random_variables 8 | probability/distribution_gaussian 9 | probability/inequalities_basic 10 | probability/two_variables 11 | probability/expectation 12 | probability/complex_variable 13 | probability/random_vectors 14 | probability/gaussian_random_vector 15 | -------------------------------------------------------------------------------- /docs/book/probability/complex_variable.rst: -------------------------------------------------------------------------------- 1 | 2 | Complex random variable 3 | =================================================== 4 | 5 | 6 | 7 | For a complex random variable :math:`Z = X + j Y`, its PDF is the 8 | joint PDF of the r.v. X and Y. 9 | 10 | 11 | .. math:: 12 | f_Z(z) = f_{X, Y} (x, y). 13 | 14 | The integral over the complex space is defined as 15 | 16 | 17 | .. math:: 18 | \int_{z \in \CC} f_Z(z) d z = \int_{-\infty}^{\infty} 19 | \int_{-\infty}^{\infty} f_{X, Y} (x, y) d x d y = 1. 20 | 21 | 22 | .. disqus:: 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/book/probability/dist_bernaulli.rst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/probability/dist_bernaulli.rst -------------------------------------------------------------------------------- /docs/book/pursuit.rst: -------------------------------------------------------------------------------- 1 | Pursuit Algorithms 2 | =========================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | pursuit/greedy_prelude 8 | pursuit/mp/index 9 | pursuit/omp/index 10 | pursuit/ols/index 11 | pursuit/cosamp/index 12 | pursuit/iht/index 13 | pursuit/htp/index 14 | pursuit/testing_framework 15 | -------------------------------------------------------------------------------- /docs/book/pursuit/cosamp/index.rst: -------------------------------------------------------------------------------- 1 | Compressive sampling matching pursuit 2 | ======================================= 3 | 4 | -------------------------------------------------------------------------------- /docs/book/pursuit/demo_sparse_bigaussian.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | rng default; 5 | N = 128; 6 | K = 8; 7 | gen = spx.data.synthetic.SparseSignalGenerator(N, K); 8 | rep = gen.biGaussian(); 9 | figure; 10 | stem(rep, '.'); 11 | export_fig images/demo_sparse_bigaussian_1.png -r120 -nocrop; 12 | 13 | nz_rep = rep(rep~=0)'; 14 | anz_rep = abs(nz_rep); 15 | dr = max(anz_rep) / min(anz_rep); 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/book/pursuit/demo_sparse_biuniform.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | rng default; 5 | N = 32; 6 | K = 4; 7 | gen = spx.data.synthetic.SparseSignalGenerator(N, K); 8 | rep = gen.biUniform(); 9 | figure; 10 | stem(rep, '.'); 11 | export_fig images/demo_sparse_biuniform_1.png -r120 -nocrop; 12 | 13 | rep = gen.biUniform(2, 4); 14 | figure; 15 | stem(rep, '.'); 16 | export_fig images/demo_sparse_biuniform_2.png -r120 -nocrop; 17 | 18 | -------------------------------------------------------------------------------- /docs/book/pursuit/demo_sparse_gaussian.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | rng default; 5 | N = 128; 6 | K = 8; 7 | gen = spx.data.synthetic.SparseSignalGenerator(N, K); 8 | rep = gen.gaussian(); 9 | figure; 10 | stem(rep, '.'); 11 | export_fig images/demo_sparse_gaussian_1.png -r120 -nocrop; 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/book/pursuit/demo_sparse_rademacher.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | rng default; 5 | N = 128; 6 | K = 8; 7 | gen = spx.data.synthetic.SparseSignalGenerator(N, K); 8 | rep = gen.rademacher(); 9 | figure; 10 | stem(rep, '.'); 11 | export_fig images/demo_sparse_rademacher_1.png -r120 -nocrop; 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/book/pursuit/demo_sparse_uniform.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | rng default; 5 | N = 32; 6 | K = 4; 7 | gen = spx.data.synthetic.SparseSignalGenerator(N, K); 8 | rep = gen.uniform(); 9 | figure; 10 | stem(rep, '.'); 11 | export_fig images/demo_sparse_uniform_1.png -r120 -nocrop; 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/book/pursuit/htp/index.rst: -------------------------------------------------------------------------------- 1 | Hard thresholding pursuit 2 | ======================================= 3 | 4 | -------------------------------------------------------------------------------- /docs/book/pursuit/iht/index.rst: -------------------------------------------------------------------------------- 1 | Iterative hard thresholding 2 | ======================================= 3 | 4 | -------------------------------------------------------------------------------- /docs/book/pursuit/images/demo_sparse_bigaussian_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/pursuit/images/demo_sparse_bigaussian_1.png -------------------------------------------------------------------------------- /docs/book/pursuit/images/demo_sparse_biuniform_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/pursuit/images/demo_sparse_biuniform_1.png -------------------------------------------------------------------------------- /docs/book/pursuit/images/demo_sparse_biuniform_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/pursuit/images/demo_sparse_biuniform_2.png -------------------------------------------------------------------------------- /docs/book/pursuit/images/demo_sparse_gaussian_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/pursuit/images/demo_sparse_gaussian_1.png -------------------------------------------------------------------------------- /docs/book/pursuit/images/demo_sparse_rademacher_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/pursuit/images/demo_sparse_rademacher_1.png -------------------------------------------------------------------------------- /docs/book/pursuit/images/demo_sparse_uniform_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/pursuit/images/demo_sparse_uniform_1.png -------------------------------------------------------------------------------- /docs/book/pursuit/mp/images/alg_matching_pursuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/pursuit/mp/images/alg_matching_pursuit.png -------------------------------------------------------------------------------- /docs/book/pursuit/mp/index.rst: -------------------------------------------------------------------------------- 1 | .. _sec:pursuit:greedy:mp: 2 | 3 | Matching Pursuit 4 | ======================================= 5 | 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | 10 | algorithm 11 | fast_mp 12 | 13 | -------------------------------------------------------------------------------- /docs/book/pursuit/ols/index.rst: -------------------------------------------------------------------------------- 1 | Orthogonal least squares 2 | ======================================= 3 | 4 | -------------------------------------------------------------------------------- /docs/book/pursuit/omp/demo_fast_omp.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | rng default; 5 | M = 100; 6 | N = 1000; 7 | A = spx.dict.simple.gaussian_mtx(M, N); 8 | S = 1000; 9 | K = 10; 10 | gen = spx.data.synthetic.SparseSignalGenerator(N, K, S); 11 | % create a sparse vector 12 | X = gen.biGaussian(); 13 | Y = A*X; 14 | start_time = tic; 15 | result = spx.fast.omp(A, Y, K, 1e-12); 16 | elapsed_time = toc(start_time); 17 | fprintf('Time taken: %.2f seconds\n', elapsed_time); 18 | fprintf('Per signal time: %.2f usec', elapsed_time * 1e6/ S); 19 | cmpare = spx.commons.SparseSignalsComparison(X, result, K); 20 | cmpare.summarize(); 21 | -------------------------------------------------------------------------------- /docs/book/pursuit/omp/demo_hadamard.m: -------------------------------------------------------------------------------- 1 | close all; clearvars; clc; 2 | rng default; 3 | 4 | PhiA = hadamard(20); 5 | rows = randperm(20, 10); 6 | PhiB = PhiA(rows, :); 7 | 8 | Phi = 1/sqrt(10) * PhiB; 9 | 10 | spx.norm.norms_l2_cw(Phi) -------------------------------------------------------------------------------- /docs/book/pursuit/omp/images/algorithm_batch_omp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/pursuit/omp/images/algorithm_batch_omp.png -------------------------------------------------------------------------------- /docs/book/pursuit/omp/images/algorithm_omp_x_alpha_version.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/pursuit/omp/images/algorithm_omp_x_alpha_version.png -------------------------------------------------------------------------------- /docs/book/pursuit/omp/images/algorithm_orthogonal_matching_pursuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/pursuit/omp/images/algorithm_orthogonal_matching_pursuit.png -------------------------------------------------------------------------------- /docs/book/pursuit/omp/index.rst: -------------------------------------------------------------------------------- 1 | Orthogonal Matching Pursuit 2 | ======================================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | algorithm 8 | erc_conditions 9 | sparse_approximation_conditions 10 | fast_omp 11 | batch_omp 12 | -------------------------------------------------------------------------------- /docs/book/real_analysis.rst: -------------------------------------------------------------------------------- 1 | Real Analysis 2 | ================================================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | real_analysis/metric_spaces 8 | -------------------------------------------------------------------------------- /docs/book/set_theory.rst: -------------------------------------------------------------------------------- 1 | Set Theory 2 | ==================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | set_theory/intro 8 | set_theory/sets 9 | set_theory/functions 10 | set_theory/relations 11 | set_theory/countable_uncountable 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/book/signal_processing.rst: -------------------------------------------------------------------------------- 1 | Digital Signal Processing 2 | ================================ 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | signal_processing/rle 8 | signal_processing/dct 9 | signal_processing/dtmf 10 | 11 | -------------------------------------------------------------------------------- /docs/book/signal_processing/demo_rle.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | x = [0 0 0 0 0 0 0 4 4 4 3 3 2 2 2 2 2 2 2 1 1 0 0 0 0 0 2 3 9 5 5 5 5 5 5] 5 | diff_positions = find(diff(x) ~= 0) 6 | runs = diff([0 diff_positions numel(x)]) 7 | start_positions = [1 (diff_positions + 1)] 8 | symbols = x(start_positions) 9 | encoding = [symbols; runs] 10 | encoding = encoding(:)' 11 | total_symbols = sum(runs) 12 | 13 | x_dec = []; 14 | for i=1:numel(encoding) / 2 15 | symbol = encoding(i*2 -1); 16 | run_length = encoding(i*2); 17 | x_dec = [x_dec symbol * ones([1, run_length])]; 18 | end 19 | fprintf('%d ', x_dec); 20 | fprintf('\n'); 21 | sum(x_dec - x) 22 | -------------------------------------------------------------------------------- /docs/book/signal_processing/images/dtmf_4507.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/signal_processing/images/dtmf_4507.png -------------------------------------------------------------------------------- /docs/book/signal_processing/images/dtmf_4507_envelope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/signal_processing/images/dtmf_4507_envelope.png -------------------------------------------------------------------------------- /docs/book/signal_processing/images/dtmf_4507_periodogram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/signal_processing/images/dtmf_4507_periodogram.png -------------------------------------------------------------------------------- /docs/book/signal_processing/images/dtmf_4507_pulses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/signal_processing/images/dtmf_4507_pulses.png -------------------------------------------------------------------------------- /docs/book/signal_processing/images/dtmf_4507_spectrogram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/signal_processing/images/dtmf_4507_spectrogram.png -------------------------------------------------------------------------------- /docs/book/signal_processing/images/dtmf_4507_spectrogram_50ms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/signal_processing/images/dtmf_4507_spectrogram_50ms.png -------------------------------------------------------------------------------- /docs/book/signal_processing/images/dtmf_4507_spectrogram_50ms_40ms_50db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/signal_processing/images/dtmf_4507_spectrogram_50ms_40ms_50db.png -------------------------------------------------------------------------------- /docs/book/signal_processing/images/dtmf_4507_spectrogram_50ms_40ms_50db_reassigned.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/signal_processing/images/dtmf_4507_spectrogram_50ms_40ms_50db_reassigned.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models.rst: -------------------------------------------------------------------------------- 1 | .. _ch:sparse_signal_models: 2 | 3 | Sparse Signal Models 4 | ====================================== 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | sparse_signal_models/outline 10 | sparse_signal_models/underdetermined 11 | sparse_signal_models/dictionary_representations 12 | sparse_signal_models/norms 13 | sparse_signal_models/compressible 14 | sparse_signal_models/dictionary_analysis 15 | sparse_signal_models/spark 16 | sparse_signal_models/coherence 17 | sparse_signal_models/babel 18 | sparse_signal_models/dirac_dct_dict 19 | sparse_signal_models/dirac_hadamard_dict 20 | sparse_signal_models/wavelet_toolbox_dictionaries 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/demo_dirac_dct_1.m: -------------------------------------------------------------------------------- 1 | close all; clearvars; clc; 2 | N = 256; 3 | Phi = spx.dict.simple.dirac_dct_mtx(N); 4 | figure; 5 | imagesc(Phi); 6 | colorbar; 7 | export_fig images/demo_dirac_dct_1.png -r120 -nocrop; 8 | 9 | mu1 = spx.dict.babel(Phi); 10 | figure; 11 | plot(mu1); 12 | grid on; 13 | export_fig images/demo_dirac_dct_babel.png -r120 -nocrop; 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/demo_dirac_hadamard_1.m: -------------------------------------------------------------------------------- 1 | close all; clearvars; clc; 2 | N = 256; 3 | Phi = spx.dict.simple.dirac_hadamard_mtx(N); 4 | figure; 5 | imagesc(Phi); 6 | colorbar; 7 | export_fig images/demo_dirac_hadamard_1.png -r120 -nocrop; 8 | 9 | mu1 = spx.dict.babel(Phi); 10 | figure; 11 | plot(mu1); 12 | grid on; 13 | export_fig images/demo_dirac_hadamard_babel.png -r120 -nocrop; 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/demo_partial_hadamard_spark.m: -------------------------------------------------------------------------------- 1 | close all; clearvars; clc; 2 | rng default; 3 | 4 | PhiA = hadamard(20); 5 | rows = randperm(20, 10); 6 | Phi = PhiA(rows, :); 7 | 8 | spx.norm.norms_l2_cw(Phi) 9 | 10 | spx.dict.spark(Phi) 11 | -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/demo_wmp_dicts.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | 5 | N = 32; 6 | Phi = wmpdictionary(N, 'lstcpt', {'RnIdent', 'dct'}); 7 | figure; 8 | imagesc(Phi); 9 | colorbar; 10 | 11 | saveas(gcf, sprintf('images/wmp_dirac_dct_N_%d.png', N)); 12 | 13 | N = 256; 14 | [Phi, nb_atoms] = wmpdictionary(N, 'lstcpt', { {'sym4', 5}, 'dct'}); 15 | figure; 16 | imagesc(Phi); 17 | colorbar; 18 | 19 | saveas(gcf, sprintf('images/wmp_sym4_dct_N_%d.png', N)); 20 | 21 | 22 | N = 256; 23 | [Phi, nb_atoms] = wmpdictionary(N, 'lstcpt', { {'sym4', 5}, {'wpsym4', 5}, 'dct'}); 24 | figure; 25 | imagesc(Phi); 26 | colorbar; 27 | 28 | saveas(gcf, sprintf('images/wmp_sym4_wpsym4_dct_N_%d.png', N)); 29 | 30 | -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/demo_dirac_dct_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/demo_dirac_dct_1.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/demo_dirac_dct_babel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/demo_dirac_dct_babel.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/demo_dirac_hadamard_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/demo_dirac_hadamard_1.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/demo_dirac_hadamard_babel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/demo_dirac_hadamard_babel.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/spark_naive_algorithm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/spark_naive_algorithm.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/sparse_representation_framework.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/sparse_representation_framework.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/underdetermined_system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/underdetermined_system.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/underdetermined_system_l1_balls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/underdetermined_system_l1_balls.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/underdetermined_system_l2_balls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/underdetermined_system_l2_balls.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/wmp_dirac_dct_N_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/wmp_dirac_dct_N_32.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/wmp_sym4_dct_N_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/wmp_sym4_dct_N_256.png -------------------------------------------------------------------------------- /docs/book/sparse_signal_models/images/wmp_sym4_wpsym4_dct_N_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/sparse_signal_models/images/wmp_sym4_wpsym4_dct_N_256.png -------------------------------------------------------------------------------- /docs/book/subspace_clustering/demo_uniform_points_multiple_subspaces.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | rng default; 5 | 6 | % Ambient space dimension 7 | M = 10; 8 | % Number of subspaces 9 | K = 4; 10 | % common dimension for each subspace 11 | D = 5; 12 | 13 | % Construct bases for random subspaces 14 | bases = spx.data.synthetic.subspaces.random_subspaces(M, K, D); 15 | cluster_sizes = [10 4 4 8]; 16 | data_points = spx.data.synthetic.subspaces.uniform_points_on_subspaces(bases, cluster_sizes); 17 | -------------------------------------------------------------------------------- /docs/book/subspace_clustering/images/alg_spr_admm_linear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/subspace_clustering/images/alg_spr_admm_linear.png -------------------------------------------------------------------------------- /docs/book/subspace_clustering/images/alg_ssc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/subspace_clustering/images/alg_ssc.png -------------------------------------------------------------------------------- /docs/book/subspace_clustering/images/alg_ssc_mc_omp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/subspace_clustering/images/alg_ssc_mc_omp.png -------------------------------------------------------------------------------- /docs/book/subspace_clustering/images/random_subspace_a_3d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/subspace_clustering/images/random_subspace_a_3d.png -------------------------------------------------------------------------------- /docs/book/subspace_clustering/images/random_subspace_a_b_3d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/subspace_clustering/images/random_subspace_a_b_3d.png -------------------------------------------------------------------------------- /docs/book/subspace_clustering/images/uniform_points_2d_subspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/subspace_clustering/images/uniform_points_2d_subspace.png -------------------------------------------------------------------------------- /docs/book/wavelets.rst: -------------------------------------------------------------------------------- 1 | Wavelets 2 | ======================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | wavelets/fundamentals 8 | wavelets/matlab_wavelet_toolbox 9 | 10 | -------------------------------------------------------------------------------- /docs/book/wavelets/fundamentals.rst: -------------------------------------------------------------------------------- 1 | Fundamentals 2 | ==================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | fundamentals/essentials 8 | -------------------------------------------------------------------------------- /docs/book/wavelets/matlab_wavelet_toolbox.rst: -------------------------------------------------------------------------------- 1 | MATLAB Wavelet Toolbox 2 | =============================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | wavelet_toolbox/wavelet_toolbox_intro 8 | wavelet_toolbox/daubechies 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/demo_db4.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | [LoD,HiD,LoR,HiR] = wfilters('db4'); 5 | subplot(221); 6 | stem(LoD, '.'); title('Lowpass Decomposition'); 7 | subplot(222); 8 | stem(LoR,'.'); title('Lowpass Reconstruction'); 9 | subplot(223); 10 | stem(HiD,'.'); title('Highpass Decomposition'); 11 | subplot(224); 12 | stem(HiR,'.'); title('Highpass Reconstruction'); 13 | 14 | export_fig images/db4_filters.png -r120 -nocrop; 15 | -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/demo_db4_noisdopp_swt.m: -------------------------------------------------------------------------------- 1 | 2 | close all; 3 | clearvars; 4 | clc; 5 | [LoD,HiD,LoR,HiR] = wfilters('db4'); 6 | 7 | load noisdopp; 8 | % perform decomposition 9 | coefficients = swt(noisdopp, 4, LoD,HiD); 10 | 11 | % plot approximation and detail components 12 | figure; 13 | for level=0:4 14 | subplot(511+level); 15 | plot(coefficients(level+1, :)); 16 | title(sprintf('SWT Coefficients @level-%d', level)); 17 | end 18 | 19 | export_fig images/noisdoop_db4_l4_swt.png -r120 -nocrop; 20 | 21 | 22 | reconstructed = iswt(coefficients,LoR,HiR); 23 | 24 | % measure the maximum difference 25 | max_abs_diff = max(abs(noisdopp-reconstructed)) 26 | -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/images/db4_filters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/wavelets/wavelet_toolbox/images/db4_filters.png -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/images/noisdoop_db4_l4_swt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/wavelets/wavelet_toolbox/images/noisdoop_db4_l4_swt.png -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/images/noisdopp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/wavelets/wavelet_toolbox/images/noisdopp.png -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/images/noisdopp_db4_decomposition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/wavelets/wavelet_toolbox/images/noisdopp_db4_decomposition.png -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/images/noisdopp_db4_l4_appcoeffs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/wavelets/wavelet_toolbox/images/noisdopp_db4_l4_appcoeffs.png -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/images/noisdopp_db4_l4_appcoeffs_per.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/wavelets/wavelet_toolbox/images/noisdopp_db4_l4_appcoeffs_per.png -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/images/noisdopp_db4_l4_decomposition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/wavelets/wavelet_toolbox/images/noisdopp_db4_l4_decomposition.png -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/images/noisdopp_db4_l4_decomposition_per.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/wavelets/wavelet_toolbox/images/noisdopp_db4_l4_decomposition_per.png -------------------------------------------------------------------------------- /docs/book/wavelets/wavelet_toolbox/images/wavelet_basis_db4_level_4_N_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/book/wavelets/wavelet_toolbox/images/wavelet_basis_db4_level_4_N_1024.png -------------------------------------------------------------------------------- /docs/buildhtml.bat: -------------------------------------------------------------------------------- 1 | make html 2 | -------------------------------------------------------------------------------- /docs/copy_references.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | copy "I:\work\projects\public\articles\texmf\bibtex\bib\misc\sksrrcs.bib" . 3 | sed 's/@online/@misc/' sksrrcs.bib > sksrrcs2.bib 4 | mv sksrrcs2.bib sksrrcs.bib 5 | 6 | -------------------------------------------------------------------------------- /docs/demos/images/cs_l_1_minimization_solution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/cs_l_1_minimization_solution.png -------------------------------------------------------------------------------- /docs/demos/images/cs_matching_pursuit_solution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/cs_matching_pursuit_solution.png -------------------------------------------------------------------------------- /docs/demos/images/cs_orthogonal_matching_pursuit_solution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/cs_orthogonal_matching_pursuit_solution.png -------------------------------------------------------------------------------- /docs/demos/images/dct_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/dct_256.png -------------------------------------------------------------------------------- /docs/demos/images/dirac_dct_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/dirac_dct_256.png -------------------------------------------------------------------------------- /docs/demos/images/dirac_dct_l_1_solution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/dirac_dct_l_1_solution.png -------------------------------------------------------------------------------- /docs/demos/images/dirac_dct_mp_solution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/dirac_dct_mp_solution.png -------------------------------------------------------------------------------- /docs/demos/images/dirac_dct_omp_solution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/dirac_dct_omp_solution.png -------------------------------------------------------------------------------- /docs/demos/images/gaussian_matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/gaussian_matrix.png -------------------------------------------------------------------------------- /docs/demos/images/guassian_sensing_matrix_histogram.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/guassian_sensing_matrix_histogram.pdf -------------------------------------------------------------------------------- /docs/demos/images/guassian_sensing_matrix_histogram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/guassian_sensing_matrix_histogram.png -------------------------------------------------------------------------------- /docs/demos/images/impulse_cosine_combination_signal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/impulse_cosine_combination_signal.png -------------------------------------------------------------------------------- /docs/demos/images/impulse_cosine_dct_basis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/impulse_cosine_dct_basis.png -------------------------------------------------------------------------------- /docs/demos/images/impulse_cosine_dirac_dct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/impulse_cosine_dirac_dct.png -------------------------------------------------------------------------------- /docs/demos/images/k_sparse_biuniform_signal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/k_sparse_biuniform_signal.png -------------------------------------------------------------------------------- /docs/demos/images/k_sparse_gaussian_signal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/k_sparse_gaussian_signal.png -------------------------------------------------------------------------------- /docs/demos/images/measurement_vector_biuniform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/measurement_vector_biuniform.png -------------------------------------------------------------------------------- /docs/demos/images/measurement_vector_biuniform_noisy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/demos/images/measurement_vector_biuniform_noisy.png -------------------------------------------------------------------------------- /docs/exercises/images/OMP_gaussian_dict_gaussian_data_k_vs_min_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/exercises/images/OMP_gaussian_dict_gaussian_data_k_vs_min_m.png -------------------------------------------------------------------------------- /docs/exercises/images/OMP_gaussian_dict_gaussian_data_phase_transition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/exercises/images/OMP_gaussian_dict_gaussian_data_phase_transition.png -------------------------------------------------------------------------------- /docs/exercises/images/dirac_dct_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/exercises/images/dirac_dct_256.png -------------------------------------------------------------------------------- /docs/exercises/images/gaussian_matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/exercises/images/gaussian_matrix.png -------------------------------------------------------------------------------- /docs/exercises/images/k_sparse_biuniform_signal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/exercises/images/k_sparse_biuniform_signal.png -------------------------------------------------------------------------------- /docs/exercises/images/measurement_vector_biuniform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/exercises/images/measurement_vector_biuniform.png -------------------------------------------------------------------------------- /docs/exercises/images/omp_algorithm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/exercises/images/omp_algorithm.png -------------------------------------------------------------------------------- /docs/exercises/images/proxy_vector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/exercises/images/proxy_vector.png -------------------------------------------------------------------------------- /docs/images/union_of_subspaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/docs/images/union_of_subspaces.png -------------------------------------------------------------------------------- /docs/latex/algorithms/alg_mp.tex: -------------------------------------------------------------------------------- 1 | \documentclass[../article_algorithms.tex]{subfiles} 2 | \begin{document} 3 | \begin{tcolorbox}[width=(\linewidth-3.5cm)] 4 | \begin{algorithm}[H] 5 | \footnotesize 6 | \SetAlgoLined 7 | \DontPrintSemicolon 8 | \label{alg:mp} 9 | $z = \text{MP}(\Phi, y, \epsilon)$\; 10 | $z \leftarrow 0$\; 11 | $r \leftarrow y$ \tcp*{$r = y - \Phi z$} 12 | 13 | \Repeat{$\|r\|_2 \leq \epsilon$}{ 14 | $h \leftarrow \Phi^T r$ \tcp*{Match} 15 | $ k \leftarrow \underset{1 \leq j \leq N}{\text{arg} \;\max} (\abs(h_j))$\tcp*{Identify} 16 | $z_k \leftarrow z_k + h_k$ \tcp*{Update representation} 17 | $r \leftarrow r - h_k \phi_k$ \tcp*{Update residual} 18 | } 19 | \end{algorithm} 20 | \end{tcolorbox} 21 | \end{document} 22 | -------------------------------------------------------------------------------- /docs/library/commons/index.rst: -------------------------------------------------------------------------------- 1 | Common utilities 2 | ===================== 3 | 4 | 5 | Contents: 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | signals 11 | matrix 12 | norms 13 | sparse 14 | comparison 15 | number 16 | print 17 | recovery 18 | 19 | -------------------------------------------------------------------------------- /docs/library/commons/number.rst: -------------------------------------------------------------------------------- 1 | Working with Numbers 2 | ================================ 3 | 4 | 5 | .. highlight:: matlab 6 | 7 | Some algorithms from number theory are useful 8 | at times. 9 | 10 | 11 | Finding integer factors closest to square root:: 12 | 13 | >> [a,b] = spx.discrete.number.integer_factors_close_to_sqr_root(120) 14 | a = 10 15 | b = 12 16 | 17 | -------------------------------------------------------------------------------- /docs/library/commons/recovery.rst: -------------------------------------------------------------------------------- 1 | Sparse recovery 2 | =============================== 3 | 4 | .. highlight:: matlab 5 | 6 | Estimate for the required number of measurements for sparse signals 7 | in ``N`` and sparsity level ``K`` based on paper by Donoho and Tanner:: 8 | 9 | M = spx.commons.sparse.phase_transition_estimate_m(N, K); 10 | 11 | Example:: 12 | 13 | >> spx.commons.sparse.phase_transition_estimate_m(1000, 4) 14 | 60 15 | 16 | -------------------------------------------------------------------------------- /docs/library/external.rst: -------------------------------------------------------------------------------- 1 | External Code 2 | ======================= 3 | 4 | .. highlight:: matlab 5 | 6 | almost equal:: 7 | 8 | isalmost(a,b,tol) 9 | 10 | 11 | Timing 12 | ---------------- 13 | 14 | :: 15 | 16 | [t, measurement_overhead, measurement_details] = timeit(f, num_outputs) 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/library/index.rst: -------------------------------------------------------------------------------- 1 | Library Classes 2 | ========================================= 3 | 4 | 5 | Contents: 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | pursuit/index 11 | commons/index 12 | synthetic 13 | graphics 14 | dictionaries 15 | vectorspace 16 | combinatorics 17 | factorization 18 | mex 19 | external 20 | noise 21 | 22 | 23 | 24 | 25 | .. 26 | clustering 27 | diclearn 28 | bht 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/library/pursuit/cosamp.rst: -------------------------------------------------------------------------------- 1 | Compressive sampling matching pursuit 2 | ============================================== 3 | 4 | .. highlight:: matlab 5 | 6 | 7 | 8 | Constructing the solver with dictionary and expected sparsity level:: 9 | 10 | solver = spx.pursuit.single.CoSaMP(Dict, K) 11 | 12 | 13 | Using the solver to obtain the sparse representation of one vector:: 14 | 15 | result = solver.solve(y) 16 | 17 | Using the solver to obtain the sparse representations of all vectors 18 | in the signal matrix Y independently:: 19 | 20 | result = solver.solve_all(Y) 21 | -------------------------------------------------------------------------------- /docs/library/pursuit/joint/comp.rst: -------------------------------------------------------------------------------- 1 | Cluster orthogonal matching pursuit 2 | ============================================== 3 | 4 | .. highlight:: matlab 5 | 6 | 7 | .. warning:: 8 | 9 | This is new algorithm under research. 10 | 11 | 12 | :: 13 | 14 | solver = spx.pursuit.joint.ClusterOMP(Dict, K) 15 | result = solver.solve(Y) 16 | -------------------------------------------------------------------------------- /docs/library/pursuit/joint/index.rst: -------------------------------------------------------------------------------- 1 | Joint recovery algorithms 2 | ==================================== 3 | 4 | 5 | .. toctree:: 6 | :maxdepth: 1 7 | 8 | comp 9 | 10 | -------------------------------------------------------------------------------- /docs/library/pursuit/mp.rst: -------------------------------------------------------------------------------- 1 | Matching pursuit 2 | ================================ 3 | 4 | .. highlight:: matlab 5 | 6 | 7 | Constructing the solver with dictionary and expected sparsity level:: 8 | 9 | solver = spx.pursuit.single.MatchingPursuit(Dict, K) 10 | 11 | Using the solver to obtain the sparse representation of one vector:: 12 | 13 | result = solver.solve(y) 14 | 15 | Using the solver to obtain the sparse representations of all vectors 16 | in the signal matrix Y independently:: 17 | 18 | 19 | result = solver.solve_all(Y) -------------------------------------------------------------------------------- /docs/notes.txt: -------------------------------------------------------------------------------- 1 | Notes for copying text from latex to sphinxdoc 2 | ------------------------------------------------------- 3 | 4 | - Section headings 5 | - inline math 6 | - Citations 7 | - Definitions 8 | - texttopdfstring 9 | - equation 10 | - l_1 to \ell_1 11 | - l_2 to \ell_2 12 | - eqref 13 | - \term 14 | - \index 15 | - \emph 16 | - Its vs It's 17 | 18 | Replacing inline math: 19 | 20 | - Search: \$(.*?)\$ 21 | - Replace: :math:`\1` 22 | 23 | 24 | 25 | Replacing index: 26 | 27 | Search: \\index\{(.*?)\} 28 | Replace: \n.. index:: \1\n 29 | 30 | Replacing term: 31 | 32 | Search: \\term\{(.*?)\} 33 | Replace: **\1** 34 | 35 | Replacing: emph 36 | 37 | Search: \\emph\{(.*?)\} 38 | Replace: *\1* 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/openhtml.bat: -------------------------------------------------------------------------------- 1 | _build\html\index.html 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/zzzreferences.rst: -------------------------------------------------------------------------------- 1 | References 2 | =================== 3 | 4 | .. bibliography:: sksrrcs.bib 5 | :cited: 6 | -------------------------------------------------------------------------------- /examples/commons/sparse/ex_partial_svd_compose_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clearvars; 3 | rng default; 4 | A = magic(6); 5 | 6 | [n1, n2] = size(A); 7 | 8 | sz = n1 * n2; 9 | 10 | factors = [0.05 0.1 0.2 0.3]; 11 | A 12 | for f=factors 13 | m = round(f * sz); 14 | fprintf('Trying for factor=%f, m=%d\n', f, m); 15 | Omega = spx.stats.rand_subset(sz, m); 16 | [U, S, V] = svd(A); 17 | y = spx.fast.partial_svd_compose(U, diag(S), V, Omega); 18 | spx.io.print.vector(y); 19 | A2 = spx.sparse.join_data_indices(y, Omega, n1, n2); 20 | full(A2) 21 | end 22 | A 23 | -------------------------------------------------------------------------------- /examples/commons/sparse/ex_sample_sparse_mat_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clearvars; 3 | rng default; 4 | A = magic(6); 5 | 6 | [n1, n2] = size(A); 7 | 8 | sz = n1 * n2; 9 | 10 | m = round(.2 * sz); 11 | 12 | Omega = spx.stats.rand_subset(sz, m); 13 | 14 | data = A(Omega); 15 | 16 | A2 = spx.sparse.join_data_indices(data, Omega, n1, n2); 17 | 18 | A 19 | full(A2) 20 | 21 | [data2, Omega2, m1, m2] = spx.sparse.split_data_indices(A2); 22 | 23 | spx.io.print.vector(Omega, 0); 24 | spx.io.print.vector(Omega2, 0); 25 | 26 | A3 = spx.sparse.join_data_indices(data2, Omega2, m1, m2); 27 | 28 | full(A3) -------------------------------------------------------------------------------- /examples/commons/sparse/ex_update_sparse_data.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clearvars; 3 | rng default; 4 | A = magic(6); 5 | 6 | [n1, n2] = size(A); 7 | 8 | sz = n1 * n2; 9 | 10 | m = round(.2 * sz); 11 | 12 | Omega = spx.stats.rand_subset(sz, m); 13 | 14 | data = A(Omega); 15 | 16 | A2 = spx.sparse.join_data_indices(data, Omega, n1, n2); 17 | [data2, Omega2, m1, m2] = spx.sparse.split_data_indices(A2); 18 | 19 | data2 = 2*data2; 20 | full(A2) 21 | spx.fast.update_sparse_data(A2, data2); 22 | full(A2) -------------------------------------------------------------------------------- /examples/data/signals/ex_multitone.m: -------------------------------------------------------------------------------- 1 | 2 | % Initialization 3 | clear all; close all; clc; 4 | gen = spx.data.synthetic.MultiToneSignalGenerator(); 5 | gen.TotalDuration = 0.35; 6 | % Sampling frequency 7 | gen.SamplingFrequency = 1000; 8 | % Frequencies (Hz) 9 | gen.Frequencies = [113 247 327 413]; 10 | % Each frequency will be present in a segment of the 11 | % overall signal duration. 12 | % The segment is described by its origin and its duration. 13 | gen.Origins = [0 0 0.030 0.150]; 14 | gen.Durations = [0.350 0.050 0.200 0.200]; 15 | % Amplitudes for each frequency 16 | gen.Amplitudes = [1 1.7 1.9 1.8]; 17 | 18 | [x , t] = gen.run(); 19 | plot(t, x); 20 | -------------------------------------------------------------------------------- /examples/data/signals/ex_picket_fence.m: -------------------------------------------------------------------------------- 1 | % Demonstrates Picket Fence signal 2 | 3 | % Initialization 4 | clear all; close all; clc; 5 | 6 | 7 | N = 256; 8 | 9 | x = SPX_SimpleSignals.picket_fence(N); 10 | 11 | fx = fft(x); 12 | 13 | spx.graphics.figure.full_screen; 14 | subplot(211); 15 | stem(x, '.'); 16 | title('Time domain'); 17 | subplot(212); 18 | stem(fx, '.'); 19 | title('Frequency domain'); 20 | -------------------------------------------------------------------------------- /examples/data/yale_faces/ex_omp_rep_svds.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | 3 | load omp_representations; 4 | [D, total_images] = size(representations); 5 | num_subjects = 38; 6 | images_per_subject = total_images / num_subjects; 7 | svd_data = zeros(images_per_subject, num_subjects); 8 | fprintf('\n Computing SVD'); 9 | tstart = tic; 10 | for i=0:(num_subjects-1) 11 | Y = representations(2:end, i*images_per_subject + (1:images_per_subject)); 12 | s = svd(Y); 13 | svd_data(:, i + 1) = s; 14 | fprintf('Subject: %d\n', i); 15 | end 16 | elapsed = toc(tstart); 17 | fprintf('Time taken: %.2f seconds \n', elapsed); 18 | save('omp_rep_svd_data', 'svd_data'); 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/data/yale_faces/ex_yale_faces.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | yf = spx.data.image.YaleFaces(); 3 | yf.load(); 4 | yf.describe(); 5 | mf = spx.graphics.Figures(); 6 | mf.new_figure('Example faces'); 7 | canvas = yf.create_random_canvas(); 8 | imshow(canvas); 9 | colormap(gray); 10 | axis image; 11 | axis off; 12 | 13 | yf.resize_all(42, 48); 14 | mf.new_figure('Subject 1'); 15 | canvas = yf.create_subject_canvas(1); 16 | imshow(canvas); 17 | colormap(gray); 18 | axis image; 19 | axis off; 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/dictionary/equiangular_tight_frames/ex_sts_to_etf.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | M = spx.discrete.steiner_system.ss_2(4); 3 | result = spx.dict.etf.ss_to_etf(M); 4 | frame = result.F; 5 | props = spx.dict.Properties(frame); 6 | fprintf('Size of F: '); 7 | fprintf('%d ', size(frame)); 8 | fprintf('\n'); 9 | disp(frame); 10 | G = props.gram_matrix(); 11 | fprintf('Gram matrix (absolute)\n'); 12 | disp(abs(G)); 13 | % Rows are orthogonal 14 | fprintf('Frame operator (diagonal)\n'); 15 | disp(frame * frame'); 16 | spx.dict.etf.is_etf(frame) 17 | 18 | -------------------------------------------------------------------------------- /examples/dictionary/sensing_matrices/ex_partial_dct_1.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | rng default; 5 | M = 2; 6 | N = 4; 7 | p = randperm(N); 8 | % select some rows randomly 9 | row_pics = sort(p(1:M)); 10 | % make sure that the first row is there 11 | row_pics(1) = 1; 12 | col_perm = randperm(N); 13 | Dict = spx.dict.PartialDCT(row_pics, col_perm); 14 | 15 | x = ones(N, 1) 16 | y = Dict.apply(x) 17 | z = Dict.adjoint(y) 18 | 19 | x(1) = x(1) + 2 20 | y = Dict.apply(x) 21 | z = Dict.adjoint(y) 22 | 23 | -------------------------------------------------------------------------------- /examples/dictionary/sensing_matrices/ex_partial_dft_1.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | rng default; 5 | M = 8; 6 | N = 16; 7 | p = randperm(N); 8 | % select some rows randomly 9 | row_pics = sort(p(1:M)); 10 | % make sure that the first row is there 11 | row_pics(1) = 1; 12 | col_perm = randperm(N); 13 | %col_perm = 1:N; 14 | Dict = spx.dict.PartialDFT(row_pics, col_perm); 15 | x = ones(N, 1) 16 | y = Dict.apply(x) 17 | z = Dict.adjoint(y) 18 | 19 | x(1) = x(1) + 2 20 | y = Dict.apply(x) 21 | z = Dict.adjoint(y) 22 | 23 | DictMtx = double(Dict); 24 | B = dftmtx(N) / sqrt(N); 25 | row_pics 26 | DictMtx(:, 1:4) 27 | B(:, 1:4) 28 | 29 | -------------------------------------------------------------------------------- /examples/discrete/ex_steiner_system_2.m: -------------------------------------------------------------------------------- 1 | clear all; close all; clc; 2 | number_of_points = 10; 3 | M = spx.discrete.steiner_system.ss_2(number_of_points); 4 | [m, n] = size(M); 5 | fprintf('Number of points: %d\n', m); 6 | fprintf('Number of blocks: %d\n', n); 7 | fprintf('Blocks:\n'); 8 | for i=1:n 9 | block = M(:, i); 10 | block = find(block == 1); 11 | fprintf('%d ', block); 12 | fprintf('\n'); 13 | end 14 | -------------------------------------------------------------------------------- /examples/ex_dirac_dct_two_ortho_basis.mlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/examples/ex_dirac_dct_two_ortho_basis.mlx -------------------------------------------------------------------------------- /examples/graphics/ex_display_matrices.m: -------------------------------------------------------------------------------- 1 | clear all; close all; clc; 2 | 3 | % The matrix to be displayed. 4 | data = spiral(100); 5 | 6 | spx.graphics.display.matrix(data); 7 | 8 | data = randn(100, 100); 9 | options.color_map = 'gray'; 10 | spx.graphics.display.matrix(data, options); 11 | -------------------------------------------------------------------------------- /examples/graphics/ex_multiple_figure.m: -------------------------------------------------------------------------------- 1 | width = 1024; 2 | height = 600; 3 | mf = spx.graphics.Figures(width, height); 4 | 5 | mf.new_figure('Figure 1'); 6 | 7 | mf.new_figure('Figure 2'); 8 | 9 | mf.new_figure('Figure 3'); 10 | 11 | mf.new_figure('Figure 4'); 12 | 13 | -------------------------------------------------------------------------------- /examples/graphics/ex_plot_circles.m: -------------------------------------------------------------------------------- 1 | 2 | % Initialization 3 | clear all; close all; clc; 4 | 5 | spx.graphics.figure.full_screen; 6 | spx.graphics.draw.circle(0, 0, 4); 7 | options.color = 'g'; 8 | spx.graphics.draw.circle(2, 2, 2, options); 9 | options.color = 'k'; 10 | spx.graphics.draw.circle(3, -3, 2, options); 11 | % lets give some leg room in the axes 12 | axis([-5 5 -5 5]); 13 | % the axes must be equal for proper visualization 14 | axis equal; 15 | -------------------------------------------------------------------------------- /examples/graphics/ex_plot_discrete_signal.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | 3 | spx.graphics.plot.discrete_signal(randn(1, 200)); 4 | spx.graphics.plot.discrete_signal(randn(1, 400)); 5 | 6 | data = randi([1, 6], 1, 1000); 7 | pmf = spx.stats.relative_frequencies(data); 8 | is_pmf = spx.probability.is_pmf(pmf); 9 | options.title = 'Distribution'; 10 | options.xlabel = 'Face'; 11 | options.ylabel = 'Probability'; 12 | options.xstep = 1; 13 | spx.graphics.plot.discrete_signal(pmf, options); 14 | -------------------------------------------------------------------------------- /examples/graphics/ex_plot_filter_response.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | 3 | h = [1 1 1 1]/4; 4 | x = randn(1, 100); 5 | y = filter(h, [1], x); 6 | spx.graphics.plot.filter_response_h_x_y(h, x, y); 7 | 8 | -------------------------------------------------------------------------------- /examples/graphics/ex_plot_poles_zeros.m: -------------------------------------------------------------------------------- 1 | clear all; close all; clc; 2 | 3 | % Draws poles and zeros on a complex plane 4 | % Coefficients of the rational filter 5 | b = [1 0.7 0.6]; 6 | a = [1 -1.5 0.9]; 7 | spx.graphics.plot.rational_poles_zeros(b,a); -------------------------------------------------------------------------------- /examples/graphics/ex_plot_polyhedron.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | % Initialization 4 | clear all; close all; clc; 5 | 6 | a1 = [ 2; 1]; 7 | a2 = [ 2; -1]; 8 | a3 = [-1; 2]; 9 | a4 = [-1; -2]; 10 | 11 | A = [a1 a2 a3 a4]'; 12 | 13 | b = ones(4,1); 14 | span = [-2 2 -2 2]; 15 | spx.graphics.plot.polyhedron(A, b, span); -------------------------------------------------------------------------------- /examples/graphics/ex_plot_quadratic_form.m: -------------------------------------------------------------------------------- 1 | clear all; close all; clc; 2 | % A symmetric positive definite matrix 3 | A = [ 3 2 ; 4 | 2 6 ]; 5 | 6 | b = [ 2 ; -8 ]; 7 | 8 | spx.graphics.plot.quadratic_form(A, b, -10, 10, -10, 10); -------------------------------------------------------------------------------- /examples/graphics/level_curves/ex_level_curve_3d_f_x_y.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | % The function 5 | f=@(x,y) 2*x.^2 + 4*y.^2;; 6 | % Construct a mesh of (x,y) values 7 | [X,Y]=meshgrid(-3:0.1:3); 8 | % compute f on all these (x, y) values 9 | Z=f(X,Y); 10 | % draw a contour plot 11 | levels = [2:2:20]; 12 | [c, h] = contour3(X,Y,Z); 13 | grid on; 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/graphics/level_curves/ex_level_curve_f_x_y.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | % The function 5 | f=@(x,y) 2*x.^2 + 4*y.^2;; 6 | % Construct a mesh of (x,y) values 7 | [X,Y]=meshgrid(-3:0.1:3); 8 | % compute f on all these (x, y) values 9 | Z=f(X,Y); 10 | % draw a contour plot 11 | levels = [2:2:20]; 12 | [c, h] = contour(X,Y,Z); 13 | clabel(c, h); 14 | grid on; 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/init.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/examples/init.m -------------------------------------------------------------------------------- /examples/linear_algebra/eigen_values/ex_orth_iters_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | 5 | n = 10; 6 | k = 4; 7 | A = gallery('lotkin',n) 8 | eigen_values = eig(A)'; 9 | options.capture_lambdas = true; 10 | [Q, lambdas, details] = spx.la.eig.orth_iters(A, eye(n, k), options); 11 | Q 12 | iterations = details.iterations 13 | Lambdas = details.lambdas 14 | lambdas 15 | eigen_values 16 | fprintf('Computing Q^T * A * Q\n' ); 17 | diag(Q' * A * Q)' 18 | -------------------------------------------------------------------------------- /examples/linear_algebra/eigen_values/ex_qr_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | % A = [1 1 1 5 | % 1 2 3 6 | % 1 3 6]; 7 | % A = hadamard(20); 8 | % gaussian matrix would have complex eigen values. 9 | % A = randn(20); 10 | 11 | % D = diag([10:-1:1]); 12 | D = diag([4 2 2 2]); 13 | n = length(D); 14 | rng('default'); 15 | S = rand(n); 16 | S = (S - 0.5)*2; 17 | A = S * D / S; 18 | 19 | [T, U, details] = spx.la.eig.qr_simple(A); 20 | 21 | fprintf('Number of iterations: %d\n', details.iterations); 22 | T 23 | U 24 | A 25 | B = U * T * U'; 26 | C = B - A 27 | eig(A) 28 | eig(T) 29 | -------------------------------------------------------------------------------- /examples/linear_algebra/givens/ex_givens_qr_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | n = 8; 5 | A = gallery('binomial',n); 6 | [Q1, R1] = spx.la.givens.qr(A); 7 | A1 = Q1 * R1; 8 | A 9 | A1 10 | fprintf('::: %f\n', max(max(abs(A-A1)))); 11 | 12 | [Q2, R2] = qr(A); 13 | R1 14 | R2 15 | R3 = abs(R1) - abs(R2) 16 | 17 | Q1 18 | Q2 19 | Q3 = abs(abs(Q1) - abs(Q2)) 20 | 21 | ADIFF = Q1 * R1 - Q2 * R2 22 | 23 | -------------------------------------------------------------------------------- /examples/linear_algebra/givens/ex_givens_rot_1.m: -------------------------------------------------------------------------------- 1 | function ex_givens_rot_1() 2 | clc; 3 | close all; 4 | 5 | test_ab(3, 4); 6 | test_ab(4, 3); 7 | 8 | test_ab(3, -4); 9 | test_ab(4, -3); 10 | 11 | test_ab(-3, 4); 12 | test_ab(-4, 3); 13 | 14 | test_ab(-3, -4); 15 | test_ab(-4, -3); 16 | 17 | end 18 | 19 | function test_ab(a, b) 20 | x = [a;b]; 21 | [c, s] = spx.la.givens.rotation(a,b); 22 | G1 = [c s; -s c]; 23 | theta = rad2deg(spx.la.givens.theta(c,s)); 24 | G2 = planerot([a;b]); 25 | y1 = G1' * x; 26 | y2 = G2 * x; 27 | fprintf('x: %d %d,\t\ty1: %.0f %.0f,\t\ty2: %.0f %.0f\n', a, b, ... 28 | y1(1), y1(2), y2(1), y2(2)); 29 | end 30 | 31 | -------------------------------------------------------------------------------- /examples/linear_algebra/hessenberg/ex_backsearch_triu.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clearvars; 3 | n = 8; 4 | A = gallery('lotkin',n) 5 | H = triu(A) 6 | [H, i1 i2] = spx.la.hessenberg.backsearch(H) 7 | H 8 | 9 | -------------------------------------------------------------------------------- /examples/linear_algebra/hessenberg/ex_build_hess_form_1.m: -------------------------------------------------------------------------------- 1 | % Builds the Hessenberg form of a matrix 2 | clc; 3 | close all; 4 | clearvars; 5 | n = 4; 6 | A = gallery('binomial',n) 7 | 8 | [H1, Q1] = spx.la.hessenberg.hess(A) 9 | A1 = Q1 * H1 * Q1' 10 | [Q2, H2] = hess(A) 11 | A2 = Q2 * H2 * Q2' 12 | 13 | fprintf('max diff ::: %f\n', max(max(abs(abs(A1)-abs(A2))))); 14 | -------------------------------------------------------------------------------- /examples/linear_algebra/hessenberg/ex_givens_hess_qr_1.m: -------------------------------------------------------------------------------- 1 | % Demo of Hessenberg QR 2 | clc; 3 | close all; 4 | clearvars; 5 | n = 8; 6 | A = gallery('binomial',n); 7 | H = hess(A); 8 | [Q1, R1] = spx.la.hessenberg.qr(H); 9 | H1 = Q1 * R1; 10 | H 11 | H1 12 | fprintf('::: %f\n', max(max(abs(H-H1)))); 13 | 14 | [Q2, R2] = qr(H); 15 | R1 16 | R2 17 | R3 = abs(R1) - abs(R2) 18 | 19 | Q1 20 | Q2 21 | Q3 = abs(abs(Q1) - abs(Q2)) 22 | 23 | HDIFF = Q1 * R1 - Q2 * R2 24 | 25 | -------------------------------------------------------------------------------- /examples/linear_algebra/hessenberg/ex_qr_rq_1.m: -------------------------------------------------------------------------------- 1 | % Demo of Hessenberg QR to RQ 2 | clc; 3 | close all; 4 | clearvars; 5 | n = 4; 6 | % The binomial causes power method to oscillate 7 | % A = gallery('binomial',n); 8 | A = gallery('lotkin',n); 9 | 10 | 11 | H = hess(A) 12 | H1 = spx.la.hessenberg.qr_rq(H); 13 | 14 | [Q, R] = qr(H); 15 | H2 = R * Q; 16 | 17 | H1 18 | H2 19 | fprintf('max diff ::: %f\n', max(max(abs(abs(H1)-abs(H2))))); 20 | -------------------------------------------------------------------------------- /examples/linear_algebra/hessenberg/ex_repeat_qr_rq_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | n = 8; 5 | % The binomial causes power method to oscillate 6 | % A = gallery('binomial',n); 7 | A = gallery('lotkin',n); 8 | H = hess(A) 9 | % The form keeps on repeating in oscillations 10 | for i=1:10 11 | H = spx.la.hessenberg.qr_rq(H) 12 | end 13 | 14 | -------------------------------------------------------------------------------- /examples/linear_algebra/house/ex_house_bidiag_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | 5 | n = 8; 6 | A = gallery('binomial',n) 7 | [UF, B, VF] = spx.la.house.bidiag(A) 8 | U = spx.la.house.q_back_accum_thin(UF) 9 | V = spx.la.house.q_back_accum_thin(VF) 10 | A1 = U * B * V' 11 | fprintf('Max Diff ::: %f\n', max(max(abs(A-A1)))); 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/linear_algebra/house/ex_house_qr_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | 6 | n = 8; 7 | A = gallery('binomial',n); 8 | [Q_factors, R1] = spx.la.house.qr(A); 9 | Q1 = spx.la.house.q_back_accum_thin(Q_factors); 10 | A1 = Q1 * R1; 11 | A 12 | A1 13 | fprintf('::: %f\n', max(max(abs(A-A1)))); 14 | 15 | [Q2, R2] = qr(A); 16 | R1 17 | R2 18 | R3 = abs(R1) - abs(R2) 19 | 20 | Q1 21 | Q2 22 | Q3 = abs(abs(Q1) - abs(Q2)) 23 | 24 | ADIFF = Q1 * R1 - Q2 * R2 25 | 26 | -------------------------------------------------------------------------------- /examples/linear_algebra/house/ex_house_qr_back_accum_1.m: -------------------------------------------------------------------------------- 1 | % This script demonstrates incremental building 2 | % of Q matrix through back accumulation 3 | clc; 4 | close all; 5 | clearvars; 6 | rng('default'); 7 | 8 | n = 5; 9 | A = gallery('binomial',n) 10 | [Q_factors, R] = spx.la.house.qr(A); 11 | 12 | for i=1:n 13 | Q = spx.la.house.q_back_accum_thin(Q_factors(:, 1:i)) 14 | end 15 | A2 = Q*R 16 | for i=1:n 17 | Q = spx.la.house.q_back_accum_full(Q_factors(:, 1:i)) 18 | end 19 | A3 = Q*R 20 | -------------------------------------------------------------------------------- /examples/linear_algebra/house/ex_house_qr_pivot_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | 6 | n = 8; 7 | A = gallery('binomial',n); 8 | [QF, R, P] = spx.la.house.qr_pivot(A); 9 | Q = spx.la.house.q_back_accum_thin(QF); 10 | A1 = Q * R; 11 | A1(:, P) = A1; 12 | A 13 | A1 14 | fprintf('::: %f\n', max(max(abs(A-A1)))); 15 | 16 | [Q2, R2] = qr(A); 17 | A2 = Q2 * R2; 18 | R 19 | R2 20 | R3 = abs(R) - abs(R2) 21 | 22 | Q 23 | Q2 24 | Q3 = abs(abs(Q) - abs(Q2)) 25 | 26 | 27 | ADIFF = A1 - A2 28 | 29 | -------------------------------------------------------------------------------- /examples/linear_algebra/house/ex_wy_house_4_cols.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | 6 | n = 8; 7 | A1 = gallery('binomial',n); 8 | A2 = A1; 9 | 10 | r = 4; 11 | Q_factors = zeros(n, r); 12 | for i=1:r 13 | [v, beta] = spx.la.house.gen(A2(i:n, i)); 14 | Q_factors(i+1:n, i) = v(2:n-i+1); 15 | A2(i:n, i:n) = spx.la.house.premul(A2(i:n, i:n), v, beta) 16 | v_full = [zeros(i-1, 1); v]; 17 | end 18 | % We compute the factors W and Y for Q = Q_1 * Q_2 * .. * Q_r 19 | % such that Q = I - WY' 20 | [W, Y] = spx.la.house.wy(Q_factors); 21 | % We pre-multiply with I - WY' 22 | A3 = spx.la.house.wy_premul(A2, W, Y); 23 | A1 24 | A3 25 | max(max(abs(A1 - A3))) 26 | -------------------------------------------------------------------------------- /examples/linear_algebra/qr/ex_mgs_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | 6 | n = 8; 7 | A = gallery('binomial',n); 8 | [Q1, R1] = spx.la.qr.mgs(A); 9 | A1 = Q1 * R1; 10 | A 11 | A1 12 | fprintf('::: %f\n', max(max(abs(A-A1)))); 13 | 14 | [Q2, R2] = qr(A); 15 | R1 16 | R2 17 | R3 = abs(R1) - abs(R2) 18 | 19 | Q1 20 | Q2 21 | Q3 = abs(abs(Q1) - abs(Q2)) 22 | 23 | ADIFF = Q1 * R1 - Q2 * R2 24 | 25 | -------------------------------------------------------------------------------- /examples/linear_algebra/schur/ex_backsearch_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clearvars; 3 | n = 8; 4 | A = gallery('lotkin',n) 5 | H = hess(A) 6 | H(n,n-1) = 1e-16; 7 | %H(n-1,n-2) = 1e-16; 8 | H(n-2,n-3) = 1e-16; 9 | [H, i1 i2] = spx.la.hessenberg.backsearch(H) 10 | H 11 | 12 | -------------------------------------------------------------------------------- /examples/linear_algebra/schur/ex_francis_step_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clearvars; 3 | n = 8; 4 | A = gallery('lotkin',n) 5 | H0 = triu(A, -1) 6 | [H1, Z] = spx.la.schur.francis_step(H0) 7 | % for i=1:4 8 | % H = spx.la.schur.francis_step(H) 9 | % H(n, n-1) 10 | % end 11 | 12 | HD = H0 - Z * H1 * Z' 13 | max(max(abs(HD))) 14 | -------------------------------------------------------------------------------- /examples/linear_algebra/schur/ex_qr_hessenberg_basic_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | % A = [1 1 1 5 | % 1 2 3 6 | % 1 3 6]; 7 | % A = hadamard(20); 8 | % gaussian matrix would have complex eigen values. 9 | % A = randn(20); 10 | 11 | % D = diag([10:-1:1]); 12 | D = diag([4 2 2 2]); 13 | n = length(D); 14 | rng('default'); 15 | S = rand(n); 16 | S = (S - 0.5)*2; 17 | A = S * D / S; 18 | 19 | [T, U, details] = spx.la.schur.qr_hessenberg(A); 20 | 21 | fprintf('Number of iterations: %d\n', details.iterations); 22 | T 23 | U 24 | A 25 | B = U * T * U' 26 | C = B - A 27 | eig(A) 28 | eig(T) 29 | -------------------------------------------------------------------------------- /examples/linear_algebra/svd/lanczos/ex_bdpro_propack.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | 5 | rng default; 6 | A = mat_selector(); 7 | k = 30; 8 | propack_lanbdpro(A, k); 9 | -------------------------------------------------------------------------------- /examples/linear_algebra/svd/lanczos/ex_spx_bdpro_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | 5 | rng default; 6 | 7 | A = mat_selector(); 8 | 9 | k = 30; 10 | spx_bdpro(A, k); -------------------------------------------------------------------------------- /examples/linear_algebra/svd/lanczos/mat_selector.m: -------------------------------------------------------------------------------- 1 | function A = mat_selector() 2 | switch 3 3 | case 1 4 | A = mat_ex_1(); 5 | case 2 6 | A = mmread('abb313.mtx'); 7 | case 3 8 | A = mmread('illc1850.mtx'); 9 | otherwise 10 | error('Select matrix'); 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /examples/linear_algebra/svd/lanczos/mat_simple_1.m: -------------------------------------------------------------------------------- 1 | function A = mat_simple1_1(n) 2 | rng default; 3 | m = 200; 4 | if nargin < 1 5 | n = 50; 6 | end 7 | U0 = orth(randn(m)); 8 | V0 = orth(randn(n)); 9 | S0 = zeros(m, n); 10 | for i=1:n 11 | S0(i,i) = m / (i); 12 | end 13 | A = U0*S0*V0'; 14 | 15 | end -------------------------------------------------------------------------------- /examples/linear_algebra/triangular/ex_back_col_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | n = 10; 6 | % Let's get a symmetric positive definite matrix 7 | A = gallery('gcdmat', n); 8 | % Compute its Cholesky decomposition 9 | U = chol(A); 10 | b = randn(n, 1); 11 | % solve the problem 12 | x = U \b 13 | x = spx.la.tris.back_col(U, b) 14 | -------------------------------------------------------------------------------- /examples/linear_algebra/triangular/ex_back_col_2.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | n = 10; 6 | % Let's get an upper triangular matrix by Wilkinson 7 | alpha = 2; 8 | k = 5; 9 | U = gallery('triw',n,alpha,k) 10 | b = randn(n, 1); 11 | % solve the problem 12 | x = U \b 13 | x = spx.la.tris.back_col(U, b) 14 | -------------------------------------------------------------------------------- /examples/linear_algebra/triangular/ex_back_row_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | n = 10; 6 | % Let's get a symmetric positive definite matrix 7 | A = gallery('gcdmat', n); 8 | % Compute its Cholesky decomposition 9 | U = chol(A); 10 | b = randn(n, 1); 11 | % solve the problem 12 | x = U \b 13 | x = spx.la.tris.back_row(U, b) 14 | -------------------------------------------------------------------------------- /examples/linear_algebra/triangular/ex_forward_col_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | n = 10; 6 | % Let's get a symmetric positive definite matrix 7 | A = gallery('gcdmat', n); 8 | % Compute its Cholesky decomposition 9 | L = chol(A, 'lower') 10 | b = randn(n, 1); 11 | % solve the problem 12 | x = L \b 13 | x = spx.la.tris.forward_col(L, b) 14 | -------------------------------------------------------------------------------- /examples/linear_algebra/triangular/ex_forward_row_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | n = 10; 6 | % Let's get a symmetric positive definite matrix 7 | A = gallery('gcdmat', n); 8 | % Compute its Cholesky decomposition 9 | L = chol(A, 'lower') 10 | b = randn(n, 1); 11 | % solve the problem 12 | x = L \b 13 | x = spx.la.tris.forward_row(L, b) 14 | -------------------------------------------------------------------------------- /examples/linear_algebra/triangular/ex_gaxpy_lu_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | n = 10; 6 | % Let's get a non-singular 7 | A = gallery('parter',n) 8 | % Compute its Cholesky decomposition 9 | [L, U] = spx.la.lu.gaxpy(A) 10 | max(max(abs((A - L*U)))) 11 | -------------------------------------------------------------------------------- /examples/linear_algebra/triangular/ex_outer_lu_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | n = 10; 6 | % Let's get a non-singular 7 | A = gallery('parter',n) 8 | % Compute its Cholesky decomposition 9 | [L, U] = spx.la.lu.outer(A) 10 | max(max(abs((A - L*U)))) 11 | % Compute Cholesky decomposition using MATLAB 12 | [L, U] = lu(A) 13 | max(max(abs((A - L*U)))) 14 | A -------------------------------------------------------------------------------- /examples/linear_algebra/triangular/ex_rect_lu_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | rng('default'); 5 | m = 10; 6 | n = 5; 7 | % Let's get a non-singular 8 | A = gallery('parter',m); 9 | A = A(:, 1:n) 10 | % Compute its Cholesky decomposition 11 | [L, U] = spx.la.lu.rect(A) 12 | max(max(abs((A - L*U)))) 13 | % Compute Cholesky decomposition using MATLAB 14 | [L, U] = lu(A) 15 | max(max(abs((A - L*U)))) 16 | -------------------------------------------------------------------------------- /examples/optimization/convex_optimization/conjugate_gradient/ex_cg_least_square.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | rng('default'); 3 | 4 | A = [ 5 | 1 -1 6 | 1 1 7 | 2 1 8 | ]; 9 | 10 | B = [ 11 | 2 12 | 4 13 | 8 14 | ]; 15 | 16 | solver = SPX_CGLeastSquare(A, B); 17 | x = solver.solve(); 18 | solver.printResults(); 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/optimization/convex_optimization/conjugate_gradient/ex_conjugate_gradients.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | rng('default'); 3 | 4 | A = [3 2; 2 6]; 5 | X = [ 2 1 0 4; 6 | -2 2 0 4]; 7 | B = A * X; 8 | 9 | solver = SPX_ConjugateDescent(A, B); 10 | x = solver.solve(); 11 | solver.printResults(); 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/optimization/convex_optimization/steepest_descent/ex_steepest_descent.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | rng('default'); 3 | 4 | A = [3 2; 2 6]; 5 | X = [ 2 1 0 4; 6 | -2 2 0 4]; 7 | B = A * X; 8 | 9 | solver = SPX_SteepestDescent(A, B); 10 | x = solver.solve(); 11 | solver.printResults(); 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/optimization/least_squares/ex_house_qr_ls_1.m: -------------------------------------------------------------------------------- 1 | % Solving a least squares problem using Householder QR factorization 2 | m = 8; 3 | n = 4; 4 | A = gallery('binomial',m); 5 | A = A(:, 1:n) 6 | x0 = (1:n)' 7 | b = A * x0 8 | 9 | x = spx.opt.ls.house_ls(A, b) 10 | 11 | -------------------------------------------------------------------------------- /examples/optimization/least_squares/ex_normal_equations_1.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | m = 8; 5 | n = 4; 6 | A = gallery('binomial',m); 7 | A = A(:, 1:n) 8 | x0 = (1:n)' 9 | b = A * x0 10 | 11 | x = spx.opt.ls.normal_eq(A, b) 12 | 13 | -------------------------------------------------------------------------------- /examples/optimization/roots/ex_newton_1.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clearvars; 3 | clc; 4 | 5 | f = @(x) exp(x)+x; 6 | df = @(x) exp(x)+1; 7 | x0 = 0; 8 | tol = 1e-6; 9 | 10 | [x, change, iterations] = spx.opt.roots.newton(f, df, x0, tol); 11 | 12 | -------------------------------------------------------------------------------- /examples/pursuit/fast/demo_fast_omp_1.m: -------------------------------------------------------------------------------- 1 | A = eye(8); 2 | x = [1 0 0 5 0 0 3 0]'; 3 | b = A * x; 4 | K = 3; 5 | 6 | result = spx.fast.omp(A, b, K, 1e-12); 7 | cmpare = spx.commons.SparseSignalsComparison(x, result, K); 8 | cmpare.summarize(); 9 | -------------------------------------------------------------------------------- /examples/pursuit/fast/demo_fast_omp_2.m: -------------------------------------------------------------------------------- 1 | m = 100; 2 | n = 1000; 3 | k = 12; 4 | A = spx.dict.simple.gaussian_dict(m, n); 5 | gen = spx.data.synthetic.SparseSignalGenerator(n, k); 6 | % create a sparse vector 7 | x = gen.biGaussian(); 8 | b = A*x; 9 | A = double(A); 10 | result = spx.fast.omp(A, b, k, 1e-12); 11 | cmpare = spx.commons.SparseSignalsComparison(x, result, k); 12 | cmpare.summarize(); 13 | -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/chen2006theoretical/print_fig_1_a_rand_dict_omp_bp_with_k.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | png_export = true; 5 | pdf_export = false; 6 | 7 | load('bin/rand_dict_bp_omp_success_with_k_figure_1.mat'); 8 | 9 | mf = spx.graphics.Figures(); 10 | 11 | mf.new_figure('Recovery probability with K'); 12 | hold all; 13 | plot(Ks, bp_success_with_k); 14 | plot(Ks, omp_success_with_k); 15 | xlabel('Sparsity level'); 16 | ylabel('probability of successful recovery'); 17 | legend('BP', 'OMP'); 18 | grid on; 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/chen2006theoretical/print_fig_1_b_hadamard_dict_omp_bp_with_k.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | png_export = true; 5 | pdf_export = false; 6 | 7 | load('bin/dirac_hadamard_dict_bp_omp_success_with_k_figure_1.mat'); 8 | 9 | mf = spx.graphics.Figures(); 10 | 11 | mf.new_figure('Recovery probability with K'); 12 | hold all; 13 | plot(Ks, bp_success_with_k); 14 | plot(Ks, omp_success_with_k); 15 | xlabel('Sparsity level'); 16 | ylabel('probability of successful recovery'); 17 | legend('BP', 'OMP'); 18 | grid on; 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/eldar2010average/model_1_data.m: -------------------------------------------------------------------------------- 1 | function X = model_1_data(N, K, S) 2 | % Data as per model 1 in eldar2010average paper 3 | gen = spx.data.synthetic.SparseSignalGenerator(N, K, S); 4 | X = gen.gaussian; 5 | omega = gen.Omega; 6 | Phi = X(omega, :); 7 | Sigma = diag(randn(K, 1)); 8 | X(omega, :) = Sigma * Phi; 9 | end 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/eldar2010average/model_2_data.m: -------------------------------------------------------------------------------- 1 | function X = model_2_data(N, K, S) 2 | % Data as per model 2 in eldar2010average paper 3 | gen = spx.data.synthetic.SparseSignalGenerator(N, K, S); 4 | X = gen.complex_gaussian; 5 | end 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/eldar2010average/model_3_data.m: -------------------------------------------------------------------------------- 1 | function X = model_3_data(N, K, S) 2 | % Data as per model 3 in eldar2010average paper 3 | gen = spx.data.synthetic.SparseSignalGenerator(N, K, S); 4 | X = gen.complex_spherical_rows; 5 | end 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/eldar2010average/print_fig_1_a_mc_recovery_somp_with_k.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | rng('default'); 5 | 6 | png_export = true; 7 | pdf_export = false; 8 | 9 | 10 | 11 | load ('bin/figure_1_spherical_dict_model_1bp_success_with_k.mat'); 12 | 13 | mf = spx.graphics.Figures(); 14 | 15 | mf.new_figure('Recovery probability with K for BP-MMV'); 16 | hold all; 17 | legends = cell(1, num_ss); 18 | for ns=1:num_ss 19 | S = Ss(ns); 20 | plot(Ks, bp_success_with_k(ns, :)); 21 | legends{ns} = sprintf('S=%d', S); 22 | end 23 | grid on; 24 | xlabel('Sparsity Level'); 25 | ylabel('Empirical Recovery Rate'); 26 | legend(legends); 27 | 28 | -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/eldar2010average/print_fig_1_b_mc_recovery_somp_with_k.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | rng('default'); 5 | 6 | png_export = true; 7 | pdf_export = false; 8 | 9 | 10 | 11 | load ('bin/figure_1_spherical_dict_model_1_somp_success_with_k.mat'); 12 | 13 | mf = spx.graphics.Figures(); 14 | 15 | mf.new_figure('Recovery probability with K for SOMP'); 16 | hold all; 17 | legends = cell(1, num_ss); 18 | for ns=1:num_ss 19 | S = Ss(ns); 20 | plot(Ks, bp_success_with_k(ns, :)); 21 | legends{ns} = sprintf('S=%d', S); 22 | end 23 | grid on; 24 | xlabel('Sparsity Level'); 25 | ylabel('Empirical Recovery Rate'); 26 | legend(legends); -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/eldar2010average/print_fig_1_c_mc_recovery_thresholding_with_k.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | rng('default'); 5 | 6 | png_export = true; 7 | pdf_export = false; 8 | 9 | 10 | 11 | load ('bin/figure_1_spherical_dict_model_1_thresholding_success_with_k.mat'); 12 | 13 | mf = spx.graphics.Figures(); 14 | 15 | mf.new_figure('Recovery probability with K for Thresholding'); 16 | hold all; 17 | legends = cell(1, num_ss); 18 | for ns=1:num_ss 19 | S = Ss(ns); 20 | plot(Ks, thr_success_with_k(ns, :)); 21 | legends{ns} = sprintf('S=%d', S); 22 | end 23 | grid on; 24 | xlabel('Sparsity Level'); 25 | ylabel('Empirical Recovery Rate'); 26 | legend(legends); -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/eldar2010average/print_fig_2_b_mc_recovery_somp_with_k.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | rng('default'); 5 | 6 | png_export = true; 7 | pdf_export = false; 8 | 9 | 10 | 11 | load ('bin/figure_2_dirac_fourier_dict_model_3_somp_success_with_k.mat'); 12 | 13 | mf = spx.graphics.Figures(); 14 | 15 | mf.new_figure('Recovery probability with K for SOMP'); 16 | hold all; 17 | legends = cell(1, num_ss); 18 | for ns=1:num_ss 19 | S = Ss(ns); 20 | plot(Ks, omp_success_with_k(ns, :)); 21 | legends{ns} = sprintf('S=%d', S); 22 | end 23 | grid on; 24 | xlabel('Sparsity Level'); 25 | ylabel('Empirical Recovery Rate'); 26 | legend(legends, 'Location', 'southwest'); -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/eldar2010average/print_fig_2_c_mc_recovery_thresholding_with_k.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | rng('default'); 5 | 6 | png_export = true; 7 | pdf_export = false; 8 | 9 | 10 | 11 | load ('bin/figure_2_dirac_fourier_dict_model_3_thr_success_with_k.mat'); 12 | 13 | mf = spx.graphics.Figures(); 14 | 15 | mf.new_figure('Recovery probability with K for Thresholding'); 16 | hold all; 17 | legends = cell(1, num_ss); 18 | for ns=1:num_ss 19 | S = Ss(ns); 20 | plot(Ks, thr_success_with_k(ns, :)); 21 | legends{ns} = sprintf('S=%d', S); 22 | end 23 | grid on; 24 | xlabel('Sparsity Level'); 25 | ylabel('Empirical Recovery Rate'); 26 | legend(legends, 'Location', 'southwest'); 27 | -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/tropp2006algorithms/print_figure_1_type_2_s_2.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | png_export = true; 5 | pdf_export = false; 6 | 7 | load('bin/noiseless_s=2_hamming_distances_omp_mmv.mat'); 8 | 9 | mf = spx.graphics.Figures(); 10 | 11 | mf.new_figure('Average Hamming distance'); 12 | 13 | average_hamming_distances = mean(hamming_distances, 2); 14 | std_hamming_distances = std(hamming_distances, 0, 2); 15 | 16 | errorbar(Ks, average_hamming_distances, std_hamming_distances, '-o'); 17 | xlabel('Sparsity level K'); 18 | ylabel('Average Hamming distance'); 19 | xlim([60, 125]); 20 | ylim([0, 0.4]); 21 | grid on; -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/tropp2006algorithms/print_figure_2_type_2_s_1.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | png_export = true; 5 | pdf_export = false; 6 | 7 | load('bin/noiseless_s=1_hamming_distances_omp_mmv.mat'); 8 | 9 | mf = spx.graphics.Figures(); 10 | 11 | mf.new_figure('Average Hamming distance'); 12 | 13 | average_hamming_distances = mean(hamming_distances, 2); 14 | std_hamming_distances = std(hamming_distances, 0, 2); 15 | 16 | errorbar(Ks, average_hamming_distances, std_hamming_distances, '-o'); 17 | xlabel('Sparsity level K'); 18 | ylabel('Average Hamming distance'); 19 | xlim([60, 125]); 20 | ylim([0, 0.45]); 21 | grid on; -------------------------------------------------------------------------------- /examples/pursuit/joint_recovery/tropp2006algorithms/print_figure_3.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | png_export = true; 5 | pdf_export = false; 6 | 7 | load('bin/noisy_hamming_distances_k_s_snr_omp_mmv.mat'); 8 | 9 | mf = spx.graphics.Figures(); 10 | 11 | mf.new_figure('Average Hamming distance'); 12 | hold on; 13 | avg_hamming_distances = mean(hamming_distances, 4); 14 | 15 | legends = cell(1, num_ks); 16 | for nk=1:num_ks 17 | K = Ks(nk); 18 | k_hamming_distances = avg_hamming_distances(nk, :, :); 19 | k_hamming_distances = reshape(k_hamming_distances, num_snrs, nums_ss); 20 | plot(Ss, k_hamming_distances, '-o'); 21 | legends{nk} = sprintf('K=%d', K); 22 | end 23 | legend(legends); 24 | 25 | -------------------------------------------------------------------------------- /examples/pursuit/single_recovery/hard_thresholding_pursuit/foucart2011hard/print_fig_1.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | 6 | load('bin/fig_1.mat'); 7 | 8 | mf = spx.graphics.Figures(); 9 | 10 | mf.new_figure('Iterations'); 11 | 12 | hold all; 13 | 14 | plot(Ks, nhtp_average_iterations_with_k); 15 | plot(Ks, csmp_average_iterations_with_k); 16 | xlabel('Sparsity level'); 17 | ylabel('Average iterations'); 18 | legend({'NHTP', 'CSMP'}); 19 | grid on; 20 | 21 | mf.new_figure('Success rate'); 22 | hold all; 23 | plot(Ks, nhtp_success_rates_with_k); 24 | plot(Ks, csmp_success_rates_with_k); 25 | xlabel('Sparsity level'); 26 | ylabel('Success rates'); 27 | legend({'NHTP', 'CSMP'}); 28 | grid on; 29 | 30 | -------------------------------------------------------------------------------- /examples/pursuit/single_recovery/orthogonal_least_squares/print_phase_transition_gaussian_dict_gaussian_data.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ols_phase_transition_gaussian_dict_gaussian_data.mat'; 6 | options.export = false; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'gaussian_dict_gaussian_data'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 11 | 'OLS', options); 12 | 13 | -------------------------------------------------------------------------------- /examples/pursuit/single_recovery/orthogonal_matching_pursuit/print_phase_transition_gaussian_dict_gaussian_data.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/omp_phase_transition_gaussian_dict_gaussian_data.mat'; 6 | options.export = false; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'gaussian_dict_gaussian_data'; 9 | %options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 11 | 'OMP', options); 12 | 13 | -------------------------------------------------------------------------------- /examples/statistics/detection/ex_roc_constant_signal_with_awgn_bht.m: -------------------------------------------------------------------------------- 1 | % Initialize 2 | close all; clear all; clc; 3 | % We compute the Receiver Operating Charactersitics of signal in presence 4 | % of Gaussian noise 5 | 6 | sigma = 1; 7 | N = 2; 8 | s = ones(N, 1); 9 | sNorm = norm(s); 10 | 11 | alphas = 0:0.05:1; 12 | gammas = sigma * sNorm * SPX_Prob.q_inv_function(alphas); 13 | 14 | PF = SPX_Prob.q_function(gammas/(sigma*sNorm)); 15 | PD = SPX_Prob.q_function(SPX_Prob.q_inv_function(alphas) - sNorm / sigma); 16 | % Scatter plot 17 | plot(PF, PD); 18 | xlabel('P_F'); 19 | ylabel('P_D'); 20 | -------------------------------------------------------------------------------- /examples/wavelet/basic/ex_coiflets.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | 3 | wave = spx.wavelet.coiflet.wavelet_function(4, 8, 1024, 3); 4 | subplot(221); 5 | t = (1:1024)./1024; 6 | plot(t(300:800),wave(300:800)); 7 | ylim([-.25 +.25]); 8 | title(' C3 coiflet wavelet function '); 9 | 10 | 11 | wave = spx.wavelet.coiflet.scaling_function(4, 8, 1024, 3); 12 | subplot(222); 13 | t = (1:1024)./1024; 14 | plot(t(300:800),wave(300:800)); 15 | ylim([-.25 +.25]); 16 | title(' C3 coiflet scaling function '); 17 | -------------------------------------------------------------------------------- /examples/wavelet/basic/ex_daubechies_wavelets.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | 3 | wave = spx.wavelet.daubechies.wavelet_function(4, 8, 1024, 4); 4 | subplot(221); 5 | t = (1:1024)./1024; 6 | plot(t(300:800),wave(300:800)); 7 | ylim([-.25 +.25]); 8 | title(' D4 Wavelet '); 9 | 10 | 11 | wave = spx.wavelet.daubechies.scaling_function(4, 8, 1024, 4); 12 | subplot(222); 13 | t = (1:1024)./1024; 14 | plot(t(300:800),wave(300:800)); 15 | ylim([-.25 +.25]); 16 | title(' D4 Scaling function '); 17 | -------------------------------------------------------------------------------- /examples/wavelet/basic/ex_haar_wavelets.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | 3 | wave = spx.wavelet.haar.wavelet_function(4, 8, 1024); 4 | subplot(221); 5 | t = (1:1024)./1024; 6 | plot(t(300:800),wave(300:800)); 7 | title(' Haar Wavelet '); 8 | 9 | 10 | wave = spx.wavelet.haar.scaling_function(4, 8, 1024); 11 | subplot(222); 12 | t = (1:1024)./1024; 13 | plot(t(300:800),wave(300:800)); 14 | title(' Haar Scaling function '); 15 | -------------------------------------------------------------------------------- /examples/wavelet/basic/ex_symmlets.m: -------------------------------------------------------------------------------- 1 | close all; clear all; clc; 2 | 3 | wave = spx.wavelet.symm.wavelet_function(4, 8, 1024, 8); 4 | subplot(221); 5 | t = (1:1024)./1024; 6 | plot(t(300:800),wave(300:800)); 7 | ylim([-.25 +.25]); 8 | title(' S8 symmlet wavelet function '); 9 | 10 | 11 | wave = spx.wavelet.symm.scaling_function(4, 8, 1024, 8); 12 | subplot(222); 13 | t = (1:1024)./1024; 14 | plot(t(300:800),wave(300:800)); 15 | ylim([-.25 +.25]); 16 | title(' S8 symmlet scaling function '); 17 | -------------------------------------------------------------------------------- /examples/wavelet/local_sine_cosine_bases/ex_project_square.m: -------------------------------------------------------------------------------- 1 | % Demonstrates the projection of x^2 function 2 | clear all; close all; clc; 3 | 4 | % The function to be projected. 5 | func = @(x) (x-2).^2; 6 | 7 | % epsilon 8 | polarity = 0; 9 | step = 0.01; 10 | epsilon = 0.2; 11 | stop = 2; 12 | x = 0:step:stop; 13 | func_x = func(x); 14 | projection = spx.wavelet.lcs.project_0_right(func, step, stop, epsilon, polarity); 15 | subplot(311); 16 | plot(x, func_x, 'r'); 17 | subplot(312); 18 | plot(x, projection, 'b'); 19 | residual = func_x - projection; 20 | subplot(313); 21 | plot(x, residual, 'g'); 22 | -------------------------------------------------------------------------------- /experiments/README.md: -------------------------------------------------------------------------------- 1 | This directory contains experimental work which are not yet officially 2 | part of the library. 3 | It also includes experiments which may in future be considered 4 | as publications. 5 | 6 | 7 | -------------------------------------------------------------------------------- /experiments/admm/basis_pursuit/test_partial_basis_1d.m: -------------------------------------------------------------------------------- 1 | function test_partial_basis_1d(N, M, K) 2 | 3 | if nargin < 1 4 | N = 2048; 5 | end 6 | 7 | if nargin < 2 8 | M = floor(N/8); 9 | end 10 | 11 | if nargin < 3 12 | K = floor(M/5); 13 | end 14 | 15 | % prepare demo signal 16 | X = spx.data.synthetic.SparseSignalGenerator() 17 | 18 | 19 | end -------------------------------------------------------------------------------- /experiments/atom_ranking_in_greedy_pursuit/Contents.m: -------------------------------------------------------------------------------- 1 | 2 | Experiments related to Atom Ranking Paper 3 | ============================================ 4 | 5 | 6 | The example for motivation is demonstrated in 7 | the file ``ex_omp_1.m``. 8 | 9 | For the discovery of atoms in regular OMP, 10 | use matching_mode =1. 11 | 12 | For the discovery of atoms in the regular 13 | OMP but correlations sorted on the previous 14 | iteration, use matching_mode=2. 15 | 16 | Increase the number of trials to 10 and 17 | see trial 7 to see a bad case where 18 | the best match appears quite late in the 19 | sorted list. 20 | 21 | -------------------------------------------------------------------------------- /experiments/atom_ranking_in_greedy_pursuit/ar_solver.m: -------------------------------------------------------------------------------- 1 | function z = ar_solver(Phi, K, y) 2 | % Let's get the corresponding matrix 3 | Phi = double(Phi); 4 | result = atom_ranked_omp(Phi, y, K); 5 | z = result.z; 6 | end -------------------------------------------------------------------------------- /experiments/atom_ranking_in_greedy_pursuit/ex_fast_omp_speed_test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/experiments/atom_ranking_in_greedy_pursuit/ex_fast_omp_speed_test.m -------------------------------------------------------------------------------- /experiments/atom_ranking_in_greedy_pursuit/fast_omp_ar_solver.m: -------------------------------------------------------------------------------- 1 | function z = fast_omp_ar_solver(Phi, K, y) 2 | % Let's get the corresponding matrix 3 | Phi = double(Phi); 4 | options.threshold_factor = 2; 5 | options.reset_cycle = 4; 6 | options.verbose = 0; 7 | res_norm_thr = 1e-3; 8 | % Solve the sparse recovery problem using OMP 9 | z = spx.fast.omp_ar(Phi, y, K, res_norm_thr, options); 10 | end -------------------------------------------------------------------------------- /experiments/atom_ranking_in_greedy_pursuit/print_ar_omp_phase_transition_gaussian_dict_gaussian_data.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ar_omp_phase_transition_gaussian_dict_gaussian_data.mat'; 6 | options.export = false; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'gaussian_dict_gaussian_data'; 9 | %options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 11 | 'OMP-AR', options); 12 | 13 | -------------------------------------------------------------------------------- /experiments/atom_ranking_in_greedy_pursuit/print_fast_omp_ar_pta_gauss_dict_data.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/fast_omp_ar_pta_gauss_dict_bigaussian_data.mat'; 6 | options.export = false; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'gaussian_dict_gaussian_data'; 9 | %options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 11 | 'OMP AR', options); 12 | 13 | -------------------------------------------------------------------------------- /experiments/atom_ranking_in_greedy_pursuit/print_omp_phase_transition_gaussian_dict_gaussian_data.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/omp_phase_transition_gaussian_dict_gaussian_data.mat'; 6 | options.export = false; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'gaussian_dict_gaussian_data'; 9 | %options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 11 | 'OMP', options); 12 | 13 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_noiseless_s_16.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_noiseless_s_16.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_noiseless_s_16'; 9 | options.subtitle = 'Noiseless, S = 16'; 10 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_noiseless_s_2.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_noiseless_s_2.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_noiseless_s_2'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Noiseless, S = 2'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_noiseless_s_4.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_noiseless_s_4.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_noiseless_s_4'; 9 | options.subtitle = 'Noiseless, S = 4'; 10 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_noiseless_s_8.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_noiseless_s_8.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_noiseless_s_8'; 9 | options.subtitle = 'Noiseless, S = 8'; 10 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_snr_30db_s_16.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_snr_30db_s_16.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_snr_30_db_s_16'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'MMV, SNR=30dB s=16'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_snr_30db_s_2.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_snr_30db_s_2.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_snr_30_db_s_2'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'MMV, SNR=30dB s=2'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_snr_30db_s_4.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_snr_30db_s_4.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_snr_30_db_s_4'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'MMV, SNR=30dB s=4'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_snr_30db_s_8.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_snr_30db_s_8.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_snr_30_db_s_8'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'MMV, SNR=30dB s=8'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_snr_40db_s_16.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_snr_40db_s_16.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_snr_40_db_s_16'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'MMV, SNR=40dB s=16'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_snr_40db_s_2.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_snr_40db_s_2.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_snr_40_db_s_2'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'MMV, SNR=40dB s=2'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_snr_40db_s_4.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_snr_40db_s_4.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_snr_40_db_s_4'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'MMV, SNR=40dB s=4'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_mmv_phase_transition_snr_40db_s_8.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/mmv_phase_transition_snr_40db_s_8.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'mmv_snr_40_db_s_8'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'MMV, SNR=40dB s=8'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_noiseless_s_16.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_noiseless_s_16.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_noiseless_s_16'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, Noiseless, S = 16'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_noiseless_s_2.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_noiseless_s_2.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_noiseless_s_2'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, Noiseless, S = 2'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_noiseless_s_4.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_noiseless_s_4.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_noiseless_s_4'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, Noiseless, S = 4'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_noiseless_s_8.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_noiseless_s_8.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_noiseless_s_8'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, Noiseless, S = 8'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_snr_30db_s_16.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_snr_30db_s_16.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_snr_30_db_s_16'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, SNR=30dB s=16'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_snr_30db_s_2.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_snr_30db_s_2.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_snr_30_db_s_2'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, SNR=30dB s=2'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_snr_30db_s_4.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_snr_30db_s_4.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_snr_30_db_s_4'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, SNR=30dB s=4'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_snr_30db_s_8.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_snr_30db_s_8.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_snr_30_db_s_8'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, SNR=30dB s=8'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_snr_40db_s_16.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_snr_40db_s_16.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_snr_40_db_s_16'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, SNR=40dB s=16'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | 15 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_snr_40db_s_2.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_snr_40db_s_2.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_snr_40_db_s_2'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, SNR=40dB s=2'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_snr_40db_s_4.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_snr_40db_s_4.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_snr_40_db_s_4'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, SNR=40dB s=4'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_ra_mmv_phase_transition_snr_40db_s_8.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/ra_mmv_phase_transition_snr_40db_s_8.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'ra_mmv_snr_40_db_s_8'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Rank Aware, SNR=40dB s=8'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | 15 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_smv_phase_transition_noiseless.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/smv_phase_transition_noiseless.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'smv_noiseless'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | options.subtitle = 'Noiseless'; 11 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 12 | 'CoSaMP', options); 13 | 14 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_smv_phase_transition_snr_20db.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/smv_phase_transition_snr_20db.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'snr_20_db'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 11 | 'CoSaMP @ 20 dB', options); 12 | 13 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_smv_phase_transition_snr_30db.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/smv_phase_transition_snr_30db.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'snr_30_db'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 11 | 'CoSaMP @ 30 dB', options); 12 | 13 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_smv_phase_transition_snr_40db.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/smv_phase_transition_snr_40db.mat'; 6 | options.export = true; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'snr_40_db'; 9 | options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 11 | 'CoSaMP @ 40 dB', options); 12 | 13 | -------------------------------------------------------------------------------- /experiments/cosamp_mmv/print_spx_cosamp_vs_ss_cosamp.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | 6 | load('bin/sscosamp_vs_spx_cosamp.mat'); 7 | 8 | mf = spx.graphics.Figures(); 9 | 10 | mf.new_figure('Iterations'); 11 | 12 | hold all; 13 | 14 | plot(Ks, sscosamp_average_iterations_with_k); 15 | plot(Ks, csmp_average_iterations_with_k); 16 | xlabel('Sparsity level'); 17 | ylabel('Average iterations'); 18 | legend({'SS-COSAMP', 'SPX-COSAMP'}); 19 | grid on; 20 | 21 | mf.new_figure('Success rate'); 22 | hold all; 23 | plot(Ks, sscosamp_success_rates_with_k); 24 | plot(Ks, csmp_success_rates_with_k); 25 | xlabel('Sparsity level'); 26 | ylabel('Success rates'); 27 | legend({'SS-COSAMP', 'SPX-COSAMP'}); 28 | grid on; 29 | 30 | -------------------------------------------------------------------------------- /experiments/ecg/mit200/periodogram_mit200.m: -------------------------------------------------------------------------------- 1 | close all; clearvars; clc; 2 | load mit200; 3 | % Sampling frequency 4 | fs = 360; 5 | periodogram(ecgsig, [], [], fs); 6 | if 0 7 | figure; 8 | [pxx, f] = periodogram(ecgsig, [], [], fs); 9 | plot(f,10*log10(pxx)); 10 | xlabel('Hz'); 11 | grid on; 12 | end -------------------------------------------------------------------------------- /experiments/ecg/mit200/spectrogram_mit200.m: -------------------------------------------------------------------------------- 1 | close all; clearvars; clc; 2 | load mit200; 3 | % Sampling frequency 4 | fs = 360; 5 | spectrogram(ecgsig, [], [], [], fs); 6 | -------------------------------------------------------------------------------- /experiments/ecg/mit200/view_mit200.m: -------------------------------------------------------------------------------- 1 | close all; clearvars; clc; 2 | load mit200; 3 | plot(tm, ecgsig); 4 | grid on; 5 | xlabel('second'); 6 | ylabel('amplitude'); 7 | hold on; 8 | plot(tm(ann), ecgsig(ann), 'ro'); 9 | 10 | -------------------------------------------------------------------------------- /experiments/fast_flipped_omp_spr/ex_compare_with_chong_1.m: -------------------------------------------------------------------------------- 1 | M = 5; 2 | S1 = 4; 3 | S2 = 4; 4 | S = S1 + S2; 5 | K = 2; 6 | Y = zeros(M, S); 7 | Y(1, 1:4) = [1 2 3 4]; 8 | Y(2, 1:4) = [3 3 2 6]; 9 | Y(3, 5:8) = [3 3 6 6]; 10 | Y(4, 5:8) = [4 5 6 7]; 11 | Y 12 | Y = spx.norm.normalize_l2(Y) 13 | C1 = spx.fast.omp_spr(Y, K, 0); 14 | max(max(abs(Y - Y * C1))) 15 | 16 | C2 = OMP_mat_func(Y, K, 0); 17 | max(max(abs(Y - Y * C2))) 18 | fprintf('Comparing C1 & C2: %e\n', full(max(max(abs(C1 - C2))))); 19 | 20 | C3 = spx.fast.batch_flipped_omp_spr(Y, K, 0); 21 | max(max(abs(Y - Y * C3))) 22 | fprintf('Comparing C2 & C3: %e\n', full(max(max(abs(C2 - C3))))); 23 | -------------------------------------------------------------------------------- /experiments/fast_omp_chol/ex_c_omp_ls_verification.m: -------------------------------------------------------------------------------- 1 | n = 512; 2 | L = 1000; 3 | T = 8; 4 | 5 | D = randn(n,L); 6 | D = D*diag(1./sqrt(sum(D.*D))); % normalize the dictionary 7 | 8 | x = randn(n,20); 9 | tic; omp(D,x,[],T,'messages',-1); t=toc; 10 | signum = ceil(20/(t/20)); % approximately 20 seconds of OMP-Cholesky 11 | % generate random signals % 12 | X = randn(n,signum); 13 | options.ls_method = 'ls'; 14 | Gamma2 = spx.fast.omp(D, X, T, 1e-12, options); 15 | Gamma1 = omp(D,X,[],T,'messages',4); 16 | cmpare = spx.commons.SparseSignalsComparison(Gamma1, Gamma2, T); 17 | cmpare.summarize(); 18 | 19 | 20 | -------------------------------------------------------------------------------- /experiments/fast_omp_chol/ex_fast_omp_verification.m: -------------------------------------------------------------------------------- 1 | n = 512; 2 | L = 1000; 3 | T = 8; 4 | 5 | D = randn(n,L); 6 | D = D*diag(1./sqrt(sum(D.*D))); % normalize the dictionary 7 | 8 | x = randn(n,20); 9 | tic; omp(D,x,[],T,'messages',-1); t=toc; 10 | signum = ceil(20/(t/20)); % approximately 20 seconds of OMP-Cholesky 11 | % generate random signals % 12 | 13 | X = randn(n,signum); 14 | Gamma1 = omp(D,X,[],T,'messages',4); 15 | Gamma2 = spx.fast.omp(D, X, T, 1e-12); 16 | cmpare = spx.commons.SparseSignalsComparison(Gamma1, Gamma2, T); 17 | cmpare.summarize(); 18 | 19 | -------------------------------------------------------------------------------- /experiments/fast_omp_chol/print_phase_transition_gaussian_dict_gaussian_data.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | data_file_path = 'bin/omp_phase_transition_gaussian_dict_gaussian_data.mat'; 6 | options.export = false; 7 | options.export_dir = 'bin'; 8 | options.export_name = 'gaussian_dict_gaussian_data'; 9 | %options.chosen_ks = [2, 4, 8, 16, 32, 64]; 10 | spx.pursuit.PhaseTransitionAnalysis.print_results(data_file_path, ... 11 | 'OMP', options); 12 | 13 | -------------------------------------------------------------------------------- /experiments/lrsc/README: -------------------------------------------------------------------------------- 1 | Low Rank Subspace Clustering Experiments 2 | ============================================== 3 | 4 | This directory includes experiments over 5 | 6 | * The LRSC library developed for CVPR11 paper 7 | by Rene Vidal. 8 | 9 | 10 | -------------------------------------------------------------------------------- /experiments/mc_omp/print_compare_algorithms.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear all; 3 | clc; 4 | 5 | 6 | load('bin/omp_vs_mc_omp_comparison.mat'); 7 | 8 | mf = spx.graphics.Figures(); 9 | 10 | mf.new_figure('Iterations'); 11 | 12 | hold all; 13 | 14 | plot(Ks, omp_average_iterations_with_k(Ks)); 15 | plot(Ks, mcomp_average_iterations_with_k(Ks)); 16 | xlabel('Sparsity level'); 17 | ylabel('Average iterations'); 18 | legend({'OMP', 'MC-OMP'}); 19 | grid on; 20 | 21 | mf.new_figure('Success rate'); 22 | hold all; 23 | plot(Ks, omp_success_rates_with_k(Ks)); 24 | plot(Ks, mcomp_success_rates_with_k(Ks)); 25 | xlabel('Sparsity level'); 26 | ylabel('Success rates'); 27 | legend({'OMP', 'MC-OMP'}); 28 | grid on; 29 | 30 | -------------------------------------------------------------------------------- /experiments/optimization/cg/profile_fast_cg.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clearvars; 3 | close all; 4 | %rng default; 5 | 6 | N = 5000; 7 | A = spx.dict.simple.gaussian_mtx(N, N); 8 | A = A' * A; 9 | x = randn(N, 1); 10 | b = A * x; 11 | options.tolerance = 1e-2; 12 | options.max_iterations = N*5; 13 | 14 | fprintf('Trying cgsolve.m\n'); 15 | tic; 16 | [x, res, iter ] = cgsolve(A, b, 1e-2, N*5, 0); 17 | time_spent = toc; 18 | fprintf('Time spent: %.4f\n', time_spent); 19 | 20 | fprintf('\nTrying fast solver: \n\n') 21 | tic; 22 | result = spx.fast.cg(A, b, options); 23 | time_spent = toc; 24 | fprintf('Outside time spent: %.4f\n', time_spent); -------------------------------------------------------------------------------- /experiments/optimization/cg/test_cg.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clearvars; 3 | close all; 4 | %rng default; 5 | 6 | N = 1000; 7 | A = spx.dict.simple.gaussian_mtx(N, N); 8 | A = A' * A; 9 | x = randn(N, 1); 10 | b = A * x; 11 | 12 | [x, res, iter ] = cgsolve(A, b, 1e-2, N*5, 0); 13 | spx.io.print.vector(x, 3); 14 | 15 | options.tolerance = 1e-2; 16 | options.max_iterations = N*5; 17 | fprintf('\nTrying fast solver: \n\n') 18 | result = spx.fast.cg(A, b, options); 19 | x = result.x; 20 | spx.io.print.vector(x, 3); 21 | -------------------------------------------------------------------------------- /experiments/quickselect/quickselect_vs_sort_speed_test.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | 5 | n = 800000; 6 | k = 100; 7 | trials = 100; 8 | 9 | sort_elapsed = 0; 10 | quickselect_elapsed = 0; 11 | for i=1:trials 12 | data = -randperm(n); 13 | tstart = tic; 14 | sort(data); 15 | sort_elapsed = sort_elapsed + toc(tstart); 16 | tstart = tic; 17 | y = spx.fast.quickselect(data, k); 18 | quickselect_elapsed = quickselect_elapsed + toc(tstart); 19 | fprintf('%d %d\n', y(k), sum (y(1:k) < -k)); 20 | end 21 | 22 | 23 | t1 = sort_elapsed; 24 | t2 = quickselect_elapsed; 25 | gain_x = t1 / t2; 26 | 27 | fprintf('Sort: %.2f sec, quickselect: %.2f sec, Gain: %.2f\n', t1, t2, gain_x); 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /experiments/ssc_batch_omp/ex_batch_flipped_omp_1.m: -------------------------------------------------------------------------------- 1 | 2 | M = 5; 3 | S1 = 4; 4 | S2 = 4; 5 | S = S1 + S2; 6 | K = 2; 7 | Y = zeros(M, S); 8 | Y(1, 1:4) = [1 2 3 4]; 9 | Y(2, 1:4) = [3 3 2 6]; 10 | Y(3, 5:8) = [3 3 6 6]; 11 | Y(4, 5:8) = [4 5 6 7]; 12 | Y 13 | Y = spx.norm.normalize_l2(Y) 14 | C = spx.fast.batch_flipped_omp_spr(Y, K, 0) 15 | 16 | Y * C 17 | abs(Y - Y * C) 18 | 19 | -------------------------------------------------------------------------------- /experiments/ssc_batch_omp/ex_batch_omp_spr_1.m: -------------------------------------------------------------------------------- 1 | 2 | M = 5; 3 | S1 = 4; 4 | S2 = 4; 5 | S = S1 + S2; 6 | K = 2; 7 | Y = zeros(M, S); 8 | Y(1, 1:4) = [1 2 3 4]; 9 | Y(2, 1:4) = [3 3 2 6]; 10 | Y(3, 5:8) = [3 3 6 6]; 11 | Y(4, 5:8) = [4 5 6 7]; 12 | Y 13 | Y = spx.norm.normalize_l2(Y) 14 | C = spx.fast.batch_omp_spr(Y, K, 0) 15 | 16 | Y * C 17 | abs(Y - Y * C) 18 | 19 | -------------------------------------------------------------------------------- /experiments/ssc_batch_omp/ex_omp_ks_1.m: -------------------------------------------------------------------------------- 1 | 2 | M = 5; 3 | S1 = 4; 4 | S2 = 4; 5 | S = S1 + S2; 6 | K = 2; 7 | Y = zeros(M, S); 8 | Y(1, 1:4) = [1 2 3 4]; 9 | Y(2, 1:4) = [3 3 2 6]; 10 | Y(3, 5:8) = [3 3 6 6]; 11 | Y(4, 5:8) = [4 5 6 7]; 12 | Y 13 | Y = spx.norm.normalize_l2(Y) 14 | C = spx.cluster.ssc.flipped_omp(Y, K, 0) 15 | 16 | Y * C 17 | abs(Y - Y * C) 18 | 19 | -------------------------------------------------------------------------------- /experiments/ssc_batch_omp/ex_omp_spr_1.m: -------------------------------------------------------------------------------- 1 | 2 | M = 5; 3 | S1 = 4; 4 | S2 = 4; 5 | S = S1 + S2; 6 | K = 2; 7 | Y = zeros(M, S); 8 | Y(1, 1:4) = [1 2 3 4]; 9 | Y(2, 1:4) = [3 3 2 6]; 10 | Y(3, 5:8) = [3 3 6 6]; 11 | Y(4, 5:8) = [4 5 6 7]; 12 | Y 13 | Y = spx.norm.normalize_l2(Y) 14 | C = spx.fast.omp_spr(Y, K, 0) 15 | 16 | Y * C 17 | abs(Y - Y * C) 18 | 19 | -------------------------------------------------------------------------------- /experiments/ssc_gomp/ex_gomp_spr_1.m: -------------------------------------------------------------------------------- 1 | M = 5; 2 | S1 = 4; 3 | S2 = 4; 4 | S = S1 + S2; 5 | K = 2; 6 | Y = zeros(M, S); 7 | Y(1, 1:4) = [1 2 3 4]; 8 | Y(2, 1:4) = [3 3 2 6]; 9 | Y(3, 5:8) = [3 3 6 6]; 10 | Y(4, 5:8) = [4 5 6 7]; 11 | Y 12 | Y = spx.norm.normalize_l2(Y); 13 | C = spx.fast.omp_spr(Y, K, 0); 14 | options.verbose = 2; 15 | C1 = spx.fast.gomp_spr(Y, K, 2, 1e-6, options); 16 | Y 17 | YC = Y * C 18 | C = full(C) 19 | C1 = full(C1) 20 | Res = abs(Y - Y * C) 21 | Res1 = abs(Y - Y * C1) 22 | 23 | -------------------------------------------------------------------------------- /experiments/ssc_hopkins155/ex_ssc_l1.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | check_hopkins(@ssc_l1, 'ssc_l1'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_hopkins155/ex_ssc_l1_mahdi.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | check_hopkins(@ssc_l1_mahdi, 'ssc_l1_mahdi'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_hopkins155/ex_ssc_mc_omp.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clc; 3 | check_hopkins(@ssc_mc_omp, 'ssc_mc_omp'); 4 | 5 | -------------------------------------------------------------------------------- /experiments/ssc_hopkins155/ex_ssc_nn_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | check_hopkins(@ssc_nn_omp, 'ssc_nn_omp'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_hopkins155/ex_ssc_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | check_hopkins(@ssc_omp, 'ssc_omp'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_hopkins155/ssc_l1.m: -------------------------------------------------------------------------------- 1 | function result = ssc_l1(X, D, K) 2 | ssc = spx.cluster.ssc.SSC_L1(X, D, K); 3 | ssc.Affine = true; 4 | ssc.NoiseFactor = 0.01; 5 | result = ssc.solve(); 6 | end 7 | -------------------------------------------------------------------------------- /experiments/ssc_hopkins155/ssc_l1_mahdi.m: -------------------------------------------------------------------------------- 1 | function result = ssc_l1_mahdi(X, D, K) 2 | options.num_clusters = K; 3 | result = spx.cluster.subspace.ssc_l1_mahdi(X, options); 4 | end 5 | -------------------------------------------------------------------------------- /experiments/ssc_hopkins155/ssc_mc_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_mc_omp(X, D, K) 2 | solver = spx.cluster.ssc.SSC_TOMP(X, D, K); 3 | result = solver.solve(); 4 | end 5 | -------------------------------------------------------------------------------- /experiments/ssc_hopkins155/ssc_nn_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_nn_omp(X, D, K) 2 | solver = spx.cluster.ssc.SSC_NN_OMP(X, D, K); 3 | result = solver.solve(); 4 | end 5 | -------------------------------------------------------------------------------- /experiments/ssc_hopkins155/ssc_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_omp(X, D, K) 2 | solver = spx.cluster.ssc.SSC_OMP(X, D, K); 3 | solver.Quiet = true; 4 | result = solver.solve(); 5 | end 6 | -------------------------------------------------------------------------------- /experiments/ssc_mc_omp/create_config.m: -------------------------------------------------------------------------------- 1 | function result = create_config(branching_factor, max_candidates_to_retain, name) 2 | result.branching_factor = branching_factor; 3 | result.max_candidates_to_retain = max_candidates_to_retain; 4 | result.name = name; 5 | end 6 | -------------------------------------------------------------------------------- /experiments/ssc_mc_omp/ex_ssc_mc_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | rng default; 5 | config = create_config([2 2 2 2 2 2], 4, '2-4'); 6 | spx.cluster.ssc.util.simulate_subspace_preservation(@ssc_mc_omp, 'ssc_mc_omp', config); 7 | spx.cluster.ssc.util.print_subspace_preservation_results('ssc_mc_omp'); 8 | -------------------------------------------------------------------------------- /experiments/ssc_mc_omp/ssc_mc_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_mc_omp(X, D, K, params) 2 | if nargin < 4 3 | params.branching_factor = 2; 4 | params.max_candidates_to_retain = 4; 5 | end 6 | rnorm_thr = 1e-3; 7 | method = spx.cluster.ssc.OMP_REPR_METHOD.MC_OMP; 8 | solver = spx.cluster.ssc.SSC_OMP(X, D, K, rnorm_thr, method); 9 | solver.RepSolverOptions = params; 10 | fprintf('candidates: %d, bf: ', params.max_candidates_to_retain); 11 | fprintf('%d ', params.branching_factor); 12 | fprintf('\n'); 13 | result = solver.solve(); 14 | end 15 | -------------------------------------------------------------------------------- /experiments/ssc_mnist_digits/Contents.m: -------------------------------------------------------------------------------- 1 | Readme 2 | =================== 3 | 4 | 5 | Load the dataset first: 6 | 7 | $load_db() 8 | 9 | After this the MNIST dataset will be available in md variable. 10 | 11 | 12 | Running the bench on SSC OMP: 13 | 14 | $bench_ssc_omp(md) 15 | 16 | 17 | Running the bench on SSC-MC-OMP 18 | 19 | $bench_ssc_mc_omp(md) 20 | 21 | 22 | Running the bench on SSC-Batch-OMP 23 | 24 | $bench_ssc_batch_omp(md) 25 | -------------------------------------------------------------------------------- /experiments/ssc_mnist_digits/bench_ssc_batch_omp.m: -------------------------------------------------------------------------------- 1 | function bench_ssc_batch_omp(md) 2 | 3 | num_samples_per_digit_arr = [50 80 100 150 200 300 400]; 4 | 5 | nns = numel(num_samples_per_digit_arr); 6 | solver_name = 'ssc_batch_omp'; 7 | for ns=1:nns 8 | num_samples_per_digit = num_samples_per_digit_arr(ns); 9 | fprintf('Simulating: %s, for %d samples per digit\n', solver_name, num_samples_per_digit); 10 | result = check_digits(md, num_samples_per_digit, @ssc_batch_omp, solver_name); 11 | filepath = sprintf('bin/%s_digits=%d.mat', solver_name, num_samples_per_digit); 12 | save(filepath, 'result'); 13 | end 14 | 15 | end 16 | 17 | -------------------------------------------------------------------------------- /experiments/ssc_mnist_digits/bench_ssc_omp.m: -------------------------------------------------------------------------------- 1 | function bench_ssc_omp(md) 2 | 3 | num_samples_per_digit_arr = [50 80 100 150 200 300 400]; 4 | 5 | nns = numel(num_samples_per_digit_arr); 6 | solver_name = 'ssc_omp'; 7 | for ns=1:nns 8 | num_samples_per_digit = num_samples_per_digit_arr(ns); 9 | fprintf('Simulating: %s, for %d samples per digit\n', solver_name, num_samples_per_digit); 10 | result = check_digits(md, num_samples_per_digit, @ssc_omp, solver_name); 11 | filepath = sprintf('bin/%s_digits=%d.mat', solver_name, num_samples_per_digit); 12 | save(filepath, 'result'); 13 | end 14 | 15 | end 16 | 17 | -------------------------------------------------------------------------------- /experiments/ssc_mnist_digits/create_config.m: -------------------------------------------------------------------------------- 1 | function result = create_config(branching_factor, max_candidates_to_retain, name) 2 | result.branching_factor = branching_factor; 3 | result.max_candidates_to_retain = max_candidates_to_retain; 4 | result.name = name; 5 | end 6 | -------------------------------------------------------------------------------- /experiments/ssc_mnist_digits/ex_ssc_mc_omp.m: -------------------------------------------------------------------------------- 1 | function ex_ssc_mc_omp(md, num_samples_per_digit) 2 | if nargin < 1 3 | error('database must be loaded.'); 4 | end 5 | if nargin < 2 6 | num_samples_per_digit = 50; 7 | end 8 | close all; 9 | clc; 10 | config = create_config([4 2 1 1 1 1 1 1 1 1], 8, '42.1-8'); 11 | check_digits(md, num_samples_per_digit, @ssc_mc_omp, 'ssc_mc_omp', config); 12 | end 13 | -------------------------------------------------------------------------------- /experiments/ssc_mnist_digits/ex_ssc_omp.m: -------------------------------------------------------------------------------- 1 | function ex_ssc_omp(md, num_samples_per_digit) 2 | if nargin < 1 3 | error('database must be loaded.'); 4 | end 5 | if nargin < 2 6 | num_samples_per_digit = 50; 7 | end 8 | close all; 9 | clc; 10 | check_digits(md, num_samples_per_digit, @ssc_omp, 'ssc_omp'); 11 | end 12 | 13 | -------------------------------------------------------------------------------- /experiments/ssc_mnist_digits/load_db.m: -------------------------------------------------------------------------------- 1 | if ~exist('md', 'var') 2 | clear all; 3 | close all; 4 | clc; 5 | md = spx.data.image.ChongMNISTDigits; 6 | end 7 | -------------------------------------------------------------------------------- /experiments/ssc_mnist_digits/ssc_batch_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_batch_omp(X, D, K, options) 2 | rnorm_thr = 1e-3; 3 | method = spx.cluster.ssc.OMP_REPR_METHOD.BATCH_OMP_C; 4 | solver = spx.cluster.ssc.SSC_OMP(X, D, K, rnorm_thr, method); 5 | solver.Quiet = true; 6 | result = solver.solve(); 7 | end 8 | -------------------------------------------------------------------------------- /experiments/ssc_mnist_digits/ssc_mc_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_mc_omp(X, D, K, params) 2 | if nargin < 4 3 | params.branching_factor = 2; 4 | params.max_candidates_to_retain = 4; 5 | end 6 | rnorm_thr = 1e-3; 7 | method = spx.cluster.ssc.OMP_REPR_METHOD.MC_OMP; 8 | solver = spx.cluster.ssc.SSC_OMP(X, D, K, rnorm_thr, method); 9 | solver.RepSolverOptions = params; 10 | fprintf('candidates: %d, bf: ', params.max_candidates_to_retain); 11 | fprintf('%d ', params.branching_factor); 12 | fprintf('\n'); 13 | result = solver.solve(); 14 | end 15 | 16 | -------------------------------------------------------------------------------- /experiments/ssc_mnist_digits/ssc_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_omp(X, D, K, options) 2 | rnorm_thr = 1e-3; 3 | method = spx.cluster.ssc.OMP_REPR_METHOD.FLIPPED_OMP_MATLAB; 4 | solver = spx.cluster.ssc.SSC_OMP(X, D, K, rnorm_thr, method); 5 | solver.Quiet = true; 6 | result = solver.solve(); 7 | end 8 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/bench_ssc_l1.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | spx.cluster.ssc.util.bench_subspace_preservation(@ssc_l1, 'ssc_l1'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/bench_ssc_nn_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | spx.cluster.ssc.util.bench_subspace_preservation(@ssc_nn_omp, 'ssc_nn_omp'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/bench_ssc_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | spx.cluster.ssc.util.bench_subspace_preservation(@ssc_omp, 'ssc_omp'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/bench_ssc_tomp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | spx.cluster.ssc.util.bench_subspace_preservation(@ssc_tomp, 'ssc_tomp'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/ex_ssc_l1_mahdi.m: -------------------------------------------------------------------------------- 1 | clearvars; 2 | close all; 3 | clc; 4 | spx.cluster.ssc.util.simulate_subspace_preservation(@ssc_l1_mahdi, 'ssc_l1_mahdi'); 5 | spx.cluster.ssc.util.print_subspace_preservation_results('ssc_l1_mahdi'); 6 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/ex_ssc_nn_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | spx.cluster.ssc.util.simulate_subspace_preservation(@ssc_nn_omp, 'ssc_nn_omp'); 5 | spx.cluster.ssc.util.print_subspace_preservation_results('ssc_nn_omp'); 6 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/ex_ssc_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | spx.cluster.ssc.util.simulate_subspace_preservation(@ssc_omp, 'ssc_omp'); 5 | spx.cluster.ssc.util.print_subspace_preservation_results('ssc_omp'); 6 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/plots/clustering_accuracy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/experiments/ssc_subspace_preservation_test/plots/clustering_accuracy.pdf -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/plots/clustering_accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/experiments/ssc_subspace_preservation_test/plots/clustering_accuracy.png -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/plots/subspace_preserving_representation_perc.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/experiments/ssc_subspace_preservation_test/plots/subspace_preserving_representation_perc.pdf -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/plots/subspace_preserving_representation_perc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/experiments/ssc_subspace_preservation_test/plots/subspace_preserving_representation_perc.png -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/plots/subspace_representation_error_perc.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/experiments/ssc_subspace_preservation_test/plots/subspace_representation_error_perc.pdf -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/plots/subspace_representation_error_perc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/experiments/ssc_subspace_preservation_test/plots/subspace_representation_error_perc.png -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/print_bench_multiple_algorithms.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | results = {}; 5 | results{1} = merge_results('ssc_omp'); 6 | results{2} = merge_results('ssc_mc_omp'); 7 | %results{3} = merge_results('ssc_tomp'); 8 | %results{4} = merge_results('ssc_l1'); 9 | plot_bench_multiple_results(results, ... 10 | {'ssc_omp', 'ssc_mc_omp'}, ... 11 | {'SSC-OMP', 'SSC-MC-OMP'}); 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/print_bench_ssc_nn_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | result = merge_results('ssc_nn_omp'); 5 | plot_bench_results(result, 'ssc_nn_omp'); 6 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/print_bench_ssc_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | fprintf('Merging results from all experiments: \n'); 5 | result = spx.cluster.ssc.util.merge_bench_subspace_preservation_results('ssc_omp'); 6 | fprintf('Plotting the results: \n'); 7 | plot_bench_results(result, 'ssc_omp'); 8 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/readme.txt: -------------------------------------------------------------------------------- 1 | Test Design 2 | ========================= 3 | 4 | 5 random subspaces of common dimension (6) 5 | in a 9-dimensional ambient space. 6 | 7 | M=9 8 | K=5 9 | D=6 10 | 11 | number of points per subspace Sk= rho D 12 | 13 | We vary rho from 5 to 3333 14 | number of points vary from 150 to 99990 15 | 16 | Number of trials : 20 17 | 18 | 19 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/ssc_l1.m: -------------------------------------------------------------------------------- 1 | function result = ssc_l1(X, D, K, solver_params) 2 | ssc = spx.cluster.ssc.SSC_L1(X, D, K); 3 | ssc.NoiseFactor = 0.001; 4 | result = ssc.solve(); 5 | end 6 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/ssc_l1_mahdi.m: -------------------------------------------------------------------------------- 1 | function result = ssc_l1_mahdi(X, D, K, solver_params) 2 | % SSC_L1_MAHDI Solve sparse subspace clustering using l1 minimization 3 | % method developed by Mahdi et al. 4 | % 5 | % :X: Data set 6 | % :D: Dimension for each subspace 7 | % :K: Number of subspaces 8 | % :solver_params: ignored. 9 | % 10 | options.num_clusters = K; 11 | result = spx.cluster.subspace.ssc_l1_mahdi(X, options); 12 | end 13 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/ssc_nn_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_nn_omp(X, D, K, solver_params) 2 | solver = spx.cluster.ssc.SSC_NN_OMP(X, D, K); 3 | result = solver.solve(); 4 | end 5 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/ssc_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_omp(X, D, K, solver_params) 2 | solver = spx.cluster.ssc.SSC_OMP(X, D, K); 3 | result = solver.solve(); 4 | end 5 | -------------------------------------------------------------------------------- /experiments/ssc_subspace_preservation_test/ssc_tomp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_tomp(X, D, K, solver_params) 2 | solver = spx.cluster.ssc.SSC_TOMP(X, D, K); 3 | result = solver.solve(); 4 | end 5 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/create_config.m: -------------------------------------------------------------------------------- 1 | function result = create_config(branching_factor, max_candidates_to_retain, name) 2 | result.branching_factor = branching_factor; 3 | result.max_candidates_to_retain = max_candidates_to_retain; 4 | result.name = name; 5 | end 6 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/ex_ssc_l1.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | check_yale_faces(4, @ssc_l1, 'ssc_l1'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/ex_ssc_l1_mahdi.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | check_hopkins(@ssc_l1_mahdi, 'ssc_l1_mahdi'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/ex_ssc_mc_omp.m: -------------------------------------------------------------------------------- 1 | function ex_ssc_omp(num_subjects) 2 | if nargin < 1 3 | num_subjects = 2; 4 | end 5 | close all; 6 | clc; 7 | check_yale_faces(num_subjects, @ssc_mc_omp, 'ssc_mc_omp'); 8 | end 9 | 10 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/ex_ssc_nn_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | check_hopkins(@ssc_nn_omp, 'ssc_nn_omp'); 5 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/ex_ssc_omp.m: -------------------------------------------------------------------------------- 1 | function ex_ssc_omp(num_subjects) 2 | if nargin < 1 3 | num_subjects = 2; 4 | end 5 | close all; 6 | clc; 7 | check_yale_faces(num_subjects, @ssc_omp, 'ssc_omp'); 8 | end 9 | 10 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/ssc_l1.m: -------------------------------------------------------------------------------- 1 | function result = ssc_l1(X, D, K) 2 | ssc = spx.cluster.ssc.SSC_L1(X, D, K); 3 | ssc.Affine = false; 4 | ssc.NoiseFactor = 0.01; 5 | result = ssc.solve(); 6 | end 7 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/ssc_l1_mahdi.m: -------------------------------------------------------------------------------- 1 | function result = ssc_l1_mahdi(X, D, K) 2 | options.num_clusters = K; 3 | result = spx.cluster.subspace.ssc_l1_mahdi(X, options); 4 | end 5 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/ssc_mc_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_mc_omp(X, D, K, params) 2 | if nargin < 4 3 | params.branching_factor = 2; 4 | params.max_candidates_to_retain = 4; 5 | end 6 | rnorm_thr = 1e-3; 7 | method = spx.cluster.ssc.OMP_REPR_METHOD.MC_OMP; 8 | solver = spx.cluster.ssc.SSC_OMP(X, D, K, rnorm_thr, method); 9 | solver.RepSolverOptions = params; 10 | fprintf('candidates: %d, bf: ', params.max_candidates_to_retain); 11 | fprintf('%d ', params.branching_factor); 12 | fprintf('\n'); 13 | result = solver.solve(); 14 | end 15 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/ssc_nn_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_nn_omp(X, D, K) 2 | solver = spx.cluster.ssc.SSC_NN_OMP(X, D, K); 3 | result = solver.solve(); 4 | end 5 | -------------------------------------------------------------------------------- /experiments/ssc_yale_faces/ssc_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_omp(X, D, K, solver_params) 2 | solver = spx.cluster.ssc.SSC_OMP(X, D, K); 3 | solver.Quiet = true; 4 | result = solver.solve(); 5 | end 6 | -------------------------------------------------------------------------------- /experiments/subspace_clustering/noise_test/ex_ssc_l1_mahdi.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | simulate_noisy_signals(@ssc_l1_mahdi, 'ssc_l1_mahdi'); 5 | -------------------------------------------------------------------------------- /experiments/subspace_clustering/noise_test/ex_ssc_nn_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | simulate_noisy_signals(@ssc_nn_omp, 'ssc_nn_omp'); 5 | -------------------------------------------------------------------------------- /experiments/subspace_clustering/noise_test/ex_ssc_omp.m: -------------------------------------------------------------------------------- 1 | clear all; 2 | close all; 3 | clc; 4 | simulate_noisy_signals(@ssc_omp, 'ssc_omp'); 5 | -------------------------------------------------------------------------------- /experiments/subspace_clustering/noise_test/ssc_l1_mahdi.m: -------------------------------------------------------------------------------- 1 | function result = ssc_l1_mahdi(X, D, K) 2 | result = spx.cluster.subspace.ssc_l1_mahdi(X); 3 | end 4 | -------------------------------------------------------------------------------- /experiments/subspace_clustering/noise_test/ssc_nn_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_nn_omp(X, D, K) 2 | solver = spx.cluster.ssc.SSC_NN_OMP(X, D, K); 3 | result = solver.solve(); 4 | end 5 | -------------------------------------------------------------------------------- /experiments/subspace_clustering/noise_test/ssc_omp.m: -------------------------------------------------------------------------------- 1 | function result = ssc_omp(X, D, K) 2 | solver = spx.cluster.ssc.SSC_OMP(X, D, K); 3 | result = solver.solve(); 4 | end 5 | -------------------------------------------------------------------------------- /library/+spx/+cluster/+lrsc/noisy_exact.m: -------------------------------------------------------------------------------- 1 | 2 | function [A,C] = noisy_exact(D,alpha,~) 3 | % Implements the solution of noisy data with exact condition A = AC 4 | if nargin < 2 5 | tau = 100/norm(D)^2; 6 | alpha = 0.5*tau; 7 | end 8 | % eq 41, theorem 5 9 | threshold = sqrt(2/alpha); 10 | options = struct; 11 | options.lambda = threshold; 12 | options.tolerance = 16*eps; 13 | % Initial vector 14 | M = size(D, 1); 15 | options.p0 = ones(M, 1); 16 | [U, S, V, details] = spx.fast.lansvd(A, options); 17 | A = U * diag(S) * V'; 18 | C = V * V'; 19 | end 20 | 21 | -------------------------------------------------------------------------------- /library/+spx/+cluster/gpca/SPX_GPCA.m: -------------------------------------------------------------------------------- 1 | classdef SPX_GPCA < handle 2 | 3 | methods(Static) 4 | 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /library/+spx/+commons/core.m: -------------------------------------------------------------------------------- 1 | classdef core 2 | % General utility functions 3 | methods(Static) 4 | 5 | 6 | 7 | 8 | end 9 | 10 | end 11 | 12 | -------------------------------------------------------------------------------- /library/+spx/+data/+synthetic/func.m: -------------------------------------------------------------------------------- 1 | classdef func 2 | 3 | methods(Static) 4 | 5 | function [x, y, res] = sinusoid(varargin) 6 | params = inputParser; 7 | params.addParameter('n', 10); 8 | params.addParameter('sigma', 0.1); 9 | params.addParameter('min', 0); 10 | params.addParameter('max', 1); 11 | params.addParameter('theta', 0); 12 | params.addParameter('f', 1); 13 | params.parse(varargin{:}); 14 | res = params.Results; 15 | x = linspace(res.min, res.max, res.n)'; 16 | y = sin(2*pi*res.f * x + res.theta) + res.sigma * randn(size(x)); 17 | end % function 18 | 19 | end % methods 20 | 21 | end % classdef 22 | 23 | -------------------------------------------------------------------------------- /library/+spx/+data/+synthetic/lowrank.m: -------------------------------------------------------------------------------- 1 | classdef lowrank 2 | % Generates matrices of low rank 3 | 4 | methods(Static) 5 | 6 | function A = from_randn(m, n, r) 7 | % Returns a low rank matrix constructed by randn(m, r) * randn(r, m) 8 | X = randn(m, r); 9 | Y = randn(r, n); 10 | A = X * Y; 11 | end % function 12 | 13 | end % methods 14 | 15 | end % classdef 16 | -------------------------------------------------------------------------------- /library/+spx/+data/local.m: -------------------------------------------------------------------------------- 1 | classdef local 2 | 3 | methods(Static) 4 | 5 | function root_dir = yale_faces_dir() 6 | % This should be changed to whatever place the faces are maintained. 7 | % The changes need to be done in ``spx_local.ini`` file. 8 | % Alternative is to subclass this class and override this method. 9 | env = spx_get_env(); 10 | root_dir = env.local_settings.yale_faces_db_dir; 11 | end 12 | 13 | function root_dir = hopkins155_dir() 14 | env = spx_get_env(); 15 | root_dir = env.local_settings.hopkins155_dir; 16 | end 17 | 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /library/+spx/+data/mtx_mkt.m: -------------------------------------------------------------------------------- 1 | % Wrapper for files from matrix market 2 | classdef mtx_mkt 3 | 4 | methods(Static) 5 | 6 | function A = abb313() 7 | A = read_file('abb313.mtx'); 8 | end 9 | 10 | function A = bfwb398() 11 | A = read_file('bfwb398.mtx'); 12 | end 13 | 14 | function A = cryg10000() 15 | A = read_file('cryg10000.mtx'); 16 | end 17 | 18 | function A = illc1850() 19 | A = read_file('illc1850.mtx'); 20 | end 21 | 22 | 23 | 24 | function A = matrix(name) 25 | filename = [name '.mtx']; 26 | A = read_file(filename); 27 | end 28 | 29 | end 30 | 31 | end 32 | 33 | function A = read_file(filename) 34 | filepath = fullfile(spx.data_dir, 'matrix_market', filename); 35 | A = mmread(filepath); 36 | end 37 | 38 | -------------------------------------------------------------------------------- /library/+spx/+data/synthetic.m: -------------------------------------------------------------------------------- 1 | classdef synthetic 2 | 3 | methods(Static) 4 | 5 | function signal = picket_fence(N) 6 | import spx.discrete.number; 7 | if ~number.is_perfect_square(N) 8 | error('N must be perfect square'); 9 | end 10 | n = sqrt(N); 11 | signal = zeros(1, N); 12 | signal(1:n:end) = 1; 13 | end 14 | 15 | function X = uniform(N, S) 16 | % Generates uniformly distributed signals 17 | 18 | % Generate Gaussian vectors 19 | X = randn(N, S); 20 | % Make them unit length 21 | X = spx.norm.normalize_l2(X); 22 | end 23 | 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /library/+spx/+dict/babel.m: -------------------------------------------------------------------------------- 1 | function [ babel ] = babel( Phi ) 2 | %BABEL computes the Babel function of a dictionary 3 | % Columns of Phi must be unit norm 4 | % The function has been defined by Joel A Tropp 5 | 6 | % Let us compute the Gram matrix 7 | G = Phi' * Phi; 8 | % Let us take element wise absolute 9 | absG = abs(G); 10 | % Let us sort each row in descending order 11 | GS = sort(absG, 2,'descend'); 12 | rowSums = cumsum(GS(:, 2:end), 2); 13 | babel = max(rowSums); 14 | 15 | 16 | -------------------------------------------------------------------------------- /library/+spx/+ecg/heartrate.m: -------------------------------------------------------------------------------- 1 | function heart_rate = heartrate(r_peak_times) 2 | % r_peak_times are the times where r peaks are observed 3 | beat = diff(r_peak_times); 4 | heart_rate = mean(60./beat); 5 | end 6 | -------------------------------------------------------------------------------- /library/+spx/+fast/batch_flipped_omp_spr.m: -------------------------------------------------------------------------------- 1 | function result = batch_flipped_omp_spr(Y, K, epsilon, sparse_output) 2 | if nargin < 4 3 | sparse_output = 1; 4 | end 5 | result = mex_batch_flipped_omp_spr(Y, K, epsilon, sparse_output); 6 | end 7 | -------------------------------------------------------------------------------- /library/+spx/+fast/batch_omp.m: -------------------------------------------------------------------------------- 1 | function result = batch_omp(Dict, X, G, DtX, K, epsilon) 2 | result = mex_batch_omp(Dict, X, G, DtX, K, epsilon); 3 | end 4 | -------------------------------------------------------------------------------- /library/+spx/+fast/batch_omp_spr.m: -------------------------------------------------------------------------------- 1 | function result = batch_omp_spr(Y, K, epsilon, sparse_output) 2 | if nargin < 4 3 | sparse_output = 1; 4 | end 5 | result = mex_batch_omp_spr(Y, K, epsilon, sparse_output); 6 | end 7 | -------------------------------------------------------------------------------- /library/+spx/+fast/bdhizsqr_svd.m: -------------------------------------------------------------------------------- 1 | function [U, S, V] = bdhizsqr_svd(alpha, beta, options) 2 | if nargin < 3 3 | options = struct; 4 | end 5 | n = numel(alpha); 6 | if nargout <= 1 7 | U = mex_svd_bd_hizsqr(alpha, beta, options); 8 | else if nargout == 2 9 | [U, S] = mex_svd_bd_hizsqr(alpha, beta, options); 10 | else 11 | [U, S, V] = mex_svd_bd_hizsqr(alpha, beta, options); 12 | V = V.'; 13 | S = spdiags(S, [0], n, n); 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /library/+spx/+fast/gomp_spr.m: -------------------------------------------------------------------------------- 1 | function result = gomp_spr(Y, K, L, epsilon, options) 2 | if nargin < 3 3 | L = 2; 4 | end 5 | if nargin < 4 6 | epsilon = 1e-3; 7 | end 8 | if nargin < 5 9 | options = struct; 10 | end 11 | if ~isfield(options, 'sparse_output') 12 | options.sparse_output = 1; 13 | end 14 | if ~isfield(options, 'verbose') 15 | options.verbose = 0; 16 | end 17 | result = mex_gomp_spr(Y, K, L, epsilon, ... 18 | options.sparse_output,... 19 | options.verbose); 20 | end 21 | -------------------------------------------------------------------------------- /library/+spx/+fast/hungarian.m: -------------------------------------------------------------------------------- 1 | function [matching,optimal_cost]=hungarian(A, options) 2 | %HUNGARIAN Solve the Assignment problem using the Hungarian method. 3 | % 4 | %[matching,optimal_cost]=hungarian(A, options) 5 | %A - a square cost matrix. 6 | %matching - the optimal assignment (from column to row) 7 | %optimal_cost - the cost of the optimal assignment. 8 | if nargin < 2 9 | options = struct; 10 | end 11 | if ~isfield(options, 'verbose') 12 | options.verbose = 0; 13 | end 14 | [matching,optimal_cost] = mex_hungarian(A, options.verbose); 15 | end 16 | -------------------------------------------------------------------------------- /library/+spx/+fast/omp_spr.m: -------------------------------------------------------------------------------- 1 | function result = omp_spr(Y, K, epsilon, sparse_output) 2 | if nargin < 4 3 | sparse_output = 1; 4 | end 5 | Y_normalized = spx.norm.normalize_l2(Y); 6 | result = mex_omp_spr(Y, Y_normalized, K, epsilon, sparse_output); 7 | end 8 | -------------------------------------------------------------------------------- /library/+spx/+fast/partial_svd_compose.m: -------------------------------------------------------------------------------- 1 | function y = partial_svd_compose(U,S, V,varargin) 2 | % Computes A only for a subset of indices Omega where 3 | % A = U S V' 4 | % Number of rows of A 5 | M = size(U,1); 6 | % Number of columns of A 7 | N = size(V,1); 8 | % Merge singular values in U 9 | U = U * diag(S); 10 | if nargin > 4 11 | I = varargin{1}; 12 | J = varargin{2}; 13 | else 14 | omega = varargin{1}; 15 | [I,J] = ind2sub( [M,N], omega ); 16 | end 17 | y = mex_partial_svd_compose(U, V, I, J, false); 18 | end 19 | 20 | -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_batch_flipped_omp_spr.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_batch_flipped_omp_spr.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_batch_omp.m: -------------------------------------------------------------------------------- 1 | % Implementation of Batch Orthogonal Matching Pursuit 2 | % Using Cholesky Decomposition 3 | % alpha = mex_batch_omp(D, G, X, K, epsilon) -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_batch_omp_spr.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_batch_omp_spr.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_gomp.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_gomp.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_gomp_mmv.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_gomp_mmv.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_gomp_spr.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_gomp_spr.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_linsolve.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_linsolve.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_mult_mat_mat.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_mult_mat_mat.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_mult_mat_t_mat.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_mult_mat_t_mat.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_mult_mat_t_vec.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_mult_mat_t_vec.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_mult_mat_vec.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_mult_mat_vec.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_omp_ar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_omp_ar.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_omp_chol.m: -------------------------------------------------------------------------------- 1 | % Implementation of Orthogonal Matching Pursuit 2 | % Using Cholesky Decomposition 3 | % alpha = mex_omp_chol(D, x, K, epsilon) -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_omp_spr.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_omp_spr.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_partial_svd_compose.m: -------------------------------------------------------------------------------- 1 | function y = mex_partial_svd_compose(U, V, I, J, transpose) 2 | % warning('Using slow version of mex_partial_svd_compose'); 3 | y = zeros(size(I)); 4 | for k=1:length(I) 5 | % Pick the I(k)-th row of U 6 | % Pick the J(k)-th row of V 7 | if ~transpose 8 | y(k) = U(I(k), :) * (V(J(k), :)'); 9 | else 10 | y(k) = U(:, I(k))' * (V(:, J(k))); 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_quickselect.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_quickselect.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/mex_test_blas.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+fast/private/mex_test_blas.m -------------------------------------------------------------------------------- /library/+spx/+fast/private/spx_pursuit.cpp: -------------------------------------------------------------------------------- 1 | #include "spx_pursuit.hpp" 2 | #include "spxblas.h" 3 | namespace spx { 4 | 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /library/+spx/+fast/private/spx_rand.cpp: -------------------------------------------------------------------------------- 1 | #include "spx_rand.hpp" 2 | 3 | #include 4 | 5 | namespace spx 6 | { 7 | 8 | Rng::Rng(unsigned seed): 9 | gen(seed){ 10 | 11 | } 12 | 13 | Rng::~Rng(){ 14 | 15 | } 16 | 17 | void Rng::uniform_real(double a, double b, Vec& v) { 18 | std::uniform_real_distribution<> dis(a, b); 19 | double* x = v.head(); 20 | mwSignedIndex x_inc = v.inc(); 21 | mwSize length = v.length(); 22 | // mexPrintf("inc: x_inc, n: m_n\n", x_inc, m_n); 23 | for (int n = 0; n < length; ++n) { 24 | double value = dis(gen); 25 | *x = value; 26 | x += x_inc; 27 | } 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /library/+spx/+fast/private/spx_rand.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _SPX_RAND_H_ 2 | #define _SPX_RAND_H_ 1 3 | 4 | #include 5 | 6 | #include "spx_vector.hpp" 7 | #include "spx_operator.hpp" 8 | 9 | namespace spx{ 10 | 11 | class Rng{ 12 | public: 13 | Rng(unsigned seed = 0); 14 | ~Rng(); 15 | //! Initialize a vector by uniform random numbers 16 | void uniform_real(double a, double b, Vec& v); 17 | private: 18 | std::mt19937 gen; 19 | }; 20 | 21 | 22 | } 23 | 24 | #endif // _SPX_RAND_H_ 25 | 26 | -------------------------------------------------------------------------------- /library/+spx/+fast/private/spxla.h: -------------------------------------------------------------------------------- 1 | #ifndef _SPX_LA_H_ 2 | #define _SPX_LA_H_ 1 3 | 4 | #include "spxblas.h" 5 | 6 | 7 | /** 8 | Solves linear equations and least square problems 9 | 10 | The matrices A and B are overwritten 11 | in the process. 12 | */ 13 | int linsolve(double A[], 14 | double B[], 15 | double X[], 16 | mwSize m, mwSize n, mwSize p, 17 | int arr_type); 18 | 19 | 20 | /** 21 | Wrapper over dgels 22 | 23 | Solves min | A X - B | 24 | 25 | The matrices A and B are overwritten 26 | in the process. 27 | */ 28 | int least_square(double A[], 29 | double B[], 30 | double X[], 31 | mwSize m, mwSize n, mwSize p); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /library/+spx/+fast/private/test_func_handle_pair.m: -------------------------------------------------------------------------------- 1 | function test_func_handle_pair() 2 | clc; 3 | close all; 4 | clearvars; 5 | make mex_demo_func_handle.cpp; 6 | 7 | A = magic(6); 8 | A = [ 9 | 1 1 1 1 0 10 | 2 2 2 2 1 11 | -1 -1 -1 -1 -1 12 | 1 0 1 0 -2] 13 | 14 | function y = forward(x) 15 | y = A *x; 16 | end 17 | function y = backward(x) 18 | y = (x' * A)'; 19 | end 20 | 21 | %input.A = @(x) A * x; 22 | input.A = @forward; 23 | input.At = @backward; 24 | input.M = size(A, 1); 25 | input.N = size(A, 2); 26 | mex_demo_func_handle(input); 27 | 28 | end 29 | 30 | -------------------------------------------------------------------------------- /library/+spx/+fast/private/test_lansvd.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | make mex_lansvd.cpp; 5 | options.verbosity = 1; 6 | A = spx.data.mtx_mkt.abb313; 7 | options.k = 4; 8 | [U, S, V, details] = spx.fast.lansvd(A, 'k', 4, 'verbosity', 0); 9 | % [U, S, V, details] = spx.fast.lansvd(A, options); 10 | 11 | SS = svds(A, 4); 12 | 13 | fprintf('Singular values by SVDS: '); 14 | spx.io.print.vector(SS); 15 | fprintf('Singular values by LANSVD: '); 16 | spx.io.print.vector(S); 17 | 18 | 19 | [U, S, V, details] = spx.fast.lansvd(A, 'lambda', 7.51); 20 | fprintf('Singular values by LANSVD: '); 21 | spx.io.print.vector(S); 22 | -------------------------------------------------------------------------------- /library/+spx/+fast/private/test_nneg_eig_compose.m: -------------------------------------------------------------------------------- 1 | clc; 2 | close all; 3 | clearvars; 4 | make mex_sqrt_times.cpp; 5 | 6 | M = 8000; 7 | N = 400; 8 | V = orth(randn(M, N)); 9 | lambda = abs(randn(N,1)); 10 | tstart = tic; 11 | A1 = V * diag(lambda) * V'; 12 | t1 = toc(tstart); 13 | tstart = tic; 14 | mex_sqrt_times(lambda, V); 15 | A2 = V * V'; 16 | t2 = toc(tstart); 17 | fprintf('max diff: %e\n', max(max(abs(A1 - A2)))); 18 | fprintf('t1: %.4f, t2: %.4f, gain: %.2f x\n', t1, t2, t1/t2); 19 | 20 | -------------------------------------------------------------------------------- /library/+spx/+fast/quickselect.m: -------------------------------------------------------------------------------- 1 | function y = quickselect(x, k) 2 | % Brings the largest k entries to the front of array 3 | y = mex_quickselect(x, k); 4 | end 5 | -------------------------------------------------------------------------------- /library/+spx/+fast/update_sparse_data.m: -------------------------------------------------------------------------------- 1 | function update_sparse_data(Y, b) 2 | mex_update_sparse_data(Y, b); 3 | end 4 | -------------------------------------------------------------------------------- /library/+spx/+graphics/rgb.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/+spx/+graphics/rgb.m -------------------------------------------------------------------------------- /library/+spx/+la/affine.m: -------------------------------------------------------------------------------- 1 | classdef affine 2 | % Methods related to affine subspaces 3 | 4 | methods(Static) 5 | 6 | function X = homogenize(X, value) 7 | if nargin < 2 8 | value = 1 9 | end 10 | % number of columns 11 | n = size(X, 2); 12 | % add one more row 13 | X(end+1, :) = value * ones(1, n); 14 | end 15 | 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /library/+spx/+la/arnoldi.m: -------------------------------------------------------------------------------- 1 | classdef arnoldi 2 | 3 | methods(Static) 4 | 5 | end % methods 6 | 7 | end % classdef 8 | 9 | -------------------------------------------------------------------------------- /library/+spx/+la/chol.m: -------------------------------------------------------------------------------- 1 | classdef chol 2 | 3 | methods(Static) 4 | 5 | function L_new = chol_update(L, atom) 6 | n = size(L, 1); 7 | if n == 0 8 | L_new = sqrt(atom); 9 | return; 10 | end 11 | v = atom(1:end-1); 12 | c = atom(end); 13 | opts.LT = true; 14 | w = linsolve(L, v, opts); 15 | c_new = sqrt(c - w' * w); 16 | L_new = [L zeros(n, 1); w' c_new]; 17 | end % function 18 | 19 | 20 | 21 | 22 | end % methods 23 | 24 | end % classdef 25 | -------------------------------------------------------------------------------- /library/+spx/+la/krylov.m: -------------------------------------------------------------------------------- 1 | classdef krylov 2 | 3 | methods(Static) 4 | 5 | end % methods 6 | 7 | end % classdef 8 | 9 | -------------------------------------------------------------------------------- /library/+spx/+la/lanczos.m: -------------------------------------------------------------------------------- 1 | classdef lancoz 2 | 3 | methods(Static) 4 | 5 | end % methods 6 | 7 | end % classdef 8 | 9 | -------------------------------------------------------------------------------- /library/+spx/+opt/projections.m: -------------------------------------------------------------------------------- 1 | classdef projections 2 | % projections to different convex sets 3 | 4 | methods(Static) 5 | 6 | function x = proj_l2_ball(x, radius) 7 | % project x to an l2 ball of given radius 8 | if nargin < 2 9 | radius = 1; 10 | end 11 | x_norm = norm(x); 12 | if x_norm > radius 13 | x = (radius / x_norm) * x; 14 | end 15 | end 16 | 17 | 18 | function x = proj_linf_ball(x, radius) 19 | % project x to an l-inf ball of given radius 20 | if nargin < 2 21 | radius = 1; 22 | end 23 | x = x .* radius ./ max(radius, abs(x)); 24 | end 25 | 26 | 27 | end % methods 28 | 29 | end % classdef -------------------------------------------------------------------------------- /library/+spx/+opt/shrinkage.m: -------------------------------------------------------------------------------- 1 | function y = shrinkage(a, kappa) 2 | % Performs element wise shrinkage 3 | % y = max(0, a-kappa) - max(0, -a-kappa); 4 | y = max(0, a-kappa) + min(0, a+kappa); 5 | end 6 | 7 | -------------------------------------------------------------------------------- /library/+spx/+opt/sv_shrinkage.m: -------------------------------------------------------------------------------- 1 | function Y = sv_shrinkage(A, kappa) 2 | % Performs shrinkage over the singular values 3 | % y = max(0, a-kappa) + min(0, a+kappa); 4 | [U, S, V] = svd(A, 'econ'); 5 | S = diag(S); 6 | % identify singular values bigger than threshold 7 | ind = find(S > kappa); 8 | % Construct the singular value sub-matrix 9 | % After shrinkage of singular values 10 | S = diag(S(ind) - kappa); 11 | % Corresponding left singular vectors 12 | U = U(:, ind); 13 | % Corresponding right singular vectors 14 | V = V(:, ind); 15 | % Result 16 | Y = U * S * V'; 17 | end 18 | 19 | -------------------------------------------------------------------------------- /library/+spx/+prob/SPX_IT.m: -------------------------------------------------------------------------------- 1 | classdef SPX_IT 2 | % functions related to information theory 3 | 4 | 5 | methods(Static) 6 | 7 | 8 | function h = entropy(data) 9 | % Returns entropy H(x) of a discrete random variable x from observed data 10 | probabilities = SPX_Statistics.relative_frequencies(data); 11 | % Compute the logarithms of probabilities 12 | log_probabilities = log2(probabilities + eps); 13 | % Compute the entropy 14 | h = -dot(probabilities,log_probabilities); 15 | % Make sure that entropy is not negative 16 | h = max(0,h); 17 | end 18 | 19 | 20 | end 21 | 22 | 23 | end 24 | 25 | -------------------------------------------------------------------------------- /library/+spx/+prob/tests/test_it.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_it 2 | initTestSuite; 3 | end 4 | 5 | 6 | function test_entropy 7 | data = [0 0 0 1 1 1 2 2 2 3 3 3]; 8 | h = SPX_IT.entropy(data); 9 | assertElementsAlmostEqual(h, 2.0); 10 | end 11 | -------------------------------------------------------------------------------- /library/+spx/+prob/tests/test_prob.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_prob 2 | initTestSuite; 3 | end 4 | 5 | function test_is_pmf 6 | x = [.1 .4 .3 .2]; 7 | verifyTrue(testCase, SPX_Prob.is_pmf(x)); 8 | x = [-.1 .6 .3 .2]; 9 | assertFalse(SPX_Prob.is_pmf(x)); 10 | end -------------------------------------------------------------------------------- /library/+spx/+wavelet/baylkin.m: -------------------------------------------------------------------------------- 1 | classdef baylkin 2 | 3 | methods(Static) 4 | 5 | function qmf = quad_mirror_filter() 6 | % Generates orthonormal quadrature mirror filter for Haar wavelet transform 7 | qmf = [ .099305765374 .424215360813 .699825214057 ... 8 | .449718251149 -.110927598348 -.264497231446 ... 9 | .026900308804 .155538731877 -.017520746267 ... 10 | -.088543630623 .019679866044 .042916387274 ... 11 | -.017460408696 -.014365807969 .010040411845 ... 12 | .001484234782 -.002736031626 .000640485329 ]; 13 | end 14 | 15 | end 16 | 17 | 18 | end 19 | -------------------------------------------------------------------------------- /library/+spx/cache_dir.m: -------------------------------------------------------------------------------- 1 | function result = cache_dir() 2 | root = spx.root_dir; 3 | result = [root filesep 'cache']; 4 | % Create the directory for storing images 5 | [status_code,message,message_id] = mkdir(result); 6 | end 7 | -------------------------------------------------------------------------------- /library/+spx/data_dir.m: -------------------------------------------------------------------------------- 1 | function result = data_dir() 2 | root = spx.root_dir; 3 | parent = fileparts(root); 4 | result = [parent filesep 'data']; 5 | end 6 | -------------------------------------------------------------------------------- /library/+spx/graphics.m: -------------------------------------------------------------------------------- 1 | classdef graphics 2 | 3 | methods(Static) 4 | 5 | function result = plot_styles() 6 | % plot styles for multiple plots 7 | result = {... 8 | '--+','-.o',':*',... 9 | '--.','-.x',':s',... 10 | '--d','-.^',':v',... 11 | '-->','-.<',':p',... 12 | '--h'}; 13 | end 14 | 15 | end 16 | 17 | end -------------------------------------------------------------------------------- /library/+spx/image.m: -------------------------------------------------------------------------------- 1 | classdef image 2 | 3 | methods(Static) 4 | 5 | function image = read_gray_image(filepath) 6 | % Reads a gray level image 7 | [image,~]=imread(filepath); 8 | image = im2double(image); 9 | % If the image is RGB, let us convert it to gray 10 | sz = size(image); 11 | if (length(sz) > 2) 12 | if sz(3) == 2 13 | image = image(:, :, 1); 14 | elseif sz(3) == 3 15 | image = rgb2gray(image); 16 | end 17 | end 18 | % Let us bring image to 0-255 range 19 | if max(image(:)) < 2 20 | image = image * 255; 21 | end 22 | end 23 | 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /library/+spx/la.m: -------------------------------------------------------------------------------- 1 | classdef la 2 | 3 | methods(Static) 4 | 5 | function no = nonorthogonality(U) 6 | % Computes the deviation from orthogonality of a basis 7 | [m, k] = size(U); 8 | gap = U' * U - eye(k); 9 | no = norm(gap); 10 | end 11 | 12 | 13 | 14 | 15 | end % methods 16 | 17 | end % classdef 18 | -------------------------------------------------------------------------------- /library/+spx/lang.m: -------------------------------------------------------------------------------- 1 | classdef lang 2 | % Useful methods for extending Language core functionality 3 | 4 | methods(Static) 5 | 6 | function result = is_class(classpath) 7 | % Returns true if classpath points to a MATLAB class. 8 | result = (exist(classpath, 'class') ~= 0); 9 | end 10 | 11 | 12 | function varargout = noop(varargin) 13 | % Does nothing 14 | for i=1:nargout 15 | varargout{i} = []; 16 | end 17 | end 18 | 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /library/+spx/locate.m: -------------------------------------------------------------------------------- 1 | function locate() 2 | % Changes current directory to the folder containing spx. 3 | dir = spx.root_dir; 4 | cd (dir); 5 | end 6 | -------------------------------------------------------------------------------- /library/+spx/locate_examples.m: -------------------------------------------------------------------------------- 1 | function locate_examples() 2 | % Changes current directory to the folder containing spx. 3 | root = spx.root_dir; 4 | lib = fileparts(root); 5 | examples = fullfile(lib, 'examples'); 6 | cd (examples); 7 | end 8 | -------------------------------------------------------------------------------- /library/+spx/log.m: -------------------------------------------------------------------------------- 1 | classdef log 2 | 3 | methods(Static) 4 | 5 | function display(message) 6 | % compute current time string 7 | curtime = datestr(now, 'HH:MM:SS'); 8 | disp([curtime, ' ', message]); 9 | end 10 | 11 | end 12 | 13 | end -------------------------------------------------------------------------------- /library/+spx/readme.m: -------------------------------------------------------------------------------- 1 | function readme 2 | disp('This toolbox contains the sparse-plex library.'); 3 | end -------------------------------------------------------------------------------- /library/+spx/rmse.m: -------------------------------------------------------------------------------- 1 | classdef rmse 2 | methods(Static) 3 | 4 | function [r, sse, mse] = vec(x, y) 5 | % Computes Root Mean Square Error between two data-vectors 6 | % Identify the non-nan locations 7 | I = ~isnan(x) & ~isnan(y); 8 | % keep only the non-nan part 9 | x = x(I); 10 | y = y(I); 11 | gap = x(:)-y(:); 12 | sse = sum(gap.^2); 13 | mse = sse / numel(gap); 14 | result = sqrt(mse); 15 | end 16 | 17 | end % methods 18 | end % classdef 19 | 20 | -------------------------------------------------------------------------------- /library/+spx/root_dir.m: -------------------------------------------------------------------------------- 1 | function result = root_dir() 2 | result = fileparts(fileparts(which('spx.root_dir'))); 3 | end 4 | -------------------------------------------------------------------------------- /library/+spx/sparse.m: -------------------------------------------------------------------------------- 1 | classdef sparse 2 | % Helper methods for working with sparse matrices 3 | 4 | methods(Static) 5 | 6 | function A = join_data_indices(data, omega, n1, n2) 7 | % Constructs a sparse matrix from the data and indices in 8 | m = length(omega); 9 | [i, j] = ind2sub([n1,n2], omega); 10 | A = sparse(i,j,data,n1,n2,m); 11 | end 12 | 13 | function [data, indices, m, n] = split_data_indices(A) 14 | if ~issparse(A) 15 | error('A should be a sparse matrix.'); 16 | end 17 | [m, n] = size(A); 18 | indices = find(A); 19 | data = A(indices); 20 | end 21 | 22 | end % methods 23 | end % classdef 24 | 25 | -------------------------------------------------------------------------------- /library/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/__init__.py -------------------------------------------------------------------------------- /library/ext/README.md: -------------------------------------------------------------------------------- 1 | External libraries directory 2 | ================================ 3 | 4 | This directory contains code picked up from external sources. 5 | 6 | -------------------------------------------------------------------------------- /library/ext/export_fig/.ignore/ghostscript.txt: -------------------------------------------------------------------------------- 1 | C:\Program Files\gs\gs9.05\bin\gswin64c.exe -------------------------------------------------------------------------------- /library/ext/export_fig/.ignore/gs_font_path.txt: -------------------------------------------------------------------------------- 1 | C:\Windows\Fonts -------------------------------------------------------------------------------- /library/ext/export_fig/ImageSelection.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/ext/export_fig/ImageSelection.class -------------------------------------------------------------------------------- /library/ext/export_fig/ImageSelection.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/ext/export_fig/ImageSelection.java -------------------------------------------------------------------------------- /library/ext/export_fig/print2eps.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/ext/export_fig/print2eps.m -------------------------------------------------------------------------------- /library/ext/hungarian.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/ext/hungarian.m -------------------------------------------------------------------------------- /library/ext/lsqi.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indigits/sparse-plex/43cae2978f62938d001baaa03308a2a717ee6c9b/library/ext/lsqi.m -------------------------------------------------------------------------------- /library/pathsetup.py: -------------------------------------------------------------------------------- 1 | import os 2 | from os import path 3 | 4 | library_dir = path.dirname(__file__) 5 | 6 | -------------------------------------------------------------------------------- /library/tests/clustering/test_kmeans_pp.m: -------------------------------------------------------------------------------- 1 | function tests = test_kmeans_pp 2 | tests = functiontests(localfunctions); 3 | end 4 | 5 | 6 | function test_1(testCase) 7 | X = [1 2 7 8 20 21 8 | 1 2 7 8 20 21]; 9 | % Capture current random number generator state 10 | st = rng; 11 | % Go to default state 12 | rng('default'); 13 | % Perform testing 14 | [seeds, labels] = spx.cluster.kmeans.pp_initialize(X, 3); 15 | verifyEqual(testCase, seeds, [ 16 | 20 8 1 17 | 20 8 1]); 18 | verifyEqual(testCase, labels, [3 3 2 2 1 1]); 19 | % restore previous state 20 | rng(st); 21 | end 22 | 23 | -------------------------------------------------------------------------------- /library/tests/commons/test_lang.m: -------------------------------------------------------------------------------- 1 | function tests = test_lang 2 | tests = functiontests(localfunctions); 3 | end 4 | 5 | function test_1(testCase) 6 | verifyTrue(testCase, spx.lang.is_class('spx.lang')); 7 | verifyFalse(testCase, spx.lang.is_class('spx.lang.noop')); 8 | spx.lang.noop; 9 | end 10 | -------------------------------------------------------------------------------- /library/tests/commons/test_signals.m: -------------------------------------------------------------------------------- 1 | 2 | function tests = test_signals 3 | tests = functiontests(localfunctions); 4 | end 5 | 6 | function test_picket_fence(testCase) 7 | import spx.data.synthetic.picket_fence; 8 | import spx.commons.sparse.support; 9 | s = picket_fence(16); 10 | expected_s = [ 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 ]; 11 | verifyEqual(testCase, s, s); 12 | fs = fft(s); 13 | verifyEqual(testCase, support(s), support(fs)); 14 | Ns = (1:100).^2; 15 | for N=Ns 16 | s = picket_fence(N); 17 | fs = fft(s); 18 | verifyEqual(testCase, support(s), support(fs, 1e-8)); 19 | end 20 | end 21 | 22 | -------------------------------------------------------------------------------- /library/tests/data/synthetic/test_dict_learn.m: -------------------------------------------------------------------------------- 1 | function tests = test_dict_learn 2 | tests = functiontests(localfunctions); 3 | end 4 | 5 | function setupOnce(testCase) 6 | figure; 7 | end 8 | function teardownOnce(testCase) 9 | close; 10 | end 11 | 12 | 13 | function test1(testCase) 14 | import spx.data.synthetic.dict_learn_problems; 15 | problem = dict_learn_problems.problem_random_dict(); 16 | imagesc(problem.true_dictionary); 17 | pause(.1); 18 | end 19 | 20 | -------------------------------------------------------------------------------- /library/tests/data/test_basic_noise.m: -------------------------------------------------------------------------------- 1 | function tests = test_basic_noise 2 | tests = functiontests(localfunctions); 3 | end 4 | 5 | function test1(testCase) 6 | N = 100; 7 | S = 100; 8 | gen = spx.data.noise.Basic(N, S); 9 | sigma = 1; 10 | X = gen.gaussian(sigma); 11 | variance = sum(sum(X.^2)) / (N * S); 12 | verifyEqual(testCase, sigma, variance, 'RelTol', .1); 13 | end 14 | -------------------------------------------------------------------------------- /library/tests/dict/test_dictionary_comparison.m: -------------------------------------------------------------------------------- 1 | function tests = test_dictionary_comparison 2 | tests = functiontests(localfunctions); 3 | end 4 | 5 | 6 | function test_1(testCase) 7 | d = spx.dict.simple.dirac_fourier_mtx(16); 8 | ratio = spx.dict.comparison.matching_atoms_ratio(d, d); 9 | verifyEqual(testCase, ratio, 1); 10 | % Let's mess up with one of the atoms 11 | d2 = d; 12 | d2(1:4, 1) = 1/2; 13 | ratio = spx.dict.comparison.matching_atoms_ratio(d, d2); 14 | verifyEqual(testCase, ratio, 31/32); 15 | d2(2:5, 2) = 1/2; 16 | ratio = spx.dict.comparison.matching_atoms_ratio(d, d2); 17 | verifyEqual(testCase, ratio, 30/32); 18 | end 19 | 20 | -------------------------------------------------------------------------------- /library/tests/runalltests.m: -------------------------------------------------------------------------------- 1 | 2 | function runalltests(all) 3 | if nargin < 1 4 | all = false; 5 | else 6 | end 7 | 8 | import matlab.unittest.TestSuite; 9 | import matlab.unittest.selectors.HasTag; 10 | 11 | 12 | suite = TestSuite.fromFolder(pwd, 'IncludingSubfolders', true); 13 | untagged_tests = suite.selectIf(~HasTag); 14 | tagged_tests = suite.selectIf(HasTag); 15 | long_tests = tagged_tests.selectIf(HasTag('Long')) 16 | 17 | if all 18 | result = run(suite) 19 | else 20 | result = run(untagged_tests) 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /library/tests/stats/test_statistics.m: -------------------------------------------------------------------------------- 1 | function tests = test_statistics 2 | tests = functiontests(localfunctions); 3 | end 4 | 5 | 6 | function test_mean(testCase) 7 | x = 1:100; 8 | xm = spx.stats.compute_statistic_per_vector(x, 1, @mean); 9 | verifyEqual(testCase, xm', x); 10 | end 11 | -------------------------------------------------------------------------------- /library/tests/wavelet/test_beylkin.m: -------------------------------------------------------------------------------- 1 | function tests = test_beylkin 2 | tests = functiontests(localfunctions); 3 | end 4 | 5 | function test_qmf(testCase) 6 | f = spx.wavelet.baylkin.quad_mirror_filter(); 7 | verifyTrue(testCase, spx.norm.is_unit_norm_vec(f)); 8 | end 9 | 10 | -------------------------------------------------------------------------------- /library/tests/wavelet/test_coiflet.m: -------------------------------------------------------------------------------- 1 | function tests = test_coiflet 2 | tests = functiontests(localfunctions); 3 | end 4 | 5 | function test_qmf(testCase) 6 | f = spx.wavelet.coiflet.quad_mirror_filter(1); 7 | verifyTrue(testCase, spx.norm.is_unit_norm_vec(f)); 8 | f = spx.wavelet.coiflet.quad_mirror_filter(2); 9 | verifyTrue(testCase, spx.norm.is_unit_norm_vec(f)); 10 | f = spx.wavelet.coiflet.quad_mirror_filter(3); 11 | verifyTrue(testCase, spx.norm.is_unit_norm_vec(f)); 12 | f = spx.wavelet.coiflet.quad_mirror_filter(4); 13 | verifyTrue(testCase, spx.norm.is_unit_norm_vec(f)); 14 | f = spx.wavelet.coiflet.quad_mirror_filter(5); 15 | verifyTrue(testCase, spx.norm.is_unit_norm_vec(f)); 16 | end 17 | 18 | -------------------------------------------------------------------------------- /library/tests/wavelet/test_haar.m: -------------------------------------------------------------------------------- 1 | function tests = test_haar 2 | tests = functiontests(localfunctions); 3 | end 4 | 5 | function test_qmf(testCase) 6 | f = spx.wavelet.haar.quad_mirror_filter(); 7 | verifyTrue(testCase, spx.norm.is_unit_norm_vec(f)); 8 | end 9 | 10 | -------------------------------------------------------------------------------- /library/tests/wavelet/test_vaidyanathan.m: -------------------------------------------------------------------------------- 1 | function tests = test_vaidyanathan 2 | tests = functiontests(localfunctions); 3 | end 4 | 5 | function test_qmf(testCase) 6 | f = spx.wavelet.vaidyanathan.quad_mirror_filter(); 7 | verifyTrue(testCase, spx.norm.is_unit_norm_vec(f)); 8 | end 9 | 10 | -------------------------------------------------------------------------------- /readthedocs.yml: -------------------------------------------------------------------------------- 1 | formats: [] -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | sphinxcontrib-bibtex 2 | sphinx_rtd_theme 3 | -------------------------------------------------------------------------------- /spx_defaults.ini: -------------------------------------------------------------------------------- 1 | # Paths for test data 2 | 3 | # http://srapplis.com/?p=1788 4 | standard_test_images_dir=D:\datasets\images\standard_test_images 5 | 6 | 7 | # http://vision.ucsd.edu/~leekc/ExtYaleDatabase/ExtYaleB.html 8 | # download cropped version of images 9 | yale_faces_db_dir=D:\datasets\images\faces\CroppedYale 10 | 11 | 12 | # http://www.vision.jhu.edu/data/hopkins155/ 13 | hopkins155_dir = D:\datasets\motion\Hopkins155 -------------------------------------------------------------------------------- /spx_get_env.m: -------------------------------------------------------------------------------- 1 | function env = spx_get_env(); 2 | global spx_env; 3 | if isempty(spx_env) 4 | filepath = which(mfilename); 5 | root = fileparts(filepath); 6 | spx_settings_cache = fullfile(root, 'spx_local_settings.mat'); 7 | data = load(spx_settings_cache); 8 | spx_env = data.globals; 9 | end 10 | env = spx_env; 11 | end 12 | 13 | -------------------------------------------------------------------------------- /startup.m: -------------------------------------------------------------------------------- 1 | spx_setup 2 | addpath('E:\lib\Matlab\toolbox\matlab_xunit_3_1_1\xunit'); --------------------------------------------------------------------------------