# Path: examples/lowRankTensorApproximations/fig_pars.py
# def set_labels():
#     lines={'Gafull': 'bo-',
#            'GaNifull': '--',
#            'Gacano': 'bx-',
#            'Gatucker': 'ro-',
#            'Gatt': 'kv-',
# 
#            'GaSparse': 'rx-',
#            'GaSparse_2': 'ro-',
#            'GaSparse_3': 'r<-',
#            'GaSparse_4': 'r*-',
#            'GaSparse_5': 'rd-',
#            'GaSparse_6': 'rv-',
#            'GaSparse_7': 'r^-',
# 
#            'full': '--',
#            'mem_cano':   ['bx--','bo--','bx--','bv--','bo--','bx--','b<--'],
#            'mem_tucker': ['rx--', 'ro--', 'rx--', 'rv--', 'ro--', 'rx--', 'r<--'],
#            'mem_tt':     ['kx-', 'ko-', 'kx--', 'kv--', 'ko--', 'kx--', 'k<--'],
# 
#            'Ga_cano': ['bx-', 'bo-', 'bx-', 'bv-', 'bo-', 'bx-', 'b<-'],
#            'Ga_tucker': ['rx-', 'ro-', 'rx-', 'rv-', 'ro-', 'rx-', 'r<-'],
#            'Ga_tt': ['kx-', 'ko-','kx--', 'kv-', 'ko-', 'kx-', 'k<-'],
# 
#            'GaNi_cano': ['bx--', 'bo--', 'bx--', 'bv--', 'bo--', 'bx--', 'b<--'],
#            'GaNi_tucker': ['rx--', 'ro--', 'rx--', 'rv--', 'ro--', 'rx--', 'r<--'],
#            'GaNi_tt': ['kx--', 'ko--', 'kx--', 'kv--', 'ko--', 'kx--', 'k<--'],
# 
# 
#            'Ga': ['-','x-','<-','|-','^-','x-','o-', '<-', 'v-','^-','d-',],
#            'GaNi': ['--', 'x--', '<--', '|--', '^--', 'x--', 'o--', '<--', 'v--', '^--', 'd--'],
# 
#            }
# 
#     labels = {'full': 'Full',
#               'tensorsLowRank': 'Sparse',
#               'Gafull': 'Ga Full',
#               'Gacano': 'Ga CP',
#               'Gatucker': 'Ga Tucker',
#               'Gatt': 'Ga TT',
# 
#               'Garank': 'Solution rank',
#               'GaNirank': 'Solution rank',
# 
#               'GaNifull': 'GaNi Full',
# 
#               'GaNicano': 'GaNi CP',
#               'GaNicanoN': 'Cano N=',
# 
#               'GaNitucker': 'GaNi Tucker',
#               'GaNituckerN': 'Tucker N=',
# 
#               'GaNitt': 'GaNi TT',
#               'GaNittN': 'TT N=',
#               }
#     return lines, labels
# 
# def set_pars(mpl):
#     mpl.rcParams['text.latex.preamble'] = [r"\usepackage{amsmath,bm,amsfonts}"]
#     params={'text.usetex': True,
#             'font.family': 'serif',
#             'font.size': 12,
#             'legend.fontsize': 10,
#             }
#     mpl.rcParams.update(params)
#     fig_par={'dpi': 1000,
#              'facecolor': 'w',
#              'edgecolor': 'k',
#              'figsize': (4, 3),
#              'figsize3D': (4, 4),
#              'pad_inches': 0.02,
#              }
# 
#     return fig_par


import pickle
import matplotlib as mpl
import matplotlib.pyplot as plt
import os
from examples.lowRankTensorApproximations.fig_pars import set_labels, set_pars
                             markeredgewidth=1, markerfacecolor='None')

            ax = plt.gca()
            plt.xlabel(xlabel)
            ax.set_xlim([0, xlimend])
            plt.xticks(sol_rank_range)
            ax.set_ylim(ylimit)
            plt.ylabel(ylabel)

            plt.legend(loc='best')
            fname=src+'Error_dim{}_mat{}_{}_N{}{}'.format(dim, material, solver, N, '.pdf')
            print(('create figure: {}'.format(fname)))
            plt.savefig(fname, dpi=parf['dpi'], pad_inches=parf['pad_inches'], bbox_inches='tight')
        print('END plot errors 3D')
        ##### END: figure 1 resiguum(solution rank) ###########


def plot_memory():
    material_list, sol_rank_range_set, kinds, Ns, kind_list, solver = load_experiment_settings()
    xlabel = 'rank of solution'
    ylabel = 'memory efficiency'
    if not os.path.exists('figures'):
        os.makedirs('figures')
    for dim in [2]:
        sol_rank_range = sol_rank_range_set['{}'.format(dim)]
        N = max(Ns['{}'.format(dim)])
        xlimend = max(sol_rank_range_set['{}'.format(dim)])
        ##### BEGIN: figure 2 Memory efficiency ###########
        for material in material_list:


