00001 // Software License for MTL 00002 // 00003 // Copyright (c) 2007 The Trustees of Indiana University. 00004 // 2008 Dresden University of Technology and the Trustees of Indiana University. 00005 // All rights reserved. 00006 // Authors: Peter Gottschling and Andrew Lumsdaine 00007 // 00008 // This file is part of the Matrix Template Library 00009 // 00010 // See also license.mtl.txt in the distribution. 00011 00012 #ifndef MTL_FILL_INCLUDE 00013 #define MTL_FILL_INCLUDE 00014 00015 #include <algorithm> 00016 00017 namespace mtl { 00018 00019 // Sets all values of a matrix 00020 template <class Matrix> 00021 void fill(Matrix& ma, typename Matrix::value_type value) 00022 { 00023 std::fill(ma.elements(), ma.elements()+ma.num_elements(), value); 00024 } 00025 00026 // Temporary solution 00027 // will be replaced by sequences and cursors generated by begin<all>(ma) and end<all>(ma) 00028 // Using segmented cursors, matrices with non-contigous element storing can be handled 00029 00030 } // namespace mtl 00031 00032 #endif // MTL_FILL_INCLUDE