SparseLU_Utils.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>
00005 //
00006 // This Source Code Form is subject to the terms of the Mozilla
00007 // Public License v. 2.0. If a copy of the MPL was not distributed
00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009 
00010 
00011 #ifndef EIGEN_SPARSELU_UTILS_H
00012 #define EIGEN_SPARSELU_UTILS_H
00013 
00014 namespace Eigen {
00015 namespace internal {
00016 
00020 template <typename Scalar, typename Index>
00021 void SparseLUImpl<Scalar,Index>::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu)
00022 {
00023  nnzL = 0; 
00024  nnzU = (glu.xusub)(n); 
00025  Index nsuper = (glu.supno)(n); 
00026  Index jlen; 
00027  Index i, j, fsupc;
00028  if (n <= 0 ) return; 
00029  // For each supernode
00030  for (i = 0; i <= nsuper; i++)
00031  {
00032    fsupc = glu.xsup(i); 
00033    jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); 
00034    
00035    for (j = fsupc; j < glu.xsup(i+1); j++)
00036    {
00037      nnzL += jlen; 
00038      nnzU += j - fsupc + 1; 
00039      jlen--; 
00040    }
00041  }
00042 }
00043 
00051 template <typename Scalar, typename Index>
00052 void SparseLUImpl<Scalar,Index>::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu)
00053 {
00054   Index fsupc, i, j, k, jstart; 
00055   
00056   Index nextl = 0; 
00057   Index nsuper = (glu.supno)(n); 
00058   
00059   // For each supernode 
00060   for (i = 0; i <= nsuper; i++)
00061   {
00062     fsupc = glu.xsup(i); 
00063     jstart = glu.xlsub(fsupc); 
00064     glu.xlsub(fsupc) = nextl; 
00065     for (j = jstart; j < glu.xlsub(fsupc + 1); j++)
00066     {
00067       glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A
00068       nextl++;
00069     }
00070     for (k = fsupc+1; k < glu.xsup(i+1); k++)
00071       glu.xlsub(k) = nextl; // other columns in supernode i
00072   }
00073   
00074   glu.xlsub(n) = nextl; 
00075 }
00076 
00077 } // end namespace internal
00078 
00079 } // end namespace Eigen
00080 #endif // EIGEN_SPARSELU_UTILS_H


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:39:23