From: Andy A. <ad...@si...> - 2003-12-15 22:59:38
|
On Sat, 13 Dec 2003, Paul Kienzle wrote: > On Dec 13, 2003, at 1:48 PM, Andy Adler wrote: > > > For sin, sinh, tan, erf, abs, conj, floor, round, ceil, fix, > > tanh, sign, asin, asinh, atan, sqrt (any more?) > > in which func(0)= 0, I could write a template that does > > the function on each non-sparse element. Then we could define > > sp_func for each, which could dispatch for sparse operands. > > These are easy enough to add as scripts: > > function x = spfn(fn,y) > [i,j,v,m,n]=spfind(y); > x = sparse(i,j,feval(fn,v),m,n); > end > > Or if they want ease of use: > > ## PKG_ADD: dispatch('sin','spsin','sparse'); > ## PKG_ADD: dispatch('sin','spsin','complex_sparse'); > function x=spsin(y), x=spfn('sin',y); end This is a great idea. Any objection to my adding this to sparse for these functions? Andy |