├── .gitignore ├── 3rdparty ├── .gitignore ├── CSCbox │ ├── LICENSE │ ├── README.txt │ ├── codes │ │ ├── CSC.m │ │ ├── SC.m │ │ ├── compute_modularity.m │ │ ├── create_SBM.m │ │ ├── estimate_lambda_k.m │ │ ├── interpolate_on_complete_graph.m │ │ └── jackson_cheby_poly_coefficients.m │ ├── main_CSC.m │ └── third_party │ │ ├── PartAgreeCoef_ARonly.m │ │ ├── README.txt │ │ ├── ind2sub4up.m │ │ ├── my_binornd.m │ │ └── rand_index.m ├── Community_BGLL_Matlab │ ├── cluster_jl.m │ ├── cluster_jl_cpp.m │ ├── cluster_jl_orient.m │ ├── cluster_jl_orientT.m │ ├── cluster_jl_orientT_cpp.m │ ├── cluster_jl_orient_cpp.m │ ├── jl_clust.cpp │ ├── jl_clust.mexglx │ ├── jl_clust_orient.cpp │ ├── jl_clust_orient.mexglx │ ├── jl_mnew.cpp │ ├── jl_mnew.mexglx │ └── readme.txt ├── LDL │ ├── AMD │ │ ├── Demo │ │ │ ├── Makefile │ │ │ ├── amd_demo.c │ │ │ ├── amd_demo.out │ │ │ ├── amd_demo2.c │ │ │ ├── amd_demo2.out │ │ │ ├── amd_f77cross.f │ │ │ ├── amd_f77cross.out │ │ │ ├── amd_f77demo.f │ │ │ ├── amd_f77demo.out │ │ │ ├── amd_f77simple.f │ │ │ ├── amd_f77simple.out │ │ │ ├── amd_f77wrapper.c │ │ │ ├── amd_l_demo.c │ │ │ ├── amd_l_demo.out │ │ │ ├── amd_simple.c │ │ │ └── amd_simple.out │ │ ├── Doc │ │ │ ├── AMD_UserGuide.bib │ │ │ ├── AMD_UserGuide.pdf │ │ │ ├── AMD_UserGuide.tex │ │ │ ├── ChangeLog │ │ │ ├── License │ │ │ ├── Makefile │ │ │ └── lesser.txt │ │ ├── Include │ │ │ ├── amd.h │ │ │ └── amd_internal.h │ │ ├── Lib │ │ │ ├── GNUmakefile │ │ │ ├── Makefile │ │ │ └── libamd.def │ │ ├── MATLAB │ │ │ ├── Contents1.m │ │ │ ├── amd2.m │ │ │ ├── amd_demo.m │ │ │ ├── amd_demo.m.out │ │ │ ├── amd_install.m │ │ │ ├── amd_make.m │ │ │ ├── amd_mex.c │ │ │ └── can_24 │ │ ├── Makefile │ │ ├── README.txt │ │ └── Source │ │ │ ├── amd.f │ │ │ ├── amd_1.c │ │ │ ├── amd_2.c │ │ │ ├── amd_aat.c │ │ │ ├── amd_control.c │ │ │ ├── amd_defaults.c │ │ │ ├── amd_dump.c │ │ │ ├── amd_global.c │ │ │ ├── amd_info.c │ │ │ ├── amd_order.c │ │ │ ├── amd_post_tree.c │ │ │ ├── amd_postorder.c │ │ │ ├── amd_preprocess.c │ │ │ ├── amd_valid.c │ │ │ └── amdbar.f │ ├── LDL │ │ ├── Demo │ │ │ ├── Makefile │ │ │ ├── ldlamd.out │ │ │ ├── ldllamd.out │ │ │ ├── ldllmain.out │ │ │ ├── ldllsimple.c │ │ │ ├── ldllsimple.out │ │ │ ├── ldlmain.c │ │ │ ├── ldlmain.out │ │ │ ├── ldlsimple.c │ │ │ └── ldlsimple.out │ │ ├── Doc │ │ │ ├── ChangeLog │ │ │ ├── Makefile │ │ │ ├── ldl.bib │ │ │ ├── ldl_userguide.pdf │ │ │ ├── ldl_userguide.tex │ │ │ └── lesser.txt │ │ ├── Include │ │ │ └── ldl.h │ │ ├── Lib │ │ │ └── Makefile │ │ ├── MATLAB │ │ │ ├── Contents1.m │ │ │ ├── ldl_install.m │ │ │ ├── ldl_make.m │ │ │ ├── ldldemo.m │ │ │ ├── ldldemo.out │ │ │ ├── ldlmain2.m │ │ │ ├── ldlmain2.out │ │ │ ├── ldlmex.c │ │ │ ├── ldlmex_short.c │ │ │ ├── ldlnumericmex.c │ │ │ ├── ldlnumericmex_old.c │ │ │ ├── ldlrow.m │ │ │ ├── ldlsparse.m │ │ │ ├── ldlsymbol.m │ │ │ ├── ldlsymbol_extra.c │ │ │ ├── ldlsymbol_extra_old.c │ │ │ ├── ldlsymbolmex.c │ │ │ ├── ldltest.m │ │ │ └── ldltest.out │ │ ├── Makefile │ │ ├── Matrix │ │ │ ├── A01 │ │ │ ├── A02 │ │ │ ├── A03 │ │ │ ├── A04 │ │ │ ├── A05 │ │ │ ├── A06 │ │ │ ├── A07 │ │ │ ├── A08 │ │ │ ├── A09 │ │ │ ├── A10 │ │ │ ├── A11 │ │ │ ├── A12 │ │ │ ├── A13 │ │ │ ├── A14 │ │ │ ├── A15 │ │ │ ├── A16 │ │ │ ├── A17 │ │ │ ├── A18 │ │ │ ├── A19 │ │ │ ├── A20 │ │ │ ├── A21 │ │ │ ├── A22 │ │ │ ├── A23 │ │ │ ├── A24 │ │ │ ├── A25 │ │ │ ├── A26 │ │ │ ├── A27 │ │ │ ├── A28 │ │ │ ├── A29 │ │ │ └── A30 │ │ ├── README.txt │ │ └── Source │ │ │ └── ldl.c │ └── SuiteSparse_config │ │ ├── Makefile │ │ ├── README.txt │ │ ├── SuiteSparse_config.c │ │ ├── SuiteSparse_config.h │ │ ├── SuiteSparse_config.mk │ │ ├── SuiteSparse_config_GPU.mk │ │ ├── SuiteSparse_config_Mac.mk │ │ └── xerbla │ │ ├── Makefile │ │ ├── xerbla.c │ │ ├── xerbla.f │ │ └── xerbla.h ├── eq_sphere_partitions │ ├── AUTHORS │ ├── CHANGELOG │ ├── COPYING │ ├── Contents.m │ ├── INSTALL.txt │ ├── README.txt │ ├── eq_illustrations │ │ ├── Contents.m │ │ ├── illustration_options.m │ │ ├── private │ │ │ ├── show_s2_sphere.m │ │ │ ├── surf_jet.m │ │ │ ├── x2eqarea.m │ │ │ └── x2stereo.m │ │ ├── project_point_set.m │ │ ├── project_s2_partition.m │ │ ├── project_s3_partition.m │ │ ├── show_r3_point_set.m │ │ └── show_s2_partition.m │ ├── eq_partitions │ │ ├── Contents.m │ │ ├── eq_caps.m │ │ ├── eq_point_set.m │ │ ├── eq_point_set_polar.m │ │ ├── eq_regions.m │ │ ├── illustrate_eq_algorithm.m │ │ ├── partition_options.m │ │ └── private │ │ │ ├── bot_cap_region.m │ │ │ ├── cap_colats.m │ │ │ ├── centres_of_regions.m │ │ │ ├── circle_offset.m │ │ │ ├── ideal_region_list.m │ │ │ ├── num_collars.m │ │ │ ├── polar_colat.m │ │ │ ├── rot3.m │ │ │ ├── round_to_naturals.m │ │ │ ├── s2_offset.m │ │ │ ├── sphere_region.m │ │ │ └── top_cap_region.m │ ├── eq_point_set_props │ │ ├── Contents.m │ │ ├── calc_dist_coeff.m │ │ ├── calc_energy_coeff.m │ │ ├── calc_packing_density.m │ │ ├── eq_dist_coeff.m │ │ ├── eq_energy_coeff.m │ │ ├── eq_energy_dist.m │ │ ├── eq_min_dist.m │ │ ├── eq_packing_density.m │ │ ├── eq_point_set_property.m │ │ ├── point_set_dist_coeff.m │ │ ├── point_set_energy_coeff.m │ │ ├── point_set_energy_dist.m │ │ ├── point_set_min_dist.m │ │ └── point_set_packing_density.m │ ├── eq_region_props │ │ ├── Contents.m │ │ ├── eq_diam_bound.m │ │ ├── eq_diam_coeff.m │ │ ├── eq_regions_property.m │ │ ├── eq_vertex_diam.m │ │ ├── eq_vertex_diam_coeff.m │ │ └── private │ │ │ ├── expand_region_for_diam.m │ │ │ ├── max_diam_bound_of_regions.m │ │ │ ├── max_vertex_diam_of_regions.m │ │ │ └── pseudo_region_for_diam.m │ ├── eq_test │ │ ├── Contents.m │ │ └── eq_area_error.m │ ├── eq_utilities │ │ ├── Contents.m │ │ ├── area_of_cap.m │ │ ├── area_of_collar.m │ │ ├── area_of_ideal_region.m │ │ ├── area_of_sphere.m │ │ ├── cart2polar2.m │ │ ├── euc2sph_dist.m │ │ ├── euclidean_dist.m │ │ ├── fatcurve.m │ │ ├── haslight.m │ │ ├── ideal_collar_angle.m │ │ ├── polar2cart.m │ │ ├── sph2euc_dist.m │ │ ├── spherical_dist.m │ │ ├── sradius_of_cap.m │ │ └── volume_of_ball.m │ ├── info.ins │ ├── install_eq_toolbox.m │ ├── private │ │ ├── install.m │ │ ├── savepathonly.m │ │ └── uninstall.m │ └── uninstall_eq_toolbox.m ├── flann │ ├── flann_build_index.m │ ├── flann_free_index.m │ ├── flann_load_index.m │ ├── flann_save_index.m │ ├── flann_search.m │ ├── flann_set_distance_type.m │ ├── test_flann.m │ └── testset.dat ├── gendist.m ├── print2eps.m └── sources │ └── flann-1.8.4-src │ ├── CMakeLists.txt │ ├── COPYING │ ├── ChangeLog │ ├── README.md │ ├── bin │ ├── download_checkmd5.py │ ├── indent.sh │ ├── make_release.sh │ ├── run_test.py │ └── uncrustify.cfg │ ├── cmake │ ├── CMakeLists.txt │ ├── FindFlann.cmake │ ├── UseLATEX.cmake │ ├── flann.pc.in │ ├── flann_utils.cmake │ └── uninstall_target.cmake.in │ ├── doc │ ├── CMakeLists.txt │ ├── images │ │ └── cmake-gui.png │ ├── manual.tex │ └── references.bib │ ├── examples │ ├── CMakeLists.txt │ ├── README │ ├── flann_example.c │ ├── flann_example.cpp │ └── flann_example_mpi.cpp │ ├── src │ ├── CMakeLists.txt │ ├── cpp │ │ ├── CMakeLists.txt │ │ └── flann │ │ │ ├── algorithms │ │ │ ├── all_indices.h │ │ │ ├── autotuned_index.h │ │ │ ├── center_chooser.h │ │ │ ├── composite_index.h │ │ │ ├── dist.h │ │ │ ├── hierarchical_clustering_index.h │ │ │ ├── kdtree_cuda_3d_index.cu │ │ │ ├── kdtree_cuda_3d_index.h │ │ │ ├── kdtree_cuda_builder.h │ │ │ ├── kdtree_index.h │ │ │ ├── kdtree_single_index.h │ │ │ ├── kmeans_index.h │ │ │ ├── linear_index.h │ │ │ ├── lsh_index.h │ │ │ └── nn_index.h │ │ │ ├── config.h │ │ │ ├── config.h.in │ │ │ ├── defines.h │ │ │ ├── flann.cpp │ │ │ ├── flann.h │ │ │ ├── flann.hpp │ │ │ ├── flann_cpp.cpp │ │ │ ├── general.h │ │ │ ├── io │ │ │ └── hdf5.h │ │ │ ├── mpi │ │ │ ├── client.h │ │ │ ├── flann_mpi_client.cpp │ │ │ ├── flann_mpi_server.cpp │ │ │ ├── index.h │ │ │ ├── matrix.h │ │ │ ├── queries.h │ │ │ └── server.h │ │ │ ├── nn │ │ │ ├── ground_truth.h │ │ │ ├── index_testing.h │ │ │ └── simplex_downhill.h │ │ │ └── util │ │ │ ├── allocator.h │ │ │ ├── any.h │ │ │ ├── cuda │ │ │ ├── heap.h │ │ │ └── result_set.h │ │ │ ├── cutil_math.h │ │ │ ├── dynamic_bitset.h │ │ │ ├── heap.h │ │ │ ├── logger.h │ │ │ ├── lsh_table.h │ │ │ ├── matrix.h │ │ │ ├── object_factory.h │ │ │ ├── params.h │ │ │ ├── random.h │ │ │ ├── result_set.h │ │ │ ├── sampling.h │ │ │ ├── saving.h │ │ │ ├── serialization.h │ │ │ └── timer.h │ ├── matlab │ │ ├── CMakeLists.txt │ │ ├── flann_build_index.m │ │ ├── flann_free_index.m │ │ ├── flann_load_index.m │ │ ├── flann_save_index.m │ │ ├── flann_search.m │ │ ├── flann_set_distance_type.m │ │ ├── nearest_neighbors.cpp │ │ └── test_flann.m │ └── python │ │ ├── CMakeLists.txt │ │ ├── pyflann │ │ ├── __init__.py │ │ ├── exceptions.py │ │ ├── flann_ctypes.py │ │ └── index.py │ │ └── setup.py.tpl │ └── test │ ├── CMakeLists.txt │ ├── flann_autotuned_test.cpp │ ├── flann_cuda_test.cu │ ├── flann_hierarchical_test.cpp │ ├── flann_kdtree_single_test.cpp │ ├── flann_kdtree_test.cpp │ ├── flann_kmeans_test.cpp │ ├── flann_linear_test.cpp │ ├── flann_lsh_test.cpp │ ├── flann_multithreaded_test.cpp │ ├── flann_tests.h │ ├── memusage_clustering.py │ ├── memusage_nn.py │ ├── test_clustering.py │ ├── test_index_save.py │ ├── test_nn.py │ ├── test_nn_autotune.py │ └── test_nn_index.py ├── Contents.m ├── LICENSE ├── README.md ├── demos ├── Contents.m ├── gsp_demo.m ├── gsp_demo_graph_embedding.m ├── gsp_demo_graph_tv.m ├── gsp_demo_learn_graph.m ├── gsp_demo_learn_graph_large.m ├── gsp_demo_poster.m ├── gsp_demo_pyramid.m ├── gsp_demo_stationarity.m ├── gsp_demo_tv_inpainting.m ├── gsp_demo_wavelet.m └── gsp_demo_wavelet_dn.m ├── embedding ├── Contents.m ├── gsp_compute_coordinates.m ├── gsp_eigenspace_estimation.m ├── gsp_isomap.m ├── gsp_laplacian_eigenmaps.m ├── gsp_lle.m └── gsp_weight2distance.m ├── filters ├── Contents.m ├── gsp_approx_filter.m ├── gsp_design_abspline.m ├── gsp_design_can_dual.m ├── gsp_design_expwin.m ├── gsp_design_half_cosine.m ├── gsp_design_heat.m ├── gsp_design_held.m ├── gsp_design_itersine.m ├── gsp_design_mexican_hat.m ├── gsp_design_meyer.m ├── gsp_design_papadakis.m ├── gsp_design_regular.m ├── gsp_design_simoncelli.m ├── gsp_design_simple_tf.m ├── gsp_design_smooth_indicator.m ├── gsp_design_warped_translates.m ├── gsp_evaluate_can_dual.m ├── gsp_filter.m ├── gsp_filter_analysis.m ├── gsp_filter_evaluate.m ├── gsp_filter_inverse.m ├── gsp_filter_synthesis.m ├── gsp_filterbank_bounds.m ├── gsp_filterbank_matrix.m ├── gsp_gabor_filterbank.m ├── gsp_jtv_compute_frame.m ├── gsp_jtv_design_can_dual.m ├── gsp_jtv_design_damped_wave.m ├── gsp_jtv_design_dgw.m ├── gsp_jtv_design_diffusion.m ├── gsp_jtv_design_kleingordon.m ├── gsp_jtv_design_meyer.m ├── gsp_jtv_design_wave.m ├── gsp_jtv_evaluate_can_dual.m ├── gsp_jtv_filter_analysis.m ├── gsp_jtv_filter_array.m ├── gsp_jtv_filter_evaluate.m ├── gsp_jtv_filter_inverse.m ├── gsp_jtv_filter_synthesis.m ├── gsp_jtv_mat2vec.m ├── gsp_jtv_vec2mat.m ├── gsp_mat2vec.m ├── gsp_multiply_filters.m ├── gsp_test_duality.m ├── gsp_test_duality_coefficient.m ├── gsp_tighten_filter.m ├── gsp_vec2mat.m ├── gsp_warp_filter.m ├── gsp_wlog_scales.m └── utils │ ├── gsp_erdos_renyi_density.m │ ├── gsp_erdos_renyi_density_normalized.m │ ├── gsp_erdos_renyi_warp.m │ ├── gsp_free_conv_norm_semi.m │ ├── gsp_mono_cubic_warp_fn.m │ ├── gsp_pwl_warp_fn.m │ ├── gsp_random_regular_density.m │ └── histnorm.m ├── graph_ml ├── .gitignore ├── gsp_classification_knn.m ├── gsp_classification_matrix.m ├── gsp_classification_tik.m ├── gsp_classification_tv.m ├── gsp_classification_tv_new.m ├── gsp_frkhs.m ├── gsp_frpcaog_1g.m ├── gsp_frpcaog_2g.m ├── gsp_gpcatv_2g.m ├── gsp_knn_classify_graph.m ├── gsp_matrix2label.m ├── gsp_ml_rls.m ├── gsp_ml_rls_tik.m ├── gsp_ml_rls_tv.m ├── gsp_regression_Lx_l1.m ├── gsp_regression_knn.m ├── gsp_regression_tik.m ├── gsp_regression_tv.m └── gsp_rkhs_evaluate.m ├── graphs ├── Contents.m ├── gsp_2dgrid.m ├── gsp_airfoil.m ├── gsp_barabasi_albert.m ├── gsp_bunny.m ├── gsp_comet.m ├── gsp_community.m ├── gsp_components.m ├── gsp_copy_graph_attributes.m ├── gsp_cube.m ├── gsp_david_sensor_network.m ├── gsp_erdos_renyi.m ├── gsp_full_connected.m ├── gsp_graph.m ├── gsp_graph_default_parameters.m ├── gsp_graph_default_plotting_parameters.m ├── gsp_graph_product.m ├── gsp_hypergraph.m ├── gsp_jtv_graph.m ├── gsp_line_graph.m ├── gsp_logo.m ├── gsp_low_stretch_tree.m ├── gsp_minnesota.m ├── gsp_modified_path.m ├── gsp_nn_graph.m ├── gsp_nn_hypergraph.m ├── gsp_non_uniform.m ├── gsp_non_uniform_patch.m ├── gsp_path.m ├── gsp_random_regular.m ├── gsp_random_ring.m ├── gsp_ring.m ├── gsp_rmse_mv_graph.m ├── gsp_sensor.m ├── gsp_separate_graph.m ├── gsp_sphere.m ├── gsp_spiral.m ├── gsp_stochastic_block_graph.m ├── gsp_subgraph.m ├── gsp_swiss_roll.m ├── gsp_torus.m ├── gsp_tree.m ├── gsp_two_moons.m ├── gsp_update_coordinates.m ├── gsp_update_weights.m └── misc │ ├── createRandRegGraph.m │ ├── david500.mat │ ├── david64.mat │ ├── logogsp.mat │ ├── minnesota.mat │ └── rescale_center.m ├── gsp_install.m ├── gsp_install_unlocbox.m ├── gsp_make.m ├── gsp_start.m ├── gspbox_version ├── imageprocessing ├── Contents.m └── gsp_patch_graph.m ├── learn_graph ├── Contents.m ├── gsp_demo_learn_graph_parameters.m ├── gsp_learn_graph_l2_degrees.m ├── gsp_learn_graph_l2_degrees_mine.m ├── gsp_learn_graph_log_degrees.m └── gsp_learn_tcer.m ├── mat2doc ├── conf.py ├── conf_local.py.template ├── copyrightplate ├── html │ ├── conf.py │ ├── highlight.css │ ├── include │ │ ├── docnav.html │ │ └── jumplist.js │ └── template.html ├── ignore ├── mat │ ├── conf.py │ └── header.m ├── nodocs ├── php │ └── conf.py ├── project.bib ├── publish.py ├── publish_local.py.template ├── publishfunctions.py └── tex │ ├── conf.py │ ├── frontpage.png │ └── main │ ├── Makefile │ ├── frontpage.eps │ ├── frontpage.m │ └── gspbox.tex ├── operators ├── Contents.m ├── gsp_div.m ├── gsp_gft.m ├── gsp_grad.m ├── gsp_grad_mat.m ├── gsp_graph_multiresolution.m ├── gsp_gwft.m ├── gsp_gwft_frame_matrix.m ├── gsp_igft.m ├── gsp_ijft.m ├── gsp_interpolate.m ├── gsp_itft.m ├── gsp_jft.m ├── gsp_jtwgft.m ├── gsp_kron_reduce.m ├── gsp_kron_reduction.m ├── gsp_localize.m ├── gsp_modulate.m ├── gsp_ngwft.m ├── gsp_ngwft_frame_matrix.m ├── gsp_pyramid_analysis.m ├── gsp_pyramid_analysis_single.m ├── gsp_pyramid_cell2coeff.m ├── gsp_pyramid_synthesis.m ├── gsp_pyramid_synthesis_single.m └── gsp_tft.m ├── plotting ├── Contents.m ├── gsp_plot_edges.m ├── gsp_plot_filter.m ├── gsp_plot_graph.m ├── gsp_plot_jft.m ├── gsp_plot_jtv_filter.m ├── gsp_plot_jtv_signal.m ├── gsp_plot_sgram.m ├── gsp_plot_signal.m └── gsp_plot_signal_spectral.m ├── pointsclouds ├── Contents.m ├── airfoil.mat ├── bunny.mat ├── gsp_pointcloud.m ├── gsp_twospirals.m ├── to_be_included │ ├── clusterincluster.m │ ├── corners.m │ ├── crescentfullmoon.m │ ├── datasets.png │ ├── datasetsdemo.m │ ├── halfkernel.m │ ├── outlier.m │ └── twospirals.m └── two_moons.mat ├── prox ├── Contents.m ├── gsp_proj_b2_filterbank.m ├── gsp_proj_filterbank.m ├── gsp_prox_l1_filterbank.m ├── gsp_prox_l2_filterbank.m ├── gsp_prox_tik.m ├── gsp_prox_tv.m ├── gsp_solve_l0.m ├── gsp_solve_l1.m └── gsp_wavelet_dn.m ├── sgwt_require ├── create_synthetic_dataset.m ├── sgwt_cheby_square.m ├── sgwt_kernel_abspline3.m ├── sgwt_kernel_abspline5.m └── sgwt_kernel_simple_tf.m ├── stationarity ├── Contents.m ├── gsp_design_translates.m ├── gsp_estimate_psd.m ├── gsp_experimental_psd.m ├── gsp_jtv_estimate_psd.m ├── gsp_jtv_wiener_inpainting.m ├── gsp_jtwgft.m ├── gsp_remove_mean.m ├── gsp_stationarity_cov.m ├── gsp_stationarity_ratio.m ├── gsp_wiener_inpainting.m ├── gsp_wiener_inpainting_exact.m ├── gsp_wiener_l2.m └── gsp_wiener_optimization.m ├── test_gsptoolbox ├── fast_gwft │ ├── WGFT_atom.m │ ├── WGFT_gconv.m │ ├── WGFT_gft.m │ ├── WGFT_gmod.m │ ├── WGFT_gtrans.m │ ├── WGFT_igft.m │ ├── WGFT_wgft.m │ └── sgwt_delta.m ├── gsp_assert_test.m ├── gsp_test_graph_learning.m ├── gsp_test_tig.m ├── help_test_flann.m ├── old │ ├── compute_resistance_distances.m │ ├── gsp_compute_resistance_distances_old.m │ ├── gsp_div_old.m │ ├── gsp_graph_multiresolution_old.m │ ├── gsp_graph_sparsify_old.m │ ├── gsp_interpolate_old.m │ ├── gsp_kron_reduce_old.m │ ├── gsp_pyramid_analysis_old.m │ ├── gsp_pyramid_analysis_single_interpolation_old.m │ ├── gsp_pyramid_synthesis_old.m │ ├── gsp_pyramid_synthesis_single_interpolation_old.m │ ├── gsp_translate_old.m │ └── sgwt_toolbox │ │ ├── ACKNOWLEDGE.txt │ │ ├── CHANGELOG.txt │ │ ├── LICENSE.txt │ │ ├── README.txt │ │ ├── demo │ │ ├── create_synthetic_dataset.m │ │ ├── distanz.m │ │ ├── minnesota.mat │ │ ├── paques_attack.png │ │ ├── sgwt_demo1.m │ │ ├── sgwt_demo2.m │ │ └── sgwt_demo3.m │ │ ├── mex │ │ ├── Makefile │ │ ├── cheby_op.cpp │ │ ├── cheby_op.h │ │ ├── cheby_op_adjoint_mex.cpp │ │ ├── cheby_op_mex.cpp │ │ └── test_cheby_op_mex.m │ │ ├── sgwt_adjoint.m │ │ ├── sgwt_cheby_coeff.m │ │ ├── sgwt_cheby_eval.m │ │ ├── sgwt_cheby_op.m │ │ ├── sgwt_cheby_square.m │ │ ├── sgwt_check_connected.m │ │ ├── sgwt_compile_mex.m │ │ ├── sgwt_delta.m │ │ ├── sgwt_filter_design.m │ │ ├── sgwt_forward.m │ │ ├── sgwt_framebounds.m │ │ ├── sgwt_ftsd.m │ │ ├── sgwt_inverse.m │ │ ├── sgwt_irregular_meshmat.m │ │ ├── sgwt_kernel_abspline3.m │ │ ├── sgwt_kernel_abspline5.m │ │ ├── sgwt_kernel_meyer.m │ │ ├── sgwt_kernel_simple_tf.m │ │ ├── sgwt_laplacian.m │ │ ├── sgwt_meshmat.m │ │ ├── sgwt_randmat.m │ │ ├── sgwt_rough_lmax.m │ │ ├── sgwt_setpath.m │ │ ├── sgwt_setscales.m │ │ ├── sgwt_view_design.m │ │ └── utils │ │ ├── argselectAssign.m │ │ ├── argselectCheck.m │ │ ├── sgwt_show_im.m │ │ ├── sgwt_soft_threshold.m │ │ └── vec.m ├── old_jtv │ ├── gsp_jft_simple.m │ ├── gsp_jtv_filter_analysis_simple.m │ ├── gsp_jtv_filter_evaluate_simple.m │ └── gsp_jtv_filter_synthesis_simple.m ├── test_complex.m ├── test_dual.m ├── test_filter.m ├── test_graph_ml.m ├── test_graphs.m ├── test_gsp_distanz.m ├── test_gsp_dn.m ├── test_gsp_estimate_vertex_time_psd.m ├── test_gsp_filter_manifold.m ├── test_gsp_hope_distanz.m ├── test_gsp_nn_graph_oose.m ├── test_gsp_proj_filerbank.m ├── test_gsp_prox.m ├── test_gsp_remove_mean.m ├── test_gsp_solve_l0.m ├── test_gsp_solve_l1.m ├── test_gsp_wiener_jft_predition.m ├── test_gspbox.m ├── test_gwft.m ├── test_jtv_filter.m ├── test_kron.m ├── test_ngwft.m ├── test_operators.m ├── test_plotting.m ├── test_pyramid.m ├── test_resistance_distance.m ├── test_rmse.m ├── test_sparsify.m ├── test_wiener.m └── time_vertex │ ├── gsp_jtv_frame_analysis.m │ ├── gsp_jtv_frame_synthesis.m │ └── gsp_time_translate.m └── utils ├── Contents.m ├── gsp_adj2vec.m ├── gsp_assign_rand_direction.m ├── gsp_cartesian.m ├── gsp_cfa.m ├── gsp_cheby_coeff.m ├── gsp_cheby_eval.m ├── gsp_cheby_op.m ├── gsp_check_connectivity.m ├── gsp_check_connectivity_undirected.m ├── gsp_check_filtertype.m ├── gsp_check_fourier.m ├── gsp_check_jtv.m ├── gsp_check_weights.m ├── gsp_classic2graph_eig_order.m ├── gsp_compute_fourier_basis.m ├── gsp_compute_graph_learning_theta.m ├── gsp_compute_theta_bounds.m ├── gsp_create_laplacian.m ├── gsp_ddf2dcdf.m ├── gsp_decompose_asymmatrix.m ├── gsp_delta.m ├── gsp_diameter.m ├── gsp_distanz.m ├── gsp_estimate_lmax.m ├── gsp_fast_estimate_lk.m ├── gsp_good_graph_index.m ├── gsp_graph_sparsify.m ├── gsp_hop_distanz.m ├── gsp_incidence.m ├── gsp_isdirected.m ├── gsp_jtv_cheby_coeff.m ├── gsp_jtv_cheby_op.m ├── gsp_jtv_delta.m ├── gsp_jtv_fa.m ├── gsp_jtv_ta.m ├── gsp_lanczos_op.m ├── gsp_laplacian.m ├── gsp_nn_distanz.m ├── gsp_norm_l1_filterbank.m ├── gsp_norm_l2_filterbank.m ├── gsp_norm_tig.m ├── gsp_norm_tik.m ├── gsp_norm_tv.m ├── gsp_plotfig.m ├── gsp_point2dcdf.m ├── gsp_repmatline.m ├── gsp_reset_seed.m ├── gsp_resistance_distance.m ├── gsp_resistance_distances.m ├── gsp_rmse_mv.m ├── gsp_smooth_downstep.m ├── gsp_smooth_step.m ├── gsp_sort_nodes.m ├── gsp_spectrum_cdf_approx.m ├── gsp_strong.m ├── gsp_symmetrize.m ├── gsp_tree_depths.m ├── gsp_vec2adj.m └── utils └── boolean.m /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.pyc 3 | ref-gsp.txt 4 | ref-gspbox.txt 5 | mat2doc/startup.m 6 | mat2doc/conf_local.py 7 | mat2doc/publish_local.py 8 | untracked/* 9 | *~ 10 | *.mexa64 11 | *.mexmaci64 12 | -------------------------------------------------------------------------------- /3rdparty/.gitignore: -------------------------------------------------------------------------------- 1 | gaimc 2 | sources/flann-1.8.4-src/build/ 3 | sources/flann-1.8.4-src/cmake/ -------------------------------------------------------------------------------- /3rdparty/CSCbox/README.txt: -------------------------------------------------------------------------------- 1 | This is the CSCbox, a Matlab toolbox that implements the Compressive 2 | Spectral Clustering (CSC) algorithm as detailed in 3 | 4 | N. Tremblay, G. Puy, R. Gribonval and P. Vandergheynst. 5 | Compressive Spectral Clustering. 6 | ArXiv e-prints:1602.02018 Feb. 2016. 7 | 8 | The authors of this Toolbox are Nicolas Tremblay and Gilles Puy; 9 | and can both be joined at firstname.lastname AT inria DOT fr 10 | 11 | This toolbox is probably not bug-free and this is its BETA-version. 12 | Please report any bug to help us improve it. 13 | 14 | This Toolbox is under the GNU Public License (see the attached 15 | document "LICENSE"). 16 | 17 | If you use this Toolbox, please kindly cite us! :-) 18 | -------------------------------------------------------------------------------- /3rdparty/CSCbox/third_party/README.txt: -------------------------------------------------------------------------------- 1 | Authors of these 4 functions are detailed in their respective preamble. 2 | -------------------------------------------------------------------------------- /3rdparty/Community_BGLL_Matlab/jl_clust.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/3rdparty/Community_BGLL_Matlab/jl_clust.mexglx -------------------------------------------------------------------------------- /3rdparty/Community_BGLL_Matlab/jl_clust_orient.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/3rdparty/Community_BGLL_Matlab/jl_clust_orient.mexglx -------------------------------------------------------------------------------- /3rdparty/Community_BGLL_Matlab/jl_mnew.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/3rdparty/Community_BGLL_Matlab/jl_mnew.mexglx -------------------------------------------------------------------------------- /3rdparty/LDL/AMD/Demo/amd_f77simple.out: -------------------------------------------------------------------------------- 1 | P ( 1) = 4 2 | P ( 2) = 1 3 | P ( 3) = 3 4 | P ( 4) = 5 5 | P ( 5) = 2 6 | -------------------------------------------------------------------------------- /3rdparty/LDL/AMD/Demo/amd_simple.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- */ 2 | /* AMD Copyright (c) by Timothy A. Davis, */ 3 | /* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ 4 | /* email: DrTimothyAldenDavis@gmail.com */ 5 | /* ------------------------------------------------------------------------- */ 6 | 7 | #include 8 | #include "amd.h" 9 | 10 | int n = 5 ; 11 | int Ap [ ] = { 0, 2, 6, 10, 12, 14} ; 12 | int Ai [ ] = { 0,1, 0,1,2,4, 1,2,3,4, 2,3, 1,4 } ; 13 | int P [5] ; 14 | 15 | int main (void) 16 | { 17 | int k ; 18 | (void) amd_order (n, Ap, Ai, P, (double *) NULL, (double *) NULL) ; 19 | for (k = 0 ; k < n ; k++) printf ("P [%d] = %d\n", k, P [k]) ; 20 | return (0) ; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /3rdparty/LDL/AMD/Demo/amd_simple.out: -------------------------------------------------------------------------------- 1 | P [0] = 0 2 | P [1] = 3 3 | P [2] = 2 4 | P [3] = 4 5 | P [4] = 1 6 | -------------------------------------------------------------------------------- /3rdparty/LDL/AMD/Doc/AMD_UserGuide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/3rdparty/LDL/AMD/Doc/AMD_UserGuide.pdf -------------------------------------------------------------------------------- /3rdparty/LDL/AMD/Doc/Makefile: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # AMD Makefile for compiling on Unix systems (for GNU or original make) 3 | #------------------------------------------------------------------------------ 4 | 5 | default: dist 6 | 7 | include ../../SuiteSparse_config/SuiteSparse_config.mk 8 | 9 | #------------------------------------------------------------------------------ 10 | # Remove all but the files in the original distribution 11 | #------------------------------------------------------------------------------ 12 | 13 | clean: 14 | - $(RM) $(CLEAN) 15 | 16 | purge: distclean 17 | 18 | distclean: clean 19 | - $(RM) *.aux *.bbl *.blg *.log *.toc 20 | 21 | #------------------------------------------------------------------------------ 22 | # Create the User Guide and Quick Start Guide 23 | #------------------------------------------------------------------------------ 24 | 25 | AMD_UserGuide.pdf: AMD_UserGuide.tex AMD_UserGuide.bib ../Include/amd.h 26 | echo '\\begin{verbatim}' > amd_h.tex 27 | expand -8 ../Include/amd.h >> amd_h.tex 28 | echo '\end{verbatim}' >> amd_h.tex 29 | pdflatex AMD_UserGuide 30 | bibtex AMD_UserGuide 31 | pdflatex AMD_UserGuide 32 | pdflatex AMD_UserGuide 33 | 34 | dist: AMD_UserGuide.pdf 35 | - $(RM) *.aux *.bbl *.blg *.log *.toc amd_h.tex 36 | 37 | -------------------------------------------------------------------------------- /3rdparty/LDL/AMD/Lib/libamd.def: -------------------------------------------------------------------------------- 1 | LIBRARY libamd.dll 2 | EXPORTS 3 | amd_order 4 | amd_defaults 5 | amd_control 6 | amd_info 7 | amd_2 8 | amd_l_order 9 | amd_l_defaults 10 | amd_l_control 11 | amd_l_info 12 | amd_l2 13 | -------------------------------------------------------------------------------- /3rdparty/LDL/AMD/MATLAB/Contents1.m: -------------------------------------------------------------------------------- 1 | %Contents of the AMD sparse matrix ordering package: 2 | % 3 | % amd2 - p = amd2 (A), the approximate minimum degree ordering of A 4 | % amd_demo - a demo of amd2, using the can_24 matrix 5 | % amd_make - to compile amd2 for use in MATLAB 6 | % amd_install - compile and install amd2 for use in MATLAB 7 | % 8 | % See also: amd, amd2, colamd, symamd, colmmd, symmmd, umfpack 9 | % 10 | % Note that amd2 and the built-in amd function in MATLAB 7.3 and later are one 11 | % and the same. 12 | % 13 | % Example: 14 | % p = amd2 (A) ; 15 | 16 | % Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, and Iain S. Duff. 17 | 18 | help Contents 19 | -------------------------------------------------------------------------------- /3rdparty/LDL/AMD/MATLAB/amd_install.m: -------------------------------------------------------------------------------- 1 | function amd_install 2 | %AMD_INSTALL compile and install amd2 for use in MATLAB 3 | % Your current directory must be AMD/MATLAB for this function to work. 4 | % 5 | % Example: 6 | % amd_install 7 | % 8 | % See also amd, amd2. 9 | 10 | % Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, and Iain S. Duff. 11 | 12 | % This orders the same matrix as the ANSI C demo, amd_demo.c. It includes an 13 | 14 | amd_make 15 | addpath (pwd) 16 | fprintf ('\nThe following path has been added. You may wish to add it\n') ; 17 | fprintf ('permanently, using the MATLAB pathtool command.\n') ; 18 | fprintf ('%s\n\n', pwd) ; 19 | amd_demo 20 | -------------------------------------------------------------------------------- /3rdparty/LDL/AMD/MATLAB/amd_make.m: -------------------------------------------------------------------------------- 1 | function amd_make 2 | %AMD_MAKE to compile amd2 for use in MATLAB 3 | % 4 | % Example: 5 | % amd_make 6 | % 7 | % See also amd, amd2. 8 | 9 | % Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, and Iain S. Duff. 10 | 11 | details = 0 ; % 1 if details of each command are to be printed 12 | 13 | d = '' ; 14 | if (~isempty (strfind (computer, '64'))) 15 | d = '-largeArrayDims' ; 16 | end 17 | 18 | i = sprintf ('-I../Include -I../../SuiteSparse_config') ; 19 | cmd = sprintf ('mex -O %s -DDLONG -output amd2 %s amd_mex.c', d, i) ; 20 | files = {'amd_order', 'amd_dump', 'amd_postorder', 'amd_post_tree', ... 21 | 'amd_aat', 'amd_2', 'amd_1', 'amd_defaults', 'amd_control', ... 22 | 'amd_info', 'amd_valid', 'amd_global', 'amd_preprocess' } ; 23 | for i = 1 : length (files) 24 | cmd = sprintf ('%s ../Source/%s.c', cmd, files {i}) ; 25 | end 26 | if (details) 27 | fprintf ('%s\n', cmd) ; 28 | end 29 | eval (cmd) ; 30 | 31 | fprintf ('AMD successfully compiled.\n') ; 32 | -------------------------------------------------------------------------------- /3rdparty/LDL/AMD/Source/amd_defaults.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /* === AMD_defaults ======================================================== */ 3 | /* ========================================================================= */ 4 | 5 | /* ------------------------------------------------------------------------- */ 6 | /* AMD, Copyright (c) Timothy A. Davis, */ 7 | /* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ 8 | /* email: DrTimothyAldenDavis@gmail.com */ 9 | /* ------------------------------------------------------------------------- */ 10 | 11 | /* User-callable. Sets default control parameters for AMD. See amd.h 12 | * for details. 13 | */ 14 | 15 | #include "amd_internal.h" 16 | 17 | /* ========================================================================= */ 18 | /* === AMD defaults ======================================================== */ 19 | /* ========================================================================= */ 20 | 21 | GLOBAL void AMD_defaults 22 | ( 23 | double Control [ ] 24 | ) 25 | { 26 | Int i ; 27 | 28 | if (Control != (double *) NULL) 29 | { 30 | for (i = 0 ; i < AMD_CONTROL ; i++) 31 | { 32 | Control [i] = 0 ; 33 | } 34 | Control [AMD_DENSE] = AMD_DEFAULT_DENSE ; 35 | Control [AMD_AGGRESSIVE] = AMD_DEFAULT_AGGRESSIVE ; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Demo/ldllsimple.out: -------------------------------------------------------------------------------- 1 | Nonzeros in L, excluding diagonal: 13 2 | x [0] = 0.1 3 | x [1] = 0.2 4 | x [2] = 0.3 5 | x [3] = 0.4 6 | x [4] = 0.5 7 | x [5] = 0.6 8 | x [6] = 0.7 9 | x [7] = 0.8 10 | x [8] = 0.9 11 | x [9] = 1 12 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Demo/ldlsimple.out: -------------------------------------------------------------------------------- 1 | Nonzeros in L, excluding diagonal: 13 2 | x [0] = 0.1 3 | x [1] = 0.2 4 | x [2] = 0.3 5 | x [3] = 0.4 6 | x [4] = 0.5 7 | x [5] = 0.6 8 | x [6] = 0.7 9 | x [7] = 0.8 10 | x [8] = 0.9 11 | x [9] = 1 12 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Doc/Makefile: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Makefile for the LDL documentation 3 | #------------------------------------------------------------------------------- 4 | 5 | default: ldl_userguide.pdf 6 | 7 | include ../../SuiteSparse_config/SuiteSparse_config.mk 8 | 9 | #------------------------------------------------------------------------------- 10 | # clean-up: 11 | #------------------------------------------------------------------------------- 12 | 13 | distclean: purge 14 | 15 | purge: clean 16 | - $(RM) *.dvi *.aux *.log *.bak *.bbl *.blg *.ps 17 | 18 | clean: 19 | - $(RM) $(CLEAN) 20 | 21 | #------------------------------------------------------------------------------- 22 | # user guide: 23 | #------------------------------------------------------------------------------- 24 | 25 | ldl_userguide.pdf: ldl_userguide.tex ldl.bib 26 | latex ldl_userguide 27 | - bibtex ldl_userguide 28 | latex ldl_userguide 29 | latex ldl_userguide 30 | dvips ldl_userguide -o ldl_userguide.ps 31 | pdflatex ldl_userguide 32 | pdflatex ldl_userguide 33 | - $(RM) *.dvi *.aux *.log *.bak *.bbl *.blg *.ps 34 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Doc/ldl_userguide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/3rdparty/LDL/LDL/Doc/ldl_userguide.pdf -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Lib/Makefile: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Makefile for the LDL library 3 | #------------------------------------------------------------------------------- 4 | 5 | default: all 6 | 7 | include ../../SuiteSparse_config/SuiteSparse_config.mk 8 | 9 | I = -I../../SuiteSparse_config -I../Include 10 | 11 | C = $(CC) $(CF) $(I) 12 | 13 | all: libldl.a 14 | 15 | #------------------------------------------------------------------------------- 16 | # the ldl library: 17 | #------------------------------------------------------------------------------- 18 | 19 | libldl.a: ../Source/ldl.c ../Include/ldl.h 20 | $(C) -c ../Source/ldl.c -o ldl.o 21 | $(C) -DLDL_LONG -c ../Source/ldl.c -o ldll.o 22 | $(ARCHIVE) libldl.a ldl.o ldll.o 23 | - $(RANLIB) libldl.a 24 | 25 | distclean: purge 26 | 27 | purge: clean 28 | - $(RM) libldl.a 29 | 30 | clean: 31 | - $(RM) $(CLEAN) 32 | 33 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/MATLAB/Contents1.m: -------------------------------------------------------------------------------- 1 | % LDL package: simple sparse LDL factorization 2 | % 3 | % Primary routines: 4 | % 5 | % ldlsparse - LDL' factorization of a real, sparse, symmetric matrix 6 | % ldlsymbol - symbolic Cholesky factorization 7 | % 8 | % Helper routines: 9 | % 10 | % ldldemo - demo program for LDL 11 | % ldlrow - an m-file description of the algorithm used by LDL 12 | % ldltest - test program for LDL 13 | % ldlmain2 - compiles and runs a longer test program for LDL 14 | % ldl_install - compile and install the LDL package for use in MATLAB. 15 | % ldl_make - compile LDL 16 | % 17 | % Example: 18 | % 19 | % [L, D, Parent, fl] = ldlsparse (A) 20 | 21 | % Copyright 2006-2007 by Timothy A. Davis, http://www.suitesparse.com 22 | 23 | % LDL License: GNU Lesser General Public License as published by the 24 | % Free Software Foundation; either version 2.1 of the License, or 25 | % (at your option) any later version. 26 | % 27 | % Acknowledgements: 28 | % 29 | % This work was supported by the National Science Foundation, under 30 | % grant CCR-0203270. 31 | % 32 | % Portions of this work were done while on sabbatical at Stanford University 33 | % and Lawrence Berkeley National Laboratory (with funding from the SciDAC 34 | % program). I would like to thank Gene Golub, Esmond Ng, and Horst Simon 35 | % for making this sabbatical possible. 36 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/MATLAB/ldl_install.m: -------------------------------------------------------------------------------- 1 | function ldl_install 2 | %LDL_INSTALL compile and install the LDL package for use in MATLAB. 3 | % Your current working directory must be LDL for this function to work. 4 | % 5 | % Example: 6 | % ldl_install 7 | % 8 | % See also ldlsparse, ldlsymbol 9 | 10 | % Copyright 2006-2007 by Timothy A. Davis, http://www.suitesparse.com 11 | 12 | ldl_make 13 | addpath (pwd) ; 14 | fprintf ('LDL has been compiled and installed. The path:\n') ; 15 | disp (pwd) ; 16 | fprintf ('has been added to your path. Use pathtool to add it permanently.\n'); 17 | ldldemo 18 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/MATLAB/ldl_make.m: -------------------------------------------------------------------------------- 1 | function ldl_make 2 | %LDL_MAKE compile LDL 3 | % 4 | % Example: 5 | % ldl_make % compiles ldlsparse and ldlsymbol 6 | % 7 | % See also ldlsparse, ldlsymbol 8 | 9 | % Copyright 2006-2007 by Timothy A. Davis, http://www.suitesparse.com 10 | 11 | d = '' ; 12 | if (~isempty (strfind (computer, '64'))) 13 | d = '-largeArrayDims' ; 14 | end 15 | eval (sprintf ('mex -O %s -DLDL_LONG -I../../SuiteSparse_config -I../Include -output ldlsparse ../Source/ldl.c ldlmex.c', d)) ; 16 | eval (sprintf ('mex -O %s -DLDL_LONG -I../../SuiteSparse_config -I../Include -output ldlsymbol ../Source/ldl.c ldlsymbolmex.c', d)) ; 17 | 18 | eval (sprintf ('mex -O %s -DLDL_LONG -I../../SuiteSparse_config -I../Include -output ldlsparse_short ../Source/ldl.c ldlmex_short.c', d)) ; 19 | eval (sprintf ('mex -O %s -DLDL_LONG -I../../SuiteSparse_config -I../Include -output ldlsymbol_extra ../Source/ldl.c ldlsymbol_extra.c', d)) ; 20 | eval (sprintf ('mex -O %s -DLDL_LONG -I../../SuiteSparse_config -I../Include -output ldlnumeric ../Source/ldl.c ldlnumericmex.c', d)) ; 21 | fprintf ('LDL successfully compiled.\n') ; 22 | 23 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/MATLAB/ldlmain2.m: -------------------------------------------------------------------------------- 1 | function ldlmain2 2 | %LDLMAIN2 compiles and runs a longer test program for LDL 3 | % 4 | % Example: 5 | % ldlmain2 6 | % 7 | % See also ldlsparse. 8 | 9 | % Copyright 2006-2007 by Timothy A. Davis, http://www.suitesparse.com 10 | 11 | help ldlmain2 12 | 13 | detail = 0 ; 14 | 15 | ldl_make 16 | 17 | d = '' ; 18 | if (~isempty (strfind (computer, '64'))) 19 | d = '-largeArrayDims' ; 20 | end 21 | 22 | mx = sprintf (... 23 | 'mex -O %s -DLDL_LONG -DDLONG -I../../SuiteSparse_config -I../Include', d) ; 24 | 25 | % compile ldlmain without AMD 26 | cmd = sprintf ('%s ../Demo/ldlmain.c ../Source/ldl.c', mx) ; 27 | if (detail) 28 | fprintf ('%s\n', cmd) ; 29 | end 30 | eval (cmd) ; 31 | ldlmain 32 | 33 | % compile ldlamd (ldlmain with AMD) 34 | cmd = sprintf ('%s -I../../AMD/Include', mx) ; 35 | 36 | files = {'amd_order', 'amd_dump', 'amd_postorder', 'amd_post_tree', ... 37 | 'amd_aat', 'amd_2', 'amd_1', 'amd_defaults', 'amd_control', ... 38 | 'amd_info', 'amd_valid', 'amd_global', 'amd_preprocess' } ; 39 | for i = 1 : length (files) 40 | cmd = sprintf ('%s ../../AMD/Source/%s.c', cmd, files {i}) ; 41 | end 42 | 43 | cmd = [cmd ' -DUSE_AMD -output ldlamd ../Demo/ldlmain.c ../Source/ldl.c'] ; 44 | if (detail) 45 | fprintf ('%s\n', cmd) ; 46 | end 47 | eval (cmd) ; 48 | ldlamd 49 | 50 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/MATLAB/ldlsymbol.m: -------------------------------------------------------------------------------- 1 | function [Lnz, Parent, fl] = ldlsymbol (A, P) %#ok 2 | %LDLSYMBOL symbolic Cholesky factorization 3 | % 4 | % Example: 5 | % [Lnz, Parent, fl] = ldlsymbol (A) 6 | % [Lnz, Parent, fl] = ldlsymbol (A, P) 7 | % 8 | % P is a permutation of 1:n, an output of AMD, SYMAMD, or SYMRCM, for example. 9 | % Only the diagonal and upper triangular part of A or A(P,P) is accessed; the 10 | % lower triangular part is ignored. If P is not provided, then P = 1:n is 11 | % assumed. 12 | % 13 | % The elimination tree is returned in the Parent array. The number of nonzeros 14 | % in each column of L is returned in Lnz. fl is the floating point operation 15 | % count for a subsequent LDL' factorization. This mexFunction replicates the 16 | % following MATLAB computations, using ldl_symbolic: 17 | % 18 | % Lnz = symbfact (A) - 1 ; 19 | % Parent = etree (A) ; 20 | % fl = sum (Lnz .* (Lnz + 2)) ; 21 | % 22 | % or, if P is provided, 23 | % 24 | % Lnz = symbfact (A (P,P)) - 1 ; 25 | % Parent = etree (A (P,P)) ; 26 | % fl = sum (Lnz .* (Lnz + 2)) ; 27 | % 28 | % Note that this routine is not required by LDL, since LDL does its own 29 | % symbolic factorization. 30 | % 31 | % See also ldlsparse, symbfact, etree 32 | 33 | % Copyright 2006-2007 by Timothy A. Davis, http://www.suitesparse.com 34 | 35 | error ('ldlsymbol mexFunction not found') ; 36 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A01: -------------------------------------------------------------------------------- 1 | name: Dense/0 n: 0 entries: 0 2 | 0 0 3 | 0 4 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A02: -------------------------------------------------------------------------------- 1 | name: Dense/0 n: 0 entries: 0 (jumbled version) 2 | 0 1 3 | 0 4 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A03: -------------------------------------------------------------------------------- 1 | name: Dense/1 n: 1 entries: 1 2 | 1 0 3 | 0 4 | 1 5 | 0 6 | 1.90275 7 | 0 8 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A04: -------------------------------------------------------------------------------- 1 | name: Dense/1 n: 1 entries: 2 (jumbled version) 2 | 1 1 3 | 0 4 | 2 5 | 0 6 | 0 7 | 1.90275 8 | 0.606843 9 | 0 10 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A05: -------------------------------------------------------------------------------- 1 | name: Dense/2 n: 2 entries: 4 2 | 2 0 3 | 0 4 | 2 5 | 4 6 | 0 7 | 1 8 | 0 9 | 1 10 | 1.78915 11 | 0.389047 12 | 0.389047 13 | 1.67505 14 | 0 15 | 1 16 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A06: -------------------------------------------------------------------------------- 1 | name: Dense/2 n: 2 entries: 5 (jumbled version) 2 | 2 1 3 | 0 4 | 3 5 | 5 6 | 0 7 | 1 8 | 0 9 | 1 10 | 0 11 | 1.78915 12 | 0.389047 13 | 0.738207 14 | 1.67505 15 | 0.389047 16 | 0 17 | 1 18 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A07: -------------------------------------------------------------------------------- 1 | name: Dense/3 n: 3 entries: 9 2 | 3 0 3 | 0 4 | 3 5 | 6 6 | 9 7 | 0 8 | 1 9 | 2 10 | 0 11 | 1 12 | 2 13 | 0 14 | 1 15 | 2 16 | 1.92648 17 | 0.776267 18 | 0.405764 19 | 0.776267 20 | 1.68063 21 | 0.250703 22 | 0.405764 23 | 0.250703 24 | 1.44517 25 | 0 26 | 1 27 | 2 28 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A08: -------------------------------------------------------------------------------- 1 | name: Dense/3 n: 3 entries: 11 (jumbled version) 2 | 3 1 3 | 0 4 | 4 5 | 7 6 | 11 7 | 2 8 | 0 9 | 1 10 | 2 11 | 1 12 | 0 13 | 2 14 | 0 15 | 2 16 | 0 17 | 1 18 | 0.262576 19 | 1.92648 20 | 0.776267 21 | 0.405764 22 | 1.68063 23 | 0.776267 24 | 0.250703 25 | 0.262576 26 | 1.44517 27 | 0.405764 28 | 0.250703 29 | 0 30 | 1 31 | 2 32 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A15: -------------------------------------------------------------------------------- 1 | name: HB/bcsstm01 n: 48 entries: 24 2 | 48 0 3 | 0 4 | 1 5 | 2 6 | 3 7 | 3 8 | 3 9 | 3 10 | 4 11 | 5 12 | 6 13 | 6 14 | 6 15 | 6 16 | 7 17 | 8 18 | 9 19 | 9 20 | 9 21 | 9 22 | 10 23 | 11 24 | 12 25 | 12 26 | 12 27 | 12 28 | 13 29 | 14 30 | 15 31 | 15 32 | 15 33 | 15 34 | 16 35 | 17 36 | 18 37 | 18 38 | 18 39 | 18 40 | 19 41 | 20 42 | 21 43 | 21 44 | 21 45 | 21 46 | 22 47 | 23 48 | 24 49 | 24 50 | 24 51 | 24 52 | 0 53 | 1 54 | 2 55 | 6 56 | 7 57 | 8 58 | 12 59 | 13 60 | 14 61 | 18 62 | 19 63 | 20 64 | 24 65 | 25 66 | 26 67 | 30 68 | 31 69 | 32 70 | 36 71 | 37 72 | 38 73 | 42 74 | 43 75 | 44 76 | 100 77 | 100 78 | 100 79 | 100 80 | 100 81 | 100 82 | 100 83 | 100 84 | 100 85 | 100 86 | 100 87 | 100 88 | 200 89 | 200 90 | 200 91 | 200 92 | 200 93 | 200 94 | 200 95 | 200 96 | 200 97 | 200 98 | 200 99 | 200 100 | 0 101 | 1 102 | 2 103 | 3 104 | 4 105 | 5 106 | 6 107 | 7 108 | 8 109 | 9 110 | 10 111 | 11 112 | 12 113 | 13 114 | 14 115 | 15 116 | 16 117 | 17 118 | 18 119 | 19 120 | 20 121 | 21 122 | 22 123 | 23 124 | 24 125 | 25 126 | 26 127 | 27 128 | 28 129 | 29 130 | 30 131 | 31 132 | 32 133 | 33 134 | 34 135 | 35 136 | 36 137 | 37 138 | 38 139 | 39 140 | 40 141 | 41 142 | 42 143 | 43 144 | 44 145 | 45 146 | 46 147 | 47 148 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A16: -------------------------------------------------------------------------------- 1 | name: HB/bcsstm01 n: 48 entries: 26 (jumbled version) 2 | 48 1 3 | 0 4 | 1 5 | 2 6 | 3 7 | 3 8 | 3 9 | 3 10 | 4 11 | 5 12 | 7 13 | 7 14 | 7 15 | 7 16 | 8 17 | 9 18 | 10 19 | 10 20 | 10 21 | 10 22 | 11 23 | 12 24 | 13 25 | 13 26 | 13 27 | 13 28 | 14 29 | 15 30 | 16 31 | 16 32 | 16 33 | 16 34 | 17 35 | 18 36 | 19 37 | 19 38 | 19 39 | 19 40 | 20 41 | 21 42 | 22 43 | 22 44 | 22 45 | 22 46 | 24 47 | 25 48 | 26 49 | 26 50 | 26 51 | 26 52 | 0 53 | 1 54 | 2 55 | 6 56 | 7 57 | 8 58 | 8 59 | 12 60 | 13 61 | 14 62 | 18 63 | 19 64 | 20 65 | 24 66 | 25 67 | 26 68 | 30 69 | 31 70 | 32 71 | 36 72 | 37 73 | 38 74 | 42 75 | 42 76 | 43 77 | 44 78 | 100 79 | 100 80 | 100 81 | 100 82 | 100 83 | 100 84 | 0.700744 85 | 100 86 | 100 87 | 100 88 | 100 89 | 100 90 | 100 91 | 200 92 | 200 93 | 200 94 | 200 95 | 200 96 | 200 97 | 200 98 | 200 99 | 200 100 | 200 101 | 0.803129 102 | 200 103 | 200 104 | 0 105 | 1 106 | 2 107 | 3 108 | 4 109 | 5 110 | 6 111 | 7 112 | 8 113 | 9 114 | 10 115 | 11 116 | 12 117 | 13 118 | 14 119 | 15 120 | 16 121 | 17 122 | 18 123 | 19 124 | 20 125 | 21 126 | 22 127 | 23 128 | 24 129 | 25 130 | 26 131 | 27 132 | 28 133 | 29 134 | 30 135 | 31 136 | 32 137 | 33 138 | 34 139 | 35 140 | 36 141 | 37 142 | 38 143 | 39 144 | 40 145 | 41 146 | 42 147 | 43 148 | 44 149 | 45 150 | 46 151 | 47 152 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A25: -------------------------------------------------------------------------------- 1 | name: Dense/0 n: 0 entries: 0 (invalid matrix, Ap [0] = 1) 2 | 0 0 3 | 1 4 | 0 5 | 0 6 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A26: -------------------------------------------------------------------------------- 1 | name: Dense/2 n: 2 entries: 4 (invalid perm, P[1]=99) 2 | 2 0 3 | 0 4 | 2 5 | 4 6 | 0 7 | 1 8 | 0 9 | 1 10 | 1.78915 11 | 0.389047 12 | 0.389047 13 | 1.67505 14 | 0 15 | 99 16 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A27: -------------------------------------------------------------------------------- 1 | name: Dense/3 n: 3 entries: 9 (invalid perm) 2 | 3 0 3 | 0 4 | 3 5 | 6 6 | 9 7 | 0 8 | 1 9 | 2 10 | 0 11 | 1 12 | 2 13 | 0 14 | 1 15 | 2 16 | 1.92648 17 | 0.776267 18 | 0.405764 19 | 0.776267 20 | 1.68063 21 | 0.250703 22 | 0.405764 23 | 0.250703 24 | 1.44517 25 | 0 26 | 1 27 | 1 28 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A28: -------------------------------------------------------------------------------- 1 | name: Dense/3 n: 3 entries: 9 (invalid Ap) 2 | 3 0 3 | 0 4 | 3 5 | 2 6 | 9 7 | 0 8 | 1 9 | 2 10 | 0 11 | 1 12 | 2 13 | 0 14 | 1 15 | 2 16 | 1.92648 17 | 0.776267 18 | 0.405764 19 | 0.776267 20 | 1.68063 21 | 0.250703 22 | 0.405764 23 | 0.250703 24 | 1.44517 25 | 0 26 | 1 27 | 2 28 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A29: -------------------------------------------------------------------------------- 1 | name: Dense/3 n: 3 entries: 9 (invalid Ai) 2 | 3 0 3 | 0 4 | 3 5 | 6 6 | 9 7 | 0 8 | 1 9 | 3 10 | 0 11 | 1 12 | 2 13 | 0 14 | 1 15 | 2 16 | 1.92648 17 | 0.776267 18 | 0.405764 19 | 0.776267 20 | 1.68063 21 | 0.250703 22 | 0.405764 23 | 0.250703 24 | 1.44517 25 | 0 26 | 1 27 | 2 28 | -------------------------------------------------------------------------------- /3rdparty/LDL/LDL/Matrix/A30: -------------------------------------------------------------------------------- 1 | name: Dense/3 n: 3 entries: 9 (invalid Ai) 2 | 3 0 3 | 0 4 | 3 5 | 6 6 | 9 7 | 0 8 | -1 9 | 2 10 | 0 11 | 1 12 | 2 13 | 0 14 | 1 15 | 2 16 | 1.92648 17 | 0.776267 18 | 0.405764 19 | 0.776267 20 | 1.68063 21 | 0.250703 22 | 0.405764 23 | 0.250703 24 | 1.44517 25 | 0 26 | 1 27 | 2 28 | -------------------------------------------------------------------------------- /3rdparty/LDL/SuiteSparse_config/Makefile: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # SuiteSparse_config Makefile 3 | #------------------------------------------------------------------------------- 4 | 5 | VERSION = 4.0.2 6 | 7 | default: ccode 8 | 9 | include SuiteSparse_config.mk 10 | 11 | ccode: libsuitesparseconfig.a 12 | 13 | all: libsuitesparseconfig.a 14 | 15 | library: libsuitesparseconfig.a 16 | 17 | libsuitesparseconfig.a: SuiteSparse_config.c SuiteSparse_config.h 18 | $(CC) $(CF) -c SuiteSparse_config.c 19 | $(ARCHIVE) libsuitesparseconfig.a SuiteSparse_config.o 20 | $(RANLIB) libsuitesparseconfig.a 21 | - $(RM) SuiteSparse_config.o 22 | 23 | distclean: purge 24 | 25 | purge: clean 26 | - $(RM) *.o *.a 27 | 28 | clean: 29 | - $(RM) -r $(CLEAN) 30 | 31 | # install SuiteSparse_config 32 | install: 33 | $(CP) libsuitesparseconfig.a $(INSTALL_LIB)/libsuitesparseconfig.$(VERSION).a 34 | ( cd $(INSTALL_LIB) ; ln -sf libsuitesparseconfig.$(VERSION).a libsuitesparseconfig.a ) 35 | $(CP) SuiteSparse_config.h $(INSTALL_INCLUDE) 36 | chmod 644 $(INSTALL_LIB)/libsuitesparseconfig*.a 37 | chmod 644 $(INSTALL_INCLUDE)/SuiteSparse_config.h 38 | 39 | # uninstall SuiteSparse_config 40 | uninstall: 41 | $(RM) $(INSTALL_LIB)/libsuitesparseconfig*.a 42 | $(RM) $(INSTALL_INCLUDE)/SuiteSparse_config.h 43 | 44 | -------------------------------------------------------------------------------- /3rdparty/LDL/SuiteSparse_config/xerbla/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for null-output xerbla 2 | 3 | default: ccode 4 | 5 | include ../SuiteSparse_config.mk 6 | 7 | ccode: libcerbla.a 8 | 9 | fortran: libxerbla.a 10 | 11 | all: libxerbla.a libcerbla.a 12 | 13 | # Fortran version: 14 | libxerbla.a: xerbla.f 15 | $(F77) $(F77FLAGS) -c xerbla.f 16 | $(ARCHIVE) libxerbla.a xerbla.o 17 | - $(RANLIB) libxerbla.a 18 | - $(RM) xerbla.o 19 | 20 | # C version: 21 | libcerbla.a: xerbla.c xerbla.h 22 | $(CC) $(CF) -c xerbla.c 23 | $(ARCHIVE) libcerbla.a xerbla.o 24 | - $(RANLIB) libcerbla.a 25 | - $(RM) xerbla.o 26 | 27 | distclean: purge 28 | 29 | purge: clean 30 | - $(RM) *.o *.a 31 | 32 | clean: 33 | - $(RM) $(CLEAN) 34 | -------------------------------------------------------------------------------- /3rdparty/LDL/SuiteSparse_config/xerbla/xerbla.c: -------------------------------------------------------------------------------- 1 | 2 | void xerbla_ (char *srname, int *info) 3 | { 4 | /* do nothing */ ; 5 | } 6 | 7 | 8 | void xerbla (char *srname, int *info) 9 | { 10 | /* do nothing */ ; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /3rdparty/LDL/SuiteSparse_config/xerbla/xerbla.h: -------------------------------------------------------------------------------- 1 | void xerbla_ (char *srname, int *info) ; 2 | void xerbla (char *srname, int *info) ; 3 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/COPYING: -------------------------------------------------------------------------------- 1 | Recursive Zonal Equal Area (EQ) Sphere Partitioning Toolbox. 2 | Release 1.10 2005-06-26 3 | COPYING 4 | 5 | For references, see AUTHORS. 6 | For revision history, see CHANGELOG. 7 | 8 | Copyright (c) 2004, 2005, University of New South Wales 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included 19 | in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 25 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_illustrations/Contents.m: -------------------------------------------------------------------------------- 1 | %Recursive Zonal Equal Area Sphere Partitioning: Illustrations 2 | % 3 | % Recursive Zonal Equal Area (EQ) Sphere Partitioning Toolbox. 4 | % Release 1.10 2005-06-01 5 | % 6 | %Functions by category 7 | %===================== 8 | % 9 | % Illustration of EQ Partitions of S^2 or S^3 10 | % show_s2_partition 3D illustration of an EQ partition of S^2 11 | % project_s2_partition Use projection to illustrate an EQ partition of S^2 12 | % project_s3_partition Use projection to illustrate an EQ partition of S^3 13 | % 14 | % Illustration of point sets on S^2 or S^3 15 | % show_r3_point_set 3D illustration of a point set 16 | % project_point_set Use projection to illustrate a point set of 17 | % S^2 or S^3 18 | % 19 | % Illustration options 20 | % illustration_options Options for illustrations of EQ partitions 21 | 22 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 23 | % $Revision 1.10 $ $Date 2005-06-01 $ 24 | % Documentation files renamed 25 | % $Revision 1.00 $ $Date 2005-02-13 $ 26 | % 27 | % For licensing, see COPYING. 28 | % For references, see AUTHORS. 29 | % For revision history, see CHANGELOG. 30 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_illustrations/private/show_s2_sphere.m: -------------------------------------------------------------------------------- 1 | function show_s2_sphere 2 | %SHOW_S2_SPHERE Illustrate the unit sphere S^2 3 | % 4 | %Syntax 5 | % show_s2_sphere 6 | 7 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 8 | % $Revision 1.10 $ $Date 2005-06-01 $ 9 | % Documentation files renamed 10 | % $Revision 1.00 $ $Date 2005-02-12 $ 11 | % 12 | % For licensing, see COPYING. 13 | % For references, see AUTHORS. 14 | % For revision history, see CHANGELOG. 15 | 16 | [X,Y,Z] = sphere(90); 17 | surf(X,Y,Z,zeros(size(Z)),... 18 | 'FaceColor','interp','FaceLighting','phong',... 19 | 'EdgeColor','none','SpecularStrength',0) 20 | axis equal 21 | grid off 22 | axis off 23 | % 24 | %end function 25 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_illustrations/private/surf_jet.m: -------------------------------------------------------------------------------- 1 | function surf_jet 2 | %SURF_JET Set up extreme color values using COLORMAP JET 3 | % 4 | %Syntax 5 | % surf_jet 6 | 7 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 8 | % $Revision 1.10 $ $Date 2005-06-01 $ 9 | % Documentation files renamed 10 | % $Revision 1.00 $ $Date 2005-02-12 $ 11 | % 12 | % For licensing, see COPYING. 13 | % For references, see AUTHORS. 14 | % For revision history, see CHANGELOG. 15 | 16 | [X,Y,Z] = sphere(2); 17 | surf(X*0,Y*0,Z*0,-ones(size(Z)),'FaceAlpha',0) 18 | hold on 19 | surf(X*0,Y*0,Z*0,ones(size(Z)),'FaceAlpha',0) 20 | hold on 21 | colormap jet 22 | axis equal 23 | grid off 24 | axis off 25 | if ~haslight(gca) 26 | camlight right 27 | end 28 | % 29 | %end function -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_illustrations/private/x2eqarea.m: -------------------------------------------------------------------------------- 1 | function result = x2eqarea(x) 2 | %X2EQUAREA Equal area projection of 3D Euclidean points 3 | % 4 | % result = x2eqarea(x); 5 | 6 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 7 | % $Revision 1.10 $ $Date 2005-06-01 $ 8 | % Documentation files renamed 9 | % $Revision 1.00 $ $Date 2005-02-12 $ 10 | % 11 | % For licensing, see COPYING. 12 | % For references, see AUTHORS. 13 | % For revision history, see CHANGELOG. 14 | 15 | dim = size(x,1)-1; 16 | theta = acos(-x(dim+1,:)); 17 | r = (area_of_cap(dim,theta)/volume_of_ball(dim)).^(1/dim); 18 | mask = (sin(theta) == 0); 19 | scale = ones(dim,1)*(r(~mask)./sin(theta(~mask))); 20 | eqarea = zeros(dim,size(x,2)); 21 | eqarea(:,~mask) = x(1:dim,~mask).*scale; 22 | mask1 = (x(dim+1,:) == 1); 23 | result = eqarea(:,~mask1); 24 | % end function 25 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_illustrations/private/x2stereo.m: -------------------------------------------------------------------------------- 1 | function result = x2stereo(x) 2 | %X2STEREO Stereographic projection of Euclidean points 3 | % 4 | % result = x2stereo(x); 5 | 6 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 7 | % $Revision 1.10 $ $Date 2005-06-01 $ 8 | % Documentation files renamed 9 | % $Revision 1.00 $ $Date 2005-02-12 $ 10 | % 11 | % For licensing, see COPYING. 12 | % For references, see AUTHORS. 13 | % For revision history, see CHANGELOG. 14 | 15 | dim = size(x,1)-1; 16 | mask = (x(dim+1,:) == 1); 17 | scale = ones(dim,1)*(1-x(dim+1,~mask)); 18 | result = x(1:dim,~mask)./scale; 19 | % end function 20 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_partitions/Contents.m: -------------------------------------------------------------------------------- 1 | %Recursive Zonal Equal Area Sphere Partitioning: EQ partitions 2 | % 3 | % Recursive Zonal Equal Area (EQ) Sphere Partitioning Toolbox. 4 | % Release 1.10 2005-06-01 5 | % 6 | %Functions by category 7 | %===================== 8 | % 9 | % Partitions 10 | % eq_caps Partition a sphere into to nested spherical caps 11 | % eq_regions Recursive zonal equal area (EQ) partition of sphere 12 | % 13 | % Point sets 14 | % eq_point_set Center points of regions of EQ partition, 15 | % in Cartesian coordinates 16 | % eq_point_set_polar Center points of regions of an EQ partition, 17 | % in spherical polar coordinates 18 | % 19 | % Partition options 20 | % partition_options Options for EQ partition 21 | % 22 | % Illustrations 23 | % illustrate_eq_algorithm Illustrate the EQ partition algorithm 24 | 25 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 26 | % $Revision 1.10 $ $Date 2005-06-01 $ 27 | % Documentation files renamed 28 | % $Revision 1.00 $ $Date 2005-02-13 $ 29 | % 30 | % For licensing, see COPYING. 31 | % For references, see AUTHORS. 32 | % For revision history, see CHANGELOG. 33 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_partitions/private/bot_cap_region.m: -------------------------------------------------------------------------------- 1 | function region = bot_cap_region(dim,a_cap) 2 | %BOT_CAP_REGION South polar (bottom) cap region of EQ partition 3 | % 4 | % An array of two points representing the bottom cap of radius a_cap as a region. 5 | % 6 | % region = bot_cap_region(dim,a_cap); 7 | 8 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 9 | % $Revision 1.10 $ $Date 2005-06-01 $ 10 | % Documentation files renamed 11 | % $Revision 1.00 $ $Date 2005-02-12 $ 12 | % 13 | % For licensing, see COPYING. 14 | % For references, see AUTHORS. 15 | % For revision history, see CHANGELOG. 16 | 17 | if dim == 1 18 | region = [2*pi-a_cap,2*pi]; 19 | else 20 | sphere_region_1 = sphere_region(dim-1); 21 | region = [[sphere_region_1(:,1); pi-a_cap],[sphere_region_1(:,2); pi]]; 22 | end 23 | % 24 | % end function 25 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_partitions/private/cap_colats.m: -------------------------------------------------------------------------------- 1 | function c_caps = cap_colats(dim,N,c_polar,n_regions) 2 | %CAP_COLATS Colatitudes of spherical caps enclosing cumulative sum of regions 3 | % 4 | % Given dim, N, c_polar and n_regions, determine c_caps, 5 | % an increasing list of colatitudes of spherical caps which enclose the same area 6 | % as that given by the cumulative sum of regions. 7 | % The number of elements is n_collars+2. 8 | % c_caps[1] is c_polar. 9 | % c_caps[n_collars+1] is Pi-c_polar. 10 | % c_caps[n_collars+2] is Pi. 11 | % 12 | % c_caps = cap_colats(dim,N,c_polar,n_regions); 13 | 14 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 15 | % $Revision 1.10 $ $Date 2005-06-01 $ 16 | % Documentation files renamed 17 | % $Revision 1.00 $ $Date 2005-02-12 $ 18 | % 19 | % For licensing, see COPYING. 20 | % For references, see AUTHORS. 21 | % For revision history, see CHANGELOG. 22 | 23 | c_caps = zeros(size(n_regions)); 24 | c_caps(1) = c_polar; 25 | ideal_region_area = area_of_ideal_region(dim,N); 26 | n_collars = size(n_regions,2)-2; 27 | subtotal_n_regions = 1; 28 | for collar_n = 1:n_collars 29 | subtotal_n_regions = subtotal_n_regions+n_regions(1+collar_n); 30 | c_caps(collar_n+1) =sradius_of_cap(dim,subtotal_n_regions*ideal_region_area); 31 | end 32 | c_caps(1+n_collars+1) = pi; 33 | 34 | % end function 35 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_partitions/private/centres_of_regions.m: -------------------------------------------------------------------------------- 1 | function points = centres_of_regions(regions) 2 | %CENTRES_OF_REGIONS Centre points of given regions 3 | % 4 | % points = centres_of_regions(regions); 5 | 6 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 7 | % $Revision 1.10 $ $Date 2005-06-01 $ 8 | % Documentation files renamed 9 | % $Revision 1.00 $ $Date 2005-02-12 $ 10 | % 11 | % For licensing, see COPYING. 12 | % For references, see AUTHORS. 13 | % For revision history, see CHANGELOG. 14 | 15 | tol = eps*2^5; 16 | dim = size(regions,1); 17 | N = size(regions,3); 18 | points = zeros(dim,N); 19 | top = regions(:,1,:); 20 | bot = regions(:,2,:); 21 | zero_bot = abs(bot(1,:)) < tol; 22 | bot(1,zero_bot) = 2*pi; 23 | equal_bot = abs(bot(1,:) - top(1,:)) < tol; 24 | bot(1,equal_bot) = top(1,equal_bot) + 2*pi; 25 | twopi_bot = abs(bot(1,:) - top(1,:) - 2*pi) < tol; 26 | points(1,twopi_bot) = 0; 27 | points(1,~twopi_bot) = mod((bot(1,~twopi_bot) + top(1,~twopi_bot))/2, 2*pi); 28 | for k = 2:dim 29 | pi_bot = abs(bot(k,:) - pi) < tol; 30 | points(k,pi_bot) = pi; 31 | zero_top = abs(top(k,:)) < tol; 32 | points(k,zero_top) = 0; 33 | all_else = ~(zero_top | pi_bot); 34 | points(k,all_else) = mod((top(k,all_else) + bot(k,all_else))/2, pi); 35 | end 36 | % end function 37 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_partitions/private/num_collars.m: -------------------------------------------------------------------------------- 1 | function n_collars = num_collars(N,c_polar,a_ideal) 2 | %NUM_COLLARS The number of collars between the polar caps 3 | % 4 | % Given N, an ideal angle, and c_polar, 5 | % determine n_collars, the number of collars between the polar caps. 6 | % 7 | % n_collars = num_collars(N,c_polar,a_ideal); 8 | 9 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 10 | % $Revision 1.10 $ $Date 2005-06-01 $ 11 | % Documentation files renamed 12 | % $Revision 1.00 $ $Date 2005-02-12 $ 13 | % 14 | % For licensing, see COPYING. 15 | % For references, see AUTHORS. 16 | % For revision history, see CHANGELOG. 17 | 18 | n_collars = zeros(size(N)); 19 | enough = (N > 2) & (a_ideal > 0); 20 | n_collars(enough) = max(1,round((pi-2*c_polar(enough))./a_ideal(enough))); 21 | % 22 | % end function 23 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_partitions/private/polar_colat.m: -------------------------------------------------------------------------------- 1 | function c_polar = polar_colat(dim, N) 2 | %POLAR_COLAT The colatitude of the North polar (top) spherical cap 3 | % 4 | % Given dim and N, determine the colatitude of the North polar spherical cap. 5 | % 6 | % c_polar = polar_colat(dim, N); 7 | 8 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 9 | % $Revision 1.10 $ $Date 2005-06-01 $ 10 | % Documentation files renamed 11 | % $Revision 1.00 $ $Date 2005-02-12 $ 12 | % 13 | % For licensing, see COPYING. 14 | % For references, see AUTHORS. 15 | % For revision history, see CHANGELOG. 16 | 17 | enough = N > 2; 18 | c_polar(N == 1) = pi; 19 | c_polar(N == 2) = pi/2; 20 | c_polar(enough) = sradius_of_cap(dim,area_of_ideal_region(dim,N(enough))); 21 | % 22 | % end function 23 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_partitions/private/round_to_naturals.m: -------------------------------------------------------------------------------- 1 | function n_regions = round_to_naturals(N,r_regions) 2 | %ROUND_TO_NATURALS Round off a given list of numbers of regions 3 | % 4 | % Given N and r_regions, determine n_regions, 5 | % a list of the natural number of regions in each collar and the polar caps. 6 | % This list is as close as possible to r_regions, using rounding. 7 | % The number of elements is n_collars+2. 8 | % n_regions[1] is 1. 9 | % n_regions[n_collars+2] is 1. 10 | % The sum of n_regions is N. 11 | % 12 | % n_regions = round_to_naturals(N,r_regions); 13 | 14 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 15 | % $Revision 1.10 $ $Date 2005-06-01 $ 16 | % Documentation files renamed 17 | % $Revision 1.00 $ $Date 2005-02-12 $ 18 | % 19 | % For licensing, see COPYING. 20 | % For references, see AUTHORS. 21 | % For revision history, see CHANGELOG. 22 | 23 | n_regions = r_regions; 24 | discrepancy = 0; 25 | for zone_n = 1:size(r_regions,2) 26 | n_regions(zone_n) = round(r_regions(zone_n)+discrepancy); 27 | discrepancy = discrepancy+r_regions(zone_n)-n_regions(zone_n); 28 | end 29 | % 30 | % end function 31 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_partitions/private/sphere_region.m: -------------------------------------------------------------------------------- 1 | function region = sphere_region(dim) 2 | %SPHERE_REGION The sphere represented as a single region of an EQ partition 3 | % 4 | % An array of two points representing S^dim as a region. 5 | % 6 | % region = sphere_region(dim); 7 | 8 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 9 | % $Revision 1.10 $ $Date 2005-06-01 $ 10 | % Documentation files renamed 11 | % $Revision 1.00 $ $Date 2005-02-12 $ 12 | % 13 | % For licensing, see COPYING. 14 | % For references, see AUTHORS. 15 | % For revision history, see CHANGELOG. 16 | 17 | if dim == 1 18 | region = [0,2*pi]; 19 | else 20 | sphere_region_1 = sphere_region(dim-1); 21 | region = [[sphere_region_1(:,1); 0],[sphere_region_1(:,2); pi]] ; 22 | end 23 | % 24 | % end function 25 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_partitions/private/top_cap_region.m: -------------------------------------------------------------------------------- 1 | function region = top_cap_region(dim,a_cap) 2 | %TOP_CAP_REGION North polar (top) cap region of EQ partition 3 | % 4 | % An array of two points representing the top cap of radius a_cap as a region. 5 | % 6 | % region = top_cap_region(dim,a_cap); 7 | 8 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 9 | % $Revision 1.10 $ $Date 2005-06-01 $ 10 | % Documentation files renamed 11 | % $Revision 1.00 $ $Date 2005-02-12 $ 12 | % 13 | % For licensing, see COPYING. 14 | % For references, see AUTHORS. 15 | % For revision history, see CHANGELOG. 16 | 17 | if dim == 1 18 | region = [0,a_cap]; 19 | else 20 | sphere_region_1 = sphere_region(dim-1); 21 | region = [[sphere_region_1(:,1); 0], [sphere_region_1(:,2); a_cap]]; 22 | end 23 | % end function 24 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_region_props/Contents.m: -------------------------------------------------------------------------------- 1 | %Recursive Zonal Equal Area Sphere Partitioning: Properties of EQ partitions 2 | % 3 | % Recursive Zonal Equal Area (EQ) Sphere Partitioning Toolbox. 4 | % Release 1.10 2005-06-01 5 | % 6 | %Functions by category 7 | %===================== 8 | % 9 | % Diameter 10 | % eq_diam_bound Maximum per-region diameter bound of EQ partition 11 | % eq_vertex_diam Maximum vertex diameter of EQ partition 12 | % 13 | % eq_diam_coeff Coefficients of diameter bound and vertex diameter of 14 | % EQ partition 15 | % eq_vertex_diam_coeff Coefficient of maximum vertex diameter of EQ partition 16 | % 17 | %Hook for user-defined properties 18 | % eq_regions_property Property of regions of an EQ partition 19 | 20 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 21 | % $Revision 1.10 $ $Date 2005-06-01 $ 22 | % Documentation files renamed 23 | % $Revision 1.00 $ $Date 2005-02-13 $ 24 | % 25 | % For licensing, see COPYING. 26 | % For references, see AUTHORS. 27 | % For revision history, see CHANGELOG. 28 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_region_props/private/expand_region_for_diam.m: -------------------------------------------------------------------------------- 1 | function expanded_region = expand_region_for_diam(region) 2 | %EXPAND_REGION_FOR_DIAM The set of 2^d vertices of a region 3 | % 4 | % Expand a region from the 2 vertex definition to the set of 2^dim vertices 5 | % of the pseudo-region of a region, so that the Euclidean diameter of a region 6 | % is approximated by the diameter of this set. 7 | % 8 | % expanded_region = expand_region_for_diam(region); 9 | 10 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 11 | % $Revision 1.10 $ $Date 2005-06-01 $ 12 | % Documentation files renamed 13 | % $Revision 1.00 $ $Date 2005-02-12 $ 14 | % 15 | % For licensing, see COPYING. 16 | % For references, see AUTHORS. 17 | % For revision history, see CHANGELOG. 18 | 19 | dim = size(region,1); 20 | if dim > 1 21 | s_top = region(dim,1); 22 | s_bot = region(dim,2); 23 | region_1 = expand_region_for_diam(region(1:dim-1,:)); 24 | expanded_region = [append(region_1, s_top), append(region_1, s_bot)]; 25 | else 26 | expanded_region = pseudo_region_for_diam(region); 27 | end 28 | % 29 | % end function 30 | 31 | function result = append(matrix,value) 32 | % Append a coordinate value to each column of a matrix. 33 | % 34 | % result = append(matrix,value); 35 | 36 | result = [matrix; ones(1,size(matrix,2))*value]; 37 | % 38 | % end function 39 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_region_props/private/pseudo_region_for_diam.m: -------------------------------------------------------------------------------- 1 | function pseudo_region = pseudo_region_for_diam(region) 2 | %PSEUDO_REGION_FOR_DIAM Two points which maximize the vertex diameter of a region 3 | % 4 | % pseudo_region = pseudo_region_for_diam(region) 5 | 6 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 7 | % $Revision 1.10 $ $Date 2005-06-01 $ 8 | % Documentation files renamed 9 | % $Revision 1.00 $ $Date 2005-02-12 $ 10 | % 11 | % For licensing, see COPYING. 12 | % For references, see AUTHORS. 13 | % For revision history, see CHANGELOG. 14 | 15 | tol = eps*2^5; 16 | phi_top = region(1,1); 17 | phi_bot = region(1,2); 18 | if phi_bot == 0 19 | phi_bot = 2*pi; 20 | end 21 | if (mod(phi_bot - phi_top, 2*pi) < tol) || (mod(phi_bot - phi_top, 2*pi) > pi) 22 | phi_bot = phi_top + pi; 23 | end 24 | pseudo_region = region; 25 | pseudo_region(1,2) = phi_bot; 26 | % 27 | % end function 28 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_test/Contents.m: -------------------------------------------------------------------------------- 1 | %Recursive Zonal Equal Area Sphere Partitioning: Tests 2 | % 3 | % Recursive Zonal Equal Area (EQ) Sphere Partitioning Toolbox. 4 | % Release 1.10 2005-06-01 5 | % 6 | %Functions 7 | %========= 8 | % 9 | % eq_area_error Total area error and max area error per region of an 10 | % EQ partition 11 | 12 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 13 | % $Revision 1.10 $ $Date 2005-06-01 $ 14 | % Documentation files renamed 15 | % $Revision 1.00 $ $Date 2005-02-13 $ 16 | % 17 | % For licensing, see COPYING. 18 | % For references, see AUTHORS. 19 | % For revision history, see CHANGELOG. 20 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_utilities/area_of_ideal_region.m: -------------------------------------------------------------------------------- 1 | function area = area_of_ideal_region(dim,N) 2 | %AREA_OF_IDEAL_REGION Area of one region of an EQ partition 3 | % 4 | %Syntax 5 | % area = area_of_ideal_region(dim,N); 6 | % 7 | %Description 8 | % AREA = AREA_OF_IDEAL_REGION(dim,N) sets AREA to be the area of one of N equal 9 | % area regions on S^dim, that is 1/N times AREA_OF_SPHERE(dim). 10 | % 11 | % The argument dim must be a positive integer. 12 | % The argument N must be a positive integer or an array of positive integers. 13 | % The result AREA will be an array of the same size as N. 14 | % 15 | %Examples 16 | % > area=area_of_ideal_region(3,1:6) 17 | % area = 18 | % 19.7392 9.8696 6.5797 4.9348 3.9478 3.2899 19 | % 20 | %See also 21 | % AREA_OF_SPHERE 22 | 23 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 24 | % $Revision 1.10 $ $Date 2005-06-01 $ 25 | % Documentation files renamed 26 | % $Revision 1.00 $ $Date 2005-02-12 $ 27 | % 28 | % For licensing, see COPYING. 29 | % For references, see AUTHORS. 30 | % For revision history, see CHANGELOG. 31 | 32 | area = area_of_sphere(dim)./N; 33 | % 34 | % end function 35 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_utilities/area_of_sphere.m: -------------------------------------------------------------------------------- 1 | function area = area_of_sphere(dim) 2 | %AREA_OF_SPHERE Area of sphere 3 | % 4 | %Syntax 5 | % area = area_of_sphere(dim); 6 | % 7 | %Description 8 | % AREA = AREA_OF_SPHERE(dim) sets AREA to be the area of the sphere S^dim, 9 | % 10 | % The argument dim must be a positive integer or an array of positive integers. 11 | % The result AREA will be an array of the same size as dim. 12 | % 13 | %Notes 14 | % The area of S^dim is defined via the Lebesgue measure on S^dim inherited from 15 | % its embedding in R^(dim+1). 16 | % 17 | % Ref: [Mue98] p39. 18 | % 19 | %Examples 20 | % > area=area_of_sphere(1:7) 21 | % area = 22 | % 6.2832 12.5664 19.7392 26.3189 31.0063 33.0734 32.4697 23 | % 24 | %See also 25 | % AREA_OF_CAP, VOLUME_OF_BALL 26 | 27 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 28 | % $Revision 1.10 $ $Date 2005-06-01 $ 29 | % Documentation files renamed 30 | % $Revision 1.00 $ $Date 2005-02-12 $ 31 | % 32 | % For licensing, see COPYING. 33 | % For references, see AUTHORS. 34 | % For revision history, see CHANGELOG. 35 | 36 | power = (dim+1)/2; 37 | area = (2*pi.^power./gamma(power)); 38 | % 39 | % end function 40 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_utilities/euc2sph_dist.m: -------------------------------------------------------------------------------- 1 | function s = euc2sph_dist(e) 2 | %EUC2SPH_DIST Convert Euclidean to spherical distance 3 | % 4 | %Syntax 5 | % s = e2s(e); 6 | % 7 | %Description 8 | % S = EUC2SPH_DIST(E) converts the Euclidean distance E to the spherical 9 | % distance S, using a formula which is valid for the unit sphere in all 10 | % dimensions. 11 | % 12 | % The argument E must be a real number or an array of real numbers. 13 | % The result S will be an array of the same size as E. 14 | % 15 | %Note 16 | % The argument E is assumed to satsify abs(E) <= 2. 17 | % 18 | %Examples 19 | % > s=euc2sph_dist(2) 20 | % s = 21 | % 3.1416 22 | % 23 | % > s=euc2sph_dist(0:0.5:2) 24 | % s = 25 | % 0 0.5054 1.0472 1.6961 3.1416 26 | % 27 | % > s=euc2sph_dist(-2) 28 | % s = 29 | % -3.1416 30 | % 31 | %See also 32 | % SPH2EUC_DIST, EUCLIDEAN_DIST, SPHERICAL_DIST 33 | 34 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 35 | % $Revision 1.10 $ $Date 2005-06-01 $ 36 | % Change name from e2s to euc2sph_dist 37 | % Documentation files renamed 38 | % $Revision 1.00 $ $Date 2005-02-12 $ 39 | % 40 | % For licensing, see COPYING. 41 | % For references, see AUTHORS. 42 | % For revision history, see CHANGELOG. 43 | 44 | s = 2*asin(e/2); 45 | % 46 | % end function 47 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_utilities/haslight.m: -------------------------------------------------------------------------------- 1 | function lit = haslight(axish) 2 | %HASLIGHT Check if axis handle has a light attached 3 | % 4 | %Syntax 5 | % lit = haslight(axish); 6 | % 7 | %Description 8 | % LIT = HASLIGHT(AXISH) sets LIT to true if the axis specified by axis 9 | % handle AXISH has a child of type 'light', and sets LIT to false otherwise. 10 | % 11 | %Examples 12 | % > lit=haslight(gca) 13 | % lit = 14 | % 1 15 | 16 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 17 | % $Revision 1.10 $ $Date 2005-06-01 $ 18 | % Documentation files renamed 19 | % $Revision 1.00 $ $Date 2005-02-12 $ 20 | % 21 | % For licensing, see COPYING. 22 | % For references, see AUTHORS. 23 | % For revision history, see CHANGELOG. 24 | 25 | lit = false; 26 | ch = get(axish,'Children'); 27 | 28 | for k = 1:length(ch) 29 | type = get(ch(k),'Type'); 30 | if strcmp(type,'light') 31 | lit = true; 32 | return; 33 | end 34 | end 35 | % 36 | %end function 37 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_utilities/sph2euc_dist.m: -------------------------------------------------------------------------------- 1 | function e = sph2euc_dist(s) 2 | %SPHE2EUC_DIST Convert spherical to Euclidean distance 3 | % 4 | %Syntax 5 | % e = sph2euc_dist(s); 6 | % 7 | %Description 8 | % E = SPHE2EUC_DIST (S) converts the spherical distance S to Euclidean 9 | % distance E, using a formula which is valid for the unit sphere in all 10 | % dimensions. 11 | % 12 | % The argument S must be a real number or an array of real numbers. 13 | % The result E will be an array of the same size as S. 14 | % 15 | %Note 16 | % The argument S is assumed to satsify abs(S) <= pi. 17 | % 18 | %Examples 19 | % > e=sph2euc_dist(pi) 20 | % e = 21 | % 2 22 | % 23 | % > e=sph2euc_dist(0:pi/4:pi) 24 | % e = 25 | % 0 0.7654 1.4142 1.8478 2.0000 26 | % 27 | %See also 28 | % EUC2SPH_DIST, EUCLIDEAN_DIST, SPHERICAL_DIST 29 | 30 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 31 | % $Revision 1.10 $ $Date 2005-06-01 $ 32 | % Change name from s2e to sph2euc_dist 33 | % Documentation files renamed 34 | % $Revision 1.00 $ $Date 2005-02-12 $ 35 | % 36 | % For licensing, see COPYING. 37 | % For references, see AUTHORS. 38 | % For revision history, see CHANGELOG. 39 | 40 | e = 2*(sin(s/2)); 41 | % 42 | % end function 43 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/eq_utilities/volume_of_ball.m: -------------------------------------------------------------------------------- 1 | function volume = volume_of_ball(dim) 2 | %VOLUME_OF_BALL Volume of the unit ball 3 | % 4 | %Syntax 5 | % volume = volume_of_ball(dim); 6 | % 7 | %Description 8 | % VOLUME = VOLUME_OF_BALL(dim) sets VOLUME to be the volume of the unit ball 9 | % B^dim in R^dim which is enclosed by the sphere S^(dim-1). 10 | % 11 | % The argument dim must be a positive integer or an array of positive integers. 12 | % The result VOLUME will be an array of the same size as dim. 13 | % 14 | %Notes 15 | % The volume of B^dim is defined via the Lebesgue measure on R^dim. 16 | % 17 | % Ref: [WeiMW]. 18 | % 19 | %Examples 20 | % > volume=volume_of_ball(1:7) 21 | % volume = 22 | % 2.0000 3.1416 4.1888 4.9348 5.2638 5.1677 4.7248 23 | % 24 | %See also 25 | % AREA_OF_SPHERE 26 | 27 | % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. 28 | % $Revision 1.10 $ $Date 2005-06-01 $ 29 | % Documentation files renamed 30 | % $Revision 1.00 $ $Date 2005-02-12 $ 31 | % 32 | % For licensing, see COPYING. 33 | % For references, see AUTHORS. 34 | % For revision history, see CHANGELOG. 35 | 36 | volume = area_of_sphere(dim-1)./dim; 37 | % 38 | % end function 39 | -------------------------------------------------------------------------------- /3rdparty/eq_sphere_partitions/info.ins: -------------------------------------------------------------------------------- 1 | MATLAB 5.0 MAT-file, Platform: GLNX86, Created on: Fri May 27 13:36:06 2005 IM@ IS_INSTALLED0INS_DIRSP eq_illustrationsP eq_partitionsX$eq_point_set_propsPeq_region_props@eq_testH eq_utilities`INS_NAME(eq_sphere_partitions -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/ChangeLog: -------------------------------------------------------------------------------- 1 | Version 1.6.11 2 | * bug fixes 3 | 4 | Version 1.6.10 5 | * fixed a radiusSearch bug introduced in 1.6.9 6 | 7 | Version 1.6.9 8 | * bug fixes 9 | * fixed radius search bug on MSVC compiler 10 | * fixed windows linking problems 11 | 12 | Version 1.6.8 13 | * bug fixes, low dimensional search speedup 14 | 15 | Version 1.6.7 16 | * bug fixes 17 | 18 | Version 1.6.6 19 | * misc bug fixes 20 | 21 | Version 1.6.5 22 | * fix compilation problem on some C++ compilers 23 | * fixes in the python bindings 24 | 25 | Version 1.6.4 26 | * small bug fix 27 | 28 | Version 1.6.3 29 | * radius search speedup 30 | 31 | Version 1.6.2 32 | * slight API changes to the C++ bindings, now the main index type is templated 33 | * on the distance functor which makes it easier to use custom distances 34 | * new kd-tree implementation optimized for low dimensionality data 35 | * experimental MPI support for cluster computing 36 | 37 | Version 1.5 38 | * new C++ templated API 39 | * saving/loading of indices to disk 40 | * threadsafe search 41 | * new distance types (thanks to Radu Bogdan Rusu and Romain Thibaux for the patch) 42 | * (api change) autotuned is no longer selected by passing a precision >0, it's used when the algorithm type is set to autotuned 43 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/bin/indent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=`dirname $0` 4 | uncrustify --no-backup -c ${DIR}/uncrustify.cfg $1 5 | 6 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/bin/make_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | VERSION=`grep "set(FLANN_VERSION" CMakeLists.txt | sed 's/[^0-9]*\([0-9]*\.[0-9]*\.[0-9]*\)[^0-9]*/\1/'` 3 | 4 | echo "Creating flann-$VERSION-src.zip" 5 | 6 | git archive --prefix=flann-$VERSION-src/ -o flann-$VERSION-src.zip $VERSION-src 7 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/bin/run_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | 4 | import sys 5 | import os.path as op 6 | import unittest 7 | 8 | if __name__ == "__main__": 9 | if len(sys.argv)==1: 10 | print "Usage: %s file"%sys.argv[0] 11 | sys.exit(1) 12 | 13 | python_path = op.abspath(op.join( op.dirname(__file__),"..","src","python")) 14 | sys.path.append(python_path) 15 | 16 | test_file = sys.argv[1] 17 | sys.argv = sys.argv[1:] 18 | execfile(test_file) 19 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(PKG_DESC "Fast Library for Approximate Nearest Neighbors") 2 | set(pkg_conf_file ${CMAKE_CURRENT_BINARY_DIR}/flann.pc) 3 | configure_file(flann.pc.in ${pkg_conf_file} @ONLY) 4 | install(FILES ${pkg_conf_file} 5 | DESTINATION ${FLANN_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT pkgconfig) 6 | 7 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/cmake/FindFlann.cmake: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Find Flann 3 | # 4 | # This sets the following variables: 5 | # FLANN_FOUND - True if FLANN was found. 6 | # FLANN_INCLUDE_DIRS - Directories containing the FLANN include files. 7 | # FLANN_LIBRARIES - Libraries needed to use FLANN. 8 | # FLANN_DEFINITIONS - Compiler flags for FLANN. 9 | 10 | find_package(PkgConfig) 11 | pkg_check_modules(PC_FLANN flann) 12 | set(FLANN_DEFINITIONS ${PC_FLANN_CFLAGS_OTHER}) 13 | 14 | find_path(FLANN_INCLUDE_DIR flann/flann.hpp 15 | HINTS ${PC_FLANN_INCLUDEDIR} ${PC_FLANN_INCLUDE_DIRS}) 16 | 17 | find_library(FLANN_LIBRARY flann 18 | HINTS ${PC_FLANN_LIBDIR} ${PC_FLANN_LIBRARY_DIRS}) 19 | 20 | set(FLANN_INCLUDE_DIRS ${FLANN_INCLUDE_DIR}) 21 | set(FLANN_LIBRARIES ${FLANN_LIBRARY}) 22 | 23 | include(FindPackageHandleStandardArgs) 24 | find_package_handle_standard_args(Flann DEFAULT_MSG 25 | FLANN_LIBRARY FLANN_INCLUDE_DIR) 26 | 27 | mark_as_advanced(FLANN_LIBRARY FLANN_INCLUDE_DIR) 28 | 29 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/cmake/flann.pc.in: -------------------------------------------------------------------------------- 1 | # This file was generated by CMake for @PROJECT_NAME@ 2 | prefix=@CMAKE_INSTALL_PREFIX@ 3 | exec_prefix=${prefix} 4 | libdir=${prefix}/@FLANN_LIB_INSTALL_DIR@ 5 | includedir=${prefix}/include 6 | 7 | Name: @PROJECT_NAME@ 8 | Description: @PKG_DESC@ 9 | Version: @FLANN_VERSION@ 10 | Requires: @PKG_EXTERNAL_DEPS@ 11 | Libs: -L${libdir} -lflann_cpp 12 | Cflags: -I${includedir} 13 | 14 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/cmake/uninstall_target.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@PROJECT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: \"@PROJECT_BINARY_DIR@/install_manifest.txt\"") 3 | endif(NOT EXISTS "@PROJECT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@PROJECT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 9 | if(EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 11 | OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval) 12 | if(NOT "${rm_retval}" STREQUAL 0) 13 | message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 14 | endif(NOT "${rm_retval}" STREQUAL 0) 15 | else(EXISTS "$ENV{DESTDIR}${file}") 16 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 17 | endif(EXISTS "$ENV{DESTDIR}${file}") 18 | endforeach(file) 19 | 20 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(LATEX) 2 | 3 | if (EXISTS ${PDFLATEX_COMPILER} AND EXISTS ${BIBTEX_COMPILER}) 4 | include(${PROJECT_SOURCE_DIR}/cmake/UseLATEX.cmake) 5 | 6 | add_latex_document(manual.tex BIBFILES references.bib IMAGE_DIRS images DEFAULT_PDF) 7 | 8 | add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/manual.pdf 9 | COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/manual.pdf ${CMAKE_CURRENT_SOURCE_DIR}/manual.pdf 10 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/manual.pdf 11 | ) 12 | add_custom_target(doc DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/manual.pdf) 13 | endif() 14 | 15 | install( 16 | FILES manual.pdf 17 | DESTINATION share/doc/flann 18 | OPTIONAL 19 | ) 20 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/doc/images/cmake-gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/3rdparty/sources/flann-1.8.4-src/doc/images/cmake-gui.png -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_custom_target(examples ALL) 2 | 3 | 4 | if (BUILD_C_BINDINGS) 5 | add_executable(flann_example_c flann_example.c) 6 | target_link_libraries(flann_example_c flann) 7 | set_target_properties(flann_example_c PROPERTIES COMPILE_FLAGS -std=c99) 8 | 9 | add_dependencies(examples flann_example_c) 10 | install (TARGETS flann_example_c DESTINATION bin ) 11 | endif() 12 | 13 | if (HDF5_FOUND) 14 | include_directories(${HDF5_INCLUDE_DIR}) 15 | 16 | add_executable(flann_example_cpp flann_example.cpp) 17 | target_link_libraries(flann_example_cpp ${HDF5_LIBRARIES}) 18 | if (HDF5_IS_PARALLEL) 19 | target_link_libraries(flann_example_cpp ${MPI_LIBRARIES}) 20 | endif() 21 | 22 | add_dependencies(examples flann_example_cpp) 23 | install (TARGETS flann_example_cpp DESTINATION bin) 24 | 25 | 26 | if (USE_MPI AND HDF5_IS_PARALLEL) 27 | add_executable(flann_example_mpi flann_example_mpi.cpp) 28 | target_link_libraries(flann_example_mpi flann_cpp ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${Boost_LIBRARIES}) 29 | 30 | add_dependencies(examples flann_example_mpi) 31 | install (TARGETS flann_example_mpi DESTINATION bin) 32 | endif() 33 | else() 34 | message("hdf5 library not found, not compiling flann_example.cpp") 35 | endif() 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/examples/README: -------------------------------------------------------------------------------- 1 | 2 | These examples use some datasets that are not included in the source distribution. You can download the datasets from here: 3 | 4 | http://people.cs.ubc.ca/~mariusm/uploads/FLANN/datasets/dataset.hdf5 5 | http://people.cs.ubc.ca/~mariusm/uploads/FLANN/datasets/dataset.dat 6 | http://people.cs.ubc.ca/~mariusm/uploads/FLANN/datasets/testset.dat 7 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/examples/flann_example.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | using namespace flann; 8 | 9 | int main(int argc, char** argv) 10 | { 11 | int nn = 3; 12 | 13 | Matrix dataset; 14 | Matrix query; 15 | load_from_file(dataset, "dataset.hdf5","dataset"); 16 | load_from_file(query, "dataset.hdf5","query"); 17 | 18 | Matrix indices(new int[query.rows*nn], query.rows, nn); 19 | Matrix dists(new float[query.rows*nn], query.rows, nn); 20 | 21 | // construct an randomized kd-tree index using 4 kd-trees 22 | Index > index(dataset, flann::KDTreeIndexParams(4)); 23 | index.buildIndex(); 24 | 25 | // do a knn search, using 128 checks 26 | index.knnSearch(query, indices, dists, nn, flann::SearchParams(128)); 27 | 28 | flann::save_to_file(indices,"result.hdf5","result"); 29 | 30 | delete[] dataset.ptr(); 31 | delete[] query.ptr(); 32 | delete[] indices.ptr(); 33 | delete[] dists.ptr(); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory( cpp ) 3 | 4 | if (BUILD_MATLAB_BINDINGS) 5 | add_subdirectory( matlab ) 6 | endif() 7 | 8 | if (BUILD_PYTHON_BINDINGS) 9 | add_subdirectory( python ) 10 | endif() 11 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/src/cpp/flann/mpi/flann_mpi_server.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | boost::mpi::environment env(argc, argv); 9 | 10 | try { 11 | if (argc != 4) { 12 | std::cout << "Usage: " << argv[0] << " \n"; 13 | return 1; 14 | } 15 | flann::mpi::Server > server(argv[1], argv[2], std::atoi(argv[3]), 16 | flann::KDTreeIndexParams(4)); 17 | 18 | server.run(); 19 | } 20 | catch (std::exception& e) { 21 | std::cerr << "Exception: " << e.what() << "\n"; 22 | } 23 | 24 | return 0; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/src/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file( setup.py.tpl setup.py ) 2 | 3 | install( DIRECTORY pyflann DESTINATION share/flann/python ) 4 | install( FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.py DESTINATION share/flann/python ) 5 | 6 | 7 | # python instalation 8 | if (PYTHON_EXECUTABLE) 9 | install(CODE "execute_process( 10 | COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/setup.py install 11 | WORKING_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}\")") 12 | endif() 13 | -------------------------------------------------------------------------------- /3rdparty/sources/flann-1.8.4-src/src/python/setup.py.tpl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | from distutils.core import setup 4 | from os.path import exists, abspath, dirname, join 5 | import os 6 | import sys 7 | 8 | 9 | def find_path(): 10 | lib_paths = [ os.path.abspath('@LIBRARY_OUTPUT_PATH@'), abspath(join(dirname(dirname(sys.argv[0])), '../../../lib')) ] 11 | possible_libs = ['libflann.so', 'flann.dll', 'libflann.dll', 'libflann.dylib'] 12 | 13 | for path in lib_paths: 14 | for lib in possible_libs: 15 | if exists(join(path,lib)): 16 | return path 17 | 18 | setup(name='flann', 19 | version='@FLANN_VERSION@', 20 | description='Fast Library for Approximate Nearest Neighbors', 21 | author='Marius Muja', 22 | author_email='mariusm@cs.ubc.ca', 23 | license='BSD', 24 | url='http://www.cs.ubc.ca/~mariusm/flann/', 25 | packages=['pyflann', 'pyflann.lib'], 26 | package_dir={'pyflann.lib': find_path() }, 27 | package_data={'pyflann.lib': ['libflann.so', 'flann.dll', 'libflann.dll', 'libflann.dylib']}, 28 | ) 29 | -------------------------------------------------------------------------------- /Contents.m: -------------------------------------------------------------------------------- 1 | % GSPBOX - Startup 2 | % 3 | % Start 4 | % gsp_start - Lauch the toolbox 5 | % gsp_make - Compile the toolbox 6 | % gsp_install - Install the 3rdparty software and try to compile souces 7 | % gsp_install_unlocbox - Install the UNLocBoX 8 | % 9 | % For help, bug reports, suggestions etc. please send email to 10 | % gspbox 'dash' support 'at' groupes 'dot' epfl 'dot' ch 11 | % 12 | 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Graph Signal Processing Toolbox (GSPBox) 2 | ====== 3 | 4 | The official Graph Signal Processing Toolbox (GSPBox) 5 | 6 | Running the toolbox 7 | == 8 | 9 | In Matlab type 10 | 11 | gsp_start 12 | 13 | as the first command from the installation directory. This will set up the correct paths. 14 | 15 | The gsp_start command will add all the necessary subdirectories (so 16 | please don't add these manually), and it will print a statement 17 | telling you which backend you are currently using. 18 | 19 | Compiling the toolbox 20 | === 21 | 22 | In Matlab type 23 | 24 | gsp_make 25 | 26 | as the first command from the installation directory. This will try to compile the mex interface for 27 | the third party components: AMD and LDL. 28 | 29 | You need the library stdc++ to compile AMD and LDL. On Ubuntu you can type: 30 | 31 | sudo apt-get install libstdc++6 32 | 33 | 34 | Installing third party software 35 | ==== 36 | 37 | In Matlab type 38 | 39 | gsp_install 40 | 41 | as the first command from the installation directory. This will try to download and install third party 42 | software. 43 | 44 | 45 | Documentation 46 | === 47 | 48 | You can find the complete documentation at https://epfl-lts2.github.io/gspbox-html/. 49 | -------------------------------------------------------------------------------- /demos/Contents.m: -------------------------------------------------------------------------------- 1 | % GSPBOX - Demos 2 | % 3 | % Introduction to the GSPBox 4 | % gsp_demo - Small tutorial on the GSPBox 5 | % gsp_demo_wavelet - Introduction to spectral wavelets 6 | % gsp_demo_graph_embedding - Introduction to use embeddings 7 | % 8 | % Convex optimization on graphs 9 | % gsp_demo_graph_tv - Graph TV demonstration 10 | % gsp_demo_wavelet_dn - Graph wavelets denoising 11 | % gsp_demo_learn_graph - Graph learning demonstration 12 | % gsp_demo_stationarity - Signal inpainting using stationarity 13 | % 14 | % Graph learning 15 | % gsp_demo_learn_graph - Demonstration of learning a graph from data 16 | % gsp_demo_learn_graph_large - Tutorial for graph learning using the GSPBox 17 | % 18 | % Sparse approximation 19 | % gsp_demo_pyramid - Kron Pyramid applied to a signal 20 | % 21 | % For help, bug reports, suggestions etc. please send email to 22 | % gspbox 'dash' support 'at' groupes 'dot' epfl 'dot' ch 23 | % 24 | -------------------------------------------------------------------------------- /demos/gsp_demo_poster.m: -------------------------------------------------------------------------------- 1 | %GSP_DEMO_POSTER A 6 steps demonstration 2 | % 3 | % This file contains a 6 steps demonstration of the GSPBOX 4 | % 5 | 6 | N = 100; % number of nodes 7 | % 1) Create a graph 8 | G = gsp_sensor(N); 9 | % 2) Compute the Fourier basis 10 | G = gsp_compute_fourier_basis(G); 11 | % 3) Create a smooth signal with noise 12 | x = G.U(:,2); 13 | y = x + 1/sqrt(N)*randn(N,1); 14 | % 4) Select a filter 15 | g = gsp_design_expwin(G,0.1); 16 | % 5) Remove the noise 17 | s = gsp_filter(G,g,y); 18 | % 6) Display the results 19 | figure(1); gsp_plot_signal(G,x); title('Original signal'); 20 | figure(2); gsp_plot_signal(G,y); title('Noisy signal'); 21 | figure(3); gsp_plot_signal(G,s); title('Denoised signal'); 22 | 23 | % Show the filter 24 | figure(4); gsp_plot_filter(G,g) 25 | 26 | % Save the plots 27 | figure(1); gsp_plotfig('poster_ori'); 28 | figure(2); gsp_plotfig('poster_noisy'); 29 | figure(3); gsp_plotfig('poster_denoised'); -------------------------------------------------------------------------------- /embedding/Contents.m: -------------------------------------------------------------------------------- 1 | % GSPBOX - Embeddings 2 | % 3 | % Availlable embeddings 4 | % gsp_lle - Local Linear Embedding 5 | % gsp_laplacian_eigenmaps - Laplacian Eigenmaps 6 | % gsp_isomap - Isomap 7 | % gsp_eigenspace_estimation - Fast Eigenspace Approximation using Random Signals (FEARS) 8 | % 9 | % Utils 10 | % gsp_weight2distance - Distance matrix from weight matrix 11 | % gsp_compute_coordinates - Compute new coordinates for a graph 12 | % 13 | % For help, bug reports, suggestions etc. please send email to 14 | % gspbox 'dash' support 'at' groupes 'dot' epfl 'dot' ch 15 | % 16 | -------------------------------------------------------------------------------- /filters/gsp_evaluate_can_dual.m: -------------------------------------------------------------------------------- 1 | function [ s ] = gsp_evaluate_can_dual( g,val,tol ) 2 | %GSP_EVALUATE_CAN_DUAL Evaluate the canonical dual filterbank 3 | % Usage: hcoeff = gsp_evaluate_can_dual( g,val ) 4 | % 5 | % Inputs parameters: 6 | % g : cell array of filters 7 | % val : column vectors of values 8 | % tol : tolerance 9 | % 10 | % Ouputs parameters: 11 | % s : Matrix of value 12 | % 13 | % This function computes the value of the canonical dual of a filterbank 14 | % *g* at the point specified in *val*. The function returns a matrix. Each 15 | % column is the output of one dual filter. 16 | % 17 | % See also: gsp_design_can_dual 18 | 19 | % Author: Nathanael Perraudin 20 | % Date : 14 June 2014 21 | % Testing: test_dual 22 | 23 | if nargin<3 24 | tol = 1e-10; 25 | end 26 | 27 | 28 | % TODO: size should be improved 29 | N = length(val); 30 | 31 | % Compute coefficient of g 32 | gcoeff = gsp_filter_evaluate(g,val)'; 33 | 34 | % Compute coefficient of h 35 | % s = zeros(N,M); 36 | % for ii = 1:N 37 | % s(ii,:) = pinv(gcoeff(ii,:)'); 38 | % end 39 | 40 | s = arrayfun(@(x) pinv(gcoeff(:, x),tol), 1 : N, 'UniformOutput', false); 41 | s = cell2mat(s'); 42 | end 43 | 44 | -------------------------------------------------------------------------------- /filters/gsp_filter.m: -------------------------------------------------------------------------------- 1 | function out = gsp_filter(G, fi, signal, param) 2 | %GSP_FILTER Filter function 3 | % Usage: coeffs = gsp_filter(G, fi, signal); 4 | % coeffs = gsp_filter(G, fi, signal, param); 5 | % 6 | % Input parameters: 7 | % G : Graph structure. 8 | % fi : Spectral filter. 9 | % s : Graph signal to filters 10 | % param : Optional parameters 11 | % Output parameters: 12 | % c : Filtered signal 13 | % 14 | % This function is a shortcut to the function |gsp_filter_analysis|. 15 | % Please use the documentation of |gsp_filter_analysis| 16 | % 17 | 18 | if nargin<4 19 | param = struct; 20 | end 21 | 22 | out = gsp_filter_analysis(G, fi, signal, param); 23 | end 24 | -------------------------------------------------------------------------------- /filters/gsp_filter_evaluate.m: -------------------------------------------------------------------------------- 1 | function fd = gsp_filter_evaluate(filter, x) 2 | %GSP_FILTER_EVALUATE Evaluate the filterbank 3 | % Usage: fd = gsp_filter_evaluate(filter, x) 4 | % 5 | % Input parameters: 6 | % filter : cell array of filter 7 | % x : data 8 | % Output parameters: 9 | % fd : response of the filters 10 | % 11 | % This function applies all the filters in *filter* to the data *x*. Every 12 | % filter correspond to one column of the matrix *fd*. 13 | % 14 | % See also: gsp_filter_analysis 15 | % 16 | 17 | % Author: Nathanael Perraudin 18 | % Date: 18 March 2014 19 | 20 | if ~iscell(filter) 21 | filter = {filter}; 22 | end 23 | 24 | Nf=numel(filter); 25 | fd=zeros(length(x),Nf); 26 | for k=1:Nf 27 | fd(:,k)=filter{k}(x); 28 | end 29 | 30 | end 31 | -------------------------------------------------------------------------------- /filters/gsp_filterbank_matrix.m: -------------------------------------------------------------------------------- 1 | function [ F ] = gsp_filterbank_matrix(G,g,param ) 2 | %GSP_FILTERBANK_MATRIX Create the matrix of the filterbank frame 3 | % Usage: F = gsp_filterbank_matrix(G, g param ); 4 | % F = gsp_filterbank_matrix(G,g); 5 | % 6 | % Input parameters: 7 | % G : Graph 8 | % g : Filters 9 | % param : Structure of optional parameter 10 | % Output parameters: 11 | % F : Frame 12 | % 13 | % This function creates the matrix associated to the filterbank g. The 14 | % size of the matrix is MN x N, where M is the number of filters. 15 | % 16 | % *param* a Matlab structure containing the following fields: 17 | % 18 | % * *param.verbose* : 0 no log, 1 print main steps, 2 print all steps. 19 | % By default, it is 1. 20 | % 21 | 22 | 23 | 24 | % AUTHOR : Nathanael Perraudin 25 | % TESTING: test_filter 26 | 27 | % Optional input arguments 28 | if nargin<4, param=struct; end 29 | if ~isfield(param, 'verbose'), param.verbose=1 ; end 30 | 31 | if param.verbose && G.N>2000 32 | warning('Create a big matrix, you can use other methods.'); 33 | end 34 | 35 | Nf = length(g); 36 | 37 | Ft = gsp_filter_analysis(G,g,eye(G.N)); 38 | 39 | F = zeros(size(Ft')); 40 | for ii = 1:Nf 41 | F(:,G.N*(ii-1)+(1:G.N)) = Ft(G.N*(ii-1)+(1:G.N),:); 42 | end 43 | 44 | end 45 | 46 | -------------------------------------------------------------------------------- /filters/gsp_gabor_filterbank.m: -------------------------------------------------------------------------------- 1 | function [ g ] = gsp_gabor_filterbank( G,k ) 2 | %GSP_GABOR_FILTERBANK returns a Gabor filterbank 3 | % Usage: g = gsp_gabor_filterbank( G,k ); 4 | % 5 | % Input parameters: 6 | % G : Graph 7 | % k : kernel 8 | % 9 | % Output parameters: 10 | % g : filterbank 11 | % 12 | % This function creates a filterbank with the kernel *k*. Every filter is 13 | % centered in a different frequency 14 | % 15 | 16 | % Author: Nathanael Perraudin 17 | % Date : 13 June 2014 18 | 19 | error('To rename and changed!') 20 | if ~isfield(G,'e') 21 | error(['GSP_GABOR_FILTERBANK: You need first to compute the Fourier basis\n',... 22 | 'You can do it with the function gsp_compute_fourier_basis']); 23 | end 24 | 25 | Nf = length(G.e); 26 | 27 | g = cell(Nf,1); 28 | 29 | for ii=1:Nf 30 | g{ii} = @(x) k(x-G.e(ii)); 31 | end 32 | 33 | 34 | end 35 | 36 | -------------------------------------------------------------------------------- /filters/gsp_jtv_design_can_dual.m: -------------------------------------------------------------------------------- 1 | function [ gd,filtertype ] = gsp_jtv_design_can_dual(g,filtertype) 2 | %GSP_JTV_DESIGN_CAN_DUAL This function returns the canonical dual of the time-vertex filterbank g 3 | % Usage: [gd,filtertype] = gsp_jtv_design_can_dual( g,filtertype ); 4 | % 5 | % Inputs parameters: 6 | % g : cell array of time-vertex filters 7 | % filtertype : Filter domain (ts,js,ts-array,js-array) 8 | % 9 | % Ouputs parameters: 10 | % g : cell array of canonical dual time-vertex filters 11 | % filtertype : Filter domain (ts,js) 12 | % 13 | % This function returns the canonical dual of the time-vertex filterbank g 14 | % 15 | 16 | % Author: Francesco Grassi 17 | % Date: September 2016 18 | 19 | Nf = size(g,1); 20 | gd = cell(Nf,1); 21 | 22 | for n = 1:Nf 23 | gd{n} = @(x,t) can_dual(g,filtertype,n,x,t); 24 | end 25 | 26 | switch filtertype 27 | case {'ts','ts-array'} 28 | filtertype = 'ts'; 29 | case {'js','js-array'} 30 | filtertype = 'js'; 31 | end 32 | 33 | end 34 | 35 | 36 | function sol = can_dual(g,ft,n,x,t) 37 | 38 | 39 | if ~isvector(x);x=x(:,1);end 40 | if ~isvector(t);t=t(1,:);end 41 | 42 | sol = gsp_jtv_evaluate_can_dual( g,ft,x,t,n ); 43 | 44 | 45 | end 46 | 47 | -------------------------------------------------------------------------------- /filters/gsp_jtv_design_meyer.m: -------------------------------------------------------------------------------- 1 | function [g,filtertype] = gsp_jtv_design_meyer(G,Nf) 2 | %GSP_DESIGN_JTV_MEYER Design the jtv Meyer tight filterbank 3 | % Usage: [g,filtertype] = gsp_design_jtv_meyer(G); 4 | % [g,filtertype] = gsp_design_jtv_meyer(G,Nf); 5 | % 6 | % Input parameters: 7 | % G : Time-Vertex graph structure 8 | % Nf : Number of filters for each domain (total number Nf^2, default Nf = 4) 9 | % Output parameters: 10 | % g : Cell array of time-vertex filters 11 | % filtertype : Filter domain js 12 | % 13 | 14 | % Author : Francesco Grassi 15 | % Date : September 2016 16 | 17 | if nargin<2 18 | Nf = 4; 19 | end 20 | 21 | %graph meyer 22 | g1 = gsp_design_meyer(G,Nf); 23 | 24 | %time meyer 25 | g2 = gsp_design_meyer(0.5/G.jtv.fs,Nf); 26 | 27 | %building jtv meyer separable filterbank 28 | n = 0; 29 | g = cell(Nf^2,1); 30 | for ii=1:Nf 31 | for jj=1:Nf 32 | n = n+1; 33 | g{n} = @(x,y) g1{ii}(x).*g2{jj}(abs(y)); 34 | end 35 | end 36 | 37 | filtertype = 'js'; 38 | 39 | end -------------------------------------------------------------------------------- /filters/gsp_jtv_filter_array.m: -------------------------------------------------------------------------------- 1 | function [h,filtertype] = gsp_jtv_filter_array(G,g,filtertype) 2 | %GSP_JTV_FILTER_ARRAY Convert ts/js filters to -array filters 3 | % Usage: [h,filtertype] = gsp_jtv_filter_array(G,g, filtertype) 4 | % 5 | % Input parameters: 6 | % G : Graph 7 | % g : Cell array of time-vertex filters 8 | % filtertype : Filter domain (ts,js) 9 | % Output parameters: 10 | % h : Cell array of graph filterbank 11 | % filtertype : Filter domain (ts-array,js-array) 12 | % 13 | % Convert ts/js filters to -array filters 14 | % 15 | 16 | % Author : Francesco Grassi, Nathanael Perraudin 17 | % Date : September 2016 18 | 19 | if ~iscell(g) 20 | g = {g}; 21 | end 22 | 23 | if ~gsp_check_filtertype(filtertype,{'ts','js'}) 24 | error('Invalid filtertype.'); 25 | end 26 | 27 | T = G.jtv.T; 28 | Nf = numel(g); 29 | 30 | switch filtertype 31 | case 'ts' 32 | v = gsp_jtv_ta(G); 33 | case 'js' 34 | v = gsp_jtv_fa(G); 35 | end 36 | 37 | h = cell(Nf,T); 38 | for n=1:Nf 39 | for ii = 1:T 40 | h{n,ii} = @(x) g{n}(x,v(ii)); 41 | end 42 | end 43 | 44 | filtertype = [filtertype '-array']; 45 | 46 | end -------------------------------------------------------------------------------- /filters/gsp_jtv_filter_inverse.m: -------------------------------------------------------------------------------- 1 | function [s] = gsp_jtv_filter_inverse(G, filter, filtertype,c, param) 2 | %GSP_JTV_FILTER_INVERSE Inverse operator of a joint timve_vertex filterbank 3 | % Usage: s = gsp_jtv_filter_inverse(G, filter, c); 4 | % s = gsp_jtv_filter_inverse(G, filter, c, param); 5 | % 6 | % Input parameters: 7 | % G : Time-vertex Graph structure. 8 | % filter : Cell array of time-vertex filters. 9 | % filtertype : Filter domain (ts,js,ts-array,js-array) 10 | % c : Transform coefficients 11 | % param : Optional parameter 12 | % Output parameters: 13 | % signal : sythesis signal 14 | % 15 | 16 | % Author: Francesco Grassi 17 | % Testing: test_jtv_filter 18 | % Date: September 2016 19 | 20 | if nargin<5 21 | param = struct; 22 | end 23 | 24 | [dual_filter,filtertype] = gsp_jtv_design_can_dual(filter,filtertype); 25 | 26 | s = gsp_jtv_filter_synthesis(G,dual_filter,filtertype,c,param); 27 | 28 | 29 | end 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /filters/gsp_jtv_mat2vec.m: -------------------------------------------------------------------------------- 1 | function C = gsp_jtv_mat2vec(C) 2 | %GSP_JTV_MAT2VEC vector to matrix transform 3 | % Usage: C = gsp_jtv_mat2vec(C); 4 | % 5 | % Input parameters: 6 | % C : Data 7 | % 8 | % Ouput parameter 9 | % C : Data 10 | % 11 | % Reshape the data from the matrix form to the vector form 12 | 13 | [N,T,Nf,Ns] = size(C); 14 | 15 | 16 | C = reshape(C,N*T*Nf,Ns); 17 | 18 | end -------------------------------------------------------------------------------- /filters/gsp_jtv_vec2mat.m: -------------------------------------------------------------------------------- 1 | function X = gsp_jtv_vec2mat(G,X) 2 | %GSP_JTV_VEC2MAT vector to matrix transform 3 | % Usage: d = gsp_jtv_vec2mat(G,X); 4 | % 5 | % Input parameters: 6 | % G : Graph 7 | % X : Data 8 | % 9 | % Ouput parameter 10 | % X : Data 11 | % 12 | % Reshape the data from the vector form to the matrix form 13 | 14 | 15 | [Nx,Ny] = size(X); 16 | 17 | X = reshape(X,G.N,G.jtv.T,Nx/G.N/G.jtv.T,Ny); 18 | 19 | 20 | end -------------------------------------------------------------------------------- /filters/gsp_mat2vec.m: -------------------------------------------------------------------------------- 1 | function [ d ,Nf] = gsp_mat2vec( d ) 2 | %GSP_MAT2VEC vector to matrix transform 3 | % Usage: d = gsp_mat2vec( d ); 4 | % [ d ,Nf] = gsp_mat2vec( d ); 5 | % 6 | % Input parameters: 7 | % d : Data 8 | % 9 | % Ouput parameter 10 | % d : Data 11 | % Nf : Number of filter 12 | % 13 | % Reshape the data from the matrix form to the vector form 14 | 15 | % TESTING: test_filter 16 | 17 | if iscell(d) 18 | Nc = numel(d); 19 | d2 = cell(Nc,1); 20 | for ii = 1:Nc 21 | d2{ii} = gsp_mat2vec(d{ii}); 22 | end 23 | d = d2; 24 | return 25 | end 26 | 27 | [M,Nf,N] = size(d); 28 | 29 | d = reshape(d,M*Nf,N); 30 | 31 | 32 | end 33 | 34 | -------------------------------------------------------------------------------- /filters/gsp_multiply_filters.m: -------------------------------------------------------------------------------- 1 | function gm = gsp_multiply_filters(g1,g2) 2 | %GSP_MULTIPLY_FILTERS Mutliply to filters 3 | % Usage: gm = gsp_multiply_filters(g1,g2); 4 | % 5 | % Input parameters: 6 | % g1 : filterbank 7 | % g2 : filterbank 8 | % 9 | % Output parameters: 10 | % gm : multiplied filterbank 11 | % 12 | % The resulting filter is $gm(x) = g1(x) g2(x)$. 13 | % 14 | 15 | % Author: Nathanael Perraudin 16 | % Date : 30 September 2015 17 | 18 | Nf1 = numel(g1); 19 | Nf2 = numel(g2); 20 | 21 | if ~iscell(g1) 22 | g1 = {g1}; 23 | end 24 | if ~iscell(g2) 25 | g2 = {g2}; 26 | end 27 | 28 | gm = cell(Nf1,Nf2); 29 | 30 | for ii = 1:Nf1 31 | for jj = 1:Nf2 32 | gm{ii,jj} = @(x) g1{ii}(x).*g2{jj}(x); 33 | end 34 | end 35 | 36 | 37 | end -------------------------------------------------------------------------------- /filters/gsp_test_duality_coefficient.m: -------------------------------------------------------------------------------- 1 | function [ bool ] = gsp_test_duality_coefficient( gcoeff,hcoeff,tol ) 2 | %GSP_TEST_DUALITY_COEFFICIENT Test if the coefficient are from dual filters 3 | % Usage: bool = gsp_test_duality_coefficient( gcoeff,hcoeff ); 4 | % bool = gsp_test_duality_coefficient( gcoeff,hcoeff,tol ); 5 | % 6 | % Input parameters: 7 | % gcoeff : coefficient of the filter 1 (matrix $N$ x $M$ ) 8 | % hcoeff : coefficinet of the filter 2 (matrix $N$ x $M$ ) 9 | % tol : tolerance for the test (default 1e-5) 10 | % 11 | % Ouput paramters: 12 | % bool : boolean 13 | % 14 | % This function test if two discrete filterbanks are dual. Each filter is 15 | % a column in the matrix *gcoeff* or *hcoeff*. $M$ is the number of 16 | % filters and $N$ the number of coefficients (size of the graph signal). 17 | % 18 | 19 | % Author: Nathanael Perraudin 20 | % Date : 13 july 2014 21 | % testing: test_dual 22 | 23 | if nargin<3 24 | tol = 1e-5; 25 | end 26 | 27 | v = sum(gcoeff.*hcoeff,2); 28 | A = min(v); 29 | B = max(v); 30 | bool = ( (A-B) / ((A+B)/2) ) < tol; 31 | 32 | end 33 | 34 | -------------------------------------------------------------------------------- /filters/gsp_tighten_filter.m: -------------------------------------------------------------------------------- 1 | function [ ftighten ] = gsp_tighten_filter(G, filters ) 2 | %GSP_TIGHTEN_FILTER Create a function that tighten a filterbank 3 | % Usage: ftighten = gsp_tighten_filter( filters ); 4 | % 5 | % Input parameters: 6 | % G : Graph or maximum eigenvalue 7 | % filters : Filters of the filterbank (cell array) 8 | % Ouput parameters: 9 | % ftighten : Inline function 10 | % 11 | % This function will compute the maximum eigenvalue of the laplacian. To 12 | % be more efficient, you can precompute it using:: 13 | % 14 | % G = gsp_estimate_lmax(G); 15 | % 16 | 17 | % Author: Nathanael Perraudin, David Shuman 18 | % Date : 16 June 2014 19 | 20 | 21 | if isstruct(G) 22 | if ~isfield(G,'lmax') 23 | warning('GSP_TIGHTEN_FILTER: has to compute lmax \n') 24 | G = gsp_estimate_lmax(G); 25 | end 26 | lmax = G.lmax; 27 | else 28 | lmax = G; 29 | end 30 | 31 | 32 | 33 | [~,B] = gsp_filterbank_bounds([0,lmax],filters); 34 | 35 | ftighten = @(x) f_tighten(filters,x,B); 36 | 37 | end 38 | 39 | 40 | function output = f_tighten(filters,x,B) 41 | output = B; 42 | 43 | for i=1:length(filters) 44 | output=output-(filters{i}(x)).^2; 45 | end 46 | output=real(sqrt(output)); 47 | end 48 | 49 | -------------------------------------------------------------------------------- /filters/gsp_vec2mat.m: -------------------------------------------------------------------------------- 1 | function [ d ] = gsp_vec2mat( d,Nf ) 2 | %GSP_VEC2MAT vector to matrix transform 3 | % Usage: d = gsp_vec2mat( d,Nf ); 4 | % 5 | % Input parameters: 6 | % d : Data 7 | % Nf : Number of filter 8 | % 9 | % Ouput parameter 10 | % d : Data 11 | % 12 | % Reshape the data from the vector form to the matrix form 13 | 14 | % TESTING: test_filter 15 | 16 | [M,N] = size(d); 17 | 18 | d = reshape(d,M/Nf,Nf,N); 19 | 20 | 21 | end 22 | 23 | -------------------------------------------------------------------------------- /filters/gsp_warp_filter.m: -------------------------------------------------------------------------------- 1 | function gw = gsp_warp_filter(g,w) 2 | %GSP_WARP_FILTER Warp the filterbank g with the filter w 3 | % Usage: gw = gsp_warp_filter(g,w); 4 | % 5 | % Input parameters: 6 | % g : filterbank 7 | % w : warping filter 8 | % 9 | % Output parameters: 10 | % gw : warped filterbank 11 | % 12 | % The resulting filter *gw* is $gw(x)=w(g(x))$. 13 | % 14 | 15 | % Author: Nathanael Perraudin 16 | % Date : 30 September 2015 17 | 18 | Nf = numel(g); 19 | 20 | if ~iscell(g) 21 | g = {g}; 22 | end 23 | 24 | gw = cell(Nf,1); 25 | 26 | for ii = 1:Nf 27 | gw{ii} = @(x) w(g{ii}(x)); 28 | end 29 | 30 | 31 | end -------------------------------------------------------------------------------- /filters/gsp_wlog_scales.m: -------------------------------------------------------------------------------- 1 | function s = gsp_wlog_scales(lmin, lmax, Nscales) 2 | %GSP_WLOG_SCALES compute logarithm scales for wavelet 3 | % Usage: s = gsp_wlog_scales(lmin, lmax, Nscales); 4 | % 5 | % Input parameters: 6 | % lmin : Minimum non zero eigenvalue 7 | % lmax : Maximum eigenvalue 8 | % Nscales : Number of scale 9 | % Output parameters: 10 | % s : scale 11 | % 12 | % returns a (possibly good) set of wavelet scales given minimum nonzero 13 | % and maximum eigenvalues of laplacian 14 | % 15 | % returns scales logarithmicaly spaced between minimum and maximum 16 | % "effective" scales : i.e. scales below minumum or above maximum 17 | % will yield the same shape wavelet (due to homogoneity of kernel : 18 | % currently assuming sgwt kernel g given as abspline with t1=1, t2=2) 19 | % 20 | % Note that in design of transform with scaling function, lmin may be 21 | % taken just as a fixed fraction of lmax, and may not actually be the 22 | % smallest nonzero eigenvalue 23 | % 24 | % This function is inspired by the sgwt_toolbox. 25 | % 26 | 27 | % Author: David K. Hammond, Nathanael Perraudin 28 | % Date : 18 March 2014 29 | 30 | 31 | t1=1; 32 | t2=2; 33 | 34 | smin=t1/lmax; 35 | smax=t2/lmin; 36 | % scales should be decreasing ... higher j should give larger s 37 | s=exp(linspace(log(smax),log(smin),Nscales)); 38 | 39 | end 40 | -------------------------------------------------------------------------------- /filters/utils/gsp_erdos_renyi_density.m: -------------------------------------------------------------------------------- 1 | function [pdf]=gsp_erdos_renyi_density(y,N,p) 2 | %GSP_ERDOS_RENYI_DENSITY The asymptotic density function of the graph Laplacian 3 | %eigenalues of an Erdos-Renyi random graph 4 | % Usage: pdf=gsp_erdos_renyi_density(y,N,p); 5 | % 6 | % Input parameters: 7 | % y : A vector of values at which the density will be evaluated. 8 | % N : Number of vertices in the graph. 9 | % p : Edge probability. 10 | % Output parameters: 11 | % pdf : The values of the density function at the points y. 12 | % 13 | % 'gsp_erdos_renyi_density(y,N,p)' computes the asymptotic density 14 | % function (for large $N$) of the combinatorial graph Laplacian 15 | % eigenvalues of an Erdos-Renyi random graph with $N$ vertices and edge 16 | % probability $p$. This is the density function associated with the free 17 | % additive convolution of a normal distribution with a semicircular 18 | % distribution. 19 | % 20 | % See also: 21 | % 22 | % Requires: gsp_free_conv_norm_semi 23 | % 24 | 25 | % AUTHOR : David I Shuman. 26 | % TESTING: 27 | % REFERENCE: 28 | 29 | pdf=sqrt(1/((1-p)*N*p))*gsp_free_conv_norm_semi((y-p*N)/(sqrt(p*(1-p)*N))); 30 | -------------------------------------------------------------------------------- /filters/utils/gsp_erdos_renyi_density_normalized.m: -------------------------------------------------------------------------------- 1 | function [pdf]=gsp_erdos_renyi_density_normalized(y,N,p) 2 | %GSP_ERDOS_RENYI_DENSITY_NORMALIZED The asymptotic density function of the normalized graph Laplacian 3 | %eigenalues of an Erdos-Renyi random graph 4 | % Usage: pdf=gsp_erdos_renyi_density_normalized(y,N,p); 5 | % 6 | % Input parameters: 7 | % y : A vector of values at which the density will be evaluated. 8 | % N : Number of vertices in the graph. 9 | % p : Edge probability. 10 | % Output parameters: 11 | % pdf : The values of the density function at the points y. 12 | % 13 | % 'gsp_erdos_renyi_density_normalized(y,N,p)' computes the asymptotic density 14 | % function (for large $N$) of the normalized graph Laplacian 15 | % eigenvalues of an Erdos-Renyi random graph with $N$ vertices and edge 16 | % probability $p$. This is a semicircular density function. 17 | % 18 | 19 | % AUTHOR : David I Shuman. 20 | % TESTING: 21 | % REFERENCE: 22 | 23 | pdf=sqrt((p*N)/(1-p))*(1/(2*pi))*real((y>1-2*sqrt((1-p)/(p*N))).*(y<1+2*sqrt((1-p)/(p*N))).*sqrt(4-p*N/(1-p)*(1-y).^2)); 24 | -------------------------------------------------------------------------------- /filters/utils/gsp_erdos_renyi_warp.m: -------------------------------------------------------------------------------- 1 | function [ cdf ] = gsp_erdos_renyi_warp( ss , N , p ) 2 | 3 | 4 | cutoff=4; % parameter to approximate the non-compactly supported distribution (the free convolution) by a compactly supported one, just for numerical purposes 5 | % To do: pass a parameter 6 | 7 | num_pts=length(ss); 8 | if num_pts > 2 9 | delta=min(ss(2:num_pts)-ss(1:(num_pts-1))); 10 | else 11 | delta=.1; 12 | end 13 | 14 | cdf=zeros(size(ss)); 15 | 16 | for k=1:num_pts 17 | if ss(k) > (p*N-cutoff*sqrt(p*(1-p)*N)-delta) 18 | if ss(k) <= (p*N+cutoff*sqrt(p*(1-p)*N)+delta) 19 | xx=(p*N-cutoff*sqrt(p*(1-p)*N)-2*delta):delta:ss(k); 20 | cdf(k)=trapz(xx,sqrt(1/((1-p)*N*p))*gsp_free_conv_norm_semi((xx-p*N)/(sqrt(p*(1-p)*N)))); 21 | else 22 | cdf(k)=1; 23 | end 24 | end 25 | end 26 | 27 | end 28 | 29 | -------------------------------------------------------------------------------- /filters/utils/gsp_random_regular_density.m: -------------------------------------------------------------------------------- 1 | function [pdf]=gsp_random_regular_density(y,r) 2 | %GSP_RANDOM_REGULAR_DENSITY The asymptotic density function of the graph Laplacian 3 | %eigenalues of a random regular graph 4 | % Usage: pdf=gsp_random_regular_density(y,r); 5 | % 6 | % Input parameters: 7 | % y : A vector of values at which the density will be evaluated. 8 | % r : The degree of every vertex in the graph. 9 | % Output parameters: 10 | % pdf : The values of the density function at the points y. 11 | % 12 | % 'gsp_random_regular_density(y,r)' computes the asymptotic density 13 | % function (for large $N$) of the combinatorial graph Laplacian 14 | % eigenvalues of a random regular graph with each vertex having degree $r$. 15 | % This density function is given by McKay's Law. 16 | % 17 | % 18 | 19 | % AUTHOR : David I Shuman. 20 | % TESTING: 21 | % REFERENCE: 22 | 23 | pdf=real((y>r-2*sqrt(r-1)).*(y 1 36 | G.coords = coords; 37 | end 38 | if nargin > 2 39 | G.plotting.limits = limits; 40 | end 41 | 42 | G.type = 'from weight'; 43 | 44 | G = gsp_graph_default_parameters(G); 45 | 46 | end 47 | -------------------------------------------------------------------------------- /graphs/gsp_logo.m: -------------------------------------------------------------------------------- 1 | function [G]=gsp_logo() 2 | %GSP_LOGO Initialize a graph with the GSP logo 3 | % Usage: G = gsp_logo(); 4 | % 5 | % Output parameters: 6 | % G : Graph structure. 7 | % 8 | % 'gsp_logo()' initializes a graph structure containing the GSP logo 9 | % 10 | % Example::: 11 | % 12 | % G = gsp_logo(); 13 | % gsp_plot_graph(G); 14 | % 15 | 16 | % Author : Johan Paratte 17 | % Test: 18 | 19 | load logogsp 20 | 21 | G.W = W; 22 | G.coords = coords; 23 | G.info.idx_g = idx_g; 24 | G.info.idx_s = idx_s; 25 | G.info.idx_p = idx_p; 26 | %G.plotting.vertex_color = [200 136/255.0 204/255.0]; 27 | %G.plotting.edge_color = [0 136/255.0 204/255.0]; 28 | G.plotting.vertex_size = 20; 29 | G.limits = [0 640 -400 0]; 30 | G = gsp_graph_default_parameters(G); 31 | 32 | end 33 | 34 | 35 | -------------------------------------------------------------------------------- /graphs/gsp_modified_path.m: -------------------------------------------------------------------------------- 1 | function [G]=gsp_modified_path(W) 2 | %GSP_MODIFIED_PATH Initialize a modified path graph 3 | % Usage: G = gsp_modified_path(W); 4 | % 5 | % Input parameters: 6 | % W : Vector of weights. 7 | % Output parameters: 8 | % G : Graph structure. 9 | % 10 | % 'gsp_modified_path(N)' initializes a path graph structure. The node are 11 | % connected like a path but with the weight given in W. The number of 12 | % node is the length of W + 1. 13 | % 14 | % Example::: 15 | % 16 | % W = ones(15,1); 17 | % W(8) = 0.1; 18 | % G = gsp_modified_path(W); 19 | % param.show_edges = 1; 20 | % gsp_plot_graph(G,param); 21 | % 22 | % See also: gsp_ring, gsp_path 23 | % 24 | 25 | % Author: Nathanael Perraudin 26 | % Date: 15 March 2014 27 | 28 | N=length(W)+1; 29 | G.N = N; 30 | % Create weighted adjancency matrix 31 | i_inds = [1:N-1,2:N]; 32 | j_inds = [2:N,1:N-1]; 33 | G.W = sparse(i_inds,j_inds,[W(:);W(:)],N,N); 34 | 35 | % Create coordinates 36 | d = zeros(N,1); 37 | for ii=2:N 38 | d(ii) = d(ii-1)+log(1+1./W(ii-1))/log(2); 39 | end 40 | 41 | G.coords = [d(:), zeros(N,1)]; 42 | G.limits = [-max(d)*0.05, max(d)*1.05, -1, 1]; 43 | 44 | G.type = 'modified path'; 45 | 46 | G = gsp_graph_default_parameters(G); 47 | 48 | end 49 | -------------------------------------------------------------------------------- /graphs/gsp_path.m: -------------------------------------------------------------------------------- 1 | function G = gsp_path(N) 2 | %GSP_PATH Initialize a path graph 3 | % Usage: G = gsp_path(N); 4 | % G = gsp_path(); 5 | % 6 | % Input parameters: 7 | % N : Number of vertices (default 32). 8 | % Output parameters: 9 | % G : Graph structure. 10 | % 11 | % 'gsp_path(N)' initializes a graph structure of a path graph. 12 | % 13 | % The path graph correspond the graph used for the DCT. See references 14 | % for more informations. 15 | % 16 | % Example::: 17 | % 18 | % G = gsp_path(16); 19 | % param.show_edges = 1; 20 | % gsp_plot_graph(G,param); 21 | % 22 | % See also: gsp_ring, gsp_graph 23 | % 24 | % References: strang1999discrete 25 | 26 | % Author David I Shuman, Nathanael Perraudin 27 | % Date: 15 March 2014 28 | 29 | if nargin < 1 30 | N = 16; 31 | end 32 | 33 | 34 | % Create weighted adjancency matrix 35 | i_inds = [1:N-1, 2:N]; 36 | j_inds = [2:N, 1:N-1]; 37 | G.W = sparse(i_inds, j_inds, ones(1,2*(N-1)), N, N); 38 | 39 | % Create coordinates 40 | G.coords = [(1:N)', zeros(N,1)]; 41 | G.plotting.limits = [0, N+1, -1, 1]; 42 | 43 | G.type = 'path'; 44 | 45 | G = gsp_graph_default_parameters(G); 46 | 47 | end 48 | -------------------------------------------------------------------------------- /graphs/gsp_random_regular.m: -------------------------------------------------------------------------------- 1 | function [ G ] = gsp_random_regular( N,k ) 2 | %GSP_RANDOM_REGULAR Create a random regualar graph 3 | % Usage: G = gsp_random_regular( N,k ) 4 | % G = gsp_random_regular( N ) 5 | % G = gsp_random_regular(); 6 | % 7 | % Input parameters: 8 | % N : Number of nodes (default 64) 9 | % k : Number of connection of each nodes (default 6) 10 | % Output parameters: 11 | % G : Graph structure. 12 | % 13 | % 'gsp_random_regular( N,k )' initializes create a graph structure 14 | % containing the weighted adjacency matrix (G.W), the number of vertices 15 | % (G.N) for a random regular graph. All edge weights are equal to 1. 16 | % 17 | % The random regular graph has the property that every nodes is connected 18 | % to 'k' other nodes. 19 | % 20 | % Example::: 21 | % 22 | % G = gsp_random_regular(100,3) 23 | % 24 | 25 | % Author : Nathanael Perraudin 26 | 27 | 28 | % Optional input arguments 29 | if nargin < 2 30 | k = 6; 31 | end 32 | 33 | if nargin < 1 34 | N = 64; 35 | end 36 | 37 | G.type = 'random_regular'; 38 | 39 | G.W = createRandRegGraph(N,k); % Use downloaded code 'createRandRegGraph' 40 | 41 | G = gsp_graph_default_parameters(G); 42 | 43 | end 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /graphs/gsp_random_ring.m: -------------------------------------------------------------------------------- 1 | function [G]=gsp_random_ring(N) 2 | %GSP_RANDOM_RING Initialize a random ring graph 3 | % Usage: G = gsp_random_ring(N); 4 | % G = gsp_random_ring(); 5 | % 6 | % Input parameters: 7 | % N : Number of vertices. (default 64) 8 | % Output parameters: 9 | % G : Graph structure. 10 | % 11 | % 'gsp_ring(N)' 12 | % weights are all equal to 1. 13 | % 14 | % Example::: 15 | % 16 | % G = gsp_random_ring(64); 17 | % param.show_edges = 1; 18 | % gsp_plot_graph(G,param); 19 | % 20 | 21 | % Author : Nathanael Perraudin 22 | 23 | if nargin < 1 24 | N = 64; 25 | end 26 | 27 | G.N=N; 28 | 29 | position = rand(N,1); 30 | position = sort(position,'ascend'); 31 | 32 | weight = N*diff(position); 33 | weightend = N * (1 + position(1) - position(end)); 34 | 35 | inds_j = (2:N)'; 36 | inds_i = (1:(N-1))'; 37 | 38 | G.W = sparse(inds_i, inds_j, weight, N,N); 39 | G.W(N,1) = weightend; 40 | 41 | G.W = G.W +G.W'; 42 | 43 | 44 | % Create coordinates 45 | G.coords=[(cos(position*2*pi)),(sin(position*2*pi))]; 46 | G.limits=[-1,1,-1,1]; 47 | 48 | 49 | G.type = 'random-ring'; 50 | 51 | 52 | G = gsp_graph_default_parameters(G); 53 | 54 | end 55 | -------------------------------------------------------------------------------- /graphs/gsp_separate_graph.m: -------------------------------------------------------------------------------- 1 | function [ Gout ] = gsp_separate_graph( G ) 2 | %GSP_SEPARATE_GRAPH Separate the graph G into disconnected components 3 | % Usage: [ Gout ] = gsp_separate_graph( G ) 4 | % 5 | % Input parameters: 6 | % G : Original graph 7 | % 8 | % Output parameters: 9 | % Gout: Cell array of graphs 10 | % 11 | 12 | % Author: Nathanael Perraudin 13 | % Date : Mai 2014 14 | 15 | % TODO: DO this operation better 16 | G = gsp_compute_fourier_basis(G); 17 | 18 | NG = sum(G.E < 1e-10); 19 | 20 | error('Not implemented'); 21 | 22 | Gout = 0; 23 | 24 | 25 | end 26 | 27 | -------------------------------------------------------------------------------- /graphs/gsp_update_coordinates.m: -------------------------------------------------------------------------------- 1 | function G = gsp_update_coordinates(G, coords) 2 | %GSP_UPDATE_COORDINATES Updates the coordinates of a graph structure 3 | % Usage: G = gsp_update_coordinates(G, coords); 4 | % 5 | % Input parameters 6 | % G : Graph 7 | % coords : New coordinates 8 | % 9 | % Output parameters 10 | % G : Output graph 11 | % 12 | % Update the coordinates of a graph structure 13 | % 14 | % See also: gsp_compute_coordinates 15 | 16 | % Authors : Dion O. E. Tzamarias 17 | % Date : 20/11/2015 18 | 19 | G.coords = coords; 20 | G = rmfield(G,'plotting'); 21 | G = gsp_graph_default_plotting_parameters(G); 22 | 23 | end -------------------------------------------------------------------------------- /graphs/gsp_update_weights.m: -------------------------------------------------------------------------------- 1 | function [ G ] = gsp_update_weights( G, W ) 2 | %GSP_UPDATE_WEIGHTS update weight matrix of the graph G 3 | % Usage: G = gsp_update_weight( G, W ); 4 | % 5 | % Input parameters 6 | % G : Graph 7 | % W : W new weight matrix 8 | % Output parameters 9 | % G : Graph 10 | % 11 | % This function will update the weight of graph and recompute the 12 | % Laplacian the new Laplacian. It will also recompute the value *G.lmax* 13 | % if it is present in the graph. 14 | % 15 | % For now this function does not recompute the Fourier basis! 16 | % 17 | % Example:: 18 | % 19 | % G.W = Wnew; 20 | % G = gsp_graph_default_parameters( G ); 21 | % 22 | % 23 | % See also: gsp_graph_default_parameters gsp_graph 24 | % 25 | 26 | % Author: Nathanael Perraudin 27 | % Date : 19.11.2014 28 | 29 | 30 | 31 | 32 | G.W = W; 33 | 34 | if isfield(G,'U') 35 | G = rmfield(G,'U'); 36 | end 37 | 38 | if isfield(G,'e') 39 | G =rmfield(G,'e'); 40 | end 41 | 42 | if isfield(G,'mu') 43 | G =rmfield(G,'mu'); 44 | end 45 | 46 | G = gsp_graph_default_parameters(G); 47 | 48 | if isfield(G,'lmax') 49 | G = rmfield(G,'lmax'); 50 | G = gsp_estimate_lmax(G); 51 | end 52 | 53 | 54 | end 55 | 56 | -------------------------------------------------------------------------------- /graphs/misc/david500.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/graphs/misc/david500.mat -------------------------------------------------------------------------------- /graphs/misc/david64.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/graphs/misc/david64.mat -------------------------------------------------------------------------------- /graphs/misc/logogsp.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/graphs/misc/logogsp.mat -------------------------------------------------------------------------------- /graphs/misc/minnesota.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/graphs/misc/minnesota.mat -------------------------------------------------------------------------------- /graphs/misc/rescale_center.m: -------------------------------------------------------------------------------- 1 | function r = rescale_center(x) 2 | %RESCALE_CENTER Rescaling the dataset 3 | 4 | N=size(x,2); 5 | x=x-repmat(mean(x,2),[1,N]); 6 | c=max(abs(x(:))); 7 | r=x/c; 8 | 9 | 10 | end 11 | 12 | -------------------------------------------------------------------------------- /gsp_install.m: -------------------------------------------------------------------------------- 1 | function [ ] = gsp_install( install_unlcobox ) 2 | %GSP_INSTALL Install third party software 3 | % Usage: gsp_install(); 4 | % 5 | % Input parameters 6 | % install_unlcobox : bool (1 to install the UNLocBoX) 7 | % 8 | % This function installs third party software. It require an internet 9 | % connection. 10 | % 11 | % You should install the UNLocBoX only if you are not using the 12 | % developement version. 13 | % 14 | % It will install the gaimc toolbox and compile some functions. 15 | % 16 | % See also: gsp_install_unlocbox 17 | 18 | 19 | global GLOBAL_gsppath; 20 | gsp_start; 21 | 22 | if nargin<1 23 | install_unlcobox = 0; 24 | end 25 | 26 | FS=filesep; 27 | 28 | fprintf('Install the GAIMC toolbox: ') 29 | try 30 | zipfilename = 'http://www.mathworks.com/matlabcentral/fileexchange/submissions/24134/v/1/download/zip'; 31 | outputdir = [GLOBAL_gsppath,FS,'3rdparty',FS,'gaimc']; 32 | unzip(zipfilename,outputdir) 33 | fprintf('Installation sucessfull!\n\n') 34 | catch 35 | warning('Could not install GAIMC') 36 | end 37 | 38 | if install_unlcobox 39 | gsp_install_unlocbox 40 | else 41 | fprintf('The function did not install the UNLocBoX. To do it, run: gsp_install_unlcobox') 42 | end 43 | 44 | gsp_make; 45 | 46 | 47 | end 48 | 49 | -------------------------------------------------------------------------------- /gsp_install_unlocbox.m: -------------------------------------------------------------------------------- 1 | function [ ] = gsp_install_unlocbox( ) 2 | %GSP_INSTALL_UNLOCBOX Install the UNLocBoX from the web 3 | % Usage: gsp_install_unlocbox(); 4 | % 5 | % This function installs the UNLocBoX. It require an internet connection. 6 | % 7 | global GLOBAL_gsppath; 8 | 9 | FS=filesep; 10 | 11 | fprintf('Install the UNLocBoX: ') 12 | try 13 | outputdir = [GLOBAL_gsppath,FS,'3rdparty']; 14 | if isunix 15 | tarfilename = webread('https://github.com/epfl-lts2/unlocbox/releases/download/1.7.4/unlocbox-1.7.4.tar.gz'); 16 | untar(tarfilename,outputdir) 17 | else 18 | zipfilename = webread('https://github.com/epfl-lts2/unlocbox/releases/download/1.7.4/unlocbox-1.7.4.zip'); 19 | unzip(zipfilename,outputdir) 20 | end 21 | fprintf('Installation sucessfull!\n\n') 22 | catch 23 | warning('Could not install the UNLocBox') 24 | end 25 | 26 | 27 | end 28 | -------------------------------------------------------------------------------- /gsp_make.m: -------------------------------------------------------------------------------- 1 | function [ ] = gsp_make( ) 2 | %GSP_MAKE Compile the necessary toolboxes for the gspbox 3 | % Usage: gsp_make(); 4 | % 5 | % This function compile the routine for the gspbox:: 6 | % 7 | % gsp_make(); 8 | % 9 | 10 | % TODO: clean this function! 11 | 12 | gsp_start; 13 | global GLOBAL_gsppath; 14 | 15 | FS=filesep; 16 | 17 | test = 0 ; 18 | paths = { } ; 19 | gsp_path = GLOBAL_gsppath ; 20 | paths = add_to_path (paths, gsp_path) ; 21 | 22 | % compile and install AMD 23 | try 24 | paths = add_to_path (paths, [gsp_path,FS,'3rdparty',FS,'LDL',FS,'AMD',FS,'MATLAB']) ; 25 | amd_make ; 26 | catch me 27 | disp (me.message) ; 28 | fprintf ('AMD not installed\n') ; 29 | end 30 | 31 | % compile and install LDL 32 | try 33 | paths = add_to_path (paths, [gsp_path,FS,'3rdparty',FS,'LDL',FS,'LDL',FS,'MATLAB']) ; 34 | ldl_make ; 35 | if test 36 | ldlmain2 ; 37 | ldltest ; 38 | end 39 | catch me 40 | disp (me.message) ; 41 | fprintf ('LDL not installed\n') ; 42 | end 43 | 44 | cd (gsp_path) 45 | 46 | 47 | end 48 | 49 | function paths = add_to_path (paths, newpath) 50 | % add a path 51 | cd (newpath) ; 52 | addpath (newpath) ; 53 | paths = [paths { newpath } ] ; 54 | end 55 | -------------------------------------------------------------------------------- /gsp_start.m: -------------------------------------------------------------------------------- 1 | function gsp_start() 2 | %GSP_START Initialize the toolbox 3 | % Usage: gsp_start(); 4 | % 5 | % Initialisation script for the GSPBox. This script add the different 6 | % path needed to run the toolbox. 7 | % 8 | % References: perraudin2014gspbox 9 | % 10 | 11 | 12 | % Author: Nathanael Perraudin 13 | % Date: 14 March 2014 14 | 15 | 16 | %% adding dependency 17 | 18 | global GLOBAL_gsppath; 19 | GLOBAL_gsppath = fileparts(mfilename('fullpath')); 20 | 21 | 22 | addpath(genpath(GLOBAL_gsppath)); 23 | 24 | % Load the version number 25 | bp=[GLOBAL_gsppath,filesep]; 26 | [FID, MSG] = fopen ([bp,'gspbox_version'],'r'); 27 | if FID == -1 28 | error(MSG); 29 | else 30 | gspbox_version = fgetl (FID); 31 | fclose(FID); 32 | end 33 | 34 | banner = sprintf(['GSPBox version %s. Copyright 2013-2015 LTS2-EPFL,\n',... 35 | 'by Nathanael Perraudin, Johan Paratte, David Shuman ',... 36 | 'and Vassilis Kalofolias'], ... 37 | gspbox_version); 38 | 39 | % display banner 40 | disp(banner); 41 | 42 | 43 | end 44 | -------------------------------------------------------------------------------- /gspbox_version: -------------------------------------------------------------------------------- 1 | 0.7.6 2 | -------------------------------------------------------------------------------- /imageprocessing/Contents.m: -------------------------------------------------------------------------------- 1 | % GSPBOX - Image Processing 2 | % 3 | % Utils 4 | % gsp_patch_graph - Create a graph connecting image pixels 5 | % 6 | % For help, bug reports, suggestions etc. please send email to 7 | % gspbox 'dash' support 'at' groupes 'dot' epfl 'dot' ch 8 | % 9 | -------------------------------------------------------------------------------- /learn_graph/Contents.m: -------------------------------------------------------------------------------- 1 | % GSPBOX - Graph learning 2 | % 3 | % Optimization model - Learning from smooth signal 4 | % gsp_learn_graph_log_degrees - Learn weighted adjacency matrix from pairwise distances using negative log prior on nodes degrees 5 | % gsp_learn_graph_l2_degrees - Learn weighted adjacency matrix from pairwise distances using l2 prior on nodes degrees 6 | % 7 | % Measure of graph quality 8 | % gsp_learn_tcer - Compute the total cumulative energy residual. 9 | % 10 | % For help, bug reports, suggestions etc. please send email to 11 | % gspbox 'dash' support 'at' groupes 'dot' epfl 'dot' ch 12 | % 13 | 14 | -------------------------------------------------------------------------------- /learn_graph/gsp_demo_learn_graph_parameters.m: -------------------------------------------------------------------------------- 1 | n = 200; 2 | 3 | %% 4 | X = 5 * rand(2, n); 5 | Z = gsp_distanz(X).^2; 6 | 7 | %% first way to control sparsity (Kalofolias 2016) 8 | % this is easy to use when we solve an optimization problem that alternates 9 | % between graph learning and solving w.r.t. X with fixed graph 10 | 11 | alpha = .6; % bigger weights 12 | beta = .5; % smaller big weights (more dense) 13 | W1 = gsp_learn_graph_log_degrees(Z, alpha, beta); 14 | 15 | %% second way to control sparsity (Kalofolias, Vandergheynst 2017) 16 | % this is easy to use for controling sparsity. For a sparser graph just use 17 | % a bigger theta. Also in general converges faster with the default 18 | % stepsize. 19 | theta = 1/sqrt(alpha*beta); % controls sparsity 20 | delta = sqrt(alpha/beta); % controls magnitude 21 | W2 = delta * gsp_learn_graph_log_degrees(theta * Z, 1, 1); 22 | 23 | %max(W2(:)) 24 | %max(W1(:)) 25 | 26 | %% the two ways are equivalent: 27 | % Clean numerical error 28 | W1(W1<1e-4)=0; 29 | W2(W2<1e-4)=0; 30 | fprintf('Relative error between W1 and W2: %e\n', norm(W1-W2, 'fro')/norm(W1, 'fro')); 31 | 32 | %% Plot graph 33 | % figure; spy(W1); title('Learned adjacency matrix'); 34 | % figure; spy(W2) 35 | figure; gsp_plot_graph(gsp_graph(W1, X')); title('Learned graph'); 36 | -------------------------------------------------------------------------------- /mat2doc/conf.py: -------------------------------------------------------------------------------- 1 | plotengine = 'matlab' 2 | author = 'Nathanael Perraudin, David Shuman, Johan Paratte' 3 | version = "0.3.1" 4 | versionfile = "gspbox_version" 5 | year = "2014" 6 | 7 | outputdir = '/tmp' 8 | 9 | try: 10 | from conf_local import * 11 | except: 12 | raise 13 | -------------------------------------------------------------------------------- /mat2doc/conf_local.py.template: -------------------------------------------------------------------------------- 1 | outputdir = 'your output path for mat2doc' 2 | -------------------------------------------------------------------------------- /mat2doc/copyrightplate: -------------------------------------------------------------------------------- 1 | This program is free software: you can redistribute it and/or modify 2 | it under the terms of the GNU General Public License as published by 3 | the Free Software Foundation, either version 3 of the License, or 4 | (at your option) any later version. 5 | 6 | This program is distributed in the hope that it will be useful, 7 | but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 | GNU General Public License for more details. 10 | 11 | You should have received a copy of the GNU General Public License 12 | along with this program. If not, see . 13 | -------------------------------------------------------------------------------- /mat2doc/html/conf.py: -------------------------------------------------------------------------------- 1 | fext='.html' 2 | urlbase='#BASEURL#/doc/' 3 | urlext='.html' 4 | widthstr='' 5 | imagetype='png' 6 | -------------------------------------------------------------------------------- /mat2doc/html/include/docnav.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mat2doc/ignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/mat2doc/ignore -------------------------------------------------------------------------------- /mat2doc/mat/conf.py: -------------------------------------------------------------------------------- 1 | fext='.m' 2 | urlbase='https://epfl-lts2.github.io/gspbox-html/doc' 3 | urlext='.html' 4 | -------------------------------------------------------------------------------- /mat2doc/mat/header.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) 2013-2016 Nathanael Perraudin, Johan Paratte, David I Shuman. 2 | % This file is part of GSPbox version {VERSION} 3 | % 4 | % This program is free software: you can redistribute it and/or modify 5 | % it under the terms of the GNU General Public License as published by 6 | % the Free Software Foundation, either version 3 of the License, or 7 | % (at your option) any later version. 8 | % 9 | % This program is distributed in the hope that it will be useful, 10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | % GNU General Public License for more details. 13 | % 14 | % You should have received a copy of the GNU General Public License 15 | % along with this program. If not, see . 16 | 17 | % If you use this toolbox please kindly cite 18 | % N. Perraudin, J. Paratte, D. Shuman, V. Kalofolias, P. Vandergheynst, 19 | % and D. K. Hammond. GSPBOX: A toolbox for signal processing on graphs. 20 | % ArXiv e-prints, Aug. 2014. 21 | % http://arxiv.org/abs/1408.5781 22 | -------------------------------------------------------------------------------- /mat2doc/nodocs: -------------------------------------------------------------------------------- 1 | 3rdparty/* -------------------------------------------------------------------------------- /mat2doc/php/conf.py: -------------------------------------------------------------------------------- 1 | fext='.php' 2 | urlbase='/gsp/doc' 3 | urlext='.php' 4 | widthstr='' 5 | imagetype='png' 6 | includedir='../include' 7 | -------------------------------------------------------------------------------- /mat2doc/publish_local.py.template: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | project = 'the root path for the gsp' 4 | 5 | # Configure HTML placement at remote server 6 | user = 'user for publication on sourceforge' 7 | outputdirweb= 'local site web directory' 8 | 9 | # -------- Configuration of mat2doc ------------ 10 | mat2docpath='location of mat2doc' 11 | 12 | # Configure matlab paths 13 | unlocxpath = 'path of unlocx toolbox'; 14 | gsppath = 'path of gsp toolbox'; 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /mat2doc/publishfunctions.py: -------------------------------------------------------------------------------- 1 | import os 2 | import commands 3 | 4 | 5 | def dos2unix(path): 6 | for root, dirs, files in os.walk(path, topdown=False): 7 | for name in files: 8 | name = os.path.join(root, name) 9 | if 'ASCII' in commands.getoutput('file '+name): 10 | os.system('dos2unix '+name) 11 | 12 | 13 | def unix2dos(path): 14 | for root, dirs, files in os.walk(path, topdown=False): 15 | for name in files: 16 | name = os.path.join(root, name) 17 | if 'ASCII' in commands.getoutput('file '+name): 18 | os.system('unix2dos '+name) 19 | -------------------------------------------------------------------------------- /mat2doc/tex/conf.py: -------------------------------------------------------------------------------- 1 | fext='.tex' 2 | urlbase='https://epfl-lts2.github.io/gspbox-html/doc' 3 | urlext='html' 4 | widthstr='60ex' 5 | imagetype='eps' 6 | includeoutput=True -------------------------------------------------------------------------------- /mat2doc/tex/frontpage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/mat2doc/tex/frontpage.png -------------------------------------------------------------------------------- /mat2doc/tex/main/Makefile: -------------------------------------------------------------------------------- 1 | PDFNAME = gspbox.pdf 2 | 3 | all: $(PDFNAME) 4 | 5 | %.pdf: %.tex Makefile $(shell ls *.bib) 6 | pslatex $* 7 | -bibtex $* 8 | pslatex $* 9 | pslatex $* 10 | dvips -t A4 $*.dvi 11 | ps2pdf $*.ps $*.pdf 12 | 13 | 14 | %.pdf: %.lyx Makefile $(shell ls *.bib) 15 | lyx -f --export pdf2 $< 16 | 17 | %.tex: %.lyx Makefile $(shell ls *.bib) 18 | lyx -f --export latex $< 19 | 20 | texclean: 21 | -rm *.aux *.bbl *.blg *.log *.dvi *.out 22 | 23 | clean: texclean 24 | -rm $(PDFNAME) 25 | 26 | .PHONY: all texclean clean 27 | -------------------------------------------------------------------------------- /mat2doc/tex/main/frontpage.m: -------------------------------------------------------------------------------- 1 | %FRONTPAGE 2 | 3 | close all; 4 | clear; 5 | 6 | paramplot.save = 1; 7 | paramplot.savefig = 0; 8 | paramplot.pathfigure = [fileparts(mfilename('fullpath')),'/']; 9 | paramplot.eps = 1; 10 | 11 | 12 | 13 | G = gsp_logo; 14 | G.plotting.vertex_size = 200; 15 | % G.plotting.edge_color = [200/255 136/255.0 204/255.0]; 16 | G.plotting.edge_color = [0.5 0.5 0.5]; 17 | G.plotting.edge_width = 2; 18 | f = zeros(G.N,1); 19 | f(G.info.idx_g) = -1; 20 | f(G.info.idx_s) = 1; 21 | f(G.info.idx_p) = 0; 22 | f = f + 0.2*randn(G.N,1); 23 | 24 | figure; 25 | paramplot.position = [100,100,1200,600]; 26 | gsp_plot_signal(G,f) 27 | colorbar off 28 | gsp_plotfig('frontpage',paramplot) 29 | 30 | -------------------------------------------------------------------------------- /operators/gsp_gwft_frame_matrix.m: -------------------------------------------------------------------------------- 1 | function [ F ] = gsp_gwft_frame_matrix(G,g,param ) 2 | %GSP_GWFT_FRAME_MATRIX Create the matrix of the GWFT frame 3 | % Usage: F = gsp_fast_gwft(G, g param ); 4 | % F = gsp_fast_gwft(G,g); 5 | % 6 | % Input parameters: 7 | % G : Graph 8 | % g : window 9 | % param : Structure of optional parameter 10 | % Output parameters: 11 | % F : Frame 12 | % 13 | % This function compute the graph windowed Fourier transform frame. In 14 | % might require a lot of memory. we create a matrix of size N^2*N. 15 | % 16 | % *param* a Matlab structure containing the following fields: 17 | % 18 | % * *param.verbose* : 0 no log, 1 print main steps, 2 print all steps. 19 | % By default, it is 1. 20 | 21 | 22 | 23 | % AUTHOR : Nathanael Perraudin 24 | % TESTING: test_fast_gwft 25 | 26 | % Optional input arguments 27 | if nargin<4, param=struct; end 28 | if ~isfield(param, 'verbose'), param.verbose=1 ; end 29 | 30 | if param.verbose && G.N>256 31 | warning('Create a big matrix, you can use other methods.'); 32 | end 33 | 34 | % Compute the translate of g 35 | ghat=G.U'*g; 36 | Ftrans=sqrt(G.N)*G.U*(repmat(ghat,1,G.N).*G.U'); 37 | 38 | F=gsp_repmatline(Ftrans,1,G.N) .* ... 39 | repmat(repmat(1./G.U(:,1),1,G.N).*G.U,1,G.N); 40 | 41 | 42 | end 43 | 44 | -------------------------------------------------------------------------------- /operators/gsp_ijft.m: -------------------------------------------------------------------------------- 1 | function X = gsp_ijft(G,Xhat) 2 | % GSP_IJFT Compute the inverse Joint time-vertex Fourier Transform 3 | % Usage: X = gsp_ijft(G,Xhat) 4 | % 5 | % Input parameters: 6 | % G : Time-Vertex graph structure 7 | % Xhat : Time-Vertex Fourier coefficients 8 | % Output parameters: 9 | % X : Time-Vertex signal 10 | % 11 | % Compute the inverse Joint time-vertex Fourier Transform 12 | 13 | % Author : Francesco Grassi 14 | % Date : September 2016 15 | 16 | 17 | if isempty(G.jtv.NFFT) 18 | NFFT = size(Xhat,2); 19 | else 20 | NFFT = G.jtv.NFFT; 21 | end 22 | 23 | normalize = sqrt(NFFT); 24 | 25 | switch G.jtv.transform 26 | case 'dft' 27 | X = ifft(gsp_igft(G,Xhat),NFFT,2)*normalize; 28 | case 'dct' 29 | if size(Xhat,3)>1 30 | error('Not implemented') 31 | end 32 | X = idct(gsp_igft(G,Xhat).',NFFT).'; 33 | otherwise 34 | error('Unknown transform'); 35 | end 36 | 37 | 38 | end 39 | -------------------------------------------------------------------------------- /operators/gsp_itft.m: -------------------------------------------------------------------------------- 1 | function X = gsp_itft(G,Xdot) 2 | % GSP_ITFT Compute the inverse Time Fourier Transform of a time-vertex signal 3 | % Usage: X = gsp_itft(G,Xhat) 4 | % 5 | % Input parameters: 6 | % G : Time-Vertex graph structure 7 | % Xdot : Time-Vertex Time Fourier Coefficients 8 | % Output parameters: 9 | % X : Time-Vertex signal 10 | % Compute the inverse Time Fourier Transform of a time-vertex signal 11 | 12 | % Author : Francesco Grassi 13 | % Date : September 2016 14 | 15 | 16 | NFFT = G.jtv.NFFT; 17 | 18 | if isempty(NFFT) 19 | NFFT = size(Xdot,2); 20 | end; 21 | 22 | 23 | normalize = sqrt(NFFT); 24 | 25 | switch G.jtv.transform 26 | case 'dft' 27 | X = ifft(Xdot,NFFT,2)*normalize; 28 | if sum(abs(vec(imag(X)))) < 1e-13 *norm(X(:)) 29 | X = real(X); 30 | end 31 | case 'dct' 32 | X = idct(Xdot.',NFFT).'; 33 | otherwise 34 | error('Unknown transform'); 35 | end 36 | 37 | 38 | end 39 | -------------------------------------------------------------------------------- /operators/gsp_kron_reduction.m: -------------------------------------------------------------------------------- 1 | function Gnew = gsp_kron_reduction( G,ind ) 2 | %GSP_KRON_REDUCTION See gsp_kron_reduce 3 | 4 | Gnew = gsp_kron_reduce(G,ind); 5 | 6 | 7 | end 8 | 9 | -------------------------------------------------------------------------------- /operators/gsp_localize.m: -------------------------------------------------------------------------------- 1 | function [ gt ] = gsp_localize(G, g, n,param) 2 | %GSP_LOCALIZE Localize a kernel g to the node n 3 | % Usage: gt = gsp_localize(G, g, n); 4 | % 5 | % Input parameters 6 | % G : Graph 7 | % g : kernel (or filterbank) 8 | % n : Indices of vertex (int) 9 | % param: Optional parameters 10 | % Output parameters 11 | % gt : translate signal 12 | % 13 | % This function localize the kernel $g$ onto the node i. If *g* 14 | % is a cell array, the localization will be done to each filter. 15 | % 16 | 17 | % Author: Nathanael Perraudin 18 | % Date : 28 July 2014 19 | 20 | if nargin <4 21 | param = struct; 22 | end 23 | 24 | f = zeros(G.N,numel(n)); 25 | for ii = 1:numel(n) 26 | f(n(ii),ii) = 1; 27 | end 28 | gt = gsp_filter_analysis(G,g,f,param); 29 | 30 | end 31 | 32 | -------------------------------------------------------------------------------- /operators/gsp_modulate.m: -------------------------------------------------------------------------------- 1 | function [ fm ] = gsp_modulate( G,f,k ) 2 | %GSP_MODULATE Generalized modulation of the signal f to the frequency k 3 | % Usage: fm = gsp_modulate( G,f,k ); 4 | % 5 | % Input parameters 6 | % G : Graph 7 | % f : Signal (column) 8 | % k : Indices of frequencies (int) 9 | % Output parameters 10 | % fm : Modulated signal 11 | % 12 | % This function modulate the column vector *f* onto the node i. If f is a 13 | % matrix, the modulation will be applicated to each column. 14 | % 15 | 16 | % Author: Nathanael Perraudin 17 | % Date : 09.12.2013 18 | 19 | nt = size(f,2); 20 | 21 | fm = sqrt(G.N)*repmat(f,1,nt).*repmat(G.U(:,k+1),1,nt); 22 | 23 | 24 | end 25 | -------------------------------------------------------------------------------- /operators/gsp_tft.m: -------------------------------------------------------------------------------- 1 | function Xdot = gsp_tft(G,X) 2 | % GSP_TFT Compute the time Fourier Transform of a time-vertex signal 3 | % Usage: X = gsp_tft(G,Xhat) 4 | % 5 | % Input parameters: 6 | % G : Time-Vertex graph structure 7 | % X : Time-Vertex signal 8 | % Output parameters: 9 | % Xdot : Time-Vertex Time Fourier Coefficients 10 | % 11 | % Compute the time Fourier Transform of a time-vertex signal 12 | 13 | % Author : Francesco Grassi 14 | % Date : September 2016 15 | 16 | 17 | NFFT = G.jtv.NFFT; 18 | 19 | if isempty(NFFT) 20 | NFFT = size(X,2); 21 | end; 22 | 23 | 24 | normalize = 1/sqrt(NFFT); 25 | 26 | switch G.jtv.transform 27 | case 'dft' 28 | Xdot = fft(X,NFFT,2)*normalize; 29 | case 'dct' 30 | if size(X,3)>1 31 | Xdot = ipermute(dct(permute(X,[2 1 3]),NFFT),[2 1 3]); 32 | end 33 | Xdot = dct(X.',NFFT).'; 34 | 35 | otherwise 36 | error('Unknown transform'); 37 | end 38 | -------------------------------------------------------------------------------- /plotting/Contents.m: -------------------------------------------------------------------------------- 1 | % GSPBOX - Plotting 2 | % 3 | % Graph 4 | % gsp_plot_graph - Plot a graph 5 | % gsp_plot_signal - Plot a graph signal 6 | % 7 | % Time_Vertex 8 | % gsp_plot_jtv_signal - Plot a timve-vertex signal 9 | % gsp_plot_jft - Plot the joint time-vertex Fourier transform of a signal 10 | % gsp_plot_jtv_filter - Plot a cell array of time-vertex filters 11 | % 12 | % Other 13 | % gsp_plot_signal_spectral - Plot a signal in the specral domain 14 | % gsp_plot_sgram - Plot a spectrogram 15 | % gsp_plot_filter - Plot a cell array of filters 16 | % 17 | % For help, bug reports, suggestions etc. please send email to 18 | % gspbox 'dash' support 'at' groupes 'dot' epfl 'dot' ch 19 | % 20 | 21 | -------------------------------------------------------------------------------- /pointsclouds/Contents.m: -------------------------------------------------------------------------------- 1 | % GSPBOX - Pointclouds 2 | % 3 | % Generate pointclouds 4 | % gsp_twospirals - Generate two spirals 5 | % 6 | % Utils 7 | % gsp_pointcloud - Load a pointcloud model and returns the set of points 8 | % 9 | % For help, bug reports, suggestions etc. please send email to 10 | % gspbox 'dash' support 'at' groupes 'dot' epfl 'dot' ch 11 | % 12 | -------------------------------------------------------------------------------- /pointsclouds/airfoil.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/pointsclouds/airfoil.mat -------------------------------------------------------------------------------- /pointsclouds/bunny.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/pointsclouds/bunny.mat -------------------------------------------------------------------------------- /pointsclouds/to_be_included/clusterincluster.m: -------------------------------------------------------------------------------- 1 | function data = clusterincluster(N, r1, r2, w1, w2, arms) 2 | 3 | if nargin < 1 4 | N = 1000; 5 | end 6 | if nargin < 2 7 | r1 = 1; 8 | end 9 | if nargin < 3 10 | r2 = 5*r1; 11 | end 12 | if nargin < 4 13 | w1 = 0.8; 14 | end 15 | if nargin < 5 16 | w2 = 1/3; 17 | end 18 | if nargin < 6 19 | arms = 64; 20 | end 21 | 22 | data = []; 23 | 24 | N1 = floor(N/2); 25 | N2 = N-N1; 26 | 27 | phi1 = rand(N1,1) * 2 * pi; 28 | dist1 = r1 + randint(N1,1,3)/3 * r1 * w1; 29 | d1 = [dist1 .* cos(phi1) dist1 .* sin(phi1) zeros(N1,1)]; 30 | 31 | perarm = round(N2/arms); 32 | N2 = perarm * arms; 33 | radperarm = (2*pi)/arms; 34 | phi2 = ((1:N2) - mod(1:N2, perarm))/perarm * (radperarm); 35 | phi2 = phi2'; 36 | dist2 = r2 * (1 - w2/2) + r2 * w2 * mod(1:N2, perarm)'/perarm; 37 | d2 = [dist2 .* cos(phi2) dist2 .* sin(phi2) ones(N2,1)]; 38 | 39 | data = [d1;d2]; 40 | 41 | scatter(data(:,1), data(:,2), 20, data(:,3)); axis square; 42 | end -------------------------------------------------------------------------------- /pointsclouds/to_be_included/corners.m: -------------------------------------------------------------------------------- 1 | function data = corners(N, scale, gapwidth, cornerwidth) 2 | 3 | if nargin < 1 4 | N = 1000; 5 | end 6 | if mod(N,8) ~= 0 7 | N = round(N/8) * 8; 8 | end 9 | 10 | if nargin < 2 11 | scale = 10; 12 | end 13 | if nargin < 3 14 | gapwidth = 2; 15 | end 16 | if nargin < 4 17 | cornerwidth = 2; 18 | end 19 | 20 | perCorner = N/4; 21 | 22 | xplusmin = [ones(perCorner,1); -1*ones(perCorner,1); ones(perCorner,1); -1*ones(perCorner,1)]; 23 | yplusmin = [ones(perCorner,1); -1*ones(2*perCorner,1); ones(perCorner,1)]; 24 | 25 | horizontal = [xplusmin(1:2:end) * gapwidth + xplusmin(1:2:end) * scale .* rand(N/2,1), ... 26 | yplusmin(1:2:end) * gapwidth + cornerwidth * yplusmin(1:2:end) .* rand(N/2,1), ... 27 | floor((0:N/2-1)'/(perCorner*.5))]; 28 | 29 | vertical = [xplusmin(2:2:end) * gapwidth + cornerwidth * xplusmin(2:2:end) .* rand(N/2,1), ... 30 | yplusmin(2:2:end) * gapwidth + yplusmin(2:2:end) * scale .* rand(N/2,1), ... 31 | floor((0:N/2-1)'/(perCorner*.5))]; 32 | 33 | data= [horizontal; vertical]; 34 | 35 | end -------------------------------------------------------------------------------- /pointsclouds/to_be_included/crescentfullmoon.m: -------------------------------------------------------------------------------- 1 | function data = crescentfullmoon(N, r1, r2, r3) 2 | 3 | if nargin < 1 4 | N = 1000; 5 | end 6 | if mod(N,4) ~= 0 7 | N = round(N/4) * 4; 8 | end 9 | if nargin < 2 10 | r1 = 5; 11 | end 12 | if nargin < 3 13 | r2 = 10; 14 | end 15 | if nargin < 4 16 | r3 = 15; 17 | end 18 | 19 | N1 = N/4; 20 | N2 = N-N1; 21 | 22 | phi1 = rand(N1,1) * 2 * pi; 23 | R1 = sqrt(rand(N1, 1)); 24 | moon = [cos(phi1) .* R1 * r1 sin(phi1) .* R1 * r1 zeros(N1,1)]; 25 | 26 | d = r3 - r2; 27 | phi2 = pi + rand(N2,1) * pi; 28 | R2 = sqrt(rand(N2,1)); 29 | crescent = [cos(phi2) .* (r2 + R2 * d) sin(phi2) .* (r2 + R2 * d) ones(N2,1)]; 30 | 31 | data = [moon; crescent]; -------------------------------------------------------------------------------- /pointsclouds/to_be_included/datasets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/pointsclouds/to_be_included/datasets.png -------------------------------------------------------------------------------- /pointsclouds/to_be_included/datasetsdemo.m: -------------------------------------------------------------------------------- 1 | % See http://stackoverflow.com/questions/16146599/create-artificial-data-in-matlab 2 | % and http://stackoverflow.com/questions/5837572/generate-a-random-point-within-a-circle-uniformly 3 | 4 | figure; 5 | hold on; 6 | dotsize = 12; 7 | colormap([1 0 .5; % magenta 8 | 0 0 .8; % blue 9 | 0 .6 0; % dark green 10 | .3 1 0]); % bright green 11 | 12 | subplot(231); 13 | data = twospirals(); 14 | scatter(data(:,1), data(:,2), dotsize, data(:,3)); axis equal; 15 | title('Two spirals'); 16 | 17 | subplot(232); 18 | data = clusterincluster(); 19 | scatter(data(:,1), data(:,2), dotsize, data(:,3)); axis equal; 20 | title('Cluster in cluster'); 21 | 22 | subplot(233); 23 | data = corners(); 24 | scatter(data(:,1), data(:,2), dotsize, data(:,3)); axis equal; 25 | title('Corners'); 26 | 27 | subplot(234); 28 | data = halfkernel(); 29 | scatter(data(:,1), data(:,2), dotsize, data(:,3)); axis equal; 30 | title('Half-kernel'); 31 | 32 | subplot(235); 33 | data = crescentfullmoon(); 34 | scatter(data(:,1), data(:,2), dotsize, data(:,3)); axis equal; 35 | title('Crescent & Full Moon'); 36 | 37 | subplot(236); 38 | data = outlier(); 39 | scatter(data(:,1), data(:,2), dotsize, data(:,3)); axis equal; 40 | title('Outlier'); -------------------------------------------------------------------------------- /pointsclouds/to_be_included/halfkernel.m: -------------------------------------------------------------------------------- 1 | function data = halfkernel(N, minx, r1, r2, noise, ratio) 2 | 3 | if nargin < 1 4 | N = 1000; 5 | end 6 | if mod(N,2) ~= 0 7 | N = N + 1; 8 | end 9 | if nargin < 2 10 | minx = -20; 11 | end 12 | if nargin < 3 13 | r1 = 20; 14 | end 15 | if nargin < 4 16 | r2 = 35; 17 | end 18 | if nargin < 5 19 | noise = 4; 20 | end 21 | if nargin < 6 22 | ratio = 0.6; 23 | end 24 | 25 | phi1 = rand(N/2,1) * pi; 26 | inner = [minx + r1 * sin(phi1) - .5 * noise + noise * rand(N/2,1) r1 * ratio * cos(phi1) - .5 * noise + noise * rand(N/2,1) ones(N/2,1)]; 27 | 28 | phi2 = rand(N/2,1) * pi; 29 | outer = [minx + r2 * sin(phi2) - .5 * noise + noise * rand(N/2,1) r2 * ratio * cos(phi2) - .5 * noise + noise * rand(N/2,1) zeros(N/2,1)]; 30 | 31 | data = [inner; outer]; 32 | end -------------------------------------------------------------------------------- /pointsclouds/to_be_included/outlier.m: -------------------------------------------------------------------------------- 1 | function data = outlier(N, r, dist, outliers, noise) 2 | 3 | if nargin < 1 4 | N = 600; 5 | end 6 | if nargin < 2 7 | r = 20; 8 | end 9 | if nargin < 3 10 | dist = 30; 11 | end 12 | if nargin < 4 13 | outliers = 0.04; 14 | end 15 | if nargin < 5 16 | noise = 5; 17 | end 18 | 19 | N1 = round(N * (.5-outliers)); 20 | N2 = N1; 21 | N3 = round(N * outliers); 22 | N4 = N-N1-N2-N3; 23 | 24 | phi1 = rand(N1,1) * pi; 25 | r1 = sqrt(rand(N1,1))*r; 26 | P1 = [-dist + r1.*sin(phi1) r1.*cos(phi1) zeros(N1,1)]; 27 | 28 | phi2 = rand(N2,1) * pi; 29 | r2 = sqrt(rand(N2,1))*r; 30 | P2 = [dist - r2.*sin(phi2) r2.*cos(phi2) 3*ones(N2,1)]; 31 | 32 | P3 = [rand(N3,1)*noise dist+rand(N3,1)*noise 2*ones(N3,1)]; 33 | 34 | P4 = [rand(N4,1)*noise -dist+rand(N4,1)*noise ones(N4,1)]; 35 | 36 | data = [P1; P2; P3; P4]; 37 | 38 | end -------------------------------------------------------------------------------- /pointsclouds/to_be_included/twospirals.m: -------------------------------------------------------------------------------- 1 | function data = twospirals(N, degrees, start, noise) 2 | % Generate "two spirals" dataset with N instances. 3 | % degrees controls the length of the spirals 4 | % start determines how far from the origin the spirals start, in degrees 5 | % noise displaces the instances from the spiral. 6 | % 0 is no noise, at 1 the spirals will start overlapping 7 | 8 | if nargin < 1 9 | N = 2000; 10 | end 11 | if nargin < 2 12 | degrees = 570; 13 | end 14 | if nargin < 3 15 | start = 90; 16 | end 17 | if nargin < 5 18 | noise = 0.2; 19 | end 20 | 21 | deg2rad = (2*pi)/360; 22 | start = start * deg2rad; 23 | 24 | N1 = floor(N/2); 25 | N2 = N-N1; 26 | 27 | n = start + sqrt(rand(N1,1)) * degrees * deg2rad; 28 | d1 = [-cos(n).*n + rand(N1,1)*noise sin(n).*n+rand(N1,1)*noise zeros(N1,1)]; 29 | 30 | n = start + sqrt(rand(N1,1)) * degrees * deg2rad; 31 | d2 = [cos(n).*n+rand(N2,1)*noise -sin(n).*n+rand(N2,1)*noise ones(N2,1)]; 32 | 33 | data = [d1;d2]; 34 | end -------------------------------------------------------------------------------- /pointsclouds/two_moons.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-lts2/gspbox/a7d9aac5e239f1bcb37a9bb09998cc161be2732f/pointsclouds/two_moons.mat -------------------------------------------------------------------------------- /prox/Contents.m: -------------------------------------------------------------------------------- 1 | % GSPBOX - Proximal operators and other solvers 2 | % 3 | % Gradient based proximal operators 4 | % gsp_prox_tv - Prox TV on graphs 5 | % gsp_prox_tik - Tikhonov proximal operator on graphs 6 | % 7 | % Filterbank based proximal operators 8 | % gsp_proj_b2_filterbank - Projection on the B2 ball 9 | % gsp_prox_l2_filterbank - L2 norm proximal operator 10 | % gsp_prox_l1_filterbank - L1 norm proximal operator 11 | % gsp_proj_filterbank - Projection onto the synthesis coefficients 12 | % 13 | % Wavelet based operator 14 | % gsp_wavelet_dn - Wavelets denoising 15 | % gsp_solve_l1 - L1 minimization (synthesis) 16 | % gsp_solve_l0 - L0 minimization (synthesis) 17 | % 18 | % For help, bug reports, suggestions etc. please send email to 19 | % gspbox 'dash' support 'at' groupes 'dot' epfl 'dot' ch 20 | % 21 | % see also: operators 22 | 23 | %To be done 24 | % gsp_wavelet_dn - Wavelet denoising operator 25 | -------------------------------------------------------------------------------- /sgwt_require/sgwt_kernel_simple_tf.m: -------------------------------------------------------------------------------- 1 | % sgwt_kernel_simple_tf : evaluates "simple" tight-frame kernel 2 | % 3 | % this is similar to meyer kernel, but simpler 4 | % 5 | % function is essentially sin^2(x) in ascending part, 6 | % essentially cos^2 in descending part. 7 | % 8 | % function r= sgwt_kernel_simple_tf(x,kerneltype) 9 | % 10 | % Inputs 11 | % x : array of independent variable values 12 | % kerneltype : string, either 'sf' or 'wavelet' 13 | % 14 | % Ouputs 15 | % r : array of function values, same size as x. 16 | % 17 | % simple tf wavelet kernel : supported on [1/4,1] 18 | % simple tf scaling function kernel : supported on [0,1/2] 19 | % 20 | 21 | function r= sgwt_kernel_simple_tf(x,kerneltype) 22 | % h : [0,1]->[0,1] must satisfy h(0)=0, h(1)=1 . 23 | h=@(x) sin(pi*x/2).^2; 24 | 25 | %r1ind=find(x>=0 & x<0.25); 26 | r1ind=find(x<0.25); 27 | 28 | r2ind=find(x>=.25 & x<0.5); 29 | r3ind=find(x>=.5 & x<1); 30 | 31 | r=zeros(size(x)); 32 | 33 | switch kerneltype 34 | case 'sf' 35 | r(r1ind)=1; 36 | r(r2ind)=sqrt(1-h(4*x(r2ind)-1).^2); 37 | case 'wavelet' 38 | r(r2ind)=h(4*(x(r2ind)-1/4)); 39 | r(r3ind)=sqrt(1-h(2*x(r3ind)-1).^2); 40 | end 41 | -------------------------------------------------------------------------------- /stationarity/Contents.m: -------------------------------------------------------------------------------- 1 | % GSPBOX - Stationarity 2 | % 3 | % Vertex stationarity 4 | % gsp_experimental_psd - Experimental power density function 5 | % gsp_design_translates - Create a filterbank by uniformly translating a window 6 | % gsp_stationarity_cov - Covariance matrix from graph stationary data 7 | % gsp_stationarity_ratio - Assert the stationarity level of some data 8 | % gsp_estimate_psd - Estimation of the Power spectrum density 9 | % gsp_wiener_optimization - Solve wiener optimization problem 10 | % gsp_wiener_l2 - Solve wiener optimization problem with l2 fidelity term 11 | % gsp_wiener_inpainting - Solve wiener in-painting problem 12 | % gsp_jtv_wiener_inpainting - Solve wiener in-painting problem for vertex time process 13 | % gsp_jtv_estimate_psd - Estimate the PSD of a time vertex process 14 | % 15 | % For help, bug reports, suggestions etc. please send email to 16 | % gspbox 'dash' support 'at' groupes 'dot' epfl 'dot' ch 17 | % 18 | 19 | 20 | -------------------------------------------------------------------------------- /stationarity/gsp_design_translates.m: -------------------------------------------------------------------------------- 1 | function [ g , mu ] = gsp_design_translates(G, g0,N ) 2 | %GSP_DESIGN_TRANSLATES Create a filterbank by uniformly translating a window 3 | % Usage: g = gsp_design_translates( G, g0, Ntrans ); 4 | % 5 | % Inputs parameters: 6 | % G : Graph structure 7 | % g0 : Mother window (anonymous function) 8 | % N : Number of translate 9 | % 10 | % Outputs parameters: 11 | % g : filterbank 12 | % mu : Centers of the filters 13 | % 14 | % This function construct a filter bank of *N* uniformly translated 15 | % filter from the mother filter *g0*. 16 | % 17 | 18 | % Author : Nathanael Perraudin 19 | % Date: 6 January 2016 20 | 21 | 22 | if isstruct(G) 23 | if ~isfield(G,'lmax') 24 | if param.verbose 25 | fprintf('GSP_DESIGN_TRANSLATE has to compute lmax \n') 26 | end 27 | G = gsp_estimate_lmax(G); 28 | end 29 | lmax = G.lmax; 30 | else 31 | lmax = G; 32 | end 33 | 34 | 35 | mu = linspace(0,lmax,N); 36 | 37 | g = cell(length(mu),1); 38 | 39 | for ii = 1:length(mu) 40 | g{ii} = @(x) g0(x-mu(ii)); 41 | end 42 | 43 | 44 | end 45 | 46 | -------------------------------------------------------------------------------- /stationarity/gsp_remove_mean.m: -------------------------------------------------------------------------------- 1 | function [ X, mX ] = gsp_remove_mean( X, dim ) 2 | %GSP_REMOVE_MEAN Remove the mean of the signal X 3 | % Usage: X = gsp_remove_mean( X ); 4 | % X = gsp_remove_mean( X, dim ); 5 | % Ç X, mX ] = gsp_remove_mean( ... ); 6 | % 7 | % Input parameters: 8 | % X : data 9 | % dim : dimension (default 1) 10 | % Output parameters: 11 | % X : centered data 12 | % mX : mean 13 | % 14 | % This function remove efficiently the mean of X across line or column of 15 | % the data. 16 | % 17 | 18 | % Author: Nathanael Perraudin 19 | % Date : 24 July 2016 20 | % Testing: test_gsp_remove_mean 21 | 22 | 23 | 24 | if nargin<2 25 | dim = 1; 26 | end 27 | 28 | mX = mean(X,dim); 29 | 30 | X = bsxfun(@minus,X,mX); 31 | 32 | 33 | end 34 | 35 | -------------------------------------------------------------------------------- /stationarity/gsp_stationarity_cov.m: -------------------------------------------------------------------------------- 1 | function C = gsp_stationarity_cov(X) 2 | %GSP_STATIONARITY_COV Covariance matrix from graph stationary data 3 | % Usage: C = gsp_stationarity_cov(X) 4 | % 5 | % Input parameters: 6 | % X : Data (M x N matrix) 7 | % Output parameters: 8 | % C : Covariance matrix (M x M) 9 | % 10 | % This function estimates the covariance from the data. Every sample has 11 | % the same expected average. 12 | % 13 | % References: perraudin2016stationary 14 | 15 | % Author : Nathanael Perraudin 16 | % Date: 6 January 2016 17 | 18 | Nso = size(X,2); 19 | X = X - mean(X(:)); 20 | C = (X*X')/Nso; 21 | 22 | 23 | end -------------------------------------------------------------------------------- /test_gsptoolbox/fast_gwft/WGFT_gconv.m: -------------------------------------------------------------------------------- 1 | function [ f_conv_g ] = WGFT_gconv(f,g,V) 2 | % Compute the generalized convolution product of two signals f and g on a 3 | % graph whose eigenvectors are the columns of V 4 | 5 | % To do: need to decide if sqrt(N) goes here or in translation, and if here, 6 | % generalize the normalization for normalized graph Laplacian 7 | f_conv_g=WGFT_igft(WGFT_gft(f,V).*WGFT_gft(g,V),V); 8 | 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test_gsptoolbox/fast_gwft/WGFT_gft.m: -------------------------------------------------------------------------------- 1 | function [ f_hat ] = WGFT_gft(f,V) 2 | % Compute the graph Fourier transform of a function f on a graph whose 3 | % eigenvectors are the columns of V 4 | 5 | f_hat=V'*f; 6 | 7 | end 8 | 9 | -------------------------------------------------------------------------------- /test_gsptoolbox/fast_gwft/WGFT_gmod.m: -------------------------------------------------------------------------------- 1 | function [ modulated ] = WGFT_gmod(g,k,V) 2 | 3 | % Modulate a signal g on a graph whose eigenvectors are the columns of V 4 | % kernel g is input in the vertex domain 5 | % k is in 1:N 6 | 7 | N=size(V,1); 8 | dc=V(:,1); 9 | factor=1./dc; 10 | modulated=factor.*V(:,k).*g; 11 | 12 | % modulated=sqrt(N)*V(:,k).*g; OLD CODE - ADDED FACTOR TO ADJUST FOR 13 | % NORMALIZED 14 | end 15 | 16 | -------------------------------------------------------------------------------- /test_gsptoolbox/fast_gwft/WGFT_gtrans.m: -------------------------------------------------------------------------------- 1 | function [ translated ] = WGFT_gtrans(g,i,V) 2 | 3 | % Note: input kernel in the vertex domain 4 | 5 | %Translate a signal g on a graph whose eigenvectors are the columns of V 6 | N=size(V,1); 7 | translated=sqrt(N)*WGFT_gconv(g,sgwt_delta(N,i),V); % extra sqrt(N) factor added here instead of convolution 8 | 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test_gsptoolbox/fast_gwft/WGFT_igft.m: -------------------------------------------------------------------------------- 1 | function [ f ] = WGFT_igft(f_hat,V) 2 | % Compute the inverse graph Fourier transform of a function f_hat on a 3 | % graph whose eigenvectors are the columns of V 4 | 5 | f=V*f_hat; 6 | 7 | end 8 | 9 | -------------------------------------------------------------------------------- /test_gsptoolbox/fast_gwft/WGFT_wgft.m: -------------------------------------------------------------------------------- 1 | function [ wgft_coefficients ] = WGFT_wgft(g,V,signal,varargin) 2 | 3 | % WGFT coefficients are output in an NxN matrix. The ith column corresponds 4 | % to translation to vertex i. The kth row corresponds to frequency 5 | % \lambda_{k-1} 6 | 7 | N=size(V,1); 8 | wgft_coefficients=zeros(N,N); 9 | 10 | if ~isempty(varargin) 11 | param=varargin{1}; 12 | for i=1:N 13 | for k=1:N 14 | g_ik=WGFT_atom(g,V,i,k,param); 15 | wgft_coefficients(k,i)=g_ik'*signal; 16 | end 17 | end 18 | else 19 | for i=1:N 20 | for k=1:N 21 | g_ik=WGFT_atom(g,V,i,k); 22 | wgft_coefficients(k,i)=g_ik'*signal; 23 | end 24 | end 25 | end 26 | 27 | 28 | end 29 | 30 | -------------------------------------------------------------------------------- /test_gsptoolbox/fast_gwft/sgwt_delta.m: -------------------------------------------------------------------------------- 1 | % sgwt_delta : Return vector with one nonzero entry equal to 1. 2 | % 3 | % function r=sgwt_delta(N,j) 4 | % 5 | % Returns length N vector with r(j)=1, all others zero 6 | % 7 | % Inputs : 8 | % N - length of vector 9 | % j - position of "delta" impulse 10 | % 11 | % Outputs: 12 | % r - returned vector 13 | 14 | % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 15 | % Copyright (C) 2010, David K. Hammond. 16 | % 17 | % The SGWT toolbox is free software: you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation, either version 3 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % The SGWT toolbox is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with the SGWT toolbox. If not, see . 29 | 30 | function r=sgwt_delta(N,j) 31 | r=zeros(N,1); 32 | r(j)=1; 33 | 34 | -------------------------------------------------------------------------------- /test_gsptoolbox/gsp_assert_test.m: -------------------------------------------------------------------------------- 1 | function e = gsp_assert_test(X1,X2,tol, name) 2 | 3 | if X1==0 4 | if norm(X2(:),'fro'). 30 | 31 | function r=sgwt_check_connected(A) 32 | d=bfs(A,1); 33 | r=~any(d==-1); 34 | 35 | -------------------------------------------------------------------------------- /test_gsptoolbox/old/sgwt_toolbox/sgwt_compile_mex.m: -------------------------------------------------------------------------------- 1 | % sgwt_compile_mex : set environment variables and call makefile to compile 2 | tmp_dir=pwd; 3 | cd([SGWT_ROOT,'mex']); 4 | setenv('matlabroot',matlabroot); 5 | setenv('mexext',mexext); 6 | !make clean 7 | !make 8 | cd(tmp_dir) 9 | clear tmp_dir 10 | -------------------------------------------------------------------------------- /test_gsptoolbox/old/sgwt_toolbox/sgwt_delta.m: -------------------------------------------------------------------------------- 1 | % sgwt_delta : Return vector with one nonzero entry equal to 1. 2 | % 3 | % function r=sgwt_delta(N,j) 4 | % 5 | % Returns length N vector with r(j)=1, all others zero 6 | % 7 | % Inputs : 8 | % N - length of vector 9 | % j - position of "delta" impulse 10 | % 11 | % Outputs: 12 | % r - returned vector 13 | 14 | % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 15 | % Copyright (C) 2010, David K. Hammond. 16 | % 17 | % The SGWT toolbox is free software: you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation, either version 3 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % The SGWT toolbox is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with the SGWT toolbox. If not, see . 29 | 30 | function r=sgwt_delta(N,j) 31 | r=zeros(N,1); 32 | r(j)=1; 33 | 34 | -------------------------------------------------------------------------------- /test_gsptoolbox/old/sgwt_toolbox/sgwt_forward.m: -------------------------------------------------------------------------------- 1 | % sgwt_forward : Compute forward of sgw transform 2 | % 3 | % function y=sgwt_forward(f,L,c,arange) 4 | % 5 | % This routine is just a wrapper calling sgwt_cheby_op, and is included for 6 | % convenience 7 | % 8 | % Inputs: 9 | % f - Input signal 10 | % L - laplacian 11 | % c - cell array of Chebyshev coefficients defining transform 12 | % arange - spectral approximation range 13 | % 14 | % Outputs: 15 | % y - SGWT coefficients 16 | 17 | % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 18 | % Copyright (C) 2010, David K. Hammond. 19 | % 20 | % The SGWT toolbox is free software: you can redistribute it and/or modify 21 | % it under the terms of the GNU General Public License as published by 22 | % the Free Software Foundation, either version 3 of the License, or 23 | % (at your option) any later version. 24 | % 25 | % The SGWT toolbox is distributed in the hope that it will be useful, 26 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | % GNU General Public License for more details. 29 | % 30 | % You should have received a copy of the GNU General Public License 31 | % along with the SGWT toolbox. If not, see .function r=sgwt_forward(f,L,c,arange) 32 | r=sgwt_cheby_op(f,L,c,arange); 33 | -------------------------------------------------------------------------------- /test_gsptoolbox/old/sgwt_toolbox/sgwt_kernel_simple_tf.m: -------------------------------------------------------------------------------- 1 | % sgwt_kernel_simple_tf : evaluates "simple" tight-frame kernel 2 | % 3 | % this is similar to meyer kernel, but simpler 4 | % 5 | % function is essentially sin^2(x) in ascending part, 6 | % essentially cos^2 in descending part. 7 | % 8 | % function r= sgwt_kernel_simple_tf(x,kerneltype) 9 | % 10 | % Inputs 11 | % x : array of independent variable values 12 | % kerneltype : string, either 'sf' or 'wavelet' 13 | % 14 | % Ouputs 15 | % r : array of function values, same size as x. 16 | % 17 | % simple tf wavelet kernel : supported on [1/4,1] 18 | % simple tf scaling function kernel : supported on [0,1/2] 19 | % 20 | 21 | function r= sgwt_kernel_simple_tf(x,kerneltype) 22 | % h : [0,1]->[0,1] must satisfy h(0)=0, h(1)=1 . 23 | h=@(x) sin(pi*x/2).^2; 24 | 25 | r1ind=find(x>=0 & x<0.25); 26 | r2ind=find(x>=.25 & x<0.5); 27 | r3ind=find(x>=.5 & x<1); 28 | 29 | r=zeros(size(x)); 30 | 31 | switch kerneltype 32 | case 'sf' 33 | r(r1ind)=1; 34 | r(r2ind)=sqrt(1-h(4*x(r2ind)-1).^2); 35 | case 'wavelet' 36 | r(r2ind)=h(4*(x(r2ind)-1/4)); 37 | r(r3ind)=sqrt(1-h(2*x(r3ind)-1).^2); 38 | end 39 | -------------------------------------------------------------------------------- /test_gsptoolbox/old/sgwt_toolbox/sgwt_randmat.m: -------------------------------------------------------------------------------- 1 | % sgwt_randmat : Compute random (Erdos-Renyi model) graph 2 | % 3 | % function A=sgwt_randmat(N,thresh) 4 | % 5 | % Inputs : 6 | % N - number of vertices 7 | % thresh - probability of connection of each edge 8 | % 9 | % Outputs : 10 | % A - adjacency matrix 11 | 12 | % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 13 | % Copyright (C) 2010, David K. Hammond. 14 | % 15 | % The SGWT toolbox is free software: you can redistribute it and/or modify 16 | % it under the terms of the GNU General Public License as published by 17 | % the Free Software Foundation, either version 3 of the License, or 18 | % (at your option) any later version. 19 | % 20 | % The SGWT toolbox is distributed in the hope that it will be useful, 21 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | % GNU General Public License for more details. 24 | % 25 | % You should have received a copy of the GNU General Public License 26 | % along with the SGWT toolbox. If not, see . 27 | 28 | function [A]=sgwt_randmat(N,thresh) 29 | assert(thresh<=1 && thresh>=0); 30 | A=rand(N)>1-thresh; 31 | B=triu(A); 32 | A=B+B'; 33 | for i=1:size(A,1) 34 | A(i,i)=0; 35 | end 36 | A=sparse(A); 37 | -------------------------------------------------------------------------------- /test_gsptoolbox/old/sgwt_toolbox/utils/sgwt_soft_threshold.m: -------------------------------------------------------------------------------- 1 | % sgwt_soft_threshold : Soft thresholding operator 2 | % 3 | % x_t = bpdq_soft_threshold(x,tgamma) 4 | % 5 | % Applies soft thresholding to each component of x 6 | % 7 | % Inputs: 8 | % x - input signal 9 | % tgamma - threshold 10 | % 11 | % Outputs: 12 | % x_t - soft thresholded result 13 | 14 | % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 15 | % Copyright (C) 2010, David K. Hammond. 16 | % 17 | % The SGWT toolbox is free software: you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation, either version 3 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % The SGWT toolbox is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with the SGWT toolbox. If not, see . 29 | 30 | 31 | function x_t = sgwt_soft_threshold(x,tgamma) 32 | tmp=abs(x)-tgamma; 33 | x_t = sign(x).*tmp.*(tmp>0); 34 | 35 | -------------------------------------------------------------------------------- /test_gsptoolbox/old/sgwt_toolbox/utils/vec.m: -------------------------------------------------------------------------------- 1 | % vec : vectorize input 2 | % 3 | % r=vec(x) 4 | % 5 | % returns r=x(:); 6 | 7 | % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 8 | % Copyright (C) 2010, David K. Hammond. 9 | % 10 | % The SGWT toolbox is free software: you can redistribute it and/or modify 11 | % it under the terms of the GNU General Public License as published by 12 | % the Free Software Foundation, either version 3 of the License, or 13 | % (at your option) any later version. 14 | % 15 | % The SGWT toolbox is distributed in the hope that it will be useful, 16 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | % GNU General Public License for more details. 19 | % 20 | % You should have received a copy of the GNU General Public License 21 | % along with the SGWT toolbox. If not, see . 22 | 23 | function r=vec(x) 24 | r=x(:); 25 | -------------------------------------------------------------------------------- /test_gsptoolbox/old_jtv/gsp_jft_simple.m: -------------------------------------------------------------------------------- 1 | function Xhat = gsp_jft_simple(G,X) 2 | 3 | [T] = size(X,2); 4 | 5 | Xhat = fft(gsp_gft(G,X),[],2)/sqrt(T); 6 | 7 | end -------------------------------------------------------------------------------- /test_gsptoolbox/old_jtv/gsp_jtv_filter_analysis_simple.m: -------------------------------------------------------------------------------- 1 | function s = gsp_jtv_filter_analysis_simple(G,g,X,param) 2 | 3 | if nargin<4 4 | param = struct; 5 | end 6 | 7 | 8 | 9 | Xhat = gsp_jft_simple(G,X); 10 | 11 | s = zeros(G.N,G.jtv.T,numel(g),size(X,3)); 12 | 13 | filt = gsp_jtv_filter_evaluate_simple(G,g,G.e,param); 14 | 15 | % Here we need to use repmat to avoid both for loops but this function 16 | % is written for testing purposes only 17 | for ii = 1:numel(g) 18 | for jj = 1:size(X,3) 19 | s(:,:,ii,jj) = gsp_ijft(G,conj(filt(:,:,ii)).*Xhat); 20 | end 21 | end 22 | 23 | if sum(abs(imag(s(:)))) < 1e-11 *norm(s(:)) 24 | s = real(s); 25 | end 26 | 27 | end -------------------------------------------------------------------------------- /test_gsptoolbox/old_jtv/gsp_jtv_filter_synthesis_simple.m: -------------------------------------------------------------------------------- 1 | function X = gsp_jtv_filter_synthesis_simple(G,g,S,param) 2 | 3 | if nargin<4 4 | param = struct; 5 | end 6 | 7 | 8 | 9 | X = zeros(G.N,G.jtv.T,size(S,4)); 10 | filt = gsp_jtv_filter_evaluate_simple(G,g,G.e,param); 11 | 12 | % using repmat we should be able to get rid of one for loop 13 | for jj = 1:size(S,4) 14 | for ii = 1:length(g) 15 | Shat = gsp_jft(G,S(:,:,ii,jj)); 16 | X(:,:,jj) = X(:,:,jj) + gsp_ijft(G,filt(:,:,ii).*Shat); 17 | end 18 | end 19 | 20 | if sum(abs(imag(X(:)))) < 1e-11 *norm(X(:)) 21 | X = real(X); 22 | end 23 | 24 | end -------------------------------------------------------------------------------- /test_gsptoolbox/test_gsp_dn.m: -------------------------------------------------------------------------------- 1 | function [ errors ] = test_gsp_dn( ) 2 | 3 | errors = 0; 4 | 5 | errors = errors + test_wavelet_dn(); 6 | 7 | 8 | 9 | end 10 | 11 | 12 | function errors = test_wavelet_dn() 13 | errors = 0; 14 | 15 | lambda = 1; 16 | 17 | 18 | Nf = 6; 19 | N = 100; 20 | G = gsp_sensor(N); 21 | G = gsp_compute_fourier_basis(G); 22 | 23 | W = gsp_design_mexican_hat(G,Nf); % Generate tight frame wavelet 24 | 25 | f = sign(G.U(:,2)); 26 | sigma = 0.3; 27 | gsp_reset_seed(0); 28 | x = f+sigma*randn(size(f)); 29 | param.tol = 1e-12; 30 | param.maxit = 100; 31 | param.verbose = 0; 32 | param.method = 'FISTA'; 33 | y1 = gsp_wavelet_dn(G,W,x,lambda,param); 34 | param.method = 'DG'; 35 | param.gamma = 1; 36 | y2 = gsp_wavelet_dn(G,W,x,lambda,param); 37 | 38 | 39 | if norm(y1(:)-y2(:))/norm(y1(:)) > 1e-9 40 | errors = errors +1; 41 | warning('DENOISING: Wavlet DG diff FISTA error') 42 | badness = norm(y1(:)-y2(:))/norm(y1(:)) 43 | figure; 44 | gsp_plot_signal(G,x); 45 | figure; 46 | gsp_plot_signal(G,y1); 47 | 48 | else 49 | fprintf('DENOISING: DG == FISTA ok\n'); 50 | end 51 | 52 | 53 | end 54 | -------------------------------------------------------------------------------- /test_gsptoolbox/test_gsp_estimate_vertex_time_psd.m: -------------------------------------------------------------------------------- 1 | function errors = test_gsp_estimate_vertex_time_psd 2 | 3 | errors = 0; 4 | 5 | %Time parameter 6 | T = 200;fs=1; 7 | % Graph parameters 8 | N = 100; 9 | %Graph 10 | G = gsp_sensor(N); 11 | % G1 = gsp_2dgrid(10); 12 | G = gsp_jtv_graph(G,T,fs); 13 | G = gsp_compute_fourier_basis(G); 14 | 15 | 16 | %wave filter 17 | alpha=1; 18 | beta = 0.7; 19 | [g, ft] = gsp_jtv_design_damped_wave(G, alpha,beta); 20 | 21 | 22 | Nx = 5; 23 | x2 = (rand(N,T,1,Nx)>0.99).*randn(N,T,1,Nx); 24 | X2 = gsp_jtv_filter_synthesis(G,g,ft,x2); 25 | 26 | param.L = 100; 27 | param.use_fast = 0; 28 | t1 = tic; 29 | param.estimator = 'TVA'; 30 | psd_TVA1 = gsp_estimate_vertex_time_psd(G,X2,param); 31 | time1 = toc(t1) 32 | 33 | t2 = tic; 34 | param.estimator = 'TVA'; 35 | param.use_fast = 1; 36 | psd_TVA2 = gsp_estimate_vertex_time_psd(G,X2,param); 37 | time2 = toc(t2) 38 | 39 | A1 = gsp_filter_evaluate(psd_TVA1,G.e); 40 | A2 = gsp_filter_evaluate(psd_TVA2,G.e); 41 | 42 | gsp_assert_test(A1,A2,1e-10,'ESTIMATE_PSD: TVA') 43 | 44 | 45 | 46 | end -------------------------------------------------------------------------------- /test_gsptoolbox/test_gsp_hope_distanz.m: -------------------------------------------------------------------------------- 1 | function errors = test_gsp_hope_distanz() 2 | 3 | errors = 0; 4 | 5 | G = gsp_path(10); 6 | 7 | d = gsp_hop_distanz(G,1,5); 8 | 9 | if d==4 10 | fprintf(' GSP_HOP_DISTANZ 1 OK\n') 11 | else 12 | warning(' GSP_HOP_DISTANZ 1 pas OK') 13 | errors = errors + 1; 14 | end 15 | 16 | d = gsp_hop_distanz(G,1,8); 17 | 18 | if d==7 19 | fprintf(' GSP_HOP_DISTANZ 2 OK\n') 20 | else 21 | warning(' GSP_HOP_DISTANZ 2 pas OK') 22 | errors = errors + 1; 23 | end 24 | 25 | 26 | end -------------------------------------------------------------------------------- /test_gsptoolbox/test_gsp_nn_graph_oose.m: -------------------------------------------------------------------------------- 1 | function [ errors ] = test_gsp_nn_graph_oose( ) 2 | 3 | errors = 0; 4 | 5 | 6 | Nx =10; 7 | N = 30; 8 | a = 0.1; 9 | %% Random sampling 10 | xg = rand(N,2); 11 | 12 | %% 13 | vx = linspace(-0.2,1.2,Nx); 14 | vy = linspace(-0.2,1.2,Nx); 15 | [X, Y] = meshgrid(vx, vy ); 16 | xo = [X(:),Y(:)]; 17 | 18 | %% Create the graph 19 | param.sigma = 0.01; 20 | param.epsilon = sqrt(-log(a)*param.sigma); 21 | param.type = 'radius'; 22 | [ G ] = gsp_nn_graph_oose( xg, xo , param ); 23 | t = param.sigma; 24 | G2 = gsp_create_cont_expW( xg,xo,t,a); 25 | 26 | d1 = G.Gm.W(:); 27 | d2 = G2.Gm.W(:); 28 | 29 | error('This test makes no sense for now') 30 | 31 | if norm(d1-d2,'fro')/norm(d1)<1e-8 32 | fprintf('TEST GSP_NN_GRAPH_OOSE OK\n'); 33 | 34 | else 35 | fprintf('ERROR IN TEST GSP_NN_GRAPH_OOSE !!!!!!!\n') 36 | norm(d1-d2,'fro')/norm(d1) 37 | errors = errors +1; 38 | end 39 | 40 | end 41 | 42 | -------------------------------------------------------------------------------- /test_gsptoolbox/test_gsp_remove_mean.m: -------------------------------------------------------------------------------- 1 | function errors = test_gsp_remove_mean() 2 | 3 | 4 | X = rand(100,10); 5 | 6 | X1 = gsp_remove_mean(X); 7 | 8 | errors = gsp_assert_test(0,sum(X1),eps(1000), 'remove mean dim 1'); 9 | 10 | X2 = gsp_remove_mean(X,2); 11 | 12 | errors = errors + gsp_assert_test(0,sum(X2,2),eps(1000), 'remove mean dim 2'); 13 | 14 | X = rand(100,10,3); 15 | 16 | X3 = gsp_remove_mean(X,3); 17 | 18 | errors = errors + gsp_assert_test(0,sum(X3,3),eps(1000), 'remove mean dim 3'); 19 | 20 | end -------------------------------------------------------------------------------- /test_gsptoolbox/test_sparsify.m: -------------------------------------------------------------------------------- 1 | function [ errors ] = test_sparsify( ) 2 | gsp_reset_seed(0); 3 | 4 | errors = 0; 5 | errors = errors + test1(); 6 | 7 | errors = errors + test2(); 8 | 9 | end 10 | 11 | function [ errors ] = test1( ) 12 | 13 | errors = 0; 14 | try 15 | epsilon = 0.4; 16 | param.distribute = 1; 17 | param.Nc = 20; 18 | G = gsp_sensor(256,param); 19 | G2 = gsp_graph_sparsify(G,epsilon); 20 | figure(100); 21 | gsp_plot_graph(G); 22 | title('Original graph') 23 | figure(101); 24 | gsp_plot_graph(G2); 25 | title('Sparsified graph') 26 | close(100); 27 | close(101); 28 | fprintf('SPARSIFY: test 1 ok\n'); 29 | catch 30 | errors = errors +1; 31 | warning('SPARSIFY: test 1 error') 32 | end 33 | 34 | end 35 | 36 | 37 | function [ errors ] = test2( ) 38 | 39 | errors = 0; 40 | N = 100; 41 | epsilon = 0.6; 42 | G = gsp_sensor(N); 43 | gsp_reset_seed(0); 44 | G2 = gsp_graph_sparsify(G,epsilon); 45 | gsp_reset_seed(0); 46 | L = gsp_graph_sparsify_old(G.L,epsilon); 47 | 48 | if sum(sum(abs(G2.L-L)))<1e-10 49 | 50 | fprintf('SPARSIFY: test ok\n'); 51 | else 52 | errors = errors+1; 53 | badness = sum(sum(abs(G2.L-L))) 54 | warning('SPARSIFY: test 2 error') 55 | end 56 | 57 | end 58 | -------------------------------------------------------------------------------- /test_gsptoolbox/time_vertex/gsp_jtv_frame_analysis.m: -------------------------------------------------------------------------------- 1 | function c = gsp_jtv_frame_analysis(F,s) 2 | %GSP_JTV_FRAME_ANALYSIS Analysis operator in time-vertex domain 3 | % Usage: c = gsp_jtv_frame_analysis(F,s,param); 4 | % 5 | % Input parameters: 6 | % F : Frame matrix (vertex_loc x time_loc x vertex x time) 7 | % s : Time-Vertex signal 8 | % Output parameters: 9 | % c : Coefficients matrix 10 | % --------------------- 11 | % This function compute the analysis operator using frame matrix 12 | 13 | % Author : Francesco Grassi 14 | % Date : July 2016 15 | 16 | [N,lag,~,T]=size(F); 17 | Ts = size(s,2); 18 | 19 | if Ts<(T+1)/2 20 | s = [ zeros(N,T-Ts-1) s ]; 21 | elseif T 1 17 | theta = sqrt(theta_min * theta_max); 18 | else 19 | theta = theta_min * 1.1; 20 | end 21 | -------------------------------------------------------------------------------- /utils/gsp_ddf2dcdf.m: -------------------------------------------------------------------------------- 1 | function [y,x] = gsp_ddf2dcdf(v,x) 2 | %GSP_DDF2DCDF Discrete density function to dicrete cumulative density function 3 | % Usage : [y] = gsp_ddf2dcdf(v); 4 | % [y,x] = gsp_ddf2dcdf(v,x); 5 | % 6 | % Input parameters: 7 | % v : Discrete density function 8 | % x : Axis value (Optional) 9 | % Output parameters: 10 | % y : Discrete cumulative ensity function 11 | % x : Axis value (Same as input) 12 | % 13 | % This function goes from discrete density function to discrete 14 | % cumulative density function. 15 | % 16 | 17 | 18 | N = length(v); 19 | y = zeros(N,1); 20 | y(1) = v(1); 21 | for ii = 1:(N-1) 22 | y(ii+1) = y(ii) +v(ii+1); 23 | end 24 | 25 | y = y/y(end); 26 | 27 | end -------------------------------------------------------------------------------- /utils/gsp_decompose_asymmatrix.m: -------------------------------------------------------------------------------- 1 | function [Wsym,Wasym] = gsp_decompose_asymmatrix(W) 2 | %GSP_DECOMPOSE_ASYMMATRIX Decompose a matrix in symmetric and asymmetric part 3 | % Usage: [Wsym,Wasym] = gsp_decompose_asymmatrix(W) 4 | % 5 | % Input parameters: 6 | % W : Asymmetric matrix 7 | % Output parameters: 8 | % Wsym : Symmetric part of W 9 | % Wasym : Asymmetric part of W 10 | % 11 | % Decompose a matrix in symmetric and asymmetric part 12 | % 13 | 14 | % Author: Francesco Grassi 15 | % Date : July 2016 16 | 17 | Wasym = W-W.'; 18 | 19 | Wasym(Wasym<0)=0; 20 | 21 | Wsym = W-Wasym; 22 | 23 | Wsym = (Wsym+Wsym')/2; 24 | 25 | end -------------------------------------------------------------------------------- /utils/gsp_delta.m: -------------------------------------------------------------------------------- 1 | function [ d, do ] = gsp_delta( G,at ) 2 | %GSP_DELTA 3 | 4 | 5 | 6 | if isstruct(G) 7 | N = G.N; 8 | else 9 | N = G; 10 | end 11 | 12 | 13 | Nat = numel(at); 14 | d = zeros(N,Nat); 15 | for ii = 1:Nat; 16 | d(at(ii),ii) = 1; 17 | end 18 | 19 | if nargout>1 20 | if isfield(G,'Gm') 21 | do = zeros(G.Gm.N-G.N,Nat); 22 | else 23 | error('This function returns two arguments only for oose.') 24 | end 25 | end 26 | 27 | end 28 | 29 | -------------------------------------------------------------------------------- /utils/gsp_diameter.m: -------------------------------------------------------------------------------- 1 | function d = gsp_diameter(G) 2 | 3 | d = 0; 4 | v = bfs(G.A,1); 5 | if any(v<0) 6 | warning('Disconnected graph!') 7 | end 8 | for ii = 1:G.N 9 | d = max(d,max(bfs(G.A,ii))); 10 | end 11 | 12 | end -------------------------------------------------------------------------------- /utils/gsp_hop_distanz.m: -------------------------------------------------------------------------------- 1 | function d = gsp_hop_distanz(G,i,j) 2 | %GSP_HOP_DISTANZ Compute the hop distance between two node 3 | % Usage: d = gsp_hop_distanz(G,i,j); 4 | % 5 | % Input parameters: 6 | % G : Graph 7 | % i : node 8 | % j : node 9 | % Output parameters: 10 | % d : hop distanz 11 | % 12 | % This code computes the hop distance between node i and node j. It uses 13 | % a naive greedy algorithm and has to be improved. 14 | % 15 | 16 | % Author: Nathanael Perraudin 17 | % Date : 15 septembre 2015 18 | % Testing: test_gsp_hope_distanz 19 | 20 | M = double(logical(G.W)); 21 | s = zeros(G.N,1); 22 | s(i) = 1; 23 | s = logical(s); 24 | d = 0; 25 | while s(j)==0 && d<=G.N+1 26 | d = d+1; 27 | s = logical(M*double(s)) +s; 28 | end 29 | 30 | if d == G.N+1 31 | d = inf; 32 | end 33 | 34 | 35 | end -------------------------------------------------------------------------------- /utils/gsp_incidence.m: -------------------------------------------------------------------------------- 1 | function G = gsp_incidence(G,inc_type) 2 | %GSP_INCIDENCE Compute an incidence matrix 3 | % 4 | % Usage: G = gsp_incidence(G) 5 | % gsp_incidence(G,inc_type) 6 | % 7 | % Input parameters: 8 | % G : Graph structure 9 | % inc_type : Type of incidence matrix: 'weighted' or 'binary' 10 | % Output parameters: 11 | % G : Graph structure 12 | % 13 | % 'gsp_incidence' compute the incidence matrix B from the gradient and add it to graph structure 14 | % 15 | 16 | % Author: Francesco Grassi 17 | % Date : July 2016 18 | 19 | if nargin < 2 20 | inc_type = 'weighted'; 21 | end 22 | 23 | 24 | if ~isfield(G,'Diff'); G = gsp_adj2vec(G); end; 25 | 26 | switch inc_type 27 | case 'weighted' 28 | B = abs(G.Diff); 29 | case 'binary' 30 | B = abs(G.Diff)>0; 31 | otherwise 32 | error('Unknown incidence matrix.') 33 | end 34 | 35 | G.B = B; 36 | 37 | end -------------------------------------------------------------------------------- /utils/gsp_isdirected.m: -------------------------------------------------------------------------------- 1 | function bool = gsp_isdirected(G) 2 | %GSP_ISDIRECTED Check is the graph is directed 3 | % Usage: bool = gsp_isdirected(G); 4 | % bool = gsp_isdirected(W); 5 | % 6 | % Input parameters 7 | % G : Graph structure or square matrix 8 | % Output parameters 9 | % bool : Boolean 10 | % 11 | % This function test if the graph is directed. Alternatively, you can 12 | % give a square matrix and it tests if it is symetric. The function 13 | % returns 0 if the matrix is symetric and 1 otherwise! 14 | % 15 | 16 | % Author: Nathanael Perraudin 17 | % Date : 13 August 2014 18 | 19 | if isstruct(G) 20 | W = G.W; 21 | else 22 | W = G; 23 | end 24 | 25 | bool = sum(sum( abs(W - transpose(W))> eps(10) ))>0; 26 | 27 | end 28 | -------------------------------------------------------------------------------- /utils/gsp_jtv_fa.m: -------------------------------------------------------------------------------- 1 | function [f, label] = gsp_jtv_fa(G,shift) 2 | %GSP_JTV_FA Frequency axis for the joint time vertex framework 3 | % Usage: f = gsp_jtv_fa(G); 4 | % 5 | % Input parameters: 6 | % G : Time-vertex graph structure 7 | % shift : Boolean value: 1 to apply fftshift on the frequency vector, 0 otherwise 8 | % Ouput parameters: 9 | % f : Frequency axis (row vector) 10 | % 11 | 12 | % Author: Nathanael Perraudin, Francesco Grassi 13 | % Date : September 2016 14 | 15 | if nargin<2 16 | shift = 0; 17 | end 18 | 19 | if ~gsp_check_jtv(G) 20 | error('GSP_JTV_FA needs the time dimension. Use GSP_JTV_GRAPH'); 21 | end 22 | 23 | if isempty(G.jtv.NFFT) 24 | NFFT = G.jtv.T; 25 | else 26 | NFFT = G.jtv.NFFT; 27 | end 28 | 29 | if shift 30 | f = fftshift(gsp_cfa( NFFT,G.jtv.fs )'); 31 | else 32 | f = gsp_cfa( NFFT,G.jtv.fs )'; 33 | end 34 | 35 | 36 | 37 | 38 | label = '\omega'; 39 | 40 | end -------------------------------------------------------------------------------- /utils/gsp_jtv_ta.m: -------------------------------------------------------------------------------- 1 | function [t,label] = gsp_jtv_ta(G,lag) 2 | %GSP_JTV_TA Time axis for the joint time vertex framework 3 | % Usage: t = gsp_jtv_ta(G); 4 | % 5 | % Input parameters: 6 | % G : Time-vertex graph structure 7 | % lag : Compute lag axis 8 | % Ouput parameters: 9 | % t : Time or Lag axis (row vector) 10 | 11 | % Author: Francesco Grassi 12 | % Date : September 2016 13 | 14 | if nargin<2 15 | lag = 0; 16 | end 17 | 18 | if isfield(G.jtv,'T') 19 | T = G.jtv.T; 20 | fs = G.jtv.fs; 21 | if lag 22 | t = -(T-1)/fs:1/fs:(T-1)/fs; 23 | label = 'Lag'; 24 | else 25 | t = 0:1/fs:(T-1)/fs; 26 | label = 'Time'; 27 | end 28 | else 29 | error('GSP_JTV_TA needs the time dimension. Use GSP_JTV_GRAPH'); 30 | end 31 | 32 | end -------------------------------------------------------------------------------- /utils/gsp_norm_l1_filterbank.m: -------------------------------------------------------------------------------- 1 | function n = gsp_norm_l1_filterbank(G, W, x) 2 | %GSP_NORM_L1_FILTERBANK Compute the l2 norm of the analysis coefficients 3 | 4 | % Usage: n = gsp_norm_l1_filterbank(G, W, x); 5 | % 6 | % Input parameters: 7 | % G : Graph structure 8 | % W : Filterbank (cell array of functions) 9 | % x : coefficients 10 | % param: structure of optional paramter 11 | % Output parameters: 12 | % n : L1 norm 13 | % 14 | % `gsp_norm_l1_filterbank(G, W, x)` computes: 15 | % 16 | % .. n = || W^* x ||_1 17 | % 18 | % .. math:: n = \| W^* x \|_1 19 | % 20 | % 21 | 22 | % Author: Nathanael Perraudin 23 | % Date: 26 March 2014 24 | 25 | if ~isfield(G,'lmax') 26 | G = gsp_estimate_lmax(G); 27 | warning(['GSP_NORM_L1_FILTERBANK: To be more efficient you should run: ',... 28 | 'G = gsp_estimate_lmax(G); before using this proximal operator.']); 29 | end 30 | 31 | n = sum(sum(abs(gsp_filter_analysis(G,W,x)))); 32 | 33 | end 34 | 35 | 36 | -------------------------------------------------------------------------------- /utils/gsp_norm_l2_filterbank.m: -------------------------------------------------------------------------------- 1 | function n = gsp_norm_l2_filterbank(G, W, x, param) 2 | %GSP_NORM_L2_FILTERBANK Compute the l2 norm of the analysis coefficients 3 | % Usage: n = gsp_norm_l2_filterbank(G, W, x); 4 | % 5 | % Input parameters: 6 | % G : Graph structure 7 | % W : Filterbank (cell array of functions) 8 | % x : coefficients 9 | % param: structure of optional paramter 10 | % Output parameters: 11 | % n : L2 norm 12 | % 13 | % `gsp_norm_l2_filterbank(G, W, x, param)` computes: 14 | % 15 | % .. n = || A W^* x -y ||_2^2 16 | % 17 | % .. math:: n = \| A W^* x - y\|_2^2 18 | % 19 | % param is a Matlab structure containing the following fields: 20 | % 21 | % * *param.A* : Forward operator (default: Id). 22 | % 23 | % * *param.y* : measurements (default: 0). 24 | % 25 | 26 | % Author: Nathanael Perraudin 27 | % Date: 26 March 2014 28 | 29 | if ~isfield(G,'lmax') 30 | G = gsp_estimate_lmax(G); 31 | warning(['GSP_NORM_L1_FILTERBANK: To be more efficient you should run: ',... 32 | 'G = gsp_estimate_lmax(G); before using this proximal operator.']); 33 | end 34 | 35 | if nargin < 4, param=struct; end 36 | 37 | if ~isfield(param, 'y'), param.nu = 0; end 38 | if ~isfield(param, 'A'), param.A = @(x) x; end 39 | 40 | n = norm(param.A(gsp_filter_synthesis(G,W,x))-param.y,'fro')^2; 41 | 42 | end 43 | -------------------------------------------------------------------------------- /utils/gsp_norm_tik.m: -------------------------------------------------------------------------------- 1 | function y = gsp_norm_tik(G,x) 2 | %GSP_NORM_TIK Squared L2 norm of the gradient on graph 3 | % Usage: y = gsp_norm_tv(G,x); 4 | % 5 | % Input parameters: 6 | % G : Graph structure (or symetric positive matrix) 7 | % x : Signal on graph 8 | % Output parameters: 9 | % y : Norm 10 | % 11 | % Compute the squared L2 norm of the gradient on graph. If x is a matrix 12 | % a vector of norm is returned. 13 | % 14 | % This function can also be used for general symetric positive matrices 15 | % 16 | % See also: gsp_prox_tik gsp_norm_tv 17 | 18 | % Author: Nathanael Perraudin 19 | % Date: 25 March 2014 20 | 21 | if isa(x,'single') 22 | x = double(x); 23 | end 24 | 25 | if ~isnumeric(G) 26 | L = G.L; 27 | else 28 | L = G; 29 | end 30 | 31 | 32 | 33 | [N,M ] = size(L); 34 | if size(x,1) ~= M 35 | error('The dimension of x is not compatible with the dimension of L'); 36 | end 37 | NL = M/N; 38 | y = 0; 39 | for ii = 1:NL; 40 | ind = (1:N)+(ii-1)*N; 41 | y = y + sum(x(ind,:) .* (L(:,ind)* x(ind,:)) ); 42 | end 43 | 44 | % Previous implementation 45 | % y = sum(x .* (L* x) ); 46 | 47 | end 48 | -------------------------------------------------------------------------------- /utils/gsp_norm_tv.m: -------------------------------------------------------------------------------- 1 | function y = gsp_norm_tv(G,x) 2 | %GSP_NORM_TV TV norm on graph 3 | % Usage: y = gsp_norm_tv(G,x); 4 | % 5 | % Input parameters: 6 | % G : Graph structure 7 | % x : Signal on graph 8 | % Output parameters: 9 | % y : Norm 10 | % 11 | % Compute the TV norm of a signal on a graph 12 | % 13 | % See also: gsp_prox_tv 14 | 15 | % Author: Nathanael Perraudin 16 | % Date: 25 March 2014 17 | % Testing: test_gsp_prox 18 | 19 | if ~isfield(G,'v_in') 20 | G = gsp_adj2vec(G); 21 | warning(['GSP_PROX_TV: To be more efficient you should run: ',... 22 | 'G = gsp_adj2vec(G); before using this proximal operator.']); 23 | end 24 | 25 | 26 | y = sum(abs(gsp_grad(G,x))); 27 | 28 | end 29 | -------------------------------------------------------------------------------- /utils/gsp_point2dcdf.m: -------------------------------------------------------------------------------- 1 | function [x,y] = gsp_point2dcdf(v) 2 | %GSP_POINT2DCDF points to discrete continuous density function 3 | % Usage : [x,y] = gsp_point2dcdf(v); 4 | % 5 | % Input parameters: 6 | % v : vector of sample (1 dimention) 7 | % Output parameters: 8 | % x : coordinate along x 9 | % y : coordinate along y 10 | % 11 | % This function compute a discrete continuous density function from a 12 | % sample list. 13 | % 14 | % Example::: 15 | % 16 | % gsp_point2dcdf([0 3 4 2 2 0 1 0 1 1 2]) 17 | % 18 | 19 | N = numel(v); 20 | tol = 1e-10; 21 | v = sort(v); 22 | [x, inds] = unique(round(v(:)*1/tol)*tol); 23 | 24 | y = (inds-1)/(N-1); 25 | 26 | %% Old code 27 | % N = numel(v); 28 | % 29 | % v = sort(v(:)); 30 | % 31 | % x = zeros(N,1); 32 | % y = zeros(N,1); 33 | % x(1) = v(1); 34 | % y(1) = 1; 35 | % ind = 1; 36 | % for ii = 1:(N-1) 37 | % if v(ii+1)>v(ii)+ eps(10); 38 | % x(ind+1) = v(ii+1); 39 | % y(ind+1) = y(ind)+1; 40 | % ind = ind + 1; 41 | % else 42 | % y(ind) = y(ind) + 1; 43 | % if ii == N-1 44 | % x(ind) = v(ii); 45 | % end 46 | % end 47 | % 48 | % end 49 | % 50 | % [~,~,x] = find(x); 51 | % [~,~,y] = find(y); 52 | % 53 | % y = y/N; 54 | % 55 | 56 | 57 | 58 | end -------------------------------------------------------------------------------- /utils/gsp_repmatline.m: -------------------------------------------------------------------------------- 1 | function [ Ar ] = gsp_repmatline( A,ncol,nrow ) 2 | %GSP_REPMATLINE This function repeat the matrix A in a specific manner 3 | % Usage Ar = gsp_repmatline( A,ncol,nrow ); 4 | % 5 | % Inputs parameters 6 | % A : Matrix 7 | % ncol: Integer 8 | % nrow: Integer 9 | % Outputs parameters 10 | % Ar : Matrix 11 | % 12 | % This function repeat a matrix line by line and column by column 13 | % 14 | % For ncol=1 and nrow=2, the matix 15 | % 1 2 16 | % 3 4 17 | % becomes 18 | % 1 1 2 2 19 | % 3 3 4 4 20 | % 21 | 22 | % Author: Nathanael Perraudin 23 | % Date : 23 October 2013 24 | 25 | if ~floor(ncol)==ncol || ~floor(nrow)==nrow 26 | error('The number of lines and rows must be integer'); 27 | end 28 | 29 | if ncol<1 || nrow<1 30 | error('The number of lines and rows must be greater or equal to one') 31 | end 32 | 33 | 34 | % Initialisation 35 | Ar=A; 36 | 37 | if ncol>1 38 | 39 | [row, col] = size(Ar); 40 | Ar = Ar(:); 41 | Ar = Ar(:,ones(1,ncol)).'; 42 | Ar = reshape(Ar,ncol*row,col); 43 | end 44 | 45 | if nrow>1 46 | Ar=transpose(Ar); 47 | [col, row] = size(Ar); 48 | Ar = Ar(:); 49 | Ar = Ar(:,ones(1,nrow)).'; 50 | Ar = reshape(Ar,nrow*col,row); 51 | Ar=transpose(Ar); 52 | end 53 | 54 | 55 | end 56 | 57 | -------------------------------------------------------------------------------- /utils/gsp_reset_seed.m: -------------------------------------------------------------------------------- 1 | function gsp_reset_seed(n) 2 | %GSP_RESET_SEED Reset the seed of the random number generator 3 | % Usage: gsp_reset_seed(n); 4 | % 5 | % Input parameters: 6 | % n : seed 7 | % Ouptut parameters: 8 | % none 9 | % 10 | % This function resets the seed 11 | 12 | % Authors: Nathanael Perraudin, Vassilis Kalofolias 13 | % Date : 21 May 2014 14 | % 15 | % global GLOBAL_rand 16 | % 17 | % if GLOBAL_rand 18 | % s = rng; 19 | 20 | if nargin<1 21 | n = 0; 22 | end 23 | 24 | if verLessThan('matlab', '7.12.0') % release 2011a has "rng" 25 | rand('twister',n); %#ok 26 | else 27 | rng(n,'twister'); 28 | end 29 | 30 | end 31 | 32 | -------------------------------------------------------------------------------- /utils/gsp_resistance_distance.m: -------------------------------------------------------------------------------- 1 | function rd = gsp_resistance_distance(G,param) 2 | %GSP_RESISTANCE_DISTANCE see gsp_resistance_distances 3 | 4 | if nargin<2 5 | param = struct; 6 | end 7 | 8 | rd = gsp_resistance_distances(G,param); 9 | 10 | end 11 | 12 | 13 | -------------------------------------------------------------------------------- /utils/gsp_smooth_downstep.m: -------------------------------------------------------------------------------- 1 | function y = gsp_smooth_downstep(x, a, o) 2 | %GSP_SMOOTH_DOWNSTEP Smooth downstep function from 1 to 0 3 | % Usage: y = gsp_smooth_downstep(x); 4 | % y = gsp_smooth_downstep(x, a); 5 | % y = gsp_smooth_downstep(x, a, o); 6 | % 7 | % Input parameters: 8 | % x : input value 9 | % a : smoothing parameter (default 1) 10 | % o : offset (default 1) 11 | % Ouput parameters: 12 | % y : output value of the function 13 | % 14 | % This function is a smooth downstep from 1 to 0 arround *o* using the 15 | % following function: 16 | % 17 | % .. f(x) = s(o-x) 18 | % 19 | % .. math:: f(x) = s(o-x) 20 | % 21 | % where 22 | % 23 | % .. / 0 if x < -1 24 | % .. s(x) = | exp(-a/x) / ( exp(-a/x) + exp(-a/(1-x)) ) if x in [-1, 1] 25 | % .. \ 1 if x > 1 26 | % 27 | % .. math:: s(x)=\begin{cases} 0 & \mbox{if }x<-1 \\ \frac{e^{-\frac{a}{x}}}{e^{-\frac{a}{x}}+e^{-\frac{a}{1-x}}} & \mbox{if }x\in[-1,1]\\ 1 & \mbox{if }x>1 \end{cases} 28 | % 29 | 30 | % Author: Nathanael Perraudin 31 | % Date : 5 mai 2016 32 | 33 | 34 | if nargin<3 35 | o = 1; 36 | end 37 | 38 | if nargin<3 39 | a = 1; 40 | end 41 | 42 | y = gsp_smooth_step(o-x, a); 43 | 44 | end 45 | 46 | 47 | -------------------------------------------------------------------------------- /utils/gsp_smooth_step.m: -------------------------------------------------------------------------------- 1 | function y = gsp_smooth_step(x, a) 2 | %GSP_SMOOTH_STEP Smooth step function from 0 to 1 arround 0.5 3 | % Usage: y = gsp_smooth_step(x); 4 | % y = gsp_smooth_step(x, a) 5 | % 6 | % Input parameters: 7 | % x : input value 8 | % a : smoothing parameter (default 1) 9 | % Ouput parameters: 10 | % y : output value of the function 11 | % 12 | % This function is a smooth step from 0 to 1 arround 0 using the 13 | % following function: 14 | % 15 | % .. / 0 if x < 0 16 | % .. s(x) = | exp(-a/x) / ( exp(-a/x) + exp(-a/(1-x)) ) if x in [0, 1] 17 | % .. \ 1 if x > 1 18 | % 19 | % .. math:: s(x)=\begin{cases} 0 & \mbox{if }x<0 \\ \frac{e^{-\frac{a}{x}}}{e^{-\frac{a}{x}}+e^{-\frac{a}{1-x}}} & \mbox{if }x\in[0,1]\\ 1 & \mbox{if }x>1 \end{cases} 20 | % 21 | 22 | 23 | % Author: Nathanael Perraudin 24 | % Date : 5 mai 2016 25 | 26 | 27 | if nargin<2 28 | a = 1; 29 | end 30 | 31 | y=fx(x,a); 32 | y = y./(y+fx(1-x,a)); 33 | 34 | end 35 | 36 | function y=fx(x,a) 37 | y = exp(-a./x); 38 | y(x<0)=0; 39 | end 40 | -------------------------------------------------------------------------------- /utils/gsp_strong.m: -------------------------------------------------------------------------------- 1 | function C = gsp_strong(A,B) 2 | %GSP_STRONG Strong product between matrices 3 | % Usage: C = gsp_strong(A,B) 4 | % 5 | % Input parameters: 6 | % A : matrix size N1*M1 7 | % B : matrix size N2*M2 8 | % Output parameters: 9 | % C : matrix size (N1xN2) * (M1xM2) 10 | % 11 | % 'gsp_strong' computes the strong product between two matrices A 12 | % and B. The cartesian product between two matrices is 13 | % 14 | % .. C = strong(A,B) = kron(A,B) + cartesian(A,B) 15 | % 16 | % .. math:: C = A \boxtimes B = A \otimes B + A \otimes I_{N_2} + I_{N_1} \otimes B 17 | % 18 | % See also: gsp_graph_product 19 | 20 | % Author : Francesco Grassi 21 | % Date : July 2016 22 | 23 | C = kron(A,B) + gsp_cartesian(A,B); 24 | 25 | 26 | end -------------------------------------------------------------------------------- /utils/gsp_symmetrize.m: -------------------------------------------------------------------------------- 1 | function W = gsp_symmetrize(W, type) 2 | %GSP_SYMMETRIZE symmetrize a matrix 3 | % Usage: W = gsp_symmetrize(W) 4 | % W = gsp_symmetrize(W, type) 5 | % 6 | % Input parameters: 7 | % W : square matrix 8 | % type : type of symmetrization (default 'full') 9 | % Output parameters: 10 | % W : symmetrized matrix 11 | % 12 | % The available symmetrization types are: 13 | % * 'average' : average of $W$ and $W^T$ (default) 14 | % * 'full' : copy the missing entries 15 | % * 'none' : nothing is done (the matrix might stay unsymmetric!) 16 | % 17 | 18 | % Author: Nathanael Perraudin 19 | % Date : 17 Janvier 2015 20 | 21 | if nargin < 2 22 | type = 'full'; 23 | end 24 | 25 | switch type 26 | case 'average' 27 | W = (W+W.')/2; 28 | case 'full' 29 | % Old version, slower 30 | % A = W>0; 31 | % M = logical(A - (A' & A)); 32 | % 33 | % W = W + M'.*W'; 34 | W = max(W, W'); 35 | case 'none' 36 | return 37 | otherwise 38 | error('GSP_SYMMETRIZE: Unknown type') 39 | end 40 | 41 | end 42 | -------------------------------------------------------------------------------- /utils/gsp_tree_depths.m: -------------------------------------------------------------------------------- 1 | function [depths,parents] = gsp_tree_depths(A,root) 2 | 3 | if gsp_check_connectivity(A) == 0 4 | error('Graph is not connected'); 5 | end 6 | 7 | N = size(A,1); 8 | assigned = root; 9 | depths = zeros(N,1); 10 | parents = zeros(N,1); 11 | 12 | next_to_expand = root; 13 | current_depth = 1; 14 | 15 | while ( length(assigned) < N ) 16 | new_entries_whole_round = []; 17 | for i = 1:length(next_to_expand) 18 | neighbors = find(A(next_to_expand(i),:)>1e-7); 19 | new_entries = setdiff(neighbors,assigned); 20 | parents(new_entries) = next_to_expand(i); 21 | depths(new_entries)=current_depth; 22 | assigned=[assigned;new_entries']; 23 | new_entries_whole_round=[new_entries_whole_round;new_entries']; 24 | end 25 | current_depth=current_depth+1; 26 | next_to_expand=new_entries_whole_round; 27 | end 28 | 29 | end 30 | 31 | -------------------------------------------------------------------------------- /utils/utils/boolean.m: -------------------------------------------------------------------------------- 1 | function y = boolean(x) 2 | 3 | y = logical(x); 4 | --------------------------------------------------------------------------------