 #endif
 		}
 	//	tmp_state = m_multiplyblockdiag(MatrixAp,state,2);
-		MatrixMultiplyKernel<<<dimGridA, dimBlockA>>>(dMatrixAp, dstate1, dstate2);
-		dtmp_state = dstate1;
-		dstate1 = dstate2;
-		dstate2 = dtmp_state;
+		MatrixMultiplyKernel<<<dimGridA, dimBlockA>>>(device_MatrixAp, device_state1, device_state2);
+		device_tmp_state = device_state1;
+		device_state1 = device_state2;
+		device_state2 = device_tmp_state;
 	//	state = tmp_state;
 		i = i + blocksize;
 	}

#endif
	
		cudaDeviceSynchronize();	
		cudaMemcpy(block_samples.elements, dblock_samples.elements, m_size(block_samples), cudaMemcpyDeviceToHost);

		//printf("%d\n", i);


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

	device_block_CA = m_new(blocksize, MatrixA.cols);
	device_block_samples = m_new(blocksize,1);
	device_MatrixAp = m_new(MatrixA.rows, MatrixA.cols); // BLOCKDIAGMATRIX
	device_state1 = m_new(2 * filters, 1);
	device_state2 = m_new(2 * filters, 1);

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