help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: apostrophe after linspace code


From: Jaroslav Hajek
Subject: Re: apostrophe after linspace code
Date: Fri, 13 Jun 2008 19:15:12 +0200

On Fri, Jun 13, 2008 at 6:22 PM, Dmitri A. Sergatskov
<address@hidden> wrote:
> On Thu, Jun 12, 2008 at 10:21 PM, Bill Denney <address@hidden> wrote:
>> Siddhartha wrote:
>>> can anyone tell me the significance of having the apostrophe
>>> ' after a line of code?
>>>
>>> something like this:
>>>
>>> x = linspace(0,100,100)';
>>>
>>> What is the difference between having that and leaving it
>>> out? I can't tell, so any help would be great!
>>>
>>
>> Hi Siddhartha,
>>
>> The apostrophe is the transpose operator.
>
> Apostrophe (') is the conjugate transpose (Hermitian transpose) operator.
> A' is equivalent to ctranspose(A).
>
> Dot apostrophe (.') is the transpose operator.
> A.' is equivalent to transpose(A).
>
> The transpose (') is the only unary operator that can have a dot (.) modifier.
>
> If A is a real matrix then (') is the equivalent to (.'), but one has to
> watch out for functions that can turn real matrix into complex one.
> Since it appears that there is no noticeable execution-time difference
> between (.') and ('), I would argue that it would be a good style guide
> to use (.') (or even explicit transpose()) to transpose real matrices.
> I believe we had few bugs in octave because of the (') and (.') mix-up.
>

I can't fully agree. It depends on why you're transposing - whether it
is a part of matrix formula, or you just need the opposite layout for
some function. In the first case, it is often more natural to use ',
because then the same formula works for complex matrices as well. In
the latter case, I would agree with your recommendation.

>> Bill
>
> Sincerely,
>
> Dmitri.
> --
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]