6 if( i<0 || j<0 ||
m<=i || n<=j || i-j>
kl || j-i>
ku ){
8 std::cerr <<
"The required component is out of the matrix size." << std::endl
9 <<
"Your input is (" << i <<
"," << j <<
"), whereas the matrix size is " <<
m <<
"x" <<
n <<
" with kl=" <<
kl <<
", ku=" <<
ku <<
"." << std::endl;
23 if( i<0 || j<0 ||
m<=i || n<=j || i-j>
kl || j-i>
ku ){
25 std::cerr <<
"The required component is out of the matrix size." << std::endl
26 <<
"Your input is (" << i <<
"," << j <<
"), whereas the matrix size is " <<
m <<
"x" <<
n <<
" with kl=" <<
kl <<
", ku=" <<
ku <<
"." << std::endl;
44 if( i<0 || j<0 ||
m<=i || n<=j || i-j>
kl || j-i>
ku ){
46 std::cerr <<
"The required component is out of the matrix size." << std::endl
47 <<
"Your input is (" << i <<
"," << j <<
"), whereas the matrix size is " <<
m <<
"x" <<
n <<
" with kl=" <<
kl <<
", ku=" <<
ku <<
"." << std::endl;
64 for(CPPL_INT
i=0;
i<mat.
m;
i++){
65 for(CPPL_INT j=0; j<mat.
n; j++){
66 if(
i-j>mat.
kl || j-
i>mat.
ku ){ s <<
" x"; }
67 else{ s <<
" " << mat(
i,j); }
82 std::ofstream ofs(filename, std::ios::trunc);
83 ofs.setf(std::cout.flags());
84 ofs.precision(std::cout.precision());
85 ofs.width(std::cout.width());
86 ofs.fill(std::cout.fill());
88 ofs <<
"#dgbmatrix" <<
" " <<
m <<
" " <<
n <<
" " <<
kl <<
" " <<
ku << std::endl;
90 for(CPPL_INT
i=0;
i<
m;
i++){
91 const CPPL_INT jmax =std::min(
n,
i+
ku+1);
92 for(CPPL_INT j=std::max(CPPL_INT(0),
i-
kl); j<jmax; j++){
103 {CPPL_VERBOSE_REPORT;
104 std::ifstream s( filename );
107 std::cerr <<
"The file \"" << filename <<
"\" can not be opened." << std::endl;
113 if(
id !=
"dgbmatrix" &&
id !=
"#dgbmatrix" ){
115 std::cerr <<
"The type name of the file \"" << filename <<
"\" is not dgbmatrix." << std::endl
116 <<
"Its type name was " <<
id <<
" ." << std::endl;
123 for(CPPL_INT
i=0;
i<
m;
i++){
124 const CPPL_INT jmax =std::min(
n,
i+ku+1);
125 for(CPPL_INT j=std::max(CPPL_INT(0),
i-
kl); j<jmax; j++){
131 std::cerr <<
"There is something is wrong with the file \"" << filename <<
"\"." << std::endl
132 <<
"Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl;
139 std::cerr <<
"There is something is wrong with the file \"" << filename <<
"\"." << std::endl
140 <<
"Most likely, there are extra data components." << std::endl;
friend _dgematrix i(const dgbmatrix &)
CPPL_INT m
matrix row size
dgbmatrix & set(const CPPL_INT &, const CPPL_INT &, const double &)
double ** darray
array of pointers of column head addresses
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT kl
lower band width
CPPL_INT ku
upper band width
void write(const char *) const
dgbmatrix & resize(const CPPL_INT &, const CPPL_INT &, const CPPL_INT &, const CPPL_INT &)
Real Double-precision General Band Matrix Class.
std::ostream & operator<<(std::ostream &s, const dgbmatrix &mat)
double & operator()(const CPPL_INT &, const CPPL_INT &)
CPPL_INT n
matrix column size