text:
//=================================================================================================

//=================================================================================================

#ifndef _BLAZE_MATH_EXPRESSIONS_DMATTDMATSUBEXPR_H_
#define _BLAZE_MATH_EXPRESSIONS_DMATTDMATSUBEXPR_H_

//*************************************************************************************************
// Includes
//*************************************************************************************************

#include <utility>
#include <blaze/math/Aliases.h>
#include <blaze/math/constraints/ColumnMajorMatrix.h>
#include <blaze/math/constraints/DenseMatrix.h>
#include <blaze/math/constraints/MatMatSubExpr.h>
#include <blaze/math/constraints/RequiresEvaluation.h>
#include <blaze/math/constraints/RowMajorMatrix.h>
#include <blaze/math/constraints/StorageOrder.h>
#include <blaze/math/Exception.h>
#include <blaze/math/expressions/Computation.h>
#include <blaze/math/expressions/DenseMatrix.h>
#include <blaze/math/expressions/Forward.h>
#include <blaze/math/expressions/MatMatSubExpr.h>
#include <blaze/math/shims/Serial.h>
#include <blaze/math/traits/SubTrait.h>
#include <blaze/math/typetraits/IsAligned.h>
#include <blaze/math/typetraits/IsExpression.h>
#include <blaze/math/typetraits/IsOperation.h>
#include <blaze/math/typetraits/IsSymmetric.h>
#include <blaze/math/typetraits/IsTemporary.h>
#include <blaze/math/typetraits/RequiresEvaluation.h>
#include <blaze/system/Blocking.h>
#include <blaze/system/Thresholds.h>
#include <blaze/util/Assert.h>
#include <blaze/util/EnableIf.h>
#include <blaze/util/FunctionTrace.h>
#include <blaze/util/IntegralConstant.h>
#include <blaze/util/mpl/If.h>
#include <blaze/util/Types.h>

namespace blaze {

//=================================================================================================
//
//  CLASS DMATTDMATSUBEXPR
//
//=================================================================================================

//*************************************************************************************************
/*!\brief Expression object for dense matrix-transpose dense matrix subtractions.
// \ingroup dense_matrix_expression
//
// The DMatTDMatSubExpr class represents the compile time expression for subtractions between
// a row-major dense matrix and a column-major dense matrix.
*/
template< typename MT1    // Type of the left-hand side dense matrix
        , typename MT2 >  // Type of the right-hand side dense matrix
class DMatTDMatSubExpr
   : public MatMatSubExpr< DenseMatrix< DMatTDMatSubExpr<MT1,MT2>, false > >
   , private Computation
{
 private:
   //**Type definitions****************************************************************************
   using RT1 = ResultType_t<MT1>;     //!< Result type of the left-hand side dense matrix expression.
   using RT2 = ResultType_t<MT2>;     //!< Result type of the right-hand side dense matrix expression.
   using RN1 = ReturnType_t<MT1>;     //!< Return type of the left-hand side dense matrix expression.
   using RN2 = ReturnType_t<MT2>;     //!< Return type of the right-hand side dense matrix expression.
   using CT1 = CompositeType_t<MT1>;  //!< Composite type of the left-hand side dense matrix expression.
   using CT2 = CompositeType_t<MT2>;  //!< Composite type of the right-hand side dense matrix expression.
   //**********************************************************************************************

   //**Return type evaluation**********************************************************************
   //! Compilation switch for the selection of the subscript operator return type.
   /*! The \a returnExpr compile time constant expression is a compilation switch for the
       selection of the \a ReturnType. If either matrix operand returns a temporary vector
       or matrix, \a returnExpr will be set to \a false and the subscript operator will
       return it's result by value. Otherwise \a returnExpr will be set to \a true and
       the subscript operator may return it's result as an expression. */
   static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );

   //! Expression return type for the subscript operator.
   using ExprReturnType = decltype( std::declval<RN1>() - std::declval<RN2>() );
   //**********************************************************************************************

   //**Serial evaluation strategy******************************************************************
   //! Compilation switch for the serial evaluation strategy of the subtraction expression.
   /*! The \a useAssign compile time constant expression represents a compilation switch for the
       serial evaluation strategy of the subtraction expression. In case either of the two dense
       matrix operands requires an intermediate evaluation or the subscript operator can only
       return by value, \a useAssign will be set to 1 and the subtraction expression will be
       evaluated via the \a assign function family. Otherwise \a useAssign will be set to 0
       and the expression will be evaluated via the function call operator. */
   static constexpr bool useAssign =
      ( RequiresEvaluation_v<MT1> || RequiresEvaluation_v<MT2> || !returnExpr );

   /*! \cond BLAZE_INTERNAL */
   //! Helper variable template for the explicit application of the SFINAE principle.
   template< typename MT >
   static constexpr bool UseAssign_v = useAssign;
   /*! \endcond */
   //**********************************************************************************************

   //**Parallel evaluation strategy****************************************************************
   /*! \cond BLAZE_INTERNAL */
   //! Helper variable template for the explicit application of the SFINAE principle.
   /*! This variable template is a helper for the selection of the parallel evaluation strategy.
       In case at least one of the two matrix operands is not SMP assignable and at least one of
       the two operands requires an intermediate evaluation, the variable is set to 1 and the
       expression specific evaluation strategy is selected. Otherwise the variable is set to 0
       and the default strategy is chosen. */
   template< typename MT >
   static constexpr bool UseSMPAssign_v =
      ( ( !MT1::smpAssignable || !MT2::smpAssignable ) && useAssign );
   /*! \endcond */
   //**********************************************************************************************

 public:
   //**Type definitions****************************************************************************
   using This          = DMatTDMatSubExpr<MT1,MT2>;    //!< Type of this DMatTDMatSubExpr instance.
   using BaseType      = DenseMatrix<This,false>;      //!< Base type of this DMatTDMatSubExpr instance.
   using ResultType    = SubTrait_t<RT1,RT2>;          //!< Result type for expression template evaluations.
   using OppositeType  = OppositeType_t<ResultType>;   //!< Result type with opposite storage order for expression template evaluations.
   using TransposeType = TransposeType_t<ResultType>;  //!< Transpose type for expression template evaluations.
   using ElementType   = ElementType_t<ResultType>;    //!< Resulting element type.

   //! Return type for expression template evaluations.
   using ReturnType = const If_t< returnExpr, ExprReturnType, ElementType >;

   //! Data type for composite expression templates.
   using CompositeType = const ResultType;

   //! Composite type of the left-hand side dense matrix expression.
   using LeftOperand = If_t< IsExpression_v<MT1>, const MT1, const MT1& >;

   //! Composite type of the right-hand side dense matrix expression.
   using RightOperand = If_t< IsExpression_v<MT2>, const MT2, const MT2& >;
   //**********************************************************************************************

   //**Compilation flags***************************************************************************
   //! Compilation switch for the expression template evaluation strategy.
   static constexpr bool simdEnabled = false;

   //! Compilation switch for the expression template assignment strategy.
   static constexpr bool smpAssignable = ( MT1::smpAssignable && MT2::smpAssignable );
   //**********************************************************************************************

   //**Constructor*********************************************************************************
   /*!\brief Constructor for the DMatTDMatSubExpr class.
   //
   // \param lhs The left-hand side operand of the subtraction expression.
   // \param rhs The right-hand side operand of the subtraction expression.
   */
   inline DMatTDMatSubExpr( const MT1& lhs, const MT2& rhs ) noexcept
      : lhs_( lhs )  // Left-hand side dense matrix of the subtraction expression
      , rhs_( rhs )  // Right-hand side dense matrix of the subtraction expression
   {
      BLAZE_INTERNAL_ASSERT( lhs.rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.columns(), "Invalid number of columns" );
   }
   //**********************************************************************************************

   //**Access operator*****************************************************************************
   /*!\brief 2D-access to the matrix elements.
   //
   // \param i Access index for the row. The index has to be in the range \f$[0..M-1]\f$.
   // \param j Access index for the column. The index has to be in the range \f$[0..N-1]\f$.
   // \return The resulting value.
   */
   inline ReturnType operator()( size_t i, size_t j ) const {
      BLAZE_INTERNAL_ASSERT( i < lhs_.rows()   , "Invalid row access index"    );
      BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
      return lhs_(i,j) - rhs_(i,j);
   }
   //**********************************************************************************************

   //**At function*********************************************************************************
   /*!\brief Checked access to the matrix elements.
   //
   // \param i Access index for the row. The index has to be in the range \f$[0..M-1]\f$.
   // \param j Access index for the column. The index has to be in the range \f$[0..N-1]\f$.
   // \return The resulting value.
   // \exception std::out_of_range Invalid matrix access index.
   */
   inline ReturnType at( size_t i, size_t j ) const {
      if( i >= lhs_.rows() ) {
         BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
      }
      if( j >= lhs_.columns() ) {
         BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
      }
      return (*this)(i,j);
   }
   //**********************************************************************************************

   //**Rows function*******************************************************************************
   /*!\brief Returns the current number of rows of the matrix.
   //
   // \return The number of rows of the matrix.
   */
   inline size_t rows() const noexcept {
      return lhs_.rows();
   }
   //**********************************************************************************************

   //**Columns function****************************************************************************
   /*!\brief Returns the current number of columns of the matrix.
   //
   // \return The number of columns of the matrix.
   */
   inline size_t columns() const noexcept {
      return lhs_.columns();
   }
   //**********************************************************************************************

