Go to the documentation of this file.00001 #ifndef OPENTISSUE_CORE_MATH_BIG_BIG_DIAG_H
00002 #define OPENTISSUE_CORE_MATH_BIG_BIG_DIAG_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/core/math/big/big_types.h>
00013
00014 namespace OpenTissue
00015 {
00016 namespace math
00017 {
00018 namespace big
00019 {
00020
00029 template<typename value_type, typename matrix_type>
00030 inline void diag( ublas::vector<value_type> const & v, matrix_type & D )
00031 {
00032 size_t const n = v.size();
00033 assert( n>0 || !"diag(): n was out of range");
00034 D.resize(n,n,false);
00035 D.clear();
00036 for(size_t i=0;i<n;++i)
00037 D(i,i) = v(i);
00038 }
00039
00040 }
00041 }
00042 }
00043
00044
00045 #endif