 #endif
 
 	MatrixCA = m_new(blocksize, MatrixA.cols);
-	output_chunk = m_new(blocksize,1);
+	output_chunk_read = m_new(blocksize,1);
+	output_chunk_write = m_new(blocksize,1);
 	MatrixAp = m_new(MatrixA.rows, MatrixA.cols); // BLOCKDIAGMATRIX
 	m_identity(MatrixAp);
 

	blocksize = 100;

#if MODE == 1
	Matrix device_MatrixAp, device_MatrixCA, device_state_read, device_state_write, device_state_tmp, device_output_chunk_read, device_output_chunk_write, device_tmp_output_chunk;

	device_MatrixCA = m_new(blocksize, MatrixA.cols);
	device_output_chunk_read = m_new(blocksize,1);


	dim3 dimBlockA(1, 1);
	dim3 dimGridA(state.cols / dimBlockA.x, MatrixAp.rows / dimBlockA.y);

	MatrixMultiplyKernel<<<dimGridCA, dimBlockCA, 1, streams[0]>>>(device_MatrixCA, device_state_read, device_output_chunk_write);
	MatrixMultiplyKernel<<<dimGridA, dimBlockA, 1, streams[1]>>>(device_MatrixAp, device_state_read, device_state_write);
#else
	Matrix state_tmp;
#endif
