<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153180</link>
    <title>MATLAB Central Newsreader - DSYEVX functionality in MATLAB</title>
    <description>Feed for thread: DSYEVX functionality in MATLAB</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 23 Jul 2007 20:28:39 -0400</pubDate>
      <title>DSYEVX functionality in MATLAB</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153180#384474</link>
      <author>borchers@nmt.edu (Brian Borchers)</author>
      <description>&lt;br&gt;
The eig() command provides easy access to the functionality of the &lt;br&gt;
LAPACK DSYEV routine.  However, there are times when it is useful to &lt;br&gt;
use options available only through the DSYEVX expert driver. For&lt;br&gt;
example, if I'm interested only in those eigenvalues of a matrix &lt;br&gt;
in a particular interval, DSYEVX can find them.  &lt;br&gt;
&amp;nbsp;&lt;br&gt;
I had hoped that eig() would have options to get at this functionality,&lt;br&gt;
but it appears that it doesn't.  Is there some relatively easy way to &lt;br&gt;
do this in MATLAB? I realize that this could be done with a mex file, &lt;br&gt;
but that seems like a lot of work...&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Brian Borchers                          borchers@nmt.edu&lt;br&gt;
Department of Mathematics               &lt;a href=&quot;http://www.nmt.edu/~borchers/&quot;&gt;http://www.nmt.edu/~borchers/&lt;/a&gt;&lt;br&gt;
New Mexico Tech                         Phone: 505-835-5813&lt;br&gt;
Socorro, NM 87801                       FAX: 505-835-5366       </description>
    </item>
    <item>
      <pubDate>Tue, 24 Jul 2007 07:22:39 -0400</pubDate>
      <title>Re: DSYEVX functionality in MATLAB</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153180#384530</link>
      <author>Markus</author>
      <description>Using a mex-function is a bit of work, but this is definitely a&lt;br&gt;
possible and fast way. Below I have pasted a mex-function that calls&lt;br&gt;
the Lapack function DPOTRF which computes a Cholesky factorization&lt;br&gt;
(i.e. imitating the functionality of Matlab-function chol). This not&lt;br&gt;
exactly what you want, but with some copy and paste and the&lt;br&gt;
documentation of your function on &amp;lt;&lt;a href=&quot;http://www.netlib.org/lapack/&quot;&gt;http://www.netlib.org/lapack/&lt;/a&gt;&amp;gt;,&lt;br&gt;
ou should quickly get your wanted function.&lt;br&gt;
&lt;br&gt;
Just put the code below into a function (e.g. called cholmex.c),&lt;br&gt;
start &quot;mex -setup&quot;, select the gcc compiler under Linux or Lcc under&lt;br&gt;
Windows and run &quot;mex chomex.c&quot; to compile your mex-function - ready.&lt;br&gt;
&lt;br&gt;
If you need more help, just let me know.&lt;br&gt;
&lt;br&gt;
Markus&lt;br&gt;
&lt;br&gt;
#include &amp;lt;mex.h&amp;gt;&lt;br&gt;
#include &amp;lt;matrix.h&amp;gt;&lt;br&gt;
&lt;br&gt;
#ifndef WIN32&lt;br&gt;
extern void dpotrf_(char *uplo, int *n, double *a, int *lda, int&lt;br&gt;
*info);&lt;br&gt;
#define dpotrf dpotrf_&lt;br&gt;
#endif&lt;br&gt;
&lt;br&gt;
void chol(double *matrix, int N);&lt;br&gt;
&lt;br&gt;
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray&lt;br&gt;
*prhs[] )&lt;br&gt;
{&lt;br&gt;
	int N;&lt;br&gt;
	&lt;br&gt;
	/* Input arguments */&lt;br&gt;
	N = mxGetN(prhs[0]);&lt;br&gt;
	&lt;br&gt;
	if(N != mxGetM(prhs[0]))&lt;br&gt;
		mexErrMsgTxt(&quot;Matrix must be square.&quot;);&lt;br&gt;
&lt;br&gt;
	/* Output arguments */&lt;br&gt;
	plhs[0] = mxDuplicateArray(prhs[0]);&lt;br&gt;
	&lt;br&gt;
	/* Cholesky factorization using LAPACK function */&lt;br&gt;
	chol(mxGetPr(plhs[0]), N);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
void chol(double *matrix, int N)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;char uplo = 'U';&lt;br&gt;
&amp;nbsp;&amp;nbsp;int info, row, col;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
	/* Cholesky factorization using LAPACK function */&lt;br&gt;
	dpotrf(&amp;uplo, &amp;N, matrix, &amp;N, &amp;info);&lt;br&gt;
	&lt;br&gt;
	/* Check result of function call */&lt;br&gt;
	if(info != 0)&lt;br&gt;
	{	&lt;br&gt;
		mexPrintf(&quot;Return code of function DPOTRF: %d\n&quot;, info);&lt;br&gt;
		mexErrMsgTxt(&quot;Error using LAPACK function.&quot;);&lt;br&gt;
	}&lt;br&gt;
	&lt;br&gt;
	/* delete lower triangle elements */&lt;br&gt;
	for(row=1; row&amp;lt;N; row++)&lt;br&gt;
		for(col=0; col&amp;lt;row; col++)&lt;br&gt;
			matrix[row + N*col] = 0;&lt;br&gt;
}</description>
    </item>
    <item>
      <pubDate>Tue, 24 Jul 2007 07:31:33 -0400</pubDate>
      <title>Re: DSYEVX functionality in MATLAB</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153180#384535</link>
      <author>Markus</author>
      <description>Using a mex-function is a bit of work, but this is definitely a&lt;br&gt;
