[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: apostrophe after linspace code
From: |
Dmitri A. Sergatskov |
Subject: |
Re: apostrophe after linspace code |
Date: |
Fri, 13 Jun 2008 11:22:44 -0500 |
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.
> Bill
Sincerely,
Dmitri.
--