void Feature::calcColorFeature()
{
    // TODO: optimize this part, reduce extra work
    
    Mat hsv;
    cvtColor(mROI, hsv, CV_BGR2HSV_FULL);
    
    Mat temp(mROI.size(), CV_8UC3), mixed;
    Mat src[] = { mROI, mGray, hsv };
    int fromTo[] = { 2,0, 3,1, 5,2 };
    mixChannels(src, 3, &temp, 1, fromTo, 3);
    temp.convertTo(mixed, CV_64F);
    
    Scalar avg, stdDev;
    meanStdDev(mixed, avg, stdDev, mMask);
    Scalar var = stdDev.mul(stdDev);
    Mat temp1 = mixed - avg;
    Mat temp2 = temp1.mul(temp1);
    Scalar sk = mean(temp1.mul(temp2), mMask) / (var.mul(stdDev));
    Scalar ku = mean(temp2.mul(temp2), mMask) / (var.mul(var));
    
    Scalar stat[] = { avg, stdDev, sk, ku };
    for (int i = 0; i < 4; i++) {
        red[i] = stat[i][0];
        gray[i] = stat[i][1];
        saturation[i] = stat[i][2];
    }
}
Esempio n. 2
0
void
IRMemoryMap::WriteScalarToMemory (lldb::addr_t process_address, Scalar &scalar, size_t size, Error &error)
{
    error.Clear();
    
    if (size == UINT32_MAX)
        size = scalar.GetByteSize();
    
    if (size > 0)
    {
        uint8_t buf[32];
        const size_t mem_size = scalar.GetAsMemoryData (buf, size, GetByteOrder(), error);
        if (mem_size > 0)
        {
            return WriteMemory(process_address, buf, mem_size, error);
        }
        else
        {
            error.SetErrorToGenericError();
            error.SetErrorString ("Couldn't write scalar: failed to get scalar as memory data");
        }
    }
    else
    {
        error.SetErrorToGenericError();
        error.SetErrorString ("Couldn't write scalar: its size was zero");
    }
    return;
}
Esempio n. 3
0
void TimeAnalysisWidget::on_applyButton_clicked()
{
    bool low = _ui->lowRadioButton->isChecked();
    int numClusters = _ui->numClustersSpin->value();
    std::vector<Point*> &points = low?_lowPoints.data():_highPoints.data();

    std::vector<Point> centers;
    std::vector<int> assignment;
    PointClusterer::kmeans(PointClusterer::RANDOM,numClusters,
                           PointClusterer::EUCLIDEAN,
                           points, 10, centers, assignment);

    std::ostringstream ss;
    ss << "K-means " << numClusters << (low?" [low]":" [high]");
    Scalar *scalar = addScalar(ss.str());

    // create labels
    scalar->labels().clear();
    for (unsigned i=0; i<centers.size(); ++i) {
        ss.str("");
        ss << "Cluster [" << i << "]";
        scalar->labels().push_back(ss.str());
    }

    // assigne scalar values to points
    for (unsigned i=0; i<assignment.size(); ++i) {
        Point *p = _lowPoints.data()[i];
        p->setScalarValue(scalar, assignment[i]);
    }

    // refill combox
    fillScalarComboBox();
    _ui->colorByComboBox->setCurrentIndex(scalar->index());
}
Esempio n. 4
0
TEST(ScalarTest, Division) {
  Scalar lhs(5.0);
  Scalar rhs(2.0);
  Scalar r = lhs / rhs;
  EXPECT_TRUE(r.IsValid());
  EXPECT_EQ(r, Scalar(2.5));
}
Esempio n. 5
0
    virtual bool
    Execute 
    (
        Args& command,
        CommandReturnObject &result
    )
    {
        DataExtractor reg_data;
        ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
        RegisterContext *reg_context = exe_ctx.GetRegisterContext ();

        if (reg_context)
        {
            if (command.GetArgumentCount() != 2)
            {
                result.AppendError ("register write takes exactly 2 arguments: <reg-name> <value>");
                result.SetStatus (eReturnStatusFailed);
            }
            else
            {
                const char *reg_name = command.GetArgumentAtIndex(0);
                const char *value_str = command.GetArgumentAtIndex(1);
                const RegisterInfo *reg_info = reg_context->GetRegisterInfoByName(reg_name);

                if (reg_info)
                {
                    Scalar scalar;
                    Error error(scalar.SetValueFromCString (value_str, reg_info->encoding, reg_info->byte_size));
                    if (error.Success())
                    {
                        if (reg_context->WriteRegisterValue(reg_info->kinds[eRegisterKindLLDB], scalar))
                        {
                            result.SetStatus (eReturnStatusSuccessFinishNoResult);
                            return true;
                        }
                    }
                    else
                    {
                        result.AppendErrorWithFormat ("Failed to write register '%s' with value '%s': %s\n",
                                                     reg_name,
                                                     value_str,
                                                     error.AsCString());
                        result.SetStatus (eReturnStatusFailed);
                    }
                }
                else
                {
                    result.AppendErrorWithFormat ("Register not found for '%s'.\n", reg_name);
                    result.SetStatus (eReturnStatusFailed);
                }
            }
        }
        else
        {
            result.AppendError ("no current frame");
            result.SetStatus (eReturnStatusFailed);
        }
        return result.Succeeded();
    }
