 #endif
 		}
 	//	statetmp = m_multiplyblockdiag(MatrixA_pow,state,2);
-		MatrixMultiplyKernel<<<dimGridA, dimBlockA>>>(dMatrixA_pow, dstate, dstate);
+		MatrixMultiplyKernel<<<dimGridA, dimBlockA>>>(dMatrixA_pow, dstate1, dstate2);
+		dstatetmp = dstate1;
+		dstate1 = dstate2;
+		dstate2 = dstate1;
 	//	state = statetmp;
 		i = i + blocksize;
 	}
+
+
+//	m_print(MatrixA_pow);
 
 	SF_INFO info;
 	info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;

	CUDA_SAFE_CALL(cudaMalloc((void**) &dblock_samples.elements, m_size(block_samples)));
	CUDA_SAFE_CALL(cudaMemcpy(dblock_samples.elements,block_samples.elements, m_size(block_samples), cudaMemcpyHostToDevice));

	CUDA_SAFE_CALL(cudaMalloc((void**) &dstate.elements, m_size(state)));
	CUDA_SAFE_CALL(cudaMemcpy(dstate.elements,state.elements, m_size(state), cudaMemcpyHostToDevice));

	dim3 dimBlockCA(1, 2);
	dim3 dimGridCA(block_CA.cols / dimBlockCA.x, block_CA.rows / dimBlockCA.y);

	dim3 dimBlockA(2, 2);
	dim3 dimGridA(MatrixA_pow.cols / dimBlockA.x, MatrixA_pow.rows / dimBlockA.y);

	for(i = 0; i < samples;) {
	//	block_samples = m_multiply(block_CA,state);
		MatrixMultiplyKernel<<<dimGridCA, dimBlockCA>>>(dblock_CA, dstate, dblock_samples);

#if DEBUG == 4
		m_print(MatrixA_pow);


	sample = (float *) malloc(sizeof(float) * samples);
	blocksize = 100;

	dblock_CA = m_new(blocksize, MatrixA.cols);
	dblock_samples = m_new(blocksize,1);
	dMatrixA_pow = m_new(MatrixA.rows, MatrixA.cols); // BLOCKDIAGMATRIX
	dstate1 = m_new(2 * filters, 1);
	dstate2 = m_new(2 * filters, 1);

	block_CA = m_new(blocksize, MatrixA.cols);
	block_samples = m_new(blocksize,1);
