Beispiel #1
0
OSStatus	CAAudioUnit::SetPresentPreset (AUPreset &inData)
{
	OSStatus result = AudioUnitSetProperty (AU(), kAudioUnitProperty_PresentPreset,
								kAudioUnitScope_Global, 0,
								&inData, sizeof (AUPreset));
	if (result == kAudioUnitErr_InvalidProperty) {
		result = AudioUnitSetProperty (AU(), kAudioUnitProperty_CurrentPreset,
								kAudioUnitScope_Global, 0,
								&inData, sizeof (AUPreset));
	}
	return result;
}
Beispiel #2
0
OSStatus		CAAudioUnit::ClearChannelLayout (AudioUnitScope	inScope,
											AudioUnitElement	inEl)
{
	return AudioUnitSetProperty (AU(),
							kAudioUnitProperty_AudioChannelLayout,
							inScope, inEl, NULL, 0);
}
Beispiel #3
0
void		CAAudioUnit::Print (FILE* file) const
{
	fprintf (file, "AudioUnit:%p\n", AU());
	if (IsValid()) {
		fprintf (file, "\tnode=%ld\t", (long)GetAUNode()); Comp().Print (file);
	}
}
Beispiel #4
0
OSStatus	CAAudioUnit::GetAUPreset (CFPropertyListRef &outData) const
{
	UInt32 dataSize = sizeof(outData);
	return AudioUnitGetProperty (AU(), kAudioUnitProperty_ClassInfo,
								kAudioUnitScope_Global, 0,
								&outData, &dataSize);
}
Beispiel #5
0
OSStatus	CAAudioUnit::SetBypass 		(bool	inBypass) const
{
	UInt32 bypass = inBypass ? 1 : 0;
	return AudioUnitSetProperty (AU(), kAudioUnitProperty_BypassEffect,
								kAudioUnitScope_Global, 0,
								&bypass, sizeof (UInt32));
}
Beispiel #6
0
bool		CAAudioUnit::CanBypass () const
{
	Boolean outWritable;
	OSStatus result = AudioUnitGetPropertyInfo (AU(), kAudioUnitProperty_BypassEffect,
									kAudioUnitScope_Global, 0,
									NULL, &outWritable);
	return (!result && outWritable);
}
Beispiel #7
0
bool		CAAudioUnit::HasChannelLayouts (AudioUnitScope 		inScope,
										AudioUnitElement 		inEl) const
{
	OSStatus result = AudioUnitGetPropertyInfo (AU(),
									kAudioUnitProperty_SupportedChannelLayoutTags,
									inScope, inEl,
									NULL, NULL);
	return !result;
}
Beispiel #8
0
bool		CAAudioUnit::GetBypass 		() const
{
	UInt32 dataSize = sizeof (UInt32);
	UInt32 outBypass;
	OSStatus result = AudioUnitGetProperty (AU(), kAudioUnitProperty_BypassEffect,
								kAudioUnitScope_Global, 0,
								&outBypass, &dataSize);
	return (result ? false : outBypass);
}
Beispiel #9
0
OSStatus	CAAudioUnit::GetFormat (AudioUnitScope				inScope,
									AudioUnitElement			inEl,
									AudioStreamBasicDescription	&outFormat) const
{
	UInt32 dataSize = sizeof (AudioStreamBasicDescription);
	return AudioUnitGetProperty (AU(), kAudioUnitProperty_StreamFormat,
								inScope, inEl,
								&outFormat, &dataSize);
}
Beispiel #10
0
OSStatus	CAAudioUnit::SetFormat (AudioUnitScope						inScope,
									AudioUnitElement					inEl,
									const AudioStreamBasicDescription	&inFormat)
{
	return AudioUnitSetProperty (AU(), kAudioUnitProperty_StreamFormat,
								inScope, inEl,
								const_cast<AudioStreamBasicDescription*>(&inFormat),
								sizeof (AudioStreamBasicDescription));
}
Beispiel #11
0
OSStatus	CAAudioUnit::GetSampleRate (AudioUnitScope		inScope,
										AudioUnitElement	inEl,
										Float64				&outRate) const
{
	UInt32 dataSize = sizeof (Float64);
	return AudioUnitGetProperty (AU(), kAudioUnitProperty_SampleRate,
								inScope, inEl,
								&outRate, &dataSize);
}
Beispiel #12
0
OSStatus	CAAudioUnit::SetChannelLayout (AudioUnitScope 		inScope,
									AudioUnitElement 			inEl,
									CAAudioChannelLayout 		&inLayout)
{
	OSStatus result = AudioUnitSetProperty (AU(),
									kAudioUnitProperty_AudioChannelLayout,
									inScope, inEl,
									inLayout, inLayout.Size());
	return result;
}
Beispiel #13
0
OSStatus	CAAudioUnit::GetChannelLayout (AudioUnitScope 		inScope,
										AudioUnitElement 		inEl,
										CAAudioChannelLayout	&outLayout) const
{
	UInt32 size;
	OSStatus result = AudioUnitGetPropertyInfo (AU(), kAudioUnitProperty_AudioChannelLayout,
									inScope, inEl, &size, NULL);
	if (result) return result;

	AudioChannelLayout *layout = (AudioChannelLayout*)malloc (size);

	require_noerr (result = AudioUnitGetProperty (AU(), kAudioUnitProperty_AudioChannelLayout,
									inScope, inEl, layout, &size), home);

	outLayout = CAAudioChannelLayout (layout);

home:
	free (layout);
	return result;
}
Beispiel #14
0
OSStatus	CAAudioUnit::GetPresentPreset (AUPreset &outData) const
{
	UInt32 dataSize = sizeof(outData);
	OSStatus result = AudioUnitGetProperty (AU(), kAudioUnitProperty_PresentPreset,
								kAudioUnitScope_Global, 0,
								&outData, &dataSize);
	if (result == kAudioUnitErr_InvalidProperty) {
		dataSize = sizeof(outData);
		result = AudioUnitGetProperty (AU(), kAudioUnitProperty_CurrentPreset,
									kAudioUnitScope_Global, 0,
									&outData, &dataSize);
		if (result == noErr) {
			// we now retain the CFString in the preset so for the client of this API
			// it is consistent (ie. the string should be released when done)
			if (outData.presetName)
				CFRetain (outData.presetName);
		}
	}
	return result;
}
Beispiel #15
0
bool		CAAudioUnit::GetChannelLayouts (AudioUnitScope 			inScope,
										AudioUnitElement 			inEl,
										ChannelTagVector			&outChannelVector) const
{
	if (HasChannelLayouts (inScope, inEl) == false) return false;

	UInt32 dataSize;
	OSStatus result = AudioUnitGetPropertyInfo (AU(),
								kAudioUnitProperty_SupportedChannelLayoutTags,
								inScope, inEl,
								&dataSize, NULL);

	if (result == kAudioUnitErr_InvalidProperty) {
		// if we get here we can do layouts but we've got the speaker config property
		outChannelVector.erase (outChannelVector.begin(), outChannelVector.end());
		outChannelVector.push_back (kAudioChannelLayoutTag_Stereo);
		outChannelVector.push_back (kAudioChannelLayoutTag_StereoHeadphones);
		outChannelVector.push_back (kAudioChannelLayoutTag_Quadraphonic);
		outChannelVector.push_back (kAudioChannelLayoutTag_AudioUnit_5_0);
		return true;
	}

	if (result) return false;

	bool canDo = false;
		// OK lets get our channel layouts and see if the one we want is present
	AudioChannelLayoutTag* info = (AudioChannelLayoutTag*)malloc (dataSize);
	result = AudioUnitGetProperty (AU(),
							kAudioUnitProperty_SupportedChannelLayoutTags,
							inScope, inEl,
							info, &dataSize);
	if (result) goto home;

	outChannelVector.erase (outChannelVector.begin(), outChannelVector.end());
	for (unsigned int i = 0; i < (dataSize / sizeof (AudioChannelLayoutTag)); ++i)
		outChannelVector.push_back (info[i]);

home:
	free (info);
	return canDo;
}
Beispiel #16
0
int QR(double* A , int n, double* Q1, double* Q2){
	for (int k = 1; k < n; k++){
		Xotr(A,n,k,Q1,Q2);
		UA(A,Q1,Q2,n,k);
	}
	for (int k = 1; k < n; k++){
		if (AU(A,Q1,Q2,n,k)==-1){
			return -1;
		}
	}
	return 1;
}
Beispiel #17
0
bool		CAAudioUnit::SupportsNumChannels () const
{
	// this is the default assumption of an audio effect unit
	Boolean* isWritable = 0;
	UInt32	dataSize = 0;
		// lets see if the unit has any channel restrictions
	OSStatus result = AudioUnitGetPropertyInfo (AU(),
									kAudioUnitProperty_SupportedNumChannels,
									kAudioUnitScope_Global, 0,
									&dataSize, isWritable); //don't care if this is writable

		// if this property is NOT implemented an FX unit
		// is expected to deal with same channel valance in and out
	if (result) {
		if (Comp().Desc().IsEffect() || Comp().Desc().IsOffline())
			return true;
	}
	return result == noErr;
}
Beispiel #18
0
bool		CAAudioUnit::CanDo (	int 				inChannelsIn,
									int 				inChannelsOut) const
{
	// this is the default assumption of an audio effect unit
	Boolean* isWritable = 0;
	UInt32	dataSize = 0;
		// lets see if the unit has any channel restrictions
	OSStatus result = AudioUnitGetPropertyInfo (AU(),
									kAudioUnitProperty_SupportedNumChannels,
									kAudioUnitScope_Global, 0,
									&dataSize, isWritable); //don't care if this is writable

		// if this property is NOT implemented an FX unit
		// is expected to deal with same channel valance in and out
	if (result)
	{
		if ((Comp().Desc().IsEffect() && (inChannelsIn == inChannelsOut))
			|| (Comp().Desc().IsOffline() && (inChannelsIn == inChannelsOut)))
		{
			return true;
		}
		else
		{
			// the au should either really tell us about this
			// or we will assume the worst
			return false;
		}
	}

	StackAUChannelInfo info (dataSize);

	result = GetProperty (kAudioUnitProperty_SupportedNumChannels,
							kAudioUnitScope_Global, 0,
							info.mChanInfo, &dataSize);
	if (result) { return false; }

	return ValidateChannelPair (inChannelsIn, inChannelsOut, info.mChanInfo, (dataSize / sizeof (AUChannelInfo)));
}
Beispiel #19
0
int LSQR(const MatrixType& A, const RhsType& B, SolType& X,
    krylov_iter_params_t params = krylov_iter_params_t(),
    const inplace_precond_t<SolType>& R = inplace_id_precond_t<SolType>()) {

    typedef typename utility::typer_t<MatrixType>::value_type value_t;
    typedef typename utility::typer_t<MatrixType>::index_type index_t;

    typedef MatrixType matrix_type;
    typedef RhsType rhs_type;        // Also serves as "long" vector type.
    typedef SolType sol_type;        // Also serves as "short" vector type.

    typedef utility::print_t<rhs_type> rhs_print_t;
    typedef utility::print_t<sol_type> sol_print_t;

    typedef utility::elem_extender_t<
        typename internal::scalar_cont_typer_t<rhs_type>::type >
        scalar_cont_type;

    bool log_lev1 = params.am_i_printing && params.log_level >= 1;
    bool log_lev2 = params.am_i_printing && params.log_level >= 2;

    /** Throughout, we will use m, n, k to denote the problem dimensions */
    index_t m = base::Height(A);
    index_t n = base::Width(A);
    index_t k = base::Width(B);

    /** Set the parameter values accordingly */
    const value_t eps = 32*std::numeric_limits<value_t>::epsilon();
    if (params.tolerance<eps) params.tolerance=eps;
    else if (params.tolerance>=1.0) params.tolerance=(1-eps);
    else {} /* nothing */

    /** Initialize everything */
    // We set the grid and rank for beta, and all other scalar containers
    // just copy from him to get that to be set right (not for the values).
    rhs_type U(B);
    scalar_cont_type
        beta(internal::scalar_cont_typer_t<rhs_type>::build_compatible(k, 1, U));
    scalar_cont_type i_beta(beta);
    base::ColumnNrm2(U, beta);
    for (index_t i=0; i<k; ++i)
        i_beta[i] = 1 / beta[i];
    base::DiagonalScale(elem::RIGHT, elem::NORMAL, i_beta, U);
    rhs_print_t::apply(U, "U Init", params.am_i_printing, params.debug_level);

    sol_type V(X);     // No need to really copy, just want sizes&comm correct.
    base::Gemm(elem::ADJOINT, elem::NORMAL, 1.0, A, U, V);
    R.apply_adjoint(V);
    scalar_cont_type alpha(beta), i_alpha(beta);
    base::ColumnNrm2(V, alpha);
    for (index_t i=0; i<k; ++i)
        i_alpha[i] = 1 / alpha[i];
    base::DiagonalScale(elem::RIGHT, elem::NORMAL, i_alpha, V);
    sol_type Z(V);
    R.apply(Z);
    sol_print_t::apply(V, "V Init", params.am_i_printing, params.debug_level);

    /* Create W=Z and X=0 */
    base::Zero(X);
    sol_type W(Z);
    scalar_cont_type phibar(beta), rhobar(alpha), nrm_r(beta);
        // /!\ Actually copied for init
    scalar_cont_type nrm_a(beta), cnd_a(beta), sq_d(beta), nrm_ar_0(beta);
    base::Zero(nrm_a); base::Zero(cnd_a); base::Zero(sq_d);
    elem::Hadamard(alpha, beta, nrm_ar_0);

    /** Return from here */
    for (index_t i=0; i<k; ++i)
        if (nrm_ar_0[i]==0)
            return 0;

    scalar_cont_type nrm_x(beta), sq_x(beta), z(beta), cs2(beta), sn2(beta);
    elem::Zero(nrm_x); elem::Zero(sq_x); elem::Zero(z); elem::Zero(sn2);
    for (index_t i=0; i<k; ++i)
        cs2[i] = -1.0;

    int max_n_stag = 3;
    std::vector<int> stag(k, 0);

    /* Reset the iteration limit if none was specified */
    if (0>params.iter_lim) params.iter_lim = std::max(20, 2*std::min(m,n));

    /* More varaibles */
    sol_type AU(X);
    scalar_cont_type minus_beta(beta), rho(beta);
    scalar_cont_type cs(beta), sn(beta), theta(beta), phi(beta);
    scalar_cont_type phi_by_rho(beta), minus_theta_by_rho(beta), nrm_ar(beta);
    scalar_cont_type nrm_w(beta), sq_w(beta), gamma(beta);
    scalar_cont_type delta(beta), gambar(beta), rhs(beta), zbar(beta);

    /** Main iteration loop */
    for (index_t itn=0; itn<params.iter_lim; ++itn) {

        /** 1. Update u and beta */
        elem::Scal(-1.0, alpha);   // Can safely overwrite based on subseq ops.
        base::DiagonalScale(elem::RIGHT, elem::NORMAL, alpha, U);
        base::Gemm(elem::NORMAL, elem::NORMAL, 1.0, A, Z, 1.0, U);
        base::ColumnNrm2(U, beta);
        for (index_t i=0; i<k; ++i)
            i_beta[i] = 1 / beta[i];
        base::DiagonalScale(elem::RIGHT, elem::NORMAL, i_beta, U);

        /** 2. Estimate norm of A */
        for (index_t i=0; i<k; ++i) {
            double a = nrm_a[i], b = alpha[i], c = beta[i];
            nrm_a[i] = sqrt(a*a + b*b + c*c);
        }

        /** 3. Update v */
        for (index_t i=0; i<k; ++i)
            minus_beta[i] = -beta[i];
        base::DiagonalScale(elem::RIGHT, elem::NORMAL, minus_beta, V);
        base::Gemm(elem::ADJOINT, elem::NORMAL, 1.0, A, U, AU);
        R.apply_adjoint(AU);
        base::Axpy(1.0, AU, V);
        base::ColumnNrm2(V, alpha);
        for (index_t i=0; i<k; ++i)
            i_alpha[i] = 1 / alpha[i];
        base::DiagonalScale(elem::RIGHT, elem::NORMAL, i_alpha, V);
        Z = V; R.apply(Z);

       /** 4. Define some variables */
        for (index_t i=0; i<k; ++i) {
            rho[i] = sqrt((rhobar[i]*rhobar[i]) + (beta[i]*beta[i]));
            cs[i] = rhobar[i]/rho[i];
            sn[i] =  beta[i]/rho[i];
            theta[i] = sn[i]*alpha[i];
            rhobar[i] = -cs[i]*alpha[i];
            phi[i] = cs[i]*phibar[i];
            phibar[i] =  sn[i]*phibar[i];
        }

        /** 5. Update X and W */
        for (index_t i=0; i<k; ++i)
            phi_by_rho[i] = phi[i]/rho[i];
        base::Axpy(phi_by_rho, W, X);
        sol_print_t::apply(X, "X", params.am_i_printing, params.debug_level);

        for (index_t i=0; i<k; ++i)
            minus_theta_by_rho[i] = -theta[i]/rho[i];
        base::DiagonalScale(elem::RIGHT, elem::NORMAL, minus_theta_by_rho, W);
        base::Axpy(1.0, Z, W);
        sol_print_t::apply(W, "W", params.am_i_printing, params.debug_level);

        /** 6. Estimate norm(r) */
        nrm_r = phibar;

        /** 7. estimate of norm(A'*r) */
        index_t cond_s1 = 0, cond_s2 = 0;
        for (index_t i=0; i<k; ++i) {
            nrm_ar[i] = std::abs(phibar[i]*alpha[i]*cs[i]);

            if (log_lev2)
                params.log_stream << "LSQR: Iteration " << i << "/" << itn
                                  << ": " << nrm_ar[i]
                                  << std::endl;


            if (nrm_ar[i]<(params.tolerance*nrm_ar_0[i]))
                cond_s1++;
            if (nrm_ar[i]<(eps*nrm_a[i]*nrm_r[i]))
                cond_s2++;
        }

        /** 8. check convergence */
        if (cond_s1 == k) {
            if (log_lev1)
                params.log_stream << "LSQR: Convergence (S1)!" << std::endl;
            return -2;
        }

        if (cond_s2 == k) {
            if (log_lev1)
                params.log_stream << "LSQR: Convergence (S2)!" << std::endl;
            return -3;
        }

        /** 9. estimate of cond(A) */
        base::ColumnNrm2(W, nrm_w);
        for (index_t i=0; i<k; ++i) {
            sq_w[i] = nrm_w[i]*nrm_w[i];
            sq_d[i] += sq_w[i]/(rho[i]*rho[i]);
            cnd_a[i] = nrm_a[i]*sqrt(sq_d[i]);

            /** 10. check condition number */
            if (cnd_a[i]>(1.0/eps)) {
                if (log_lev1)
                    params.log_stream << "LSQR: Stopping (S3)!" << std::endl;
                return -4;
            }
        }

        /** 11. check stagnation */
        for (index_t i=0; i<k; ++i) {
            if (std::abs(phi[i]/rho[i])*nrm_w[i] < (eps*nrm_x[i]))
                stag[i]++;
            else
                stag[i] = 0;

            if (stag[i] >= max_n_stag) {
                if (log_lev1)
                    params.log_stream << "LSQR: Stagnation." << std::endl;
                return -5;
            }
        }

        /** 12. estimate of norm(X) */
        for (index_t i=0; i<k; ++i) {
            delta[i] =  sn2[i]*rho[i];
            gambar[i] = -cs2[i]*rho[i];
            rhs[i] = phi[i] - delta[i]*z[i];
            zbar[i] = rhs[i]/gambar[i];
            nrm_x[i] = sqrt(sq_x[i] + (zbar[i]*zbar[i]));
            gamma[i] = sqrt((gambar[i]*gambar[i]) + (theta[i]*theta[i]));
            cs2[i] = gambar[i]/gamma[i];
            sn2[i] = theta[i]/gamma[i];
            z[i] = rhs[i]/gamma[i];
            sq_x[i] += z[i]*z[i];
        }
    }
    if (log_lev1)
        params.log_stream << "LSQR: No convergence within iteration limit."
                          << std::endl;

    return -6;
}
Beispiel #20
0
bool FeynHiggsWrapper::SetFeynHiggsPars()
{
    int err;

    /* FeynHiggs debug flag */
    //FHSetDebug(2);
    //FHSetDebug(3);

    Mw_FHinput = mySUSY.Mw_tree(); /* Tree-level W-boson mass */
    //Mw_FHinput = mySUSY.StandardModel::Mw(); /* SM prediction, which should not be used, since mHl cannot be set before calling FeynHiggs. */
    //std::cout << "Mw = " << Mw_FHinput << " used in FeynHiggsWrapper::SetFeynHiggsPars()" << std::endl;

    /* Set the FeynHiggs SM input parameters */
    FHSetSMPara(&err,
                1.0/mySUSY.alphaMz(),
                mySUSY.getAlsMz(), mySUSY.getGF(),
                mySUSY.getLeptons(StandardModel::ELECTRON).getMass(),
                mySUSY.getQuarks(QCD::UP).getMass(),
                mySUSY.getQuarks(QCD::DOWN).getMass(),
                mySUSY.getLeptons(StandardModel::MU).getMass(),
                mySUSY.getQuarks(QCD::CHARM).getMass(),
                mySUSY.getQuarks(QCD::STRANGE).getMass(),
                mySUSY.getLeptons(StandardModel::TAU).getMass(),
                mySUSY.getQuarks(QCD::BOTTOM).getMass(),
                Mw_FHinput, mySUSY.getMz(),
                mySUSY.getLambda(), mySUSY.getA(), mySUSY.getRhob(), mySUSY.getEtab());
    if (err != 0) {
#ifdef FHDEBUG
        std::cout << "FeynHiggsWrapper::SetFeynHiggsPars(): Error has been detected in SetPara.F:"
                  << err << std::endl;
#endif
        return (false);
    }

    /* Parameters for FeynHiggs */
    double Q_S = mySUSY.Q_SUSY;
    gslpp::complex muHFH = mySUSY.muH;
    gslpp::complex M1FH = mySUSY.m1;
    gslpp::complex M2FH = mySUSY.m2;
    gslpp::matrix<gslpp::complex> MsQ2 = mySUSY.msQhat2;
    gslpp::matrix<gslpp::complex> MsU2 = mySUSY.msUhat2;
    gslpp::matrix<gslpp::complex> MsD2 = mySUSY.msDhat2;
    gslpp::matrix<gslpp::complex> MsL2 = mySUSY.msLhat2;
    gslpp::matrix<gslpp::complex> MsE2 = mySUSY.msEhat2;
    gslpp::matrix<gslpp::complex> KU = mySUSY.TUhat.hconjugate() * mySUSY.v2() / sqrt(2.0);
    gslpp::matrix<gslpp::complex> KD = mySUSY.TDhat.hconjugate() * mySUSY.v1() / sqrt(2.0);
    gslpp::matrix<gslpp::complex> KE = mySUSY.TEhat.hconjugate() * mySUSY.v1() / sqrt(2.0);

    /* MFV trilinear couplings */
    gslpp::vector<gslpp::complex> AU(3,0.), AD(3,0.), AE(3,0.);
    for (int i=0; i<3; i++) {
        int p = (int)mySUSY.UP + 2*i;
        AU.assign(i, KU(i,i) / mySUSY.Mq_Q((QCD::quark)p));
        p = (int)mySUSY.DOWN + 2*i;
        AD.assign(i, KD(i,i) / mySUSY.Mq_Q((QCD::quark)p));
        p = (int)mySUSY.ELECTRON + 2*i;
        AE.assign(i, KE(i,i) / mySUSY.Ml_Q((StandardModel::lepton)p));
    }

    /* Check if non-minimal flavor-violating (NMFV) entries exist in the
     * sfermion mass matrices. See also IniFV() in SetFV.F of FeynHiggs. */
    NMFVu = true; NMFVd = true; NMFVe = true;// NMFVnu = true; 
    double TMPu = 0.0, TMPd = 0.0, TMPe = 0.0; //TMPnu = 0.0
    for (int i=0; i<3; i++) {
        for (int j=0; j<3; j++) {
           if (i < j) {
               TMPu += MsQ2(i, j).abs2() + MsU2(i, j).abs2();
               TMPd += MsQ2(i, j).abs2() + MsD2(i, j).abs2();
               //TMPnu += MsL2(i, j).abs2(); /* not used */
               TMPe += MsL2(i, j).abs2() + MsE2(i, j).abs2();
           }
           if (i != j) {
               TMPu += KU(i, j).abs2();
               TMPd += KD(i, j).abs2();
               TMPe += KE(i, j).abs2();
           }
        }
    }
    if (!TMPu) NMFVu = false;
    if (!TMPe) NMFVd = false;
    if (!TMPe) NMFVe = false;

    /* NMFV trilinear couplings. In the case of NMFV, the trilinear couplings
     * AU, AD and AE for FHSetPara() as well as KU, KD and KE for FHSetNMFV()
     * and FHSetLFV() have to be rotated. */
    gslpp::complex muHphase(1.0, - 2.0*muHFH.arg(), true);
    if (NMFVu) AU *= muHphase;
    if (NMFVd) AD *= muHphase;
    if (NMFVe) AE *= muHphase;
    KU *= muHphase;
    KD *= muHphase;
    KE *= muHphase;

    /* NMFV parameters for FeynHiggs */
    gslpp::matrix<gslpp::complex> deltaQLL(3,3,0.);
    gslpp::matrix<gslpp::complex> deltaULR(3,3,0.), deltaURL(3,3,0.), deltaURR(3,3,0.);
    gslpp::matrix<gslpp::complex> deltaDLR(3,3,0.), deltaDRL(3,3,0.), deltaDRR(3,3,0.);
    gslpp::matrix<gslpp::complex> deltaLLL(3,3,0.);
    gslpp::matrix<gslpp::complex> deltaELR(3,3,0.), deltaERL(3,3,0.), deltaERR(3,3,0.);
    for (int i=0; i<3; i++)
        for (int j=0; j<3; j++) {
            deltaQLL.assign(i, j, MsQ2(i,j) / sqrt(MsQ2(i,i).real() * MsQ2(j,j).real()));
            deltaULR.assign(i, j, KU(i,j) / sqrt(MsQ2(i,i).real() * MsU2(j,j).real()));
            deltaURL.assign(i, j, KU(j,i).conjugate() / sqrt(MsU2(i,i).real() * MsQ2(j,j).real()));
            deltaURR.assign(i, j, MsU2(i,j) / sqrt(MsU2(i,i).real() * MsU2(j,j).real()));
            deltaDLR.assign(i, j, KD(i,j) / sqrt(MsQ2(i,i).real() * MsD2(j,j).real()));
            deltaDRL.assign(i, j, KD(j,i).conjugate() / sqrt(MsD2(i,i).real() * MsQ2(j,j).real()));
            deltaDRR.assign(i, j, MsD2(i,j) / sqrt(MsD2(i,i).real() * MsD2(j,j).real()));
            deltaLLL.assign(i, j, MsL2(i,j) / sqrt(MsL2(i,i).real() * MsL2(j,j).real()));
            deltaELR.assign(i, j, KE(i,j) / sqrt(MsL2(i,i).real() * MsE2(j,j).real()));
            deltaERL.assign(i, j, KE(j,i).conjugate() / sqrt(MsE2(i,i).real() * MsL2(j,j).real()));
            deltaERR.assign(i, j, MsE2(i,j) / sqrt(MsE2(i,i).real() * MsE2(j,j).real()));
        }

    /* Set the FeynHiggs parameters, where the GUT relation is used for M1=0. */
    FHSetPara(&err,
              mySUSY.mut/mySUSY.quarks[QCD::TOP].getMass(),
              mySUSY.mtpole, mySUSY.tanb,
              mySUSY.mHptree,  // as now used, "mHptree" is a name for MA0. We shall be using mA instead of mHptree
	      -1, // this is now not used, the mHptree 
              //
              sqrt(MsL2(2,2).real()), sqrt(MsE2(2,2).real()),
              sqrt(MsQ2(2,2).real()), sqrt(MsU2(2,2).real()),
              sqrt(MsD2(2,2).real()),
              sqrt(MsL2(1,1).real()), sqrt(MsE2(1,1).real()),
              sqrt(MsQ2(1,1).real()), sqrt(MsU2(1,1).real()),
              sqrt(MsD2(1,1).real()),
              sqrt(MsL2(0,0).real()), sqrt(MsE2(0,0).real()),
              sqrt(MsQ2(0,0).real()), sqrt(MsU2(0,0).real()),
              sqrt(MsD2(0,0).real()),
              //
              ToComplex2(muHFH.real(), muHFH.imag()),
              //
              ToComplex2(AE(2).real(), AE(2).imag()),
              ToComplex2(AU(2).real(), AU(2).imag()),
              ToComplex2(AD(2).real(), AD(2).imag()),
              ToComplex2(AE(1).real(), AE(1).imag()),
              ToComplex2(AU(1).real(), AU(1).imag()),
              ToComplex2(AD(1).real(), AD(1).imag()),
              ToComplex2(AE(0).real(), AE(0).imag()),
              ToComplex2(AU(0).real(), AU(0).imag()),
              ToComplex2(AD(0).real(), AD(0).imag()),
              //
              ToComplex2(M1FH.real(), M1FH.imag()),
              ToComplex2(M2FH.real(), M2FH.imag()),
              ToComplex2(mySUSY.m3, 0.),
              //
              Q_S, Q_S, Q_S);
    if (err != 0) {
#ifdef FHDEBUG
        std::cout << "FeynHiggsWrapper::SetFeynHiggsPars(): Error has been detected in SetPara.F:"
                  << err << std::endl;
#endif
        return (false);
    }

    /* Set the non-minimal flavor-violating parameters in the squark sector */
    FHSetNMFV(&err,
              // Q_LL
              ToComplex2(deltaQLL(0,1).real(), deltaQLL(0,1).imag()),
              ToComplex2(deltaQLL(1,2).real(), deltaQLL(1,2).imag()),
              ToComplex2(deltaQLL(0,2).real(), deltaQLL(0,2).imag()),
              // U_LR
              ToComplex2(deltaULR(0,1).real(), deltaULR(0,1).imag()),
              ToComplex2(deltaULR(1,2).real(), deltaULR(1,2).imag()),
              ToComplex2(deltaULR(0,2).real(), deltaULR(0,2).imag()),
              // U_RL
              ToComplex2(deltaURL(0,1).real(), deltaURL(0,1).imag()),
              ToComplex2(deltaURL(1,2).real(), deltaURL(1,2).imag()),
              ToComplex2(deltaURL(0,2).real(), deltaURL(0,2).imag()),
              // U_RR
              ToComplex2(deltaURR(0,1).real(), deltaURR(0,1).imag()),
              ToComplex2(deltaURR(1,2).real(), deltaURR(1,2).imag()),
              ToComplex2(deltaURR(0,2).real(), deltaURR(0,2).imag()),
              // D_LR
              ToComplex2(deltaDLR(0,1).real(), deltaDLR(0,1).imag()),
              ToComplex2(deltaDLR(1,2).real(), deltaDLR(1,2).imag()),
              ToComplex2(deltaDLR(0,2).real(), deltaDLR(0,2).imag()),
              // D_RL
              ToComplex2(deltaDRL(0,1).real(), deltaDRL(0,1).imag()),
              ToComplex2(deltaDRL(1,2).real(), deltaDRL(1,2).imag()),
              ToComplex2(deltaDRL(0,2).real(), deltaDRL(0,2).imag()),
              // D_RR
              ToComplex2(deltaDRR(0,1).real(), deltaDRR(0,1).imag()),
              ToComplex2(deltaDRR(1,2).real(), deltaDRR(1,2).imag()),
              ToComplex2(deltaDRR(0,2).real(), deltaDRR(0,2).imag())
              );
    if (err != 0) {
#ifdef FHDEBUG
        std::cout << "FeynHiggsWrapper::SetFeynHiggsPars(): Error was detected in SetFV.F:"
                  << err << std::endl;
#endif
        return (false);
    }

    /* Set the non-minimal flavor-violating parameters in the slepton sector,
     * which are not used to compute the sneutrino mass spectrum. */
    FHSetLFV(&err,
              // L_LL
              ToComplex2(deltaLLL(0,1).real(), deltaLLL(0,1).imag()),
              ToComplex2(deltaLLL(1,2).real(), deltaLLL(1,2).imag()),
              ToComplex2(deltaLLL(0,2).real(), deltaLLL(0,2).imag()),
              // E_LR
              ToComplex2(deltaELR(0,1).real(), deltaELR(0,1).imag()),
              ToComplex2(deltaELR(1,2).real(), deltaELR(1,2).imag()),
              ToComplex2(deltaELR(0,2).real(), deltaELR(0,2).imag()),
              // E_RL
              ToComplex2(deltaERL(0,1).real(), deltaERL(0,1).imag()),
              ToComplex2(deltaERL(1,2).real(), deltaERL(1,2).imag()),
              ToComplex2(deltaERL(0,2).real(), deltaERL(0,2).imag()),
              // E_RR
              ToComplex2(deltaERR(0,1).real(), deltaERR(0,1).imag()),
              ToComplex2(deltaERR(1,2).real(), deltaERR(1,2).imag()),
              ToComplex2(deltaERR(0,2).real(), deltaERR(0,2).imag())
              );
    if (err != 0) {
#ifdef FHDEBUG
        std::cout << "FeynHiggsWrapper::SetFeynHiggsPars(): Error was detected in SetFV.F:"
                  << err << std::endl;
#endif
        return (false);
    }

    computeHiggsCouplings = true;
    computeHiggsProd = true;
    computeConstraints = true;
    computeFlavour = true;

    return (true);
}
Beispiel #21
0
OSStatus	CAAudioUnit::SetAUPreset (CFPropertyListRef &inData)
{
	return AudioUnitSetProperty (AU(), kAudioUnitProperty_ClassInfo,
								kAudioUnitScope_Global, 0,
								&inData, sizeof (CFPropertyListRef));
}
Beispiel #22
0
int    CAAudioUnit::GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt)
{
	// this is the default assumption of an audio effect unit
	Boolean* isWritable = 0;
	UInt32	dataSize = 0;
		// lets see if the unit has any channel restrictions
	OSStatus result = AudioUnitGetPropertyInfo (AU(),
						    kAudioUnitProperty_SupportedNumChannels,
						    kAudioUnitScope_Global, 0,
						    &dataSize, isWritable); //don't care if this is writable

	// if this property is NOT implemented an FX unit
	// is expected to deal with same channel valance in and out

	if (result)
	{
		if (Comp().Desc().IsEffect())
		{
			return 1;
		}
		else if (Comp().Desc().IsGenerator() || Comp().Desc().IsMusicDevice()) {
			// directly query Bus Formats
			// Note that that these may refer to different subBusses
			// (eg. Kick, Snare,.. on a Drummachine)
			// eventually the Bus-Name for each configuration should be exposed
			// for the User to select..

			UInt32 elCountIn, elCountOut;

			if (GetElementCount (kAudioUnitScope_Input, elCountIn)) return -1;
			if (GetElementCount (kAudioUnitScope_Output, elCountOut)) return -1;

			cnt = std::max(elCountIn, elCountOut);

			*chaninfo = (AUChannelInfo*) malloc (sizeof (AUChannelInfo) * cnt);

			for (unsigned int i = 0; i < elCountIn; ++i) {
				UInt32 numChans;
				if (NumberChannels (kAudioUnitScope_Input, i, numChans)) return -1;
				(*chaninfo)[i].inChannels = numChans;
			}
			for (unsigned int i = elCountIn; i < cnt; ++i) {
				(*chaninfo)[i].inChannels = 0;
			}

			for (unsigned int i = 0; i < elCountOut; ++i) {
				UInt32 numChans;
				if (NumberChannels (kAudioUnitScope_Output, i, numChans)) return -1;
				(*chaninfo)[i].outChannels = numChans;
			}
			for (unsigned int i = elCountOut; i < cnt; ++i) {
				(*chaninfo)[i].outChannels = 0;
			}
			return 0;
		}
		else
		{
			// the au should either really tell us about this
			// or we will assume the worst
			return -1;
		}
	}

	*chaninfo = (AUChannelInfo*) malloc (dataSize);
	cnt = dataSize / sizeof (AUChannelInfo);

	result = GetProperty (kAudioUnitProperty_SupportedNumChannels,
			      kAudioUnitScope_Global, 0,
			      *chaninfo, &dataSize);

	if (result) { return -1; }
	return 0;
}