% funm: Matrix equivalent of function 'name' % % Usage: B = funm(A, name) % where A = square non-singular matrix, provisionally % real-valued % B = square result matrix % name = string, name of function to apply to A. % args = any arguments to pass to function 'name' % The function must accept a vector and apply % element-wise to that vector. % % Example: To compute sqrtm(A), you could use funm(A, 'sqrt') % % Note that you should not use funm for 'sqrt', 'log' or 'exp'; instead % use sqrtm, logm and expm which are more robust. Similarly, % trigonometric and hyperbolic functions (cos, sin, tan, cot, sec, csc, % cosh, sinh, tanh, coth, sech, csch) are better handled by thfm(A, % name), which defines them in terms of the more robust expm.