possible and fast way. Below I have pasted a mex-function that calls&lt;br&gt;
the Lapack function DPOTRF which computes a Cholesky factorization&lt;br&gt;
(i.e. imitating the functionality of Matlab-function chol). This not&lt;br&gt;
exactly what you want, but with some copy and paste and the&lt;br&gt;
documentation of your function on &amp;lt;&lt;a href=&quot;http://www.netlib.org/lapack/&quot;&gt;http://www.netlib.org/lapack/&lt;/a&gt;&amp;gt;,&lt;br&gt;
ou should quickly get your wanted function.&lt;br&gt;
&lt;br&gt;
Just put the code below into a function (e.g. called cholmex.c),&lt;br&gt;
start &quot;mex -setup&quot;, select the gcc compiler under Linux or Lcc under&lt;br&gt;
Windows and run &quot;mex chomex.c&quot; to compile your mex-function - ready.&lt;br&gt;
&lt;br&gt;
If you need more help, just let me know.&lt;br&gt;
&lt;br&gt;
Markus&lt;br&gt;
&lt;br&gt;
#include &amp;lt;mex.h&amp;gt;&lt;br&gt;
#include &amp;lt;matrix.h&amp;gt;&lt;br&gt;
&lt;br&gt;
#ifndef WIN32&lt;br&gt;
extern void dpotrf_(char *uplo, int *n, double *a, int *lda, int&lt;br&gt;
*info);&lt;br&gt;
#define dpotrf dpotrf_&lt;br&gt;
#endif&lt;br&gt;
&lt;br&gt;
void chol(double *matrix, int N);&lt;br&gt;
&lt;br&gt;
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray&lt;br&gt;
*prhs[] )&lt;br&gt;
{&lt;br&gt;
	int N;&lt;br&gt;
	&lt;br&gt;
	/* Input arguments */&lt;br&gt;
	N = mxGetN(prhs[0]);&lt;br&gt;
	&lt;br&gt;
	if(N != mxGetM(prhs[0]))&lt;br&gt;
		mexErrMsgTxt(&quot;Matrix must be square.&quot;);&lt;br&gt;
&lt;br&gt;
	/* Output arguments */&lt;br&gt;
	plhs[0] = mxDuplicateArray(prhs[0]);&lt;br&gt;
	&lt;br&gt;
	/* Cholesky factorization using LAPACK function */&lt;br&gt;
	chol(mxGetPr(plhs[0]), N);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
void chol(double *matrix, int N)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;char uplo = 'U';&lt;br&gt;
&amp;nbsp;&amp;nbsp;int info, row, col;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
	/* Cholesky factorization using LAPACK function */&lt;br&gt;
	dpotrf(&amp;uplo, &amp;N, matrix, &amp;N, &amp;info);&lt;br&gt;
	&lt;br&gt;
	/* Check result of function call */&lt;br&gt;
	if(info != 0)&lt;br&gt;
	{	&lt;br&gt;
		mexPrintf(&quot;Return code of function DPOTRF: %d\n&quot;, info);&lt;br&gt;
		mexErrMsgTxt(&quot;Error using LAPACK function.&quot;);&lt;br&gt;
	}&lt;br&gt;
	&lt;br&gt;
	/* delete lower triangle elements */&lt;br&gt;
	for(row=1; row&amp;lt;N; row++)&lt;br&gt;
		for(col=0; col&amp;lt;row; col++)&lt;br&gt;
			matrix[row + N*col] = 0;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
/*&lt;br&gt;
If you test this function, note that DPOTRF&lt;br&gt;
expects a real, symmetric, positive definite&lt;br&gt;
matrix as input. For example use the following&lt;br&gt;
line: x = eye(5)+rand(5); cholmex(x+x');&lt;br&gt;
/*</description>
    </item>
    <item>
      <pubDate>Tue, 24 Jul 2007 07:37:35 -0400</pubDate>
      <title>Re: DSYEVX functionality in MATLAB</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153180#384538</link>
      <author>Markus</author>
      <description>Sorry for accidentally posting two times. Refer to my SECOND reply,&lt;br&gt;
it contains some additional text.&lt;br&gt;
&lt;br&gt;
Markus</description>
    </item>
    <item>
      <pubDate>Fri, 27 Jul 2007 08:50:24 -0400</pubDate>
      <title>Re: DSYEVX functionality in MATLAB</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153180#385180</link>
      <author>Markus Buehren</author>
      <description>Did anybody try to translate the mex-file above under Windows? There you have to give the path to the lapack library additionally:&lt;br&gt;
&lt;br&gt;
mex('cholmex.c', [matlabroot, '/extern/lib/win32/lcc/libmwlapack.lib'])&lt;br&gt;
&lt;br&gt;
If your file is called &quot;cholmex.c&quot; and you are using the LCC compiler.&lt;br&gt;
&lt;br&gt;
Markus</description>
    </item>
  </channel>
</rss>

