Speeding up 2D Finite Difference Matrix
古いコメントを表示
I have two matrices B and D, where B is a
matrix and D is a
matrix defined as follows:
,where
is the
identity matrix and
denotes the Kronecker product of matrices P and Q. I am currently computing B as a sparse matrix as follows:
o = ones(n,1);
z = zeros(n,1);
D = spdiags([-o o z],-1:1,n,n);
D(1,1) = 0;
I = speye(n);
B1 = kron(I, D);
B2 = kron(D, I);
B = [B1;B2];
I know that
can be quickly computed using
[0; diff(x)]
I need to find a quick way of computing
and
in a similar manor. Currently my code is spending a signifigant amount of its time to compute
and
so I was wondering if anyone had some incite into computing this efficently.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!