def test_matrix_norm(self):
        """Compute matrix norm of forward/backward projector using power
        norm. """

        geom = Geometry(2)
        proj_vec = Rn(geom.proj_size).element(1)

        # Compute norm for simple least squares
        cp = ODLChambollePock(geom, proj_vec)
        self.assertEqual(cp.adj_scal_fac, 1)
        mat_norm0 = cp.matrix_norm(iterations=4,
                                   vol_init=1,
                                   intermediate_results=True)
        self.assertTrue(mat_norm0[-1] > 0)

        # Resume computation
        mat_norm1, vol = cp.matrix_norm(iterations=3,
                                        vol_init=1, intermediate_results=True,
                                        return_volume=True)
        mat_norm2 = cp.matrix_norm(iterations=4, vol_init=vol,
                                   intermediate_results=True)
        self.assertNotEqual(mat_norm0[0], mat_norm2[0])

        self.assertEqual(mat_norm0[3], mat_norm2[0])

        # Compute norm for TV
        mat_norm3 = cp.matrix_norm(iterations=4, vol_init=1, tv_norm=True,
                                   intermediate_results=True)

        self.assertFalse(np.array_equal(mat_norm2, mat_norm3))
        print('LS unit init volume:', mat_norm2)
        print('TV unit init volume:', mat_norm3)

        # Use non-homogeneous initial volume
        v0 = np.random.rand(geom.vol_size)
        mat_norm4 = cp.matrix_norm(iterations=4, vol_init=v0, tv_norm=False,
                                   intermediate_results=True)
        mat_norm5 = cp.matrix_norm(iterations=4, vol_init=v0, tv_norm=True,
                                   intermediate_results=True)
        print('LS random init volume:', mat_norm4)
        print('TV random init volume:', mat_norm5)

        # test with adjoint scaling factor for backprojector
        self.assertEqual(cp.adj_scal_fac, 1)
        cp.adjoint_scaling_factor()
        self.assertFalse(cp.adj_scal_fac == 1)
        print('adjoint scaling factor:', cp.adj_scal_fac)

        mat_norm6 = cp.matrix_norm(iterations=4, vol_init=1, tv_norm=False,
                                   intermediate_results=True)
        mat_norm7 = cp.matrix_norm(iterations=4, vol_init=1, tv_norm=True,
                                   intermediate_results=True)

        print('LS init volume, adjoint rescaled:', mat_norm6)
        print('TV init volume, adjoint rescaled:', mat_norm7)