⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mf_c.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 21mar2005}{...}
{cmd:help mata C()}
{hline}
{* index C()}{...}

{title:Title}

{p 4 8 2}
{bf:[M-5] C() -- Make complex}


{title:Syntax}

{p 8 12 2}
{it:complex matrix}{bind: }
{cmd:C(}{it:numeric matrix A}{cmd:)}

{p 8 12 2}
{it:complex matrix}{bind: }
{cmd:C(}{it:real matrix R}{cmd:,}
{it:real matrix I}{cmd:)}


{title:Description}

{p 4 4 2}
{cmd:C(}{it:A}{cmd:)}
returns {it:A} converted to complex.  
{cmd:C(}{it:A}{cmd:)} returns {it:A} if {it:A} is already complex.
If {it:A} is real, 
{cmd:C(}{it:A}{cmd:)} returns {it:A}+0i -- {it:A} cast up to complex.
Coding {cmd:C(}{it:A}{cmd:)} is thus how you ensure 
that the matrix is treated as complex.

{p 4 4 2}
{cmd:C(}{it:R}{cmd:,} {it:I}{cmd:)} 
returns 
the complex matrix
{it:R}+{it:I}i 
and is faster than the alternative 
{bind:{it:R} {cmd:+} {it:I}{cmd::*1i}}.


{title:Remarks}

{p 4 4 2}
Many of Mata's functions are overloaded, meaning they return a real when
given real arguments and a complex when given complex arguments.  Given
real arguments, if the result cannot be expressed as a real, missing value is
returned.  Thus {cmd:sqrt(-1)} evaluates to missing while {cmd:sqrt(-1+0i)}
is 1i.

{p 4 4 2}
{cmd:C()} is the fast way to make arguments they might be real into complex.
You can code 

		{cmd:result = sqrt(C(}{it:x}{cmd:))}

{p 4 4 2}
If {it:x} already is complex, {cmd:C()} does nothing; if {it:x} is 
real, {cmd:C(}{it:x}{cmd:)} returns the complex equivalent.

{p 4 4 2}
The two-argument version of {cmd:C()} is less frequently used.  
{cmd:C(}{it:R}{cmd:,} {it:I}{cmd:)} is literally equivalent to 
{it:R} {cmd::+} {it:I}{cmd:*1i}, meaning that {it:R} and {it:I} need only 
be c-conformable.  For instance, {cmd:C(1, (1,2,3))}
evaluates to (1+1i, 1+2i, 1+3i).


{title:Conformability}

    {cmd:C(}{it:A}{cmd:)}:
		{it:A}:  {it:r x c}
	   {it:result}:  {it:r x c}

    {cmd:C(}{it:R}{cmd:,} {it:I}{cmd:)}:
		{it:R}:  {it:r1 x c1}
		{it:I}:  {it:r2 x c2}, {it:R} and {it:I} c-conformable
	   {it:result}:  max({it:r1},{it:r2}) {it:x} max({it:c1},{it:c2})



{title:Diagnostics}

{p 4 4 2}
{cmd:C(}{it:Z}{cmd:)}, if {it:Z} is complex, literally returns {it:Z} and 
not a copy of {it:Z}.  This makes execution of {cmd:C()} applied to 
complex arguments instant.

{p 4 4 2}
In 
{cmd:C(}{it:R}{cmd:,} {it:I}{cmd:)},
the {it:i},{it:j} element of the result will be missing anywhere
{it:R}{cmd:[}{it:i}{cmd:,}{it:j}{cmd:]} or 
{it:I}{cmd:[}{it:i}{cmd:,}{it:j}{cmd:]} is missing.
For instance, {cmd:C((1,3,.), (.,2,4))} results in (., 3+2i, .).
If 
{it:R}{cmd:[}{it:i}{cmd:,}{it:j}{cmd:]} and 
{it:I}{cmd:[}{it:i}{cmd:,}{it:j}{cmd:]} are both missing, then 
the 
{it:R}{cmd:[}{it:i}{cmd:,}{it:j}{cmd:]} 
value will be used.  E.g., {cmd:C(.a, .b)} results in .a.


{title:Source code}

{p 4 4 2}
{cmd:C()}
is built-in.


{title:Also see}

{p 4 13 2}
Manual:  {hi:[M-5] C()}

{p 4 13 2}
Online:  help for 
{bf:{help mf_re:[M-5] Re()}};
{bf:{help m4_utility:[M-4] utility}}
{p_end}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -