7 for(CPPL_INT
i=0;
i<n;
i++){
8 for(CPPL_INT j=0; j<=
i; j++){ newmat(
i,j) =(*this)(
i,j); }
9 for(CPPL_INT j=
i+1; j<n; j++){ newmat(
i,j) =(*this)(j,
i); }
20 for(CPPL_INT
i=0;
i<n;
i++){
21 for(CPPL_INT j=0; j<=
i; j++){
22 newmat(
i,j) =(*this)(
i,j);
43 std::cerr <<
"i must be greater than or equal to j since dsymatrix_small is L strage. " << std::endl;
44 std::cerr <<
"Your input was (" << i <<
", " << j <<
")." << std::endl;
50 return array[(i*(i+1))/2 +j];
61 std::cerr <<
"i must be greater than or equal to j since dsymatrix_small is L strage. " << std::endl;
62 std::cerr <<
"Your input was (" << i <<
", " << j <<
")." << std::endl;
68 return array[(i*(i+1))/2 +j];
83 inline std::ostream& operator<<(std::ostream& s, const dsymatrix_small<n>& A)
85 s << std::setiosflags(std::ios::showpos);
86 for(CPPL_INT
i=0;
i<n;
i++){
87 for(CPPL_INT j=0; j<=
i; j++){ s <<
" " << A(
i,j) <<
" "<< std::flush; }
88 for(CPPL_INT j=
i+1; j<n; j++){ s <<
"{" << A(j,
i) <<
"}" << std::flush; }
99 std::ofstream ofs(filename, std::ios::trunc);
100 ofs.setf(std::cout.flags());
101 ofs.precision(std::cout.precision());
102 ofs.width(std::cout.width());
103 ofs.fill(std::cout.fill());
104 ofs <<
"#dsymatrix" <<
" " << n << std::endl;
105 for(CPPL_INT
i=0;
i<n;
i++){
106 for(CPPL_INT j=0; j<=
i; j++){
107 ofs << (*this)(
i,j) <<
" ";
118 {CPPL_VERBOSE_REPORT;
119 std::ifstream s(filename);
122 std::cerr <<
"The file \"" << filename <<
"\" can not be opened." << std::endl;
128 if(
id !=
"dsymatrix" &&
id !=
"#dsymatrix" ){
130 std::cerr <<
"The type name of the file \"" << filename <<
"\" is not dsymatrix." << std::endl
131 <<
"Its type name was " <<
id <<
" ." << std::endl;
139 std::cerr <<
"Matrix size is invalid." << std::endl;
143 for(CPPL_INT
i=0;
i<n;
i++){
144 for(CPPL_INT j=0; j<=
i; j++ ){
145 s >> operator()(
i,j);
150 std::cerr <<
"There is something is wrong with the file \"" << filename <<
"\"." << std::endl
151 <<
"Most likely, there is a lack of data components, or a linefeed code or space code is missing at the end of the last line." << std::endl;
169 {CPPL_VERBOSE_REPORT;
170 for(CPPL_INT
i=0;
i<n;
i++){
171 for(CPPL_INT j=0; j<=
i; j++){
182 {CPPL_VERBOSE_REPORT;
184 for(CPPL_INT k=0; k<n; k++){
194 {CPPL_VERBOSE_REPORT;
196 for(CPPL_INT
i=0;
i<n;
i++){
206 {CPPL_VERBOSE_REPORT;
208 for(
int i=0;
i<n;
i++){
209 for(
int j=0; j<=
i; j++){
210 if( max<fabs(A(
i,j)) ){
224 {CPPL_VERBOSE_REPORT;
242 {CPPL_VERBOSE_REPORT;
243 for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ A.
array[k]+=B.
array[k]; }
251 {CPPL_VERBOSE_REPORT;
252 for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ A.
array[k]-=B.
array[k]; }
260 {CPPL_VERBOSE_REPORT;
261 for(CPPL_INT
i=0;
i<n;
i++){
262 for(CPPL_INT j=0; j<=
i; j++){
273 {CPPL_VERBOSE_REPORT;
274 for(CPPL_INT
i=0;
i<n;
i++){
275 for(CPPL_INT j=0; j<=
i; j++){
290 {CPPL_VERBOSE_REPORT;
298 {CPPL_VERBOSE_REPORT;
300 for(CPPL_INT
i=0;
i<n;
i++){
301 for(CPPL_INT j=0; j<=
i; j++){
316 {CPPL_VERBOSE_REPORT;
318 for(CPPL_INT
i=0;
i<n;
i++){
319 for(CPPL_INT j=0; j<
i; j++){
320 X(i,j) =A(i,j)+B(i,j);
322 for(CPPL_INT j=i; j<n; j++){
323 X(i,j) =A(j,i)+B(i,j);
333 {CPPL_VERBOSE_REPORT;
335 for(CPPL_INT
i=0;
i<n;
i++){
336 for(CPPL_INT j=0; j<=
i; j++){
337 X(
i,j) =A(
i,j)+B(
i,j);
348 {CPPL_VERBOSE_REPORT;
350 for(CPPL_INT
i=0;
i<n;
i++){
351 for(CPPL_INT j=0; j<
i; j++){
352 X(i,j) =A(i,j)-B(i,j);
354 for(CPPL_INT j=i; j<n; j++){
355 X(i,j) =A(j,i)-B(i,j);
365 {CPPL_VERBOSE_REPORT;
367 for(CPPL_INT
i=0;
i<n;
i++){
368 for(CPPL_INT j=0; j<=
i; j++){
369 X(
i,j) =A(
i,j)-B(
i,j);
379 {CPPL_VERBOSE_REPORT;
382 for(CPPL_INT
i=0;
i<n;
i++){
383 for(CPPL_INT j=0; j<
i; j++){
386 for(CPPL_INT j=i; j<n; j++){
395 template<CPPL_INT m, CPPL_INT n>
397 {CPPL_VERBOSE_REPORT;
400 for(CPPL_INT
i=0;
i<m;
i++){
401 for(CPPL_INT j=0; j<n; j++){
402 for(CPPL_INT k=0; k<
i; k++){
403 X(i,j) +=A(i,k)*B(k,j);
405 for(CPPL_INT k=i; k<m; k++){
406 X(i,j) +=A(k,i)*B(k,j);
417 {CPPL_VERBOSE_REPORT;
420 for(CPPL_INT
i=0;
i<n;
i++){
421 for(CPPL_INT j=0; j<
i; j++){
422 for(CPPL_INT k=0; k<j; k++){
423 X(i,j) +=A(i,k)*B(j,k);
425 for(CPPL_INT k=j; k<
i; k++){
426 X(i,j) +=A(i,k)*B(k,j);
428 for(CPPL_INT k=i; k<n; k++){
429 X(i,j) +=A(k,i)*B(k,j);
432 for(CPPL_INT j=i; j<n; j++){
433 for(CPPL_INT k=0; k<
i; k++){
434 X(i,j) +=A(i,k)*B(j,k);
436 for(CPPL_INT k=i; k<j; k++){
437 X(i,j) +=A(k,i)*B(j,k);
439 for(CPPL_INT k=j; k<n; k++){
440 X(i,j) +=A(k,i)*B(k,j);
451 {CPPL_VERBOSE_REPORT;
453 for(CPPL_INT
i=0;
i<n;
i++){
454 for(CPPL_INT j=0; j<=
i; j++){
465 {CPPL_VERBOSE_REPORT;
467 for(CPPL_INT
i=0;
i<n;
i++){
468 for(CPPL_INT j=0; j<=
i; j++){
483 {CPPL_VERBOSE_REPORT;
485 for(CPPL_INT
i=0;
i<n;
i++){
486 for(CPPL_INT j=0; j<=
i; j++){
487 C(
i,j) =A(
i,j)*B(
i,j);
489 for(CPPL_INT j=
i+1; j<n; j++){
490 C(
i,j) =A(j,
i)*B(
i,j);
500 {CPPL_VERBOSE_REPORT;
502 for(CPPL_INT
i=0;
i<n;
i++){
503 for(CPPL_INT j=0; j<=
i; j++){
504 C(
i,j) =A(
i,j)*B(
i,j);
dsymatrix_small< n > & operator/=(dsymatrix_small< n > &A, const double &v)
const dsymatrix_small< n > & operator+(const dsymatrix_small< n > &A)
void write(const char *filename) const
dcovector_small< l > & zero()
Samll Real Double-precision Symmetric Matrix Class.
dsymatrix_small< n > & identity()
dsymatrix_small< n > & operator*=(dsymatrix_small< n > &A, const double &v)
dsymatrix_small< n > & operator+=(dsymatrix_small< n > &A, const dsymatrix_small< n > &B)
Samll Real Double-precision General Dence Matrix Class.
dgematrix_small< n, n > to_dgematrix_small() const
_dgematrix i(const _dgbmatrix &mat)
double damax(const dsymatrix_small< n > &A)
dgematrix_small< m, n > & zero()
dsymatrix to_dsymatrix() const
Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].
dsymatrix_small< n > operator-(const dsymatrix_small< n > &A)
void idamax(CPPL_INT &I, CPPL_INT &J, const dsymatrix_small< n > &A)
dsymatrix_small< n > & set(const CPPL_INT &, const CPPL_INT &, const double &)
dsymatrix_small< n > operator/(const dsymatrix_small< n > &A, const double &v)
void read(const char *filename)
dsymatrix_small< n > & operator-=(dsymatrix_small< n > &A, const dsymatrix_small< n > &B)
dgematrix_small< n, n > hadamerd(const dsymatrix_small< n > &A, const dgematrix_small< n, n > &B)
dcovector_small< n > operator*(const dsymatrix_small< n > &A, const dcovector_small< n > &B)
Samll Real Double-precision Column Vector Class.
double trace(const dsymatrix_small< n > &A)
double & operator()(const CPPL_INT &i, const CPPL_INT &j)
dsymatrix_small< n > & zero()
double array[(n *(n+1))/2]
1D array to store vector data