-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvpd.m
30 lines (25 loc) · 855 Bytes
/
invpd.m
1
function xinv = invpd(x);% PURPOSE: generalized inverse of non PD matrix % (Moore-Penrose)% ----------------------------------------------------------------% USAGE: xinverse = invpd(x)% where: x = input matrix%---------------------------------------------------% RETURNS: xinv = Moore-Penrose psuedo matrix inverse% ----------------------------------------------------------------% NOTES:% This function is intended to ensure PD % var-cov matrices returned by numerical hessians% don't use it like invpd() in Gauss% ----------------------------------------------------------------% Written by:% James P. LeSage, Dept of Economics% University of Toledo% 2801 W. Bancroft St,% Toledo, OH 43606% jlesage@spatial-econometrics.com[n,k] = size(x);if n ~= kerror('invpd: must input a square matrix');end;xinv = pinv(x);