📄 gmc.h
字号:
* N matrix, \c size(0) returns M and \c size(1) returns N. */ inline int size(int d) const; // submatrix size /** Returns the number of columns, i.e. for a M x N matrix * this returns N. New in lapackpp-2.4.4. */ inline int cols() const { return size(1); } /** Returns the number of rows, i.e. for a M x N matrix this * returns M. New in lapackpp-2.4.4. */ inline int rows() const { return size(0); } /** Returns the distance between memory locations (in terms of * number of elements) between consecutive elements along * dimension d. For example, if \c inc(d) returns 1, then * elements along the dth dimension are contiguous in * memory. */ inline int inc(int d) const; // explicit increment /** Returns the global dimensions of the (possibly larger) * matrix owning this space. This will only differ from \c * size(d) if the current matrix is actually a submatrix view * of some larger matrix. */ inline int gdim(int d) const; // global dimensions /** If the memory space used by this matrix is viewed as a * linear array, \c start(d) returns the starting offset of * the first element in dimension \c d. (See \ref LaIndex * class.) */ inline int start(int d) const; // return ii[d].start() /** If the memory space used by this matrix is viewed as a * linear array, \c end(d) returns the starting offset of the * last element in dimension \c d. (See \ref LaIndex * class.) */ inline int end(int d) const; // return ii[d].end() /** Returns the index specifying this submatrix view in * dimension \c d. (See \ref LaIndex class.) This will only * differ from a unit-stride index if the current matrix is * actually a submatrix view of some larger matrix. */ inline LaIndex index(int d) const;// index /** Returns the number of data objects which utilize the same * (or portions of the same) memory space used by this * matrix. */ inline int ref_count() const; /** Returns the memory address of the first element of the * matrix. \c G.addr() is equivalent to \c &G(0,0) . */ inline COMPLEX* addr() const; // begining addr of data space //@} /** @name Access functions */ //@{ /** Returns the \f$(i,j)\f$th element of this matrix, with the * indices i and j starting at zero (zero-based offset). This * means you have * * \f[ A_{n\times m} = \left(\begin{array}{ccc} a_{11} & & * a_{1m} \\ & \ddots & \\ a_{n1} & & a_{nm} * \end{array}\right) * \f] * * but for accessing the element \f$a_{11}\f$ you have to * write @c A(0,0). * * Optional runtime bounds checking (0<=i<m, 0<=j<n) is set * by the compile time macro LA_BOUNDS_CHECK. */ inline COMPLEX& operator()(int i, int j); /** Returns the \f$(i,j)\f$th element of this matrix, with the * indices i and j starting at zero (zero-based offset). This * means you have * * \f[ A_{n\times m} = \left(\begin{array}{ccc} a_{11} & & * a_{1m} \\ & \ddots & \\ a_{n1} & & a_{nm} * \end{array}\right) * \f] * * but for accessing the element \f$a_{11}\f$ you have to * write @c A(0,0). * * Optional runtime bounds checking (0<=i<m, 0<=j<n) is set * by the compile time macro LA_BOUNDS_CHECK. */ inline COMPLEX& operator()(int i, int j) const; /** Return a submatrix view specified by the indices I and * J. (See \ref LaIndex class.) These indices specify start, * increment, and ending offsets, similar to triplet notation * of Matlab or Fortran 90. For example, if B is a 10 x 10 * matrix, I is \c (0:2:2) and J is \c (3:1:4), then \c B(I,J) * denotes the 2 x 2 matrix * * \f[ \left(\begin{array}{cc} b_{0,3} & b_{2,3} \\ * b_{0,4} & b_{4,4} * \end{array}\right) \f] */ LaGenMatComplex operator()(const LaIndex& I, const LaIndex& J) ; /** Return a submatrix view specified by the indices I and * J. (See \ref LaIndex class.) These indices specify start, * increment, and ending offsets, similar to triplet notation * of Matlab or Fortran 90. For example, if B is a 10 x 10 * matrix, I is \c (0:2:2) and J is \c (3:1:4), then \c B(I,J) * denotes the 2 x 2 matrix * * \f[ \left(\begin{array}{cc} b_{0,3} & b_{2,3} \\ * b_{0,4} & b_{4,4} * \end{array}\right) \f] */ LaGenMatComplex operator()(const LaIndex& I, const LaIndex& J) const; /** Returns a submatrix view for the specified row \c k of * this matrix. * * The returned object references still the same memory as * this object, so if you modify elements, they will appear * modified in both objects. (New in lapackpp-2.4.6) */ LaGenMatComplex row(int k); /** Returns a submatrix view for the specified row \c k of * this matrix. * * The returned object references still the same memory as * this object, so if you modify elements, they will appear * modified in both objects. (New in lapackpp-2.4.6) */ LaGenMatComplex row(int k) const; /** Returns a submatrix view for the specified column \c k * of this matrix. * * The returned object references still the same memory as * this object, so if you modify elements, they will appear * modified in both objects. (New in lapackpp-2.4.6) */ LaGenMatComplex col(int k); /** Returns a submatrix view for the specified column \c k * of this matrix. * * The returned object references still the same memory as * this object, so if you modify elements, they will appear * modified in both objects. (New in lapackpp-2.4.6) */ LaGenMatComplex col(int k) const; //@} /** @name Assignments */ //@{ /** Set elements of left-hand size to the scalar value s. No * new matrix is created, so that if there are other matrices * that reference this memory space, they will also be * affected. */ LaGenMatComplex& operator=(COMPLEX s); // CS: addition /** Set elements of left-hand size to the scalar value s. No * new matrix is created, so that if there are other matrices * that reference this memory space, they will also be * affected. */ LaGenMatComplex& operator=(const LaComplex& s); /* Set elements of left-hand size to the scalar value s. No * new matrix is created, so that if there are other matrices * that reference this memory space, they will also be * affected. */ //LaGenMatComplex& operator=(const std::complex<double>& s); // CS: end /** Release left-hand side (reclaiming memory space if * possible) and copy elements of elements of \c s. Unline \c * inject(), it does not require conformity, and previous * references of left-hand side are unaffected. * * This is an alias for copy(). * * Watch out! Due to the C++ "named return value optimization" * you cannot use this as an alias for copy() when declaring a * variable if the right-side is a return value of * operator(). More precisely, you cannot write the following: * \verbatim LaGenMatComplex x = y(LaIndex(),LaIndex()); // erroneous reference copy! \endverbatim * * Instead, if the initialization should create a new copy of * the right-side matrix, you have to write it this way: * \verbatim LaGenMatComplex x = y(LaIndex(),LaIndex()).copy(); // correct deep-copy \endverbatim * * Or this way: * \verbatim LaGenMatComplex x; x = y(LaIndex(),LaIndex()); // correct deep-copy \endverbatim * * Note: The manual for lapack++-1.1 claimed that this * operator would be an alias for ref(), not for copy(), * i.e. this operator creates a reference instead of a deep * copy. However, since that confused many people, the * behaviour was changed so that B=A will now create B as a * deep copy instead of a reference. If you want a * reference, please write B.ref(A) explicitly. */ LaGenMatComplex& operator=(const LaGenMatComplex& s); //copy /** Add the scalar value s to elements of left-hand side. No * new matrix is created, so that if there are other matrices * that reference this memory space, they will also be * affected. * * @note This method is rather slow. In many cases, it can * be much faster to use Blas_Mat_Mult() with a Ones-Matrix * instead. */ LaGenMatComplex& operator+=(COMPLEX s); /** Add the scalar value s to elements of left-hand side. No * new matrix is created, so that if there are other matrices * that reference this memory space, they will also be * affected. (New in lapackpp-2.4.7.) */ LaGenMatComplex& add(COMPLEX s); /** Scale the left-hand side matrix by the given scalar * value. No new matrix is created, so that if there are * other matrices that reference this memory space, they * will also be affected. (New in lapackpp-2.4.7.) */ LaGenMatComplex& scale(const LaComplex& s); /** Scale the left-hand side matrix by the given scalar * value. No new matrix is created, so that if there are * other matrices that reference this memory space, they * will also be affected. (New in lapackpp-2.4.7.) */ LaGenMatComplex& scale(COMPLEX s); /** Scale the left-hand side matrix by the given scalar * value. No new matrix is created, so that if there are * other matrices that reference this memory space, they * will also be affected. (New in lapackpp-2.4.7.) */ LaGenMatComplex& operator*=(COMPLEX s); /** Copy elements of s into the memory space referenced by the * left-hand side, without first releasing it. The effect is * that if other matrices share memory with left-hand side, * they too will be affected. Note that the size of s must be * the same as that of the left-hand side matrix. * * @note If you rather wanted to create a new copy of \c s, * you should use \c copy() instead. */ LaGenMatComplex& inject(const LaGenMatComplex& s); /** Release left-hand side (reclaiming memory space if * possible) and copy elements of elements of \c s. Unline \c * inject(), it does not require conformity, and previous * references of left-hand side are unaffected. */ LaGenMatComplex& copy(const LaGenMatComplex& s); /** Returns a newly allocated matrix that is an * element-by-element copy of this matrix. * * New in lapackpp-2.5.2 */ LaGenMatComplex copy() const; /** Release left-hand side (reclaiming memory space if possible) * and copy elements of \c s_real as real part and \c s_imag as * imaginary part into the left-hand side. If \c s_imag is not * given, an imaginary part of zero is used. * * Unline \c inject(), it does not require conformity, and * previous references of left-hand side are unaffected. */ LaGenMatComplex& copy(const LaGenMatDouble& s_real, const LaGenMatDouble& s_imag = LaGenMatDouble()); /** This is an optimization for returning temporary matrices * from functions, without copying. The shallow_assign() * function essentially sets an internal flag which instructs * the \c X::X(&X) copy constructor to avoid the copying. */ inline LaGenMatComplex& shallow_assign(); /** Let this matrix reference the given matrix s, so that the * given matrix memory s is now referenced by multiple objects * (by the given object s and now also by this object). Handle
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -