Esempio n. 1
0
polyjam::core::Coefficient
polyjam::core::Coefficient::inversion() const
{
  Coefficient newClone = clone();
  newClone.inversionInPlace();
  return newClone;
}
Esempio n. 2
0
polyjam::core::Coefficient
polyjam::core::Coefficient::negation() const
{
  Coefficient newClone = clone();
  newClone.negationInPlace();
  return newClone;
}
Esempio n. 3
0
void
polyjam::core::Coefficient::copy( const Coefficient & coefficient )
{
  fields::Field * newField = NULL;
  
  switch( coefficient.kind() )
  {
    case fields::Field::R:
    {
      newField = new fields::R(coefficient._field.get());
      break;
    }
    case fields::Field::Q:
    {
      newField = new fields::Q(coefficient._field.get());
      break;
    }
    case fields::Field::Zp:
    {
      newField = new fields::Zp(coefficient._field.get());
      break;
    }
    case fields::Field::Sym:
    {
      newField = new fields::Sym(coefficient._field.get());
      break;
    }
    default:
      break;
  }
  
  _field = FieldPtr(newField);
}
Esempio n. 4
0
void HamOperator::AddState(TraceState& state, int parity, MixState& res, int order2Change)
{
	Coefficient coef = state.Normalize();
	StateId id = StateCollection::Inst()->GetId(state);
	if (!id.IsValid())
	{
		return;
	}

	if (parity % 2 == 1)
	{
		coef.Opposite();
	}
	
	if (order2Change != 0)
	{
		coef.ChangeOrder(order2Change);
	}

	res.AddState(id, coef);
}
int main(int argc, char *argv[]) {
	CommandHandler ch;
	FileParser fp;
	Queue startQueue;
	Queue endQueue;
	biquad_t treble;
	biquad_t bass;

	ch.handleStartCommands(argc, argv);
	fp.parseFile(&startQueue, ch.getInputFileName());
	std::cout << "Parsed file into " << startQueue.getQueueSize() << " blocks."
			<< std::endl;

	Coefficient c;
	c.bassCoeffiecient(ch.getBassIntensity(), &(bass.b0), &(bass.b1), &(bass.b2),
			&(bass.a1), &(bass.a2));
	c.trebleCoefficient(ch.getTrebleIntensity(), &(treble.b0), &(treble.b1),
			&(treble.b2), &(treble.a1), &(treble.a2));

	Equalizer *eq1 = new Equalizer(&startQueue, &endQueue, treble, bass, "Eq1");
	Equalizer *eq2 = new Equalizer(&startQueue, &endQueue, treble, bass, "Eq2");
	Equalizer *eq3 = new Equalizer(&startQueue, &endQueue, treble, bass, "Eq3");
	Equalizer *eq4 = new Equalizer(&startQueue, &endQueue, treble, bass, "Eq4");
	Equalizer *eq5 = new Equalizer(&startQueue, &endQueue, treble, bass, "Eq5");
	Equalizer *eq6 = new Equalizer(&startQueue, &endQueue, treble, bass, "Eq6");

	while (startQueue.getQueueSize() > startQueue.getBlockCount())
		;

	eq1->stop();
	eq2->stop();
	eq3->stop();
	eq4->stop();
	eq5->stop();
	eq6->stop();

	endQueue.writeToFile(ch.getOutputFileName());
	return 0;
}
Esempio n. 6
0
 virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
 { return active_attr[T.Attribute-1] ? c->Eval(T, ip, GetTime()) : 0.0; }
Esempio n. 7
0
 /// Evaluate the coefficient
 virtual double Eval(ElementTransformation &T,
                     const IntegrationPoint &ip)
 { return pow(a->Eval(T, ip), p); }
Esempio n. 8
0
 /// Evaluate the coefficient
 virtual double Eval(ElementTransformation &T,
                     const IntegrationPoint &ip)
 { return alpha * a->Eval(T, ip) + beta * b->Eval(T, ip); }