The checking for identity is only O(n^2) if the result is true - usually it's O(1) approximately.
The question is, is it worth the coding effort? Symmetric matrices are so common - more likely than not, in my work - that Mark's suggestion has merit. Henry Rich > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Roger Hui > Sent: Saturday, September 02, 2006 2:44 PM > To: Programming forum > Subject: Re: [Jprogramming] Re: Symmetric inner and outer products > > And by the same logic you should always check for > the identity matrix, since the checking is O(n^2). > > > > ----- Original Message ----- > From: "Mark D. Niemiec" <[EMAIL PROTECTED]> > Date: Saturday, September 2, 2006 11:39 am > Subject: [Jprogramming] Re: Symmetric inner and outer products > > > Since inner product is an O(n^3) process, and checking to see if a > > matrix is O(n^2), > > if special code were implemented to handle symmetrical matrices, > > wouldn't it just > > be easier to always check each time, since the additional cost > > would be insignificant? > > > > The same logic could also apply to other symmetric matrix > > operations that could be > > significantly improved by special code. In particular, 128!:1 > > could be replaced by %. > > which could just automatically invoke the special code for upper > > tridiagonal matrices > > after just checking for zero, since the cost of the check is much > > smaller than the cost > > of the inversion. > > > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
