apostrophe after linspace code
Jaroslav Hajek
highegg at gmail.com
Fri Jun 13 12:15:12 CDT 2008
On Fri, Jun 13, 2008 at 6:22 PM, Dmitri A. Sergatskov
<dasergatskov at gmail.com> wrote:
> On Thu, Jun 12, 2008 at 10:21 PM, Bill Denney <bill at denney.ws> 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
> Help-octave at octave.org
> 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
More information about the Help-octave
mailing list