LifeV
RNM.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief Container class for multidimensional arrays
30 
31  @contributor Matteo Astorino <matteo.astorino@epfl.ch>
32  @mantainer Matteo Astorino <matteo.astorino@epfl.ch>
33 
34  */
35 
36 #ifndef KNM_H_
37 #define KNM_H_
38 
39 // une tentative qui ne marche pas
40 // de tableau constant
41 #include <cassert>
42 #include <iostream>
43 #include <iomanip>
44 
45 #include <cmath>
46 
47 //using namespace std;
48 #define const_R R
49 #ifdef CHECK_KN
50 #include <cstdlib>
51 inline void Check_Kn ( const char* str, const char* file, int line )
52 {
53  std::cerr << "CHECK_KN: " << str << " in file: " << file << ", line " << line << std::endl;
54  abort();
55 }
56 #define K_assert(i) if (!(i)) Check_Kn(#i,__FILE__,__LINE__);
57 
58 #else
59 #define K_assert(i)
60 #endif
61 // version du 29 fev 2000
62 // correction for (... lj++,ui++ qui apelle le produit scalaire
63 // petite correction assert
64 // ajoute de operateur /= et *= sur des vecteurs
65 // suppression de constructeur qui pose de probleme
66 // correction oper += ... dans RNM_op.h ligne 56 change = en oper
67 // version de 25 nov 99 sans const R
68 // ajoute de '.' pour extraire une colonne, ou ligne , ...
69 // version du 22 nov 1999 cast to KN_<const R>
70 // version du 21 nov 1999 correction delete
71 // version du 13 nov 1999
72 // version du 18 mars 99
73 // F. Hecht
74 // attention les indexations les indexations peuvent changer
75 // puisque que l'on peut prendre la transposer d'une matrice
76 // tableau
77 // mais ils partent de 0
78 // version corrigee du 15/11/98
79 // version avec sous tableau --- mars 99
80 // -------
81 // remarque du 8 mars 99 FH
82 // class pour prendre des sous-tableau
83 // attention aux PB de continute dans les tableaux
84 // on a supposer que les tableaux multi indices pouvait est vue comme
85 // un tableau continue ce qui est generalement faux quand l'on en
86 // prend un sous tableau
87 // exemple: un tableau 3,5 est numerote comme:
88 // 0 3 6 9 12
89 // 1 4 7 10 13
90 // 2 5 8 11 14
91 // step
92 // indexi n 1
93 // indexj m n
94 // est le sous tableau 3,3 n'est pas numeroter consecutivement
95 //
96 // Donc la fonction IsVector1() nous dit si un tableau
97 // � un 2 ou 3 indices est ou non consecutif en memoire
98 //
99 // ----------------------------------
100 // version du 21 novembre 2000 FH
101 // --- initialisation --
102 namespace LifeV
103 {
104 
105 template <class R>
106 class KNMKL_ ;
107 template <class R>
108 class KNMK_ ;
109 template <class R>
110 class KNM_ ;
111 template <class R>
112 class KN_ ;
113 
114 template <class R>
115 class KNMKL ;
116 template <class R>
117 class KNMK ;
118 template <class R>
119 class KNM ;
120 template <class R>
121 class KN ;
122 
123 template <class R>
124 class Add_KN_;
125 template <class R>
126 class Sub_KN_;
127 template <class R>
128 class Mulc_KN_;
129 template <class R>
130 class Add_Mulc_KN_;
131 template <class R>
132 class Mul_KNM_KN_;
133 template <class R>
134 class MatriceCreuseMulKN_;
135 template <class R>
136 class MatriceCreuseDivKN_;
137 
138 class ShapeOfArray;
139 
140 class FromTo
141 {
142 public:
143  int from, to;
144  FromTo ( int i, int j ) : from ( i ), to ( j )
145  {
146  K_assert ( i < j );
147  }
148 };
149 
150 class SubArray
151 {
152 public:
153  const int n, step, start;
154  // SubArray(char nn): n(-1),step(1),start(0) {}
155  explicit SubArray ( int nn, int sta = 0, int s = 1 ) : n ( nn ), step ( s ), start ( sta )
156  {}
157  SubArray ( const FromTo& ft ) : n ( ft.to - ft.from + 1 ), step ( 1 ), start ( ft.from )
158  {}
159  SubArray ( const ShapeOfArray& ); // all
160  int end() const
161  {
162  return start + step * n;
163  }
164  int last() const
165  {
166  return start + step * ( n - 1 );
167  }
168  int len1() const
169  {
170  return step * ( n - 1 );
171  }
172 };
173 
174 
176 {
177 protected:
178 public:
179 
180  const int n; // n nb of item
181  const int step; // step nb of between 2 item
182  const int next; // the next array of same type in matrix for subarray
183  // by default no next
184  ShapeOfArray ( const ShapeOfArray& s, int nn ) : n ( s.n ), step ( s.n ), next ( nn )
185  {}
186  ShapeOfArray ( int nn ) : n ( nn ), step ( 1 ), next ( -1 )
187  {}
188 
189  ShapeOfArray ( int nn, int s ) : n ( nn ), step ( s ), next ( -1 )
190  {}
191 
192  ShapeOfArray ( int nn, int s, int nextt ) : n ( nn ), step ( s ), next ( nextt )
193  {}
194 
195  ShapeOfArray ( const ShapeOfArray& old, const SubArray& sub )
196  : n ( sub.n ), step ( old.step* sub.step ), next ( old.next )
197  {
198  K_assert ( ( sub.last() ) * old.step <= old.last() );
199  } // a constructor
200 
201  ShapeOfArray ( const ShapeOfArray& old, int stepo, int start )
202  : n ( old.n - start ), step ( old.step* stepo ), next ( old.next )
203  {
204  K_assert ( n >= 0 );
205  }
206 
207  int end() const
208  {
209  return n * step;
210  }
211  int last() const
212  {
213  return ( n - 1 ) * step;
214  }
215  int constant() const
216  {
217  return step == 0;
218  }
219  int index ( int k ) const
220  {
221  K_assert ( ( k >= 0 ) && ( ( k < n ) || !step ) );
222  return step * k;
223  }
224  ShapeOfArray operator* ( int stepp ) const
225  {
226  return ShapeOfArray ( n, step * stepp, next );
227  }
228  bool SameShape ( const ShapeOfArray& a ) const
229  {
230  return !step || !a.step || a.n == n ;
231  }
232  int N ( const ShapeOfArray& a )
233  {
234  return step ? n : a.n;
235  } // size of 2 shape
236 
237 
238  // protected:
239  int operator[] ( int k ) const
240  {
241  K_assert ( ( k >= 0 ) && ( ( k < n ) || !step ) );
242  return step * k;
243  }
244 
245 };
246 
247 std::ostream& operator<< ( std::ostream& f, const ShapeOfArray& s );
248 
249 inline bool SameShape ( const ShapeOfArray& a, const ShapeOfArray& b )
250 {
251  return !a.step || !b.step || a.n == b.n ;
252 }
253 
254 inline int N ( const ShapeOfArray& a, const ShapeOfArray& b )
255 {
256  K_assert ( SameShape ( a, b ) );
257  return a.step ? a.n : b.n ;
258 }
259 
260 inline SubArray::SubArray ( const ShapeOfArray& s )
261  : n ( s.n ), step ( s.step ), start ( 0 )
262 {}
263 
264 
265 
266 
267 template <class R>
268 std::ostream& operator<< ( std::ostream& f, const KN_<const_R>& v ) ;
269 
270 
271 template <class R>
272 class KN_: public ShapeOfArray
273 {
274 protected:
275  R* v;
276 public:
277  int N() const
278  {
279  return this->n;
280  }
281  int size() const
282  {
283  return this->step ? N() * this->step : N();
284  }
285  operator R* () const
286  {
287  return this->v;
288  }
289  KN_ ( const KN_<R>& u ) : ShapeOfArray ( u ), v ( u.v )
290  {}
291  KN_ ( const KN_<R>& U, const SubArray& sa ) : ShapeOfArray ( U, sa ), v ( U.v + U.index ( sa.start ) )
292  {}
293 
294  KN_ operator() ( const SubArray& sa ) const
295  {
296  return KN_ ( *this, sa );
297  } // sub array
298  R& operator[] ( int i ) const
299  {
300  return v[ index ( i ) ];
301  }
302  R& operator() ( int i ) const
303  {
304  return v[ index ( i ) ];
305  }
306 
307  R operator, ( const KN_<const_R>& v ) const; // dot product
308 
309  const KN_& operator = ( const KN_<const_R>& u ) ;
310  const KN_& operator += ( const KN_<const_R>& u ) ;
311  const KN_& operator -= ( const KN_<const_R>& u ) ;
312 
313  const KN_& operator *= ( const KN_<const_R>& u ) ;
314  const KN_& operator /= ( const KN_<const_R>& u ) ;
315 
316 
317  const KN_& operator = ( const_R a ) ;
318  const KN_& operator += ( const_R a ) ;
319  const KN_& operator -= ( const_R a ) ;
320  const KN_& operator /= ( const_R a ) ;
321  const KN_& operator *= ( const_R a ) ;
322 
323  R KNMmin() const ; // min -> KNMmin to avoid clash name with aztec, JFG
324  R KNMmax() const ; // max -> KNMmax to avoid clash name with aztec, JFG
325  R sum() const ;
326  KN_& map ( R (* ) ( R ) );
327 
328  const KN_& operator = ( const Add_KN_<R>& u ) ;
329  const KN_& operator+= ( const Add_KN_<R>& u ) ;
330  const KN_& operator-= ( const Add_KN_<R>& u ) ;
331 
332  const KN_& operator = ( const Sub_KN_<R>& u ) ;
333  const KN_& operator-= ( const Sub_KN_<R>& u ) ;
334  const KN_& operator+= ( const Sub_KN_<R>& u ) ;
335 
336  const KN_& operator = ( const Mulc_KN_<R>& u ) ;
337  const KN_& operator+= ( const Mulc_KN_<R>& u ) ;
338  const KN_& operator-= ( const Mulc_KN_<R>& u ) ;
339 
340  const KN_& operator = ( const Add_Mulc_KN_<R>& u ) ;
341  const KN_& operator+= ( const Add_Mulc_KN_<R>& u ) ;
342  const KN_& operator-= ( const Add_Mulc_KN_<R>& u ) ;
343 
344  const KN_& operator = ( const Mul_KNM_KN_<R>& u ) ;
345  const KN_& operator+= ( const Mul_KNM_KN_<R>& u ) ;
346  const KN_& operator-= ( const Mul_KNM_KN_<R>& u ) ;
347 
348  const KN_& operator = ( const MatriceCreuseMulKN_<R>& ) ;
349  const KN_& operator = ( const MatriceCreuseDivKN_<R>& ) ;
350 
351  friend std::ostream& operator<< <R> ( std::ostream& f, const KN_<const_R>& v ) ;
352 
353 private:
354 
355  KN_& operator++()
356  {
357  K_assert ( next >= 0 );
358  v += next;
359  return *this;
360  } // ++U
361  KN_& operator--()
362  {
363  K_assert ( next >= 0 );
364  v -= next;
365  return *this;
366  } // --U
367  KN_ operator++ ( int )
368  {
369  K_assert ( next >= 0 );
370  KN_ old = *this;
371  v = v + next;
372  return old;
373  } // U++
374  KN_ operator-- ( int )
375  {
376  K_assert ( next >= 0 );
377  KN_ old = *this;
378  v = v - next;
379  return old;
380  } // U++
381 
382  KN_ ( R* u, const ShapeOfArray& s ) : ShapeOfArray ( s ), v ( u )
383  {}
384  KN_ ( R* u, int nn, int s ) : ShapeOfArray ( nn, s ), v ( u )
385  {}
386  KN_ ( R* u, int nn, int s, int nextt ) : ShapeOfArray ( nn, s, nextt ), v ( u )
387  {}
388  KN_ ( R* u, int nn ) : ShapeOfArray ( nn ), v ( u )
389  {}
390  KN_ ( const KN_<R>& u, int offset ) : ShapeOfArray ( u ), v ( &u[ offset ] )
391  {}
392  KN_ ( const KN_<R>& u, const ShapeOfArray& sh, int startv = 0 )
393  : ShapeOfArray ( sh* u.step ), v ( &u[ startv ] )
394  {}
395  KN_ ( const KN_<R>& u, int nnext, const ShapeOfArray& sh, int startv = 0 )
396  : ShapeOfArray ( sh.n, sh.step* u.step, nnext ), v ( &u[ startv ] )
397  { }
398 
399 
400  // friend class KN_<R>;
401  friend class KNM_<R>;
402  friend class KNMK_<R>;
403  friend class KNMKL_<R>;
404  friend class KN<R>;
405  friend class KNM<R>;
406  friend class KNMK<R>;
407  friend class KNMKL<R>;
408 
409 };
410 
411 template <class R>
412 class KNM_: public KN_<R>
413 {
414 public:
417 public:
418  int IsVector1() const
419  {
420  return ( shapei.n * shapej.n ) == this->n ;
421  }
422  int N() const
423  {
424  return shapei.n;
425  }
426  int M() const
427  {
428  return shapej.n;
429  }
430  int size() const
431  {
432  return shapei.n * shapej.n;
433  }
434 
435  KNM_ ( R* u, const ShapeOfArray& s,
436  const ShapeOfArray& si,
437  const ShapeOfArray& sj )
438  : KN_<R> ( u, s ), shapei ( si ), shapej ( sj )
439  {}
440  KNM_ ( R* u, int n, int m )
441  : KN_<R> ( u, ShapeOfArray ( n* m ) ), shapei ( n, 1, n ), shapej ( m, n, 1 )
442  {}
443  KNM_ ( R* u, int n, int m, int s )
444  : KN_<R> ( u, ShapeOfArray ( n* m, s ) ), shapei ( n, 1, n ), shapej ( m, n, 1 )
445  {}
446  KNM_ ( KN_<R> u, int n, int m )
447  : KN_<R> ( u, ShapeOfArray ( m* n ) ), shapei ( n, 1, n ), shapej ( m, n, 1 )
448  { }
449 
450  KNM_ ( const KN_<R>& u, const ShapeOfArray& si, const ShapeOfArray& sj, int offset = 0 )
451  : KN_<R> ( &u[ offset ], si.last() + sj.last() + 1, u.step ), shapei ( si ), shapej ( sj )
452  {
453  K_assert ( offset >= 0 && this->n + ( this->v - ( R* ) u ) <= u.n );
454  }
455  KNM_ ( const KN_<R>& u, const ShapeOfArray& si, const ShapeOfArray& sj, int offset, int nnext )
456  : KN_<R> ( &u[ offset ], si.last() + sj.last() + 1, u.step, nnext ), shapei ( si ), shapej ( sj )
457  {
458  K_assert ( offset >= 0 && this->n + ( this->v - ( R* ) u ) <= u.n );
459  }
460 
461  KNM_ ( KNM_<R> U, const SubArray& si, const SubArray& sj )
462  : KN_<R> ( U, SubArray ( U.ij ( si.len1(), sj.len1() ) + 1, U.ij ( si.start, sj.start ) ) ),
463  shapei ( U.shapei, si ), shapej ( U.shapej, sj )
464  {}
465 
466  KNM_ ( KNM_<R> U, const SubArray& sa, const SubArray& si, const SubArray& sj )
467  : KN_<R> ( U, SubArray ( sa ) ), shapei ( U.shapei, si ), shapej ( U.shapej, sj )
468  {}
469 
470  KNM_ ( const KNM_<R>& u )
471  : KN_<R> ( u ), shapei ( u.shapei ), shapej ( u.shapej )
472  {}
473 
474  KNM_ operator() ( const SubArray& sa, const SubArray& sb ) const
475  {
476  return KNM_ ( *this, sa, sb );
477  } // sub array
478 
479  int ij ( const int i, const int j ) const
480  {
481  return shapei.index ( i ) + shapej.index ( j );
482  }
483  int indexij ( int i, int j ) const
484  {
485  return this->index ( shapei.index ( i ) + shapej.index ( j ) );
486  }
487  R& operator() ( int i, int j ) const
488  {
489  return this->v[ indexij ( i, j ) ];
490  }
491  //Alain (28/06/02): version for unsigned int.
492  unsigned int indexij ( unsigned int i, unsigned int j ) const
493  {
494  return this->index ( shapei.index ( i ) + shapej.index ( j ) );
495  }
496  R& operator() ( unsigned int i, unsigned int j ) const
497  {
498  return this->v[ indexij ( i, j ) ];
499  }
500  //Alain (18/10/02): version for long unsigned int.
501  long unsigned int indexij ( long unsigned int i, long unsigned int j ) const
502  {
503  return this->index ( shapei.index ( i ) + shapej.index ( j ) );
504  }
505  R& operator() ( long unsigned int i, long unsigned int j ) const
506  {
507  return this->v[ indexij ( i, j ) ];
508  }
509  //
510 
511  KN_<R> operator() ( const char, int j ) const // une colonne j ('.',j)
512  {
513  return KN_<R> ( &this->v[ this->index ( shapej.index ( j ) ) ], shapei * this->step );
514  }
515  KN_<R> operator() ( int i , const char ) const // une ligne i (i,'.')
516  {
517  return KN_<R> ( &this->v[ this->index ( shapei.index ( i ) ) ], shapej * this->step );
518  }
519  KN_<R> operator() ( const char, const char ) const // tous
520  {
521  return * this;
522  }
523 
524  // Alain (21/11/01) : modification of t(), constructor
525  // KNM_<R>(*this,shapej,shapei,v) was not defined.
526  KNM_<R> t() const
527  {
528  return KNM_<R> ( this->v, *this, shapej, shapei );
529  }
530 
531  const KNM_& operator = ( const KNM_<const_R>& u ) ;
532  const KNM_& operator = ( const_R a ) ;
533  const KNM_& operator+= ( const_R a ) ;
534  const KNM_& operator-= ( const_R a ) ;
535  const KNM_& operator/= ( const_R a ) ;
536  const KNM_& operator*= ( const_R a ) ;
537  const KNM_& operator+= ( const KNM_<const_R>& u ) ;
538  const KNM_& operator-= ( const KNM_<const_R>& u ) ;
539  const KNM_& operator*= ( const KNM_<const_R>& u ) ;
540  const KNM_& operator/= ( const KNM_<const_R>& u ) ;
541 
542 private:
543  KNM_& operator++()
544  {
545  this->v += this->next;
546  return *this;
547  } // ++U
548  KNM_& operator--()
549  {
550  this->v -= this->next;
551  return *this;
552  } // ++U
553  KNM_ operator++ ( int )
554  {
555  KNM_<R> old = *this;
556  this->v = this->v + this->next;
557  return old;
558  } // U++
559  KNM_ operator-- ( int )
560  {
561  KNM_<R> old = *this;
562  this->v = this->v - this->next;
563  return old;
564  } // U--
565 
566 
567  friend class KN_<R>;
568  // friend class KNM_<R>;
569  friend class KNMK_<R>;
570  friend class KNMKL_<R>;
571  friend class KN<R>;
572  friend class KNM<R>;
573  friend class KNMK<R>;
574  friend class KNMKL<R>;
575 };
576 
577 
578 
579 
580 template <class R>
581 class KNMK_: public KN_<R>
582 {
583  friend class KNMK<R>;
584 public:
588 public:
589  int IsVector1() const
590  {
591  return ( shapei.n * shapej.n * shapek.n ) == this->n ;
592  }
593  int N() const
594  {
595  return shapei.n;
596  }
597  int M() const
598  {
599  return shapej.n;
600  }
601  int K() const
602  {
603  return shapek.n;
604  }
605  int size() const
606  {
607  return shapei.n * shapej.n * shapek.n;
608  }
609  KNMK_ ( const ShapeOfArray& s,
610  const ShapeOfArray& si,
611  const ShapeOfArray& sj,
612  const ShapeOfArray& sk,
613  R* u )
614  : KN_<R> ( u, s ), shapei ( si ), shapej ( sj ), shapek ( sk )
615  {}
616 
617  KNMK_ ( R* u, const int n, const int m, const int k )
618  : KN_<R> ( u, ShapeOfArray ( n* m* k ) ), shapei ( n, 1, n ), shapej ( m, n, 1 ), shapek ( k, n* m, n* m )
619  {}
620  ;
621 
622  // KNMK_(const KN_<R> & u,int n,int m,int k)
623  // : KN_<R>(ShapeOfArray(n*m*k)),shapei(n,1,n),shapekj(m,n,1),u),
624  // shapek(k,n*m,n*m){};
625 
626  KNMK_ ( const KNMK_<R>& U, const SubArray& si, const SubArray& sj, const SubArray& sk ) :
627  KN_<R> ( U, SubArray ( U.ijk ( si.len1(), sj.len1(), sk.len1() ) + 1,
628  U.ijk ( si.start, sj.start, sk.start ) ) ),
629  shapei ( U.shapei, si ),
630  shapej ( U.shapej, sj ),
631  shapek ( U.shapek, sk )
632  {}
633 
634  KNMK_ ( const KNMK_<R>& u ) : KN_<R> ( u ), shapei ( u.shapei ), shapej ( u.shapej ), shapek ( u.shapek )
635  {}
636 
637 
638  int ijk ( const int i, const int j, const int k ) const
639  {
640  return shapei.index ( i ) + shapej.index ( j ) + shapek.index ( k );
641  }
642  int indexijk ( int i, int j, int k ) const
643  {
644  return this->index ( shapei.index ( i ) + shapej.index ( j ) + shapek.index ( k ) );
645  }
646 
647  R& operator() ( int i, int j, int k ) const
648  {
649  return this->v[ indexijk ( i, j, k ) ];
650  }
651 
652  // pas de tableau suivant
653  KN_<R> operator() ( const char , int j, int k ) const
654  {
655  // le tableau (.,j,k)
656  return KN_<R> ( *this, -1, shapei, shapej[ j ] + shapek[ k ] );
657  }
658  KN_<R> operator() ( int i, const char , int k ) const
659  {
660  // le tableau (i,.,k)
661  return KN_<R> ( *this, -1, shapej, shapei[ i ] + shapek[ k ] );
662  }
663  KN_<R> operator() ( int i, int j, const char ) const
664  {
665  // le tableau (i,j,.)
666  return KN_<R> ( *this, -1, shapek, shapei[ i ] + shapej[ j ] );
667  }
668  //
669  KNM_<R> operator() ( const char , const char , int k ) const
670  {
671  // le tableau (.,.,k)
672  return KNM_<R> ( *this, shapei, shapej, shapek[ k ], shapek.next );
673  } // step = n*m
674  //attention les suivants ne marche pas
675  KNM_<R> operator() ( const char , int j, const char ) const
676  {
677  // le tableau (.,j,.)
678  return KNM_<R> ( *this, shapei, shapek, shapej[ j ], -1 /*shapej.next*/ );
679  } // step = n
680 
681  KNM_<R> operator() ( int i, const char , const char ) const
682  {
683  // le tableau (i,.,.)
684  return KNM_<R> ( *this, shapej, shapek, shapei[ i ], -1 /*shapei.next*/ );
685  } // step = 1
686 
687  const KNMK_& operator = ( const KNMK_<const_R>& u ) ;
688  const KNMK_& operator+= ( const KNMK_<const_R>& u ) ;
689  const KNMK_& operator-= ( const KNMK_<const_R>& u ) ;
690  const KNMK_& operator/= ( const KNMK_<const_R>& u ) ;
691  const KNMK_& operator*= ( const KNMK_<const_R>& u ) ;
692  const KNMK_& operator = ( const_R a ) ;
693  const KNMK_& operator+= ( const_R a ) ;
694  const KNMK_& operator-= ( const_R a ) ;
695  const KNMK_& operator/= ( const_R a ) ;
696  const KNMK_& operator*= ( const_R a ) ;
697 
698  KNMK_ operator() ( SubArray si, SubArray sj, SubArray sk ) const
699  {
700  return KNMK_ ( *this, si, sj, sk );
701  }
702 
703 private:
704  // KNMK_& operator++(){v += next;return *this;} // ++U
705  // KNMK_& operator--(){v -= next;return *this;} // --U
706  // KNMK_ operator++(int ){KNMK_ old=*this;v = v +next;return old;} // U++
707  // KNMK_ operator--(int ){KNMK_ old=*this;v = v -next;return old;} // U--
708 
709 
710  friend class KNM_<R>;
711  friend class KN_<R>;
712 
713 };
714 
715 //===========================================================================
716 //===========================================================================
717 //===========================================================================
718 // A. Veneziani: KNMKL_ class for handling 4 indexes - October 2002
719 
720 template <class R>
721 class KNMKL_: public KN_<R>
722 {
723  friend class KNMKL<R>;
724 public:
729 public:
730  int IsVector1() const
731  {
732  return ( shapei.n * shapej.n * shapek.n * shapel.n ) == this->n ;
733  }
734  int N() const
735  {
736  return shapei.n;
737  }
738  int M() const
739  {
740  return shapej.n;
741  }
742  int K() const
743  {
744  return shapek.n;
745  }
746  int L() const
747  {
748  return shapel.n;
749  }
750  int size() const
751  {
752  return shapei.n * shapej.n * shapek.n * shapel.n;
753  }
754  KNMKL_ ( const ShapeOfArray& s,
755  const ShapeOfArray& si,
756  const ShapeOfArray& sj,
757  const ShapeOfArray& sk,
758  const ShapeOfArray& sl,
759  R* u )
760  : KN_<R> ( u, s ), shapei ( si ), shapej ( sj ), shapek ( sk ), shapel ( sl )
761  {}
762 
763  KNMKL_ ( R* u, const int n, const int m, const int k, const int l )
764  : KN_<R> ( u, ShapeOfArray ( n* m* k* l ) ), shapei ( n, 1, n ), shapej ( m, n, 1 ), shapek ( k, n* m, n* m ), shapel ( l, n* m* k, n* m* k )
765  {}
766  ;
767 
768 
769  KNMKL_ ( const KNMK_<R>& U, const SubArray& si, const SubArray& sj, const SubArray& sk, const SubArray& sl ) :
770  KN_<R> ( U, SubArray ( U.ijkl ( si.len1(), sj.len1(), sk.len1(), sl.len1() ) + 1,
771  U.ijkl ( si.start, sj.start, sk.start, sl.start ) ) ),
772  shapei ( U.shapei, si ),
773  shapej ( U.shapej, sj ),
774  shapek ( U.shapek, sk ),
775  shapel ( U.shapel, sl )
776  {}
777 
778  KNMKL_ ( const KNMK_<R>& u ) : KN_<R> ( u ), shapei ( u.shapei ), shapej ( u.shapej ), shapek ( u.shapek ), shapel ( u.shapel )
779  {}
780 
781 
782  int ijkl ( const int i, const int j, const int k, const int l ) const
783  {
784  return shapei.index ( i ) + shapej.index ( j ) + shapek.index ( k ) + shapel.index ( l );
785  }
786  int indexijk ( int i, int j, int k, int l ) const
787  {
788  return this->index ( shapei.index ( i ) + shapej.index ( j ) + shapek.index ( k ) + shapel.index ( l ) );
789  }
790 
791  R& operator() ( int i, int j, int k, int l ) const
792  {
793  return this->v[ indexijk ( i, j, k, l ) ];
794  }
795 
796  // pas de tableau suivant
797  KN_<R> operator() ( const char , int j, int k, int l ) const
798  {
799  // le tableau (.,j,k,l)
800  return KN_<R> ( *this, -1, shapei, shapej[ j ] + shapek[ k ] + shapel[ l ] );
801  }
802 
803  KN_<R> operator() ( int i, const char , int k, int l ) const
804  {
805  // le tableau (i,.,k,l)
806  return KN_<R> ( *this, -1, shapej, shapei[ i ] + shapek[ k ] + shapel[ l ] );
807  }
808 
809  KN_<R> operator() ( int i, int j, const char, int l ) const
810  {
811  // le tableau (i,j,.,l)
812  return KN_<R> ( *this, -1, shapek, shapei[ i ] + shapej[ j ] + shapel[ l ] );
813  }
814 
815  KN_<R> operator() ( int i, int j, int k, const char ) const
816  {
817  // le tableau (i,j,k,.)
818  return KN_<R> ( *this, -1, shapel, shapei[ i ] + shapej[ j ] + shapek[ k ] );
819  }
820 
821 
822  // ATTENTION: This part has to be verified
823  // KNM_<R> operator()(const char ,const char ,int k, int l) const { // le tableau (.,.,k,l)
824  // return KNM_<R>(*this,shapei,shapej,shapek[k]+shapel[l],-1/*shapel.next*/);} // step = k*n*m
825  // KNM_<R> operator()(const char ,int j,const char , int l) const { // le tableau (.,j,.,l)
826  // return KNM_<R>(*this,shapei,shapek,shapej[j]+shapel[l],-1/*shapel.next*/);} // step = k*n*m
827  // KNM_<R> operator()(const char ,int j, int k, const char) const { // le tableau (.,j,k,.)
828  // return KNM_<R>(*this,shapei,shapel,shapej[j]+shapek[k],-1/*shapek.next*/);} // step = n*m
829  // //attention les suivants ne marche pas
830  // KNM_<R> operator()(int i, const char ,const char, int l) const { // le tableau (i,.,.,l)
831  // return KNM_<R>(*this,shapei,shapel,shapej[j]+shapek[k],-1/*shapej.next*/);} // step = n
832  // KNM_<R> operator()(int i, const char ,int k,const char ) const { // le tableau (i,.,k,.)
833  // return KNM_<R>(*this,shapei,shapek,shapej[j]+shapel[l],-1/*shapel.next*/);} // step = n
834  // KNM_<R> operator()(int i, int j, const char ,const char ) const { // le tableau (i,j,.,.)
835  // return KNM_<R>(*this,shapei,shapej,shapek[k]+shapel[l],-1/*1*/);} // step = 1
836 
837  // //
838  // KNMK_<R> operator()(const char ,const char ,int k) const { // le tableau (.,.,.,l)
839  // return KNMK_<R>(*this,shapei,shapej,shapek,shapel[l],shapel.next);} // step = k*n*m
840  // KNMK_<R> operator()(const char ,const char ,int k) const { // le tableau (.,.,k,.)
841  // return KNMK_<R>(*this,shapei,shapej,shapel,shapek[k],shapek.next);} // step = n*m
842  // //attention les suivants ne marche pas
843  // KNMK_<R> operator()(const char ,int j,const char ) const { // le tableau (.,j,.,.)
844  // return KNMK_<R>(*this,shapei,shapek,shapel,shapej[j],-1/*shapej.next*/);} // step = n
845  // KNMK_<R> operator()(int i,const char ,const char ) const { // le tableau (i,.,.,.)
846  // return KNMK_<R>(*this,shapej,shapek,shapei,shapei[i],-1/*shapei.next*/);} // step = 1
847 
848  const KNMKL_& operator = ( const KNMKL_<const_R>& u ) ;
849  const KNMKL_& operator+= ( const KNMKL_<const_R>& u ) ;
850  const KNMKL_& operator-= ( const KNMKL_<const_R>& u ) ;
851  const KNMKL_& operator/= ( const KNMKL_<const_R>& u ) ;
852  const KNMKL_& operator*= ( const KNMKL_<const_R>& u ) ;
853  const KNMKL_& operator = ( const_R a ) ;
854  const KNMKL_& operator+= ( const_R a ) ;
855  const KNMKL_& operator-= ( const_R a ) ;
856  const KNMKL_& operator/= ( const_R a ) ;
857  const KNMKL_& operator*= ( const_R a ) ;
858 
859  KNMKL_ operator() ( SubArray si, SubArray sj, SubArray sk ) const
860  {
861  return KNMKL_ ( *this, si, sj, sk );
862  }
863 
864 private:
865  // KNMK_& operator++(){v += next;return *this;} // ++U
866  // KNMK_& operator--(){v -= next;return *this;} // --U
867  // KNMK_ operator++(int ){KNMK_ old=*this;v = v +next;return old;} // U++
868  // KNMK_ operator--(int ){KNMK_ old=*this;v = v -next;return old;} // U--
869 
870  friend class KNMK_<R>;
871  friend class KNM_<R>;
872  friend class KN_<R>;
873 
874 };
875 
876 
877 //===========================================================================
878 //===========================================================================
879 //===========================================================================
880 
881 template <class R>
882 class KN : public KN_<R>
883 {
884 public:
885 
886  // explicit KN(const R & u):KN_<R>(new R(uu),1,0) {}
887  KN ( const int nn ) : KN_<R> ( new R[ nn ], nn )
888  {}
889  KN ( const int nn, R ( *f ) ( int i ) ) : KN_<R> ( new R[ nn ], nn )
890  {
891  for ( int i = 0; i < this->n; i++ )
892  {
893  this->v[ i ] = f ( i );
894  }
895  }
896  KN ( const int nn, const R& a ) : KN_<R> ( new R[ nn ], nn )
897  {
898  KN_<R>::operator= ( a );
899  }
900  KN ( const int nn, int s, const R a ) : KN_<R> ( new R[ nn ], nn, s )
901  {
902  KN_<R>::operator= ( a );
903  }
904  template <class S>
905  KN ( const KN_<S>& s ) : KN_<R> ( new R[ s.n ], s.n )
906  {
907  for ( int i = 0; i < this->n; i++ )
908  {
909  this->v[ i ] = s[ i ];
910  }
911  }
912  template <class S>
913  KN ( const KN_<S>& s, R ( *f ) ( S ) ) : KN_<R> ( new R[ s.n ], s.n )
914  {
915  for ( int i = 0; i < this->n; i++ )
916  {
917  this->v[ i ] = f ( s[ i ] );
918  }
919  }
920  explicit KN ( const KN<R>& u ) : KN_<R> ( new R[ u.n ], u.n )
921  {
922  KN_<R>::operator= ( u );
923  }
924  explicit KN ( const KN_<R>& u ) : KN_<R> ( new R[ u.n ], u.n )
925  {
926  KN_<R>::operator= ( u );
927  }
928 
929  ~KN()
930  {
931  // should use std::shared_ptr
932  delete [] this->v;
933  }
934 
935  const KN& operator = ( const_R a )
936  {
937  KN_<R>::operator= ( a );
938  return *this;
939  }
940  const KN& operator = ( const KN_<R>& a )
941  {
942  KN_<R>::operator= ( a );
943  return *this;
944  }
945 
946  const KN& operator = ( const KN<R>& a )
947  {
948  KN_<R>::operator= ( a );
949  return *this;
950  }
951 
952  const KN& operator = ( const Add_KN_<R>& u )
953  {
954  KN_<R>::operator= ( u );
955  return *this;
956  }
957  const KN& operator = ( const Sub_KN_<R>& u )
958  {
959  KN_<R>::operator= ( u );
960  return *this;
961  }
962  const KN& operator = ( const Mulc_KN_<R>& u )
963  {
964  KN_<R>::operator= ( u );
965  return *this;
966  }
967  const KN& operator = ( const Add_Mulc_KN_<R>& u )
968  {
969  KN_<R>::operator= ( u );
970  return *this;
971  }
972  const KN& operator = ( const Mul_KNM_KN_<R>& u )
973  {
974  KN_<R>::operator= ( u );
975  return *this;
976  }
977  const KN& operator = ( const MatriceCreuseMulKN_<R>& A )
978  {
979  KN_<R>::operator= ( A );
980  return *this;
981  }
982  const KN& operator = ( const MatriceCreuseDivKN_<R>& A )
983  {
984  KN_<R>::operator= ( A );
985  return *this;
986  }
987 
988  const KN& operator -= ( const_R a )
989  {
990  KN_<R>::operator-= ( a );
991  return *this;
992  }
993  const KN& operator -= ( const KN_<R>& a )
994  {
995  KN_<R>::operator-= ( a );
996  return *this;
997  }
998  const KN& operator -= ( const Add_KN_<R>& u )
999  {
1000  KN_<R>::operator-= ( u );
1001  return *this;
1002  }
1003  const KN& operator -= ( const Sub_KN_<R>& u )
1004  {
1005  KN_<R>::operator-= ( u );
1006  return *this;
1007  }
1008  const KN& operator -= ( const Mulc_KN_<R>& u )
1009  {
1010  KN_<R>::operator-= ( u );
1011  return *this;
1012  }
1013  const KN& operator -= ( const Add_Mulc_KN_<R>& u )
1014  {
1015  KN_<R>::operator-= ( u );
1016  return *this;
1017  }
1018  const KN& operator -= ( const Mul_KNM_KN_<R>& u )
1019  {
1020  KN_<R>::operator-= ( u );
1021  return *this;
1022  }
1023 
1024  const KN& operator += ( const_R a )
1025  {
1026  KN_<R>::operator += ( a );
1027  return *this;
1028  }
1029  const KN& operator += ( const KN_<R>& a )
1030  {
1031  KN_<R>::operator+= ( a );
1032  return *this;
1033  }
1034  const KN& operator += ( const Add_KN_<R>& u )
1035  {
1036  KN_<R>::operator+= ( u );
1037  return *this;
1038  }
1039  const KN& operator += ( const Sub_KN_<R>& u )
1040  {
1041  KN_<R>::operator+= ( u );
1042  return *this;
1043  }
1044  const KN& operator += ( const Mulc_KN_<R>& u )
1045  {
1046  KN_<R>::operator+= ( u );
1047  return *this;
1048  }
1049  const KN& operator += ( const Add_Mulc_KN_<R>& u )
1050  {
1051  KN_<R>::operator+= ( u );
1052  return *this;
1053  }
1054  const KN& operator += ( const Mul_KNM_KN_<R>& u )
1055  {
1056  KN_<R>::operator+= ( u );
1057  return *this;
1058  }
1059 
1060 
1061  const KN& operator/= ( const_R a )
1062  {
1063  KN_<R>::operator/= ( a );
1064  return *this;
1065  }
1066  const KN& operator*= ( const_R a )
1067  {
1068  KN_<R>::operator*= ( a );
1069  return *this;
1070  }
1071  const KN& operator/= ( const KN_<const_R>& a )
1072  {
1073  KN_<R>::operator/= ( a );
1074  return *this;
1075  }
1076  const KN& operator*= ( const KN_<const_R>& a )
1077  {
1078  KN_<R>::operator*= ( a );
1079  return *this;
1080  }
1081 
1082 
1083  // two opertor to cast to an array of constant
1084  // operator KN_<const_R> & ()
1085  // { return * (KN_<const_R>*) this;}
1086  // operator KN_<const_R> const & () const
1087  // { return *(const KN_<const_R>*) this;}
1088  // operator KN<const_R> & ()
1089  // { return (KN<const_R> &) *this;}
1090  // operator KN<const_R> const & () const
1091  // { return (const KN<const_R>& ) *this;}
1092 };
1093 
1094 // Array with 2 indices
1095 // ---------------------
1096 
1097 template <class R>
1098 class KNM: public KNM_<R>
1099 {
1100 public:
1101 
1102  KNM ( const int n, const int m )
1103  : KNM_<R> ( new R[ n* m ], n, m )
1104  {
1105  assert ( this->v != 0 );
1106  }
1107 
1108  /* Alain (28/06/02): I remove the explicit statment for allowing implicit
1109  conversion.
1110  explicit KNM(const KNM<R> & u) // PB si stepi ou stepj nulle
1111  :KNM_<R>(new R[u.size()],u.N(),u.M())
1112  { KN_<R>::operator=(u);}
1113  explicit KNM(const KNM_<R> & u)
1114  :KNM_<R>(new R[u.size()],u.N(),u.M())
1115  { KNM_<R>::operator=(u);}
1116  */
1117  KNM ( const KNM<R>& u ) // PB si stepi ou stepj nulle
1118  :
1119  KNM_<R> ( new R[ u.size() ], u.N(), u.M() )
1120  {
1121  KN_<R>::operator= ( u );
1122  }
1123  KNM ( const KNM_<R>& u )
1124  : KNM_<R> ( new R[ u.size() ], u.N(), u.M() )
1125  {
1126  KNM_<R>::operator= ( u );
1127  }
1128 
1129  ~KNM()
1130  {
1131  delete [] this->v;
1132  }
1133 
1134  const KNM& operator= ( const KNM_<const_R>& u )
1135  {
1136  KNM_<R>::operator= ( u );
1137  return *this;
1138  }
1139  const KNM& operator= ( const_R a )
1140  {
1141  KNM_<R>::operator= ( a );
1142  return *this;
1143  }
1144  const KNM& operator+= ( const_R a )
1145  {
1146  KNM_<R>::operator+= ( a );
1147  return *this;
1148  }
1149  const KNM& operator-= ( const_R a )
1150  {
1151  KNM_<R>::operator-= ( a );
1152  return *this;
1153  }
1154  const KNM& operator/= ( const_R a )
1155  {
1156  KNM_<R>::operator/= ( a );
1157  return *this;
1158  }
1159  const KNM& operator*= ( const_R a )
1160  {
1161  KNM_<R>::operator*= ( a );
1162  return *this;
1163  }
1164  const KNM& operator+= ( const KNM_<const_R>& u )
1165  {
1166  KNM_<R>::operator+= ( u );
1167  return *this;
1168  }
1169  const KNM& operator-= ( const KNM_<const_R>& u )
1170  {
1171  KNM_<R>::operator-= ( u );
1172  return *this;
1173  }
1174 
1175  const KNM& operator/= ( const KNM_<const_R>& u )
1176  {
1177  KNM_<R>::operator/= ( u );
1178  return *this;
1179  }
1180  const KNM& operator*= ( const KNM_<const_R>& u )
1181  {
1182  KNM_<R>::operator*= ( u );
1183  return *this;
1184  }
1185 
1186 
1187  // two opertors to cast to un array of constant
1188  // operator KNM_<const_R> & ()
1189  // { return * (KNM_<const_R>*) this;}
1190  // operator KNM_<const_R> const & () const
1191  // { return *(const KNM_<const_R>*) this;}
1192 
1193  // operator KNM<const_R> & ()
1194  // { return * (KNM<const_R>*) this;}
1195  // operator KNM<const_R> const & () const
1196  // { return *(const KNM<const_R>*) this;}
1197 
1198 };
1199 
1200 // Array with 3 indices
1201 // ---------------------
1202 template <class R>
1203 class KNMK: public KNMK_<R>
1204 {
1205 public:
1206 
1207  KNMK ( const int n, const int m, const int k )
1208  : KNMK_<R> ( new R[ n* m* k ], n, m, k )
1209  {}
1210  explicit KNMK ( const KNMK_<R>& u )
1211  : KNMK_<R> ( new R[ u.size() ], u.N(), u.M(), u.K() )
1212  {
1213  KNMK_<R>::operator= ( u );
1214  }
1215  KNMK ( const KNMK<R>& u )
1216  : KNMK_<R> ( new R[ u.size() ], u.N(), u.M(), u.K() )
1217  {
1218  KNMK_<R>::operator= ( u );
1219  }
1220 
1221  ~KNMK()
1222  {
1223  delete [] this->v;
1224  }
1225 
1226  KNMK& operator= ( const KNMK_<const_R>& u )
1227  {
1228  KN_<R>::operator= ( u );
1229  return *this;
1230  }
1231  KNMK& operator= ( const_R a )
1232  {
1233  KN_<R>::operator= ( a );
1234  return *this;
1235  }
1236  KNMK& operator+= ( const_R a )
1237  {
1238  KN_<R>::operator+= ( a );
1239  return *this;
1240  }
1241  KNMK& operator-= ( const_R a )
1242  {
1243  KN_<R>::operator-= ( a );
1244  return *this;
1245  }
1246  KNMK& operator/= ( const_R a )
1247  {
1248  KN_<R>::operator/= ( a );
1249  return *this;
1250  }
1251  KNMK& operator*= ( const_R a )
1252  {
1253  KN_<R>::operator*= ( a );
1254  return *this;
1255  }
1256  KNMK& operator+= ( const KNMK_<const_R>& u )
1257  {
1258  KN_<R>::operator+= ( u );
1259  return *this;
1260  }
1261  KNMK& operator-= ( const KNMK_<const_R>& u ) // A. Veneziani: I guess here there was a bug
1262  {
1263  KN_<R>::operator-= ( u );
1264  return *this;
1265  }
1266 
1267  KNMK& operator*= ( const KNMK_<const_R>& u ) // A. Veneziani: I guess here there was a bug
1268  {
1269  KN_<R>::operator*= ( u );
1270  return *this;
1271  }
1272  KNMK& operator/= ( const KNMK_<const_R>& u ) // A. Veneziani: I guess here there was a bug
1273  {
1274  KN_<R>::operator/= ( u );
1275  return *this;
1276  }
1277 
1278  // two opertor to cast to un array of constant
1279  // operator KNMK_<const_R> & ()
1280  // { return * (KNMK_<const_R>*) this;}
1281  // operator KNMK_<const_R> const & () const
1282  // { return *(const KNMK_<const_R>*) this;}
1283 
1284  // operator KNMK<const_R> & ()
1285  // { return * (KNMK<const_R>*) this;}
1286  // operator KNMK<const_R> const & () const
1287  // { return *(const KNMK<const_R>*) this;}
1288 };
1289 
1290 //
1291 // A. Veneziani, October, 30, 2002
1292 //
1293 // Array with 4 indices
1294 // ---------------------
1295 template <class R>
1296 class KNMKL: public KNMKL_<R>
1297 {
1298 public:
1299 
1300  KNMKL ( const int n, const int m, const int k, const int l )
1301  : KNMKL_<R> ( new R[ n* m* k* l ], n, m, k, l )
1302  {}
1303  explicit KNMKL ( const KNMKL_<R>& u )
1304  : KNMKL_<R> ( new R[ u.size() ], u.N(), u.M(), u.K(), u.L() )
1305  {
1306  KNMKL_<R>::operator= ( u );
1307  }
1308  // This constructor is commented out because it is wrong: u.L() has no sense
1309  // for u of type KNMK
1310 #if 0
1311  explicit KNMKL ( const KNMK<R>& u )
1312  : KNMKL_<R> ( new R[ u.size() ], u.N(), u.M(), u.K(), u.L() )
1313  {
1314  KNMKL_<R>::operator= ( u );
1315  }
1316 #endif
1317 
1319  {
1320  delete [] this->v;
1321  }
1322 
1323  KNMKL& operator= ( const KNMKL_<const_R>& u )
1324  {
1325  KN_<R>::operator= ( u );
1326  return *this;
1327  }
1328  KNMKL& operator= ( const_R a )
1329  {
1330  KN_<R>::operator= ( a );
1331  return *this;
1332  }
1333  KNMKL& operator+= ( const_R a )
1334  {
1335  KN_<R>::operator+= ( a );
1336  return *this;
1337  }
1338  KNMKL& operator-= ( const_R a )
1339  {
1340  KN_<R>::operator-= ( a );
1341  return *this;
1342  }
1343  KNMKL& operator/= ( const_R a )
1344  {
1345  KN_<R>::operator/= ( a );
1346  return *this;
1347  }
1348  KNMKL& operator*= ( const_R a )
1349  {
1350  KN_<R>::operator*= ( a );
1351  return *this;
1352  }
1353  KNMKL& operator+= ( const KNMKL_<const_R>& u )
1354  {
1355  KN_<R>::operator+= ( u );
1356  return *this;
1357  }
1358  KNMKL& operator-= ( const KNMKL_<const_R>& u )
1359  {
1360  KN_<R>::operator-= ( u );
1361  return *this;
1362  }
1363 
1364  KNMKL& operator*= ( const KNMKL_<const_R>& u )
1365  {
1366  KN_<R>::operator*= ( u );
1367  return *this;
1368  }
1369  KNMKL& operator/= ( const KNMKL_<const_R>& u )
1370  {
1371  KN_<R>::operator/= ( u );
1372  return *this;
1373  }
1374 
1375  // two opertor to cast to un array of constant
1376  // operator KNMK_<const_R> & ()
1377  // { return * (KNMK_<const_R>*) this;}
1378  // operator KNMK_<const_R> const & () const
1379  // { return *(const KNMK_<const_R>*) this;}
1380 
1381  // operator KNMK<const_R> & ()
1382  // { return * (KNMK<const_R>*) this;}
1383  // operator KNMK<const_R> const & () const
1384  // { return *(const KNMK<const_R>*) this;}
1385 };
1386 
1387 
1388 // ------------- optimization ---------------------
1389 template <class R>
1390 class Add_KN_
1391 {
1392 public:
1393  const KN_<const_R>& a;
1394  const KN_<const_R>& b;
1395  Add_KN_ ( const KN_<const_R>& aa, const KN_<const_R>& bb )
1396  : a ( aa ), b ( bb )
1397  {
1398  K_assert ( SameShape ( a, b ) );
1399  }
1400 };
1401 
1402 template <class R>
1403 class Sub_KN_
1404 {
1405 public:
1406  const KN_<const_R>& a;
1407  const KN_<const_R>& b;
1408  Sub_KN_ ( const KN_<const_R>& aa, const KN_<const_R>& bb )
1409  : a ( aa ), b ( bb )
1410  {
1411  K_assert ( SameShape ( a, b ) );
1412  }
1413 };
1414 
1415 template <class R>
1416 class Mulc_KN_
1417 {
1418 public:
1419  const KN_<const_R>& a;
1421  Mulc_KN_ ( const KN_<const_R>& aa, const_R bb ) : a ( aa ), b ( bb )
1422  {}
1423  Mulc_KN_ ( const Mulc_KN_<R>& aa, const_R bb ) : a ( aa.a ), b ( aa.b* bb )
1424  {}
1425 }
1426 ;
1427 
1428 template <class R>
1429 class Add_Mulc_KN_
1430 {
1431 public:
1432  const KN_<const_R> a, b;
1433  const R ca, cb;
1434  Add_Mulc_KN_ ( const Mulc_KN_<R>& aa, const Mulc_KN_<R>& bb )
1435  : a ( aa.a ), b ( bb.a ), ca ( aa.b ), cb ( bb.b )
1436  {
1437  K_assert ( SameShape ( a, b ) );
1438  }
1439  Add_Mulc_KN_ ( const Mulc_KN_<R>& aa, const KN_<const_R>& bb, const R cbb )
1440  : a ( aa.a ), b ( bb ), ca ( aa.b ), cb ( cbb )
1441  {
1442  K_assert ( SameShape ( a, b ) );
1443  }
1444  Add_Mulc_KN_ ( const KN_<const_R>& aa, const R caa, const KN_<const_R>& bb, const R cbb )
1445  : a ( aa ), b ( bb ), ca ( caa ), cb ( cbb )
1446  {
1447  K_assert ( SameShape ( a, b ) );
1448  }
1449 };
1450 
1451 
1452 template <class R>
1453 class Mul_KNM_KN_
1454 {
1455 public:
1456  const KNM_<const_R> A;
1457  const KN_<const_R> b;
1458  Mul_KNM_KN_ ( const KNM_<const_R>& aa, const KN_<const_R>& bb )
1459  : A ( aa ), b ( bb )
1460  {
1461  K_assert ( SameShape ( A.shapej, b ) );
1462  }
1463 };
1464 
1465 
1466 std::ostream& operator<< ( std::ostream& f, const ShapeOfArray& s );
1467 
1468 template <class R>
1469 std::ostream& operator<< ( std::ostream& f, const KN_<const_R>& v );
1470 template <class R>
1471 std::ostream& operator<< ( std::ostream& f, const KNM_<const_R>& v );
1472 template <class R>
1473 std::ostream& operator<< ( std::ostream& f, const KNMK_<const_R>& v );
1474 template <class R>
1475 inline std::ostream& operator<< ( std::ostream& f, const KN<const_R>& v )
1476 {
1477  return f << ( KN_<const_R> ) v;
1478 }
1479 template <class R>
1480 inline std::ostream& operator<< ( std::ostream& f, const KNM<const_R>& v )
1481 {
1482  return f << ( KNM_<const_R> ) v;
1483 }
1484 template <class R>
1485 inline std::ostream& operator<< ( std::ostream& f, const KNMK<const_R>& v )
1486 {
1487  return f << ( KNMK_<const_R> ) v;
1488 }
1489 
1490 
1491 template <class R>
1492 inline Add_KN_<R> operator+ ( const KN_<const_R>& a, const KN_<const_R>& b )
1493 {
1494  return Add_KN_<R> ( a, b );
1495 }
1496 template <class R>
1497 inline Sub_KN_<R> operator- ( const KN_<const_R>& a, const KN_<const_R>& b )
1498 {
1499  return Sub_KN_<R> ( a, b );
1500 }
1501 template <class R>
1502 inline Mulc_KN_<R> operator* ( const KN_<const_R>& a, const R& b )
1503 {
1504  return Mulc_KN_<R> ( a, b );
1505 }
1506 template <class R>
1507 inline Mulc_KN_<R> operator* ( const R& b, const KN_<const_R>& a )
1508 {
1509  return Mulc_KN_<R> ( a, b );
1510 }
1511 template <class R>
1512 inline Mulc_KN_<R> operator- ( const KN_<const_R>& a )
1513 {
1514  return Mulc_KN_<R> ( a, -1 );
1515 }
1516 
1517 
1518 
1519 template <class R>
1520 inline Add_Mulc_KN_<R> operator+ ( const Mulc_KN_<R>& a, const Mulc_KN_<R>& b )
1521 {
1522  return Add_Mulc_KN_<R> ( a, b );
1523 }
1524 template <class R>
1525 inline Add_Mulc_KN_<R> operator- ( const Mulc_KN_<R>& a, const Mulc_KN_<R>& b )
1526 {
1527  return Add_Mulc_KN_<R> ( a, b.a, -b.b );
1528 }
1529 
1530 template <class R>
1531 inline Add_Mulc_KN_<R> operator+ ( const Mulc_KN_<R>& a, const KN_<const_R>& b )
1532 {
1533  return Add_Mulc_KN_<R> ( a, b, 1.0 );
1534 }
1535 template <class R>
1536 inline Add_Mulc_KN_<R> operator- ( const Mulc_KN_<R>& a, const KN_<const_R>& b )
1537 {
1538  return Add_Mulc_KN_<R> ( a, b, -1.0 );
1539 }
1540 
1541 template <class R>
1542 inline Add_Mulc_KN_<R> operator+ ( const KN_<const_R>& b, const Mulc_KN_<R>& a )
1543 {
1544  return Add_Mulc_KN_<R> ( a, b, 1.0 );
1545 }
1546 template <class R>
1547 inline Add_Mulc_KN_<R> operator- ( const KN_<const_R>& b, const Mulc_KN_<R>& a )
1548 {
1549  return Add_Mulc_KN_<R> ( a, b, -1.0 );
1550 }
1551 template <class R>
1552 inline Mul_KNM_KN_<R> operator* ( const KNM_<const_R> A, const KN_<const_R> b )
1553 {
1554  return Mul_KNM_KN_<R> ( A, b );
1555 }
1556 
1557 
1558 
1559 
1560 template <class R>
1561 inline int SameAdress ( const KN_<R>& a, const KN_<R>& b )
1562 {
1563  return & a[ 0 ] == &b[ 0 ];
1564 }
1565 }
1566 #include <lifev/core/array/RNMTemplate.hpp>
1567 #ifdef K_assert
1568 #undef K_assert
1569 #endif
1570 #endif
KNMKL_(R *u, const int n, const int m, const int k, const int l)
Definition: RNM.hpp:763
KN_(R *u, const ShapeOfArray &s)
Definition: RNM.hpp:382
const KN & operator=(const KN< R > &a)
Definition: RNM.hpp:946
const KNM_ & operator=(const KNM_< R > &u)
Add_Mulc_KN_< R > operator+(const Mulc_KN_< R > &a, const Mulc_KN_< R > &b)
Definition: RNM.hpp:1520
const KN_ & operator-=(const Add_KN_< R > &u)
const KNMKL_ & operator-=(R a)
int K() const
Definition: RNM.hpp:601
const KN & operator-=(const Mulc_KN_< R > &u)
Definition: RNM.hpp:1008
const KN & operator-=(const Add_KN_< R > &u)
Definition: RNM.hpp:998
const KN_ & operator+=(const Mulc_KN_< R > &u)
const KNMKL_ & operator*=(R a)
KN_ & operator++()
Definition: RNM.hpp:355
const KN & operator+=(const Sub_KN_< R > &u)
Definition: RNM.hpp:1039
int L() const
Definition: RNM.hpp:746
KNMK(const KNMK_< R > &u)
Definition: RNM.hpp:1210
KNM(const int n, const int m)
Definition: RNM.hpp:1102
const KNMK_ & operator/=(R a)
ShapeOfArray(int nn)
Definition: RNM.hpp:186
KN_< R > operator()(int i, int j, const char) const
Definition: RNM.hpp:663
KNMKL & operator-=(const KNMKL_< R > &u)
Definition: RNM.hpp:1358
const KNMKL_ & operator=(const KNMKL_< R > &u)
KN_ operator()(const SubArray &sa) const
Definition: RNM.hpp:294
KN_(const KN_< R > &U, const SubArray &sa)
Definition: RNM.hpp:291
int N() const
Definition: RNM.hpp:422
int SameAdress(const KN_< R > &a, const KN_< R > &b)
Definition: RNM.hpp:1561
bool SameShape(const ShapeOfArray &a, const ShapeOfArray &b)
Definition: RNM.hpp:249
KNM_< R > operator()(const char, const char, int k) const
Definition: RNM.hpp:669
const KN_ & operator+=(const Add_Mulc_KN_< R > &u)
KNM_ operator--(int)
Definition: RNM.hpp:559
const KN_ & operator=(const Mul_KNM_KN_< R > &u)
const KNM_ & operator-=(R a)
int ijk(const int i, const int j, const int k) const
Definition: RNM.hpp:638
KN_< R > operator()(int i, const char, int k) const
Definition: RNM.hpp:658
Mul_KNM_KN_(const KNM_< R > &aa, const KN_< R > &bb)
Definition: RNM.hpp:1458
const KN & operator=(const MatriceCreuseDivKN_< R > &A)
Definition: RNM.hpp:982
const KNM_ & operator/=(R a)
KNM_(R *u, int n, int m, int s)
Definition: RNM.hpp:443
int end() const
Definition: RNM.hpp:207
const KN_ & operator*=(R a)
Sub_KN_(const KN_< R > &aa, const KN_< R > &bb)
Definition: RNM.hpp:1408
const KN_< R > & a
Definition: RNM.hpp:1393
KN_(const KN_< R > &u, int offset)
Definition: RNM.hpp:390
const KN & operator-=(R a)
Definition: RNM.hpp:988
KN_(R *u, int nn)
Definition: RNM.hpp:388
KNMK_(const KNMK_< R > &U, const SubArray &si, const SubArray &sj, const SubArray &sk)
Definition: RNM.hpp:626
bool SameShape(const ShapeOfArray &a) const
Definition: RNM.hpp:228
int indexij(int i, int j) const
Definition: RNM.hpp:483
const KN & operator*=(R a)
Definition: RNM.hpp:1066
int N() const
Definition: RNM.hpp:734
KN_(R *u, int nn, int s, int nextt)
Definition: RNM.hpp:386
const KNM_ & operator+=(const KNM_< R > &u)
KNMK & operator*=(R a)
Definition: RNM.hpp:1251
const KNM_ & operator+=(R a)
int size() const
Definition: RNM.hpp:750
KNMKL & operator*=(const KNMKL_< R > &u)
Definition: RNM.hpp:1364
int last() const
Definition: RNM.hpp:211
R KNMmin() const
~KN()
Definition: RNM.hpp:929
ShapeOfArray shapej
Definition: RNM.hpp:416
Mul_KNM_KN_< R > operator*(const KNM_< R > A, const KN_< R > b)
Definition: RNM.hpp:1552
KNM_(R *u, int n, int m)
Definition: RNM.hpp:440
R & operator()(int i) const
Definition: RNM.hpp:302
int ij(const int i, const int j) const
Definition: RNM.hpp:479
R & operator()(int i, int j, int k, int l) const
Definition: RNM.hpp:791
const KN_ & operator=(const Sub_KN_< R > &u)
const KNMK_ & operator-=(const KNMK_< R > &u)
Add_Mulc_KN_< R > operator-(const Mulc_KN_< R > &a, const Mulc_KN_< R > &b)
Definition: RNM.hpp:1525
const KNMKL_ & operator-=(const KNMKL_< R > &u)
KNMKL & operator+=(R a)
Definition: RNM.hpp:1333
ShapeOfArray shapej
Definition: RNM.hpp:726
KN(const KN_< S > &s, R(*f)(S))
Definition: RNM.hpp:913
Mulc_KN_(const KN_< R > &aa, R bb)
Definition: RNM.hpp:1421
Add_Mulc_KN_(const Mulc_KN_< R > &aa, const Mulc_KN_< R > &bb)
Definition: RNM.hpp:1434
KNMK & operator/=(R a)
Definition: RNM.hpp:1246
Add_KN_< R > operator+(const KN_< R > &a, const KN_< R > &b)
Definition: RNM.hpp:1492
KN(const KN_< S > &s)
Definition: RNM.hpp:905
KNM_(KNM_< R > U, const SubArray &si, const SubArray &sj)
Definition: RNM.hpp:461
Add_Mulc_KN_< R > operator+(const KN_< R > &b, const Mulc_KN_< R > &a)
Definition: RNM.hpp:1542
const KN_ & operator=(const Add_KN_< R > &u)
const KNM_ & operator*=(const KNM_< R > &u)
const KN_< R > & a
Definition: RNM.hpp:1406
const KN_ & operator+=(const Mul_KNM_KN_< R > &u)
ShapeOfArray operator*(int stepp) const
Definition: RNM.hpp:224
const KNM & operator/=(const KNM_< R > &u)
Definition: RNM.hpp:1175
const KN & operator-=(const Add_Mulc_KN_< R > &u)
Definition: RNM.hpp:1013
const KN & operator+=(const Mulc_KN_< R > &u)
Definition: RNM.hpp:1044
KNM_< R > t() const
Definition: RNM.hpp:526
KN(const int nn, const R &a)
Definition: RNM.hpp:896
const KN & operator=(const Sub_KN_< R > &u)
Definition: RNM.hpp:957
KNMKL & operator/=(const KNMKL_< R > &u)
Definition: RNM.hpp:1369
const KNMKL_ & operator+=(const KNMKL_< R > &u)
KN_< R > operator()(const char, const char) const
Definition: RNM.hpp:519
Mulc_KN_< R > operator*(const KN_< R > &a, const R &b)
Definition: RNM.hpp:1502
void updateInverseJacobian(const UInt &iQuadPt)
KNMK_(const KNMK_< R > &u)
Definition: RNM.hpp:634
R * v
Definition: RNM.hpp:275
const KNM & operator*=(R a)
Definition: RNM.hpp:1159
const KN & operator=(const Mul_KNM_KN_< R > &u)
Definition: RNM.hpp:972
ShapeOfArray shapej
Definition: RNM.hpp:586
int N(const ShapeOfArray &a, const ShapeOfArray &b)
Definition: RNM.hpp:254
Add_Mulc_KN_< R > operator+(const Mulc_KN_< R > &a, const KN_< R > &b)
Definition: RNM.hpp:1531
const KN & operator=(const KN_< R > &a)
Definition: RNM.hpp:940
const KN & operator-=(const Mul_KNM_KN_< R > &u)
Definition: RNM.hpp:1018
const KN_ & operator=(const MatriceCreuseDivKN_< R > &)
const KNMK_ & operator-=(R a)
const int next
Definition: RNM.hpp:182
KNM_(const KN_< R > &u, const ShapeOfArray &si, const ShapeOfArray &sj, int offset, int nnext)
Definition: RNM.hpp:455
const KN_ & operator+=(const Sub_KN_< R > &u)
KNMKL(const int n, const int m, const int k, const int l)
Definition: RNM.hpp:1300
ShapeOfArray shapei
Definition: RNM.hpp:725
Add_KN_(const KN_< R > &aa, const KN_< R > &bb)
Definition: RNM.hpp:1395
KNM_(KNM_< R > U, const SubArray &sa, const SubArray &si, const SubArray &sj)
Definition: RNM.hpp:466
const KNMKL_ & operator=(R a)
const KNM & operator+=(R a)
Definition: RNM.hpp:1144
const KN & operator-=(const Sub_KN_< R > &u)
Definition: RNM.hpp:1003
KNMK(const int n, const int m, const int k)
Definition: RNM.hpp:1207
KN(const KN_< R > &u)
Definition: RNM.hpp:924
const KN_ & operator*=(const KN_< R > &u)
Add_Mulc_KN_< R > operator-(const Mulc_KN_< R > &a, const KN_< R > &b)
Definition: RNM.hpp:1536
const KN_ & operator+=(R a)
SubArray(const FromTo &ft)
Definition: RNM.hpp:157
KN_< R > operator()(int i, int j, const char, int l) const
Definition: RNM.hpp:809
KNMK_(R *u, const int n, const int m, const int k)
Definition: RNM.hpp:617
KNMK & operator*=(const KNMK_< R > &u)
Definition: RNM.hpp:1267
const KNM & operator*=(const KNM_< R > &u)
Definition: RNM.hpp:1180
operator R*() const
Definition: RNM.hpp:285
int last() const
Definition: RNM.hpp:164
ShapeOfArray(const ShapeOfArray &s, int nn)
Definition: RNM.hpp:184
KNMKL & operator=(R a)
Definition: RNM.hpp:1328
int N() const
Definition: RNM.hpp:277
ShapeOfArray shapek
Definition: RNM.hpp:587
int operator[](int k) const
Definition: RNM.hpp:239
KNM_(KN_< R > u, int n, int m)
Definition: RNM.hpp:446
Add_Mulc_KN_< R > operator-(const KN_< R > &b, const Mulc_KN_< R > &a)
Definition: RNM.hpp:1547
KNMK & operator+=(R a)
Definition: RNM.hpp:1236
KNMK & operator-=(const KNMK_< R > &u)
Definition: RNM.hpp:1261
int N() const
Definition: RNM.hpp:593
KNM_(const KN_< R > &u, const ShapeOfArray &si, const ShapeOfArray &sj, int offset=0)
Definition: RNM.hpp:450
KN_ & operator--()
Definition: RNM.hpp:361
KNMKL & operator-=(R a)
Definition: RNM.hpp:1338
KNMKL & operator+=(const KNMKL_< R > &u)
Definition: RNM.hpp:1353
ShapeOfArray(const ShapeOfArray &old, int stepo, int start)
Definition: RNM.hpp:201
R & operator()(unsigned int i, unsigned int j) const
Definition: RNM.hpp:496
ShapeOfArray shapei
Definition: RNM.hpp:585
const int n
Definition: RNM.hpp:180
Mulc_KN_< R > operator-(const KN_< R > &a)
Definition: RNM.hpp:1512
KN_(const KN_< R > &u, int nnext, const ShapeOfArray &sh, int startv=0)
Definition: RNM.hpp:395
const KNM_ & operator/=(const KNM_< R > &u)
KNMKL(const KNMKL_< R > &u)
Definition: RNM.hpp:1303
KN_ operator--(int)
Definition: RNM.hpp:374
const KN_< R > a
Definition: RNM.hpp:1432
KNMKL_(const ShapeOfArray &s, const ShapeOfArray &si, const ShapeOfArray &sj, const ShapeOfArray &sk, const ShapeOfArray &sl, R *u)
Definition: RNM.hpp:754
KNMKL & operator/=(R a)
Definition: RNM.hpp:1343
KN_< R > operator()(const char, int j, int k) const
Definition: RNM.hpp:653
const KNM_ & operator-=(const KNM_< R > &u)
KNMKL & operator*=(R a)
Definition: RNM.hpp:1348
int M() const
Definition: RNM.hpp:426
KN_(const KN_< R > &u, const ShapeOfArray &sh, int startv=0)
Definition: RNM.hpp:392
KN_< R > operator()(const char, int j, int k, int l) const
Definition: RNM.hpp:797
R & operator()(int i, int j) const
Definition: RNM.hpp:487
KNMKL_(const KNMK_< R > &U, const SubArray &si, const SubArray &sj, const SubArray &sk, const SubArray &sl)
Definition: RNM.hpp:769
const KNM & operator-=(const KNM_< R > &u)
Definition: RNM.hpp:1169
KNMK & operator+=(const KNMK_< R > &u)
Definition: RNM.hpp:1256
const KN & operator+=(const Add_KN_< R > &u)
Definition: RNM.hpp:1034
KN_(R *u, int nn, int s)
Definition: RNM.hpp:384
int K() const
Definition: RNM.hpp:742
const KN & operator=(R a)
Definition: RNM.hpp:935
ShapeOfArray shapek
Definition: RNM.hpp:727
const KN & operator*=(const KN_< R > &a)
Definition: RNM.hpp:1076
const int step
Definition: RNM.hpp:181
int ijkl(const int i, const int j, const int k, const int l) const
Definition: RNM.hpp:782
KNMK_(const ShapeOfArray &s, const ShapeOfArray &si, const ShapeOfArray &sj, const ShapeOfArray &sk, R *u)
Definition: RNM.hpp:609
int N(const ShapeOfArray &a)
Definition: RNM.hpp:232
const KN_ & operator-=(const Add_Mulc_KN_< R > &u)
int indexijk(int i, int j, int k) const
Definition: RNM.hpp:642
ShapeOfArray shapei
Definition: RNM.hpp:415
int IsVector1() const
Definition: RNM.hpp:418
int M() const
Definition: RNM.hpp:738
const KN & operator+=(R a)
Definition: RNM.hpp:1024
KNMK & operator=(R a)
Definition: RNM.hpp:1231
const KN_ & operator-=(const KN_< R > &u)
const KN & operator+=(const Mul_KNM_KN_< R > &u)
Definition: RNM.hpp:1054
const KN_< R > b
Definition: RNM.hpp:1457
const KN_< R > b
Definition: RNM.hpp:1432
KNMKL & operator=(const KNMKL_< R > &u)
Definition: RNM.hpp:1323
KNM_(R *u, const ShapeOfArray &s, const ShapeOfArray &si, const ShapeOfArray &sj)
Definition: RNM.hpp:435
Add_Mulc_KN_(const Mulc_KN_< R > &aa, const KN_< R > &bb, const R cbb)
Definition: RNM.hpp:1439
int index(int k) const
Definition: RNM.hpp:219
const KNMK_ & operator*=(const KNMK_< R > &u)
KNMK_ operator()(SubArray si, SubArray sj, SubArray sk) const
Definition: RNM.hpp:698
int size() const
Definition: RNM.hpp:281
int len1() const
Definition: RNM.hpp:168
KNMKL_ operator()(SubArray si, SubArray sj, SubArray sk) const
Definition: RNM.hpp:859
KNMK & operator-=(R a)
Definition: RNM.hpp:1241
ShapeOfArray(int nn, int s, int nextt)
Definition: RNM.hpp:192
KNM(const KNM< R > &u)
Definition: RNM.hpp:1117
KNM_ operator()(const SubArray &sa, const SubArray &sb) const
Definition: RNM.hpp:474
const KNM_< R > A
Definition: RNM.hpp:1456
int size() const
Definition: RNM.hpp:430
KNMK(const KNMK< R > &u)
Definition: RNM.hpp:1215
ShapeOfArray(int nn, int s)
Definition: RNM.hpp:189
KNMK & operator=(const KNMK_< R > &u)
Definition: RNM.hpp:1226
const KN_ & operator/=(R a)
Add_Mulc_KN_(const KN_< R > &aa, const R caa, const KN_< R > &bb, const R cbb)
Definition: RNM.hpp:1444
const KNMKL_ & operator+=(R a)
const KN_ & operator-=(const Sub_KN_< R > &u)
KN_< R > operator()(const char, int j) const
Definition: RNM.hpp:511
const KN & operator-=(const KN_< R > &a)
Definition: RNM.hpp:993
const KNM & operator/=(R a)
Definition: RNM.hpp:1154
const KN_< R > & a
Definition: RNM.hpp:1419
int from
Definition: RNM.hpp:143
KN(const int nn)
Definition: RNM.hpp:887
const KN_ & operator+=(const Add_KN_< R > &u)
KNM_ & operator++()
Definition: RNM.hpp:543
const KN_ & operator/=(const KN_< R > &u)
int constant() const
Definition: RNM.hpp:215
const KN & operator/=(R a)
Definition: RNM.hpp:1061
int end() const
Definition: RNM.hpp:160
int M() const
Definition: RNM.hpp:597
const KNM & operator=(R a)
Definition: RNM.hpp:1139
KN_< R > operator()(int i, int j, int k, const char) const
Definition: RNM.hpp:815
const KNM_ & operator=(R a)
const KN_ & operator=(const Mulc_KN_< R > &u)
SubArray(int nn, int sta=0, int s=1)
Definition: RNM.hpp:155
unsigned int indexij(unsigned int i, unsigned int j) const
Definition: RNM.hpp:492
const KN_ & operator=(const KN_< R > &u)
KNMKL_(const KNMK_< R > &u)
Definition: RNM.hpp:778
const KNMK_ & operator+=(const KNMK_< R > &u)
const KNM & operator-=(R a)
Definition: RNM.hpp:1149
KN(const int nn, int s, const R a)
Definition: RNM.hpp:900
R & operator()(int i, int j, int k) const
Definition: RNM.hpp:647
KNM_< R > operator()(int i, const char, const char) const
Definition: RNM.hpp:681
const KN_ & operator+=(const KN_< R > &u)
R & operator[](int i) const
Definition: RNM.hpp:298
KN_(const KN_< R > &u)
Definition: RNM.hpp:289
const KNMK_ & operator=(const KNMK_< R > &u)
const KN & operator=(const MatriceCreuseMulKN_< R > &A)
Definition: RNM.hpp:977
ShapeOfArray shapel
Definition: RNM.hpp:728
KN_ & map(R(*)(R))
long unsigned int indexij(long unsigned int i, long unsigned int j) const
Definition: RNM.hpp:501
const int step
Definition: RNM.hpp:153
KNMK & operator/=(const KNMK_< R > &u)
Definition: RNM.hpp:1272
KN_< R > operator()(int i, const char) const
Definition: RNM.hpp:515
FromTo(int i, int j)
Definition: RNM.hpp:144
const KNM_ & operator*=(R a)
const KNMK_ & operator=(R a)
const KN_< R > & b
Definition: RNM.hpp:1394
Mulc_KN_< R > operator*(const R &b, const KN_< R > &a)
Definition: RNM.hpp:1507
KN_< R > operator()(int i, const char, int k, int l) const
Definition: RNM.hpp:803
KNM_ operator++(int)
Definition: RNM.hpp:553
R KNMmax() const
const KNMKL_ & operator/=(R a)
R operator,(const KN_< R > &v) const
KNM(const KNM_< R > &u)
Definition: RNM.hpp:1123
KNM_ & operator--()
Definition: RNM.hpp:548
const KN & operator+=(const Add_Mulc_KN_< R > &u)
Definition: RNM.hpp:1049
const KNMK_ & operator*=(R a)
const KN & operator=(const Add_KN_< R > &u)
Definition: RNM.hpp:952
const KN_ & operator-=(R a)
Sub_KN_< R > operator-(const KN_< R > &a, const KN_< R > &b)
Definition: RNM.hpp:1497
int IsVector1() const
Definition: RNM.hpp:589
ShapeOfArray(const ShapeOfArray &old, const SubArray &sub)
Definition: RNM.hpp:195
const KN_ & operator=(R a)
const KN_ & operator-=(const Mulc_KN_< R > &u)
const KNM & operator+=(const KNM_< R > &u)
Definition: RNM.hpp:1164
const KNMKL_ & operator/=(const KNMKL_< R > &u)
const KN & operator+=(const KN_< R > &a)
Definition: RNM.hpp:1029
const KN_< R > & b
Definition: RNM.hpp:1407
#define K_assert(i)
Definition: RNM.hpp:59
R & operator()(long unsigned int i, long unsigned int j) const
Definition: RNM.hpp:505
const int n
Definition: RNM.hpp:153
KNM_< R > operator()(const char, int j, const char) const
Definition: RNM.hpp:675
int indexijk(int i, int j, int k, int l) const
Definition: RNM.hpp:786
#define const_R
Definition: RNM.hpp:48
const KN & operator=(const Add_Mulc_KN_< R > &u)
Definition: RNM.hpp:967
KN(const KN< R > &u)
Definition: RNM.hpp:920
KN(const int nn, R(*f)(int i))
Definition: RNM.hpp:889
const int start
Definition: RNM.hpp:153
int size() const
Definition: RNM.hpp:605
const KNMK_ & operator+=(R a)
const KN_ & operator-=(const Mul_KNM_KN_< R > &u)
const KNMK_ & operator/=(const KNMK_< R > &u)
const KN_ & operator=(const Add_Mulc_KN_< R > &u)
const KN & operator=(const Mulc_KN_< R > &u)
Definition: RNM.hpp:962
const KN & operator/=(const KN_< R > &a)
Definition: RNM.hpp:1071
KN_ operator++(int)
Definition: RNM.hpp:367
Mulc_KN_(const Mulc_KN_< R > &aa, R bb)
Definition: RNM.hpp:1423
R sum() const
const KNM & operator=(const KNM_< R > &u)
Definition: RNM.hpp:1134
const KNMKL_ & operator*=(const KNMKL_< R > &u)
SubArray(const ShapeOfArray &)
Definition: RNM.hpp:260
const KN_ & operator=(const MatriceCreuseMulKN_< R > &)
int IsVector1() const
Definition: RNM.hpp:730
KNM_(const KNM_< R > &u)
Definition: RNM.hpp:470