Esempio n. 6
0
template <typename Int> inline
float Cast_( const Scalar<Int>& s, ScalarType<float,Int> )
{
	switch ( s.Type() ) {
	default: TypeCastError( s.Type(), SINGLE );
	case SINGLE:     return s.template Get_<float>();
	}
}
Esempio n. 7
0
template <typename Int> inline
scomplex Cast_( const Scalar<Int>& s, ScalarType<scomplex,Int> q )
{
	switch ( s.Type() ) {
	default: TypeCastError( s.Type(), SCOMPLEX );
	case SINGLE:     return s.template Get_<float>();
	case SCOMPLEX:   return s.template Get_<scomplex>();
	}
}
Esempio n. 8
0
template <typename Int> inline
double Cast_( const Scalar<Int>& s, ScalarType<double,Int> )
{
	switch ( s.Type() ) {
	default: TypeCastError( s.Type(), DOUBLE );
	case INTEGRAL:   return s.template Get_<Int>();
	case SINGLE:     return s.template Get_<float>();
	case DOUBLE:     return s.template Get_<double>();
	}
}
Esempio n. 9
0
 bool Scalar::Equal( Scalar& a, Scalar& b )
{
    if( a.Type() != b.Type() )
        return false;

    DataType* pA = a.Get();
    DataType* pB = b.Get();

    return DataType::Equal( pA, pB );
}
Esempio n. 10
0
void
IM::multiply_assign (const Scalar& s, const Unit& u)
{
  daisy_assert (unit_);
  for (std::map<symbol, double>::iterator i = content.begin (); 
       i != content.end ();
       i++)
    (*i).second = Units::multiply (*unit_, s.unit (),
                                   (*i).second * s.value (), u);
  unit_ = &u;
}
Esempio n. 11
0
template <typename Int> inline
dcomplex Cast_( const Scalar<Int>& s, ScalarType<dcomplex,Int> q )
{
	switch ( s.Type() ) {
	default: TypeCastError( s.Type(), DCOMPLEX );
	case INTEGRAL:   return s.template Get_<Int>();
	case SINGLE:     return s.template Get_<float>();
	case DOUBLE:     return s.template Get_<double>();
	case SCOMPLEX:   return s.template Get_<scomplex>();
	case DCOMPLEX:   return s.template Get_<dcomplex>();
	}
}
Esempio n. 12
0
uint64_t
SBValue::GetValueAsUnsigned(uint64_t fail_value)
{
    ValueLocker locker;
    lldb::ValueObjectSP value_sp(GetSP(locker));
    if (value_sp)
    {
        Scalar scalar;
        if (value_sp->ResolveValue (scalar))
            return scalar.ULongLong(fail_value);
    }
    return fail_value;
}
Esempio n. 13
0
TEST(ScalarTest, SetValueFromCString) {
  Scalar a;

  EXPECT_THAT_ERROR(
      a.SetValueFromCString("1234567890123", lldb::eEncodingUint, 8).ToError(),
      Succeeded());
  EXPECT_EQ(1234567890123ull, a);

  EXPECT_THAT_ERROR(
      a.SetValueFromCString("-1234567890123", lldb::eEncodingSint, 8).ToError(),
      Succeeded());
  EXPECT_EQ(-1234567890123ll, a);

  EXPECT_THAT_ERROR(
      a.SetValueFromCString("asdf", lldb::eEncodingSint, 8).ToError(),
      Failed());
  EXPECT_THAT_ERROR(
      a.SetValueFromCString("asdf", lldb::eEncodingUint, 8).ToError(),
      Failed());
  EXPECT_THAT_ERROR(
      a.SetValueFromCString("1234567890123", lldb::eEncodingUint, 4).ToError(),
      Failed());
  EXPECT_THAT_ERROR(a.SetValueFromCString("123456789012345678901234567890",
                                          lldb::eEncodingUint, 8)
                        .ToError(),
                    Failed());
  EXPECT_THAT_ERROR(
      a.SetValueFromCString("-123", lldb::eEncodingUint, 8).ToError(),
      Failed());
}
Esempio n. 14
0
//-----------------------------------------------------------------------------
double dolfin::assemble(const Form& a)
{
  if (a.rank() != 0)
  {
    dolfin_error("assemble.cpp",
                 "assemble form",
                 "Expecting a scalar form but rank is %d",
                 a.rank());
  }

  Scalar s;
  Assembler assembler;
  assembler.assemble(s, a);
  return s.get_scalar_value();
}
Esempio n. 15
0
uint64_t
SBValue::GetValueAsUnsigned(uint64_t fail_value)
{
    if (m_opaque_sp)
    {
        if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
        {
            Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
            Scalar scalar;
            if (m_opaque_sp->ResolveValue (scalar))
                return scalar.GetRawBits64(fail_value);
        }
    }
    return fail_value;
}
Esempio n. 16
0
static bool ReadIntegerArgument(Scalar &scalar, unsigned int bit_width,
                                bool is_signed, Thread &thread,
                                uint32_t *argument_register_ids,
                                unsigned int &current_argument_register,
                                addr_t &current_stack_argument) {
  if (bit_width > 64)
    return false; // Scalar can't hold large integer arguments

  if (current_argument_register < 6) {
    scalar = thread.GetRegisterContext()->ReadRegisterAsUnsigned(
        argument_register_ids[current_argument_register], 0);
    current_argument_register++;
    if (is_signed)
      scalar.SignExtend(bit_width);
  } else {
    uint32_t byte_size = (bit_width + (8 - 1)) / 8;
    Status error;
    if (thread.GetProcess()->ReadScalarIntegerFromMemory(
            current_stack_argument, byte_size, is_signed, scalar, error)) {
      current_stack_argument += byte_size;
      return true;
    }
    return false;
  }
  return true;
}
Esempio n. 17
0
bool Multivector::AssignSum( const Multivector& multivectorA, const Multivector& multivectorB )
{
	if( this == &multivectorA && this == &multivectorB )
	{
		Scalar scalarTwo;
		if( !scalarTwo.Assign( 2.0 ) )
			return false;

		if( !AssignScalarProduct( scalarTwo, *this ) )
			return false;

		return true;
	}
	
	bool accumulateA = true;
	bool accumulateB = true;

	if( this == &multivectorA )
		accumulateA = false;
	else if( this == &multivectorB )
		accumulateB = false;
	else
		sumOfTerms.RemoveAll();

	if( accumulateA )
	{
		for( const SumOfTerms::Node* node = multivectorA.sumOfTerms.Head(); node; node = node->Next() )
		{
			const Term* term = node->data;
			sumOfTerms.InsertAfter()->data = term->Clone();
		}
	}

	if( accumulateB )
	{
		for( const SumOfTerms::Node* node = multivectorB.sumOfTerms.Head(); node; node = node->Next() )
		{
			const Term* term = node->data;
			sumOfTerms.InsertAfter()->data = term->Clone();
		}
	}

	if( !CollectTerms( Term::OUTER_PRODUCT ) )
		return false;

	return true;
}
Esempio n. 18
0
Scalar *TimeAnalysisWidget::addScalar( std::string name ) {
    int index = -1;
    for ( unsigned i = 0; i < _scalars.size(); ++i )
        if ( _scalars[i]->name() == name ) {
            index = i;
            break;
        }

    if ( index == -1 ) {
        Scalar *scalar = new Scalar( name );
        scalar->setIndex(_scalars.size());
        _scalars.push_back( scalar );
        return scalar;
    } else {
        return _scalars[index];
    }
}
Esempio n. 19
0
bool Multivector::AssignInnerProduct( const Multivector& multivectorA, const Multivector& multivectorB )
{
	if( multivectorA.CountProductTypes( Term::GEOMETRIC_PRODUCT ) > 0 )
		if( !const_cast< Multivector* >( &multivectorA )->CollectTerms( Term::OUTER_PRODUCT ) )
			return false;

	if( multivectorB.CountProductTypes( Term::GEOMETRIC_PRODUCT ) > 0 )
		if( !const_cast< Multivector* >( &multivectorB )->CollectTerms( Term::OUTER_PRODUCT ) )
			return false;

	Multivector* multivectorResult = this;

	Multivector multivectorStorage;
	if( this == &multivectorA || this == &multivectorB )
		multivectorResult = &multivectorStorage;

	for( const SumOfTerms::Node* nodeA = multivectorA.sumOfTerms.Head(); nodeA; nodeA = nodeA->Next() )
	{
		const Term* termA = nodeA->data;

		for( const SumOfTerms::Node* nodeB = multivectorB.sumOfTerms.Head(); nodeB; nodeB = nodeB->Next() )
		{
			const Term* termB = nodeB->data;

			Multivector innerProductMultivector;
			if( !termA->InnerProductMultiply( termB, innerProductMultivector ) )
				return false;

			Scalar scalar;
			if( !scalar.AssignProduct( *termA->coeficient, *termB->coeficient ) )
				return false;

			if( !innerProductMultivector.AssignScalarProduct( scalar, innerProductMultivector ) )
				return false;

			multivectorResult->sumOfTerms.Absorb( &innerProductMultivector.sumOfTerms );
		}
	}

	if( multivectorResult == &multivectorStorage )
		return Assign( multivectorStorage );

	return true;
}
Esempio n. 20
0
uint64_t
SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
{
    error.Clear();
    ValueLocker locker;
    lldb::ValueObjectSP value_sp(GetSP(locker));
    if (value_sp)
    {
        Scalar scalar;
        if (value_sp->ResolveValue (scalar))
            return scalar.ULongLong(fail_value);
        else
            error.SetErrorString("could not resolve value");
    }
    else
        error.SetErrorStringWithFormat ("could not get SBValue: %s", locker.GetError().AsCString());
    
    return fail_value;
}
Esempio n. 21
0
      void read_label (const std::string& path, VertexList& vertices, Scalar& scalar)
      {
        vertices.clear();
        scalar.resize(0);

        std::ifstream in (path.c_str(), std::ios_base::in);
        if (!in)
          throw Exception ("Error opening input file!");

        std::string line;
        std::getline (in, line);
        if (line.substr(0, 13) != "#!ascii label")
          throw Exception ("Error parsing FreeSurfer label file \"" + Path::basename (path) + "\": Bad first line identifier");
        std::getline (in, line);
        uint32_t num_vertices = 0;
        try {
          num_vertices = to<size_t> (line);
        } catch (Exception& e) {
          throw Exception (e, "Error parsing FreeSurfer label file \"" + Path::basename (path) + "\": Bad second line vertex count");
        }

        for (size_t i = 0; i != num_vertices; ++i) {
          std::getline (in, line);
          uint32_t index = std::numeric_limits<uint32_t>::max();
          default_type x = NaN, y = NaN, z = NaN, value = NaN;
          sscanf (line.c_str(), "%u %lf %lf %lf %lf", &index, &x, &y, &z, &value);
          if (index == std::numeric_limits<uint32_t>::max())
            throw Exception ("Error parsing FreeSurfer label file \"" + Path::basename (path) + "\": Malformed line");
          if (index >= scalar.size()) {
            scalar.conservativeResizeLike (Scalar::Base::Constant (index+1, NaN));
            vertices.resize (index+1, Vertex (NaN, NaN, NaN));
          }
          if (std::isfinite (scalar[index]))
            throw Exception ("Error parsing FreeSurfer label file \"" + Path::basename (path) + "\": Duplicated index (" + str(scalar[index]) + ")");
          scalar[index] = value;
          vertices[index] = Vertex (x, y, z);
        }

        if (!in.good())
          throw Exception ("Error parsing FreeSurfer label file \"" + Path::basename (path) + "\": End of file reached");
        scalar.set_name (path);
      }
Esempio n. 22
0
//=========================================================================================
bool Matrix::AssignInverse( const Matrix& matrix, InverseType inverseType, InverseResult& inverseResult )
{
	// TODO: Calculate left and right inverse matrices for non-square matrices.

	inverseResult = NONSINGULAR_MATRIX;

	Scalar scalar;
	if( !matrix.AssignDeterminantTo( scalar ) )
		return false;

	if( scalar == 0.0 )
	{
		inverseResult = SINGULAR_MATRIX;
		return true;
	}

	if( !scalar.Invert() )
		return false;

	if( matrix.rows == 1 && matrix.cols == 1 )
	{
		if( !AssignDimensions( 1, 1 ) )
			return false;

		if( !AssignScalarFrom( 0, 0, scalar ) )
			return false;
	}
	else if( matrix.rows == matrix.cols )
	{
		if( !AssignAdjugate( matrix ) )
			return false;

		if( !Scale( scalar ) )
			return false;
	}
	else if( matrix.rows > matrix.cols )
		return false;		// TODO: Deal with this case.
	else if( matrix.rows < matrix.cols )
		return false;		// TODO: Deal with this case.

	return true;
}
Esempio n. 23
0
T3::Scalar T3::Axisymmetric::Lap(const T3::Scalar& x) const {
    Scalar dx;
    dx += at(0).two(x);
    
    Field dux = at(1).two(x);
    PFOR(i,x.N[0]) FOR(j,x.N[1]) dux(i,j,0) /= at(0)(i)*at(0)(i);
    dx += dux;
    
    dux = at(0)(x);
    PFOR(i,x.N[0]) FOR(j,x.N[1]) dux(i,j,0) /= at(0)(i)/2;
    dx += dux;
    
    dux = at(1)(x);
    PFOR(i,x.N[0]) FOR(j,x.N[1]) dux(i,j,0) /= at(0)(i)*at(0)(i)*sin(at(1)(j))/cos(at(1)(j));
    dx += dux;
    
    dx.parent = parent;
    dx.fix();
    return dx;
}
Esempio n. 24
0
T3::Scalar T3::Axisymmetric::operator*(const T3::Vector& x) const {
    Scalar dx;
    dx += at(0)(x[0]);

    Field dxu = at(1)(x[1]);
    PFOR(i,x.N[0]) FOR(j,x.N[1]) dxu(i,j,0) /= at(0)(i);
    dx += dxu;
    
    Field xu = x[0];
    PFOR(i,x.N[0]) FOR(j,x.N[1]) xu(i,j,0) /= at(0)(i) / 2.;
    dx += xu;
    
    xu = x[1];
    PFOR(i,x.N[0]) FOR(j,x.N[1]) xu(i,j,0) /= at(0)(i) * sin( at(1)(j) ) / cos( at(1)(j) );
    dx += xu;
    
    dx.parent = x.parent;
    dx.fix();
    return dx;
}
Esempio n. 25
0
uint64_t
SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
{
    error.Clear();
    if (m_opaque_sp)
    {
        if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
        {
            Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
            Scalar scalar;
            if (m_opaque_sp->ResolveValue (scalar))
                return scalar.GetRawBits64(fail_value);
            else
                error.SetErrorString("could not get value");
        }
        else
            error.SetErrorString("could not get target");
    }
    error.SetErrorString("invalid SBValue");
    return fail_value;
}
Esempio n. 26
0
bool Scalar::AssignProduct( const Scalar& scalarA, const Scalar& scalarB )
{
	Scalar* scalarResult = this;

	Scalar scalarStorage;
	if( this == &scalarA || this == &scalarB )
		scalarResult = &scalarStorage;

	scalarResult->sumOfTermsNumerator.RemoveAll();
	Multiply( scalarResult->sumOfTermsNumerator, scalarA.sumOfTermsNumerator, scalarB.sumOfTermsNumerator );

	scalarResult->sumOfTermsDenominator.RemoveAll();
	Multiply( scalarResult->sumOfTermsDenominator, scalarA.sumOfTermsDenominator, scalarB.sumOfTermsDenominator );

	scalarResult->CollectTerms();

	if( scalarResult == &scalarStorage )
		return Assign( scalarStorage );

	return true;
}
Esempio n. 27
0
template<class Op> static void
binarySOpCn_( const Mat& srcmat, Mat& dstmat, const Scalar& _scalar )
{
    Op op;
    typedef typename Op::type1 T;
    typedef typename Op::type2 WT;
    typedef typename Op::rtype DT;
    const T* src0 = (const T*)srcmat.data;
    DT* dst0 = (DT*)dstmat.data;
    size_t step1 = srcmat.step/sizeof(src0[0]);
    size_t step = dstmat.step/sizeof(dst0[0]);
    int cn = dstmat.channels();
    Size size = getContinuousSize( srcmat, dstmat, cn );
    WT scalar[12];
    _scalar.convertTo(scalar, cn, 12);

    for( ; size.height--; src0 += step1, dst0 += step )
    {
        int i, len = size.width;
        const T* src = src0;
        T* dst = dst0;

        for( ; (len -= 12) >= 0; dst += 12, src += 12 )
        {
            DT t0 = op(src[0], scalar[0]);
            DT t1 = op(src[1], scalar[1]);
            dst[0] = t0; dst[1] = t1;

            t0 = op(src[2], scalar[2]);
            t1 = op(src[3], scalar[3]);
            dst[2] = t0; dst[3] = t1;

            t0 = op(src[4], scalar[4]);
            t1 = op(src[5], scalar[5]);
            dst[4] = t0; dst[5] = t1;

            t0 = op(src[6], scalar[6]);
            t1 = op(src[7], scalar[7]);
            dst[6] = t0; dst[7] = t1;

            t0 = op(src[8], scalar[8]);
            t1 = op(src[9], scalar[9]);
            dst[8] = t0; dst[9] = t1;

            t0 = op(src[10], scalar[10]);
            t1 = op(src[11], scalar[11]);
            dst[10] = t0; dst[11] = t1;
        }

        for( (len) += 12, i = 0; i < (len); i++ )
            dst[i] = op((WT)src[i], scalar[i]);
    }
}
Esempio n. 28
0
void TimeAnalysisWidget::loadLowAndHighData(std::string filename)
{
    std::string basename = filename.substr(0, filename.find_last_of('.'));    
    _highPoints.load(basename + ".high");

    //_lowPoints.load(basename + ".low");
    //_lowPoints.load(basename + ".low_normalized_cols");
//    _lowPoints.load(basename + ".low_normalized_rows");
    _lowPoints.load(basename + ".low_standarised");
    //_lowPoints.load(basename + ".low_unnormalized");

    // adding default scalars
    Scalar *noneScalar = addScalar("None");
    noneScalar->labels().push_back("None");

    Scalar *dayScalar = addScalar("Day");
    for (int i=0; i<7; ++i)
        dayScalar->labels().push_back(QDate::longDayName(i+1).toStdString());

    Scalar *wend_wdayScalar = addScalar("Weekend/Weekdays");
    wend_wdayScalar->labels().push_back("Weekdays");
    wend_wdayScalar->labels().push_back("Weekends");

    for (int i=0; i<_lowPoints.numPoints(); ++i) {
        Point *lp = _lowPoints.data()[i];
        Point *hp = _highPoints.data()[i];

        QDate d = lp->getDate();

        lp->setScalarValue(noneScalar, 0);
        lp->setScalarValue(dayScalar, d.dayOfWeek()-1);
        lp->setScalarValue(wend_wdayScalar, d.dayOfWeek()==6||d.dayOfWeek()==7);

        hp->setScalarValue(noneScalar, 0);
        hp->setScalarValue(dayScalar, d.dayOfWeek());
        hp->setScalarValue(wend_wdayScalar, d.dayOfWeek()==6||d.dayOfWeek()==7);
    }
}
Esempio n. 29
0
bool Scalar::AssignInverse( const Scalar& scalar )
{
	if( this == &scalar )
		return Invert();
	else
	{
		if( scalar.IsZero() )
			return false;

		sumOfTermsNumerator.Copy( scalar.sumOfTermsDenominator );
		sumOfTermsDenominator.Copy( scalar.sumOfTermsNumerator );
	}

	return true;
}
 KOKKOS_INLINE_FUNCTION
 static Scalar draw(Generator& gen, const Scalar& start, const Scalar& end) {
   return BaseRand::draw(gen, start.coeff(0), end.coeff(0));
 }