From olafm at statistik.tu-dortmund.de  Fri Jul 30 12:01:22 2010
From: olafm at statistik.tu-dortmund.de (Olaf Mersmann)
Date: Fri, 30 Jul 2010 12:01:22 +0200
Subject: [Rd] transpose of complex matrices in R
In-Reply-To: <4C529CE0.2070408@cam.ac.uk>
References: <4C529CE0.2070408@cam.ac.uk>
Message-ID: <55722628-0C98-45BC-AFC7-95132F92E2EB@statistik.tu-dortmund.de>

Hi,

On 30.07.2010, at 11:35, Robin Hankin wrote:
> 3.  Try to define a t.complex() function:
> t.complex <- function(x){t(Conj(x))}
> (also fails because of recursion)

Try this version:

  t.complex <- function(x) {
    xx <- Conj(x)
    .Internal(t.default(xx))
  }

You get infinite recursion in your example because you keep dispatching on the (complex) result of Conj(x) in t(Conj(x)). I'm not sure if the use of .Internal in user code is sanctioned but it does work for me.

Cheers,
Olaf



[Rd] transpose of complex matrices in R
Olaf Mersmann