Menu

[r131]: / trunk / include / dgematrix- / dgematrix-cast.hpp  Maximize  Restore  History

Download this file

37 lines (31 with data), 994 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//=============================================================================
/*! cast to _zgematrix */
inline _zgematrix dgematrix::to_zgematrix() const
{VERBOSE_REPORT;
zgematrix newmat(m,n);
for(long i=0; i<m*n; i++){
newmat.array[i] =comple(array[i],0.0);
}
return _(newmat);
}
//=============================================================================
/*! cast to dgematrix_small */
template<long _m, long _n>
inline dgematrix_small<_m,_n> dgematrix::to_dgematrix_small() const
{VERBOSE_REPORT;
#ifdef CPPL_DEBUG
if( m!=_m || n!=_n ){
std::cerr << "[ERROR]@dgematrix::to_dgematrix_small() const" << std::endl
<< "size mismatch." << std::endl
<< "Your input was from " << m << "x" << n << " to " << _m << "x" << _n << "." << std::endl;
exit(1);
}
#endif//CPPL_DEBUG
dgematrix_small<_m,_n> newmat;
for(long i=0; i<m; i++){
for(long j=0; j<n; j++){
newmat(i,j) =(*this)(i,j);
}
}
return newmat;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.