   //**Left operand access*************************************************************************
   /*!\brief Returns the left-hand side dense matrix operand.
   //
   // \return The left-hand side dense matrix operand.
   */
   inline LeftOperand leftOperand() const noexcept {
      return lhs_;
   }
   //**********************************************************************************************

   //**Right operand access************************************************************************
   /*!\brief Returns the right-hand side transpose dense matrix operand.
   //
   // \return The right-hand side transpose dense matrix operand.
   */
   inline RightOperand rightOperand() const noexcept {
      return rhs_;
   }
   //**********************************************************************************************

   //**********************************************************************************************
   /*!\brief Returns whether the expression can alias with the given address \a alias.
   //
   // \param alias The alias to be checked.
   // \return \a true in case the expression can alias, \a false otherwise.
   */
   template< typename T >
   inline bool canAlias( const T* alias ) const noexcept {
      return ( IsExpression_v<MT1> && ( RequiresEvaluation_v<MT1> ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
             ( IsExpression_v<MT2> && ( RequiresEvaluation_v<MT2> ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
   }
   //**********************************************************************************************

   //**********************************************************************************************
   /*!\brief Returns whether the expression is aliased with the given address \a alias.
   //
   // \param alias The alias to be checked.
   // \return \a true in case an alias effect is detected, \a false otherwise.
   */
   template< typename T >
   inline bool isAliased( const T* alias ) const noexcept {
      return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
   }
   //**********************************************************************************************

   //**********************************************************************************************
   /*!\brief Returns whether the operands of the expression are properly aligned in memory.
   //
   // \return \a true in case the operands are aligned, \a false if not.
   */
   inline bool isAligned() const noexcept {
      return lhs_.isAligned() && rhs_.isAligned();
   }
   //**********************************************************************************************

   //**********************************************************************************************
   /*!\brief Returns whether the expression can be used in SMP assignments.
   //
   // \return \a true in case the expression can be used in SMP assignments, \a false if not.
   */
   inline bool canSMPAssign() const noexcept {
      return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
             ( rows() * columns() >= SMP_DMATTDMATSUB_THRESHOLD );
   }
   //**********************************************************************************************

 private:
   //**Member variables****************************************************************************
   LeftOperand  lhs_;  //!< Left-hand side dense matrix of the subtraction expression.
   RightOperand rhs_;  //!< Right-hand side dense matrix of the subtraction expression.
   //**********************************************************************************************

   //**Assignment to dense matrices****************************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief Assignment of a dense matrix-transpose dense matrix subtraction to a dense matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression to be assigned.
   // \return void
   //
   // This function implements the performance optimized assignment of a dense matrix-transpose
   // dense matrix subtraction expression to a dense matrix. Due to the explicit application of
   // the SFINAE principle, this function can only be selected by the compiler in case neither
   // of the two operands requires an intermediate evaluation.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto assign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> DisableIf_t< UseAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      constexpr size_t block( BLOCK_SIZE );

      const size_t m( rhs.rows() );
      const size_t n( rhs.columns() );

      for( size_t ii=0UL; ii<m; ii+=block ) {
         const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
         for( size_t jj=0UL; jj<n; jj+=block ) {
            const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
            for( size_t i=ii; i<iend; ++i ) {
               for( size_t j=jj; j<jend; ++j ) {
                  (~lhs)(i,j) = rhs.lhs_(i,j) - rhs.rhs_(i,j);
               }
            }
         }
      }
   }
   /*! \endcond */
   //**********************************************************************************************

   //**Assignment to dense matrices****************************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief Assignment of a dense matrix-transpose dense matrix subtraction to a dense matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression to be assigned.
   // \return void
   //
   // This function implements the performance optimized assignment of a dense matrix-transpose
   // dense matrix subtraction expression to a dense matrix. Due to the explicit application of
   // the SFINAE principle, this function can only be selected by the compiler in case either
   // of the two operands requires an intermediate evaluation.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto assign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> EnableIf_t< UseAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      if( !IsOperation_v<MT1> && isSame( ~lhs, rhs.lhs_ ) ) {
         subAssign( ~lhs, rhs.rhs_ );
      }
      else if( ( !IsOperation_v<MT2> && isSame( ~lhs, rhs.rhs_ ) ) ||
               ( !RequiresEvaluation_v<MT2> && rhs.rhs_.isAliased( &(~lhs) ) ) ) {
         assign   ( ~lhs, -rhs.rhs_ );
         addAssign( ~lhs,  rhs.lhs_ );
      }
      else {
         assign   ( ~lhs, rhs.lhs_ );
         subAssign( ~lhs, rhs.rhs_ );
      }
   }
   /*! \endcond */
   //**********************************************************************************************

   //**Assignment to sparse matrices***************************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief Assignment of a dense matrix-transpose dense matrix subtraction to a sparse matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side sparse matrix.
   // \param rhs The right-hand side subtraction expression to be assigned.
   // \return void
   //
   // This function implements the performance optimized assignment of a dense matrix-transpose
   // dense matrix subtraction expression to a sparse matrix.
   */
   template< typename MT  // Type of the target sparse matrix
           , bool SO >    // Storage order of the target sparse matrix
   friend inline void assign( SparseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
   {
      BLAZE_FUNCTION_TRACE;

      using TmpType = If_t< SO, OppositeType, ResultType >;

      BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( ResultType );
      BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( OppositeType );
      BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE( ResultType );
      BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OppositeType );
      BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER( MT, TmpType );
      BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION( TmpType );

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      const TmpType tmp( serial( rhs ) );
      assign( ~lhs, tmp );
   }
   /*! \endcond */
   //**********************************************************************************************

   //**Addition assignment to dense matrices*******************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief Addition assignment of a dense matrix-transpose dense matrix subtraction to a dense
   //        matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression to be added.
   // \return void
   //
   // This function implements the performance optimized addition assignment of a dense matrix-
   // transpose dense matrix subtraction expression to a dense matrix. Due to the explicit
   // application of the SFINAE principle, this function can only be selected by the compiler
   // in case neither of the two operands requires an intermediate evaluation.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto addAssign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> DisableIf_t< UseAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      constexpr size_t block( BLOCK_SIZE );

      const size_t m( rhs.rows() );
      const size_t n( rhs.columns() );

      for( size_t ii=0UL; ii<m; ii+=block ) {
         const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
         for( size_t jj=0UL; jj<n; jj+=block ) {
            const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
            for( size_t i=ii; i<iend; ++i ) {
               for( size_t j=jj; j<jend; ++j ) {
                  (~lhs)(i,j) += rhs.lhs_(i,j) - rhs.rhs_(i,j);
               }
            }
         }
      }
   }
   /*! \endcond */
   //**********************************************************************************************

