void	equalizer_base::getEq (int16_t s, DSPCOMPLEX *outVec) {
int16_t	carrier;

	for (carrier = Kmin (Mode, Spectrum);
	     carrier <= Kmax (Mode, Spectrum); carrier ++) 
	   outVec [indexFor (carrier)] =
	              refFrame [s][indexFor (carrier)];
}
		equalizer_base::equalizer_base (uint8_t Mode,
	                                        uint8_t Spectrum) {
int16_t	i;
	this	-> Mode		= Mode;
	this	-> Spectrum	= Spectrum;
	this	-> K_min	= Kmin (Mode, Spectrum);
	this	-> K_max	= Kmax (Mode, Spectrum);
	this	-> symbolsinFrame	= symbolsperFrame (Mode);
	this	-> carriersinSymbol	= Kmax (Mode, Spectrum) -
	                                  Kmin (Mode, Spectrum) + 1;
	
	init_gain_ref_cells ();
	this	-> refFrame	= new DSPCOMPLEX *[symbolsinFrame];
	for (i = 0; i < symbolsinFrame; i ++)
	   refFrame [i] = new DSPCOMPLEX [carriersinSymbol];
	this	-> testFrame	= new DSPCOMPLEX *[symbolsinFrame];
	for (i = 0; i < symbolsinFrame; i ++)
	   testFrame [i] = new DSPCOMPLEX [carriersinSymbol];
}
//
//	We create a single "estimator" for each of the symbols
//	of a frame.
//
	estimatorBase::estimatorBase (DSPCOMPLEX 	**refFrame,
	                              uint8_t	Mode,
	                              uint8_t	Spectrum,
	                              int16_t	refSymbol) {
	this	-> refFrame	= refFrame;
	this	-> Mode		= Mode;
	this	-> Spectrum	= Spectrum;
	this	-> refSymbol	= refSymbol;
	this	-> K_min	= Kmin (Mode, Spectrum);
	this	-> K_max	= Kmax (Mode, Spectrum);
}
Beispiel #4
0
    /**
       @brief computes jk fock matrix operator
       @param basis basis handle
       @param D density matrix
       @param F fock matrix
    */
    void hf_fockjk(const Integer *basis_handle, const double *D, double *F,
		   const double *screen, const double *tolerance) {
	const Basis &basis = *Basis_find_object(*basis_handle);

	int N = basis.numShells();
	//int N2 = binomial2 (N);
	int n = basis.numFunctions();
	int n2 = binomial2 (n);

	//copy packed symmetric matrix to square matrix
	//const Matrix tmp = SymmetricAdapter(n, ShallowAdapter(n2, const_cast<double*>(D)));
	//Matrix screen2 = SymmetricAdapter(N, ShallowAdapter(N2, const_cast<double*>(screen)));

	typedef matrix::symmetric_adapter<double> symmetric;
	typedef matrix::const_symmetric_adapter<double> const_symmetric;
	typedef matrix::block_meta_matrix<BlockMatrix> MetaMatrix;
	typedef MetaMatrix::size_vector size_vector;

	size_vector block_sizes, shell_sizes, matrix_sizes;
	foreach (const Basis::Block& block, basis.blocks()) {
	    shell_sizes.push_back(block.shell().size());
	    block_sizes.push_back(block.size());
	    matrix_sizes.push_back(shell_sizes.back()*block_sizes.back());
	}
	const size_vector matrix_dims[] = { matrix_sizes, matrix_sizes };
	const size_vector matrix_block_dims[] = { shell_sizes, shell_sizes };
	MetaMatrix D_(matrix_dims, matrix_block_dims);
	MetaMatrix F_(matrix_dims, matrix_block_dims);

	// matrix::meta_matrix<Matrix> Dmax(block_sizes);//, Kmax(block_sizes);
	Matrix Dmax(N, N);

	// Matrix K_(N,N);
	// typedef matrix::meta_matrix<Matrix> meta_matrix;
	// // matrix::meta_matrix_decorator<Matrix, Matrix> Kmax(block_sizes, K_);
	// matrix::meta_matrix<Matrix> Kmax(block_sizes);
	// Kmax = K_;
	Matrix Kmax(N, N);

	typedef matrix::permutation<int> P;
	matrix::const_symmetric_adapter<double>  screen_adapter(screen,N);
	matrix::assign(Kmax, P(basis.shell_permutations())(screen_adapter));

	P Pf(basis.function_permutations());

	const matrix::const_symmetric_adapter<double> D_adapter(D,n);
	D_ = Pf(D_adapter);
	hf::Dmax(basis, D_, Dmax);
	basis.normalize(D_);

	//matrix::zero(F_);
	F_ = 0;

	//matrix::meta_matrix_decorator<BlockMatrix, MetaMatrix&> d(dims, dims, D_, 6);

	//double cutoff = 1.0e-15;
	double cutoff = *tolerance;
	hf::fock(basis, D_, F_, &Kmax, &Dmax, cutoff);
	//hf::fock(basis, d, F_, &Kmax, &Dmax, cutoff);
	basis.normalize(F_);

	//copy square symmetric matrix to packed upper
	SymmetricAdapter Fsymm(n, ShallowAdapter(n2, F));

	matrix::symmetric_adapter<double> F_adapter(F,n);
	Pf(F_adapter) = F_;

     }