Negative zero isn't a bug, it's a feature that numerical types,
especially William Kahan, wanted to get into IEEE-754 to help out some
things. I'm not expert enough to explain.
The idea of 0&=`(,: +@|:)} is, a zero in the original matrix is either
below the diagonal, in which case you want to select from the adjoint,
or not, in which case you want a zero and you might as well take your
zero from the adjoint. Along the main diagonal, you can pick either
value, since they are the same.
The bitwise-OR version would take advantage of the facts that (a) a OR 0
= a and (b) a OR a = a, so that adjoint OR original would pick up
whichever value is nonzero, or, in the case of the main diagonal, would
leave the value unchanged.
Negative zero puts the kibosh on that. -0 OR a = -a, which wouldn't do.
But if the below-the-diagonal values were known to be +0, it would work.
Henry Rich
On 1/16/2013 11:42 AM, km wrote:
Copied from J on my iPad
hftd =: 23 b.&.(a.&i.)&.(2&(3!:5))&.+. +@|: NB. hftdevil!
A
1 _2j3 0
0 _4 5j_6
0 0 7
hftd A
1 _2j_3 0
_2j_3 _4 5j_6
0 5j6 7
ishermitian hftd A
0
Notice _2j3 in A but in the result _2j_3 where _2j3 was. I have not tried to
understand hftd .
Kip Murray
Sent from my iPad
On Jan 16, 2013, at 9:58 AM, km <k...@math.uh.edu> wrote:
And my discussion of his original hft has nothing to do with his new algorithm
using bit-wise or!
Kip
Sent from my iPad
On Jan 16, 2013, at 9:33 AM, Raul Miller <rauldmil...@gmail.com> wrote:
But = is tolerant, and 0 = %__
--
Raul
On Wed, Jan 16, 2013 at 10:28 AM, km <k...@math.uh.edu> wrote:
Henry's
hft =: 0&=`(,: +@|:)}
tests each element of its argument A returning 1 or 0 depending on whether the
element is 0 . He doesn't know where this A is coming from, maybe somebody
else's file. If he is comparing the bit representations of his 0 and one of
A's 0's the test may return 0 instead of 1, and then the wrong element of A ,:
+@|: A is chosen to go into the result B .
Kip Murray
Sent from my iPad
On Jan 16, 2013, at 7:53 AM, Raul Miller <rauldmil...@gmail.com> wrote:
Ok, this makes sense, given the underlying hardware.
But, I am having trouble reasoning about how this could cause problems
fro Henry's implementation, since:
0 = % __
1
and
% ::0:"0 j./~_*i:1
0 0 0
0 _ 0
0 0 0
0j1 % __
0
% 0j1 % __
_
0j1 * % __
0
% 0j1 * % __
_
Is there some way of getting an imaginary negative zero? Or is the
issue simply the result of % on the result of Henry's code on a matrix
with a negative zero off the diagonal? (Are there any other ways for
this to be a problem?)
Thanks,
--
Raul
On Wed, Jan 16, 2013 at 8:31 AM, Dan Bron <j...@bron.us> wrote:
In J, the reciprocal of zero is infinity. Correspondingly, the reciprocal of
negative zero is negative infinity. Ergo, the reciprocal of negative infinity
is negative zero.
%0
_
%_
0
%__
0
% %_ NB. The two zeros look identical
_
% %__ NB. But J knows their "signs"
__
So, you can produce a negative zero by inverting negative infinity, and you can
identify a negative zero by inverting it. If __=%x then x is negative zero
(the only value whose reciprocal is negative infinity).
-Dan
Please excuse typos; composed on a handheld device.
On Jan 16, 2013, at 7:49 AM, Raul Miller <rauldmil...@gmail.com> wrote:
I thought that J did not represent negative zero?
Is it possible to trick J into revealing a negative zero? If so, does
it involve foreigns or is there some native calculations that lead
here?
Thanks,
--
Raul
On Wed, Jan 16, 2013 at 7:26 AM, Henry Rich <henryhr...@nc.rr.com> wrote:
On my awaking, there was a whiff of sulfur in the air, and a greenish
haze... and somehow in my mind the idea that that last program won't work,
because of the possibility of negative zero. I'll stay relegated to imp
status.
Henry Rich
On 1/15/2013 6:20 PM, Henry Rich wrote:
Nah, that's not beyond impish. The devilish solution is to take the
bitwise OR of the matrix with its conjugate transpose (but that's easier
in assembler language than in J:
(23 b.&.(a.&i.)&.(2&(3!:5))&.+. +@|:))
). And you need to be sure that the zeros on the lower diagonal and
below are true zeros!
Henry Rich
On 1/15/2013 6:03 PM, km wrote:
Oh, boy! (v1`v2) } y <--> (v1 y) } (v2 y)
Brief and devilish, take care for your soul, Henry!
--Kip
Sent from my iPad
On Jan 15, 2013, at 3:39 PM, Henry Rich <henryhr...@nc.rr.com> wrote:
hft =: 0&=`(,: +@|:)}
Henry Rich
On 1/15/2013 5:25 AM, km wrote:
This is an easy one. A Hermitian matrix matches its conjugate
transpose. Write a verb hft that creates a Hermitian matrix from a
triangular one that has a real diagonal.
ishermitian =: -: +@|:
]A =: 2 2 $ 1 2j3 0 4
1 2j3
0 4
]B =: hft A
1 2j3
2j_3 4
ishermitian A
0
ishermitian B
1
Kip Murray
Sent from my iPad
----------------------------------------------------------------------
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
----------------------------------------------------------------------
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
----------------------------------------------------------------------
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
----------------------------------------------------------------------
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm