There seem to be two issues here. If the arguments are symmetric then that can be checked. However that is not the common case which led to my initial post - the case where (a f b) -: (b f a). The programmer knows this. There is no need for any checking. I certainly do not expect many cases where argument symmetry occurs or should be checked. Some other special cases with diagonal matrices are best handled other ways using rank again using the programmers knowledge..

The real question I believe is, is this case sufficiently common to justify it having a 'primitive' perhaps indirectly using a !. conjunction.

.!.n  for the inner product case
/!.n might restrict / to the dyadic tables case with an upper triangular result

I would assume the result will go into a matrix result. If there are problems with fill that should be handled by the user after the calculation. If I had to opt for only one of these I think it would be the tables case. There are lots of cases where one wants to construct a set of results where the combining function is commutative and the saving is likely to be significant.

It does not seem to me that this should double the amount of code required.

Fraser


----- Original Message ----- From: "Henry Rich" <[EMAIL PROTECTED]>
To: "'Programming forum'" <[email protected]>
Sent: Sunday, September 03, 2006 6:45 AM
Subject: RE: [Jprogramming] Re: Symmetric inner and outer products


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

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to