⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gmf.h

📁 LAPACK++ (Linear Algebra PACKage in C++) is a software library for numerical linear algebra that sol
💻 H
📖 第 1 页 / 共 2 页
字号:
       * 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) */      LaGenMatFloat col(int k) const;            LaGenMatFloat& operator=(float 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.        *       * 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       LaGenMatFloat 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       LaGenMatFloat x = y(LaIndex(),LaIndex()).copy(); // correct deep-copy       \endverbatim       *       * Or this way:       * \verbatim       LaGenMatFloat 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.       */    LaGenMatFloat& operator=(const LaGenMatFloat& s); //copy    LaGenMatFloat& operator+=(float s);    LaGenMatFloat& add(float s);    LaGenMatFloat& resize(int m, int n);    LaGenMatFloat& resize(const LaGenMatFloat& s);    LaGenMatFloat& ref(const LaGenMatFloat& s);    LaGenMatFloat& inject(const LaGenMatFloat& s);    LaGenMatFloat& copy(const LaGenMatFloat& s);      /** Returns a newly allocated matrix that is an       * element-by-element copy of this matrix.       *       * New in lapackpp-2.5.2 */      LaGenMatFloat copy() const;      /** @name Expensive access functions */      //@{      /** Returns a newly allocated large matrix that consists of       * \c M-by-N copies of the given matrix. (New in       * lapackpp-2.4.5.) */      matrix_type repmat (int M, int N) const;      /** Returns the trace, i.e. the sum of all diagonal elements       * of the matrix. (New in lapackpp-2.4.5) */      value_type trace () const;      /** Returns a newly allocated column vector of dimension \c       * Nx1 that contains the diagonal of the given matrix. (New       * in lapackpp-2.4.5) */      matrix_type diag () const;      //@}    inline int shallow() const      // read global shallow flag        { return shallow_;}    inline int debug() const;       // read global debug flag    inline int debug(int d);        // set global debug flag    inline const LaGenMatFloat& info() const {             int *t = info_;             *t = 1;             return *this;};    //* I/O *//    friend DLLIMPORT std::ostream& operator<<(std::ostream&, const LaGenMatFloat&);    std::ostream& Info(std::ostream& s) const    {        s << "Size: (" << size(0) << "x" << size(1) << ") " ;        s << "Indeces: " << ii[0] << " " << ii[1];        s << "#ref: " << ref_count() << "addr: " << addr() << std::endl;        return s;    };      /** @name Matrix type conversions */      //@{      /** Convert this matrix to a complex matrix with imaginary part zero. */      LaGenMatComplex to_LaGenMatComplex() const;      /** Convert this matrix to a double (floating-point double precision) matrix. */      LaGenMatDouble to_LaGenMatDouble() const;      /** Convert this matrix to an int matrix. */      LaGenMatInt to_LaGenMatInt() const;      /** Convert this matrix to a long int matrix. */      LaGenMatLongInt to_LaGenMatLongInt() const;      //@}      /** @name Constructors for elementary matrices */      //@{      /** Returns a newly allocated all-zero matrix of dimension       * \c NxN, if \c M is not given, or \c NxM if \c M is given.       * (New in lapackpp-2.4.5) */      static matrix_type zeros (int N, int M=0);      /** Returns a newly allocated all-one matrix of dimension \c       * NxN, if \c M is not given, or \c NxM if \c M is given.       * (New in lapackpp-2.4.5) */      static matrix_type ones (int N, int M=0);      /** Returns a newly allocated identity matrix of dimension       * \c NxN, if \c M is not given, or a rectangular matrix \c       * NxM if \c M is given.  (New in lapackpp-2.4.5) */      static matrix_type eye (int N, int M=0);      /** Returns a newly allocated matrix of dimension \c NxM       * with pseudo-random values. The values are uniformly       * distributed in the interval \c (0,1) or, if specified, \c       * (low,high).  (New in lapackpp-2.4.5)       *       * Note: Since this uses the system's \c rand() call, the       * randomness of the values might be questionable -- don't       * use this if you need really strong random numbers. */      static matrix_type rand (int N, int M,			       value_type low=0, value_type high=1);      /** Returns a newly allocated diagonal matrix of dimension       * \c NxN that has the vector \c vect of length \c N on the       * diagonal.  (New in lapackpp-2.4.5) */      static matrix_type from_diag (const matrix_type &vect);      /** Returns a newly allocated linarly spaced column vector       * with \c nr_points elements, between and including \c       * start and \c end. (New in lapackpp-2.4.5.) */      static matrix_type linspace (value_type start, value_type end,				   int nr_points);      //@}};  //* End of LaGenMatFloat Class *//namespace la {   /** The matrix data type containing (single-precision) \c float       values. */   typedef LaGenMatFloat fmat;} // namespace/** Print the matrix to the given output stream. If the matrix * info flag is set, then this prints only the matrix info, * see LaGenMatDouble::info(). Otherwise all matrix elements * are printed.  * * \see LaPreferences::setPrintFormat()  */DLLIMPORTstd::ostream& operator<<(std::ostream&, const LaGenMatFloat&);            //* Member Functions *// inline int LaGenMatFloat::size(int d) const{    return sz[d];}inline int LaGenMatFloat::inc(int d) const{    return ii[d].inc();}inline int LaGenMatFloat::gdim(int d) const{    return dim[d];}inline int LaGenMatFloat::start(int d) const{    return ii[d].start();}inline int LaGenMatFloat::end(int d) const{    return ii[d].end();}inline int LaGenMatFloat::ref_count() const{    return v.ref_count();}inline LaIndex LaGenMatFloat::index(int d)  const{    return ii[d];}inline float* LaGenMatFloat::addr() const{    return  v.addr();}inline int LaGenMatFloat::debug() const{    return debug_;}inline int LaGenMatFloat::debug(int d){    return debug_ = d;}inline float& LaGenMatFloat::operator()(int i, int j){#ifdef LA_BOUNDS_CHECK    assert(i>=0);    assert(i<size(0));    assert(j>=0);    assert(j<size(1));#endif    return v( dim[0]*(ii[1].start() + j*ii[1].inc()) +                 ii[0].start() + i*ii[0].inc());}inline float& LaGenMatFloat::operator()(int i, int j) const{#ifdef LA_BOUNDS_CHECK    assert(i>=0);    assert(i<size(0));    assert(j>=0);    assert(j<size(1));#endif    return v( dim[0]*(ii[1].start() + j*ii[1].inc()) +                 ii[0].start() + i*ii[0].inc());}inline  LaGenMatFloat&  LaGenMatFloat::shallow_assign(){    shallow_ = 1;    return *this;}#endif // _LA_GEN_MAT_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -