import timeit
import numpy as np
import tt
from tt.riemannian import riemannian

matrix = tt.matrix(tt.rand(100, 10, 10))
vec = tt.matrix(tt.rand(10, 10, 10), n=[10] * 10, m=[1] * 10)
vec_100 = tt.matrix(tt.rand(10, 10, 100), n=[10] * 10, m=[1] * 10)
tens = np.random.randn(10, 10, 10, 10)
globals = {'matrix': matrix, 'vec': vec, 'vec_100': vec_100, 'tens': tens,
           'tt': tt, 'riemannian': riemannian}
logs = {}

matvec_time = timeit.timeit("matrix * vec", globals=globals, number=1000) / 1000
print('Multiplying a matrix by a vector takes %f seconds.' % matvec_time)
logs['matvec_time'] = matvec_time

norm_time = timeit.timeit("tt.tensor.norm(matrix.tt)", globals=globals,
                          number=1000) / 1000
print('Computing the norm of a matrix takes %f seconds.' % norm_time)
logs['norm_time'] = norm_time

# Time for a Gram matrix of size 100 x 100.
gram_time = 100 * 100 * timeit.timeit("tt.dot(vec.tt, vec.tt)", globals=globals,
                          number=1000) / 1000
print('Computing the Gram matrix of size 100 x 100 takes %f seconds.' % gram_time)
logs['gram_time'] = gram_time

# Time for a Gram matrix x A x of size 100 x 100.
mat_gram_time = 100 * 100 * timeit.timeit("tt.dot(vec.tt, (matrix * vec).tt)",
                                      globals=globals, number=100) / 100
print('Computing the Gram matrix x A x of size 100 x 100 takes %f seconds.' % mat_gram_time)
logs['mat_gram_time'] = mat_gram_time


# tt_svd_time = timeit.timeit("tt.vector(tens)", globals=globals,
#                             number=1000) / 1000
# print('TT-SVD for tensor of shape %s takes %f seconds.' % (tens.shape,
#                                                            tt_svd_time))
# logs['tt_svd_time'] = tt_svd_time

project_time = timeit.timeit("riemannian.project(vec.tt, vec_100.tt)", globals=globals,
                             number=1000) / 1000
print('Projecting a vector of rank 100 on a vector of rank 10 takes %f seconds.' % project_time)
logs['project_time'] = project_time

round_time = timeit.timeit("tt.tensor.round(vec_100.tt, rmax=10)", globals=globals,
                             number=1000) / 1000
print('Rounding a vector of rank 100 to rank 10 takes %f seconds.' % round_time)
logs['round_time'] = round_time
@@ -409,16 +409,17 @@
 an%7D%0A
+%0A
 logs = %7B
 %7D%0A%0Am
@@ -414,16 +414,29 @@
 logs = %7B
+'lib': 'ttpy'
 %7D%0A%0Amatve
@@ -620,16 +620,212 @@
 c_time%0A%0A
+matmul_time = timeit.timeit(%22matrix * matrix%22, globals=globals, number=1000) / 1000%0Aprint('Multiplying %25a matrix by a matrix takes %25f seconds.' %25 (matmul_time))%0Alogs%5B'matmul_time'%5D = matmul_time%0A%0A
 norm_tim
@@ -1655,18 +1655,16 @@
 _time%0A%0A%0A
-# 
 tt_svd_t
@@ -1719,18 +1719,16 @@
 lobals,%0A
-# 
         
@@ -1767,18 +1767,16 @@
  / 1000%0A
-# 
 print('T
@@ -1838,18 +1838,16 @@
 .shape,%0A
-# 
         
@@ -1911,18 +1911,16 @@
 _time))%0A
-# 
 logs%5B'tt
@@ -2272,16 +2272,25 @@
 _100.tt,
+ eps=0.0,
  rmax=10
@@ -2436,24 +2436,24 @@
 round_time)%0A
-
 logs%5B'round_
@@ -2463,16 +2463,17 @@
 e'%5D = round_time
+%0A

Add matmul and NITs