RTOp_SparseSubVector.h

Go to the documentation of this file.
00001 /*
00002 // @HEADER
00003 // ***********************************************************************
00004 // 
00005 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00006 //                  Copyright (2003) Sandia Corporation
00007 // 
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //  
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA
00025 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00026 // 
00027 // ***********************************************************************
00028 // @HEADER
00029 */
00030 
00031 #ifndef RTOP_SPARSE_SUB_VECTOR_H
00032 #define RTOP_SPARSE_SUB_VECTOR_H
00033 
00034 #include <stddef.h>
00035 
00036 #include "RTOp.h"
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 /* */
00118 struct RTOp_SparseSubVector {
00119   /* Offset for the sub-vector into the global vector */
00120   RTOp_index_type                  global_offset;
00121   /* Dimension of the sub-vector */
00122   RTOp_index_type                  sub_dim;
00123   /* Number of nonzero elements (<tt>sub_nz == sub_dim</tt> for dense vectors) */
00124   RTOp_index_type                  sub_nz;
00125   /* Array (size min{|<tt>value_stride*sub_nz</tt>|,1}) for the values in the vector */
00126   const RTOp_value_type            *values;
00127   /* Stride between elements in <tt>values[]</tt> */
00128   ptrdiff_t                        values_stride;
00129   /* */
00133   const RTOp_index_type            *indices;
00134   /* Stride between indices in indices[] (sparse vectors only) */
00135   ptrdiff_t                        indices_stride;
00136   /* Offset of indices[] into local sub-vector (sparse vectors only) */
00137   ptrdiff_t                        local_offset;
00138   /* If <tt>is_sorted == 0</tt> then the vector is not sorted, otherwise it is sorted (sparse vectors only) */
00139   int                              is_sorted;
00140 };
00141 
00142 /* */
00145 void RTOp_sparse_sub_vector(
00146   RTOp_index_type global_offset, RTOp_index_type sub_dim, RTOp_index_type sub_nz
00147   ,const RTOp_value_type values[], ptrdiff_t values_stride
00148   ,const RTOp_index_type indices[], ptrdiff_t indices_stride
00149   ,ptrdiff_t local_offset, int is_sorted
00150   ,struct RTOp_SparseSubVector *sub_vec
00151   );
00152 /* */
00155 void RTOp_sparse_sub_vector_null( struct RTOp_SparseSubVector *sub_vec );
00156 
00157 /* */
00160 void RTOp_sparse_sub_vector_from_dense(
00161   const struct RTOp_SubVector     *sub_vec
00162   ,struct RTOp_SparseSubVector    *spc_sub_vec
00163   );
00164 
00165 #ifdef __cplusplus
00166 }
00167 #endif
00168 
00169 #endif /* RTOP_SPARSE_SUB_VECTOR_H */

Generated on Tue Oct 20 12:51:49 2009 for MOOCHO (Single Doxygen Collection) by doxygen 1.4.7