   //**Addition assignment to dense matrices*******************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief Addition assignment of a dense matrix-transpose dense matrix subtraction to a dense
   //        matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression to be added.
   // \return void
   //
   // This function implements the performance optimized addition assignment of a dense matrix-
   // transpose dense matrix subtraction expression to a dense matrix. Due to the explicit
   // application of the SFINAE principle, this function can only be selected by the compiler
   // in case either of the two operands requires an intermediate evaluation.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto addAssign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> EnableIf_t< UseAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      if( !RequiresEvaluation_v<MT2> ) {
         subAssign( ~lhs, rhs.rhs_ );
         addAssign( ~lhs, rhs.lhs_ );
      }
      else {
         addAssign( ~lhs, rhs.lhs_ );
         subAssign( ~lhs, rhs.rhs_ );
      }
   }
   /*! \endcond */
   //**********************************************************************************************

   //**Addition assignment to sparse matrices******************************************************
   // No special implementation for the addition assignment to sparse matrices.
   //**********************************************************************************************

   //**Subtraction assignment to dense matrices****************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief Subtraction assignment of a dense matrix-transpose dense matrix subtraction to a
   //        dense matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression to be subtracted.
   // \return void
   //
   // This function implements the performance optimized subtraction assignment of a dense
   // matrix-transpose dense matrix subtraction expression to a dense matrix. Due to the
   // explicit application of the SFINAE principle, this function can only be selected by
   // the compiler in case neither of the two operands requires an intermediate evaluation.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto subAssign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> DisableIf_t< UseAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      constexpr size_t block( BLOCK_SIZE );

      const size_t m( rhs.rows() );
      const size_t n( rhs.columns() );

      for( size_t ii=0UL; ii<m; ii+=block ) {
         const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
         for( size_t jj=0UL; jj<n; jj+=block ) {
            const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
            for( size_t i=ii; i<iend; ++i ) {
               for( size_t j=jj; j<jend; ++j ) {
                  (~lhs)(i,j) -= rhs.lhs_(i,j) - rhs.rhs_(i,j);
               }
            }
         }
      }
   }
   /*! \endcond */
   //**********************************************************************************************

   //**Subtraction assignment to dense matrices****************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief Subtraction assignment of a dense matrix-transpose dense matrix subtraction to a
   //        dense matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression to be subtracted.
   // \return void
   //
   // This function implements the performance optimized subtraction assignment of a dense
   // matrix-transpose dense matrix subtraction expression to a dense matrix. Due to the
   // explicit application of the SFINAE principle, this function can only be selected by
   // the compiler in case either of the two operands requires an intermediate evaluation.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto subAssign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> EnableIf_t< UseAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      if( !RequiresEvaluation_v<MT2> ) {
         addAssign( ~lhs, rhs.rhs_ );
         subAssign( ~lhs, rhs.lhs_ );
      }
      else {
         subAssign( ~lhs, rhs.lhs_ );
         addAssign( ~lhs, rhs.rhs_ );
      }
   }
   /*! \endcond */
   //**********************************************************************************************

   //**Subtraction assignment to sparse matrices***************************************************
   // No special implementation for the subtraction assignment to sparse matrices.
   //**********************************************************************************************

   //**Schur product assignment to dense matrices**************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief Schur product assignment of a dense matrix-transpose dense matrix subtraction to a
   //        dense matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression for the Schur product.
   // \return void
   //
   // This function implements the performance optimized Schur product assignment of a dense
   // matrix-transpose dense matrix subtraction expression to a dense matrix. Due to the explicit
   // application of the SFINAE principle, this function can only be selected by the compiler in
   // case either of the two operands requires an intermediate evaluation.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto schurAssign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> EnableIf_t< UseAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( ResultType );
      BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE( ResultType );
      BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION( ResultType );

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      const ResultType tmp( serial( rhs ) );
      schurAssign( ~lhs, tmp );
   }
   /*! \endcond */
   //**********************************************************************************************

   //**Schur product assignment to sparse matrices*************************************************
   // No special implementation for the Schur product assignment to sparse matrices.
   //**********************************************************************************************

   //**Multiplication assignment to dense matrices*************************************************
   // No special implementation for the multiplication assignment to dense matrices.
   //**********************************************************************************************

   //**Multiplication assignment to sparse matrices************************************************
   // No special implementation for the multiplication assignment to sparse matrices.
   //**********************************************************************************************

   //**SMP assignment to dense matrices************************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief SMP assignment of a dense matrix-transpose dense matrix subtraction to a dense matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression to be assigned.
   // \return void
   //
   // This function implements the performance optimized SMP assignment of a dense matrix-
   // transpose dense matrix subtraction expression to a dense matrix. Due to the explicit
   // application of the SFINAE principle, this function can only be selected by the compiler
   // in case the expression specific parallel evaluation strategy is selected.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto smpAssign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> EnableIf_t< UseSMPAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      if( !IsOperation_v<MT1> && isSame( ~lhs, rhs.lhs_ ) ) {
         smpSubAssign( ~lhs, rhs.rhs_ );
      }
      else if( ( !IsOperation_v<MT2> && isSame( ~lhs, rhs.rhs_ ) ) ||
               ( !RequiresEvaluation_v<MT2> && rhs.rhs_.isAliased( &(~lhs) ) ) ) {
         smpAssign   ( ~lhs, -rhs.rhs_ );
         smpAddAssign( ~lhs,  rhs.lhs_ );
      }
      else {
         smpAssign   ( ~lhs, rhs.lhs_ );
         smpSubAssign( ~lhs, rhs.rhs_ );
      }
   }
   /*! \endcond */
   //**********************************************************************************************

   //**SMP assignment to sparse matrices***********************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief SMP assignment of a dense matrix-transpose dense matrix subtraction to a sparse matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side sparse matrix.
   // \param rhs The right-hand side subtraction expression to be assigned.
   // \return void
   //
   // This function implements the performance optimized SMP assignment of a dense matrix-
   // transpose dense matrix subtraction expression to a sparse matrix. Due to the explicit
   // application of the SFINAE principle, this function can only be selected by the compiler
   // in case the expression specific parallel evaluation strategy is selected.
   */
   template< typename MT  // Type of the target sparse matrix
           , bool SO >    // Storage order of the target sparse matrix
   friend inline auto smpAssign( SparseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> EnableIf_t< UseSMPAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      using TmpType = If_t< SO, OppositeType, ResultType >;

      BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( ResultType );
      BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( OppositeType );
      BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE( ResultType );
      BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OppositeType );
      BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER( MT, TmpType );
      BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION( TmpType );

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      const TmpType tmp( rhs );
      smpAssign( ~lhs, tmp );
   }
   /*! \endcond */
   //**********************************************************************************************

   //**SMP addition assignment to dense matrices***************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief SMP addition assignment of a dense matrix-transpose dense matrix subtraction to a
   //        dense matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression to be added.
   // \return void
   //
   // This function implements the performance optimized SMP addition assignment of a dense
   // matrix-transpose dense matrix subtraction expression to a dense matrix. Due to the explicit
   // application of the SFINAE principle, this function can only be selected by the compiler in
   // case the expression specific parallel evaluation strategy is selected.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto smpAddAssign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> EnableIf_t< UseSMPAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      if( !RequiresEvaluation_v<MT2> ) {
         smpSubAssign( ~lhs, rhs.rhs_ );
         smpAddAssign( ~lhs, rhs.lhs_ );
      }
      else {
         smpAddAssign( ~lhs, rhs.lhs_ );
         smpSubAssign( ~lhs, rhs.rhs_ );
      }
   }
   /*! \endcond */
   //**********************************************************************************************

   //**SMP addition assignment to sparse matrices**************************************************
   // No special implementation for the SMP addition assignment to sparse matrices.
   //**********************************************************************************************

   //**SMP subtraction assignment to dense matrices************************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief SMP subtraction assignment of a dense matrix-transpose dense matrix subtraction to a
   //        dense matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression to be subtracted.
   // \return void
   //
   // This function implements the performance optimized SMP subtraction assignment of a dense
   // matrix-transpose dense matrix subtraction expression to a dense matrix. Due to the explicit
   // application of the SFINAE principle, this function can only be selected by the compiler in
   // case the expression specific parallel evaluation strategy is selected.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto smpSubAssign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> EnableIf_t< UseSMPAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      if( !RequiresEvaluation_v<MT2> ) {
         smpAddAssign( ~lhs, rhs.rhs_ );
         smpSubAssign( ~lhs, rhs.lhs_ );
      }
      else {
         smpSubAssign( ~lhs, rhs.lhs_ );
         smpAddAssign( ~lhs, rhs.rhs_ );
      }
   }
   /*! \endcond */
   //**********************************************************************************************

   //**SMP subtraction assignment to sparse matrices***********************************************
   // No special implementation for the SMP subtraction assignment to sparse matrices.
   //**********************************************************************************************

   //**SMP Schur product assignment to dense matrices**********************************************
   /*! \cond BLAZE_INTERNAL */
   /*!\brief SMP Schur product assignment of a dense matrix-transpose dense matrix subtraction
   //        to a dense matrix.
   // \ingroup dense_matrix
   //
   // \param lhs The target left-hand side dense matrix.
   // \param rhs The right-hand side subtraction expression for the Schur product.
   // \return void
   //
   // This function implements the performance optimized SMP Schur product assignment of a dense
   // matrix-transpose dense matrix subtraction expression to a dense matrix. Due to the explicit
   // application of the SFINAE principle, this function can only be selected by the compiler in
   // case the expression specific parallel evaluation strategy is selected.
   */
   template< typename MT  // Type of the target dense matrix
           , bool SO >    // Storage order of the target dense matrix
   friend inline auto smpSchurAssign( DenseMatrix<MT,SO>& lhs, const DMatTDMatSubExpr& rhs )
      -> EnableIf_t< UseSMPAssign_v<MT> >
   {
      BLAZE_FUNCTION_TRACE;

      BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( ResultType );
      BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE( ResultType );
      BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION( ResultType );

      BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == rhs.rows()   , "Invalid number of rows"    );
      BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );

      const ResultType tmp( rhs );
      smpSchurAssign( ~lhs, tmp );
   }
   /*! \endcond */
   //**********************************************************************************************

   //**SMP Schur product assignment to sparse matrices*********************************************
   // No special implementation for the SMP Schur product assignment to sparse matrices.
   //**********************************************************************************************

   //**SMP multiplication assignment to dense matrices*********************************************
   // No special implementation for the SMP multiplication assignment to dense matrices.
   //**********************************************************************************************

   //**SMP multiplication assignment to sparse matrices********************************************
   // No special implementation for the SMP multiplication assignment to sparse matrices.
   //**********************************************************************************************

   //**Compile time checks*************************************************************************
   /*! \cond BLAZE_INTERNAL */
   BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( MT1 );
   BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( MT2 );
   BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MT1, MT2 );
   BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATSUBEXPR( MT1, MT2 );
   /*! \endcond */
   //**********************************************************************************************
};
//*************************************************************************************************

//=================================================================================================
//
//  GLOBAL BINARY ARITHMETIC OPERATORS
//
//=================================================================================================

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Backend implementation of the subtraction of a row-major and a colum-major dense matrix
//        (\f$ A=B-C \f$).
// \ingroup dense_matrix
//
// \param lhs The left-hand side dense matrix for the matrix subtraction.
// \param rhs The right-hand side dense matrix to be subtracted from the left-hand side matrix.
// \return The difference of the two matrices.
//
// This function implements a performance optimized treatment of the subtraction of a symmetric
// row-major dense matrix and a column-major dense matrix.
*/
template< typename MT1  // Type of the left-hand side dense matrix
        , typename MT2  // Type of the right-hand side dense matrix
        , EnableIf_t< !IsSymmetric_v<MT1> && !IsSymmetric_v<MT2> >* = nullptr >
