stochasticMatrixPro​jection(A,projectio​n_type)

バージョン 1.3.0.0 (2.58 KB) 作成者: Lior Kirsch
Finds the closest stochastic matrix
ダウンロード: 169
更新 2015/5/23

ライセンスの表示

Given a matrix A it finds the closest matrix which is column stochastic (left stochastic matrix ).
This is based on vector implementation in http://www.mathworks.com/matlabcentral/fileexchange/30332-projection-onto-simplex which is based on the paper http://arxiv.org/abs/1101.6081
Two type of projections are supproted:
1. "on simplex" - Each entry is in [0,1] and each columns sums to one.
2. "inside simplex" - Each entry is in [0,1] and each columns sum is also in [0,1]
input:
A - matrix, which columns to project
projection_type - which type of projection to make:
'on' - on the simplex, each column sums to one (default)
'inside' - inside the simplex, each column sum is in the interval[0,1]
example:
vec_2d = rand(2,200)*3 - 1;
proj_vec = stochasticMatrixProjection(vec_2d,'on');
subplot(1,2,1);
plot([vec_2d(1,:);proj_vec(1,:)],[vec_2d(2,:);proj_vec(2,:)],...
[vec_2d(1,:);proj_vec(1,:)],[vec_2d(2,:);proj_vec(2,:)],'.'); axis equal
subplot(1,2,2);
proj_vec = stochasticMatrixProjection(vec_2d,'inside');
plot([vec_2d(1,:);proj_vec(1,:)],[vec_2d(2,:);proj_vec(2,:)],...
[vec_2d(1,:);proj_vec(1,:)],[vec_2d(2,:);proj_vec(2,:)],'.'); axis equal

引用

Lior Kirsch (2024). stochasticMatrixProjection(A,projection_type) (https://www.mathworks.com/matlabcentral/fileexchange/50779-stochasticmatrixprojection-a-projection_type), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2014b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersPolynomials についてさらに検索
タグ タグを追加
謝辞

ヒントを得たファイル: Projection onto simplex

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.3.0.0

Replaced repmat with bsxfun

1.2.0.0

Example added.

1.1.0.0

* added text to the description

1.0.0.0