lib_ex_pour_HZpp/Partie_2/algebre_lineaire/sparselib++/sp1_5c/include/tmvec.h

1 line
8.9 KiB
C
Raw Normal View History

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* ******** *** SparseLib++ */ /* ******* ** *** *** *** v. 1.5c */ /* ***** *** ******** ******** */ /* ***** *** ******** ******** R. Pozo */ /* ** ******* *** ** *** *** K. Remington */ /* ******** ******** A. Lumsdaine */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* */ /* */ /* SparseLib++ : Sparse Matrix Library */ /* */ /* National Institute of Standards and Technology */ /* University of Notre Dame */ /* Authors: R. Pozo, K. Remington, A. Lumsdaine */ /* */ /* NOTICE */ /* */ /* Permission to use, copy, modify, and distribute this software and */ /* its documentation for any purpose and without fee is hereby granted */ /* provided that the above notice appear in all copies and supporting */ /* documentation. */ /* */ /* Neither the Institutions (National Institute of Standards and Technology, */ /* University of Notre Dame) nor the Authors make any representations about */ /* the suitability of this software for any purpose. This software is */ /* provided ``as is'' without expressed or implied warranty. */ /* */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ // // mv_vector_TYPE.h Basic vector class (TYPE precision) // #ifndef _MV_VECTOR_TYPE_H #define _MV_VECTOR_TYPE_H // // Key features: // // o efficient indexing as fast as native C arrays // o supports only unit strides (for efficient indexing) // o copy-by-value semantics // o optional "share" semantics allows vectors to be constructed as // "views", or "references" of an existing memory, using // MV_Vector_::ref modifier in the constuctor. (see note below.) // o vector views can assign and references sections of vector, but // cannot modify their *size*. // o block-range indexing via MV_VecIndex class (e.g. A(I) = B; ) // (note for the above to work, A(I) must return a vector view.) // o optional range checking (compile switch) // o fast copying (A=B) via loop unrolling // o (experimental derived FMV_Vector class) for even faster copying via // memcpy() for data elements employing simple bit-wise copying (e.g. // float, complex, et.c) // o support for both [] and () style indexing ([] not available // for matrices.) // // NOTES: // // o O(N) loops for copying and assigning scalars to vectors unroll // loops to a depth of 4. Thus on some machines, it is faster // to execute A=scalar, than to manually assign a native C // array using an explicit for loop: // // for (i=0; i<N; d[i++] = scalar); // // o function code for the () and [] operators has been // inlined into the class declaration, for compilers // (e.g. Turbo C++ v. 3.0) that refuse to inline otherwise. // // o The MV_Vector(*TYPE, int len) constructor is now a deep-copy to // match the MV_Vector(con