SparseLU_copy_to_ucol.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  * NOTE: This file is the modified version of [s,d,c,z]copy_to_ucol.c file in SuperLU 
00012  
00013  * -- SuperLU routine (version 2.0) --
00014  * Univ. of California Berkeley, Xerox Palo Alto Research Center,
00015  * and Lawrence Berkeley National Lab.
00016  * November 15, 1997
00017  *
00018  * Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
00019  *
00020  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
00021  * EXPRESSED OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
00022  *
00023  * Permission is hereby granted to use or copy this program for any
00024  * purpose, provided the above notices are retained on all copies.
00025  * Permission to modify the code and to distribute modified code is
00026  * granted, provided the above notices are retained, and a notice that
00027  * the code was modified is included with the above copyright notice.
00028  */
00029 #ifndef SPARSELU_COPY_TO_UCOL_H
00030 #define SPARSELU_COPY_TO_UCOL_H
00031 
00032 namespace Eigen {
00033 namespace internal {
00034 
00049 template <typename Scalar, typename Index>
00050 Index SparseLUImpl<Scalar,Index>::copy_to_ucol(const Index jcol, const Index nseg, IndexVector& segrep, BlockIndexVector repfnz ,IndexVector& perm_r, BlockScalarVector dense, GlobalLU_t& glu)
00051 {  
00052   Index ksub, krep, ksupno; 
00053     
00054   Index jsupno = glu.supno(jcol);
00055   
00056   // For each nonzero supernode segment of U[*,j] in topological order 
00057   Index k = nseg - 1, i; 
00058   Index nextu = glu.xusub(jcol); 
00059   Index kfnz, isub, segsize; 
00060   Index new_next,irow; 
00061   Index fsupc, mem; 
00062   for (ksub = 0; ksub < nseg; ksub++)
00063   {
00064     krep = segrep(k); k--; 
00065     ksupno = glu.supno(krep); 
00066     if (jsupno != ksupno ) // should go into ucol(); 
00067     {
00068       kfnz = repfnz(krep); 
00069       if (kfnz != emptyIdxLU)
00070       { // Nonzero U-segment 
00071         fsupc = glu.xsup(ksupno); 
00072         isub = glu.xlsub(fsupc) + kfnz - fsupc; 
00073         segsize = krep - kfnz + 1; 
00074         new_next = nextu + segsize; 
00075         while (new_next > glu.nzumax) 
00076         {
00077           mem = memXpand<ScalarVector>(glu.ucol, glu.nzumax, nextu, UCOL, glu.num_expansions); 
00078           if (mem) return mem; 
00079           mem = memXpand<IndexVector>(glu.usub, glu.nzumax, nextu, USUB, glu.num_expansions); 
00080           if (mem) return mem; 
00081           
00082         }
00083         
00084         for (i = 0; i < segsize; i++)
00085         {
00086           irow = glu.lsub(isub); 
00087           glu.usub(nextu) = perm_r(irow); // Unlike the L part, the U part is stored in its final order
00088           glu.ucol(nextu) = dense(irow); 
00089           dense(irow) = Scalar(0.0); 
00090           nextu++;
00091           isub++;
00092         }
00093         
00094       } // end nonzero U-segment 
00095       
00096     } // end if jsupno 
00097     
00098   } // end for each segment
00099   glu.xusub(jcol + 1) = nextu; // close U(*,jcol)
00100   return 0; 
00101 }
00102 
00103 } // namespace internal
00104 } // end namespace Eigen
00105 
00106 #endif // SPARSELU_COPY_TO_UCOL_H


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 12:00:34