# Path: examples/lowRankTensorApproximations/fig_pars.py
# def set_labels():
#     lines={'Gafull': 'bo-',
#            'GaNifull': '--',
#            'Gacano': 'bx-',
#            'Gatucker': 'ro-',
#            'Gatt': 'kv-',
# 
#            'GaSparse': 'rx-',
#            'GaSparse_2': 'ro-',
#            'GaSparse_3': 'r<-',
#            'GaSparse_4': 'r*-',
#            'GaSparse_5': 'rd-',
#            'GaSparse_6': 'rv-',
#            'GaSparse_7': 'r^-',
# 
#            'full': '--',
#            'mem_cano':   ['bx--','bo--','bx--','bv--','bo--','bx--','b<--'],
#            'mem_tucker': ['rx--', 'ro--', 'rx--', 'rv--', 'ro--', 'rx--', 'r<--'],
#            'mem_tt':     ['kx-', 'ko-', 'kx--', 'kv--', 'ko--', 'kx--', 'k<--'],
# 
#            'Ga_cano': ['bx-', 'bo-', 'bx-', 'bv-', 'bo-', 'bx-', 'b<-'],
#            'Ga_tucker': ['rx-', 'ro-', 'rx-', 'rv-', 'ro-', 'rx-', 'r<-'],
#            'Ga_tt': ['kx-', 'ko-','kx--', 'kv-', 'ko-', 'kx-', 'k<-'],
# 
#            'GaNi_cano': ['bx--', 'bo--', 'bx--', 'bv--', 'bo--', 'bx--', 'b<--'],
#            'GaNi_tucker': ['rx--', 'ro--', 'rx--', 'rv--', 'ro--', 'rx--', 'r<--'],
#            'GaNi_tt': ['kx--', 'ko--', 'kx--', 'kv--', 'ko--', 'kx--', 'k<--'],
# 
# 
#            'Ga': ['-','x-','<-','|-','^-','x-','o-', '<-', 'v-','^-','d-',],
#            'GaNi': ['--', 'x--', '<--', '|--', '^--', 'x--', 'o--', '<--', 'v--', '^--', 'd--'],
# 
#            }
# 
#     labels = {'full': 'Full',
#               'tensorsLowRank': 'Sparse',
#               'Gafull': 'Ga Full',
#               'Gacano': 'Ga CP',
#               'Gatucker': 'Ga Tucker',
#               'Gatt': 'Ga TT',
# 
#               'Garank': 'Solution rank',
#               'GaNirank': 'Solution rank',
# 
#               'GaNifull': 'GaNi Full',
# 
#               'GaNicano': 'GaNi CP',
#               'GaNicanoN': 'Cano N=',
# 
#               'GaNitucker': 'GaNi Tucker',
#               'GaNituckerN': 'Tucker N=',
# 
#               'GaNitt': 'GaNi TT',
#               'GaNittN': 'TT N=',
#               }
#     return lines, labels
# 
# def set_pars(mpl):
#     mpl.rcParams['text.latex.preamble'] = [r"\usepackage{amsmath,bm,amsfonts}"]
#     params={'text.usetex': True,
#             'font.family': 'serif',
#             'font.size': 12,
#             'legend.fontsize': 10,
#             }
#     mpl.rcParams.update(params)
#     fig_par={'dpi': 1000,
#              'facecolor': 'w',
#              'edgecolor': 'k',
#              'figsize': (4, 3),
#              'figsize3D': (4, 4),
#              'pad_inches': 0.02,
#              }
# 
#     return fig_par


# Path: examples/lowRankTensorApproximations/plots.py
import pickle
import matplotlib as mpl
import matplotlib.pyplot as plt
import os
from examples.lowRankTensorApproximations.fig_pars import set_labels, set_pars

                             markeredgewidth=1, markerfacecolor='None')

            ax = plt.gca()
            plt.xlabel(xlabel)
            ax.set_xlim([0, xlimend])
            plt.xticks(sol_rank_range)
            ax.set_ylim(ylimit)
            plt.ylabel(ylabel)

            plt.legend(loc='best')
            fname=src+'Error_dim{}_mat{}_{}_N{}{}'.format(dim, material, solver, N, '.pdf')
            print(('create figure: {}'.format(fname)))
            plt.savefig(fname, dpi=parf['dpi'], pad_inches=parf['pad_inches'], bbox_inches='tight')
        print('END plot errors 3D')
        ##### END: figure 1 resiguum(solution rank) ###########


def plot_memory():
    material_list, sol_rank_range_set, kinds, Ns, kind_list, solver = load_experiment_settings()
    xlabel = 'rank of solution'
    ylabel = 'memory efficiency'
    if not os.path.exists('figures'):
        os.makedirs('figures')
    for dim in [2]:
        sol_rank_range = sol_rank_range_set['{}'.format(dim)]
        N = max(Ns['{}'.format(dim)])
        xlimend = max(sol_rank_range_set['{}'.format(dim)])
        ##### BEGIN: figure 2 Memory efficiency ###########
        for material in material_list:


            parf = set_pars(mpl)