private void computeCCATwoStepLRvsWNGrams(SparseDoubleMatrix2D wtl,
			SparseDoubleMatrix2D wtr, SparseDoubleMatrix2D ltw,
			SparseDoubleMatrix2D rtw,SparseDoubleMatrix2D wtw,
			SparseDoubleMatrix2D l1l2_OR_R1R2_L1R1, SparseDoubleMatrix2D l1l2_OR_R1R2_L1R1T, SparseDoubleMatrix2D l1l3_OR_R1R3_L1R2, SparseDoubleMatrix2D l1l3_OR_R1R3_L1R2T, SparseDoubleMatrix2D l1l4_OR_R1R4_L2R1, SparseDoubleMatrix2D l1l4_OR_R1R4_L2R1T, SparseDoubleMatrix2D l2l3_OR_R2R3_L2R2, SparseDoubleMatrix2D l2l3_OR_R2R3_L2R2T, SparseDoubleMatrix2D l2l4_OR_R2R4_L1L2, SparseDoubleMatrix2D l2l4_OR_R2R4_L1L2T, SparseDoubleMatrix2D l3l4_OR_R3R4_R1R2, SparseDoubleMatrix2D l3l4_OR_R3R4_R1R2T, SVDTemplates svdTC,ContextPCANGramsRepresentation _cpcaR2,int dim1,int dim2) {
		
		
		SparseDoubleMatrix2D wtlphiL=new SparseDoubleMatrix2D(wtl.rows(),_opt.hiddenStateSize,0,0.7,0.75);
		SparseDoubleMatrix2D wtrphiR=new SparseDoubleMatrix2D(wtr.rows(),_opt.hiddenStateSize,0,0.7,0.75);
		SparseDoubleMatrix2D ltwphiLT=new SparseDoubleMatrix2D(_opt.hiddenStateSize,wtl.rows(),0,0.7,0.75);
		SparseDoubleMatrix2D rtwphiRT=new SparseDoubleMatrix2D(_opt.hiddenStateSize,wtr.rows(),0,0.7,0.75);
		SparseDoubleMatrix2D wtLphiLRphiR=new SparseDoubleMatrix2D(wtl.rows(),wtlphiL.columns()+wtrphiR.columns(),0,0.7,0.75);
		SparseDoubleMatrix2D wtLphiLRphiRT=new SparseDoubleMatrix2D(wtlphiL.columns()+wtrphiR.columns(),wtl.rows(),0,0.7,0.75);
				
		
		if(_opt.numGrams==3){
			computeCCA2NGramsLR(l1l2_OR_R1R2_L1R1,l1l2_OR_R1R2_L1R1T,wtw,svdTC,_cpcaR2);
		}
		
		
		
		if(_opt.numGrams==5){
			computeCCA2NGramsLR(l1l2_OR_R1R2_L1R1,l1l2_OR_R1R2_L1R1T,l1l3_OR_R1R3_L1R2,l1l3_OR_R1R3_L1R2T,l1l4_OR_R1R4_L2R1,l1l4_OR_R1R4_L2R1T,l2l3_OR_R2R3_L2R2,l2l3_OR_R2R3_L2R2T,
					l2l4_OR_R2R4_L1L2,l2l4_OR_R2R4_L1L2T,l3l4_OR_R3R4_R1R2,l3l4_OR_R3R4_R1R2T,wtw,svdTC,_cpcaR2);
		}
		
		wtl.zMult(MatrixFormatConversion.createDenseMatrixCOLT(phiL), wtlphiL);
		wtr.zMult(MatrixFormatConversion.createDenseMatrixCOLT(phiR), wtrphiR);
		
		phiLT=phiL.transpose();
		phiRT=phiR.transpose();
		
		MatrixFormatConversion.createDenseMatrixCOLT(phiLT).zMult(ltw, ltwphiLT);
		MatrixFormatConversion.createDenseMatrixCOLT(phiRT).zMult(rtw, rtwphiRT);
		
		wtLphiLRphiR=_cpcaR2.concatenateLR(wtlphiL,wtrphiR);
		wtLphiLRphiRT=_cpcaR2.concatenateLRT(ltwphiLT,rtwphiRT);
		
		if(_opt.numGrams==3){
			computeCCA2NGrams( wtw,wtLphiLRphiR,wtLphiLRphiRT,l1l2_OR_R1R2_L1R1, l1l2_OR_R1R2_L1R1T,svdTC,_cpcaR2,wtLphiLRphiR.rows(),wtLphiLRphiRT.rows());
		}
		if(_opt.numGrams==5){
			computeCCA2NGrams(wtw,wtLphiLRphiR,wtLphiLRphiRT,l1l2_OR_R1R2_L1R1,l1l2_OR_R1R2_L1R1T
					,l1l3_OR_R1R3_L1R2,l1l3_OR_R1R3_L1R2T,l1l4_OR_R1R4_L2R1,l1l4_OR_R1R4_L2R1T,l2l3_OR_R2R3_L2R2,l2l3_OR_R2R3_L2R2T,
					l2l4_OR_R2R4_L1L2,l2l4_OR_R2R4_L1L2T,l3l4_OR_R3R4_R1R2,l3l4_OR_R3R4_R1R2T,svdTC,_cpcaR2,wtLphiLRphiR.rows(),wtLphiLRphiRT.rows());
			
		}
	}