@Override
	public SufficientStatistics clone() {
		
		SufficientStatistics newStats = new SufficientStatistics();
		if( !this.isSet())
			return newStats;
		
		if( this.Mxx == null) {
			newStats.Px = new double[this.Px.length][this.Px[0].length][this.Px[0][0].length];
			newStats.counts = new double[this.counts.length];
			
			for(int pE = 0; pE < this.Px.length; ++pE) {
				newStats.counts[pE] = this.counts[pE];
				for(int fS = 0; fS < this.Px[0].length; ++fS)
					for(int sS = 0; sS < this.Px[0][0].length; ++sS)
						newStats.Px[pE][fS][sS] = this.Px[pE][fS][sS];
			}			
		}else {
			newStats.Mxx = new double[this.Mxx.length][this.Mxx[0].length][this.Mxx[0][0].length];
			newStats.Mx = new double[this.Mx.length][this.Mx[0].length];
			newStats.Tx = new double[this.Tx.length][this.Tx[0].length];
			
			for(int pE = 0; pE < this.Mxx.length; ++pE)
				for(int fS = 0; fS < this.Mxx[0].length; ++fS) {
					newStats.Tx[pE][fS] = this.Tx[pE][fS];
					newStats.Mx[pE][fS] = this.Mx[pE][fS];
					for(int sS = 0; sS < this.Mxx[0][0].length; ++sS)
						newStats.Mxx[pE][fS][sS] = this.Mxx[pE][fS][sS];
				}	
		}
		
		return newStats;
	}