.......for instance, this is the program to determine Sign and complex
quadrant functions copied from its source code...
marcos
/*
Quadrants:
(2)
2  1

(3) + (1)
3  4
(4)
quadrant(0i) = quandrant(C(.)) = .
Note treatment of degenerate cases: quadrant(5+0i) = 1
Thus, after exclusion of Re==Im==0:
Q1: Re>0 & Im>=0
Q2: Re<=0 & Im>0
Q3: Re<0 & Im<=0
*/
real matrix quadrant(complex matrix z)
{
real matrix q
complex scalar a
real scalar ar, ai, res
real scalar i, j, r, c
q = J(r=rows(z),c=cols(z),.)
for (i=1;i<=r;i++) {
for (j=1;j<=c;j++) {
a = z[i,j]
if (a!=. & a!=0) {
ar = Re(a)
ai = Im(a)
if (ar> 0 & ai>=0) res = 1
else if (ar<=0 & ai> 0) res = 2
else if (ar< 0 & ai<=0) res = 3
else res = 4
q[i,j] = res
}
}
}
return(q)
}
end
Original Message
From: ownerstatalist@hsphsun2.harvard.edu
[mailto:ownerstatalist@hsphsun2.harvard.edu] On Behalf Of Rachel
Sent: 08 March 2007 16:09
To: statalist@hsphsun2.harvard.edu
Subject: st: Follow up: Viewing code for matrix functions.
Thanks, this was very helpful.
On 3/7/07, M.Delprato@westminster.ac.uk <M.Delprato@westminster.ac.uk>
wrote:
> Rachel,
>
> Some matrix commands are in built and others you can see the code.
> Type help m4_matrix for a list of matrix functions.
> For example, you can see the code to obtain a matrix determinant
> help mf_det and then and the bottom of the help windown you have the
source
> code. But some commands such as cholesky (help mf_cholesky) are in built
and
> they use the LAPACK package  a set of free routines from Fortran.
>
> You will have to go trough the list of commands displayed with help
m4_matrix
> and check if there's a source code.
>
> Hope this helps,
>
> Marcos.
>
>
>
>
> Quoting Austin Nichols <austinnichols@gmail.com>:
>
> > Rachel
> > It's a safe bet that every function is built in (not interpreted
> > code). It's an even safer bet that all the matrix functions are built
> > ineven the matrix subcommands are!
> >
> > The references at
http://mathworld.wolfram.com/CholeskyDecomposition.html
> > might tell you the relevant formulas...
> >
> > though I sincerely doubt you need them.
> >
> > On 3/6/07, Rachel <academicgirl@gmail.com> wrote:
> > > I would like to see the code for several of Stata's matrix functions
> > > (for example, cholesky()). However, I can't seem to find where they
> > > are implemented.
> > >
> > > which cholesky tells me it's not implemented as either an ado or
> > > builtin function, so I assume I must be using the wrong name.
> > >
> > > Can anyone help?
> > >
> > > Thanks,
> > > Rachel
> > > *
> > > * For searches and help try:
> > > * http://www.stata.com/support/faqs/res/findit.html
> > > * http://www.stata.com/support/statalist/faq
> > > * http://www.ats.ucla.edu/stat/stata/
> > >
> > *
> > * For searches and help try:
> > * http://www.stata.com/support/faqs/res/findit.html
> > * http://www.stata.com/support/statalist/faq
> > * http://www.ats.ucla.edu/stat/stata/
> >
>
>
>
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/