#!/usr/bin/octave --no-gui

m = [0,0;1,-1]

nr = rows(m);
nc = columns(m);
ns = 0;

for i0=1:nr
	for j0=1:nc
		nonsaddle = false;
		for i=1:nr
			for j=1:nc
				if (m(i,j0) > m(i0,j0) || m(i0,j0) > m(i0,j))
					nonsaddle = true;
					break;
				endif
			endfor
			if (nonsaddle)
				break;
			endif
		endfor
		if (!nonsaddle)
			printf("Matrix saddle point: m(%u,%u) = %g\n", i0, j0, m(i0,j0));
			ns++;
		endif
	endfor
endfor

if (ns == 0)
	printf("No saddle points are found.\n");
endif