inline const DMatTDMatSubExpr<MT1,MT2>
   dmattdmatsub( const DenseMatrix<MT1,false>& lhs, const DenseMatrix<MT2,true>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == (~rhs).rows()   , "Invalid number of rows"    );
   BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );

   return DMatTDMatSubExpr<MT1,MT2>( ~lhs, ~rhs );
}
/*! \endcond */
//*************************************************************************************************

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Backend implementation of the subtraction of a symmetric row-major and a colum-major
//        dense matrix (\f$ A=B-C \f$).
// \ingroup dense_matrix
//
// \param lhs The left-hand side dense matrix for the matrix subtraction.
// \param rhs The right-hand side dense matrix to be subtracted from the left-hand side matrix.
// \return The difference of the two matrices.
//
// This function implements a performance optimized treatment of the subtraction of a symmetric
// row-major dense matrix and a column-major dense matrix.
*/
template< typename MT1  // Type of the left-hand side dense matrix
        , typename MT2  // Type of the right-hand side dense matrix
        , EnableIf_t< IsSymmetric_v<MT1> && !IsSymmetric_v<MT2> >* = nullptr >
inline decltype(auto)
   dmattdmatsub( const DenseMatrix<MT1,false>& lhs, const DenseMatrix<MT2,true>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == (~rhs).rows()   , "Invalid number of rows"    );
   BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );

   return trans( ~lhs ) - ~rhs;
}
/*! \endcond */
//*************************************************************************************************

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Backend implementation of the subtraction of a row-major and a symmetric column-major
//        dense matrix (\f$ A=B-C \f$).
// \ingroup dense_matrix
//
// \param lhs The left-hand side dense matrix for the matrix subtraction.
// \param rhs The right-hand side dense matrix to be subtracted from the left-hand side matrix.
// \return The difference of the two matrices.
//
// This function implements a performance optimized treatment of the subtraction of a (potentially
// symmetric) row-major dense matrix and a symmetric column-major dense matrix.
*/
template< typename MT1  // Type of the left-hand side dense matrix
        , typename MT2  // Type of the right-hand side dense matrix
        , EnableIf_t< IsSymmetric_v<MT2> >* = nullptr >
inline decltype(auto)
   dmattdmatsub( const DenseMatrix<MT1,false>& lhs, const DenseMatrix<MT2,true>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == (~rhs).rows()   , "Invalid number of rows"    );
   BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );

   return (~lhs) - trans( ~rhs );
}
/*! \endcond */
//*************************************************************************************************

//*************************************************************************************************
/*!\brief Subtraction operator for the subtraction of a row-major and a column-major dense matrix
//        (\f$ A=B-C \f$).
// \ingroup dense_matrix
//
// \param lhs The left-hand side dense matrix for the matrix subtraction.
// \param rhs The right-hand side dense matrix to be subtracted from the left-hand side matrix.
// \return The difference of the two matrices.
// \exception std::invalid_argument Matrix sizes do not match.
//
// This operator represents the subtraction of a row-major and a column-major dense matrix:

   \code
   using blaze::rowMajor;
   using blaze::columnMajor;

   blaze::DynamicMatrix<double,rowMajor> A, C;
   blaze::DynamicMatrix<double,columnMajor> B;
   // ... Resizing and initialization
   C = A - B;
   \endcode

// The operator returns an expression representing a dense matrix of the higher-order element
// type of the two involved matrix element types \a MT1::ElementType and \a MT2::ElementType.
// Both matrix types \a MT1 and \a MT2 as well as the two element types \a MT1::ElementType
// and \a MT2::ElementType have to be supported by the SubTrait class template.\n
// In case the current number of rows and columns of the two given  matrices don't match, a
// \a std::invalid_argument is thrown.
*/
template< typename MT1    // Type of the left-hand side dense matrix
        , typename MT2 >  // Type of the right-hand side dense matrix
inline decltype(auto)
   operator-( const DenseMatrix<MT1,false>& lhs, const DenseMatrix<MT2,true>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() ) {
      BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
   }

   return dmattdmatsub( ~lhs, ~rhs );
}
//*************************************************************************************************

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Backend implementation of the subtraction of a column-major and a row-major dense
//        matrix (\f$ A=B-C \f$).
// \ingroup dense_matrix
//
// \param lhs The left-hand side dense matrix for the matrix subtraction.
// \param rhs The right-hand side dense matrix to be subtracted from the left-hand side matrix.
// \return The difference of the two matrices.
//
// This function implements a performance optimized treatment of the subtraction of a column-major
// dense matrix and a row-major dense matrix.
*/
template< typename MT1  // Type of the left-hand side dense matrix
        , typename MT2  // Type of the right-hand side dense matrix
        , EnableIf_t< !IsSymmetric_v<MT1> && !IsSymmetric_v<MT2> >* = nullptr >
inline const DMatTDMatSubExpr<MT1,MT2>
   tdmatdmatsub( const DenseMatrix<MT1,true>& lhs, const DenseMatrix<MT2,false>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == (~rhs).rows()   , "Invalid number of rows"    );
   BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );

   return DMatTDMatSubExpr<MT1,MT2>( ~lhs, ~rhs );
}
/*! \endcond */
//*************************************************************************************************

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Backend implementation of the subtraction of a column-major and a symmetric row-major
//        dense matrix (\f$ A=B-C \f$).
// \ingroup dense_matrix
//
// \param lhs The left-hand side dense matrix for the matrix subtraction.
// \param rhs The right-hand side dense matrix to be subtracted from the left-hand side matrix.
// \return The difference of the two matrices.
//
// This function implements a performance optimized treatment of the subtraction of a column-major
// dense matrix and a symmetric row-major dense matrix.
*/
template< typename MT1  // Type of the left-hand side dense matrix
        , typename MT2  // Type of the right-hand side dense matrix
        , EnableIf_t< !IsSymmetric_v<MT1> && IsSymmetric_v<MT2> >* = nullptr >
inline decltype(auto)
   tdmatdmatsub( const DenseMatrix<MT1,true>& lhs, const DenseMatrix<MT2,false>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == (~rhs).rows()   , "Invalid number of rows"    );
   BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );

   return (~lhs) - trans( ~rhs );
}
/*! \endcond */
//*************************************************************************************************

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Backend implementation of the subtraction of a symmetric column-major and a row-major
//        dense matrix (\f$ A=B-C \f$).
// \ingroup dense_matrix
//
// \param lhs The left-hand side dense matrix for the matrix subtraction.
// \param rhs The right-hand side dense matrix to be subtracted from the left-hand side matrix.
// \return The difference of the two matrices.
//
// This function implements a performance optimized treatment of the subtraction of a symmetric
// column-major dense matrix and a (potentially symmetric) row-major dense matrix.
*/
template< typename MT1  // Type of the left-hand side dense matrix
        , typename MT2  // Type of the right-hand side dense matrix
        , EnableIf_t< IsSymmetric_v<MT1> >* = nullptr >
inline decltype(auto)
   tdmatdmatsub( const DenseMatrix<MT1,true>& lhs, const DenseMatrix<MT2,false>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == (~rhs).rows()   , "Invalid number of rows"    );
   BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );

   return trans( ~lhs ) - (~rhs);
}
/*! \endcond */
//*************************************************************************************************

//*************************************************************************************************
/*!\brief Subtraction operator for the subtraction of a column-major and a row-major dense matrix
//        (\f$ A=B-C \f$).
// \ingroup dense_matrix
//
// \param lhs The left-hand side dense matrix for the matrix subtraction.
// \param rhs The right-hand side dense matrix to be subtracted from the left-hand side matrix.
// \return The difference of the two matrices.
// \exception std::invalid_argument Matrix sizes do not match
//
// This operator represents the subtraction of a column-major and a row-major dense matrix:

   \code
   using blaze::rowMajor;
   using blaze::columnMajor;

   blaze::DynamicMatrix<double,columnMajor> A;
   blaze::DynamicMatrix<double,rowMajor> B, C;
   // ... Resizing and initialization
   C = A - B;
   \endcode

// The operator returns an expression representing a dense matrix of the higher-order element
// type of the two involved matrix element types \a MT1::ElementType and \a MT2::ElementType.
// Both matrix types \a MT1 and \a MT2 as well as the two element types \a MT1::ElementType
// and \a MT2::ElementType have to be supported by the SubTrait class template.\n
// In case the current number of rows and columns of the two given  matrices don't match, a
// \a std::invalid_argument is thrown.
*/
template< typename MT1    // Type of the left-hand side dense matrix
        , typename MT2 >  // Type of the right-hand side dense matrix
inline decltype(auto)
   operator-( const DenseMatrix<MT1,true>& lhs, const DenseMatrix<MT2,false>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() ) {
      BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
   }

   return tdmatdmatsub( ~lhs, ~rhs );
}
//*************************************************************************************************

//=================================================================================================
//
//  ISALIGNED SPECIALIZATIONS
//
//=================================================================================================

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct IsAligned< DMatTDMatSubExpr<MT1,MT2> >
   : public BoolConstant< IsAligned_v<MT1> && IsAligned_v<MT2> >
{};
/*! \endcond */
//*************************************************************************************************

} // namespace blaze

#endif


text:
/*
                       ___                            __
                      /\_ \                          /\ \__
                   __ \//\ \     ___     ___     ____\ \  _\
                 /'_ `\ \ \ \   / __`\  / __`\  /  __\\ \ \/
                /\ \ \ \ \_\ \_/\ \ \ \/\ \ \ \/\__   \\ \ \_
                \ \____ \/\____\ \____/\ \____/\/\____/ \ \__\
                 \/___/\ \/____/\/___/  \/___/  \/___/   \/__/
                   /\____/
                   \_/__/

                   OpenGL framework for fast demo programming

                             http://www.gloost.org

    This file is part of the gloost framework. You can use it in parts or as
       whole under the terms of the GPL (http://www.gnu.org/licenses/#GPL).

            gloost is being created by Felix Weißig and Stephan Beck

     Felix Weißig (thesleeper@gmx.net), Stephan Beck (stephan@pixelstars.de)
*/

