SCM

SCM Repository

[matrix] View of /www/doxygen/CHMfactor_8c-source.html
ViewVC logotype

View of /www/doxygen/CHMfactor_8c-source.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (download) (as text) (annotate)
Wed Jan 2 17:03:19 2008 UTC (11 years, 8 months ago) by dmbates
File size: 7929 byte(s)
Added doxygen documentation
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Matrix: CHMfactor.c Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
  <ul>
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
  </ul>
</div>
<h1>CHMfactor.c</h1><a href="CHMfactor_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001                                 <span class="comment">/* CHOLMOD factors */</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include "<a class="code" href="CHMfactor_8h.html">CHMfactor.h</a>"</span>
<a name="l00003"></a>00003 
<a name="l00004"></a><a class="code" href="CHMfactor_8h.html#65d766e6b16a370b3057acf81b4c6f1a">00004</a> SEXP <a class="code" href="CHMfactor_8c.html#65d766e6b16a370b3057acf81b4c6f1a">CHMfactor_to_sparse</a>(SEXP x)
<a name="l00005"></a>00005 {
<a name="l00006"></a>00006     <a class="code" href="chm__common_8h.html#46821edd5f96e6452825a9faff530128">CHM_FR</a> L = <a class="code" href="chm__common_8h.html#de1afdf986f10e6cf03c5061e3fa9b3e">AS_CHM_FR</a>(x), Lcp;
<a name="l00007"></a>00007     <a class="code" href="chm__common_8h.html#1a47b00141f8a86eb3d071242cdec825">CHM_SP</a> Lm;
<a name="l00008"></a>00008     R_CheckStack();
<a name="l00009"></a>00009 
<a name="l00010"></a>00010     <span class="comment">/* cholmod_factor_to_sparse changes its first argument. Make a copy */</span>
<a name="l00011"></a>00011     Lcp = cholmod_copy_factor(L, &amp;<a class="code" href="chm__common_8c.html#c2b5dcf1f18e620b15b2e284dd9f6bd4">c</a>);
<a name="l00012"></a>00012     <span class="keywordflow">if</span> (!(Lcp-&gt;is_ll))
<a name="l00013"></a>00013         <span class="keywordflow">if</span> (!cholmod_change_factor(Lcp-&gt;xtype, 1, 0, 1, 1, Lcp, &amp;<a class="code" href="chm__common_8c.html#c2b5dcf1f18e620b15b2e284dd9f6bd4">c</a>))
<a name="l00014"></a>00014             error(<a class="code" href="Mutils_8h.html#32a3cf3d9dd914f5aeeca5423c157934">_</a>(<span class="stringliteral">"cholmod_change_factor failed with status %d"</span>), <a class="code" href="chm__common_8c.html#c2b5dcf1f18e620b15b2e284dd9f6bd4">c</a>.status);
<a name="l00015"></a>00015     Lm = cholmod_factor_to_sparse(Lcp, &amp;<a class="code" href="chm__common_8c.html#c2b5dcf1f18e620b15b2e284dd9f6bd4">c</a>); cholmod_free_factor(&amp;Lcp, &amp;<a class="code" href="chm__common_8c.html#c2b5dcf1f18e620b15b2e284dd9f6bd4">c</a>);
<a name="l00016"></a>00016     <span class="keywordflow">return</span> <a class="code" href="chm__common_8c.html#7aa1a6e564c24a55b031b5c03b3313f4" title="Copy the contents of a to an appropriate CsparseMatrix object and, optionally, free...">chm_sparse_to_SEXP</a>(Lm, 1<span class="comment">/*do_free*/</span>, -1<span class="comment">/*uploT*/</span>, 0<span class="comment">/*Rkind*/</span>,
<a name="l00017"></a>00017                               <span class="stringliteral">"N"</span><span class="comment">/*non_unit*/</span>, R_NilValue<span class="comment">/*dimNames*/</span>);
<a name="l00018"></a>00018 }
<a name="l00019"></a>00019 
<a name="l00020"></a><a class="code" href="CHMfactor_8h.html#8651ba67f85b2a18a8b2b1b23a392219">00020</a> SEXP <a class="code" href="CHMfactor_8c.html#15222009b843f42503fa463de01397ac">CHMfactor_solve</a>(SEXP a, SEXP b, SEXP system)
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022     <a class="code" href="chm__common_8h.html#46821edd5f96e6452825a9faff530128">CHM_FR</a> L = <a class="code" href="chm__common_8h.html#de1afdf986f10e6cf03c5061e3fa9b3e">AS_CHM_FR</a>(a);
<a name="l00023"></a>00023     SEXP bb = PROTECT(<a class="code" href="Mutils_8c.html#574d0797f3bfb4cb555038c8d90cceb8">dup_mMatrix_as_dgeMatrix</a>(b));
<a name="l00024"></a>00024     <a class="code" href="chm__common_8h.html#a416c4fbd43f275b63b81b32cff10811">CHM_DN</a> B = <a class="code" href="chm__common_8h.html#aa0424486b25ff64e947e1946f1c1b2c">AS_CHM_DN</a>(bb), X;
<a name="l00025"></a>00025     <span class="keywordtype">int</span> sys = asInteger(system);
<a name="l00026"></a>00026     R_CheckStack();
<a name="l00027"></a>00027 
<a name="l00028"></a>00028     <span class="keywordflow">if</span> (!(sys--))               <span class="comment">/* -- align with CHOLMOD defs */</span>
<a name="l00029"></a>00029         error(<a class="code" href="Mutils_8h.html#32a3cf3d9dd914f5aeeca5423c157934">_</a>(<span class="stringliteral">"system argument is not valid"</span>));
<a name="l00030"></a>00030 
<a name="l00031"></a>00031     X = cholmod_solve(sys, L, B, &amp;<a class="code" href="chm__common_8c.html#c2b5dcf1f18e620b15b2e284dd9f6bd4">c</a>);
<a name="l00032"></a>00032     UNPROTECT(1);
<a name="l00033"></a>00033     <span class="keywordflow">return</span> <a class="code" href="chm__common_8c.html#c0552f8d5248824ec90a314b69bd1408" title="Copy the contents of a to an appropriate denseMatrix object and, optionally, free...">chm_dense_to_SEXP</a>(X, 1<span class="comment">/*do_free*/</span>, 0<span class="comment">/*Rkind*/</span>,
<a name="l00034"></a>00034                              GET_SLOT(bb, <a class="code" href="Syms_8h.html#93d8b8a3cd9c897599b3e2d996821a0b">Matrix_DimNamesSym</a>));
<a name="l00035"></a>00035 }
<a name="l00036"></a>00036 
<a name="l00037"></a><a class="code" href="CHMfactor_8h.html#ae1511a0bca842168f9bf6ae554eda88">00037</a> SEXP <a class="code" href="CHMfactor_8c.html#0b91bc65ce8655713f5b71d484897408">CHMfactor_spsolve</a>(SEXP a, SEXP b, SEXP system)
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039     <a class="code" href="chm__common_8h.html#46821edd5f96e6452825a9faff530128">CHM_FR</a> L = <a class="code" href="chm__common_8h.html#de1afdf986f10e6cf03c5061e3fa9b3e">AS_CHM_FR</a>(a);
<a name="l00040"></a>00040     <a class="code" href="chm__common_8h.html#1a47b00141f8a86eb3d071242cdec825">CHM_SP</a> B = <a class="code" href="chm__common_8h.html#181c1e5f964ecab945a22c5309500afd">AS_CHM_SP</a>(b);
<a name="l00041"></a>00041     <span class="keywordtype">int</span> sys = asInteger(system);
<a name="l00042"></a>00042     R_CheckStack();
<a name="l00043"></a>00043 
<a name="l00044"></a>00044     <span class="keywordflow">if</span> (!(sys--))               <span class="comment">/* -- align with CHOLMOD defs */</span>
<a name="l00045"></a>00045         error(<a class="code" href="Mutils_8h.html#32a3cf3d9dd914f5aeeca5423c157934">_</a>(<span class="stringliteral">"system argument is not valid"</span>));
<a name="l00046"></a>00046     <span class="keywordflow">return</span> <a class="code" href="chm__common_8c.html#7aa1a6e564c24a55b031b5c03b3313f4" title="Copy the contents of a to an appropriate CsparseMatrix object and, optionally, free...">chm_sparse_to_SEXP</a>(cholmod_spsolve(sys, L, B, &amp;<a class="code" href="chm__common_8c.html#c2b5dcf1f18e620b15b2e284dd9f6bd4">c</a>),
<a name="l00047"></a>00047                               1<span class="comment">/*do_free*/</span>, 0<span class="comment">/*uploT*/</span>, 0<span class="comment">/*Rkind*/</span>,
<a name="l00048"></a>00048                               <span class="stringliteral">""</span>, GET_SLOT(b, <a class="code" href="Syms_8h.html#93d8b8a3cd9c897599b3e2d996821a0b">Matrix_DimNamesSym</a>));
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 2 09:18:58 2008 for Matrix by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
</body>
</html>

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge