├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .gitmodules ├── Contents.m ├── GPL.txt ├── LICENSE.txt ├── README.md ├── README.txt ├── builtins ├── @cvx │ ├── abs.m │ ├── blkdiag.m │ ├── builtins.m │ ├── cat.m │ ├── conj.m │ ├── conv.m │ ├── ctranspose.m │ ├── cumprod.m │ ├── cumsum.m │ ├── diag.m │ ├── disp.m │ ├── end.m │ ├── eq.m │ ├── exp.m │ ├── find.m │ ├── full.m │ ├── ge.m │ ├── gt.m │ ├── hankel.m │ ├── horzcat.m │ ├── imag.m │ ├── ipermute.m │ ├── isreal.m │ ├── kron.m │ ├── ldivide.m │ ├── le.m │ ├── log.m │ ├── lt.m │ ├── max.m │ ├── min.m │ ├── minus.m │ ├── mldivide.m │ ├── mpower.m │ ├── mrdivide.m │ ├── mtimes.m │ ├── ne.m │ ├── nnz.m │ ├── norm.m │ ├── permute.m │ ├── plus.m │ ├── polyval.m │ ├── power.m │ ├── prod.m │ ├── rdivide.m │ ├── real.m │ ├── reshape.m │ ├── size.m │ ├── sparse.m │ ├── spy.m │ ├── sqrt.m │ ├── std.m │ ├── subsasgn.m │ ├── subsref.m │ ├── sum.m │ ├── times.m │ ├── toeplitz.m │ ├── transpose.m │ ├── tril.m │ ├── triu.m │ ├── uminus.m │ ├── uplus.m │ ├── var.m │ └── vertcat.m ├── @cvxcnst │ ├── eq.m │ ├── ge.m │ ├── gt.m │ ├── le.m │ ├── lt.m │ └── ne.m └── Contents.m ├── commands ├── @cvx │ └── commands.m ├── Contents.m ├── cvx_begin.m ├── cvx_clear.m ├── cvx_end.m ├── cvx_expert.m ├── cvx_pause.m ├── cvx_power_warning.m ├── cvx_precision.m ├── cvx_profile.m ├── cvx_quiet.m ├── cvx_save_prefs.m ├── cvx_solver.m ├── cvx_solver_settings.m ├── cvx_tic.m ├── cvx_toc.m └── cvx_where.m ├── cvx_error.m ├── cvx_setup.m ├── cvx_startup.m ├── cvx_version.m ├── doc ├── Makefile ├── _static │ ├── cloud.css │ ├── cloud.js │ └── cvxrlogo.png ├── _templates │ └── getpdf.html ├── advanced.rst ├── basics.rst ├── citing.rst ├── conf.py ├── credits.rst ├── cvx_usage ├── cvx_usrguide.bib ├── cvx_usrguide.tex ├── dcp.rst ├── envelope.eps ├── envelope.pdf ├── fullpage.sty ├── funcref.rst ├── gp.rst ├── gurobi.rst ├── index.rst ├── install.rst ├── intro.rst ├── islsymb.sty ├── license.rst ├── mosek.rst ├── quickstart.rst ├── requirements.txt ├── sdp.rst ├── solver.rst ├── support.rst ├── tradeoff.eps └── tradeoff.pdf ├── examples ├── Contents.m ├── antenna_array_design │ ├── Contents.m │ ├── ant_array_min_beamwidth.m │ ├── ant_array_min_sidelobe.m │ ├── ant_array_min_therm_noise.m │ ├── broadband_array_min_sidelobe.m │ ├── html │ │ ├── ant_array_min_beamwidth.html │ │ ├── ant_array_min_beamwidth__01.png │ │ ├── ant_array_min_beamwidth__02.png │ │ ├── ant_array_min_beamwidth__03.png │ │ ├── ant_array_min_sidelobe.html │ │ ├── ant_array_min_sidelobe__01.png │ │ ├── ant_array_min_sidelobe__02.png │ │ ├── ant_array_min_sidelobe__03.png │ │ ├── ant_array_min_therm_noise.html │ │ ├── ant_array_min_therm_noise__01.png │ │ ├── ant_array_min_therm_noise__02.png │ │ ├── ant_array_min_therm_noise__03.png │ │ ├── broadband_array_min_sidelobe.html │ │ ├── broadband_array_min_sidelobe__01.png │ │ ├── broadband_array_min_sidelobe__02.png │ │ ├── broadband_array_min_sidelobe__03.png │ │ ├── line_array_spec_fact.html │ │ ├── line_array_spec_fact__01.png │ │ ├── line_array_spec_fact__02.png │ │ ├── polar_plot_ant.html │ │ └── spectral_fact.html │ ├── line_array_spec_fact.m │ ├── polar_plot_ant.m │ └── spectral_fact.m ├── bullet.gif ├── circuit_design │ ├── Contents.m │ ├── LC_osc_design.m │ ├── clock_mesh.m │ ├── dig_ckt_sizing.m │ ├── elmore_straight_wire.m │ ├── html │ │ ├── LC_osc_design.html │ │ ├── LC_osc_design__01.png │ │ ├── clock_mesh.html │ │ ├── clock_mesh__01.png │ │ ├── clock_mesh__02.png │ │ ├── clock_mesh__03.png │ │ ├── dig_ckt_sizing.html │ │ ├── dig_ckt_sizing__01.png │ │ ├── elmore_straight_wire.html │ │ ├── elmore_straight_wire__01.png │ │ ├── elmore_straight_wire__02.png │ │ ├── inverter_chain_sizing.html │ │ ├── inverter_chain_sizing__01.png │ │ ├── plot_four_tapers.html │ │ ├── simple_NAND2_gate_design.html │ │ ├── simple_NAND2_gate_design__01.png │ │ ├── simple_step.html │ │ ├── tristate_bus_sizing.html │ │ ├── tristate_bus_sizing__01.png │ │ ├── tristate_bus_sizing__02.png │ │ ├── tristate_bus_sizing__03.png │ │ ├── tristate_bus_sizing__04.png │ │ ├── tristate_bus_sizing__05.png │ │ ├── tristate_bus_sizing__06.png │ │ ├── tristate_bus_sizing__07.png │ │ ├── tristate_bus_sizing__08.png │ │ ├── tristate_bus_sizing__09.png │ │ ├── tristate_bus_sizing__10.png │ │ ├── tristate_bus_sizing__11.png │ │ ├── tristate_bus_sizing__12.png │ │ ├── tristate_bus_sizing__13.png │ │ ├── wire_driver_sizing.html │ │ ├── wire_driver_sizing__01.png │ │ ├── wire_driver_sizing__02.png │ │ ├── wire_driver_sizing__03.png │ │ ├── wire_sizing.html │ │ ├── wire_sizing__01.png │ │ ├── wire_sizing__02.png │ │ ├── wire_sizing__03.png │ │ ├── wire_sizing__04.png │ │ ├── wire_sizing__05.png │ │ ├── wire_sizing__06.png │ │ ├── wire_sizing_spacing.html │ │ ├── wire_sizing_spacing__01.png │ │ ├── wire_sizing_spacing__02.png │ │ ├── wire_sizing_spacing__03.png │ │ ├── wire_sizing_spacing__04.png │ │ ├── wire_sizing_spacing__05.png │ │ ├── wire_sizing_spacing__06.png │ │ ├── wire_sizing_spacing__07.png │ │ ├── wire_sizing_spacing__08.png │ │ ├── wire_sizing_spacing__09.png │ │ ├── wire_sizing_topology.html │ │ ├── wire_sizing_topology__01.png │ │ ├── wire_sizing_topology__02.png │ │ ├── wire_sizing_topology__03.png │ │ └── wire_sizing_topology__04.png │ ├── inverter_chain_sizing.m │ ├── plot_four_tapers.m │ ├── simple_NAND2_gate_design.m │ ├── simple_step.m │ ├── tristate_bus_sizing.m │ ├── wire_driver_sizing.m │ ├── wire_sizing.m │ ├── wire_sizing_spacing.m │ └── wire_sizing_topology.m ├── closest_toeplitz_psd.m ├── cvxbook │ ├── Ch04_cvx_opt_probs │ │ ├── Contents.m │ │ ├── cantilever_beam.m │ │ ├── cantilever_beam_plot.m │ │ ├── cantilever_beam_rec.m │ │ ├── channel_capacity.m │ │ ├── chebyshev_center.m │ │ ├── chebyshev_center_2D.m │ │ ├── ex_4_27.m │ │ ├── ex_4_3.m │ │ ├── ex_4_38.m │ │ ├── ex_4_5.m │ │ ├── fastest_mixing_MC.m │ │ ├── frob_norm_diag_scaling.m │ │ ├── html │ │ │ ├── cantilever_beam.html │ │ │ ├── cantilever_beam__01.png │ │ │ ├── cantilever_beam_plot.html │ │ │ ├── cantilever_beam_rec.html │ │ │ ├── cantilever_beam_rec__01.png │ │ │ ├── channel_capacity.html │ │ │ ├── chebyshev_center.html │ │ │ ├── chebyshev_center_2D.html │ │ │ ├── chebyshev_center_2D__01.png │ │ │ ├── ex_4_27.html │ │ │ ├── ex_4_3.html │ │ │ ├── ex_4_38.html │ │ │ ├── ex_4_5.html │ │ │ ├── fastest_mixing_MC.html │ │ │ ├── frob_norm_diag_scaling.html │ │ │ ├── logopt_investment.html │ │ │ ├── logopt_investment__01.png │ │ │ ├── max_det_psd_completion.html │ │ │ └── min_spec_rad_ppl_dynamics.html │ │ ├── logopt_investment.m │ │ ├── max_det_psd_completion.m │ │ └── min_spec_rad_ppl_dynamics.m │ ├── Ch05_duality │ │ ├── Contents.m │ │ ├── ex_5_1.m │ │ ├── ex_5_19.m │ │ ├── ex_5_33.m │ │ ├── ex_5_39.m │ │ ├── html │ │ │ ├── ex_5_1.html │ │ │ ├── ex_5_19.html │ │ │ ├── ex_5_1__01.png │ │ │ ├── ex_5_33.html │ │ │ ├── ex_5_33__01.png │ │ │ ├── ex_5_39.html │ │ │ ├── matrix_games.html │ │ │ ├── matrix_games_LP.html │ │ │ ├── norm_approx.html │ │ │ └── qcqp.html │ │ ├── matrix_games.m │ │ ├── matrix_games_LP.m │ │ ├── norm_approx.m │ │ └── qcqp.m │ ├── Ch06_approx_fitting │ │ ├── Contents.m │ │ ├── basispursuit.m │ │ ├── convex_interpolation.m │ │ ├── deadzone.m │ │ ├── fig6_15.m │ │ ├── fig6_19.m │ │ ├── fig6_20.m │ │ ├── fig6_5.m │ │ ├── fig6_6.m │ │ ├── fig6_9.m │ │ ├── html │ │ │ ├── basispursuit.html │ │ │ ├── basispursuit__01.png │ │ │ ├── basispursuit__02.png │ │ │ ├── basispursuit__03.png │ │ │ ├── convex_interpolation.html │ │ │ ├── convex_interpolation__01.png │ │ │ ├── deadzone.html │ │ │ ├── fig6_15.html │ │ │ ├── fig6_15__01.png │ │ │ ├── fig6_19.html │ │ │ ├── fig6_19__01.png │ │ │ ├── fig6_20.html │ │ │ ├── fig6_20__01.png │ │ │ ├── fig6_5.html │ │ │ ├── fig6_5__01.png │ │ │ ├── fig6_6.html │ │ │ ├── fig6_6__01.png │ │ │ ├── fig6_6__02.png │ │ │ ├── fig6_6__03.png │ │ │ ├── fig6_6__04.png │ │ │ ├── fig6_6__05.png │ │ │ ├── fig6_6__06.png │ │ │ ├── fig6_9.html │ │ │ ├── fig6_9__01.png │ │ │ ├── penalty_comp_cvx.html │ │ │ ├── penalty_comp_cvx__01.png │ │ │ ├── preference_regions.html │ │ │ ├── preference_regions__01.png │ │ │ ├── preference_regions__02.png │ │ │ ├── regressor_cvx.html │ │ │ ├── regressor_cvx__01.png │ │ │ ├── smoothrec_cvx.html │ │ │ ├── smoothrec_cvx__01.png │ │ │ ├── smoothrec_cvx__02.png │ │ │ ├── smoothrec_cvx__03.png │ │ │ ├── tv_cvx.html │ │ │ ├── tv_cvx__01.png │ │ │ ├── tv_cvx__02.png │ │ │ ├── tv_cvx__03.png │ │ │ ├── tv_cvx__04.png │ │ │ ├── tv_cvx__05.png │ │ │ ├── wcrobls.html │ │ │ └── wcrobls__01.png │ │ ├── penalty_comp_cvx.m │ │ ├── preference_regions.m │ │ ├── regressor_cvx.m │ │ ├── smoothrec_cvx.m │ │ ├── tv_cvx.m │ │ └── wcrobls.m │ ├── Ch07_statistical_estim │ │ ├── Contents.m │ │ ├── ML_covariance_est.m │ │ ├── cheb.m │ │ ├── cher.m │ │ ├── counting_problem_poisson.m │ │ ├── detector2.m │ │ ├── expdesign.m │ │ ├── html │ │ │ ├── ML_covariance_est.html │ │ │ ├── cheb.html │ │ │ ├── cher.html │ │ │ ├── counting_problem_poisson.html │ │ │ ├── detector2.html │ │ │ ├── detector2__01.png │ │ │ ├── expdesign.html │ │ │ ├── expdesign__01.png │ │ │ ├── expdesign__02.png │ │ │ ├── expdesign__03.png │ │ │ ├── expdesign__04.png │ │ │ ├── logistics.html │ │ │ ├── logistics__01.png │ │ │ ├── logistics_gp.html │ │ │ ├── logistics_gp__01.png │ │ │ ├── maxent.html │ │ │ ├── maxent__01.png │ │ │ ├── maxent__02.png │ │ │ ├── montecarlo.html │ │ │ ├── probbounds.html │ │ │ ├── probbounds__01.png │ │ │ ├── probbounds__02.png │ │ │ └── probbounds__03.png │ │ ├── logistics.m │ │ ├── logistics_gp.m │ │ ├── maxent.m │ │ ├── montecarlo.m │ │ └── probbounds.m │ ├── Ch08_geometric_probs │ │ ├── Contents.m │ │ ├── analytic_center.m │ │ ├── data_floorplan_32.mat │ │ ├── data_floorplan_60.mat │ │ ├── eucl_dist_poly.m │ │ ├── eucl_dist_poly_2D.m │ │ ├── eucl_proj_cone1.m │ │ ├── eucl_proj_cone2.m │ │ ├── eucl_proj_hlf.m │ │ ├── eucl_proj_hyp.m │ │ ├── eucl_proj_rect.m │ │ ├── eucl_proj_rect.m~ │ │ ├── ex_8_3.m │ │ ├── ex_8_4.m │ │ ├── ex_8_5.m │ │ ├── floor_plan.m │ │ ├── floor_plan_graphs.m │ │ ├── floorplan.m │ │ ├── html │ │ │ ├── analytic_center.html │ │ │ ├── eucl_dist_poly.html │ │ │ ├── eucl_dist_poly_2D.html │ │ │ ├── eucl_dist_poly_2D__01.png │ │ │ ├── eucl_proj_cone1.html │ │ │ ├── eucl_proj_cone2.html │ │ │ ├── eucl_proj_hlf.html │ │ │ ├── eucl_proj_hyp.html │ │ │ ├── eucl_proj_rect.html │ │ │ ├── ex_8_3.html │ │ │ ├── ex_8_4.html │ │ │ ├── ex_8_5.html │ │ │ ├── floor_plan.html │ │ │ ├── floor_plan__01.png │ │ │ ├── floor_plan_graphs.html │ │ │ ├── floor_plan_graphs__01.png │ │ │ ├── floorplan.html │ │ │ ├── linear_discr.html │ │ │ ├── linear_discr__01.png │ │ │ ├── max_vol_ellip_in_polyhedra.html │ │ │ ├── max_vol_ellip_in_polyhedra__01.png │ │ │ ├── min_vol_elp_finite_set.html │ │ │ ├── min_vol_elp_finite_set__01.png │ │ │ ├── min_vol_union_ellip.html │ │ │ ├── min_vol_union_ellip__01.png │ │ │ ├── placement_lin.html │ │ │ ├── placement_lin__01.png │ │ │ ├── placement_lin__02.png │ │ │ ├── placement_quad.html │ │ │ ├── placement_quad__01.png │ │ │ ├── placement_quad__02.png │ │ │ ├── placement_quar.html │ │ │ ├── placement_quar__01.png │ │ │ ├── placement_quar__02.png │ │ │ ├── poly3_discr.html │ │ │ ├── poly3_discr__01.png │ │ │ ├── poly4_discr.html │ │ │ ├── poly4_discr__01.png │ │ │ ├── quad_discr.html │ │ │ ├── quad_discr__01.png │ │ │ ├── robust_lin_discr.html │ │ │ ├── robust_lin_discr__01.png │ │ │ ├── separate_ell_2D.html │ │ │ ├── separate_ell_2D__01.png │ │ │ ├── separate_poly_2D.html │ │ │ ├── separate_poly_2D__01.png │ │ │ ├── separate_pt_poly.html │ │ │ ├── svm_1.html │ │ │ ├── svm_1__01.png │ │ │ ├── svm_2.html │ │ │ ├── svm_2__01.png │ │ │ ├── test_floorplan.html │ │ │ └── test_floorplan__01.png │ │ ├── linear_discr.m │ │ ├── max_vol_ellip_in_polyhedra.m │ │ ├── min_vol_elp_finite_set.m │ │ ├── min_vol_union_ellip.m │ │ ├── placement_lin.m │ │ ├── placement_quad.m │ │ ├── placement_quar.m │ │ ├── poly3_discr.m │ │ ├── poly4_discr.m │ │ ├── quad_discr.m │ │ ├── robust_lin_discr.m │ │ ├── separate_ell_2D.m │ │ ├── separate_poly_2D.m │ │ ├── separate_pt_poly.m │ │ ├── svm_1.m │ │ ├── svm_2.m │ │ └── test_floorplan.m │ ├── Ch11_intpt_methods │ │ ├── Contents.m │ │ ├── html │ │ │ └── log_utility_flow.html │ │ └── log_utility_flow.m │ └── Contents.m ├── equality_constr_norm_min.m ├── examples.css ├── examples.js ├── filter_design │ ├── Contents.m │ ├── equalizer_design.m │ ├── fir_chebychev_design.m │ ├── fir_lin_phase_lowpass_max_atten.m │ ├── fir_lin_phase_lowpass_min_order.m │ ├── fir_lin_phase_lowpass_min_ripple.m │ ├── fir_lin_phase_lowpass_min_trans.m │ ├── fir_mag_design_lowpass_max_atten.m │ ├── fir_mag_design_lowpass_min_order.m │ ├── html │ │ ├── equalizer_design.html │ │ ├── equalizer_design__01.png │ │ ├── equalizer_design__02.png │ │ ├── equalizer_design__03.png │ │ ├── equalizer_design__04.png │ │ ├── equalizer_design__05.png │ │ ├── equalizer_design__06.png │ │ ├── equalizer_design__07.png │ │ ├── equalizer_design__08.png │ │ ├── fir_chebychev_design.html │ │ ├── fir_chebychev_design__01.png │ │ ├── fir_chebychev_design__02.png │ │ ├── fir_lin_phase_lowpass_max_atten.html │ │ ├── fir_lin_phase_lowpass_max_atten__01.png │ │ ├── fir_lin_phase_lowpass_max_atten__02.png │ │ ├── fir_lin_phase_lowpass_min_order.html │ │ ├── fir_lin_phase_lowpass_min_order__01.png │ │ ├── fir_lin_phase_lowpass_min_order__02.png │ │ ├── fir_lin_phase_lowpass_min_ripple.html │ │ ├── fir_lin_phase_lowpass_min_ripple__01.png │ │ ├── fir_lin_phase_lowpass_min_ripple__02.png │ │ ├── fir_lin_phase_lowpass_min_trans.html │ │ ├── fir_lin_phase_lowpass_min_trans__01.png │ │ ├── fir_lin_phase_lowpass_min_trans__02.png │ │ ├── fir_mag_design_lowpass_max_atten.html │ │ ├── fir_mag_design_lowpass_max_atten__01.png │ │ ├── fir_mag_design_lowpass_max_atten__02.png │ │ ├── fir_mag_design_lowpass_min_order.html │ │ ├── fir_mag_design_lowpass_min_order__01.png │ │ ├── fir_mag_design_lowpass_min_order__02.png │ │ ├── iir_mag_design_bandpass_max_atten.html │ │ ├── iir_mag_design_bandpass_max_atten__01.png │ │ ├── iir_mag_design_lowpass_max_atten.html │ │ ├── iir_mag_design_lowpass_max_atten__01.png │ │ ├── one_over_f_filter.html │ │ ├── one_over_f_filter__01.png │ │ └── spectral_fact.html │ ├── iir_mag_design_bandpass_max_atten.m │ ├── iir_mag_design_lowpass_max_atten.m │ ├── one_over_f_filter.m │ └── spectral_fact.m ├── gp_tutorial │ ├── Contents.m │ ├── basic_odp.m │ ├── beta_min_odp.m │ ├── elmore_interconnect.m │ ├── floor_planning.m │ ├── html │ │ ├── basic_odp.html │ │ ├── basic_odp__01.png │ │ ├── beta_min_odp.html │ │ ├── beta_min_odp__01.png │ │ ├── elmore_interconnect.html │ │ ├── elmore_interconnect__01.png │ │ ├── floor_planning.html │ │ ├── floor_planning__01.png │ │ ├── max_volume_box.html │ │ ├── max_volume_box__01.png │ │ ├── power_control.html │ │ ├── simple_dig_ckt_sizing.html │ │ ├── simple_dig_ckt_sizing__01.png │ │ ├── simple_dig_ckt_sizing_vect.html │ │ └── simple_dig_ckt_sizing_vect__01.png │ ├── max_volume_box.m │ ├── power_control.m │ ├── simple_dig_ckt_sizing.m │ └── simple_dig_ckt_sizing_vect.m ├── graph_laplacian │ ├── Contents.m │ ├── best_const.m │ ├── cut_grid_data.m │ ├── cut_grid_example.m │ ├── fdla.m │ ├── fmmc.m │ ├── html │ │ ├── best_const.html │ │ ├── cut_grid_data.html │ │ ├── cut_grid_example.html │ │ ├── cut_grid_example__01.png │ │ ├── cut_grid_example__02.png │ │ ├── cut_grid_example__03.png │ │ ├── cut_grid_example__04.png │ │ ├── cut_grid_example__05.png │ │ ├── fdla.html │ │ ├── fmmc.html │ │ ├── larger_example.html │ │ ├── larger_example__01.png │ │ ├── larger_example__02.png │ │ ├── larger_example__03.png │ │ ├── larger_example__04.png │ │ ├── larger_example__05.png │ │ ├── larger_example__06.png │ │ ├── max_deg.html │ │ ├── mh.html │ │ ├── plotgraph.html │ │ ├── small_example.html │ │ ├── small_example__01.png │ │ ├── small_example__02.png │ │ ├── small_example__03.png │ │ ├── small_example__04.png │ │ └── small_example__05.png │ ├── larger_example.m │ ├── max_deg.m │ ├── mh.m │ ├── plotgraph.m │ └── small_example.m ├── html │ ├── closest_toeplitz_psd.html │ ├── equality_constr_norm_min.html │ ├── min_phase_spectral_fact.html │ ├── nonneg_matrix_fact.html │ ├── nonneg_matrix_fact__01.png │ ├── quickstart.html │ ├── quickstart__01.png │ ├── regularized_norm_tradeoff.html │ ├── regularized_norm_tradeoff__01.png │ ├── regularized_norm_tradeoff__02.png │ ├── simple_LP.html │ ├── simple_LP2.html │ └── simple_LS.html ├── index.html ├── log_exp │ ├── Contents.m │ ├── html │ │ ├── max_entropy.html │ │ ├── sparse_covariance_est.html │ │ ├── sparse_covariance_est__01.png │ │ ├── sparse_covariance_est_tradeoff.html │ │ ├── sparse_covariance_est_tradeoff__01.png │ │ └── weighted_analytic_center.html │ ├── max_entropy.m │ ├── sparse_covariance_est.m │ ├── sparse_covariance_est_tradeoff.m │ └── weighted_analytic_center.m ├── make.m ├── min_phase_spectral_fact.m ├── minus.gif ├── nonneg_matrix_fact.m ├── plus.gif ├── quickstart.m ├── regularized_norm_tradeoff.m ├── simple_LP.m ├── simple_LP2.m ├── simple_LS.m ├── sparse_heuristics │ ├── Contents.m │ ├── html │ │ ├── sparse_infeas.html │ │ ├── sparse_infeas_dual.html │ │ ├── sparse_solution.html │ │ └── sparse_solution__01.png │ ├── sparse_infeas.m │ ├── sparse_infeas_dual.m │ └── sparse_solution.m └── time_series_analysis │ ├── Contents.m │ ├── html │ ├── l1_trend_filter_snp500.html │ └── l1_trend_filter_snp500__01.png │ ├── l1_trend_filter_snp500.m │ └── snp500.txt ├── functions ├── @cvx │ ├── avg_abs_dev.m │ ├── avg_abs_dev_med.m │ ├── berhu.m │ ├── cvx_recip.m │ ├── det_inv.m │ ├── det_rootn.m │ ├── functions.m │ ├── geo_mean.m │ ├── huber_pos.m │ ├── inv_pos.m │ ├── lambda_max.m │ ├── lambda_sum_largest.m │ ├── log_normcdf.m │ ├── log_sum_exp.m │ ├── matrix_frac.m │ ├── norm_nuc.m │ ├── norms.m │ ├── pow_abs.m │ ├── pow_cvx.m │ ├── pow_p.m │ ├── pow_pos.m │ ├── prod_inv.m │ ├── quad_form.m │ ├── quad_over_lin.m │ ├── quad_pos_over_lin.m │ ├── rel_entr.m │ ├── sigma_max.m │ ├── square.m │ ├── square_abs.m │ ├── square_pos.m │ ├── sum_largest.m │ ├── sum_log.m │ ├── sum_square.m │ ├── sum_square_abs.m │ ├── sum_square_pos.m │ ├── trace_inv.m │ ├── trace_sqrtm.m │ └── vec.m ├── Contents.m ├── avg_abs_dev.m ├── avg_abs_dev_med.m ├── berhu.m ├── det_inv.m ├── det_root2n.m ├── det_rootn.m ├── entr.m ├── geo_mean.m ├── geomean.m ├── huber.m ├── huber_circ.m ├── huber_pos.m ├── inv_pos.m ├── kl_div.m ├── lambda_max.m ├── lambda_min.m ├── lambda_sum_largest.m ├── lambda_sum_smallest.m ├── log_det.m ├── log_normcdf.m ├── log_prod.m ├── log_sum_exp.m ├── logsumexp.m ├── logsumexp_sdp.m ├── matrix_frac.m ├── norm_largest.m ├── norm_nuc.m ├── norms.m ├── norms_largest.m ├── poly_env.m ├── polyenv.m ├── polyval_trig.m ├── pos.m ├── pow_abs.m ├── pow_p.m ├── pow_pos.m ├── prod_inv.m ├── quad_form.m ├── quad_over_lin.m ├── quad_pos_over_lin.m ├── rel_entr.m ├── sigma_max.m ├── square_ │ └── square.m ├── square_abs.m ├── square_pos.m ├── sum_largest.m ├── sum_log.m ├── sum_smallest.m ├── sum_square.m ├── sum_square_abs.m ├── sum_square_pos.m ├── sym.m ├── trace_inv.m ├── trace_sqrtm.m └── vec_ │ └── vec.m ├── keywords ├── Contents.m ├── In.m ├── binary.m ├── dual.m ├── epigraph.m ├── expression.m ├── expressions.m ├── hypograph.m ├── integer.m ├── maximise.m ├── maximize.m ├── minimise.m ├── minimize.m ├── subject.m ├── variable.m └── variables.m ├── lib ├── @cell │ ├── cvx_id.m │ ├── cvx_setdual.m │ └── cvx_value.m ├── @cvx │ ├── bcompress.m │ ├── buncompress.m │ ├── cvx.m │ ├── cvx_basis.m │ ├── cvx_classify.m │ ├── cvx_constant.m │ ├── cvx_getdual.m │ ├── cvx_isaffine.m │ ├── cvx_isconcave.m │ ├── cvx_isconstant.m │ ├── cvx_isconvex.m │ ├── cvx_isnonzero.m │ ├── cvx_readlevel.m │ ├── cvx_setdual.m │ ├── cvx_value.m │ ├── cvx_vexity.m │ ├── in.m │ ├── keywords.m │ ├── matlab6.m │ ├── sets.m │ ├── sparsify.m │ ├── svec.m │ ├── type.m │ └── value.m ├── @cvxcnst │ ├── cvxcnst.m │ ├── disp.m │ ├── display.m │ ├── double.m │ ├── logical.m │ └── rhs.m ├── @cvxdual │ ├── colon.m │ ├── cvx_basis.m │ ├── cvx_value.m │ ├── cvxaff.m │ ├── cvxdual.m │ ├── disp.m │ ├── display.m │ ├── dof.m │ ├── inuse.m │ ├── isreal.m │ ├── name.m │ ├── problem.m │ ├── size.m │ ├── subsref.m │ ├── type.m │ └── value.m ├── @cvxin │ ├── cvxin.m │ ├── cvxtuple.m │ ├── gt.m │ └── lt.m ├── @cvxobj │ ├── cvx_id.m │ ├── cvxobj.m │ ├── disp.m │ ├── display.m │ ├── isempty.m │ ├── isequal.m │ ├── length.m │ ├── ndims.m │ ├── numel.m │ ├── subsasgn.m │ └── subsref.m ├── @cvxprob │ ├── cvx_value.m │ ├── cvxprob.m │ ├── disp.m │ ├── eliminate.m │ ├── eq.m │ ├── extract.m │ ├── index.m │ ├── ne.m │ ├── newcnstr.m │ ├── newdual.m │ ├── newnonl.m │ ├── newobj.m │ ├── newtemp.m │ ├── newvar.m │ ├── pop.m │ ├── solve.m │ ├── spy.m │ ├── subsasgn.m │ ├── subsref.m │ └── touch.m ├── @cvxtuple │ ├── apply.m │ ├── cvx_collapse.m │ ├── cvx_constant.m │ ├── cvx_getdual.m │ ├── cvx_id.m │ ├── cvx_isaffine.m │ ├── cvx_isconcave.m │ ├── cvx_isconstant.m │ ├── cvx_isconvex.m │ ├── cvx_setdual.m │ ├── cvx_value.m │ ├── cvxtuple.m │ ├── disp.m │ ├── eq.m │ ├── ge.m │ ├── gt.m │ ├── in.m │ ├── le.m │ ├── lt.m │ ├── ne.m │ ├── numel.m │ ├── subsasgn.m │ ├── subsref.m │ └── testall.m ├── Contents.m ├── cvx_accept_concave.m ├── cvx_accept_convex.m ├── cvx_basis.m ├── cvx_bcompress.m ├── cvx_bcompress_mex.c ├── cvx_blkdiag.m ├── cvx_c2r.m ├── cvx_check_dimension.m ├── cvx_check_dimlist.m ├── cvx_class.m ├── cvx_classify.m ├── cvx_clearpath.m ├── cvx_clearspath.m ├── cvx_collapse.m ├── cvx_constant.m ├── cvx_default_dimension.m ├── cvx_eliminate_mex.c ├── cvx_expand_dim.m ├── cvx_expert_check.m ├── cvx_getdual.m ├── cvx_global.m ├── cvx_id.m ├── cvx_ids.m ├── cvx_isaffine.m ├── cvx_isconcave.m ├── cvx_isconstant.m ├── cvx_isconvex.m ├── cvx_isnonzero.m ├── cvx_r2c.m ├── cvx_readlevel.m ├── cvx_reduce_size.m ├── cvx_remap.m ├── cvx_reshape.m ├── cvx_run_solver.m ├── cvx_setdual.m ├── cvx_setpath.m ├── cvx_setspath.m ├── cvx_size_check.m ├── cvx_subs2str.m ├── cvx_subsasgn.m ├── cvx_subsref.m ├── cvx_subsref_check.m ├── cvx_use_sparse.m ├── cvx_value.m ├── cvx_values.m ├── cvx_vexity.m ├── cvx_zeros.m └── narginchk_ │ └── narginchk.m ├── sets ├── Contents.m ├── complex_lorentz.m ├── convex_poly_coeffs.m ├── exponential.m ├── geo_mean_cone.m ├── hermitian_semidefinite.m ├── lorentz.m ├── nonneg_poly_coeffs.m ├── nonnegative.m ├── norm_ball.m ├── rotated_complex_lorentz.m ├── rotated_lorentz.m ├── semidefinite.m └── simplex.m ├── shims ├── cvx_glpk.m ├── cvx_gurobi.m ├── cvx_mosek.m ├── cvx_sdpt3.m └── cvx_sedumi.m ├── solvers.txt └── structures ├── @cvx └── structures.m ├── Contents.m ├── cvx_create_structure.m ├── cvx_invert_structure.m ├── cvx_orthog_structure.m ├── cvx_replicate_structure.m ├── cvx_s_banded.m ├── cvx_s_hankel.m ├── cvx_s_hermitian.m ├── cvx_s_sparse.m ├── cvx_s_symmetric.m ├── cvx_s_symmetric_ut.m └── cvx_s_upper_hankel.m /.gitignore: -------------------------------------------------------------------------------- 1 | doc/_build 2 | sedumi/ 3 | sdpt3/ 4 | sedumi.tgz 5 | sedumi.zip 6 | sdpt3.tgz 7 | sdpt3.zip 8 | lib/*.mex* 9 | lib/*/*.mex 10 | 11 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/.gitmodules -------------------------------------------------------------------------------- /builtins/@cvx/conj.m: -------------------------------------------------------------------------------- 1 | function y = conj( x ) 2 | 3 | %Disciplined convex/geometric programming information for CONJ: 4 | % CONJ(X) imposes no convexity restrictions on its arguments. However, 5 | % since CONJ(X)=X when X is real, it is only useful for complex 6 | % affine expressions. 7 | 8 | y = cvx( x.size_, conj( x.basis_ ) ); 9 | 10 | % Copyright 2005-2016 CVX Research, Inc. 11 | % See the file LICENSE.txt for full copyright information. 12 | % The command 'cvx_where' will show where this file is located. 13 | -------------------------------------------------------------------------------- /builtins/@cvx/ctranspose.m: -------------------------------------------------------------------------------- 1 | function y = ctranspose( x ) 2 | 3 | %Disciplined convex/geometric programming information for CTRANSPOSE (.): 4 | % The complex conjugate transpose operation may be applied to CVX 5 | % variables without restriction. 6 | 7 | % 8 | % Determine permutation 9 | % 10 | 11 | s = x.size_; 12 | if length( s ) > 2, 13 | error( 'Transpose of an ND array is not defined.' ); 14 | end 15 | 16 | % 17 | % Permute the data 18 | % 19 | 20 | ndxs = 1 : prod( s ); 21 | ndx2 = reshape( ndxs, s ).'; 22 | b = conj( x.basis_ ); 23 | try 24 | b = b( :, ndx2 ); 25 | catch %#ok 26 | ndxs( ndx2( : ).' ) = ndxs; 27 | [ r, c, v ] = find( b ); 28 | b = sparse( r, ndxs( c ), v, size( b, 1 ), size( b, 2 ) ); 29 | clear r c v 30 | end 31 | y = cvx( size( ndx2 ), b ); 32 | 33 | % Copyright 2005-2016 CVX Research, Inc. 34 | % See the file LICENSE.txt for full copyright information. 35 | % The command 'cvx_where' will show where this file is located. 36 | -------------------------------------------------------------------------------- /builtins/@cvx/disp.m: -------------------------------------------------------------------------------- 1 | function disp( x, prefix ) 2 | if nargin < 2, 3 | prefix = ''; 4 | end 5 | disp( [ prefix, 'cvx ', cvx_class( x, true, true, true ), ' expression (', type( x ), ')' ] ); 6 | dual = cvx_getdual( x ); 7 | if ~isempty( dual ), 8 | disp( [ prefix, ' tied to dual variable: ', dual.subs ] ); 9 | end 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | -------------------------------------------------------------------------------- /builtins/@cvx/end.m: -------------------------------------------------------------------------------- 1 | function y = end( x, k, n ) 2 | 3 | %Disciplined convex/geometric programming information for END: 4 | % The use of END as an array subscript (e.g., X(:,end)) is identical 5 | % with CVX variables as it is for numeric vectors and arrays. 6 | 7 | sz = size( x ); 8 | nz = length( sz ); 9 | if k > nz, 10 | y = 1; 11 | elseif k < n || nz <= n, 12 | y = sz( k ); 13 | else 14 | y = prod( sz( k : end ) ); 15 | end 16 | 17 | % Copyright 2005-2016 CVX Research, Inc. 18 | % See the file LICENSE.txt for full copyright information. 19 | % The command 'cvx_where' will show where this file is located. 20 | -------------------------------------------------------------------------------- /builtins/@cvx/eq.m: -------------------------------------------------------------------------------- 1 | function a = eq( x, y ) 2 | 3 | %Disciplined convex programming information for EQ (==): 4 | % Both the left- and right-hand sides of an equality constraint must 5 | % be affine (or constant). If either side of the constraint is complex, 6 | % then the real and imaginary portions are constrained separately. 7 | % 8 | %Disciplined geometric programming information for EQ (>): 9 | % Both the left- and right-hand sides of an equality constraint must 10 | % be log-affine, which includes positive constants and monomials. 11 | 12 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '==' ); 13 | if nargout, a = b; end 14 | 15 | % Copyright 2005-2016 CVX Research, Inc. 16 | % See the file LICENSE.txt for full copyright information. 17 | % The command 'cvx_where' will show where this file is located. 18 | -------------------------------------------------------------------------------- /builtins/@cvx/full.m: -------------------------------------------------------------------------------- 1 | function z = full( x ) 2 | 3 | % Disciplined convex/geometric programming information for FULL (+): 4 | % This is effectively a "no-op", and can be used in DCPs and DGPs 5 | % without restrictions. 6 | 7 | z = x; 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /builtins/@cvx/horzcat.m: -------------------------------------------------------------------------------- 1 | function y = horzcat( varargin ) 2 | y = cat( 2, varargin{:} ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /builtins/@cvx/imag.m: -------------------------------------------------------------------------------- 1 | function y = imag( x ) 2 | 3 | %Disciplined convex/geometric programming information for IMAG: 4 | % IMAG(X) may be freely applied to any CVX expression. Of course, 5 | % IMAG(X)=0 for all real expressions (including convex, concave, 6 | % log-convex, and log-concave), so it is primarily useful in the 7 | % complex affine case. 8 | 9 | y = cvx( x.size_, imag( x.basis_ ) ); 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | -------------------------------------------------------------------------------- /builtins/@cvx/ipermute.m: -------------------------------------------------------------------------------- 1 | function y = ipermute( x, order ) 2 | 3 | % Disciplined convex/geometric programming information for IPERMUTE: 4 | % IPERMUTE(A,ORDER) imposes no convexity restrictions on A. ORDER 5 | % must be constant. 6 | 7 | % 8 | % Determine the permutation 9 | % 10 | 11 | s = x.size_; 12 | ndxs = 1 : prod( s ); 13 | ndx2 = ipermute( reshape( ndxs, s ), order ); 14 | 15 | % 16 | % Permute the data 17 | % 18 | 19 | b = x.basis_; 20 | try 21 | b = b( :, ndx2 ); 22 | catch 23 | ndxs( ndx2( : ).' ) = ndxs; 24 | [ r, c, v ] = find( b ); 25 | b = sparse( r, ndxs( c ), v, size( b, 1 ), size( b, 2 ) ); 26 | clear r c v 27 | end 28 | y = cvx( size( ndx2 ), b ); 29 | 30 | % Copyright 2005-2016 CVX Research, Inc. 31 | % See the file LICENSE.txt for full copyright information. 32 | % The command 'cvx_where' will show where this file is located. 33 | -------------------------------------------------------------------------------- /builtins/@cvx/isreal.m: -------------------------------------------------------------------------------- 1 | function y = isreal( x, full ) 2 | 3 | %Disciplined convex/geometric programming information for ISREAL: 4 | % ISREAL(X) may be freely applied to any CVX expression. It will 5 | % return TRUE for all real affine, convex, concave, log-convex, 6 | % and log-concave expressions, and FALSE for complex affine 7 | % expressions. 8 | 9 | y = x.basis_; 10 | if nargin > 1 && full, 11 | y = any( imag( y ), 1 ); 12 | else 13 | y = isreal( x.basis_ ) | nnz(imag(x.basis_)) == 0; 14 | end 15 | 16 | % Copyright 2005-2016 CVX Research, Inc. 17 | % See the file LICENSE.txt for full copyright information. 18 | % The command 'cvx_where' will show where this file is located. 19 | -------------------------------------------------------------------------------- /builtins/@cvx/ldivide.m: -------------------------------------------------------------------------------- 1 | function z = ldivide( x, y ) 2 | 3 | %Disciplined convex programming information for LDIVIDE: 4 | % For DCP purposes, the LDIVIDE division operator X.\Y is equivalent to 5 | % (1./X).*Y. The left-hand term must be constant and non-zero; and if the 6 | % right-hand term is nonlinear, t constant must also be real. 7 | % 8 | %Disciplined geometric programming information for LDIVIDE: 9 | % Terms in a left divide must have opposite log-curvature, so the 10 | % following products are permitted: 11 | % {log-convex} .\ {log-concave} {log-concave} .\ {log-convex} 12 | % {log-affine} .\ {log-affine} 13 | % Note that log-affine expressions are both log-convex and log-concave. 14 | % 15 | %For vectors, matrices, and arrays, these rules are verified indepdently 16 | %for each element. 17 | 18 | z = times( x, y, '.\' ); 19 | 20 | % Copyright 2005-2016 CVX Research, Inc. 21 | % See the file LICENSE.txt for full copyright information. 22 | % The command 'cvx_where' will show where this file is located. 23 | -------------------------------------------------------------------------------- /builtins/@cvx/mldivide.m: -------------------------------------------------------------------------------- 1 | function z = mldivide( x, y ) 2 | 3 | % Disciplined convex/geomtric programming information for MLDIVIDE: 4 | % The MLDIVIDE operation X\Y can be employed with X as a scalar. In 5 | % that case, it is equivalent to the LDIVIDE operation X.\Y, and 6 | % must obey the same rules as outlined in the help for CVX/LDIVIDE. 7 | % 8 | % When X is a matrix, the MRDIVIDE operation X\Y is equivalent to 9 | % inv(X)*Y for both DCP and DGP purposes. The inv() operation is 10 | % not supported for non-constant expressions, so X must be both 11 | % constant and nonsingular. The resulting matrix multiplication 12 | % must obey the same rules as outlined in the help for CVX/MTIMES. 13 | 14 | z = mtimes( x, y, 'ldivide' ); 15 | 16 | % Copyright 2005-2016 CVX Research, Inc. 17 | % See the file LICENSE.txt for full copyright information. 18 | % The command 'cvx_where' will show where this file is located. 19 | -------------------------------------------------------------------------------- /builtins/@cvx/mpower.m: -------------------------------------------------------------------------------- 1 | function z = mpower( x, y ) 2 | 3 | % Disciplined convex/geometric programming information for MPOWER (^): 4 | % The CVX version of the matrix power function Z=X.^Y supports only 5 | % the case where X and Y are scalars. In such instances, the rules 6 | % are identical to those outlined in the help for CVX/POWER. 7 | 8 | if length( x ) == 1 && length( y ) == 1, 9 | z = power( x, y ); 10 | else 11 | error( 'Disciplined convex programming error:\n Matrix powers not permitted.', 1 ); %#ok 12 | end 13 | 14 | % Copyright 2005-2016 CVX Research, Inc. 15 | % See the file LICENSE.txt for full copyright information. 16 | % The command 'cvx_where' will show where this file is located. 17 | -------------------------------------------------------------------------------- /builtins/@cvx/mrdivide.m: -------------------------------------------------------------------------------- 1 | function z = mrdivide( x, y ) 2 | 3 | % Disciplined convex/geomtric programming information for MRDIVIDE: 4 | % The MRDIVIDE operation X/Y is quite often employed with Y as a 5 | % scalar. In that case, it is equivalent to the RDIVIDE operation 6 | % X./Y, and must obey the same rules as outlined in the help for 7 | % CVX/RDIVIDE. 8 | % 9 | % When Y is a matrix, the MRDIVIDE operation X/Y is equivalent to 10 | % X*inv(Y) for both DCP and DGP purposes. The inv() operation is 11 | % not supported for non-constant expressions, so Y must be both 12 | % constant and nonsingular. The resulting matrix multiplication 13 | % must obey the same rules as outlined in the help for CVX/MTIMES. 14 | 15 | z = mtimes( x, y, 'rdivide' ); 16 | 17 | % Copyright 2005-2016 CVX Research, Inc. 18 | % See the file LICENSE.txt for full copyright information. 19 | % The command 'cvx_where' will show where this file is located. 20 | -------------------------------------------------------------------------------- /builtins/@cvx/ne.m: -------------------------------------------------------------------------------- 1 | function a = ne( x, y ) 2 | 3 | % Disciplined convex/geometric programming information for NE (~=): 4 | % Not-equal constraints violate both the DCP and DGP rulesets. Thus 5 | % not-equal expressions may only appear in CVX models when both 6 | % sides are constant. 7 | 8 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '~=' ); 9 | if nargout, a = b; end 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | -------------------------------------------------------------------------------- /builtins/@cvx/nnz.m: -------------------------------------------------------------------------------- 1 | function s = nnz( x ) 2 | 3 | % Disciplined convex/geometric programming information for NNZ: 4 | % When used in CVX models, NNZ cannot deduce the numeric value of a 5 | % CVX variable, so it returns the number of "structurally" nonzero 6 | % elements; i.e., those that are not *identically* zero. This is 7 | % similar to the concept of structural nonzeros in sparse matrix 8 | % factorizations. To illustrate the distinction, consider: 9 | % variable x(3); 10 | % x(2) == 0; 11 | % y = [x(1);0;x(3)]; 12 | % In this case, NNZ(x) returns 3, even though x(2) has been set to 13 | % zero in an equality constraint. (After all, the overall model may 14 | % be infeasible, in which case x(2) is arguably not zero.) However, 15 | % NNZ(y) returns 2, because y(2) is identically zero. 16 | 17 | s = nnz( any( x.basis_, 1 ) ); 18 | 19 | % Copyright 2005-2016 CVX Research, Inc. 20 | % See the file LICENSE.txt for full copyright information. 21 | % The command 'cvx_where' will show where this file is located. 22 | -------------------------------------------------------------------------------- /builtins/@cvx/permute.m: -------------------------------------------------------------------------------- 1 | function y = permute( x, order ) 2 | 3 | % Disciplined convex/geometric programming information for PERMUTE: 4 | % PERMUTE(A,ORDER) imposes no convexity restrictions on A. ORDER 5 | % must be constant. 6 | 7 | % 8 | % Determine the permutation 9 | % 10 | 11 | s = x.size_; 12 | ndxs = 1 : prod( s ); 13 | ndx2 = permute( reshape( ndxs, s ), order ); 14 | 15 | % 16 | % Permute the data 17 | % 18 | 19 | b = x.basis_; 20 | try 21 | b = x.basis_( :, ndx2 ); 22 | catch %#ok 23 | ndxs( ndx2( : ).' ) = ndxs; 24 | [ r, c, v ] = find( b ); 25 | b = sparse( r, ndxs( c ), v, size( b, 1 ), size( b, 2 ) ); 26 | clear r c v 27 | end 28 | y = cvx( size( ndx2 ), b ); 29 | 30 | % Copyright 2005-2016 CVX Research, Inc. 31 | % See the file LICENSE.txt for full copyright information. 32 | % The command 'cvx_where' will show where this file is located. 33 | -------------------------------------------------------------------------------- /builtins/@cvx/rdivide.m: -------------------------------------------------------------------------------- 1 | function z = rdivide( x, y ) 2 | 3 | % Disciplined convex programming information for RDIVIDE: 4 | % For DCP purposes, the RDIVIDE division operator X./Y is identical 5 | % to X.*(1./Y). The right-hand term must be constant and non-zero; 6 | % and if the left-hand term is nonlinear, the constat must be real. 7 | % 8 | % Disciplined geometric programming information for RDIVIDE: 9 | % Terms in a left divide must have opposite log-curvature, so the 10 | % following products are permitted: 11 | % {log-convex} ./ {log-concave} {log-concave} ./ {log-convex} 12 | % {log-affine} ./ {log-affine} 13 | % Note that log-affine expressions are both log-convex and 14 | % log-concave. 15 | % 16 | % For vectors, matrices, and arrays, these rules are verified 17 | % indepdently for each element. 18 | 19 | z = times( x, y, './' ); 20 | 21 | % Copyright 2005-2016 CVX Research, Inc. 22 | % See the file LICENSE.txt for full copyright information. 23 | % The command 'cvx_where' will show where this file is located. 24 | -------------------------------------------------------------------------------- /builtins/@cvx/real.m: -------------------------------------------------------------------------------- 1 | function y = real( x ) 2 | 3 | % Disciplined convex/geometric programming information for REAL: 4 | % REAL(X) may be freely applied to any CVX expression. However, 5 | % since REAL(X)=X for all real expressions (including convex, 6 | % concave, log-convex, and log-concave), it is only useful in 7 | % the complex affine case. 8 | 9 | y = cvx( x.size_, real( x.basis_ ) ); 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | -------------------------------------------------------------------------------- /builtins/@cvx/spy.m: -------------------------------------------------------------------------------- 1 | function spy( x, mode ) 2 | global cvx___ 3 | 4 | % SPY is not a computational function, so it can be applied to any 5 | % CVX variables. 6 | 7 | switch nargin, 8 | case 0, 9 | error( 'Not enough arguments.' ); 10 | case 1, 11 | mode = ''; 12 | case 2, 13 | if ~ischar( mode ) || size( mode, 1 ) > 1, 14 | error( 'Second argument must be a string.' ); 15 | end 16 | end 17 | 18 | b = x.basis_; 19 | s = x.size_; 20 | 21 | switch mode, 22 | case { '2-d', '2-D', '2d', '2D' }, 23 | b = sum( b ~= 0, 1 ); 24 | b = reshape( b, s ); 25 | case { '', '3-d', '3-D', '3d', '3D' }, 26 | p = length( cvx___.reserved ) + 1; 27 | if size( b, 1 ) < p, b( p, end ) = 0; end 28 | otherwise, 29 | error( [ 'Unknown spy mode: ', mode ] ); 30 | end 31 | 32 | spy( b ); 33 | 34 | % Copyright 2005-2016 CVX Research, Inc. 35 | % See the file LICENSE.txt for full copyright information. 36 | % The command 'cvx_where' will show where this file is located. 37 | -------------------------------------------------------------------------------- /builtins/@cvx/subsref.m: -------------------------------------------------------------------------------- 1 | function x = subsref( x, S ) 2 | 3 | % Disciplined convex/geometric programming information for SUBSREF: 4 | % The use of subscripts to extract elements or "slices" of any CVX 5 | % variable is identical to their use with numeric arrays. All 6 | % conventions are preserved, including the colon ':' and 'end'. 7 | 8 | narginchk(2,2); 9 | 10 | try 11 | ndxs = builtin( 'subsref', reshape( 1 : prod( x.size_ ), x.size_ ), S ); 12 | catch errmsg 13 | error( errmsg.identifier, errmsg.message ); 14 | end 15 | 16 | x = cvx( size( ndxs ), x.basis_( :, ndxs ) ); 17 | 18 | % Copyright 2005-2016 CVX Research, Inc. 19 | % See the file LICENSE.txt for full copyright information. 20 | % The command 'cvx_where' will show where this file is located. 21 | -------------------------------------------------------------------------------- /builtins/@cvx/transpose.m: -------------------------------------------------------------------------------- 1 | function y = transpose( x ) 2 | 3 | % Disciplined convex/geometric programming information for TRANSPOSE: 4 | % The transpose operation may be applied to CVX variables without 5 | % restriction. 6 | 7 | % 8 | % Determine permutation 9 | % 10 | 11 | s = x.size_; 12 | if length( s ) > 2, 13 | error( 'Transpose of an ND array is not defined.' ); 14 | end 15 | 16 | % 17 | % Permute the data 18 | % 19 | 20 | ndxs = 1 : prod( s ); 21 | ndx2 = reshape( ndxs, s ).'; 22 | b = x.basis_; 23 | try 24 | b = b( :, ndx2 ); 25 | catch %#ok 26 | ndxs( ndx2( : ).' ) = ndxs; 27 | [ r, c, v ] = find( b ); 28 | b = sparse( r, ndxs( c ), v, size( b, 1 ), size( b, 2 ) ); 29 | clear r c v 30 | end 31 | y = cvx( size( ndx2 ), b ); 32 | 33 | % Copyright 2005-2016 CVX Research, Inc. 34 | % See the file LICENSE.txt for full copyright information. 35 | % The command 'cvx_where' will show where this file is located. 36 | -------------------------------------------------------------------------------- /builtins/@cvx/tril.m: -------------------------------------------------------------------------------- 1 | function x = tril( x, k ) 2 | 3 | % Disciplined convex/geometric programming information for TRIL: 4 | % TRIL imposes no convexity restrictions on its arguments. 5 | 6 | % 7 | % Check inputs 8 | % 9 | 10 | if nargin < 2, k = 0; end 11 | s = x.size_; 12 | if length( s ) > 2, 13 | error( 'The first argument must be 2-D.' ); 14 | elseif ~isnumeric( k ) || length( k ) ~= 1, 15 | error( 'The second argument must be an integer scalar.' ); 16 | end 17 | 18 | % 19 | % Zero out the elements outside of the desired triangle 20 | % 21 | 22 | b = x.basis_; 23 | b( :, ~tril(ones(s),k) ) = 0; 24 | x = cvx( s, b ); 25 | 26 | % Copyright 2005-2016 CVX Research, Inc. 27 | % See the file LICENSE.txt for full copyright information. 28 | % The command 'cvx_where' will show where this file is located. 29 | -------------------------------------------------------------------------------- /builtins/@cvx/triu.m: -------------------------------------------------------------------------------- 1 | function x = triu( x, k ) 2 | 3 | % Disciplined convex/geometric programming information for TRIU: 4 | % TRIU imposes no convexity restrictions on its arguments. 5 | 6 | % 7 | % Check inputs 8 | % 9 | 10 | if nargin < 2, k = 0; end 11 | s = x.size_; 12 | if length( s ) > 2, 13 | error( 'The first argument must be 2-D.' ); 14 | elseif ~isnumeric( k ) || length( k ) ~= 1, 15 | error( 'The second argument must be an integer scalar.' ); 16 | end 17 | 18 | % 19 | % Zero out the elements outside of the desired triangle 20 | % 21 | 22 | b = x.basis_; 23 | b( :, ~triu(ones(s),k) ) = 0; 24 | x = cvx( s, b ); 25 | 26 | % Copyright 2005-2016 CVX Research, Inc. 27 | % See the file LICENSE.txt for full copyright information. 28 | % The command 'cvx_where' will show where this file is located. 29 | -------------------------------------------------------------------------------- /builtins/@cvx/uplus.m: -------------------------------------------------------------------------------- 1 | function z = uplus( x ) 2 | 3 | % Disciplined convex/geometric programming information for UPLUS (+): 4 | % Unary plus may be used in DCPs and DGPs without restrictions. 5 | 6 | z = x; 7 | 8 | % Copyright 2005-2016 CVX Research, Inc. 9 | % See the file LICENSE.txt for full copyright information. 10 | % The command 'cvx_where' will show where this file is located. 11 | -------------------------------------------------------------------------------- /builtins/@cvx/var.m: -------------------------------------------------------------------------------- 1 | function y = var( varargin ) 2 | 3 | %STD Internal cvx version. 4 | 5 | y = square_pos( std( varargin{:} ) ); 6 | 7 | % Copyright 2005-2016 CVX Research, Inc. 8 | % See the file LICENSE.txt for full copyright information. 9 | % The command 'cvx_where' will show where this file is located. 10 | -------------------------------------------------------------------------------- /builtins/@cvx/vertcat.m: -------------------------------------------------------------------------------- 1 | function y = vertcat( varargin ) 2 | 3 | % Disciplined convex/geometric programming information for VERTCAT: 4 | % VERTCAT imposes no convexity restrictions on its arguments. 5 | 6 | y = cat( 1, varargin{:} ); 7 | 8 | % Copyright 2005-2016 CVX Research, Inc. 9 | % See the file LICENSE.txt for full copyright information. 10 | % The command 'cvx_where' will show where this file is located. 11 | -------------------------------------------------------------------------------- /builtins/@cvxcnst/eq.m: -------------------------------------------------------------------------------- 1 | function a = eq( x, y ) 2 | 3 | %Disciplined convex programming information for EQ (==): 4 | % Both the left- and right-hand sides of an equality constraint must 5 | % be affine (or constant). If either side of the constraint is complex, 6 | % then the real and imaginary portions are constrained separately. 7 | % 8 | %Disciplined geometric programming information for EQ (>): 9 | % Both the left- and right-hand sides of an equality constraint must 10 | % be log-affine, which includes positive constants and monomials. 11 | 12 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '==' ); 13 | if nargout, a = b; end 14 | 15 | % Copyright 2005-2016 CVX Research, Inc. 16 | % See the file LICENSE.txt for full copyright information. 17 | % The command 'cvx_where' will show where this file is located. 18 | -------------------------------------------------------------------------------- /builtins/@cvxcnst/ne.m: -------------------------------------------------------------------------------- 1 | function a = ne( x, y ) 2 | 3 | % Disciplined convex/geometric programming information for NE (~=): 4 | % Not-equal constraints violate both the DCP and DGP rulesets. Thus 5 | % not-equal expressions may only appear in CVX models when both 6 | % sides are constant. 7 | 8 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '~=' ); 9 | if nargout, a = b; end 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | -------------------------------------------------------------------------------- /commands/Contents.m: -------------------------------------------------------------------------------- 1 | % CVX: Top-level commands to control CVX. 2 | % 3 | % cvx_begin - Starts a new CVX specification. 4 | % cvx_clear - Clears all active CVX data. 5 | % cvx_end - Completes a cvx specification. 6 | % cvx_pause - Pauses the processing of CVX models. 7 | % cvx_power_warning - Controls the CVX warning message for x.^p expressions. 8 | % cvx_precision - Controls CVX solver precision. 9 | % cvx_profile - CVX-specific profiler control. 10 | % cvx_quiet - CVX output control. 11 | % cvx_solver - CVX solver selection. 12 | % cvx_where - Returns the location of the CVX system. 13 | % cvx_expert - CVX expert mode. 14 | % cvx_save_prefs - Saves current CVX settings for future MATLAB sessions. 15 | % cvx_solver_settings - CVX solver settings adjustment. 16 | 17 | % Copyright 2005-2016 CVX Research, Inc. 18 | % See the file LICENSE.txt for full copyright information. 19 | % The command 'cvx_where' will show where this file is located. 20 | -------------------------------------------------------------------------------- /commands/cvx_clear.m: -------------------------------------------------------------------------------- 1 | % CVX_CLEAR Clears all active CVX data. 2 | % CVX_CLEAR clears the current CVX model in progress. This is useful if, for 3 | % example, you have made an error typing in your model and wish to start 4 | % over. Typing this before entering another CVX_BEGIN again avoids the 5 | % warning message that occurs if CVX_BEGIN detects a model in progress. 6 | 7 | prob = evalin( 'caller', 'cvx_problem', '[]' ); 8 | if isa( prob, 'cvxprob' ), 9 | evalin( 'caller', 'pop( cvx_problem, ''clear'' )' ); 10 | end 11 | % cvx_clearpath( 1 ); 12 | 13 | % Copyright 2005-2016 CVX Research, Inc. 14 | % See the file LICENSE.txt for full copyright information. 15 | % The command 'cvx_where' will show where this file is located. 16 | -------------------------------------------------------------------------------- /commands/cvx_tic.m: -------------------------------------------------------------------------------- 1 | function cvx_tic 2 | 3 | %CVX_TIC Resets the CVX timing functionality. 4 | % 5 | % CVX collects the following timing information: 6 | % --- Elapsed time since CVX_TIC was last called. If CVX_TIC was never 7 | % called, this measures the time since CVX was first initialized. 8 | % --- Elapsed time spent between top-level CVX_BEGIN and CVX_END comamnds 9 | % --- Elapsed time spent within the top-level CVX_END itself. This 10 | % includes final problem extraction, presolving, and solving. 11 | % --- Elapsed time spent calling the numerical solver. 12 | % To retrieve the current totals for these numbers, type CVX_TOC. 13 | % CVX_TIC resets these numbers to zero. 14 | 15 | global cvx___ 16 | cvx_global 17 | if ~isempty( cvx___.problems ), 18 | error( 'CVX_TIC can only be called when no models are in construction.' ); 19 | end 20 | cvx___.timers(1) = tic; 21 | cvx___.timers(2:4) = 0; 22 | 23 | % Copyright 2005-2016 CVX Research, Inc. 24 | % See the file LICENSE.txt for full copyright information. 25 | % The command 'cvx_where' will show where this file is located. 26 | -------------------------------------------------------------------------------- /commands/cvx_where.m: -------------------------------------------------------------------------------- 1 | function s = cvx_where 2 | 3 | %CVX_WHERE Returns the location of the CVX system. 4 | % CVX_WHERE returns a string containing the base directory of the CVX 5 | % modeling framework. Within that directory are some useful 6 | % subdirectories and files: 7 | % functions/ new functions 8 | % examples/ sample cvx models 9 | % LICENSE.txt copyright information 10 | % The proper operation of this function assumes that it has not been 11 | % moved from its default position within the cvx distribution. 12 | 13 | try 14 | s = dbstack('-completenames'); 15 | catch 16 | s = dbstack; 17 | end 18 | s = s(1); 19 | if isfield( s, 'file' ), 20 | s = s.file; 21 | else 22 | s = s.name; 23 | end 24 | if ispc, 25 | fs = '\'; 26 | else 27 | fs = '/'; 28 | end 29 | temp = strfind( s, fs ); 30 | s( temp(end-1) + 1 : end ) = []; 31 | 32 | % Copyright 2005-2016 CVX Research, Inc. 33 | % See the file LICENSE.txt for full copyright information. 34 | % The command 'cvx_where' will show where this file is located. 35 | -------------------------------------------------------------------------------- /doc/_static/cvxrlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/doc/_static/cvxrlogo.png -------------------------------------------------------------------------------- /doc/_templates/getpdf.html: -------------------------------------------------------------------------------- 1 |

