public Matrix right_smooth(Matrix eigenFeatDict, ArrayList<Integer> doc){
		double[][] R=new double[doc.size()][_smooths.size()*_num_hidden];
		double[][] smoothedStateofToken=new double[1][_smooths.size()*_num_hidden];
		double[][] smoothedStateofTokenCopy=new double[1][_smooths.size()*_num_hidden];
		Matrix RMatrix= new Matrix(R); 
		Matrix smoothedStateofTokenMatrix; 
		int counter=doc.size()-2;//See exponential smoothing definition. s0=0, s1=x0 etc.
		//Iterator<Token> tok_iter= doc.ReverseIterator();
		
		while(counter>=0){
			
			//Token tok=doc.get(counter);
			//assert counter== tok.getidx();
		
			if (counter==doc.size()-2){
				smoothedStateofTokenCopy=getStateforToken(eigenFeatDict,doc.get(counter+1));
				for (int idx=0; idx<_smooths.size();idx++){
					for (int k=0;k<_num_hidden;k++)
						smoothedStateofToken[0][idx*_num_hidden+k]= smoothedStateofTokenCopy[0][k];
				}
				smoothedStateofTokenMatrix= new Matrix(smoothedStateofToken); //s1=x0
			}
			else{
				smoothedStateofToken=getNextStateSmoothed(smoothedStateofToken,getStateforToken(eigenFeatDict,doc.get(counter+1)));
				smoothedStateofTokenMatrix= new Matrix(smoothedStateofToken); 
			}
			
			RMatrix.setMatrix(counter, counter, 0, RMatrix.getColumnDimension()-1, smoothedStateofTokenMatrix);
			counter--;
			
			
		}
		
		return RMatrix;
	}