/// gloost includes
#include <gloostConfig.h>
#include <PerspectiveCamera.h>

/// cpp includes
#include <glbinding/gl/gl.h>
using namespace gl;
#include <GL/glut.h>

namespace gloost
{

///////////////////////////////////////////////////////////////////////////////

/// class constructor
PerspectiveCamera::PerspectiveCamera():
    Camera()
{

}

///////////////////////////////////////////////////////////////////////////////

  ///

PerspectiveCamera::PerspectiveCamera(float fov, float aspect, float near, float far)
  : Camera(fov, aspect, near, far)
{

}

///////////////////////////////////////////////////////////////////////////////

  ///

PerspectiveCamera::~PerspectiveCamera()
{

}

///////////////////////////////////////////////////////////////////////////////

  ///

void
PerspectiveCamera::setFov(float fov)
{
  _fov = fov;
  _projection_dirty = true;
}

///////////////////////////////////////////////////////////////////////////////

  ///
float
PerspectiveCamera::getFov() const
{
  return _fov;
}

///////////////////////////////////////////////////////////////////////////////

  ///

void
PerspectiveCamera::setAspect(float aspect)
{
  _aspect = aspect;
  _projection_dirty = true;
}

///////////////////////////////////////////////////////////////////////////////

  ///
float
PerspectiveCamera::getAspect() const
{
  return _aspect;
}

///////////////////////////////////////////////////////////////////////////////

  ///

void PerspectiveCamera::setNear(float near)
{
  _near = near;
  _projection_dirty = true;
}

///////////////////////////////////////////////////////////////////////////////

  ///
float
PerspectiveCamera::getNear() const
{
  return _near;
}

///////////////////////////////////////////////////////////////////////////////

  ///

void PerspectiveCamera::setFar(float far)
{
  _far = far;
  _projection_dirty = true;
}

///////////////////////////////////////////////////////////////////////////////

  ///
float
PerspectiveCamera::getFar() const
{
  return _far;
}

///////////////////////////////////////////////////////////////////////////////

  ///

/* virtual */
void PerspectiveCamera::set()
{

  if(_projection_dirty)
  {
    updateProjection();
    updateFrustum();
  }

  Camera::set();
}

///////////////////////////////////////////////////////////////////////////////

  /// set poisition, point to look at and down vector of the camera

void
PerspectiveCamera::lookAt(Point3 eye, Point3 coi, Vector3 up)
{

  _cameraPosition = eye;

  glMatrixMode(GL_MODELVIEW);

  glPushMatrix();
  {
    glLoadIdentity();
    gluLookAt((GLfloat) eye[0],(GLfloat) eye[1],(GLfloat) eye[2],
              (GLfloat) coi[0],(GLfloat) coi[1],(GLfloat) coi[2],
              (GLfloat) up[0], (GLfloat) up[1], (GLfloat) up[2]);
    gloostGetv (GL_MODELVIEW_MATRIX, _modelview.data());
  }
  glPopMatrix();

  updateFrustum();

}

///////////////////////////////////////////////////////////////////////////////

  /// returns position of the camera !!! Works only if position was set via lookAt(Point3 ...)

/* virtual */
const Point3&
PerspectiveCamera::getPosition()
{
  return _cameraPosition;
}

///////////////////////////////////////////////////////////////////////////////

  ///

/*virtual*/
Ray
PerspectiveCamera::getPickRay(unsigned int screenWidth,
                              unsigned int screenHeight,
                              unsigned int mouseH,
                              unsigned int mouseV)
{

  if(_projection_dirty)
  {
    updateProjection();
    updateFrustum();
  }

  Vector3 frustumH_vec         = _frustum.far_lower_right - _frustum.far_lower_left;
  Vector3 FrustumOnePixelWidth = frustumH_vec/screenWidth;

  Vector3 frustumV_vec          = _frustum.far_upper_left - _frustum.far_lower_left;
  Vector3 FrustumOnePixelHeight = frustumV_vec/screenHeight;

  Point3 pickPointOnFarPlane = _frustum.far_lower_left
                                + (FrustumOnePixelWidth * mouseH)
                                + (FrustumOnePixelHeight * mouseV);

  Matrix modelviewInv = _modelview;
  modelviewInv.invert();

  Point3 camPos = modelviewInv * Point3(0.0, 0.0, 0.0);
  Vector3 pickDir = (pickPointOnFarPlane - camPos).normalized();

  return Ray(camPos, pickDir);
}

///////////////////////////////////////////////////////////////////////////////

  /// recalc the projection matrix

/*virtual*/
void
PerspectiveCamera::updateProjection()
{
  glMatrixMode(GL_PROJECTION);

  glPushMatrix();
  {
    glLoadIdentity();
    gluPerspective (_fov, _aspect, _near, _far);
    gloostGetv (GL_PROJECTION_MATRIX, _projection.data());
  }
  glPopMatrix();

  glMatrixMode(GL_MODELVIEW);

  _projection_dirty = false;
}

///////////////////////////////////////////////////////////////////////////////

  ///

/*virtual*/
void
PerspectiveCamera::updateFrustum()
{
  const float scale = tan(M_PI * _fov/360.0f);
  const float near_top = _near * scale;
  const float near_left  = near_top * _aspect;
  const float far_top = _far * scale;
  const float far_left  = far_top * _aspect;
  Matrix _modelview_inv(_modelview);
  _modelview_inv.invert();
  _frustum.near_lower_left  = _modelview_inv * Point3(-near_left,-near_top,-_near);
  _frustum.near_lower_right = _modelview_inv * Point3(near_left,-near_top,-_near);
  _frustum.near_upper_right = _modelview_inv * Point3(near_left,near_top,-_near);
  _frustum.near_upper_left  = _modelview_inv * Point3(-near_left,near_top,-_near);

  _frustum.far_lower_left  = _modelview_inv * Point3(-far_left,-far_top,-_far);
  _frustum.far_lower_right = _modelview_inv * Point3(far_left,-far_top,-_far);
  _frustum.far_upper_right = _modelview_inv * Point3(far_left,far_top,-_far);
  _frustum.far_upper_left  = _modelview_inv * Point3(-far_left,far_top,-_far);

  _frustum.recalcPlanes();
}

///////////////////////////////////////////////////////////////////////////////

} // namespace gloost

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Class org.drip.quant.solver1D.InitializationHeuristics</title>
<meta name="date" content="2014-01-13">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.drip.quant.solver1D.InitializationHeuristics

Packages that use InitializationHeuristics

Package
Description

org.drip.quant.solver1D

Uses of InitializationHeuristics in org.drip.quant.solver1D

Methods in org.drip.quant.solver1D that return InitializationHeuristics

Modifier and Type
Method and Description

static InitializationHeuristics
InitializationHeuristics.FromBracketingCustomBCP(BracketingControlParams bcpCustom)

Construct an Initialization Heuristics Instance from Custom Bracketing Control Parameters

static InitializationHeuristics
InitializationHeuristics.FromBracketingEdgeHints(double dblStartingBracketLeft,
                       double dblStartingBracketRight)

Construct an Initialization Heuristics Instance from the bracketing edge soft hints

static InitializationHeuristics
InitializationHeuristics.FromBracketingFloorCeiling(double dblBracketFloor,
                          double dblBracketCeiling)

Construct an Initialization Heuristics Instance from the bracketing hard floor/ceiling

static InitializationHeuristics
InitializationHeuristics.FromBracketingMidHint(double dblStartingBracketMid)

Construct an Initialization Heuristics Instance from the bracketing mid hint

static InitializationHeuristics
InitializationHeuristics.FromHardSearchEdges(double dblSearchStartLeft,
                   double dblSearchStartRight)

Construct an Initialization Heuristics Instance from the hard search edges

Methods in org.drip.quant.solver1D with parameters of type InitializationHeuristics

Modifier and Type
Method and Description

FixedPointFinderOutput
FixedPointFinder.findRoot(InitializationHeuristics ih)

Invoke the solution 1D root finding sequence

BracketingOutput
ExecutionInitializer.initializeBracket(InitializationHeuristics ih,
                 double dblOFGoal)

Set up the bracket to be used for the eventual search kick-off

ConvergenceOutput
ExecutionInitializer.initializeVariate(InitializationHeuristics ih,
                 double dblOFGoal)

Initialize the starting variate to within the fixed point convergence zone

BracketingOutput
ExecutionInitializer.verifyHardSearchEdges(InitializationHeuristics ih,
                     double dblOFGoal)

Initialize the starting bracket within the specified boundary

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreatePageToLayoutTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('page_to_layout', function(Blueprint $table)
		{
			$table->integer('page_id')->unsigned()->primary();
			$table->integer('store_id')->unsigned()->index('store_id_idx');
			$table->integer('layout_id')->unsigned();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('page_to_layout');
	}

}


