code: public BlockOrder setBlockOrder(BlockOrder order) {
  		verifyTrue(order != null, "block order cannot be null");
  
  		if (order == layout.blockOrder) {
  			return order; // quick exit, already same
  		}
  
  		BlockMatrixLayout newLayout = new BlockMatrixLayout(layout.rows, layout.columns,
  				layout.blockStripe, order);
  
  		// swap order of each block
  		for (int r = 0; r < layout.rows; r += layout.blockStripe) {
  			for (int c = 0; c < layout.columns; c += layout.blockStripe) {
  
  				int blockNumber = layout.getBlockNumber(r, c);
  				if (data[blockNumber] == null) {
  					continue;
  				} else if (order == BlockOrder.ROWMAJOR) {
  					data[blockNumber] = layout.toRowMajorBlock(data[blockNumber], r, c);
  				} else {
  					data[blockNumber] = layout.toColMajorBlock(data[blockNumber], r, c);
  				}
  
  			}
  		}
  
  		BlockOrder oldLayout = this.layout.blockOrder;
  		this.layout = newLayout;
  		return oldLayout;
  
  	}
docs: Change layout of blocks in this matrix (e.g. switch form rowmajor to
  columnmajor).
  
  @param order
  - new block layout order.
  @return old BlockOrder.