Hot answers tagged

5

This is my comment expanded into an answer. MATLAB is a column-major programming language; it is not very hard to find it in the documentation once you know what to look for: https://www.mathworks.com/help/matlab/matlab_external/matlab-data.html#f22019 The layout of data structures (most commonly row-major or column-major) used in a programming language is ...


2

Gonna answer by points: NR authors are referring to the fact that $h$ itself is affected by roundoff too. Also, if your $h$ does not have a finite binary representation, like $h = 0.1$, you're sure you have error for every $h$ in your code. What you really want is that the difference between $x$ and $x+h$ is exactly representable in finite precision ...


2

The inverse of the (1,1) block of $$ \begin{bmatrix} A & B\\ C & D \end{bmatrix}^{-1} $$ is $A-BD^{-1}C$ (Schur complement). This is what you are trying to compute, if I understand correctly from your explanation ("marginalize" may be standard in your domain, but it is not standard linear algebra language). So at least you can reduce to ...


1

Here is a fast implementation using sparse matrices and sparse Jacobian estimation: % define square domain [-1,1] x [-1,1] n = 51; x=linspace(-1,1,n); y=x; [X,Y]=meshgrid(x,x); % build finite differences operators dx=x(2)-x(1); e=ones(n,1); d0x=ones(n,1); grad = spdiags([-e 0*e e],-1:1,n,n)/2/dx; % use Kronecker product to build matrix of d/dx and d/dy ...


Only top voted, non community-wiki answers of a minimum length are eligible