text:
if defined?(ActiveRecord)
  module AttrEncrypted
    module Adapters
      module ActiveRecord
        def self.extended(base)
          base.attr_encrypted_options[:encode] = true
          base.eigenclass_eval { alias_method_chain :method_missing, :attr_encrypted }
        end

        protected

          # Ensures the attribute methods for db fields have been defined before calling the original
          # <tt>attr_encrypted</tt> method
          def attr_encrypted(*attrs)
            define_attribute_methods rescue nil
            super
            attrs.reject { |attr| attr.is_a?(Hash) }.each { |attr| alias_method "#{attr}_before_type_cast", attr }
          end

          # Allows you to use dynamic methods like <tt>find_by_email</tt> or <tt>scoped_by_email</tt> for
          # encrypted attributes
          #
          # NOTE: This only works when the <tt>:key</tt> option is specified as a string (see the README)
          #
          # This is useful for encrypting fields like email addresses. Your user's email addresses
          # are encrypted in the database, but you can still look up a user by email for logging in
          #
          # Example
          #
          #   class User < ActiveRecord::Base
          #     attr_encrypted :email, :key => 'secret key'
          #   end
          #
          #   User.find_by_email_and_password('test@example.com', 'testing')
          #   # results in a call to
          #   User.find_by_encrypted_email_and_password('the_encrypted_version_of_test@example.com', 'testing')
          def method_missing_with_attr_encrypted(method, *args, &block)
            if match = /^(find|scoped)_(all_by|by)_([_a-zA-Z]\w*)$/.match(method.to_s)
              attribute_names = match.captures.last.split('_and_')
              attribute_names.each_with_index do |attribute, index|
                if attr_encrypted?(attribute)
                  args[index] = send("encrypt_#{attribute}", args[index])
                  attribute_names[index] = encrypted_attributes[attribute]
                end
              end
              method = "#{match.captures[0]}_#{match.captures[1]}_#{attribute_names.join('_and_')}".to_sym
            end
            method_missing_without_attr_encrypted(method, *args, &block)
          end
      end
    end
  end

  ActiveRecord::Base.extend AttrEncrypted::Adapters::ActiveRecord
end


text:
namespace node {

using v8::Context;
using v8::Local;
using v8::Object;
using v8::ReadOnly;
using v8::Value;

// The config binding is used to provide an internal view of compile or runtime
// config options that are required internally by lib/*.js code. This is an
// alternative to dropping additional properties onto the process object as
// has been the practice previously in node.cc.

#define READONLY_BOOLEAN_PROPERTY(str)                                        \
  do {                                                                        \
    target->DefineOwnProperty(env->context(),                                 \
                              OneByteString(env->isolate(), str),             \
                              True(env->isolate()), ReadOnly).FromJust();     \
  } while (0)

void InitConfig(Local<Object> target,
                Local<Value> unused,
                Local<Context> context) {
  Environment* env = Environment::GetCurrent(context);
#ifdef NODE_HAVE_I18N_SUPPORT

  READONLY_BOOLEAN_PROPERTY("hasIntl");

#ifdef NODE_HAVE_SMALL_ICU
  READONLY_BOOLEAN_PROPERTY("hasSmallICU");
#endif  // NODE_HAVE_SMALL_ICU

  if (flag_icu_data_dir)
    READONLY_BOOLEAN_PROPERTY("usingICUDataDir");
#endif  // NODE_HAVE_I18N_SUPPORT

  if (config_preserve_symlinks)
    READONLY_BOOLEAN_PROPERTY("preserveSymlinks");
}  // InitConfig

}  // namespace node

NODE_MODULE_CONTEXT_AWARE_BUILTIN(config, node::InitConfig)


text:
package org.wisdom.wamp.data;

public class Howdy {

    public String howdy() {
        return "Hi!";
    }

    public void noop() {
    }

    public Struct struc() {
        return new Struct("hi", 1000, true, new String[] {"a", "b"});
    }

    public Struct complex(Struct s) {
        return s;
    }

    public boolean operation(String m, Struct s) {
        return m != null && s != null;
    }

    public void buggy() {
        throw new NullPointerException("I'm a bug");
    }
}


text:
import random, math

class Mock(object):
    def __getattr__(self, key):
        """Mock objects of this type will dynamically implement any requested member"""
        return random.choice(["world", math.pi])

m = Mock()


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='../../../../../../../../../../test.xsl'?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<!DOCTYPE Test SYSTEM '../../../../../../../../../../test.dtd'>
<Test
    ID="F_SecureRandomTest_04"
        date-of-creation="2005-01-31"
    timeout="1"
        >
        <!--
        -->

                <APITestDescription>
                    <TestedClass name="java.security.SecureRandom"/>
                    <TestedMethod name="protected SecureRandom(SecureRandomSpi secureRandomSpi, Provider provider)"/>

                    <TestedClass name="java.security.Security"/>
                    <TestedMethod name="public static int addProvider(Provider provider)"/>
                    <TestedMethod name="public static String getProperty(String key)"/>

                    <TestedClass name="java.security.Provider"/>
                    <TestedMethod name="protected Provider(String name, double version, String info)"/>
                    <TestedMethod name="public Object put(Object key, Object value)"/>

                    <TestedClass name="java.security.SecureRandomSpi"/>
                    <TestedMethod name="public SecureRandomSpi()"/>

                    <Description>
                        Check SPI mechanism by example of SecureRandomSPI implementation.
                    </Description>
                </APITestDescription>

                <Keyword name="functional"/>
                <Source name="F_SecureRandomTest_04.java"/>
                <Modification date="2005-01-31" />

            <Runner ID="Runtime">
                <Option name="-cp" value="$CP$PathSeparator$TestSuiteClassRoot$PathSeparator"/>
                   <Option name="-Djava.security.policy=$TestDirectory$FileSeparatorauxiliary$FileSeparatorSecureRandomTest.policy"/>
                <Param name="toRun" value="org.apache.harmony.test.func.api.java.security.F_SecureRandomTest_04.F_SecureRandomTest_04">
                </Param>
            </Runner>
        <Restriction name="OtherVMOnly"/>
</Test>


text:
package com.sensorfields.cyborg.sample.beer.detail;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;
import android.view.Gravity;

import com.sensorfields.cyborg.ViewDisposables;
import com.sensorfields.cyborg.mvi.MviView;
import com.sensorfields.cyborg.sample.Application;
import com.sensorfields.cyborg.sample.R;

import io.reactivex.Observable;

public final class BeerDetailView extends AppCompatTextView implements MviView<Intent, ViewState> {

    private final ViewDisposables disposables = new ViewDisposables();
    private final BeerDetailViewModel viewModel;

    public BeerDetailView(Context context) {
        this(context, null);
    }

    public BeerDetailView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, android.R.attr.textViewStyle);
    }

    public BeerDetailView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        viewModel = Application.component(context).navigator().viewModel(BeerDetailViewModel.class);
        setGravity(Gravity.CENTER);
        setText(R.string.beer_detail_text);
    }

    private Observable<Intent.InitialIntent> initialIntent() {
        return Observable.just(Intent.InitialIntent.create());
    }

    @SuppressWarnings("unchecked")
    @Override
    public Observable<Intent> intents() {
        return Observable.mergeArray(initialIntent());
    }

    @Override
    public void render(ViewState state) {
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        disposables.attach();
        disposables.add(viewModel.viewStates().subscribe(this::render));
        viewModel.process(intents());
    }

    @Override
    protected void onDetachedFromWindow() {
        disposables.detach();
        super.onDetachedFromWindow();
    }
}


text:
package org.springframework.boot.actuate.influx;

import java.io.IOException;

import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBException;
import org.influxdb.dto.Pong;
import org.junit.Test;

import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

/**
 * Tests for {@link InfluxDbHealthIndicator}.
 *
 * @author Eddú Meléndez
 */
public class InfluxDbHealthIndicatorTests {

	@Test
	public void influxDbIsUp() {
		Pong pong = mock(Pong.class);
		given(pong.getVersion()).willReturn("0.9");
		InfluxDB influxDB = mock(InfluxDB.class);
		given(influxDB.ping()).willReturn(pong);
		InfluxDbHealthIndicator healthIndicator = new InfluxDbHealthIndicator(influxDB);
		Health health = healthIndicator.health();
		assertThat(health.getStatus()).isEqualTo(Status.UP);
		assertThat(health.getDetails().get("version")).isEqualTo("0.9");
		verify(influxDB).ping();
	}

	@Test
	public void influxDbIsDown() {
		InfluxDB influxDB = mock(InfluxDB.class);
		given(influxDB.ping())
				.willThrow(new InfluxDBException(new IOException("Connection failed")));
		InfluxDbHealthIndicator healthIndicator = new InfluxDbHealthIndicator(influxDB);
		Health health = healthIndicator.health();
		assertThat(health.getStatus()).isEqualTo(Status.DOWN);
		assertThat((String) health.getDetails().get("error"))
				.contains("Connection failed");
		verify(influxDB).ping();
	}

}


text:
/// Copyright (c) 2012 Ecma International.  All rights reserved.
/**
 * @path ch15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-65.js
 * @description Object.getOwnPropertyDescriptor returns data desc for functions on built-ins (String.prototype.concat)
 */

function testcase() {
  var desc = Object.getOwnPropertyDescriptor(String.prototype, "concat");
  if (desc.value === String.prototype.concat &&
      desc.writable === true &&
      desc.enumerable === false &&
      desc.configurable === true) {
    return true;
  }
 }
runTestCase(testcase);


text:
A retro twitter client.

