Path: news.mathworks.com!newsfeed-00.mathworks.com!panix!bloom-beacon.mit.edu!llnews!53ab2750!not-for-mail
From: Peter Boettcher <boettcher@ll.mit.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Is MCR required for standalone applications?
References: <ftj9de$pap$1@fred.mathworks.com>
Message-ID: <muy3apug1fp.fsf@G99-Boettcher.llan.ll.mit.edu>
Organization: MIT Lincoln Laboratory
User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/23.0.0 (gnu/linux)
Cancel-Lock: sha1:uYRzWVhst5MeelCTz3OHzUk3WLE=
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Lines: 42
Date: Wed, 09 Apr 2008 17:31:38 -0400
NNTP-Posting-Host: 155.34.163.114
X-Complaints-To: news@ll.mit.edu
X-Trace: llnews 1207776095 155.34.163.114 (Wed, 09 Apr 2008 17:21:35 EDT)
NNTP-Posting-Date: Wed, 09 Apr 2008 17:21:35 EDT
Xref: news.mathworks.com comp.soft-sys.matlab:462078



"Ahmed ElDessouki" <ahmed.eldessouki@gmail.com> writes:

> Hello, 
>
> I have a program written in C, and I wish to add an
> algorithm to improve its speed. I have that figured out, and
> I need to use a cumulative inverse chi squared distribution.
> My variable would be the degrees of freedom; so I would need
> to use the MatLab function chi2inv(x,y)
>
> I need to be able to pass the variable y from within my C
> code, and compile it as a standalone application. I have
> figured out that I need to use MatLab compiler (mcc). 
>
> Now, my question is: Do I need to have MCR installed on the
> computer I want to use my application on? Is there any way
> around this? From my understanding is that the mcc command
> allows me to access my M files from my C code, but it then
> uses MCR to do do the computations. Is this correct? And is
> there any way to do it so that everything is done from
> within one executable? 

I would suggest that MATLAB is a rather large dependency to be
introducing into your C-based project, only for one function: chi2inv.

Two options:

1- Implement chi2inv in C.  As you develop for now, you can use the
MATLAB engine to use chi2inv, and have your C port ready for using on
other machines.

2- Use a different library better suited for C-based math.  I recommend
the GNU Scientific Library:

http://www.gnu.org/software/gsl/
or here for Windows:
http://gnuwin32.sourceforge.net/packages/gsl.htm

The documentation for the inverse chi-squared CDF is here:
http://www.gnu.org/software/gsl/manual/html_node/The-Chi_002dsquared-Distribution.html

-Peter