Other links

2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /doc/envelope.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/doc/envelope.pdf -------------------------------------------------------------------------------- /doc/fullpage.sty: -------------------------------------------------------------------------------- 1 | % This is FULLPAGE.STY by H.Partl, Version 2 as of 15 Dec 1988. 2 | % Document Style Option to fill the paper just like Plain TeX. 3 | 4 | \typeout{Style Option FULLPAGE Version 2 as of 15 Dec 1988} 5 | 6 | \topmargin 0pt 7 | \advance \topmargin by -\headheight 8 | \advance \topmargin by -\headsep 9 | 10 | \textheight 9.0in 11 | 12 | \oddsidemargin 0in 13 | \evensidemargin 0in 14 | \marginparwidth 0.5in 15 | 16 | \textwidth 6.0in 17 | 18 | \endinput 19 | 20 | 21 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. CVX documentation master file, created by 2 | sphinx-quickstart on Tue Jun 26 20:00:08 2012. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | ================ 7 | CVX Users' Guide 8 | ================ 9 | 10 | .. toctree:: 11 | intro 12 | install 13 | quickstart 14 | basics 15 | dcp 16 | sdp 17 | gp 18 | solver 19 | funcref 20 | support 21 | advanced 22 | license 23 | citing 24 | credits 25 | gurobi 26 | mosek 27 | 28 | .. _CVX Support: http://support.cvxr.com/ 29 | .. _CVX Sales: mailto:sales@cvxr.com 30 | .. _Licensing: http://cvxr.com/cvx/licensing 31 | .. _Academic License Request: http://cvxr.com/cvx/academic 32 | 33 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx 2 | cloud_sptheme 3 | 4 | -------------------------------------------------------------------------------- /doc/tradeoff.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/doc/tradeoff.pdf -------------------------------------------------------------------------------- /examples/antenna_array_design/Contents.m: -------------------------------------------------------------------------------- 1 | % Antenna array design 2 | % Antenna Array Pattern Synthesis via Convex Optimization 3 | % FIR Filter Design via Spectral Factorization and Convex Optimization 4 | % 5 | % ant_array_min_beamwidth.m - Minimize beamwidth of an array with arbitrary 2-D geometry 6 | % line_array_spec_fact.m - Minimize sidelobe level of a uniform linear array via spectral factorization 7 | % broadband_array_min_sidelobe.m - Minimize sidelobe level of an FIR broadband far-field antenna array 8 | % ant_array_min_sidelobe.m - Minimize sidelobe level of an array with arbitrary 2-D geometry 9 | % ant_array_min_therm_noise.m - Minimize thermal noise power of an array with arbitrary 2-D geometry 10 | % polar_plot_ant.m - Plot a polar plot of an antenna array sensitivity 11 | % spectral_fact.m - Spectral factorization using Kolmogorov 1939 approach 12 | help Contents 13 | -------------------------------------------------------------------------------- /examples/antenna_array_design/html/ant_array_min_beamwidth__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/ant_array_min_beamwidth__01.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/ant_array_min_beamwidth__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/ant_array_min_beamwidth__02.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/ant_array_min_beamwidth__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/ant_array_min_beamwidth__03.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/ant_array_min_sidelobe__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/ant_array_min_sidelobe__01.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/ant_array_min_sidelobe__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/ant_array_min_sidelobe__02.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/ant_array_min_sidelobe__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/ant_array_min_sidelobe__03.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/ant_array_min_therm_noise__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/ant_array_min_therm_noise__01.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/ant_array_min_therm_noise__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/ant_array_min_therm_noise__02.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/ant_array_min_therm_noise__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/ant_array_min_therm_noise__03.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/broadband_array_min_sidelobe__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/broadband_array_min_sidelobe__01.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/broadband_array_min_sidelobe__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/broadband_array_min_sidelobe__02.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/broadband_array_min_sidelobe__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/broadband_array_min_sidelobe__03.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/line_array_spec_fact__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/line_array_spec_fact__01.png -------------------------------------------------------------------------------- /examples/antenna_array_design/html/line_array_spec_fact__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/antenna_array_design/html/line_array_spec_fact__02.png -------------------------------------------------------------------------------- /examples/bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/bullet.gif -------------------------------------------------------------------------------- /examples/circuit_design/html/LC_osc_design__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/LC_osc_design__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/clock_mesh__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/clock_mesh__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/clock_mesh__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/clock_mesh__02.png -------------------------------------------------------------------------------- /examples/circuit_design/html/clock_mesh__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/clock_mesh__03.png -------------------------------------------------------------------------------- /examples/circuit_design/html/dig_ckt_sizing__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/dig_ckt_sizing__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/elmore_straight_wire__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/elmore_straight_wire__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/elmore_straight_wire__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/elmore_straight_wire__02.png -------------------------------------------------------------------------------- /examples/circuit_design/html/inverter_chain_sizing__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/inverter_chain_sizing__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/simple_NAND2_gate_design__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/simple_NAND2_gate_design__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__02.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__03.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__04.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__05.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__06.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__07.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__08.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__09.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__10.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__11.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__12.png -------------------------------------------------------------------------------- /examples/circuit_design/html/tristate_bus_sizing__13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/tristate_bus_sizing__13.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_driver_sizing__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_driver_sizing__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_driver_sizing__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_driver_sizing__02.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_driver_sizing__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_driver_sizing__03.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing__02.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing__03.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing__04.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing__05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing__05.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing__06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing__06.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_spacing__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_spacing__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_spacing__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_spacing__02.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_spacing__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_spacing__03.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_spacing__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_spacing__04.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_spacing__05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_spacing__05.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_spacing__06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_spacing__06.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_spacing__07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_spacing__07.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_spacing__08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_spacing__08.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_spacing__09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_spacing__09.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_topology__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_topology__01.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_topology__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_topology__02.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_topology__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_topology__03.png -------------------------------------------------------------------------------- /examples/circuit_design/html/wire_sizing_topology__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/circuit_design/html/wire_sizing_topology__04.png -------------------------------------------------------------------------------- /examples/circuit_design/simple_step.m: -------------------------------------------------------------------------------- 1 | % Computes the step response of a linear system 2 | 3 | function X = simple_step(A,B,DT,N) 4 | n = size(A,1); 5 | Ad = expm( full( A * DT ) ); 6 | Bd = ( Ad - eye(n) ) * B; 7 | Bd = A \ Bd; 8 | X = zeros(n,N); 9 | for k = 2 : N, 10 | X(:,k) = Ad*X(:,k-1)+Bd; 11 | end 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/chebyshev_center.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/chebyshev_center.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/chebyshev_center_2D.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/chebyshev_center_2D.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/ex_4_27.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/ex_4_27.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/ex_4_3.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/ex_4_3.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/ex_4_38.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/ex_4_38.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/ex_4_5.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/ex_4_5.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/fastest_mixing_MC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/fastest_mixing_MC.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/html/cantilever_beam__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/html/cantilever_beam__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/html/cantilever_beam_rec__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/html/cantilever_beam_rec__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/html/chebyshev_center_2D__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/html/chebyshev_center_2D__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch04_cvx_opt_probs/html/logopt_investment__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch04_cvx_opt_probs/html/logopt_investment__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/Contents.m: -------------------------------------------------------------------------------- 1 | % Chapter 5: Duality 2 | % 3 | % qcqp.m - Section 5.2.4: Solves a simple QCQP 4 | % matrix_games.m - Section 5.2.5: Mixed strategies for matrix games 5 | % matrix_games_LP.m - Section 5.2.5: Mixed strategies for matrix games (LP formulation) 6 | % norm_approx.m - Examples 5.6,5.8: An l_p norm approximation problem 7 | % ex_5_19.m - Exercise 5.19c: Markovitz portfolio optimization w/ diversification constraint 8 | % ex_5_1.m - Exercise 5.1d: Sensitivity analysis for a simple QCQP 9 | % ex_5_33.m - Exercise 5.33: Parametrized l1-norm approximation 10 | % ex_5_39.m - Exercise 5.39: SDP relaxations of the two-way partitioning problem 11 | help Contents 12 | -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/ex_5_1.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch05_duality/ex_5_1.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/ex_5_19.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch05_duality/ex_5_19.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/ex_5_33.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch05_duality/ex_5_33.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/ex_5_39.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch05_duality/ex_5_39.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/html/ex_5_1__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch05_duality/html/ex_5_1__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/html/ex_5_33__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch05_duality/html/ex_5_33__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/matrix_games.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch05_duality/matrix_games.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/matrix_games_LP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch05_duality/matrix_games_LP.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/norm_approx.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch05_duality/norm_approx.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch05_duality/qcqp.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch05_duality/qcqp.m -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/basispursuit__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/basispursuit__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/basispursuit__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/basispursuit__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/basispursuit__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/basispursuit__03.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/convex_interpolation__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/convex_interpolation__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_15__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_15__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_19__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_19__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_20__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_20__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_5__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_5__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_6__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_6__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_6__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_6__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_6__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_6__03.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_6__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_6__04.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_6__05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_6__05.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_6__06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_6__06.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/fig6_9__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/fig6_9__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/penalty_comp_cvx__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/penalty_comp_cvx__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/preference_regions__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/preference_regions__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/preference_regions__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/preference_regions__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/regressor_cvx__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/regressor_cvx__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/smoothrec_cvx__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/smoothrec_cvx__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/smoothrec_cvx__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/smoothrec_cvx__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/smoothrec_cvx__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/smoothrec_cvx__03.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/tv_cvx__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/tv_cvx__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/tv_cvx__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/tv_cvx__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/tv_cvx__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/tv_cvx__03.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/tv_cvx__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/tv_cvx__04.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/tv_cvx__05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/tv_cvx__05.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch06_approx_fitting/html/wcrobls__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch06_approx_fitting/html/wcrobls__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/Contents.m: -------------------------------------------------------------------------------- 1 | % Chapter 7: Statistical estimation 2 | % 3 | % counting_problem_poisson.m - Section 7.1.1: Counting problems with Poisson distribution 4 | % ML_covariance_est.m - Section 7.1.1: Covariance estimation for Gaussian variables 5 | % probbounds.m - Section 7.4.3: Probability bounds example with Voronoi diagram 6 | % expdesign.m - Section 7.5.2: Experiment design 7 | % logistics.m - Figure 7.1: Logistic regression 8 | % logistics_gp.m - Figure 7.1: Logistic regression (GP version) 9 | % maxent.m - Example 7.2: Maximum entropy distribution 10 | % detector2.m - Example 7.4: Binary hypothesis testing 11 | % cheb.m - Computes Chebyshev lower bounds on probability vectors 12 | % cher.m - Computes Chernoff upper bounds on probability 13 | % montecarlo.m - Probability estimate using Monte Carlo methods 14 | help Contents 15 | -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/cher.m: -------------------------------------------------------------------------------- 1 | function prob = cher( A, b, Sigma ); 2 | 3 | % Computes Chernoff upper bounds on probability 4 | % 5 | % Computes a bound on the probability that a Gaussian random vector 6 | % N(0,Sigma) satisfies A x <= b, by solving a QP 7 | % 8 | 9 | [ m, n ] = size( A ); 10 | cvx_begin quiet 11 | variable u( m ) 12 | minimize( b' * u + 0.5 * sum_square( chol( Sigma ) * A' * u ) ) 13 | subject to 14 | u >= 0; 15 | cvx_end 16 | prob = exp( cvx_optval ); 17 | -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/detector2__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/detector2__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/expdesign__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/expdesign__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/expdesign__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/expdesign__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/expdesign__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/expdesign__03.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/expdesign__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/expdesign__04.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/logistics__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/logistics__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/logistics_gp__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/logistics_gp__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/maxent__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/maxent__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/maxent__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/maxent__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/probbounds__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/probbounds__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/probbounds__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/probbounds__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/html/probbounds__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch07_statistical_estim/html/probbounds__03.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch07_statistical_estim/montecarlo.m: -------------------------------------------------------------------------------- 1 | function prob = montecarlo(A,b,Sigma,notrials); 2 | 3 | % Probability estimate using Monte Carlo methods 4 | % 5 | % Estimates the probability that a random vector x in R2 6 | % with mean zero and covariance Sigma satisfies Ax <= b, 7 | % based on 100 * notrials trials. Sigma must be PSD. 8 | 9 | m = size(A,1); 10 | 11 | R = chol(Sigma); % Y = R^{-T}X has covariance I 12 | X = R'*randn(2,notrials); 13 | prob = length(find(sum(A*X - b(:,ones(1,notrials)) < 0) == m))/notrials; 14 | 15 | for i=1:99 16 | X = R'*randn(2,notrials); 17 | prob = 0.5*(prob + ... 18 | length(find(sum(A*X - b(:,ones(1,notrials)) < 0) == m))/notrials); 19 | end; 20 | 21 | -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/analytic_center.m: -------------------------------------------------------------------------------- 1 | % Section 8.5.3: Analytic center of a set of linear inequalities 2 | % Boyd & Vandenberghe "Convex Optimization" 3 | % Joëlle Skaf - 04/29/08 4 | % 5 | % The analytic center of a set of linear inequalities and equalities: 6 | % a_i^Tx <= b_i i=1,...,m, 7 | % Fx = g, 8 | % is the solution of the unconstrained minimization problem 9 | % minimize -sum_{i=1}^m log(b_i-a_i^Tx). 10 | 11 | % Input data 12 | randn('state', 0); 13 | rand('state', 0); 14 | n = 10; 15 | m = 50; 16 | p = 5; 17 | tmp = randn(n,1); 18 | A = randn(m,n); 19 | b = A*tmp + 10*rand(m,1); 20 | F = randn(p,n); 21 | g = F*tmp; 22 | 23 | % Analytic center 24 | cvx_begin 25 | variable x(n) 26 | minimize -sum(log(b-A*x)) 27 | F*x == g 28 | cvx_end 29 | 30 | disp(['The analytic center of the set of linear inequalities and ' ... 31 | 'equalities is: ']); 32 | disp(x); 33 | -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/eucl_dist_poly.m: -------------------------------------------------------------------------------- 1 | % Euclidean distance between polyhedra 2 | % Section 8.2.1, Boyd & Vandenberghe "Convex Optimization" 3 | % Joelle Skaf - 10/09/05 4 | % 5 | % Given two polyhedra C = {x | A1*x <= b1} and D = {x | A2*x <= b2}, the 6 | % distance between them is the optimal value of the problem: 7 | % minimize || x - y ||_2 8 | % s.t. A1*x <= b1 9 | % A2*y <= b2 10 | 11 | % Input data 12 | randn('state',0); 13 | rand('state',0); 14 | 15 | n = 5; 16 | m1 = 2*n; 17 | m2 = 3*n; 18 | A1 = randn(m1,n); 19 | A2 = randn(m2,n); 20 | b1 = rand(m1,1); 21 | b2 = rand(m2,1) + A2*randn(n,1); 22 | 23 | % Solution via CVX 24 | cvx_begin 25 | variables x(n) y(n) 26 | minimize (norm(x - y)) 27 | A1*x <= b1; 28 | A2*y <= b2; 29 | cvx_end 30 | 31 | % Displaying results 32 | disp('------------------------------------------------------------------'); 33 | disp('The distance between the 2 polyhedra C and D is: ' ); 34 | disp(['dist(C,D) = ' num2str(cvx_optval)]); 35 | -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/eucl_proj_cone1.m: -------------------------------------------------------------------------------- 1 | % Euclidean projection on the nonnegative orthant 2 | % Section 8.1.1, Boyd & Vandenberghe "Convex Optimization" 3 | % Joelle Skaf - 10/07/05 4 | % 5 | % The projection of x0 on the proper cone K = R+^n is given by 6 | % minimize || x - x0 ||^2 7 | % s.t. x >= 0 8 | % It is also given by: P_K(x0)_k = max{x0_k,0} 9 | 10 | % Input data 11 | randn('seed',0); 12 | n = 10; 13 | x0 = randn(n,1); 14 | 15 | fprintf(1,'Computing the analytical solution...'); 16 | 17 | % Analytical solution 18 | pk_x0 = max(x0,0); 19 | 20 | fprintf(1,'Done! \n'); 21 | 22 | % Solution via CVX 23 | fprintf(1,'Computing the solution via a QP...'); 24 | 25 | cvx_begin quiet 26 | variable x(n) 27 | minimize ( norm(x - x0) ) 28 | x >= 0; 29 | cvx_end 30 | 31 | fprintf(1,'Done! \n'); 32 | 33 | % Verification 34 | disp('-----------------------------------------------------------------'); 35 | disp('Verifying that the analytical solution and the solution obtained via QP are equal: '); 36 | [pk_x0 x] 37 | disp('They are equal as expected!'); 38 | -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/eucl_dist_poly_2D__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/eucl_dist_poly_2D__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/floor_plan__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/floor_plan__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/floor_plan_graphs__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/floor_plan_graphs__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/linear_discr__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/linear_discr__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/max_vol_ellip_in_polyhedra__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/max_vol_ellip_in_polyhedra__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/min_vol_elp_finite_set__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/min_vol_elp_finite_set__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/min_vol_union_ellip__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/min_vol_union_ellip__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/placement_lin__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/placement_lin__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/placement_lin__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/placement_lin__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/placement_quad__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/placement_quad__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/placement_quad__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/placement_quad__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/placement_quar__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/placement_quar__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/placement_quar__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/placement_quar__02.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/poly3_discr__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/poly3_discr__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/poly4_discr__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/poly4_discr__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/quad_discr__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/quad_discr__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/robust_lin_discr__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/robust_lin_discr__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/separate_ell_2D__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/separate_ell_2D__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/separate_poly_2D__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/separate_poly_2D__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/svm_1__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/svm_1__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/svm_2__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/svm_2__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch08_geometric_probs/html/test_floorplan__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/cvxbook/Ch08_geometric_probs/html/test_floorplan__01.png -------------------------------------------------------------------------------- /examples/cvxbook/Ch11_intpt_methods/Contents.m: -------------------------------------------------------------------------------- 1 | % Chapter 11: Interior-point methods 2 | % 3 | % log_utility_flow.m - Section 11.8.4: Network rate optimization 4 | help Contents 5 | -------------------------------------------------------------------------------- /examples/cvxbook/Contents.m: -------------------------------------------------------------------------------- 1 | % Figures, examples, and exercises from the book Convex Optimization 2 | % 3 | % Ch04_cvx_opt_probs/ - Chapter 4: Convex optimization problems 4 | % Ch05_duality/ - Chapter 5: Duality 5 | % Ch06_approx_fitting/ - Chapter 6: Approximation and fitting 6 | % Ch07_statistical_estim/ - Chapter 7: Statistical estimation 7 | % Ch08_geometric_probs/ - Chapter 8: Geometric problems 8 | % Ch11_intpt_methods/ - Chapter 11: Interior-point methods 9 | help Contents 10 | -------------------------------------------------------------------------------- /examples/filter_design/html/equalizer_design__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/equalizer_design__01.png -------------------------------------------------------------------------------- /examples/filter_design/html/equalizer_design__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/equalizer_design__02.png -------------------------------------------------------------------------------- /examples/filter_design/html/equalizer_design__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/equalizer_design__03.png -------------------------------------------------------------------------------- /examples/filter_design/html/equalizer_design__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/equalizer_design__04.png -------------------------------------------------------------------------------- /examples/filter_design/html/equalizer_design__05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/equalizer_design__05.png -------------------------------------------------------------------------------- /examples/filter_design/html/equalizer_design__06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/equalizer_design__06.png -------------------------------------------------------------------------------- /examples/filter_design/html/equalizer_design__07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/equalizer_design__07.png -------------------------------------------------------------------------------- /examples/filter_design/html/equalizer_design__08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/equalizer_design__08.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_chebychev_design__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_chebychev_design__01.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_chebychev_design__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_chebychev_design__02.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_lin_phase_lowpass_max_atten__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_lin_phase_lowpass_max_atten__01.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_lin_phase_lowpass_max_atten__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_lin_phase_lowpass_max_atten__02.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_lin_phase_lowpass_min_order__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_lin_phase_lowpass_min_order__01.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_lin_phase_lowpass_min_order__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_lin_phase_lowpass_min_order__02.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_lin_phase_lowpass_min_ripple__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_lin_phase_lowpass_min_ripple__01.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_lin_phase_lowpass_min_ripple__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_lin_phase_lowpass_min_ripple__02.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_lin_phase_lowpass_min_trans__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_lin_phase_lowpass_min_trans__01.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_lin_phase_lowpass_min_trans__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_lin_phase_lowpass_min_trans__02.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_mag_design_lowpass_max_atten__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_mag_design_lowpass_max_atten__01.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_mag_design_lowpass_max_atten__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_mag_design_lowpass_max_atten__02.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_mag_design_lowpass_min_order__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_mag_design_lowpass_min_order__01.png -------------------------------------------------------------------------------- /examples/filter_design/html/fir_mag_design_lowpass_min_order__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/fir_mag_design_lowpass_min_order__02.png -------------------------------------------------------------------------------- /examples/filter_design/html/iir_mag_design_bandpass_max_atten__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/iir_mag_design_bandpass_max_atten__01.png -------------------------------------------------------------------------------- /examples/filter_design/html/iir_mag_design_lowpass_max_atten__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/iir_mag_design_lowpass_max_atten__01.png -------------------------------------------------------------------------------- /examples/filter_design/html/one_over_f_filter__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/filter_design/html/one_over_f_filter__01.png -------------------------------------------------------------------------------- /examples/gp_tutorial/Contents.m: -------------------------------------------------------------------------------- 1 | % Examples from A Tutorial on Geometric Programming 2 | % 3 | % max_volume_box.m - Box volume maximization 4 | % simple_dig_ckt_sizing.m - Digital circuit sizing 5 | % simple_dig_ckt_sizing_vect.m - Digital circuit sizing (vectorized) 6 | % elmore_interconnect.m - Elmore delay sizing for an interconnect network. 7 | % floor_planning.m - Floor planning with an optimal trade-off curve. 8 | % basic_odp.m - Optimal doping profile optimization 9 | % beta_min_odp.m - Optimal doping profile optimization with current gain constraint. 10 | % power_control.m - Simple power control in communication systems via GP. 11 | help Contents 12 | -------------------------------------------------------------------------------- /examples/gp_tutorial/html/basic_odp__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/gp_tutorial/html/basic_odp__01.png -------------------------------------------------------------------------------- /examples/gp_tutorial/html/beta_min_odp__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/gp_tutorial/html/beta_min_odp__01.png -------------------------------------------------------------------------------- /examples/gp_tutorial/html/elmore_interconnect__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/gp_tutorial/html/elmore_interconnect__01.png -------------------------------------------------------------------------------- /examples/gp_tutorial/html/floor_planning__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/gp_tutorial/html/floor_planning__01.png -------------------------------------------------------------------------------- /examples/gp_tutorial/html/max_volume_box__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/gp_tutorial/html/max_volume_box__01.png -------------------------------------------------------------------------------- /examples/gp_tutorial/html/simple_dig_ckt_sizing__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/gp_tutorial/html/simple_dig_ckt_sizing__01.png -------------------------------------------------------------------------------- /examples/gp_tutorial/html/simple_dig_ckt_sizing_vect__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/gp_tutorial/html/simple_dig_ckt_sizing_vect__01.png -------------------------------------------------------------------------------- /examples/graph_laplacian/Contents.m: -------------------------------------------------------------------------------- 1 | % Graph Laplacian eigenvalue optimization 2 | % Convex Optimization of Graph Laplacian Eigenvalues 3 | % 4 | % larger_example.m - FDLA and FMMC solutions for a 50-node, 200-edge graph 5 | % cut_grid_example.m - FDLA and FMMC solutions for a 64-node, 95-edge cut-grid graph 6 | % small_example.m - FDLA and FMMC solutions for an 8-node, 13-edge graph 7 | % fmmc.m - Computes fastest mixing Markov chain (FMMC) edge weights 8 | % mh.m - Computes the Metropolis-Hastings heuristic edge weights 9 | % best_const.m - Computes the constant edge weight that yields fastest averaging. 10 | % fdla.m - Computes the fastest distributed linear averaging (FDLA) edge weights 11 | % max_deg.m - Computes the maximum-degree heuristic edge weights 12 | % cut_grid_data.m - Generate a cut-grid graph for the ICM 2006 talk example 13 | % plotgraph.m - Plots a graph with each edge width proportional to its weight. 14 | help Contents 15 | -------------------------------------------------------------------------------- /examples/graph_laplacian/html/cut_grid_example__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/cut_grid_example__01.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/cut_grid_example__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/cut_grid_example__02.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/cut_grid_example__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/cut_grid_example__03.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/cut_grid_example__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/cut_grid_example__04.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/cut_grid_example__05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/cut_grid_example__05.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/larger_example__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/larger_example__01.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/larger_example__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/larger_example__02.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/larger_example__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/larger_example__03.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/larger_example__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/larger_example__04.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/larger_example__05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/larger_example__05.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/larger_example__06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/larger_example__06.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/small_example__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/small_example__01.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/small_example__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/small_example__02.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/small_example__03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/small_example__03.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/small_example__04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/small_example__04.png -------------------------------------------------------------------------------- /examples/graph_laplacian/html/small_example__05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/graph_laplacian/html/small_example__05.png -------------------------------------------------------------------------------- /examples/html/nonneg_matrix_fact__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/html/nonneg_matrix_fact__01.png -------------------------------------------------------------------------------- /examples/html/quickstart__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/html/quickstart__01.png -------------------------------------------------------------------------------- /examples/html/regularized_norm_tradeoff__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/html/regularized_norm_tradeoff__01.png -------------------------------------------------------------------------------- /examples/html/regularized_norm_tradeoff__02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/html/regularized_norm_tradeoff__02.png -------------------------------------------------------------------------------- /examples/log_exp/Contents.m: -------------------------------------------------------------------------------- 1 | % Examples employing logarithms, exponentials, and entropy functions 2 | % 3 | % max_entropy.m - Entropy maximization 4 | % sparse_covariance_est.m - Sparse covariance estimation for Gaussian variables 5 | % sparse_covariance_est_tradeoff.m - Sparse covariance estimation for Gaussian variables 6 | % weighted_analytic_center.m - Weighted analytic center of a set of linear inequalities 7 | help Contents 8 | -------------------------------------------------------------------------------- /examples/log_exp/html/sparse_covariance_est__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/log_exp/html/sparse_covariance_est__01.png -------------------------------------------------------------------------------- /examples/log_exp/html/sparse_covariance_est_tradeoff__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/log_exp/html/sparse_covariance_est_tradeoff__01.png -------------------------------------------------------------------------------- /examples/log_exp/max_entropy.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/log_exp/max_entropy.m -------------------------------------------------------------------------------- /examples/log_exp/weighted_analytic_center.m: -------------------------------------------------------------------------------- 1 | % Weighted analytic center of a set of linear inequalities 2 | % Joëlle Skaf - 04/29/08 3 | % 4 | % The weighted analytic center of a set of linear inequalities: 5 | % a_i^Tx <= b_i i=1,...,m, 6 | % is the solution of the unconstrained minimization problem 7 | % minimize -sum_{i=1}^m w_i*log(b_i-a_i^Tx), 8 | % where w_i>0 9 | 10 | % Input data 11 | randn('state', 0); 12 | rand('state', 0); 13 | n = 10; 14 | m = 50; 15 | tmp = randn(n,1); 16 | A = randn(m,n); 17 | b = A*tmp + 2*rand(m,1); 18 | w = rand(m,1); 19 | 20 | % Analytic center 21 | cvx_begin 22 | variable x(n) 23 | minimize -sum(w.*log(b-A*x)) 24 | cvx_end 25 | 26 | disp('The weighted analytic center of the set of linear inequalities is: '); 27 | disp(x); 28 | -------------------------------------------------------------------------------- /examples/minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/minus.gif -------------------------------------------------------------------------------- /examples/plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/plus.gif -------------------------------------------------------------------------------- /examples/simple_LP.m: -------------------------------------------------------------------------------- 1 | % Builds and solves a simple linear program 2 | 3 | echo on 4 | 5 | n = 100; 6 | A = randn(0.5*n,n); 7 | b = randn(0.5*n,1); 8 | c = randn(n,1); 9 | d = randn; 10 | cvx_begin 11 | variable x(n) 12 | dual variables y z 13 | minimize( c' * x + d ) 14 | subject to 15 | y : A * x == b; 16 | z : x >= 0; 17 | cvx_end 18 | 19 | echo off 20 | 21 | -------------------------------------------------------------------------------- /examples/simple_LP2.m: -------------------------------------------------------------------------------- 1 | % Builds and solves a simple inequality-constrained linear program 2 | 3 | echo on 4 | 5 | n = 10; 6 | A = randn(2*n,n); 7 | b = randn(2*n,1); 8 | c = randn(n,1); 9 | d = randn; 10 | cvx_begin 11 | variable x(n) 12 | dual variables y z 13 | minimize( c' * x + d ) 14 | subject to 15 | y : A * x <= b; 16 | cvx_end 17 | 18 | echo off 19 | 20 | -------------------------------------------------------------------------------- /examples/simple_LS.m: -------------------------------------------------------------------------------- 1 | % Builds and solves a simple least-squares problem using cvx 2 | 3 | echo on 4 | 5 | n = 100; 6 | A = randn(2*n,n); 7 | b = randn(2*n,1); 8 | cvx_begin 9 | variable x(n) 10 | minimize( norm( A*x-b ) ) 11 | cvx_end 12 | 13 | echo off 14 | -------------------------------------------------------------------------------- /examples/sparse_heuristics/Contents.m: -------------------------------------------------------------------------------- 1 | % Sparse solution heuristics 2 | % 3 | % sparse_solution.m - Computing a sparse solution of a set of linear inequalities 4 | % sparse_infeas_dual.m - Detecting a small subset of infeasible linear inequalities 5 | % sparse_infeas.m - Finding a point that satisfies many linear inequalities 6 | help Contents 7 | -------------------------------------------------------------------------------- /examples/sparse_heuristics/html/sparse_solution__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/sparse_heuristics/html/sparse_solution__01.png -------------------------------------------------------------------------------- /examples/sparse_heuristics/sparse_solution.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/sparse_heuristics/sparse_solution.m -------------------------------------------------------------------------------- /examples/time_series_analysis/Contents.m: -------------------------------------------------------------------------------- 1 | % Example from l1 Trend Filtering 2 | % 3 | % l1_trend_filter_snp500.m - l1 trend filtering 4 | % snp500.txt - (no title) 5 | help Contents 6 | -------------------------------------------------------------------------------- /examples/time_series_analysis/html/l1_trend_filter_snp500__01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvxr/CVX/a0a775908bc1eec1625d56498d0224132b0d8b7f/examples/time_series_analysis/html/l1_trend_filter_snp500__01.png -------------------------------------------------------------------------------- /functions/@cvx/avg_abs_dev_med.m: -------------------------------------------------------------------------------- 1 | function y = avg_abs_dev_med( x, dim ) 2 | 3 | %AVG_ABS_DEV_MED Internal cvx version. 4 | 5 | if ~cvx_isaffine( x ), 6 | error( 'Disciplined convex programming error:\n ABS_AVG_DEV_MED is convex and nonmonotonic in X, so X must be affine.', 1 ); %#ok 7 | end 8 | 9 | try 10 | if nargin < 2, dim = []; end 11 | [ x, sx, sy, zx, zy, nx, nv, perm ] = cvx_reduce_size( x, dim ); %#ok 12 | catch exc 13 | error( exc.message ); 14 | end 15 | 16 | if nx > 1 && nv > 0, 17 | cvx_begin 18 | variable y( 1, nv ); 19 | minimize( sum( abs( x - ones(nx,1) * y ) ) / nx ); %#ok 20 | cvx_end 21 | y = cvx_optval; 22 | elseif nx == 0, 23 | y = NaN( sy ); 24 | else 25 | y = zeros( sy ); 26 | end 27 | 28 | % 29 | % Reverse the reshaping and permutation steps 30 | % 31 | 32 | y = reshape( y, sy ); 33 | if ~isempty( perm ), 34 | y = ipermute( y, perm ); 35 | end 36 | 37 | % Copyright 2005-2016 CVX Research, Inc. 38 | % See the file LICENSE.txt for full copyright information. 39 | % The command 'cvx_where' will show where this file is located. 40 | -------------------------------------------------------------------------------- /functions/@cvx/inv_pos.m: -------------------------------------------------------------------------------- 1 | function y = inv_pos( x ) 2 | 3 | %INV_POS Internal cvx version. 4 | 5 | y = pow_cvx( x, -1, 'pow_p' ); 6 | 7 | % Copyright 2005-2016 CVX Research, Inc. 8 | % See the file LICENSE.txt for full copyright information. 9 | % The command 'cvx_where' will show where this file is located. 10 | 11 | -------------------------------------------------------------------------------- /functions/@cvx/lambda_max.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = lambda_max( x ) 2 | 3 | %LAMBDA_MAX Internal cvx version. 4 | 5 | narginchk(1,1); 6 | if ndims( x ) > 2 || size( x, 1 ) ~= size( x, 2 ), %#ok 7 | 8 | error( 'Input must be a square matrix.' ); 9 | 10 | elseif cvx_isconstant( x ), 11 | 12 | cvx_optval = cvx( lambda_max( cvx_constant( x ) ) ); 13 | 14 | elseif cvx_isaffine( x ), 15 | 16 | z = []; 17 | n = size( x, 1 ); 18 | cvx_begin 19 | epigraph variable z 20 | z * eye( n ) - x == semidefinite( n, ~isreal( x ) ); %#ok 21 | cvx_end 22 | 23 | else 24 | 25 | error( 'Discipliend convex programming error:\n LAMBDA_MAX is convex and nonmonotonic, so its input must be affine.' ); 26 | 27 | end 28 | 29 | % Copyright 2005-2016 CVX Research, Inc. 30 | % See the file LICENSE.txt for full copyright information. 31 | % The command 'cvx_where' will show where this file is located. 32 | -------------------------------------------------------------------------------- /functions/@cvx/log_normcdf.m: -------------------------------------------------------------------------------- 1 | function y = log_normcdf( x ) 2 | 3 | %LOG_NORMCDF Internal CVX version. 4 | 5 | narginchk(1,1); 6 | if ~isreal( x ), 7 | error( 'Argument must be real.' ); 8 | end 9 | 10 | persistent a b nb ob 11 | if isempty( a ), 12 | a =sqrt( [ 0.018102332171520 13 | 0.011338501342044 14 | 0.072727608432177 15 | 0.184816581789135 16 | 0.189354610912339 17 | 0.023660365352785 ] ); 18 | a = sparse(diag(a)); 19 | b = [3 2.5 2 1 -1 -2]'; 20 | nb = length(b); 21 | ob = ones(nb,1); 22 | end 23 | 24 | cx = cvx_isconstant( x ); 25 | sx = size(x); 26 | nx = prod(sx); 27 | y = a * ( b * ones(1,nx) - ob * reshape( x, 1, nx ) ); 28 | if cx, 29 | y = cvx( sum( cvx_constant( max( y, 0 ) ) .^ 2 ) ); 30 | else 31 | y = sum_square_pos( y ); 32 | end 33 | y = - reshape( y, sx ); 34 | 35 | % Copyright 2005-2016 CVX Research, Inc. 36 | % See the file LICENSE.txt for full copyright information. 37 | % The command 'cvx_where' will show where this file is located. 38 | -------------------------------------------------------------------------------- /functions/@cvx/norm_nuc.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = norm_nuc( X ) %#ok 2 | 3 | %NORM_NUC Internal cvx version. 4 | 5 | narginchk(1,1); 6 | if ndims( X ) > 2, %#ok 7 | error( 'norm_nuc is not defined for N-D arrays.' ); 8 | elseif ~cvx_isaffine( X ), 9 | error( 'Input must be affine.' ); 10 | end 11 | 12 | % 13 | % Construct problem 14 | % 15 | 16 | [ m, n ] = size( X ); %#ok 17 | W1 = []; W2 = []; 18 | cvx_begin sdp 19 | if isreal(X) 20 | variable W1(m,m) symmetric 21 | variable W2(n,n) symmetric 22 | else 23 | variable W1(m,m) hermitian 24 | variable W2(n,n) hermitian 25 | end 26 | minimize(0.5*(trace(W1)+trace(W2))); 27 | [W1,X;X',W2] >= 0; %#ok 28 | cvx_end 29 | 30 | % Copyright 2005-2016 CVX Research, Inc. 31 | % See the file LICENSE.txt for full copyright information. 32 | % The command 'cvx_where' will show where this file is located. 33 | -------------------------------------------------------------------------------- /functions/@cvx/pow_abs.m: -------------------------------------------------------------------------------- 1 | function y = pow_abs( x, p ) 2 | 3 | %POW_ABS Internal cvx version. 4 | 5 | narginchk(2,2); 6 | if ~cvx_isconstant( p ), 7 | error( 'Second argument must be constant.' ); 8 | elseif ~isreal( p ), 9 | error( 'Second argument must be real.' ); 10 | elseif any( cvx_constant( p(:) ) < 1 ), 11 | error( 'Second argument must be greater than or equal to one.' ); 12 | end 13 | y = pow_cvx( x, p, 'pow_abs' ); 14 | 15 | % Copyright 2005-2016 CVX Research, Inc. 16 | % See the file LICENSE.txt for full copyright information. 17 | % The command 'cvx_where' will show where this file is located. 18 | -------------------------------------------------------------------------------- /functions/@cvx/pow_p.m: -------------------------------------------------------------------------------- 1 | function y = pow_p( x, p ) 2 | 3 | %POW_P Internal cvx version. 4 | 5 | narginchk(2,2); 6 | y = pow_cvx( x, p, 'pow_p' ); 7 | 8 | % Copyright 2005-2016 CVX Research, Inc. 9 | % See the file LICENSE.txt for full copyright information. 10 | % The command 'cvx_where' will show where this file is located. 11 | -------------------------------------------------------------------------------- /functions/@cvx/pow_pos.m: -------------------------------------------------------------------------------- 1 | function y = pow_pos( x, p ) 2 | 3 | %POW_POS Internal cvx version. 4 | 5 | narginchk(2,2); 6 | if ~cvx_isconstant( p ), 7 | error( 'Second argument must be constant.' ); 8 | elseif ~isreal( p ), 9 | error( 'Second argument must be real.' ); 10 | end 11 | p = cvx_constant( p ); 12 | if nnz( p < 1 ), 13 | error( 'Second argument must be greater than or equal to 1.\n(Use POW_P for exponents less than 1.)', 1 ); %#ok 14 | end 15 | y = pow_cvx( x, p, 'pow_pos' ); 16 | 17 | % Copyright 2005-2016 CVX Research, Inc. 18 | % See the file LICENSE.txt for full copyright information. 19 | % The command 'cvx_where' will show where this file is located. 20 | 21 | -------------------------------------------------------------------------------- /functions/@cvx/quad_pos_over_lin.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = quad_pos_over_lin( x, y, varargin ) %#ok 2 | 3 | %QUAD_POS_OVER_LIN Internal cvx version. 4 | 5 | narginchk(2,3); 6 | if ~isreal( x ), 7 | error( 'First input must be real.' ); 8 | end 9 | x2 = []; 10 | cvx_begin 11 | variable x2( size(x) ) 12 | minimize quad_over_lin( x2, y, varargin{:} ); 13 | x2 >= x; %#ok 14 | cvx_end 15 | 16 | % Copyright 2005-2016 CVX Research, Inc. 17 | % See the file LICENSE.txt for full copyright information. 18 | % The command 'cvx_where' will show where this file is located. 19 | 20 | -------------------------------------------------------------------------------- /functions/@cvx/sigma_max.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = sigma_max( x ) 2 | 3 | %SIGMA_MAX Internal cvx version. 4 | 5 | narginchk(1,1); 6 | if ndims( x ) > 2, %#ok 7 | error( 'lambda_max is not defined for N-D arrays.' ); 8 | elseif ~cvx_isaffine( x ), 9 | error( 'Input must be affine.' ); 10 | end 11 | 12 | % 13 | % Construct problem 14 | % 15 | 16 | [ m, n ] = size( x ); 17 | cvx_optval = lambda_max( [ zeros( m, m ), x ; x', zeros( n, n ) ] ); 18 | 19 | % Copyright 2005-2016 CVX Research, Inc. 20 | % See the file LICENSE.txt for full copyright information. 21 | % The command 'cvx_where' will show where this file is located. 22 | -------------------------------------------------------------------------------- /functions/@cvx/square_abs.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = square_abs( x ) 2 | 3 | %SQUARE_ABS Internal cvx version. 4 | 5 | narginchk(1,1); 6 | cvx_optval = pow_abs( x, 2 ); 7 | 8 | % Copyright 2005-2016 CVX Research, Inc. 9 | % See the file LICENSE.txt for full copyright information. 10 | % The command 'cvx_where' will show where this file is located. 11 | -------------------------------------------------------------------------------- /functions/@cvx/square_pos.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = square_pos( x ) 2 | 3 | %SQUARE_POS Internal cvx version. 4 | 5 | narginchk(1,1); 6 | cvx_optval = pow_pos( x, 2 ); 7 | 8 | % Copyright 2005-2016 CVX Research, Inc. 9 | % See the file LICENSE.txt for full copyright information. 10 | % The command 'cvx_where' will show where this file is located. 11 | -------------------------------------------------------------------------------- /functions/@cvx/sum_log.m: -------------------------------------------------------------------------------- 1 | function y = sum_log( x, dim ) 2 | 3 | %SUM_LOG Internal CVX version. 4 | 5 | cvx_expert_check( 'sum_log', x ); 6 | narginchk(1,2); 7 | if nargin == 2, 8 | y = size( x, dim ) * log( geo_mean( x, dim ) ); 9 | else 10 | y = length( x ) * log( geo_mean( x ) ); 11 | end 12 | 13 | % Copyright 2005-2016 CVX Research, Inc. 14 | % See the file LICENSE.txt for full copyright information. 15 | % The command 'cvx_where' will show where this file is located. 16 | -------------------------------------------------------------------------------- /functions/@cvx/sum_square.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = sum_square( x, varargin ) 2 | 3 | %SUM_SQUARE Internal cvx version. 4 | 5 | narginchk(1,2); 6 | if ~isreal( x ), 7 | error( 'Disciplined convex programming error:\n The argument to SUM_SQUARE must be real and affine.', 1 ); %#ok 8 | end 9 | cvx_optval = quad_over_lin( x, 1, varargin{:} ); 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | -------------------------------------------------------------------------------- /functions/@cvx/sum_square_abs.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = sum_square_abs( x, varargin ) 2 | 3 | %SUM_SQUARE_ABS Internal cvx version. 4 | 5 | narginchk(1,2); 6 | cvx_optval = quad_over_lin( x, 1, varargin{:} ); 7 | 8 | % Copyright 2005-2016 CVX Research, Inc. 9 | % See the file LICENSE.txt for full copyright information. 10 | % The command 'cvx_where' will show where this file is located. 11 | -------------------------------------------------------------------------------- /functions/@cvx/sum_square_pos.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = sum_square_pos( x, varargin ) %#ok 2 | 3 | %SUM_SQUARE_POS Internal cvx version. 4 | 5 | narginchk(1,2); 6 | x2 = []; 7 | cvx_begin 8 | variable x2( size( x ) ); 9 | minimize( sum_square( x2, varargin{:} ) ); 10 | x2 >= x; %#ok 11 | cvx_end 12 | 13 | % Copyright 2005-2016 CVX Research, Inc. 14 | % See the file LICENSE.txt for full copyright information. 15 | % The command 'cvx_where' will show where this file is located. 16 | -------------------------------------------------------------------------------- /functions/@cvx/trace_inv.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = trace_inv( X ) %#ok 2 | 3 | %TRACE_INV Internal cvx version. 4 | 5 | narginchk(1,1); 6 | if ndims( X ) > 2, %#ok 7 | error( 'trace_inv is not defined for N-D arrays.' ); 8 | elseif ~cvx_isaffine( X ), 9 | error( 'Input must be affine.' ); 10 | end 11 | n = size(X,1); 12 | if n ~= size( X, 2 ), 13 | error( 'Matrix must be square.' ); 14 | end 15 | 16 | % 17 | % Construct problem 18 | % 19 | 20 | Y = []; 21 | cvx_begin sdp 22 | if isreal(X), 23 | variable Y(n,n) symmetric 24 | else 25 | variable Y(n,n) Hermitian 26 | end 27 | minimize(trace(Y)); 28 | [Y,eye(n);eye(n),X] >= 0; %#ok 29 | cvx_end 30 | 31 | % Copyright 2005-2016 CVX Research, Inc. 32 | % See the file LICENSE.txt for full copyright information. 33 | % The command 'cvx_where' will show where this file is located. 34 | -------------------------------------------------------------------------------- /functions/@cvx/trace_sqrtm.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = trace_sqrtm( X ) %#ok 2 | 3 | %TRACE_SQRTM Internal cvx version. 4 | 5 | narginchk(1,1); 6 | if ndims( X ) > 2, %#ok 7 | error( 'trace_inv is not defined for N-D arrays.' ); 8 | elseif ~cvx_isaffine( X ), 9 | error( 'Input must be affine.' ); 10 | end 11 | n = size(X,1); 12 | if n ~= size( X, 2 ), 13 | error( 'Matrix must be square.' ); 14 | end 15 | 16 | % 17 | % Construct problem 18 | % 19 | 20 | Y = []; 21 | cvx_begin sdp 22 | if isreal(X), 23 | variable Y(n,n) 24 | else 25 | variable Y(n,n) complex 26 | end 27 | maximize(real(trace(Y))); 28 | [eye(n),Y;Y',X] >= 0; %#ok 29 | cvx_end 30 | 31 | % Copyright 2005-2016 CVX Research, Inc. 32 | % See the file LICENSE.txt for full copyright information. 33 | % The command 'cvx_where' will show where this file is located. 34 | -------------------------------------------------------------------------------- /functions/@cvx/vec.m: -------------------------------------------------------------------------------- 1 | function x = vec( x ) 2 | 3 | % VEC CVX implementation of vec 4 | 5 | x.size_ = [prod(x.size_),1]; 6 | 7 | % Copyright 2005-2016 CVX Research, Inc. 8 | % See the file LICENSE.txt for full copyright information. 9 | % The command 'cvx_where' will show where this file is located. 10 | -------------------------------------------------------------------------------- /functions/det_root2n.m: -------------------------------------------------------------------------------- 1 | function cvx_optval = det_root2n( X ) 2 | 3 | %DET_ROOT2N 2nth-root of the determinant of an SPD matrix. 4 | % For a square matrix X, DET_ROOT2N(X) returns 5 | % POW(DET(X),1/(2*size(X,1)) 6 | % if X is symmetric (real) or Hermitian (complex) and positive 7 | % semidefinite, and -Inf otherwise. 8 | % 9 | % This function has been replaced in significance with DET_ROOTN(X), 10 | % and is now simply implemented as SQRT(DET_ROOTN(X)). Please see 11 | % DET_ROOTN for more information on its usefulness. 12 | % 13 | % Disciplined convex programming information: 14 | % DET_ROOT2N is concave and nonmonotonic; therefore, when used in 15 | % CVX specifications, its argument must be affine. 16 | 17 | narginchk(1,1); 18 | cvx_optval = sqrt(det_rootn(X)); 19 | 20 | % Copyright 2005-2016 CVX Research, Inc. 21 | % See the file LICENSE.txt for full copyright information. 22 | % The command 'cvx_where' will show where this file is located. 23 | -------------------------------------------------------------------------------- /functions/entr.m: -------------------------------------------------------------------------------- 1 | function y = entr( x ) 2 | 3 | %ENTR Scalar entropy. 4 | % ENTR(X) returns an array of the same size as X with the unnormalized 5 | % entropy function applied to each element: 6 | % { -X.*LOG(X) if X > 0, 7 | % ENTR(X) = { 0 if X == 0, 8 | % { -Inf otherwise. 9 | % If X is a vector representing a discrete probability distribution, then 10 | % SUM(ENTR(X)) returns its entropy. 11 | % 12 | % Disciplined convex programming information: 13 | % ENTR(X) is concave and nonmonotonic in X. Thus when used in CVX 14 | % expressions, X must be real and affine. Its use will effectively 15 | % constrain X to be nonnegative: there is no need to add an 16 | % additional X >= 0 to your model in order to enforce this. 17 | 18 | narginchk(1,1); 19 | cvx_expert_check( 'entr', x ); 20 | y = -rel_entr( x, 1 ); 21 | 22 | % Copyright 2005-2016 CVX Research, Inc. 23 | % See the file LICENSE.txt for full copyright information. 24 | % The command 'cvx_where' will show where this file is located. 25 | -------------------------------------------------------------------------------- /functions/geomean.m: -------------------------------------------------------------------------------- 1 | function y = geomean( varargin ) 2 | 3 | %GEOMEAN Geometric mean. 4 | % GEOMEAN(X) = GEO_MEAN(X) = PROD(X).^(1/LENGTH(X)). We have replaced this 5 | % function with GEO_MEAN to better match our function naming conventions. 6 | % Please start using it instead. 7 | 8 | warning( 'CVX:Renamed', [ ... 9 | 'The function "geomean" has been renamed "geo_mean". Please start\n', ... 10 | 'using the new name. The old name will be removed in a future release.' ], 1 ); 11 | 12 | y = geo_mean( varargin{:} ); 13 | 14 | % Copyright 2005-2016 CVX Research, Inc. 15 | % See the file LICENSE.txt for full copyright information. 16 | % The command 'cvx_where' will show where this file is located. 17 | -------------------------------------------------------------------------------- /functions/inv_pos.m: -------------------------------------------------------------------------------- 1 | function y = inv_pos( x ) 2 | 3 | %INV_POS Reciprocal of a positive quantity. 4 | % INV_POS(X) returns 1./X if X is positive, and +Inf otherwise. 5 | % X must be real. 6 | % 7 | % For matrices and N-D arrays, the function is applied to each element. 8 | % 9 | % Disciplined convex programming information: 10 | % INV_POS is convex and nonincreasing; therefore, when used in CVX 11 | % specifications, its argument must be concave (or affine). 12 | 13 | narginchk(1,1); 14 | if ~isreal( x ), 15 | error( 'Input must be real.' ); 16 | end 17 | y = 1.0 ./ max( x, 0 ); 18 | 19 | % Copyright 2005-2016 CVX Research, Inc. 20 | % See the file LICENSE.txt for full copyright information. 21 | % The command 'cvx_where' will show where this file is located. 22 | -------------------------------------------------------------------------------- /functions/lambda_max.m: -------------------------------------------------------------------------------- 1 | function z = lambda_max( Y ) 2 | 3 | % LAMBDA_MAX Maximum eigenvalue of a symmetric matrix. 4 | % For square matrix X, LAMBDA_MAX(X) is MAX(EIG(X)) if X is Hermitian 5 | % or symmetric and real; and +Inf otherwise. 6 | % 7 | % An error results if X is not a square matrix. 8 | % 9 | % Disciplined convex programming information: 10 | % LAMBDA_MAX is convex and nonmonotonic (at least with respect to 11 | % elementwise comparison), so its argument must be affine. 12 | 13 | narginchk(1,1); 14 | if ndims( Y ) > 2 || size( Y, 1 ) ~= size( Y, 2 ), %#ok 15 | error( 'Input must be a square matrix.' ); 16 | end 17 | err = Y - Y'; 18 | Y = 0.5 * ( Y + Y' ); 19 | if norm( err, 'fro' ) > 8 * eps * norm( Y, 'fro' ), 20 | z = Inf; 21 | else 22 | z = max( eig( full( Y ) ) ); 23 | end 24 | 25 | % Copyright 2005-2016 CVX Research, Inc. 26 | % See the file LICENSE.txt for full copyright information. 27 | % The command 'cvx_where' will show where this file is located. 28 | 29 | -------------------------------------------------------------------------------- /functions/lambda_min.m: -------------------------------------------------------------------------------- 1 | function z = lambda_min( Y ) 2 | 3 | % LAMBDA_MIN Minimum eigenvalue of a symmetric matrix. 4 | % For square matrix X, LAMBDA_MIN(X) is MIN(EIG(X)) if X is Hermitian 5 | % or symmetric and real; and -Inf otherwise. 6 | % 7 | % An error results if X is not a square matrix. 8 | % 9 | % Disciplined convex programming information: 10 | % LAMBDA_MIN is concave and nonmonotonic (at least with respect to 11 | % elementwise comparison), so its argument must be affine. 12 | 13 | narginchk(1,1); 14 | z = - lambda_max( -Y ); 15 | 16 | % Copyright 2005-2016 CVX Research, Inc. 17 | % See the file LICENSE.txt for full copyright information. 18 | % The command 'cvx_where' will show where this file is located. 19 | 20 | -------------------------------------------------------------------------------- /functions/lambda_sum_smallest.m: -------------------------------------------------------------------------------- 1 | function z = lambda_sum_smallest( Y, k ) 2 | 3 | % LAMBDA_SUM_SMALLEST Sum of the k smallest eigenvalues of a symmetric matrix. 4 | % For square matrix X, LAMBDA_SUM_SMALLEST(X,K) is SUM_SMALLEST(EIG(X),k) 5 | % if X is Hermitian or symmetric and real; and +Inf otherwise. 6 | % 7 | % An error results if X is not a square matrix. 8 | % 9 | % Disciplined convex programming information: 10 | % LAMBDA_SUM_SMALLEST is concave and nonmonotonic (at least with 11 | % respect to elementwise comparison), so its argument must be affine. 12 | 13 | z = - lambda_sum_largest( - Y, k ); 14 | 15 | % Copyright 2005-2016 CVX Research, Inc. 16 | % See the file LICENSE.txt for full copyright information. 17 | % The command 'cvx_where' will show where this file is located. 18 | -------------------------------------------------------------------------------- /functions/logsumexp.m: -------------------------------------------------------------------------------- 1 | function y = logsumexp( varargin ) 2 | 3 | %LOGSUMEXP log(sum(exp(x))). 4 | % LOGSUMEXP(X) = LOG_SUM_EXP(X) = LOG(SUM(EXP(X)). We have replaced this 5 | % function with LOG_SUM_EXP to better match our function naming 6 | % conventions. Please start using it instead. 7 | 8 | warning( 'CVX:Renamed', [ ... 9 | 'The function "logsumexp" has been renamed "log_sum_exp". Please start\n', ... 10 | 'using the new name. The old name will be removed in a future release.' ], 1 ); 11 | 12 | y = log_sum_exp( varargin{:} ); 13 | 14 | % Copyright 2005-2016 CVX Research, Inc. 15 | % See the file LICENSE.txt for full copyright information. 16 | % The command 'cvx_where' will show where this file is located. 17 | -------------------------------------------------------------------------------- /functions/norm_nuc.m: -------------------------------------------------------------------------------- 1 | function z = norm_nuc( x ) 2 | 3 | %NORM_NUC Nuclear norm of a matrix. 4 | % NORM_NUC(X) = SUM(SVD(X)). X must be a 2-D matrix, real or complex. 5 | % 6 | % Disciplined convex programming information: 7 | % NORM_NUC(X) is convex and nonmontonic in X, so X must be affine. 8 | 9 | narginchk(1,1); 10 | z = sum(svd(x)); 11 | 12 | % Copyright 2005-2016 CVX Research, Inc. 13 | % See the file LICENSE.txt for full copyright information. 14 | % The command 'cvx_where' will show where this file is located. 15 | -------------------------------------------------------------------------------- /functions/polyenv.m: -------------------------------------------------------------------------------- 1 | function y = polyenv( varargin ) 2 | 3 | %POLYENV Evaluate the convex or concave envelope of a polynomial. 4 | % We have replaced this function with POLY_ENV to better match our 5 | % function naming conventions. Please start using it instead. 6 | 7 | warning( 'CVX:Renamed', [ ... 8 | 'The function "polyenv" has been renamed "poly_env". Please start using\n', ... 9 | 'the new name. The old name will be removed in a future release.' ], 1 ); 10 | 11 | y = poly_env( varargin{:} ); 12 | 13 | % Copyright 2005-2016 CVX Research, Inc. 14 | % See the file LICENSE.txt for full copyright information. 15 | % The command 'cvx_where' will show where this file is located. 16 | -------------------------------------------------------------------------------- /functions/pos.m: -------------------------------------------------------------------------------- 1 | function y = pos( x ) 2 | 3 | % POS Positive part. 4 | % POS(X) = MAX(X,0). X must be real. 5 | % 6 | % Disciplined convex programming information: 7 | % POS(X) is convex and nondecreasing in X. Thus when used in CVX 8 | % expressions, X must be convex (or affine). 9 | 10 | narginchk(1,1); 11 | if ~isreal( x ), 12 | 13 | error( 'Argument must be real.' ); 14 | 15 | else 16 | 17 | y = max( x, 0 ); 18 | 19 | end 20 | 21 | % Copyright 2005-2016 CVX Research, Inc. 22 | % See the file LICENSE.txt for full copyright information. 23 | % The command 'cvx_where' will show where this file is located. 24 | -------------------------------------------------------------------------------- /functions/pow_abs.m: -------------------------------------------------------------------------------- 1 | function y = pow_abs( x, p ) 2 | 3 | %POW_POS Power of absolute value. 4 | % POW_POS(X,P) = ABS(X).^P. 5 | % P must be real and greater than or equal to one. 6 | % 7 | % Disciplined convex programming information: 8 | % POW_ABS(X,P) is convex and nonmonotonic, so X must be affine. 9 | % P must be constant, and its elements must be greater than or 10 | % equal to one. X may be complex. 11 | 12 | narginchk(2,2); 13 | if ~isnumeric( x ) || ~isnumeric( p ), 14 | error( 'Arguments must be numeric.' ); 15 | elseif ~isreal( p ), 16 | error( 'Second argument must be real.' ); 17 | elseif any( p(:) < 1 ), 18 | error( 'Second argument must be greater than or equal to one.' ); 19 | end 20 | y = abs(x).^p; 21 | 22 | % Copyright 2005-2016 CVX Research, Inc. 23 | % See the file LICENSE.txt for full copyright information. 24 | % The command 'cvx_where' will show where this file is located. 25 | -------------------------------------------------------------------------------- /functions/pow_pos.m: -------------------------------------------------------------------------------- 1 | function y = pow_pos( x, p ) 2 | 3 | %POW_POS Power of positive part. 4 | % POW_POS(X,P) = POS(X).^P = MAX(X,0).^P. 5 | % Both P and X must be real, and P must be greater than or equal to 1. 6 | % 7 | % Disciplined convex programming information: 8 | % POW_POS(X,P) is convex and nondecreasing in X; so when used in CVX 9 | % expressions, X must be convex. P must be constant, real, and 10 | % greater than or equal to 1. 11 | 12 | narginchk(2,2); 13 | if ~isnumeric( x ) || ~isreal( x ) || ~isnumeric( p ) || ~isreal( p ), 14 | error( 'Arguments must be real.' ); 15 | elseif any( p(:) <= 1 ), 16 | error( 'Second argument must be greater than or equal to 1.\nFor other exponents, use POW_P instead.', 1 ); %#ok 17 | end 18 | y = max(x,0).^p; 19 | 20 | % Copyright 2005-2016 CVX Research, Inc. 21 | % See the file LICENSE.txt for full copyright information. 22 | % The command 'cvx_where' will show where this file is located. 23 | -------------------------------------------------------------------------------- /functions/sigma_max.m: -------------------------------------------------------------------------------- 1 | function z = sigma_max( x ) 2 | 3 | %SIGMA_MAX Maximum singular value. 4 | % SIGMA_MAX(X) returns the maximum singular value of X. X must be a 2-D 5 | % matrix, real or complex. SIGMA_MAX(X) is synonymous with NORM(X). 6 | % 7 | % Disciplined convex programming information: 8 | % SIGMA_MAX(X) is convex and nonmontonic in X, so X must be affine. 9 | 10 | narginchk(1,1); 11 | z = norm( x, 2 ); 12 | 13 | % Copyright 2005-2016 CVX Research, Inc. 14 | % See the file LICENSE.txt for full copyright information. 15 | % The command 'cvx_where' will show where this file is located. 16 | -------------------------------------------------------------------------------- /functions/square_/square.m: -------------------------------------------------------------------------------- 1 | function y = square( x ) 2 | 3 | %SQUARE Square. 4 | % SQUARE(X) is an array of the same size as X, whose elements are the 5 | % squares of the elements of X. 6 | % 7 | % Disciplined convex programming information: 8 | % If X is real, then SQUARE(X) is convex and nonmonotonic in X. If X 9 | % is complex, then SQUARE(X) is neither convex nor concave. Thus when 10 | % when use in CVX expressions, X must be real and affine. 11 | 12 | narginchk(1,1); 13 | y = x .* x; 14 | 15 | % Copyright 2005-2016 CVX Research, Inc. 16 | % See the file LICENSE.txt for full copyright information. 17 | % The command 'cvx_where' will show where this file is located. 18 | -------------------------------------------------------------------------------- /functions/square_abs.m: -------------------------------------------------------------------------------- 1 | function y = square_abs( x ) 2 | 3 | %SQUARE_ABS Square of absolute value. 4 | % For real X, SQUARE_ABS(X) produces the same result as SQUARE(X); that 5 | % is, it squares the elements of X. For complex X, SQUARE_ABS(X) returns 6 | % a real array whose elements are the squares of the magnitudes of the 7 | % elements of X; that is, SQUARE_ABS(X) = CONJ(X).*X. 8 | % 9 | % Disciplined convex programming information: 10 | % SQUARE_ABS(X) is convex and nonmonotonic in X. Thus when used in 11 | % CVX expressions, X must be affine. 12 | 13 | narginchk(1,1); 14 | y = conj( x ) .* x; 15 | 16 | % Copyright 2005-2016 CVX Research, Inc. 17 | % See the file LICENSE.txt for full copyright information. 18 | % The command 'cvx_where' will show where this file is located. 19 | -------------------------------------------------------------------------------- /functions/square_pos.m: -------------------------------------------------------------------------------- 1 | function y = square_pos( x ) 2 | 3 | %SQUARE_POS Square of positive part. 4 | % SQUARE_POS(X) is the square of the postive parts of the elements of X; 5 | % i.e., SQUARE_POS(X)=MAX(X,0).^2. X must be real. 6 | % 7 | % Disciplined convex programming information: 8 | % SQUARE_POS(X) is convex and nondecreasing in X. Thus when used in 9 | % CVX expressions, X must be convex (or affine). 10 | 11 | narginchk(1,1); 12 | if ~isreal( x ), 13 | error( 'Argument must be real.' ); 14 | end 15 | 16 | y = square( max( x, 0 ) ); 17 | 18 | % Copyright 2005-2016 CVX Research, Inc. 19 | % See the file LICENSE.txt for full copyright information. 20 | % The command 'cvx_where' will show where this file is located. 21 | -------------------------------------------------------------------------------- /functions/sum_square_abs.m: -------------------------------------------------------------------------------- 1 | function y = sum_square_abs( x, dim ) 2 | 3 | %SUM_SQUARE_ABS Sum of the squares of absolute values. 4 | % For real arrays, SUM_SQUARE_ABS(X) computes the same result as 5 | % SUM_SQUARE(X). For complex arrays, SUM_SQUARE(X) first computes the 6 | % magnitudes of the elements of X, so it compute SUM_SQUARE_ABS(X). 7 | % 8 | % Similarly, SUM_SQUARE_ABS(X,DIM) implements SUM_SQUARE(ABS(X),DIM). 9 | % 10 | % Disciplined convex programming information: 11 | % SUM_SQUARE_ABS(X,...) is convex and nonmonotonic in X. Thus, when 12 | % used in CVX expressions, X must be affine. DIM must be constant. 13 | 14 | narginchk(1,2); 15 | y = conj( x ) .* x; 16 | if nargin == 2, 17 | y = sum( y, dim ); 18 | else 19 | y = sum( y ); 20 | end 21 | 22 | % Copyright 2005-2016 CVX Research, Inc. 23 | % See the file LICENSE.txt for full copyright information. 24 | % The command 'cvx_where' will show where this file is located. 25 | -------------------------------------------------------------------------------- /functions/sym.m: -------------------------------------------------------------------------------- 1 | function x = sym( x ) 2 | 3 | % SYM Symmetrize. 4 | % SYM(X), where X is a matrix, returns the symmetric or Hermitian part 5 | % of X; that is, SYM(X) = 0.5 * ( X + X' ). If X is an array, SYM(X) 6 | % symmetrizes each of the submatrices X(:,:,k). X must satisfy 7 | % size(X,1) = size(X,2). 8 | % 9 | % SYM(X) is useful in CVX when constructing LMIs. Sometimes, numerical 10 | % errors will cause a construct to be slightly non-symmetric, causing 11 | % CVX to flag it as an error. If you are sure the asymmetry is solely 12 | % due to this effect, SYM(X) will correct it for you. 13 | 14 | sx = size(x); 15 | if sx(1) ~= sx(2), 16 | error( 'Argument must be square in its first two dimensions.' ); 17 | elseif sx(1) > 1, 18 | x = 0.5 * ( x + conj( permute( x, [2,1,3:length(sx)] ) ) ); 19 | end 20 | 21 | % Copyright 2005-2016 CVX Research, Inc. 22 | % See the file LICENSE.txt for full copyright information. 23 | % The command 'cvx_where' will show where this file is located. 24 | -------------------------------------------------------------------------------- /functions/vec_/vec.m: -------------------------------------------------------------------------------- 1 | function v = vec( x ) 2 | 3 | % VEC Vectorize. 4 | % VEC(X), where X is a vector, matrix, or N-D array, returns a column vector 5 | % containing all of the elements of X; i.e., VEC(X)=X(:). 6 | 7 | v = reshape( x, numel( x ), 1 ); 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /keywords/Contents.m: -------------------------------------------------------------------------------- 1 | % CVX: Keywords for declaring variables and objectives 2 | % dual - Declares one or more dual variables. 3 | % epigraph - Declares an epigraph variable. 4 | % hypograph - Declares a hypograph variable. 5 | % maximize - Specifies a concave (or affine) objective to be maximized. 6 | % minimize - Specifies a convex (or affine) objective to be maximized. 7 | % subject - Implements the "subject to" keyword. 8 | % variable - Declares a single CVX variable with optional matrix structure. 9 | % variables - Declares one or more CVX variables. 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | -------------------------------------------------------------------------------- /keywords/In.m: -------------------------------------------------------------------------------- 1 | function y = In 2 | y = cvxin; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /keywords/maximise.m: -------------------------------------------------------------------------------- 1 | function maximise( varargin ) 2 | 3 | %MAXIMISE Specifiies a concave (or affine) objective to be maximized. 4 | 5 | global cvx___ 6 | prob = evalin( 'caller', 'cvx_problem', '[]' ); 7 | if ~isa( prob, 'cvxprob' ), 8 | error( 'No CVX model exists in this scope.' ); 9 | elseif isempty( cvx___.problems ) || cvx___.problems( end ).self ~= prob, 10 | error( 'Internal CVX data corruption. Please CLEAR ALL and rebuild your model.' ); 11 | elseif nargin < 1, 12 | error( 'Objective expression missing.' ); 13 | elseif iscellstr( varargin ), 14 | x = evalin( 'caller', sprintf( '%s ', varargin{:} ) ); 15 | elseif nargin > 1, 16 | error( 'Too many input arguments.' ); 17 | else 18 | x = varargin{1}; 19 | end 20 | try 21 | newobj( prob, 'maximize', x ); 22 | catch exc 23 | rethrow( exc ) 24 | end 25 | 26 | % Copyright 2005-2016 CVX Research, Inc. 27 | % See the file LICENSE.txt for full copyright information. 28 | % The command 'cvx_where' will show where this file is located. 29 | -------------------------------------------------------------------------------- /keywords/maximize.m: -------------------------------------------------------------------------------- 1 | function maximize( varargin ) 2 | 3 | %MAXIMIZE Specifiies a concave (or affine) objective to be maximized. 4 | 5 | global cvx___ 6 | prob = evalin( 'caller', 'cvx_problem', '[]' ); 7 | if ~isa( prob, 'cvxprob' ), 8 | error( 'No CVX model exists in this scope.' ); 9 | elseif isempty( cvx___.problems ) || cvx___.problems( end ).self ~= prob, 10 | error( 'Internal CVX data corruption. Please CLEAR ALL and rebuild your model.' ); 11 | elseif nargin < 1, 12 | error( 'Objective expression missing.' ); 13 | elseif iscellstr( varargin ), 14 | x = evalin( 'caller', sprintf( '%s ', varargin{:} ) ); 15 | elseif nargin > 1, 16 | error( 'Too many input arguments.' ); 17 | else 18 | x = varargin{1}; 19 | end 20 | try 21 | newobj( prob, 'maximize', x ); 22 | catch exc 23 | rethrow( exc ) 24 | end 25 | 26 | % Copyright 2005-2016 CVX Research, Inc. 27 | % See the file LICENSE.txt for full copyright information. 28 | % The command 'cvx_where' will show where this file is located. 29 | -------------------------------------------------------------------------------- /keywords/minimise.m: -------------------------------------------------------------------------------- 1 | function minimise( varargin ) 2 | 3 | %MINIMISE Specifiies a convex (or affine) objective to be maximized. 4 | 5 | global cvx___ 6 | prob = evalin( 'caller', 'cvx_problem', '[]' ); 7 | if ~isa( prob, 'cvxprob' ), 8 | error( 'No CVX model exists in this scope.' ); 9 | elseif isempty( cvx___.problems ) || cvx___.problems( end ).self ~= prob, 10 | error( 'Internal CVX data corruption. Please CLEAR ALL and rebuild your model.' ); 11 | elseif nargin < 1, 12 | error( 'Objective expression missing.' ); 13 | elseif iscellstr( varargin ), 14 | x = evalin( 'caller', sprintf( '%s ', varargin{:} ) ); 15 | elseif nargin > 1, 16 | error( 'Too many input arguments.' ); 17 | else 18 | x = varargin{1}; 19 | end 20 | try 21 | newobj( prob, 'minimize', x ); 22 | catch exc 23 | rethrow( exc ) 24 | end 25 | 26 | % Copyright 2005-2016 CVX Research, Inc. 27 | % See the file LICENSE.txt for full copyright information. 28 | % The command 'cvx_where' will show where this file is located. 29 | -------------------------------------------------------------------------------- /keywords/minimize.m: -------------------------------------------------------------------------------- 1 | function minimize( varargin ) 2 | 3 | %MINIMIZE Specifiies a convex (or affine) objective to be maximized. 4 | 5 | global cvx___ 6 | prob = evalin( 'caller', 'cvx_problem', '[]' ); 7 | if ~isa( prob, 'cvxprob' ), 8 | error( 'No CVX model exists in this scope.' ); 9 | elseif isempty( cvx___.problems ) || cvx___.problems( end ).self ~= prob, 10 | error( 'Internal CVX data corruption. Please CLEAR ALL and rebuild your model.' ); 11 | elseif nargin < 1, 12 | error( 'Objective expression missing.' ); 13 | elseif iscellstr( varargin ), 14 | x = evalin( 'caller', sprintf( '%s ', varargin{:} ) ); 15 | elseif nargin > 1, 16 | error( 'Too many input arguments.' ); 17 | else 18 | x = varargin{1}; 19 | end 20 | try 21 | newobj( prob, 'minimize', x ); 22 | catch exc 23 | rethrow( exc ) 24 | end 25 | 26 | % Copyright 2005-2016 CVX Research, Inc. 27 | % See the file LICENSE.txt for full copyright information. 28 | % The command 'cvx_where' will show where this file is located. 29 | -------------------------------------------------------------------------------- /keywords/subject.m: -------------------------------------------------------------------------------- 1 | function subject( to ) 2 | 3 | %SUBJECT Implements the "subject to" keyword. 4 | % The keyword 5 | % SUBJECT TO 6 | % is a "no-op"---that is, it has no functional value. It is provided 7 | % solely to allow CVX models to read more closely to their mathematical 8 | % counterparts; e.g. 9 | % MINIMIZE( ) 10 | % SUBJECT TO 11 | % 12 | % ... 13 | % It may be omitted without altering the model in any way. 14 | 15 | % We had some consistency checking code here, but given that this is supposed to be 16 | % no-op, it seems sensible to remove it all. 17 | 18 | % Copyright 2005-2016 CVX Research, Inc. 19 | % See the file LICENSE.txt for full copyright information. 20 | % The command 'cvx_where' will show where this file is located. 21 | -------------------------------------------------------------------------------- /lib/@cell/cvx_id.m: -------------------------------------------------------------------------------- 1 | function y = cvx_id( x ) 2 | y = cellfun( @cvx_id, x ); 3 | if isempty( y ), 4 | y = -Inf; 5 | else 6 | y = max( y( : ) ); 7 | end 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/@cell/cvx_setdual.m: -------------------------------------------------------------------------------- 1 | function x = cvx_setdual( x, y ) 2 | x = cvx_setdual( cvxtuple( x ), y ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cell/cvx_value.m: -------------------------------------------------------------------------------- 1 | function y = cvx_value( x ) 2 | global cvx___ 3 | y = cellfun( @cvx_value, x, 'UniformOutput', false ); 4 | 5 | % Copyright 2005-2016 CVX Research, Inc. 6 | % See the file LICENSE.txt for full copyright information. 7 | % The command 'cvx_where' will show where this file is located. 8 | -------------------------------------------------------------------------------- /lib/@cvx/bcompress.m: -------------------------------------------------------------------------------- 1 | function [ xR, x, sx ] = bcompress( x, mode, nsrt ) 2 | narginchk(1,3); 3 | 4 | if nargin < 2 || isempty( mode ), 5 | mode = 'full'; 6 | elseif ~ischar( mode ) || size( mode, 1 ) ~= 1, 7 | error( 'Second argument must be a string.' ); 8 | end 9 | 10 | if nargin < 3 || isempty( nsrt ), 11 | nsrt = 0; 12 | elseif ~cvx_check_dimension( nsrt, true ), 13 | error( 'Third argument must be a nonnegative integer.' ); 14 | end 15 | 16 | sx = x.size_; 17 | xb = x.basis_; 18 | if nargout <= 1, 19 | xR = cvx_bcompress( xb, mode, nsrt ); 20 | else 21 | [ xR, xb ] = cvx_bcompress( xb, mode, nsrt ); 22 | x = cvx( size( xb, 2 ), xb ); 23 | end 24 | 25 | % Copyright 2005-2016 CVX Research, Inc. 26 | % See the file LICENSE.txt for full copyright information. 27 | % The command 'cvx_where' will show where this file is located. 28 | -------------------------------------------------------------------------------- /lib/@cvx/buncompress.m: -------------------------------------------------------------------------------- 1 | function x = buncompress( xR, x, sx ) 2 | narginchk(2,3); 3 | 4 | if ~isa( xR, 'double' ) && ~isa( xR, 'sparse' ), 5 | error( 'First argument must be a structure matrix.' ); 6 | elseif size( x.basis_, 2 ) ~= size( xR, 1 ), 7 | error( 'Structure matrix incompatible with vector.' ); 8 | elseif nargin < 3 || isempty( sx ), 9 | sx = size( xR, 2 ); 10 | elseif ~cvx_check_dimlist( sx, false ), 11 | error( 'Third argument must be a size matrix.' ); 12 | elseif prod( sx ) ~= isempty( xR ) * prod( x.size_ ) + ~isempty( xR ) * size( xR, 2 ), 13 | error( 'Incompatible size matrix.' ); 14 | end 15 | 16 | if isempty( xR ), 17 | x = cvx( sx, x.basis_ ); 18 | else 19 | x = cvx( sx, x.basis_ * xR ); 20 | end 21 | 22 | % Copyright 2005-2016 CVX Research, Inc. 23 | % See the file LICENSE.txt for full copyright information. 24 | % The command 'cvx_where' will show where this file is located. 25 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_basis.m: -------------------------------------------------------------------------------- 1 | function y = cvx_basis( x ) 2 | y = x.basis_; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_constant.m: -------------------------------------------------------------------------------- 1 | function y = cvx_constant( x ) 2 | y = cvx_reshape( x.basis_( 1, : ), x.size_ ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_getdual.m: -------------------------------------------------------------------------------- 1 | function z = cvx_getdual( x ) 2 | z = x.dual_; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_isaffine.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isaffine( x, full ) 2 | narginchk(1,2); 3 | y = cvx_vexity( x ); 4 | if nargin < 2, 5 | y = nnz( y ) == 0; 6 | else 7 | y = cvx_reshape( y == 0, x.size_ ); 8 | end 9 | 10 | % Copyright 2005-2016 CVX Research, Inc. 11 | % See the file LICENSE.txt for full copyright information. 12 | % The command 'cvx_where' will show where this file is located. 13 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_isconcave.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isconcave( x, full ) 2 | narginchk(1,2); 3 | y = cvx_vexity( x ); 4 | if nargin < 2, 5 | y = nnz( y > 0 ) == 0; 6 | else 7 | y = cvx_reshape( y <= 0, x.size_ ); 8 | end 9 | 10 | % Copyright 2005-2016 CVX Research, Inc. 11 | % See the file LICENSE.txt for full copyright information. 12 | % The command 'cvx_where' will show where this file is located. 13 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_isconstant.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isconstant( x, full ) 2 | narginchk(1,2); 3 | b = x.basis_; 4 | if size( b, 1 ) <= 1, 5 | y = true; 6 | if nargin == 2 && full, 7 | y = y( ones( 1, prod( x.size_ ) ) ); 8 | y = reshape( y, x.size_ ); 9 | end 10 | elseif nargin == 2 && full, 11 | bz = b ~= 0; 12 | y = cvx_reshape( sum( bz, 1 ) == bz( 1, : ), x.size_ ); 13 | else 14 | y = nnz( b ) == nnz( b( 1, : ) ); 15 | end 16 | 17 | % Copyright 2005-2016 CVX Research, Inc. 18 | % See the file LICENSE.txt for full copyright information. 19 | % The command 'cvx_where' will show where this file is located. 20 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_isconvex.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isconvex( x, full ) 2 | narginchk(1,2); 3 | y = cvx_vexity( x ); 4 | if nargin < 2, 5 | y = nnz( y < 0 ) == 0; 6 | else 7 | y = cvx_reshape( y >= 0, x.size_ ); 8 | end 9 | 10 | % Copyright 2005-2016 CVX Research, Inc. 11 | % See the file LICENSE.txt for full copyright information. 12 | % The command 'cvx_where' will show where this file is located. 13 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_isnonzero.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isnonzero( x, full ) 2 | narginchk(1,2); 3 | y = any( x.basis_, 1 ); 4 | if nargin < 2, 5 | y = all( y ); 6 | else 7 | y = cvx_reshape( y, x.size_ ); 8 | end 9 | 10 | % Copyright 2005-2016 CVX Research, Inc. 11 | % See the file LICENSE.txt for full copyright information. 12 | % The command 'cvx_where' will show where this file is located. 13 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_readlevel.m: -------------------------------------------------------------------------------- 1 | function y = cvx_readlevel( x ) 2 | 3 | global cvx___ 4 | s = size( x.basis_ ); 5 | [ r, c ] = find( x.basis_ ); 6 | y = max( sparse( r, c, cvx___.readonly( r ), s(1), s(2) ), [], 1 ); 7 | y = cvx_reshape( y, x.size_ ); 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_setdual.m: -------------------------------------------------------------------------------- 1 | function x = cvx_setdual( x, y ) 2 | x.dual_ = y; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvx/cvx_value.m: -------------------------------------------------------------------------------- 1 | function v = cvx_value( x ) 2 | v = value( x ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvx/in.m: -------------------------------------------------------------------------------- 1 | function a = in( x, y ) 2 | 3 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '==' ); 4 | if nargout, a = b; end 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/@cvx/keywords.m: -------------------------------------------------------------------------------- 1 | % CVX: Keywords for declaring variables and objectives 2 | % dual - Declares one or more dual variables. 3 | % epigraph - Declares an epigraph variable. 4 | % hypograph - Declares a hypograph variable. 5 | % maximize - Specifies a concave (or affine) objective to be maximized. 6 | % minimize - Specifies a convex (or affine) objective to be maximized. 7 | % subject - Implements the "subject to" keyword. 8 | % variable - Declares a single CVX variable with optional matrix structure. 9 | % variables - Declares one or more CVX variables. 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | -------------------------------------------------------------------------------- /lib/@cvx/matlab6.m: -------------------------------------------------------------------------------- 1 | %CVX: Matlab 6 compatability functions. 2 | % This directory contains definitions for 'true' and 'false'. These 3 | % functions are used extensively in CVX, and are built in for MATLAB 4 | % 6.5 and later. For MATLAB 6.1 we supply these surrogates. It is 5 | % *very* important, however, that this directory NOT be placed in 6 | % the MATLAB search path for older versions of MATLAB. 7 | 8 | % Copyright 2005-2016 CVX Research, Inc. 9 | % See the file LICENSE.txt for full copyright information. 10 | % The command 'cvx_where' will show where this file is located. 11 | -------------------------------------------------------------------------------- /lib/@cvx/svec.m: -------------------------------------------------------------------------------- 1 | function z = svec( x, nrm ) 2 | 3 | if nargin < 2 || isempty( nrm ) || isequal( nrm, 'fro' ), 4 | nrm = 2; 5 | elseif ~isnumeric( nrm ) || length( nrm ) ~= 1 || nrm < 1, 6 | error( 'Second argument must be a number between 1 and Inf, or ''fro''.' ); 7 | end 8 | 9 | if ~isreal( x ) && nrm ~= 2, 10 | z = vec( x ); 11 | return 12 | else 13 | [ xR, y ] = bcompress( x ); 14 | if isempty( y ), 15 | z = cvx( 0 ); 16 | else 17 | z = y .* norms( xR, nrm, 2 ); 18 | end 19 | end 20 | 21 | % Copyright 2005-2016 CVX Research, Inc. 22 | % See the file LICENSE.txt for full copyright information. 23 | % The command 'cvx_where' will show where this file is located. 24 | -------------------------------------------------------------------------------- /lib/@cvx/value.m: -------------------------------------------------------------------------------- 1 | function v = value( x, data ) 2 | global cvx___ 3 | if nargin == 1, 4 | data = cvx___.x; 5 | end 6 | nx = size( data, 1 ); 7 | nb = size( x.basis_, 1 ); 8 | if nx < nb, 9 | data( end + 1 : nb, : ) = NaN; 10 | elseif nx > nb, 11 | data( nb + 1 : end, : ) = []; 12 | end 13 | v = cvx_reshape( data.' * x.basis_, x.size_ ); 14 | if any( x.size_ == 1 ), v = full( v ); end 15 | 16 | % Copyright 2005-2016 CVX Research, Inc. 17 | % See the file LICENSE.txt for full copyright information. 18 | % The command 'cvx_where' will show where this file is located. 19 | -------------------------------------------------------------------------------- /lib/@cvxcnst/cvxcnst.m: -------------------------------------------------------------------------------- 1 | function v = cvxcnst( p, rhs ) 2 | v = class( struct( 'problem', p, 'rhs', rhs ), 'cvxcnst' ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxcnst/disp.m: -------------------------------------------------------------------------------- 1 | function disp( x ) 2 | disp( 'Constraint accepted' ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxcnst/display.m: -------------------------------------------------------------------------------- 1 | function display( x ) 2 | long = ~isequal(get(0,'FormatSpacing'),'compact'); 3 | if long, disp( ' ' ); end 4 | disp(x); 5 | if long, disp( ' ' ); end 6 | 7 | % Copyright 2005-2016 CVX Research, Inc. 8 | % See the file LICENSE.txt for full copyright information. 9 | % The command 'cvx_where' will show where this file is located. 10 | -------------------------------------------------------------------------------- /lib/@cvxcnst/double.m: -------------------------------------------------------------------------------- 1 | function x = double( v ) %#ok 2 | error( 'Disciplined convex programming error:\n Constraints may not appear in if/then statements.', 1 ); %#ok 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxcnst/logical.m: -------------------------------------------------------------------------------- 1 | function x = logical( v ) %#ok 2 | error( 'Disciplined convex programming error:\n Constraints may not appear in if/then statements.', 1 ); %#ok 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxcnst/rhs.m: -------------------------------------------------------------------------------- 1 | function x = rhs( y ) 2 | x = y.rhs; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxdual/colon.m: -------------------------------------------------------------------------------- 1 | function z = colon( x, y ) 2 | if ~isa( x, 'cvxdual' ), 3 | z = x; x = y; y = z; 4 | end 5 | global cvx___ 6 | try 7 | dvars = cvx___.problems( x.problem_ ).dvars; 8 | q = builtin( 'subsref', dvars, x.name_ ); 9 | catch 10 | error( 'CVX:Corrupt', 'Internal CVX data corruption. Please CLEAR ALL and rebuild your model.' ); 11 | end 12 | if q.attached_, 13 | nm = cvx_subs2str( x.name_ ); 14 | error( 'CVX:DualInUse', 'Dual variable "%s" has already been assigned.', nm(2:end) ); 15 | end 16 | q.attached_ = true; 17 | dvars = builtin( 'subsasgn', dvars, x.name_, q ); 18 | cvx___.problems( x.problem_ ).dvars = dvars; 19 | try 20 | z = cvx_setdual( y, x.name_ ); 21 | catch 22 | error( 'CVX:CannotAttachDual', 'Cannot attach a dual variable to an object of type %s.', class( y ) ); 23 | end 24 | 25 | % Copyright 2005-2016 CVX Research, Inc. 26 | % See the file LICENSE.txt for full copyright information. 27 | % The command 'cvx_where' will show where this file is located. 28 | -------------------------------------------------------------------------------- /lib/@cvxdual/cvx_basis.m: -------------------------------------------------------------------------------- 1 | function ans = cvx_basis( x, varargin ) 2 | ans = cvx_basis( cvxaff( x ), varargin{:} ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxdual/cvx_value.m: -------------------------------------------------------------------------------- 1 | function v = cvx_value( x ) 2 | v = value( x ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxdual/cvxaff.m: -------------------------------------------------------------------------------- 1 | function y = cvxaff( x ) 2 | global cvx___ 3 | y = subsref( cvx___.problems( x.problem_ ).duals, x.name_ ); 4 | 5 | % Copyright 2005-2016 CVX Research, Inc. 6 | % See the file LICENSE.txt for full copyright information. 7 | % The command 'cvx_where' will show where this file is located. 8 | -------------------------------------------------------------------------------- /lib/@cvxdual/cvxdual.m: -------------------------------------------------------------------------------- 1 | function y = cvxdual( prob, name ) 2 | 3 | y = class( struct( 'problem_', prob, 'name_', name, 'attached_', false ), 'cvxdual', cvxobj ); 4 | 5 | % Copyright 2005-2016 CVX Research, Inc. 6 | % See the file LICENSE.txt for full copyright information. 7 | % The command 'cvx_where' will show where this file is located. 8 | -------------------------------------------------------------------------------- /lib/@cvxdual/disp.m: -------------------------------------------------------------------------------- 1 | function disp( x, prefix, iname ) 2 | if nargin < 2, prefix = ''; end 3 | if nargin < 3, iname = ''; end 4 | nm = cvx_subs2str( x.name_ ); 5 | nm = nm(2:end); 6 | if ~isequal( nm, iname ), 7 | disp( [ prefix, 'cvx dual variable ', nm, ' (', type( x ), ')' ] ); 8 | else 9 | disp( [ prefix, 'cvx dual variable (', type( x ), ')' ] ); 10 | end 11 | 12 | % Copyright 2005-2016 CVX Research, Inc. 13 | % See the file LICENSE.txt for full copyright information. 14 | % The command 'cvx_where' will show where this file is located. 15 | -------------------------------------------------------------------------------- /lib/@cvxdual/display.m: -------------------------------------------------------------------------------- 1 | function display( x ) 2 | nm = inputname(1); 3 | long = ~isequal(get(0,'FormatSpacing'),'compact'); 4 | if long, disp( ' ' ); end 5 | disp([nm ' =']); 6 | if long, disp( ' ' ); end 7 | disp(x,' ',nm); 8 | if long, disp( ' ' ); end 9 | 10 | % Copyright 2005-2016 CVX Research, Inc. 11 | % See the file LICENSE.txt for full copyright information. 12 | % The command 'cvx_where' will show where this file is located. 13 | -------------------------------------------------------------------------------- /lib/@cvxdual/dof.m: -------------------------------------------------------------------------------- 1 | function y = dof( x ) 2 | y = size( cvx_basis( cvxaff( x ) ), 2 ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxdual/inuse.m: -------------------------------------------------------------------------------- 1 | function y = inuse( x ) 2 | y = ~isempty( x ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxdual/isreal.m: -------------------------------------------------------------------------------- 1 | function y = isreal( x ) 2 | y = isreal( cvxaff( x ) ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxdual/name.m: -------------------------------------------------------------------------------- 1 | function y = name( x ) 2 | y = x.name_; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxdual/problem.m: -------------------------------------------------------------------------------- 1 | function p = problem( x ) 2 | p = x.problem_; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxdual/size.m: -------------------------------------------------------------------------------- 1 | function y = size( x, varargin ) 2 | y = size( cvxaff( x ), varargin{:} ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxdual/subsref.m: -------------------------------------------------------------------------------- 1 | function x = subsref( x, S ) 2 | error( 'Cannot use subscripting on dual variables.' ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxdual/value.m: -------------------------------------------------------------------------------- 1 | function v = value( x ) 2 | global cvx___ 3 | v = cvxaff( x ); 4 | switch class( v ), 5 | case 'cvx', 6 | v = value( v, cvx___.y ); 7 | case 'cell', 8 | for k = 1 : numel( v ), 9 | v{k} = value( v{k}, cvx___.y ); 10 | end 11 | end 12 | 13 | % Copyright 2005-2016 CVX Research, Inc. 14 | % See the file LICENSE.txt for full copyright information. 15 | % The command 'cvx_where' will show where this file is located. 16 | -------------------------------------------------------------------------------- /lib/@cvxin/cvxin.m: -------------------------------------------------------------------------------- 1 | function v = cvxin 2 | superiorto('cell','struct','cvx','cvxtuple'); 3 | v = class( struct( 'active', false, 'value', [] ), 'cvxin' ); 4 | 5 | % Copyright 2005-2016 CVX Research, Inc. 6 | % See the file LICENSE.txt for full copyright information. 7 | % The command 'cvx_where' will show where this file is located. 8 | -------------------------------------------------------------------------------- /lib/@cvxin/cvxtuple.m: -------------------------------------------------------------------------------- 1 | function v = cvxtuple( varargin ) 2 | 3 | if nargin == 1, 4 | v = varargin{1}; 5 | switch class( v ), 6 | case 'struct', 7 | if numel( v ) ~= 1, 8 | error( 'struct arrays not permitted in cvx tuple objects.' ); 9 | end 10 | case 'cell', 11 | v = reshape( v, 1, numel( v ) ); 12 | otherwise, 13 | return 14 | end 15 | else 16 | v = varargin; 17 | end 18 | 19 | v = class( struct( 'value_', { v } ), 'cvxtuple', cvxobj ); 20 | 21 | % Copyright 2005-2016 CVX Research, Inc. 22 | % See the file LICENSE.txt for full copyright information. 23 | % The command 'cvx_where' will show where this file is located. 24 | -------------------------------------------------------------------------------- /lib/@cvxin/gt.m: -------------------------------------------------------------------------------- 1 | function a = gt( x, y ) 2 | 3 | if isa(y,'cvxin')||~isa(x,'cvxin')||~x.active, 4 | error( 'CVX error: improper use of the pseudo-operator.' ); 5 | end 6 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x.value, y, '==' ); 7 | if nargout, a = b; end 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/@cvxin/lt.m: -------------------------------------------------------------------------------- 1 | function y = lt( x, y ) 2 | 3 | if isa(x,'cvxin')||~isa(y,'cvxin')||y.active, 4 | error( 'CVX error: improper use of the pseudo-operator.' ); 5 | end 6 | y.active = true; 7 | y.value = x; 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/@cvxobj/cvx_id.m: -------------------------------------------------------------------------------- 1 | function y = cvx_id( x ) 2 | y = x.id_; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxobj/cvxobj.m: -------------------------------------------------------------------------------- 1 | function y = cvxobj() 2 | global cvx___ 3 | if isempty( cvx___ ), 4 | error( 'Internal cvx data corruption' ); 5 | end 6 | cvx___.id = cvx___.id + 1; 7 | y = class( struct( 'id_', cvx___.id ), 'cvxobj' ); 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/@cvxobj/disp.m: -------------------------------------------------------------------------------- 1 | function disp( x, prefix ) %#ok 2 | if nargin < 2, prefix = ''; end 3 | disp( [ prefix, 'cvx base object' ] ); 4 | 5 | % Copyright 2005-2016 CVX Research, Inc. 6 | % See the file LICENSE.txt for full copyright information. 7 | % The command 'cvx_where' will show where this file is located. 8 | -------------------------------------------------------------------------------- /lib/@cvxobj/display.m: -------------------------------------------------------------------------------- 1 | function display( x ) 2 | long = ~isequal(get(0,'FormatSpacing'),'compact'); 3 | if long, disp( ' ' ); end 4 | disp([inputname(1) ' =']); 5 | if long, disp( ' ' ); end 6 | disp(x,' ') 7 | if long, disp( ' ' ); end 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/@cvxobj/isempty.m: -------------------------------------------------------------------------------- 1 | function y = isempty( x ) 2 | y = any( size( x ) == 0 ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxobj/isequal.m: -------------------------------------------------------------------------------- 1 | function z = isequal( x, y ) 2 | z = x.id_ == y.id_; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxobj/length.m: -------------------------------------------------------------------------------- 1 | function n = length( x ) 2 | s = size( x ); 3 | if any( s == 0 ), 4 | n = 0; 5 | else 6 | n = max( s ); 7 | end 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/@cvxobj/ndims.m: -------------------------------------------------------------------------------- 1 | function n = ndims( x ) 2 | n = length( size( x ) ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxobj/numel.m: -------------------------------------------------------------------------------- 1 | function n = numel( x, varargin ) 2 | n = prod( size( x ) ); %#ok 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxobj/subsasgn.m: -------------------------------------------------------------------------------- 1 | function x = subsasgn( x, S, y ) 2 | error( 'Subscripted assignment not allowed for these objects.' ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxobj/subsref.m: -------------------------------------------------------------------------------- 1 | function x = subsref( x, S, cheat ) 2 | error( 'Subscripts not allowed for this object.' ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxprob/cvx_value.m: -------------------------------------------------------------------------------- 1 | function v = cvx_value( x ) 2 | warning( 'CVX:IllegalUse', ... 3 | 'CVX error: illegal use of a cvx problem object has been detected.\n Please do not copy or manipulate the value of ''cvx_problem'' in any way.', 1 ); %#ok 4 | v = []; 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/@cvxprob/eq.m: -------------------------------------------------------------------------------- 1 | function z = eq( x, y ) 2 | if ~isa( x, class( y ) ) 3 | error( 'cvxprob objects may only be compared to each other.' ); 4 | else 5 | z = cvx_id( x ) == cvx_id( y ); 6 | end 7 | 8 | % Copyright 2005-2016 CVX Research, Inc. 9 | % See the file LICENSE.txt for full copyright information. 10 | % The command 'cvx_where' will show where this file is located. 11 | -------------------------------------------------------------------------------- /lib/@cvxprob/index.m: -------------------------------------------------------------------------------- 1 | function y = index( x ) 2 | y = x.index_; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxprob/ne.m: -------------------------------------------------------------------------------- 1 | function z = ne( x, y ) 2 | z = ~eq( x, y ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxprob/newtemp.m: -------------------------------------------------------------------------------- 1 | function z = newtemp( prob, siz ) 2 | 3 | % NEWTEMP Creates a temporary variable. 4 | 5 | global cvx___ 6 | vstr = cvx___.problems( prob.index_ ).variables; 7 | if isfield( vstr, 'temp_' ), 8 | ndx = length( vstr.temp_ ); 9 | else 10 | ndx = 0; 11 | end 12 | base = struct( 'type', { '.', '{}' }, 'subs', { 'temp_', { ndx + 1 } } ); 13 | z = newvar( prob, base, siz ); 14 | 15 | % Copyright 2005-2016 CVX Research, Inc. 16 | % See the file LICENSE.txt for full copyright information. 17 | % The command 'cvx_where' will show where this file is located. 18 | -------------------------------------------------------------------------------- /lib/@cvxprob/spy.m: -------------------------------------------------------------------------------- 1 | function spy( prob, reduce ) 2 | if nargin < 2 || ~reduce, 3 | A = extract( prob ); 4 | else 5 | A = eliminate( prob ); 6 | end 7 | spy( A' ); 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/@cvxprob/subsasgn.m: -------------------------------------------------------------------------------- 1 | function x = subsasgn( x, S, y ) 2 | error( 'Subscripted assignment not allowed for cvx problem objects.' ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxprob/subsref.m: -------------------------------------------------------------------------------- 1 | function y = subsref( x, S, cheat ) 2 | global cvx___ 3 | y = subsref( cvx___.problems( x.index_ ), S ); 4 | 5 | % Copyright 2005-2016 CVX Research, Inc. 6 | % See the file LICENSE.txt for full copyright information. 7 | % The command 'cvx_where' will show where this file is located. 8 | -------------------------------------------------------------------------------- /lib/@cvxprob/touch.m: -------------------------------------------------------------------------------- 1 | function x = touch( p, x, iseq ) 2 | global cvx___ 3 | if nargin < 3, iseq = false; end 4 | 5 | if isa( x, 'cvx' ), 6 | p = p.index_; 7 | b = cvx_basis( x ); 8 | y = any( b, 2 ); 9 | if iseq, 10 | cvx___.canslack( y ) = false; 11 | end 12 | v = cvx___.problems( p ).t_variable; 13 | nv = size( v, 1 ); 14 | ny = length( y ); 15 | if ny < nv, 16 | y( nv, : ) = 0; 17 | elseif nv < ny, 18 | y = y( 1 : nv, : ); 19 | end 20 | cvx___.problems( p ).t_variable = v | y; 21 | end 22 | 23 | % Copyright 2005-2016 CVX Research, Inc. 24 | % See the file LICENSE.txt for full copyright information. 25 | % The command 'cvx_where' will show where this file is located. 26 | -------------------------------------------------------------------------------- /lib/@cvxtuple/apply.m: -------------------------------------------------------------------------------- 1 | function y = apply( func, x ) 2 | y = do_apply( func, x.value_ ); 3 | 4 | function y = do_apply( func, x ) 5 | switch class( x ), 6 | case 'struct', 7 | y = cell2struct( do_apply( func, struct2cell( x ) ), fieldnames( x ), 1 ); 8 | case 'cell', 9 | y = cellfun( func, x, 'UniformOutput', false ); 10 | otherwise, 11 | y = feval( func, x ); 12 | end 13 | 14 | % Copyright 2005-2016 CVX Research, Inc. 15 | % See the file LICENSE.txt for full copyright information. 16 | % The command 'cvx_where' will show where this file is located. 17 | -------------------------------------------------------------------------------- /lib/@cvxtuple/cvx_collapse.m: -------------------------------------------------------------------------------- 1 | function x = cvx_collapse( x, keeptemp, tocell ) 2 | x = cvx_collapse( x.value_, keeptemp, tocell ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxtuple/cvx_constant.m: -------------------------------------------------------------------------------- 1 | function y = cvx_constant( x ) 2 | y = apply( @cvx_constant, x ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxtuple/cvx_getdual.m: -------------------------------------------------------------------------------- 1 | function x = cvx_getdual( x ) 2 | x = x.dual_; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxtuple/cvx_id.m: -------------------------------------------------------------------------------- 1 | function y = cvx_id( x ) 2 | y = apply( @cvx_id, x ); 3 | switch class( y ), 4 | case 'struct', 5 | y = struct2cell( y ); 6 | y = max( [ -Inf, y{:} ] ); 7 | case 'cell', 8 | y = max( [ -Inf, y{:} ] ); 9 | end 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | 15 | 16 | -------------------------------------------------------------------------------- /lib/@cvxtuple/cvx_isaffine.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isaffine( x ) 2 | y = testall( @cvx_isaffine, x ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxtuple/cvx_isconcave.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isconcave( x ) 2 | y = testall( @cvx_isconcave, x ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxtuple/cvx_isconstant.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isconstant( x ) 2 | y = testall( @cvx_isconstant, x ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxtuple/cvx_isconvex.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isconvex( x ) 2 | y = testall( @cvx_isconvex, x ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxtuple/cvx_value.m: -------------------------------------------------------------------------------- 1 | function y = cvx_value( x ) 2 | y = apply( @cvx_value, x ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxtuple/cvxtuple.m: -------------------------------------------------------------------------------- 1 | function v = cvxtuple( varargin ) 2 | 3 | if nargin == 1, 4 | v = varargin{1}; 5 | switch class( v ), 6 | case 'struct', 7 | if numel( v ) ~= 1, 8 | error( 'struct arrays not permitted in cvx tuple objects.' ); 9 | end 10 | case 'cell', 11 | v = reshape( v, 1, numel( v ) ); 12 | otherwise, 13 | return 14 | end 15 | else 16 | v = varargin; 17 | end 18 | 19 | v = class( struct( 'value_', { v }, 'dual_', { [] } ), 'cvxtuple', cvxobj ); 20 | 21 | % Copyright 2005-2016 CVX Research, Inc. 22 | % See the file LICENSE.txt for full copyright information. 23 | % The command 'cvx_where' will show where this file is located. 24 | -------------------------------------------------------------------------------- /lib/@cvxtuple/eq.m: -------------------------------------------------------------------------------- 1 | function a = eq( x, y ) 2 | 3 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '==' ); 4 | if nargout, a = b; end 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/@cvxtuple/ge.m: -------------------------------------------------------------------------------- 1 | function a = ge( x, y ) 2 | 3 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '>=' ); 4 | if nargout, a = b; end 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/@cvxtuple/gt.m: -------------------------------------------------------------------------------- 1 | function a = gt( x, y ) 2 | 3 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '>' ); 4 | if nargout, a = b; end 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/@cvxtuple/in.m: -------------------------------------------------------------------------------- 1 | function a = in( x, y ) 2 | 3 | narginchk(2,2); 4 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '==' ); 5 | if nargout, a = b; end 6 | 7 | % Copyright 2005-2016 CVX Research, Inc. 8 | % See the file LICENSE.txt for full copyright information. 9 | % The command 'cvx_where' will show where this file is located. 10 | -------------------------------------------------------------------------------- /lib/@cvxtuple/le.m: -------------------------------------------------------------------------------- 1 | function a = le( x, y ) 2 | 3 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '<=' ); 4 | if nargout, a = b; end 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/@cvxtuple/lt.m: -------------------------------------------------------------------------------- 1 | function a = lt( x, y ) 2 | 3 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '<' ); 4 | if nargout, a = b; end 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/@cvxtuple/ne.m: -------------------------------------------------------------------------------- 1 | function a = ne( x, y ) 2 | 3 | b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '~=' ); 4 | if nargout, a = b; end 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/@cvxtuple/numel.m: -------------------------------------------------------------------------------- 1 | function n = numel( x, varargin ) 2 | n = numel( x.value_, varargin{:} ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxtuple/subsasgn.m: -------------------------------------------------------------------------------- 1 | function y = subsasgn( x, varargin ) %#ok 2 | error( 'cvx tuple objects are read-only.' ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/@cvxtuple/subsref.m: -------------------------------------------------------------------------------- 1 | function y = subsref( x, varargin ) 2 | y = cvxtuple( subsref( x.value_, varargin{:} ) ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | 8 | -------------------------------------------------------------------------------- /lib/@cvxtuple/testall.m: -------------------------------------------------------------------------------- 1 | function y = testall( func, x ) 2 | y = do_test( func, x.value_ ); 3 | 4 | function y = do_test( func, x ) 5 | switch class( x ), 6 | case 'struct', 7 | y = do_test( func, struct2cell( x ) ); 8 | case 'cell', 9 | y = all( cellfun( func, x ) ); 10 | otherwise, 11 | y = feval( func, x ); 12 | end 13 | 14 | % Copyright 2005-2016 CVX Research, Inc. 15 | % See the file LICENSE.txt for full copyright information. 16 | % The command 'cvx_where' will show where this file is located. 17 | -------------------------------------------------------------------------------- /lib/Contents.m: -------------------------------------------------------------------------------- 1 | % CVX: Internal functions and scripts. 2 | % This directory contains code that is meant for internal use by 3 | % the CVX system itself. Documentation of the functions in this 4 | % directory is more sparse and not intended for end users. 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/cvx_accept_concave.m: -------------------------------------------------------------------------------- 1 | function x = cvx_accept_concave( x ) 2 | global cvx___ 3 | if isa( x, 'cvx' ), 4 | t = cvx_vexity( x ) < 0; 5 | if any( t( : ) ), 6 | prob = cvx___.problems(end).self; 7 | if all( t ), 8 | src = x; 9 | dst = newtemp( prob, size( src ) ); 10 | x = dst; 11 | else 12 | src = x( t ); 13 | dst = newtemp( prob, size( src ) ); 14 | x( t ) = dst; 15 | end 16 | newcnstr( prob, src(:), dst(:), '>=' ); 17 | end 18 | end 19 | 20 | % Copyright 2005-2016 CVX Research, Inc. 21 | % See the file LICENSE.txt for full copyright information. 22 | % The command 'cvx_where' will show where this file is located. 23 | -------------------------------------------------------------------------------- /lib/cvx_accept_convex.m: -------------------------------------------------------------------------------- 1 | function x = cvx_accept_convex( x ) 2 | global cvx___ 3 | if isa( x, 'cvx' ), 4 | t = cvx_vexity( x ) > 0; 5 | if any( t( : ) ), 6 | prob = cvx___.problems(end).self; 7 | if all( t ), 8 | src = x; 9 | dst = newtemp( prob, size( src ) ); 10 | x = dst; 11 | else 12 | src = x( t ); 13 | dst = newtemp( prob, size( src ) ); 14 | x( t ) = dst; 15 | end 16 | newcnstr( prob, src(:), dst(:), '<=' ); 17 | end 18 | end 19 | 20 | % Copyright 2005-2016 CVX Research, Inc. 21 | % See the file LICENSE.txt for full copyright information. 22 | % The command 'cvx_where' will show where this file is located. 23 | -------------------------------------------------------------------------------- /lib/cvx_basis.m: -------------------------------------------------------------------------------- 1 | function y = cvx_basis( x ) 2 | 3 | if isempty( x ) 4 | y = sparse( 1, 0 ); 5 | else 6 | y = sparse( reshape( x, 1, numel( x ) ) ); 7 | end 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/cvx_blkdiag.m: -------------------------------------------------------------------------------- 1 | function y = cvx_blkdiag( varargin ) 2 | 3 | % A reimplemenetation of MATLAB's blkdiag function, which is broken in 4 | % certain versions of MATLAB. 5 | 6 | if nargin == 1, 7 | y = varargin{1}; 8 | else 9 | isYsparse = false; 10 | for k = 1 : nargin, 11 | x = varargin{k}; 12 | [ p2(k+1), m2(k+1) ] = size(x); %#ok 13 | if issparse(x), isYsparse = true; end 14 | end 15 | p1 = cumsum(p2); 16 | m1 = cumsum(m2); 17 | if isYsparse 18 | y = sparse( varargin{1} ); 19 | for k = 2 : nargin, 20 | y = [y sparse(p1(k),m2(k+1)); sparse(p2(k+1),m1(k)) varargin{k}]; %#ok 21 | end 22 | else 23 | y = zeros(p1(end),m1(end)); 24 | for k=1:nargin 25 | y(p1(k)+1:p1(k+1),m1(k)+1:m1(k+1)) = varargin{k}; 26 | end 27 | end 28 | end 29 | 30 | % Copyright 2005-2016 CVX Research, Inc. 31 | % See the file LICENSE.txt for full copyright information. 32 | % The command 'cvx_where' will show where this file is located. 33 | -------------------------------------------------------------------------------- /lib/cvx_check_dimension.m: -------------------------------------------------------------------------------- 1 | function y = cvx_check_dimension( x, zero_ok ) 2 | 3 | %CVX_CHECK_DIMENSION Verifies that the input is valid dimension. 4 | % CVX_CHECK_DIMENSION( DIM ) verifies that the quantity DIM is valid for use 5 | % in commands that call for a dimension; e.g., SUM( X, DIM ). In other words, 6 | % it verifies that DIM is a positive integer scalar. 7 | % 8 | % CVX_CHECK_DIMENSION( DIM, ZERO_OK ) allows DIM to be zero if ZERO_OK is 9 | % true. If ZERO_OK is false, the default behavior is used. 10 | 11 | if isnumeric( x ) && length( x ) == 1 && isreal( x ) && x < Inf && x == floor( x ), 12 | if nargin < 2, zero_ok = false; end 13 | y = x > 0 | zero_ok; 14 | else 15 | y = 0; 16 | end 17 | 18 | % Copyright 2005-2016 CVX Research, Inc. 19 | % See the file LICENSE.txt for full copyright information. 20 | % The command 'cvx_where' will show where this file is located. 21 | -------------------------------------------------------------------------------- /lib/cvx_classify.m: -------------------------------------------------------------------------------- 1 | function v = cvx_classify( x ) 2 | 3 | % Classifications: 4 | % 1 - negative constant 5 | % 2 - zero 6 | % 3 - positive constant 7 | % 4 - complex constant 8 | % 5 - concave 9 | % 6 - real affine 10 | % 7 - convex 11 | % 8 - complex affine 12 | % 9 - log concave 13 | % 10 - log affine 14 | % 11 - log convex monomial 15 | % 12 - log convex posynomial 16 | % 13 - invalid 17 | 18 | v = full( sign( real( x ) ) ) + 2; 19 | if ~isreal( x ), 20 | v( imag( x ) ~= 0 ) = 4; 21 | end 22 | v( ~isfinite( x ) ) = 13; 23 | v = reshape( v, 1, numel( x ) ); 24 | 25 | % Copyright 2005-2016 CVX Research, Inc. 26 | % See the file LICENSE.txt for full copyright information. 27 | % The command 'cvx_where' will show where this file is located. 28 | -------------------------------------------------------------------------------- /lib/cvx_clearpath.m: -------------------------------------------------------------------------------- 1 | function cvx_clearpath( arg ) %#ok 2 | 3 | %CVX_CLEARPATH Clears the cvx path. 4 | % CVX_CLEARPATH removes the internal cvx directories from Matlab's path. CVX 5 | % does this automatically when a model is completed (i.e., after CVX_END), in 6 | % order to reduce potential naming conflicts with other packages. There is no 7 | % need to call this function during the normal use of CVX. 8 | 9 | global cvx___ 10 | cvx_global 11 | if nargin == 0, 12 | cvx___.path.hold = false; 13 | end 14 | if cvx___.path.hold, 15 | cvx_setspath; 16 | else 17 | cvx_clearspath; 18 | if ~isempty( cvx___.path.string ), 19 | path(strrep(path,cvx___.path.string,'')); 20 | end 21 | cvx___.path.active = false; 22 | end 23 | 24 | % Copyright 2005-2016 CVX Research, Inc. 25 | % See the file LICENSE.txt for full copyright information. 26 | % The command 'cvx_where' will show where this file is located. 27 | -------------------------------------------------------------------------------- /lib/cvx_clearspath.m: -------------------------------------------------------------------------------- 1 | function cvx_clearspath 2 | 3 | %CVX_CLEARSPATH Clears the cvx solver path. 4 | % CVX_CLEARSPATH removes the internal solver directories to the Matlab 5 | % path. CVX automatically clears the solver path after completion of a 6 | % model computation, so calling this function should not be necessary. 7 | % Nevertheless, we provide it for completeness and debugging. 8 | 9 | global cvx___ 10 | osolv = cvx___.solvers.active; 11 | if osolv, 12 | tstr = cvx___.solvers.list(osolv).path; 13 | if ~isempty( tstr ), 14 | path(strrep(path,tstr,'')); 15 | end 16 | cvx___.solvers.active = 0; 17 | end 18 | 19 | % Copyright 2005-2016 CVX Research, Inc. 20 | % See the file LICENSE.txt for full copyright information. 21 | % The command 'cvx_where' will show where this file is located. 22 | -------------------------------------------------------------------------------- /lib/cvx_constant.m: -------------------------------------------------------------------------------- 1 | function y = cvx_constant( x ) 2 | narginchk(1,1); 3 | y = x; 4 | 5 | % Copyright 2005-2016 CVX Research, Inc. 6 | % See the file LICENSE.txt for full copyright information. 7 | % The command 'cvx_where' will show where this file is located. 8 | -------------------------------------------------------------------------------- /lib/cvx_default_dimension.m: -------------------------------------------------------------------------------- 1 | function y = cvx_default_dimension( sx ) 2 | 3 | %CVX_DEFAULT_DIMENSION Default dimension for SUM, MAX, etc. 4 | % DIM = CVX_DEFAULT_DIMENSION( SX ), where SX is a size vector, returns the 5 | % first index DIM such that SX(DIM)>1, if one exists; otherwise, DIM=1. This 6 | % matches the behavior by functions like SUM, MAX, ANY, ALL, etc. in 7 | % selecting the dimension over which to operate if DIM is not supplied. 8 | % 9 | % For example, suppose size(X) = [1,3,4]; then SUM(X) would sum over dimension 10 | % 2; and DIM=CVX_DEFAULT_DIMENSION([1,3,4]) returns DIM=2. 11 | % 12 | % This is an internal CVX function, and as such no checking is performed to 13 | % insure that the arguments are valid. 14 | 15 | y = find( sx ~= 1 ); 16 | if isempty( y ), 17 | y = 1; 18 | else 19 | y = y( 1 ); 20 | end 21 | 22 | % Copyright 2005-2016 CVX Research, Inc. 23 | % See the file LICENSE.txt for full copyright information. 24 | % The command 'cvx_where' will show where this file is located. 25 | -------------------------------------------------------------------------------- /lib/cvx_expand_dim.m: -------------------------------------------------------------------------------- 1 | function zx = cvx_expand_dim( z, dim, nx ) 2 | 3 | %CVX_EXPAND_DIM Expands an N-D array along a specified dimension. 4 | % CVX_EXPAND_DIM( X, DIM, NX ) stacks NX copies of the matrix X along the 5 | % dimension NX. It is equivalent to CAT( DIM, X, X, ..., X ), where X is 6 | % repeated NX times. 7 | % 8 | % This is an internal CVX function, and as such no checking is performed to 9 | % insure that the arguments are valid. 10 | 11 | zdims = cell( 1, max( ndims(z), dim ) ); 12 | [ zdims{:} ] = deal( ':' ); 13 | zdims{dim} = ones( 1, nx ); 14 | zx = z( zdims{:} ); 15 | 16 | % Copyright 2005-2016 CVX Research, Inc. 17 | % See the file LICENSE.txt for full copyright information. 18 | % The command 'cvx_where' will show where this file is located. 19 | 20 | -------------------------------------------------------------------------------- /lib/cvx_getdual.m: -------------------------------------------------------------------------------- 1 | function y = cvx_getdual( x ) 2 | y = []; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/cvx_id.m: -------------------------------------------------------------------------------- 1 | function y = cvx_id( x ) %#ok 2 | y = -Inf; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/cvx_ids.m: -------------------------------------------------------------------------------- 1 | function y = cvx_ids( varargin ) 2 | y = cellfun( @cvx_id, varargin ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/cvx_isaffine.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isaffine( x, full ) %#ok 2 | narginchk(1,2); 3 | if nargin == 1, 4 | y = true; 5 | else 6 | y = true( size( x ) ); 7 | end 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/cvx_isconcave.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isconcave( x, full ) %#ok 2 | narginchk(1,2); 3 | if nargin == 2, 4 | y = ~imag( x ); 5 | elseif isreal( x ), 6 | y = true; 7 | else 8 | y = nnz(imag(x)) == 0; 9 | end 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | -------------------------------------------------------------------------------- /lib/cvx_isconstant.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isconstant( x, full ) %#ok 2 | narginchk(1,2); 3 | if nargin == 1, 4 | y = true; 5 | else 6 | y = true( size( x ) ); 7 | end 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/cvx_isconvex.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isconvex( x, full ) %#ok 2 | narginchk(1,2); 3 | if nargin == 2, 4 | y = ~imag( x ); 5 | elseif isreal( x ), 6 | y = true; 7 | else 8 | y = nnz(imag(x)) == 0; 9 | end 10 | 11 | % Copyright 2005-2016 CVX Research, Inc. 12 | % See the file LICENSE.txt for full copyright information. 13 | % The command 'cvx_where' will show where this file is located. 14 | -------------------------------------------------------------------------------- /lib/cvx_isnonzero.m: -------------------------------------------------------------------------------- 1 | function y = cvx_isnonzero( x, full ) %#ok 2 | narginchk(1,2); 3 | if nargin == 1, 4 | y = nnz( x ) ~= 0; 5 | else 6 | y = x ~= 0; 7 | end 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/cvx_readlevel.m: -------------------------------------------------------------------------------- 1 | function y = cvx_readlevel( x ) 2 | if ndims( x ) <= 2, 3 | y = sparse( size( x, 1 ), size( x, 2 ) ); 4 | else 5 | y = zeros( size( x ) ); 6 | end 7 | 8 | % Copyright 2005-2016 CVX Research, Inc. 9 | % See the file LICENSE.txt for full copyright information. 10 | % The command 'cvx_where' will show where this file is located. 11 | -------------------------------------------------------------------------------- /lib/cvx_setdual.m: -------------------------------------------------------------------------------- 1 | function x = cvx_setdual( x, y ) 2 | x = cvx_setdual( cvx( x ), y ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/cvx_setpath.m: -------------------------------------------------------------------------------- 1 | function cvx_setpath( arg ) %#ok 2 | 3 | %CVX_SETPATH Sets the cvx path. 4 | % CVX_SETPATH adds the internal cvx directories to Matlab's path so that the 5 | % CVX system can find the functions that they contain. There is no reason to 6 | % call this function during normal use of CVX; it is done automatically as 7 | % needed. However, if you are debugging CVX, calling this function can help to 8 | % insure that breakpoints stay valid. 9 | 10 | % Set the hold flag 11 | global cvx___ 12 | cvx_global 13 | if ~cvx___.path.active, 14 | s = warning('off'); %#ok 15 | path([cvx___.path.string,path]); 16 | warning(s); 17 | cvx___.path.active = true; 18 | end 19 | if nargin == 0, 20 | cvx___.path.hold = true; 21 | end 22 | if cvx___.path.hold, 23 | cvx_setspath; 24 | end 25 | 26 | % Copyright 2005-2016 CVX Research, Inc. 27 | % See the file LICENSE.txt for full copyright information. 28 | % The command 'cvx_where' will show where this file is located. 29 | -------------------------------------------------------------------------------- /lib/cvx_size_check.m: -------------------------------------------------------------------------------- 1 | function sz = cvx_size_check( varargin ) 2 | 3 | %CVX_SIZE_CHECK Verifies size compatability. 4 | % SZ = CVX_SIZE_CHECK( ARG1, ..., ARGN ) verifies that the arguments are 5 | % compatible in size in the same sense as required by the + operator. 6 | % That is, any arguments that are not scalars must be of the same size. 7 | % No type checking is performed. The output SZ is the size encountered 8 | % if the arguments are compatible, or an empty array if they are not. 9 | % In other words, ISEMPTY(SZ) is true if the arguments are incompatible. 10 | 11 | for k = 1 : nargin, 12 | sz = size( varargin{k} ); 13 | if any( sz ~= 1 ), 14 | break; 15 | end 16 | end 17 | for j = k+1 : nargin, 18 | sx = size(varargin{k}); 19 | if any( sx ~= 1 ) && any( sx ~= sz ), 20 | sz = []; 21 | break 22 | end 23 | end 24 | 25 | % Copyright 2005-2016 CVX Research, Inc. 26 | % See the file LICENSE.txt for full copyright information. 27 | % The command 'cvx_where' will show where this file is located. 28 | -------------------------------------------------------------------------------- /lib/cvx_subsasgn.m: -------------------------------------------------------------------------------- 1 | function y = cvx_subsasgn( y, varargin ) 2 | temp.type = '()'; 3 | temp.subs = varargin(1:end-1); 4 | y = subsasgn( y, temp, varargin{end} ); 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/cvx_subsref.m: -------------------------------------------------------------------------------- 1 | function y = cvx_subsref( x, varargin ) 2 | temp.type = '()'; 3 | temp.subs = varargin; 4 | y = subsref( x, temp ); 5 | 6 | % Copyright 2005-2016 CVX Research, Inc. 7 | % See the file LICENSE.txt for full copyright information. 8 | % The command 'cvx_where' will show where this file is located. 9 | -------------------------------------------------------------------------------- /lib/cvx_subsref_check.m: -------------------------------------------------------------------------------- 1 | function s = cvx_subsref_check( nin, nin_norm, S ) 2 | 3 | if nin < nin_norm, 4 | s = 'Not enough input arguments'; 5 | elseif nin == nin_norm, 6 | if ~isa( S, 'struct' ), 7 | s = 'Subscript argument to SUBSREF and SUBSASGN must be a structure.'; 8 | else 9 | Sf = fieldnames( S ); 10 | if length( Sf ) ~= 2, 11 | s = 'Subscript argument to SUBSREF and SUBSASGN must have two fields.'; 12 | elseif ~isempty( setdiff( { 'type', 'subs' }, Sf ) ), 13 | s = 'Subscript argument to SUBSREF and SUBSASGN must have two fields whose names are "type" and "subs".'; 14 | elseif isempty( S ), 15 | s = 'Subscript argument to SUBSREF and SUBSASGN must not be empty.'; 16 | else 17 | s = ''; 18 | end 19 | end 20 | else 21 | s = ''; 22 | end 23 | 24 | % Copyright 2005-2016 CVX Research, Inc. 25 | % See the file LICENSE.txt for full copyright information. 26 | % The command 'cvx_where' will show where this file is located. 27 | -------------------------------------------------------------------------------- /lib/cvx_value.m: -------------------------------------------------------------------------------- 1 | function v = cvx_value( x ) 2 | v = x; 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/cvx_values.m: -------------------------------------------------------------------------------- 1 | function varargout = cvx_values( varargin ) 2 | varargout = cvx_value( varargin ); 3 | 4 | % Copyright 2005-2016 CVX Research, Inc. 5 | % See the file LICENSE.txt for full copyright information. 6 | % The command 'cvx_where' will show where this file is located. 7 | -------------------------------------------------------------------------------- /lib/cvx_vexity.m: -------------------------------------------------------------------------------- 1 | function y = cvx_vexity( x ) 2 | sx = size( x ); 3 | if cvx_use_sparse( sx, 0, true ) 4 | y = sparse( sx(1), sx(2) ); 5 | else 6 | y = zeros( sx ); 7 | end 8 | 9 | % Copyright 2005-2016 CVX Research, Inc. 10 | % See the file LICENSE.txt for full copyright information. 11 | % The command 'cvx_where' will show where this file is located. 12 | -------------------------------------------------------------------------------- /lib/cvx_zeros.m: -------------------------------------------------------------------------------- 1 | function x = cvx_zeros( s ) 2 | if cvx_use_sparse( s, 0, 1 ), 3 | x = sparse( s(1), s(2) ); 4 | else 5 | x = zeros( s ); 6 | end 7 | 8 | % Copyright 2005-2016 CVX Research, Inc. 9 | % See the file LICENSE.txt for full copyright information. 10 | % The command 'cvx_where' will show where this file is located. 11 | -------------------------------------------------------------------------------- /lib/narginchk_/narginchk.m: -------------------------------------------------------------------------------- 1 | function narginchk(imin, imax) 2 | narg = evalin('caller', 'nargin'); 3 | if narg < imin, 4 | me = {'MATLAB:narginchk:notEnoughInputs', 'Not enough input arguments.'}; 5 | elseif narg > imax, 6 | me = {'MATLAB:narginchk:tooManyInputs', 'Too many input arguments.'}; 7 | else 8 | return 9 | end 10 | throwAsCaller(MException(me{:})); 11 | 12 | -------------------------------------------------------------------------------- /solvers.txt: -------------------------------------------------------------------------------- 1 | # These are the URLs of the SDPT3 and SeDuMi bundles to include. 2 | # We have stopped using submodules because the MEX files are no 3 | # longer checked into Git; instead, they are built by CI processes 4 | https://github.com/sqlp/sedumi/releases/download/v1.3.8/sedumi.tgz 5 | https://github.com/sqlp/sdpt3/releases/download/4.0-20240410/sdpt3.tgz 6 | -------------------------------------------------------------------------------- /structures/cvx_replicate_structure.m: -------------------------------------------------------------------------------- 1 | function str = cvx_replicate_structure( str, sz ) 2 | %CVX_REPLICATE_STRUCTURE Apply matrix structure to N-D arrays. 3 | 4 | szs = size( str ); 5 | nmat = prod( sz ); 6 | omat = ones( 1, nmat ); 7 | [ r, c, v ] = find( str ); 8 | nelm = length( r ); 9 | oelm = ones( 1, nelm ); 10 | r = r( : ); 11 | nvec = ( 0 : nmat - 1 ) * szs( 1 ); 12 | r = r( :, omat ) + nvec( oelm, : ); 13 | c = c( : ); 14 | c = c( :, omat ); 15 | nvec = ( 0 : nmat - 1 ) * szs( 2 ); 16 | c = c( :, omat ) + nvec( oelm, : ); 17 | v = v( : ); 18 | v = v( :, omat ); 19 | str = sparse( r, c, v, nmat * szs( 1 ), nmat * szs( 2 ) ); 20 | 21 | % Copyright 2005-2016 CVX Research, Inc. 22 | % See the file LICENSE.txt for full copyright information. 23 | % The command 'cvx_where' will show where this file is located. 24 | -------------------------------------------------------------------------------- /structures/cvx_s_hankel.m: -------------------------------------------------------------------------------- 1 | function [ y, symm ] = cvx_s_hankel( m, n, symm ) 2 | 3 | %CVX_S_HANKEL Hankel matrices. 4 | 5 | c = 0 : n - 1; 6 | c = c( ones( 1, m ), : ); 7 | r = ( 0 : m - 1 )'; 8 | r = r( :, ones( 1, n ) ); 9 | v = abs( r + c ) + 1; 10 | y = sparse( v, r + m * c + 1, 1, m + n + 1, m * n ); 11 | symm = false; 12 | 13 | % Copyright 2005-2016 CVX Research, Inc. 14 | % See the file LICENSE.txt for full copyright information. 15 | % The command 'cvx_where' will show where this file is located. 16 | -------------------------------------------------------------------------------- /structures/cvx_s_hermitian.m: -------------------------------------------------------------------------------- 1 | function [ y, symm ] = cvx_s_hermitian( m, n, symm ) %#ok 2 | 3 | %CVX_S_HERMITIAN Complex Hermitian matrices. This is no longer used by 4 | %cvx_create_structure, but it is used by cvx_sdpt3. 5 | 6 | if m ~= n, 7 | error( 'Hermitian structure requires square matrices.' ); 8 | end 9 | 10 | nsq = n * n; 11 | c = 0 : n - 1; 12 | c = c( ones( 1, 2 * n ), : ); 13 | c = c( : ); 14 | r = 0 : n - 1; 15 | r = r( [ 1, 1 ], : ); 16 | r = r( : ); 17 | r = r( :, ones( 1, n ) ); 18 | r = r( : ); 19 | v = [ 1 ; 1i ]; 20 | v = v( :, ones( 1, nsq ) ); 21 | v = v( : ); 22 | temp = r < c; 23 | v( temp ) = conj( v( temp ) ); 24 | temp = r == c; 25 | v( temp ) = real( v( temp ) ); 26 | mn = min( r, c ); 27 | mx = max( r, c ); 28 | y = sparse( 2 * ( mx + mn .* ( n - 0.5 * ( mn + 1 ) ) + 1 ) - ( v == 1 ), r + n * c + 1, v, length( v ), nsq ); 29 | y = y( any( y, 2 ), : ); 30 | symm = false; 31 | 32 | % Copyright 2005-2016 CVX Research, Inc. 33 | % See the file LICENSE.txt for full copyright information. 34 | % The command 'cvx_where' will show where this file is located. 35 | -------------------------------------------------------------------------------- /structures/cvx_s_symmetric.m: -------------------------------------------------------------------------------- 1 | function [ y, symm ] = cvx_s_symmetric( m, n, symm ) %#ok 2 | %CVX_S_SYMMETRIC Symmetric matrices (lower triangle storage). 3 | if m ~= n, 4 | error( 'Symmetric structure requires square matrices.' ); 5 | end 6 | symm = false; 7 | nsq = n * n; 8 | ntr = 0.5 * ( nsq + n ); 9 | c = 0 : n - 1; 10 | c = c( ones( 1, n ), : ); 11 | r = c'; 12 | mn = min( r, c ); 13 | mx = max( r, c ); 14 | y = mx + mn .* ( n - 0.5 * ( mn + 1 ) ) + 1; 15 | y = sparse( y( : ), 1 : nsq, 1, ntr, nsq ); 16 | 17 | % Copyright 2005-2016 CVX Research, Inc. 18 | % See the file LICENSE.txt for full copyright information. 19 | % The command 'cvx_where' will show where this file is located. 20 | -------------------------------------------------------------------------------- /structures/cvx_s_symmetric_ut.m: -------------------------------------------------------------------------------- 1 | function [ y, symm ] = cvx_s_symmetric_ut( m, n, symm ) 2 | %CVX_S_SYMMETRIC_UT Symmetric matrices (upper triangle storage). 3 | if m ~= n, 4 | error( 'Symmetric structure requires square matrices.' ); 5 | end 6 | symm = false; 7 | nsq = n * n; 8 | ntr = 0.5 * ( nsq + n ); 9 | c = 0 : n - 1; 10 | c = c( ones( 1, n ), : ); 11 | r = c'; 12 | mn = min( r, c ); 13 | mx = max( r, c ); 14 | y = mn + 0.5 * mx .* ( mx + 1 ) + 1; 15 | y = sparse( y( : ), 1 : nsq, 1, ntr, nsq ); 16 | 17 | % Copyright 2005-2016 CVX Research, Inc. 18 | % See the file LICENSE.txt for full copyright information. 19 | % The command 'cvx_where' will show where this file is located. 20 | -------------------------------------------------------------------------------- /structures/cvx_s_upper_hankel.m: -------------------------------------------------------------------------------- 1 | function [ y, symm ] = cvx_s_upper_hankel( m, n, symm ) 2 | 3 | % CVX_S_UPPER_HANKEL Upper Hankel matrices. 4 | 5 | c = 0 : n - 1; 6 | c = c( ones( 1, m ), : ); 7 | r = ( 0 : m - 1 )'; 8 | r = r( :, ones( 1, n ) ); 9 | v = abs( r + c ) + 1; 10 | temp = v <= min( m, n ); 11 | y = sparse( v( temp ), r( temp ) + m * c( temp ) + 1, 1, min( m, n ), m * n ); 12 | symm = false; 13 | 14 | % Copyright 2005-2016 CVX Research, Inc. 15 | % See the file LICENSE.txt for full copyright information. 16 | % The command 'cvx_where' will show where this file is located. 17 | --------------------------------------------------------------------------------