- [Download for Mac](https://github.com/r7kamura/retro-twitter-client/releases/download/v0.0.9/retro-twitter-client-darwin-x64.zip)
- [Download for Win](https://github.com/r7kamura/retro-twitter-client/releases/download/v0.0.9/retro-twitter-client-win32-x64.zip)
- [Download for Linux](https://github.com/r7kamura/retro-twitter-client/releases/download/v0.0.9/retro-twitter-client-linux-x64.zip)

![](/screenshots/preview13.png)


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>Keyed Fragments | React</title>
  <meta name="viewport" content="width=device-width">
  <meta property="og:title" content="Keyed Fragments | React">
  <meta property="og:type" content="website">
  <meta property="og:url" content="https://facebook.github.io/react/docs/create-fragment-zh-CN.html">
  <meta property="og:image" content="https://facebook.github.io/react/img/logo_og.png">
  <meta property="og:description" content="A JavaScript library for building user interfaces">
  <meta property="fb:app_id" content="623268441017527">

  <link rel="shortcut icon" href="/react/favicon.ico">
  <link rel="alternate" type="application/rss+xml" title="React" href="https://facebook.github.io/react/feed.xml">

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" />
  <link rel="stylesheet" href="/react/css/syntax.css">
  <link rel="stylesheet" href="/react/css/codemirror.css">
  <link rel="stylesheet" href="/react/css/react.css">

          React

Docs

Support

Download

Blog

            <input id="algolia-doc-search" type="text" placeholder="Search docs..." />

GitHub

React Native

Quick Start

            Getting Started

            Tutorial

            Thinking in React

Community Resources

            Conferences

            Videos

            Complementary Tools

            Examples

Guides

            Why React?

            Displaying Data

                    JSX in Depth

                    JSX Spread Attributes

                    JSX Gotchas

            Interactivity and Dynamic UIs

            Multiple Components

            Reusable Components

            Transferring Props

            Forms

            Working With the Browser

                    Refs to Components

            Tooling Integration

                    Language Tooling

                    Package Management

                    Server-side Environments

            Add-Ons

                    Animation

                    Two-Way Binding Helpers

                    Test Utilities

                    Cloning Elements

                    Keyed Fragments

                    Immutability Helpers

                    PureRenderMixin

                    Performance Tools

                    Shallow Compare

            Advanced Performance

            Context

Reference

            Top-Level API

            Component API

            Component Specs and Lifecycle

            Supported Tags and Attributes

            Event System

            DOM Differences

            Special Non-DOM Attributes

            Reconciliation

            Web Components

            React (Virtual) DOM Terminology

Tips

            Introduction

            Inline Styles

            If-Else in JSX

            Self-Closing Tag

            Maximum Number of JSX Root Nodes

            Shorthand for Specifying Pixel Values in style props

            Type of the Children props

            Value of null for Controlled Input

            componentWillReceiveProps Not Triggered After Mounting

            Props in getInitialState Is an Anti-Pattern

            DOM Event Listeners in a Component

            Load Initial Data via AJAX

            False in JSX

            Communicate Between Components

            Expose Component Functions

            this.props.children undefined

            Use React with Other Libraries

            Dangerously Set innerHTML

Contributing

            Design Principles

    Edit on GitHub

      Keyed Fragments

在大多数情况下,你可以使用 key prop 指定你从 render 返回的元素的 keys。然而,这在一个情况下会失败:如果你有两组你需要记录的子级,将没有办法在不使用包裹元素的情况下放置一个 key 到每组上。

即是,如果你有一个像这样的组件:

var Swapper = React.createClass({
  propTypes: {
    // `leftChildren` and `rightChildren` can be a string, element, array, etc.
    leftChildren: React.PropTypes.node,
    rightChildren: React.PropTypes.node,

    swapped: React.PropTypes.bool
  },
  render: function() {
    var children;
    if (this.props.swapped) {
      children = [this.props.rightChildren, this.props.leftChildren];
    } else {
      children = [this.props.leftChildren, this.props.rightChildren];
    }
    return <div>{children}</div>;
  }
});

这些子级会在当你改变 swapped prop 时加载和卸载,因为没有任何的 key 标记在这两组子级上。

要解决这个问题,你可以使用 createFragment 插件来给予这两组子级 keys.

Array<ReactNode> createFragment(object children) #

代替创建数组,我们这样写:

var createFragment = require('react-addons-create-fragment');

if (this.props.swapped) {
  children = createFragment({
    right: this.props.rightChildren,
    left: this.props.leftChildren
  });
} else {
  children = createFragment({
    left: this.props.leftChildren,
    right: this.props.rightChildren
  });
}

被传入对象的 keys (即 left 和 right)被用作为整组子级的 keys,并且对象 keys 的顺序被用于决定渲染子级的顺序。通过这个改变,这两个子级将会恰当的在 DOM 里排序,而不被卸载。

createFragment 的返回值应该被对待为一个不透明的对象;你可以使用 React.Children 来遍历一个 fragment 但是不应该直接访问它。同样注意,我们依赖于 JavaScript 引擎保留了对象的枚举顺序,这点在 spec 上是不保证的,但是所有主要的浏览器和 VMs 都对非数字键的对象实现了这个特性。

注意:

将来,createFragment 也许会被替换为如下的API:

return (
  <div>
    <x:frag key="right">{this.props.rightChildren}</x:frag>,
    <x:frag key="left">{this.props.leftChildren}</x:frag>
  </div>
);

允许你直接在 JSX 里赋值 keys 而不用添加包裹元素。

        ← Prev

        Next →

        A Facebook & Instagram collaboration.

        Acknowledgements

        © 2013–2016 Facebook Inc.

        Documentation licensed under CC BY 4.0.


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>TraceryCpp: tracery Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

TraceryCpp
    0.0.1

A C++11 port of Tracery (story-grammar generation library for JavaScript)

Main Page

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

File Members

tracery Directory Reference

Files

file  	BaseEngModifiers.cpp [code]

file  	BaseEngModifiers.hpp [code]

file  	Grammar.cpp [code]

file  	Grammar.hpp [code]

file  	Helpers.cpp [code]

file  	Helpers.hpp [code]

file  	Modifiers.hpp [code]

file  	NodeAction.cpp [code]

file  	NodeAction.hpp [code]

file  	RandomNumberGenerator.hpp [code]

file  	RuleSet.cpp [code]

file  	RuleSet.hpp [code]

file  	Symbol.cpp [code]

file  	Symbol.hpp [code]

file  	Tracery.cpp [code]

file  	Tracery.hpp [code]

file  	TraceryNode.cpp [code]

file  	TraceryNode.hpp [code]

file  	Types.hpp [code]

tracery

Generated by

     1.8.11


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>U-Index</title>
<meta name="date" content="2014-12-01">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B C D E F G H I L M N O P Q R S T U V X

U

update(M) - Method in interface com.team09.qanda.views.QView

upvote_checkbox - Static variable in class com.team09.qanda.R.drawable

upvote_icon_default - Static variable in class com.team09.qanda.R.drawable

upvote_icon_pressed - Static variable in class com.team09.qanda.R.drawable

upvoteCheckbox - Static variable in class com.team09.qanda.R.id

User - Class in com.team09.qanda.models

Class to store the devices user.

User(Context) - Constructor for class com.team09.qanda.models.User

User(Context, String) - Constructor for class com.team09.qanda.models.User

user_questions - Static variable in class com.team09.qanda.R.id

user_questions - Static variable in class com.team09.qanda.R.string

user_row_layout - Static variable in class com.team09.qanda.R.layout

user_threads - Static variable in class com.team09.qanda.R.menu

UserListView - Static variable in class com.team09.qanda.R.id

usernameInput - Static variable in class com.team09.qanda.R.id

usernamePrompt - Static variable in class com.team09.qanda.R.id

userThreadsActivity(String) - Method in class com.team09.qanda.views.MainActivity

This method allows navigation to lists of locally saved questions (favourites,
 my questions and read laters) upon selection from the menu.

userThreadsActivity(String) - Method in class com.team09.qanda.views.QuestionThreadActivity

This method allows navigation to lists of locally saved questions (favourites,
 my questions and read laters) upon selection from the menu.

UserThreadsActivity - Class in com.team09.qanda.views

Activity for any locally stored questions, including favorites, user's questions, and read later.

UserThreadsActivity() - Constructor for class com.team09.qanda.views.UserThreadsActivity

userThreadsActivity(String) - Method in class com.team09.qanda.views.UserThreadsActivity

This method allows navigation to lists of locally saved questions (favourites,
 my questions and read laters) upon selection from the menu.

A B C D E F G H I L M N O P Q R S T U V X

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
package com.bj58.oceanus.exchange.nodes.resultset.impl;

import com.bj58.oceanus.core.shard.AnalyzeResult;
import com.bj58.oceanus.core.shard.TableInfo;
import com.bj58.oceanus.exchange.nodes.AbstractNodeAnalyzer;
import com.bj58.oceanus.exchange.nodes.DefaultAnalyzeResult;
import com.bj58.sql.parser.FromBaseTable;
import com.bj58.sql.parser.JoinNode;
import com.bj58.sql.parser.NodeTypes;

/**
 * SQL节点解析器:JoinNodeAnalyzer
 *
 * @author Service Platform Architecture Team (spat@58.com)
 */
public class JoinNodeAnalyzer extends
		AbstractNodeAnalyzer<JoinNode, AnalyzeResult> {

	int[] nodeTypes = { NodeTypes.JOIN_NODE, NodeTypes.HALF_OUTER_JOIN_NODE };

	@Override
	public int[] getNodeTypes() {
		return nodeTypes;
	}

	TableInfo createTableInfo(FromBaseTable fromTable) {
		TableInfo info = new TableInfo();
		try {
			info.setSchema(fromTable.getOrigTableName().getSchemaName());
			info.setOrgName(fromTable.getOrigTableName().getTableName());
			info.setName(fromTable.getTableName().getTableName());
			info.setTableNode(fromTable.getOrigTableName());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return info;
	}

	@Override
	public AnalyzeResult doAnalyze(JoinNode joinNode) {
		DefaultAnalyzeResult result = new DefaultAnalyzeResult();
		if (joinNode.getLeftResultSet().getNodeType() == NodeTypes.FROM_BASE_TABLE) {
			TableInfo tableInfo=this.createTableInfo((FromBaseTable) joinNode.getLeftResultSet());
			result.getTableInfos().add(tableInfo);
		} else {
			analyzeAndMergeResult(result, joinNode.getLeftResultSet());
		}
		if(joinNode.getRightResultSet().getNodeType()== NodeTypes.FROM_BASE_TABLE){
			TableInfo tableInfo=this.createTableInfo((FromBaseTable) joinNode.getRightResultSet());
			result.getTableInfos().add(tableInfo);
		} else {
			analyzeAndMergeResult(result, joinNode.getRightResultSet());
		}

		analyzeAndMergeResult(result, joinNode.getJoinClause());
		return result;
	}

}


text:
goog.module('grrUi.hunt.huntErrorsDirective');
goog.module.declareLegacyNamespace();

/** @type {number} */
let AUTO_REFRESH_INTERVAL_MS = 20 * 1000;

/**
 * Sets the delay between automatic refreshes.
 *
 * @param {number} millis Interval value in milliseconds.
 * @export
 */
exports.setAutoRefreshInterval = function(millis) {
  AUTO_REFRESH_INTERVAL_MS = millis;
};

/**
 * Controller for HuntErrorsDirective.
 * @unrestricted
 */
const HuntErrorsController = class {
  /**
   * @param {!angular.Scope} $scope
   * @ngInject
   */
  constructor($scope) {
    /** @private {!angular.Scope} */
    this.scope_ = $scope;

    /** @type {string} */
    this.scope_.huntId;

    /** @export {string} */
    this.errorsUrl;

    /** @type {number} */
    this.autoRefreshInterval = AUTO_REFRESH_INTERVAL_MS;

    this.scope_.$watch('huntId', this.onHuntIdChange_.bind(this));
  }

  /**
   * Handles huntId attribute changes.
   *
   * @param {string} huntId
   * @private
   */
  onHuntIdChange_(huntId) {
    if (angular.isDefined(huntId)) {
      this.errorsUrl = 'hunts/' + huntId + '/errors';
    }
  }
};

/**
 * Directive for displaying errors of a hunt with a given URN.
 *
 * @return {!angular.Directive} Directive definition object.
 * @ngInject
 * @export
 */
exports.HuntErrorsDirective = function() {
  return {
    scope: {huntId: '='},
    restrict: 'E',
    templateUrl: '/static/angular-components/hunt/hunt-errors.html',
    controller: HuntErrorsController,
    controllerAs: 'controller'
  };
};

/**
 * Directive's name in Angular.
 *
 * @const
 * @export
 */
exports.HuntErrorsDirective.directive_name = 'grrHuntErrors';


text:
<!DOCTYPE html>

		<meta charset="utf-8" />
		<base href="../../" />

		<link type="text/css" rel="stylesheet" href="page.css" />

		[page:Material] →

[name]

			A material for shiny surfaces with specular highlights.

			The material uses a non-physically based [link:https://en.wikipedia.org/wiki/Blinn-Phong_shading_model Blinn-Phong]
			model for calculating reflectance. Unlike the Lambertian model used in the [page:MeshLambertMaterial]
			this can simulate shiny surfaces with specular highlights (such as varnished wood).

			Shading is calculated using a [link:https://en.wikipedia.org/wiki/Phong_shading Phong] shading model.
			This calculates shading per pixel (i.e. in the [link:https://en.wikipedia.org/wiki/Shader#Pixel_shaders fragment shader],
			AKA pixel shader)	which gives more accurate results than the Gouraud model used by [page:MeshLambertMaterial],
			at the cost of some performance. The [page:MeshStandardMaterial] and [page:MeshPhysicalMaterial]
			also use this shading model.

			Performance will generally be greater when using this material over the	[page:MeshStandardMaterial]
			or [page:MeshPhysicalMaterial], at the cost of some graphical accuracy.

Constructor

[name]( [param:Object parameters] )

			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
			Any property of the material (including any property inherited from [page:Material]) can be passed in here.

			The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
			string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.

Properties

See the base [page:Material] class for common properties.

[property:Texture alphaMap]

The alpha map is a grayscale texture that controls the opacity across the surface
			(black: fully transparent; white: fully opaque). Default is null.

			Only the color of the texture is used, ignoring the alpha channel if one exists.
			For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the
			green channel when sampling this texture due to the extra bit of precision provided
			for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
			luminance/alpha textures will also still work as expected.

[property:Texture aoMap]

The red channel of this texture is used as the ambient occlusion map. Default is null.
		The aoMap requires a second set of UVs, and consequently will ignore the [page:Texture repeat]
		and [page:Texture offset] Texture properties.

[property:Float aoMapIntensity]

Intensity of the ambient occlusion effect. Default is 1. Zero is no occlusion effect.

[property:Texture bumpMap]

			The texture to create a bump map. The black and white values map to the perceived depth in relation to the lights.
			Bump doesn't actually affect the geometry of the object, only the lighting. If a normal map is defined this will
			be ignored.

[property:Float bumpScale]

How much the bump map affects the material. Typical ranges are 0-1. Default is 1.

[property:Color color]

[page:Color] of the material, by default set to white (0xffffff).

[property:Integer combine]

			How to combine the result of the surface's color with the environment map, if any.

			Options are [page:Materials THREE.Multiply] (default), [page:Materials THREE.MixOperation],
			[page:Materials THREE.AddOperation]. If mix is chosen, the [page:.reflectivity] is used to
			blend between the two colors.

[property:Texture displacementMap]

			The displacement map affects the position of the mesh's vertices. Unlike other maps
			which only affect the light and shade of the material the displaced vertices can cast shadows,
			block other objects, and otherwise act as real geometry. The displacement texture is
			an image where the value of each pixel (white being the highest) is mapped against,
			and repositions, the vertices of the mesh.

[property:Float displacementScale]

			How much the displacement map affects the mesh (where black is no displacement,
			and white is maximum displacement). Without a displacement map set, this value is not applied.
			 Default is 1.

[property:Float displacementBias]

			The offset of the displacement map's values on the mesh's vertices.
			Without a displacement map set, this value is not applied. Default is 0.

[property:Color emissive]

		Emissive (light) color of the material, essentially a solid color unaffected by other lighting.
		Default is black.

[property:Texture emissiveMap]

		Set emisssive (glow) map. Default is null. The emissive map color is modulated by
		the emissive color and the emissive intensity. If you have an emissive map, be sure to
		set the emissive color to something other than black.

[property:Float emissiveIntensity]

Intensity of the emissive light. Modulates the emissive color. Default is 1.

[property:TextureCube envMap]

The environment map. Default is null.

[property:Boolean isMeshPhongMaterial]

			Used to check whether this or derived classes are mesh Phong materials. Default is *true*.

			You should not change this, as it used internally for optimisation.

[property:Texture lightMap]

The light map. Default is null. The lightMap requires a second set of UVs,
		and consequently will ignore the [page:Texture repeat] and [page:Texture offset]
		Texture properties.

[property:Float lightMapIntensity]

Intensity of the baked light. Default is 1.

[property:Texture map]

The color map. Default is null. The texture map color is modulated by the diffuse [page:.color].

[property:boolean morphNormals]

			Defines whether the material uses morphNormals. Set as true to pass morphNormal
			attributes from the [page:Geometry]	to the shader. Default is *false*.

[property:Boolean morphTargets]

Define whether the material uses morphTargets. Default is false.

[property:Texture normalMap]

			The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change
			the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting.

[property:Vector2 normalScale]

			How much the normal map affects the material. Typical ranges are 0-1.
			Default is a [page:Vector2] set to (1,1).

[property:Float reflectivity]

			How much the environment map affects the surface; also see [page:.combine].
			The default value is 1 and the valid range is between 0 (no reflections) and 1 (full reflections).

[property:Float refractionRatio]

			The index of refraction (IOR) of air (approximately 1) divided by the index of refraction of the material.
			It is used with environment mapping modes [page:Textures THREE.CubeRefractionMapping] and [page:Textures THREE.EquirectangularRefractionMapping].
			The refraction ratio should not exceed 1. Default is *0.98*.

[property:Float shininess]

How shiny the [page:.specular] highlight is; a higher value gives a sharper highlight. Default is *30*.

[property:Boolean skinning]

Define whether the material uses skinning. Default is false.

[property:Color specular]

			Specular color of the material. Default is a [page:Color] set to *0x111111* (very dark grey).

			This defines how shiny the material is and the color of its shine.

[property:Texture specularMap]

			The specular map value affects both how much the specular surface highlight
			contributes and how much of the environment map affects the surface. Default is null.

[property:Boolean wireframe]

Render geometry as wireframe. Default is *false* (i.e. render as flat polygons).

[property:String wireframeLinecap]

			Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.

			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]
			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.

[property:String wireframeLinejoin]

			Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.

			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]
			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.

[property:Float wireframeLinewidth]

Controls wireframe thickness. Default is 1.

		Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
		on Windows platforms linewidth will always be 1 regardless of the set value.

Methods

See the base [page:Material] class for common methods.

Source

		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]


text:
FOUNDATION_EXPORT double Pods_Neuron_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_Neuron_TestsVersionString[];