当前位置: 首页>>代码示例>>C++>>正文


C++ matrix_type::Width方法代码示例

本文整理汇总了C++中matrix_type::Width方法的典型用法代码示例。如果您正苦于以下问题:C++ matrix_type::Width方法的具体用法?C++ matrix_type::Width怎么用?C++ matrix_type::Width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matrix_type的用法示例。


在下文中一共展示了matrix_type::Width方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: multiply

  /**
   * 17.
   * @brief Multiply one scalar with matrix.
   * @param[in] A The matrix.
   * @param[in] a The scalar.
   * @param[out] B B is overwritten with (A*B).
   */
  static void multiply(const matrix_type& A,
                       const value_type& a,
                       matrix_type& B) {
    /** Result matrices should always be of the right size */
    B.Resize(A.Height(), A.Width());

    /** Get the matrix dimensions. */
    const int m = A.Height();
    const int n = A.Width();
   
    /** Simple scalar-matrix product. */ 
    for (int i=0; i<m; ++i)
      for (int j=0; j<n; ++j)
        B.Set(i, j, (a*A.Get(i, j)));
  }
开发者ID:yyzreal,项目名称:AMD,代码行数:22,代码来源:ElementalMatrixAdaptor.hpp

示例2: elementwiseProduct

  /** 
   * 16. 
   * @brief Compute the element-wise product of two matrices.
   * @param[in] A the first matrix.
   * @param[in] B the second matrix.
   * @param[out] C the result, which contains A.*B.
   */ 
  static void elementwiseProduct(const matrix_type& A,
                              const matrix_type& B,
                              matrix_type& C) {

    /** Result matrices should always be of the right size */
    C.Resize (A.Height(), A.Width());

    /* Get the matrix dimensions */
    const int m = A.Height();
    const int n = A.Width();

    /* Simple element-wise product */
    for (int i=0; i<m; ++i) 
      for (int j=0; j<n; ++j) 
        C.Set(i, j, (A.Get(i,j)*B.Get(i,j)));
  }
开发者ID:yyzreal,项目名称:AMD,代码行数:23,代码来源:ElementalMatrixAdaptor.hpp

示例3: copy

  /** 
   * 13. 
   * @brief Copy the contents of a matrix.
   * @param[out] A A is overwritten with B.
   * @param[in] B The matrix to be copied.
   */
  static void copy (matrix_type &A, const matrix_type &B) { 

    /** Result matrices should always be of the right size */
    A.Resize (B.Height(), B.Width());

    /** This one is pretty simple, but the order is different */
    elem::Copy (B, A);
  }
开发者ID:yyzreal,项目名称:AMD,代码行数:14,代码来源:ElementalMatrixAdaptor.hpp

示例4: diag

  /** 
   * 15. 
   * @brief Extract the diagonal elements of a matrix.
   * @param[in] A The (square) matrix whose diagonal is to be extracted.
   * @param[out] B A diagonal matrix containing entries from A.
   */
  static void diag(const matrix_type& A,
                   matrix_type& B) {
    /* create a zeros matrix of the right dimension and assign to B */
    const int n = A.Width();
    B = zeros(n, n);

    /* Set the diagonals of B */
    for (int i=0; i<n; ++i) B.Set(i, i, A.Get(i,i));
  }
开发者ID:yyzreal,项目名称:AMD,代码行数:15,代码来源:ElementalMatrixAdaptor.hpp

示例5: transpose

  /** 
   * 6. 
   * @brief Compute the matrix transpose.
   * @param[in] A The matrix to be transposed.
   * @param[out] B B is overwritten with A^{T}
   */
  static void transpose (const matrix_type& A, 
                         matrix_type& B) {

    /** Result matrices should always have sufficient space */
    B.Resize(A.Width(), A.Height());

    /** Compute transpose */
    elem::Transpose (A, B);
  }
开发者ID:yyzreal,项目名称:AMD,代码行数:15,代码来源:ElementalMatrixAdaptor.hpp

示例6: negation

  /** 
   * 7. 
   * @brief Compute element-wise negation of a matrix.
   * @param[in] A The matrix to be negated.
   * @param[out] B B is overwritten with -1.0*A
   */
  static void negation (const matrix_type& A,
                        matrix_type& B) {

    /** Result matrices should always have sufficient space */
    B.Resize(A.Height(), A.Width());

    /** Copy over the matrix */
    elem::Copy (A, B);

    /** Multiply by -1.0 */
    elem::Scal(-1.0, B);
  }
开发者ID:yyzreal,项目名称:AMD,代码行数:18,代码来源:ElementalMatrixAdaptor.hpp

示例7: minus

  /** 
   * 4. 
   * @brief Subtract one matrix from another.
   * @param[in] A The first matrix
   * @param[in] B The second matrix
   * @param[out] C C is overwritten with (A-B)
   */
  static void minus (const matrix_type& A,
                     const matrix_type& B, 
                     matrix_type& C) {

    /** Result matrices should always have sufficient space */
    C.Resize(A.Height(), A.Width());

    /** first copy the matrix over */
    elem::Copy (A, C);

    /** now, subtract the other matrix in */
    elem::Axpy (-1.0, B, C);
  }
开发者ID:yyzreal,项目名称:AMD,代码行数:20,代码来源:ElementalMatrixAdaptor.hpp

示例8: apply

    /**
     * Apply columnwise the sketching transform that is described by the
     * the transform with output sketch_of_A.
     */
    void apply (const matrix_type& A,
                output_matrix_type& sketch_of_A,
                columnwise_tag dimension) const {

        const value_type *a = A.LockedBuffer();
        El::Int lda = A.LDim();
        value_type *sa = sketch_of_A.Buffer();
        El::Int ldsa = sketch_of_A.LDim();

        for (El::Int j = 0; j < A.Width(); j++)
            for (El::Int i = 0; i < data_type::_S; i++)
                sa[j * ldsa + i] = a[j * lda + data_type::_samples[i]];
    }
开发者ID:TPNguyen,项目名称:libskylark,代码行数:17,代码来源:UST_Elemental.hpp

示例9: apply_impl_vdist

    void apply_impl_vdist(const matrix_type& A,
                         output_matrix_type& sketch_of_A,
                         skylark::sketch::columnwise_tag tag) const {

        matrix_type sketch_of_A_STAR_RD(data_type::_S,
                                        A.Width());

        dense_transform_t<matrix_type, matrix_type, ValuesAccessor>
            transform(*this);

        transform.apply(A, sketch_of_A_STAR_RD, tag);

        sketch_of_A = sketch_of_A_STAR_RD;
    }
开发者ID:TPNguyen,项目名称:libskylark,代码行数:14,代码来源:dense_transform_Elemental_star_rowdist_star_star.hpp

示例10: getNumCols

 /**
  * 2.
  * @brief A function to return the number of cols in a matrix
  * @param[in] A The matrix for which we need the number of cols.
  * @return number of cols in A
  */
 static int getNumCols (const matrix_type& A) { return A.Width(); }
开发者ID:yyzreal,项目名称:AMD,代码行数:7,代码来源:ElementalMatrixAdaptor.hpp


注:本文中的matrix_type::Width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。