repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
prophesy
prophesy-master/prophesy/input/samplefile.py
import logging from prophesy.data.samples import InstantiationResultDict, ParameterInstantiation, InstantiationResultFlag from prophesy.adapter.pycarl import Rational from prophesy.data.point import Point logger = logging.getLogger(__name__) def read_samples_file(path, parameters): """ Reads sample files. ...
3,648
40.942529
132
py
prophesy
prophesy-master/prophesy/input/pctlfile.py
from prophesy.util import check_filepath_for_reading from prophesy.data.property import Property class PctlFile: """ Wrapper for pctl files, which contain a list of pctl formulae """ def __init__(self, location): check_filepath_for_reading(location) self.location = location self...
972
31.433333
134
py
prophesy
prophesy-master/prophesy/input/__init__.py
# intentionally left blank
27
13
26
py
prophesy
prophesy-master/prophesy/input/modelfile.py
import os import re import shutil import tempfile import logging from prophesy.config import configuration from prophesy.util import ensure_dir_exists, check_filepath_for_reading from prophesy.data.parameter import ParameterOrder, Parameter from prophesy.data.model_type import ModelType, model_is_nondeterministic from...
6,597
36.91954
129
py
prophesy
prophesy-master/prophesy_web/application.py
import os from prophesy.modelcheckers.prism import PrismModelChecker from prophesy.data.point import Point from prophesy.data.samples import ParameterInstantiation, InstantiationResultDict from prophesy.regions.region_solutionfunctionchecker import SolutionFunctionRegionChecker from prophesy.regions.region_checker impo...
34,164
36.668137
188
py
prophesy
prophesy-master/prophesy_web/config.py
import os import subprocess from prophesy.util import Configuration class WebConfig(Configuration): # Sections DIRECTORIES = "directories" def __init__(self): super().__init__(os.path.join(os.path.dirname( os.path.realpath(__file__)), "prophesy_web.cfg")) def get_results_dir(sel...
1,066
25.02439
85
py
prophesy
prophesy-master/prophesy_web/__init__.py
0
0
0
py
prophesy
prophesy-master/prophesy_web/tests/tornado_test_case.py
import pytest # Imported to start the webservice and check it's functionality from prophesy_web.application import make_app, initEnv from tornado.testing import AsyncHTTPTestCase # For parsing json-strings in dicts import json class TornadoTestCase(AsyncHTTPTestCase): """ General class for testing the tornado w...
2,880
34.567901
81
py
prophesy
prophesy-master/prophesy_web/tests/test_tornado.py
import pytest from tornado_test_case import TornadoTestCase # For parsing json-strings in dicts import json # To create random numbers for testing the configuration (maybe unnecessary) import random # Check if a file really exists import os.path import shutil import logging from helpers.helper import get_example_pat...
8,808
43.489899
112
py
prophesy
prophesy-master/prophesy_web/tests/test_tornado_workflow.py
import pytest from tornado_test_case import TornadoTestCase # Imported to start the webservice and check it's functionality from prophesy_web.application import make_app, initEnv from tornado.testing import AsyncHTTPTestCase # For parsing json-strings in dicts import json # To create random numbers for testing the ...
3,024
39.878378
113
py
prophesy
prophesy-master/prophesy_web/tests/helpers/helper.py
import os example_dir = os.path.abspath( os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, "examples")) def get_example_path(*paths): return os.path.join(example_dir, *paths)
209
22.333333
89
py
prophesy
prophesy-master/scripts/parameter_synthesis.py
#!/usr/bin/env python3 import logging import time import click import prophesy.adapter.pycarl as pc import prophesy.config import random import numpy from prophesy.data.constant import parse_constants_string from prophesy.data.hyperrectangle import HyperRectangle from prophesy.data.samples import InstantiationResultDi...
31,629
45.514706
245
py
prophesy
prophesy-master/scripts/webcegar.py
#!/usr/bin/env python3 from argparse import ArgumentParser from tornado.ioloop import IOLoop import logging import prophesy.config from prophesy_web import config from prophesy_web.application import initEnv, make_app def parse_cli_args(): parser = ArgumentParser(description='Start a webservice for ' + config.T...
1,271
32.473684
109
py
prophesy
prophesy-master/scripts/tests/test_sampling_solutionfunction.py
import os.path import logging import pytest from requires import * from conftest import EXAMPLE_FOLDER, current_time import click.testing logger = logging.getLogger(__name__) import parameter_synthesis SAMPLINGNR = 3 ITERATIONS = 1 target_file = "sampling_solutionfunction_{}.samples".format(current_time) benchmarks...
2,185
32.630769
81
py
prophesy
prophesy-master/scripts/tests/requires.py
### # Helpers for the script tests. #### import pytest from prophesy.config import configuration, modules def require_prism(rational_function=False): if rational_function: return pytest.mark.xfail() return pytest.mark.skipif(not configuration.get_prism(), reason="requires prism") def require_storm...
970
26.742857
95
py
prophesy
prophesy-master/scripts/tests/conftest.py
import sys import os import time import prophesy.config import logging sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) logging.basicConfig(filename="prophesy_script_test.log", format='%(levelname)s:%(message)s', level=logging.DEBUG) EXAMPLE_FOLDER = os.path.join(os.path.dirname(os.path.dir...
507
35.285714
113
py
prophesy
prophesy-master/scripts/tests/test_find_feasible_solution.py
import os.path import pytest import logging from conftest import EXAMPLE_FOLDER, current_time from requires import * import click.testing import pycarl import parameter_synthesis logger = logging.getLogger(__name__) target_file = "sampling_model_{}.samples".format(current_time) benchmarks = [ ("brp", "brp_16-2"...
4,932
36.656489
81
py
prophesy
prophesy-master/scripts/tests/test_sampling_model.py
import os.path import pytest import logging from requires import * from conftest import EXAMPLE_FOLDER, current_time import click.testing import pycarl import parameter_synthesis logger = logging.getLogger(__name__) SAMPLINGNR = 3 ITERATIONS = 1 target_file = "sampling_model_{}.samples".format(current_time) benchma...
2,605
37.323529
101
py
prophesy
prophesy-master/scripts/tests/util.py
import random import numpy as np def set_random_seeds(py_seed=42, np_seed=23): random.seed(py_seed) np.random.seed(np_seed)
135
14.111111
45
py
prophesy
prophesy-master/scripts/tests/test_search_optimum.py
import os.path import pytest import logging from requires import * from conftest import EXAMPLE_FOLDER, current_time import click.testing import parameter_synthesis logger = logging.getLogger(__name__) target_file = "sampling_model_{}.samples".format(current_time) benchmarks = [ pytest.param("brp", "brp", "N=16...
1,098
31.323529
95
py
prophesy
prophesy-master/scripts/tests/test_compute_solutionfunction.py
import os.path import pytest import logging from conftest import EXAMPLE_FOLDER, current_time from requires import * import click.testing import pycarl import parameter_synthesis logger = logging.getLogger(__name__) target_file = "compute_solutionfunction_{}.rat".format(current_time) benchmarks = [ pytest.param(...
1,492
36.325
116
py
prophesy
prophesy-master/scripts/tests/test_complete_pipeline.py
import os.path import pytest import logging from conftest import EXAMPLE_FOLDER, current_time from requires import * import click.testing logger = logging.getLogger(__name__) import parameter_synthesis import pycarl benchmarks_pipeline = [ pytest.param("brp", "brp", "N=16,MAX=2", "property1", 0.7, "z3", "storm", ...
2,121
41.44
158
py
prophesy
prophesy-master/scripts/tests/test_parameter_space_partitioning.py
import os.path import pytest import logging from conftest import EXAMPLE_FOLDER, current_time from requires import * import click.testing logger = logging.getLogger(__name__) import parameter_synthesis import pycarl benchmarks_smt = [ pytest.param("kydie", "kydie", "", "property1", "kydie", "15/100", "z3", "quad...
8,365
43.031579
169
py
prophesy
prophesy-master/tests/requires.py
### # Helpers for the script tests. #### import pytest from prophesy.config import configuration, modules def require_prism(rational_function=False): if rational_function: return pytest.mark.xfail() return pytest.mark.skipif(not configuration.get_prism(), reason="requires prism") def require_storm...
967
29.25
95
py
prophesy
prophesy-master/tests/conftest.py
import pytest import os import sys import prophesy.config import logging sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers')) logging.basicConfig(filename="prophesy_test.log", format='%(levelname)s:%(message)s', level=logging.DEBUG) prophesy.config.load_configuration() """ Enable incremental testing ""...
777
28.923077
106
py
prophesy
prophesy-master/tests/helpers/helper.py
import os example_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "examples")) def get_example_path(*paths): return os.path.join(example_dir, *paths)
193
23.25
104
py
prophesy
prophesy-master/tests/modelcheckers/test_sampling.py
from prophesy.modelcheckers.storm import StormModelChecker from prophesy.modelcheckers.stormpy import StormpyModelChecker from prophesy.input.modelfile import PrismFile from prophesy.input.pctlfile import PctlFile import prophesy.adapter.pycarl as pc from prophesy.data.point import Point from helpers.helper import get...
1,326
35.861111
82
py
prophesy
prophesy-master/tests/modelcheckers/test_check_region.py
from prophesy.modelcheckers.storm import StormModelChecker from prophesy.modelcheckers.stormpy import StormpyModelChecker from prophesy.modelcheckers.prism import PrismModelChecker from prophesy.input.modelfile import PrismFile from prophesy.input.pctlfile import PctlFile from prophesy.data.hyperrectangle import HyperR...
1,758
44.102564
108
py
prophesy
prophesy-master/tests/modelcheckers/test_compute_rational_function.py
from prophesy.modelcheckers.storm import StormModelChecker from prophesy.modelcheckers.stormpy import StormpyModelChecker from prophesy.modelcheckers.prism import PrismModelChecker from prophesy.input.modelfile import PrismFile from prophesy.input.pctlfile import PctlFile from helpers.helper import get_example_path fr...
2,009
39.2
94
py
prophesy
prophesy-master/tests/data/test_hyperrect.py
from prophesy.data.interval import Interval, string_to_interval, BoundType from prophesy.data.hyperrectangle import HyperRectangle from prophesy.data.point import Point import prophesy.adapter.pycarl as pc def test_hyperrectangle_splitting(): i = Interval(0.0, BoundType.closed, 2.0, BoundType.closed) j = Int...
3,460
50.656716
136
py
prophesy
prophesy-master/tests/data/test_constants.py
from prophesy.data.constant import parse_constants_string import prophesy.adapter.pycarl as pc def test_constants_parsing(): x_var = pc.Variable("x") y_var = pc.Variable("y") constants = parse_constants_string("x=y,y=2") assert x_var in constants assert y_var in constants constants = parse_con...
518
31.4375
57
py
prophesy
prophesy-master/tests/data/test_point.py
from prophesy.data.point import Point def test_to_float(): p = Point(*[3, 4]).to_float() assert p[0] == 3.0
120
12.444444
37
py
prophesy
prophesy-master/tests/data/test_range.py
from prophesy.data.range import Range, create_cartesian_product def test_cartesian_product(): r1 = Range(1, 3, 1) r2 = Range(4, 6, 1) result = create_cartesian_product([r1, r2]) assert len(list(result)) == 9
226
24.222222
63
py
prophesy
prophesy-master/tests/data/test_parameter.py
from prophesy.data.parameter import Parameter import prophesy.adapter.pycarl as pc import pycarl import pickle from prophesy.data.interval import Interval, string_to_interval def test_contains(): pycarl.clear_variable_pool() x = pc.Variable("x") p = Parameter(x, string_to_interval("(0,1)", int)) p_ne...
375
30.333333
63
py
prophesy
prophesy-master/tests/data/test_interval.py
from prophesy.data.interval import Interval, string_to_interval, BoundType, constraint_to_interval import pycarl def test_interval_parsing(): int1 = string_to_interval("(2,5)", int) assert int1.left_bound() == 2 assert int1.left_bound_type() == BoundType.open assert int1.right_bound() == 5 assert i...
7,838
39.2
98
py
prophesy
prophesy-master/tests/data/test_property.py
from prophesy.data.property import * import prophesy.adapter.pycarl as pc def test_property_parsing(): input_string = "Pmin=? [F \"now\"]" p = Property.from_string(input_string) assert input_string == str(p) input_string = "Pmin=? [F \"now\"]" p = Property.from_string(input_string) assert inpu...
678
34.736842
73
py
prophesy
prophesy-master/tests/input/test_storm_result.py
from prophesy.input.solutionfunctionfile import read_pstorm_result from helpers.helper import get_example_path from requires import * @require_pycarl_parser() def test_read_pstorm_result_brp(): read_pstorm_result(get_example_path("brp", "brp_16-2.rat"))
259
31.5
66
py
prophesy
prophesy-master/doc/source/conf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # prophesy documentation build configuration file, created by # sphinx-quickstart on Wed Jan 20 17:48:07 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # a...
7,419
30.440678
79
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/main.py
""" forked from https://github.com/juntang-zhuang/Adabelief-Optimizer/tree/update_0.2.0/PyTorch_Experiments/wgan/main.py """ from __future__ import print_function import argparse import os import random import wandb import uuid import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as ...
13,951
40.278107
199
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/optimizers/set_optim.py
from optimizers import * import torch.optim as optim import torch import sys import os from util import build_optimizer, OptimizerSetting def set_optimizers(optimizer, model, lr, momentum, beta1, beta2, eps, beta_momentum_coeff): if optimizer == 'adam': optimizer = optim.Adam(model.parameters(), lr=lr, b...
3,198
37.083333
91
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/optimizers/util.py
# This code will be published soon
34
34
34
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/optimizers/__init__.py
0
0
0
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/utils/lr_scheduler.py
from torch.optim import lr_scheduler import math # ================ # Set LR Scheduler # Reference https://github.com/christiancosgrove/pytorch-spectral-normalization-gan/blob/12dcf945a6359301d63d1e0da3708cd0f0590b19/main.py#L55 # ================ def build_scheduler(opt, optimizerD, optimizerG): if opt.schedul...
1,690
33.510204
141
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/utils/set_model.py
import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.utils.data import torchvision.datasets as dset import torchvision.transforms as transforms import torchvision.utils as vutils import torch.nn.functional as F def set_models(weights_init, model="GAN", netG_path...
7,074
44.352564
118
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/utils/inception.py
""" forked from https://github.com/mseitzer/pytorch-fid/blob/master/inception.py """ import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models try: from torchvision.models.utils import load_state_dict_from_url, load_state_dict except ImportError: from torch.utils.model_z...
11,769
36.845659
82
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/utils/data_utils.py
import torch import torchvision.datasets as datasets import torchvision.transforms as transforms def build_dataset(opt): if opt.dataset in ['imagenet', 'folder', 'lfw']: # folder dataset dataset = datasets.ImageFolder(root=opt.dataroot, transform=transforms.Compose([...
2,828
41.223881
91
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/utils/lib_version.py
import sys import torch import torchvision import numpy as np import PIL def print_libs_version(): print("Environment:") print("\tPython: {}".format(sys.version.split(" ")[0])) print("\tPyTorch: {}".format(torch.__version__)) print("\tTorchvision: {}".format(torchvision.__version__)) print("\tCUDA:...
511
33.133333
63
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/utils/log_utils.py
import datetime def date_str(): dt_now = datetime.datetime.now() date_str = str(dt_now.year) + "_" + str(dt_now.month) + "_" + str(dt_now.day) +\ "_" + str(dt_now.hour) + "_" + str(dt_now.minute) return date_str def set_otf(opt, wandb_project_name): """ return : e.g. const_lr_cifar10_RESNET_c...
1,062
45.217391
151
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/utils/fid_score.py
""" forked from https://github.com/mseitzer/pytorch-fid/blob/master/inception.py """ import os import pathlib from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter import numpy as np import torch from scipy import linalg from torch.nn.functional import adaptive_avg_pool2d from PIL import Image try: ...
7,548
35.119617
79
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/utils/metric.py
import torch class TensorMetric(object): def __init__(self, name): self.name = name self.sum = torch.tensor(0.) self.n = torch.tensor(0.) def update(self, val): self.sum += val.detach().cpu() self.n += 1 @property def avg(self): return self.sum / self.n...
582
19.103448
38
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/utils/lsun/download.py
# -*- coding: utf-8 -*- from __future__ import print_function, division import argparse from os.path import join import subprocess from urllib.request import Request, urlopen __author__ = 'Fisher Yu' __email__ = 'fy@cs.princeton.edu' __license__ = 'MIT' def list_categories(): url = 'http://dl.yf.io/lsun/catego...
1,843
29.733333
78
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/utils/lsun/data.py
from __future__ import print_function import argparse import cv2 import lmdb import numpy import os from os.path import exists, join __author__ = 'Fisher Yu' __email__ = 'fy@cs.princeton.edu' __license__ = 'MIT' def view(db_path): print('Viewing', db_path) print('Press ESC to exist or SPACE to advance.') ...
3,076
33.965909
80
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/jupyter/toy_example/set_optimizer.py
# coding: utf-8 import attr import torch.optim as optim from cg_optimizer import ConjugateGradientOptimizer @attr.s class OptimizerSetting: name = attr.ib() lr = attr.ib() weight_decay = attr.ib() model = attr.ib() momentum = attr.ib(default=0.9) # sgd, sgd_nesterov eps = attr.ib(default=0.00...
2,082
35.54386
153
py
ConjugateGradient_GAN
ConjugateGradient_GAN-master/jupyter/toy_example/cg_optimizer.py
""" Conjugate Gradient method in PyTorch! """ import torch from torch.optim.optimizer import Optimizer, required class ConjugateGradientOptimizer(Optimizer): """ Conjugate Gradient method Notation: d_buffer: update vector alpha_buffer: alpha beta_buffer: beta """ def ...
6,671
39.436364
141
py
dmrgpy
dmrgpy-master/install.py
#!/usr/bin/python3 # create the optional arguments import argparse parser = argparse.ArgumentParser() parser.add_argument("--gpp",default="g++", help='C++ Compiler to be used') parser.add_argument("--check_gpp",default="True", help='C++ Compiler to be used') args = parser.parse_args() # get the argumen...
671
31
76
py
dmrgpy
dmrgpy-master/install_julia.py
#!/usr/bin/python3 import os import sys import subprocess mpath = os.path.dirname(os.path.realpath(__file__)) # main path try: out,err = subprocess.Popen(['julia', '--version'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate() except: out = "" # check if JUlia has the corre...
1,665
23.865672
85
py
dmrgpy
dmrgpy-master/addsystem.py
#!/usr/bin/python from __future__ import print_function import os pwd = os.getcwd() # get the current location # different files for Linux and Mac import platform if platform.system()=="Linux": bashrc = os.environ["HOME"]+"/.bashrc" # path to .bashrc print("Detected Linux system") f = open(bashrc).read() # re...
1,929
22.253012
70
py
dmrgpy
dmrgpy-master/clean.py
#!/usr/bin/python import os pwd = os.getcwd() for d in os.walk("."): # loop over subdirectories os.chdir(d[0]) os.system("rm -rf .mpsfolder") os.system("rm -f ERROR") os.system("rm -f *.OUT") os.system("rm -rf .pychainfolder") os.system("rm -rf .dmrgfolder") os.chdir(pwd)
292
16.235294
49
py
dmrgpy
dmrgpy-master/examples/replace_string.py
import os ds = os.walk(os.getcwd()) def modify(ls): """Modify an input file to add the path""" return ls.replace("time.clock","time.perf_counter") ds = [d[0] for d in ds] # loop for d in ds: os.chdir(d) # go to that directory if os.path.isfile("main.py"): ls = open("main.py").read() # read all th...
429
20.5
56
py
dmrgpy
dmrgpy-master/examples/addpath.py
import os ds = os.walk(os.getcwd()) d0 = os.getcwd() def modify(ls,depth=1): """Modify an input file to add the path""" ls = ls.split("\n") # split lo = "# Add the root path of the dmrgpy library\n" dd = "" for i in range(depth): dd += "../" lo += "import os ; import sys ; sys.path.append(os....
1,069
24.47619
83
py
dmrgpy
dmrgpy-master/examples/Heisenberg_VS_Hubbard_dynamic/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') # for example PATH = /home/jose/programs/dmrgpy/src #PATH = PATH_TO_DMRGPY_LIBRARY import numpy as np import matplotlib.pyplot as plt from dmrgpy import fermionchain from dmrgpy import spinchain n = 4 # number ...
1,862
22.2875
67
py
dmrgpy
dmrgpy-master/examples/spinful_F_model/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import fermionchain # example for a model containing spinful fermions # and spinless pseudofermions in each site n = 4 # number of fermionic sites (each having spin and f fermion...
1,158
32.114286
68
py
dmrgpy
dmrgpy-master/examples/arnoldi_ground_state/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain n = 6 spins = ["S=1/2" for i in range(n)] # spin 1/2 heisenberg chain sc = spinchain.Spin_Chain(spins) # create the spin chain h = 0 for i in range(n-1): h = ...
681
21.733333
66
py
dmrgpy
dmrgpy-master/examples/analytic_continuation/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain n = 6 spins = ["S=1/2" for i in range(n)] # spin 1/2 heisenberg chain sc = spinchain.Spin_Chain(spins) # create the spin chain h = 0 for i in range(n-1): h = ...
896
20.878049
66
py
dmrgpy
dmrgpy-master/examples/exponential_time_evolution/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain n = 6 # number of sites in your chain spins = ["S=1/2" for i in range(n)] # create the sites sc = spinchain.Spin_Chain(spins) # create the chain h = 0 for i in ...
1,696
26.370968
87
py
dmrgpy
dmrgpy-master/examples/spinless_fermions_second_quantization/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import fermionchain nf = 10 # number of different spinless fermionic orbitals fc = fermionchain.Fermionic_Chain(nf) # create the object C = fc.C # annihilation Cdag = fc.Cdag # ...
898
23.972222
75
py
dmrgpy
dmrgpy-master/examples/julia_VS_cpp/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain def get(version,n=30): spins = ["S=1/2" for i in range(n)] # spin 1/2 heisenberg chain sc = spinchain.Spin_Chain(spins) # create the spin chain if version...
981
18.254902
66
py
dmrgpy
dmrgpy-master/examples/kondo_entropy/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import fermionchain def get(JK): n = 4 # number of spinful fermionic sites fc = fermionchain.Spinful_Fermionic_Chain(n) # create the chain h = 0 mu = 0. for i...
1,365
28.695652
67
py
dmrgpy
dmrgpy-master/examples/transverse_ising_model/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain n = 40 # number of sites in your chain spins = ["S=1/2" for i in range(n)] # create the sites sc = spinchain.Spin_Chain(spins) # create the chain # now define t...
1,363
22.517241
80
py
dmrgpy
dmrgpy-master/examples/random_mps/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain n = 10 spins = ["S=1/2" for i in range(n)] # spin 1/2 heisenberg chain sc = spinchain.Spin_Chain(spins) # create the spin chain wf = sc.random_mps() # random wave...
372
15.217391
66
py
dmrgpy
dmrgpy-master/examples/total_particle_number/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np import matplotlib.pyplot as plt from dmrgpy import fermionchain L = 4 # number of sites def get_N(mu): fc = fermionchain.Fermionic_Chain(L) # create the chain h = 0 # initialize ...
1,199
26.272727
79
py
dmrgpy
dmrgpy-master/examples/purified_excited_states/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain import time n = 8 # take n different sites spins = ["S=1/2" for i in range(n)] # spin 1/2 heisenberg chain sc = spinchain.Spin_Chain(spins) # create the spin chai...
1,374
22.706897
79
py
dmrgpy
dmrgpy-master/examples/evolve_wavefunction/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') #------------------------------------------------------------------ import numpy as np from dmrgpy import spinchain # Heisenberg Hamiltonian S12 n = 4 # number of sites in your chain spins = ["S=1/2" for i in r...
1,112
23.733333
90
py
dmrgpy
dmrgpy-master/examples/spinboson_chain/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import bosonchain ns = 2 # 6 sites in total, 2 spins nb = 4 # and 4 bosons sites = ["S=1/2" for i in range(ns)] # add spins sites = sites + ["B" for i in range(nb)] # add bosons b...
1,468
28.979592
80
py
dmrgpy
dmrgpy-master/examples/effective_hamiltonian/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import fermionchain n = 2 # number of spinful fermionic sites fc = fermionchain.Spinful_Fermionic_Chain(n) # create the chain # initialize Hamiltonian # h = 0 phi = 0.1 t = 1.0*np...
860
21.076923
70
py
dmrgpy
dmrgpy-master/examples/comparison_dmrg/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import simplechains b = np.random.random(3) J = np.random.random(3) ssc = simplechains.SSC(s=.5,n=14,b=b,J=J) print("Energy with ED",ssc.gs_energy(mode="ED")) print("Energy with M...
659
23.444444
76
py
dmrgpy
dmrgpy-master/examples/excited_states/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain import time n = 12 # take n different sites spins = ["S=1/2" for i in range(n)] # spin 1/2 heisenberg chain sc = spinchain.Spin_Chain(spins) # create the spin cha...
943
20.454545
83
py
dmrgpy
dmrgpy-master/examples/interacting_majorana/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import fermionchain n = 20 # number of spinful fermionic sites fc = fermionchain.Fermionic_Chain(n) # create the chain h = 0 V = -0.9 for i in range(n-1): # hopping h = h + fc...
829
21.432432
103
py
dmrgpy
dmrgpy-master/examples/parafermion_static_correlator/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np import matplotlib.pyplot as plt from dmrgpy import parafermionchain n = 3 pc = parafermionchain.Parafermionic_Chain(n) # create the chain h = 0 for i in range(n): for j in range(n): ...
1,205
20.157895
66
py
dmrgpy
dmrgpy-master/examples/charge_gap/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np import matplotlib.pyplot as plt from dmrgpy import fermionchain n = 6 fc = fermionchain.Fermionic_Chain(n) # create the chain h = 0 for i in range(n-1): h = h + fc.C[i]*fc.Cdag[i+1] for i...
516
16.827586
66
py
dmrgpy
dmrgpy-master/examples/haldane_gap/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') from dmrgpy import spinchain n = 18 # take n sites spins = ["S=1" for i in range(n)] # spin 1 Heisenberg chain sc = spinchain.Spin_Chain(spins) # create the spin chain sc.maxm = 20 sc.nsweeps = 30 h = 0 for i ...
893
23.162162
66
py
dmrgpy
dmrgpy-master/examples/iterate_energy/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np # conventional numpy library from dmrgpy import spinchain # library dealing with DMRG for spin chains import matplotlib.pyplot as plt # library to plot the results ###########################...
1,542
25.603448
82
py
dmrgpy
dmrgpy-master/examples/julia_VS_cpp_evolution/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain def get(n): spins = [2 for i in range(n)] # spin 1/2 heisenberg chain sc = spinchain.Spin_Chain(spins) # create the spin chain h = 0 for i in range(n-1): ...
1,101
19.792453
66
py
dmrgpy
dmrgpy-master/examples/hubbard_chain/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import fermionchain n = 4 # number of spinful fermionic sites fc = fermionchain.Spinful_Fermionic_Chain(n) # create the chain #fc.Nup = fc.N #fc.Ndn = fc.N #fc.Cup = fc.C #fc.Cdag...
1,585
25
70
py
dmrgpy
dmrgpy-master/examples/dcf_haldane/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np import spinchain n = 30 spins = [3 for i in range(n)] # spin 1/2 heisenberg chain sc = spinchain.Spin_Chain(spins) # create the spin chain sc.kpmmaxm = 10 # KPM max m fo = open("DCF.OUT","w")...
604
18.516129
66
py
dmrgpy
dmrgpy-master/examples/spinless_fermion_dynamical_correlator_multioperator/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np import matplotlib.pyplot as plt from dmrgpy import fermionchain n = 6 fc = fermionchain.Fermionic_Chain(n) # create the chain m = np.matrix(np.random.random((n,n)) + 1j*np.random.random((n,n)...
1,449
19.714286
78
py
dmrgpy
dmrgpy-master/examples/magnetization_distribution_moments/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain n = 20 # number of sites in your chain spins = ["S=1/2" for i in range(n)] # create the sites sc = spinchain.Spin_Chain(spins) # create the chain #sc.itensor_ver...
1,650
26.983051
67
py
dmrgpy
dmrgpy-master/examples/readme_examples/hubbard_correlator/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') from dmrgpy import fermionchain n = 20 # number of sites fc = fermionchain.Spinful_Fermionic_Chain(n) # first neighbor hopping h = 0 for i in range(n-1): h = h + fc.Cdagup[i]*fc.Cup[i+1] h = h + fc.Cdagd...
1,244
22.055556
84
py
dmrgpy
dmrgpy-master/examples/readme_examples/static_correlator_S12/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') from dmrgpy import spinchain n = 30 spins = ["S=1/2" for i in range(n)] # S=1 in each site sc = spinchain.Spin_Chain(spins) # create spin chain object h = 0 # initialize Hamiltonian for i in range(len(spins)...
794
23.090909
69
py
dmrgpy
dmrgpy-master/examples/readme_examples/map_edge_correlator/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') import numpy as np from dmrgpy import spinchain n = 10 # create an S=1/2 spin chain spins = ["S=1/2" for i in range(n)] # spin 1/2 heisenberg chain # create first neighbor exchange sc = spinchain.Spin_Chain(...
1,191
19.551724
69
py
dmrgpy
dmrgpy-master/examples/readme_examples/energy_VS_length/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') from dmrgpy import spinchain spins = ["S=1/2" for i in range(30)] # spins in each site sc = spinchain.Spin_Chain(spins) # create spin chain object h = 0 # initialize Hamiltonian for i in range(len(spins)-1)...
498
21.681818
69
py
dmrgpy
dmrgpy-master/examples/readme_examples/XXZ_energy/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') from dmrgpy import spinchain import numpy as np n = 10 ; spins = ["S=1/2" for i in range(n)] # spins in each site sc = spinchain.Spin_Chain(spins) # create spin chain object hxy,hz = 0,0 # initialize Hamilto...
935
23.631579
69
py
dmrgpy
dmrgpy-master/examples/readme_examples/edge_correlator/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') from dmrgpy import spinchain n = 20 ; spins = ["S=1" for i in range(n)] # S=1 chain sc = spinchain.Spin_Chain(spins) # create spin chain object h = 0 # initialize Hamiltonian for i in range(len(spins)-1): ...
942
23.815789
69
py
dmrgpy
dmrgpy-master/examples/readme_examples/map_dyn_corr_correlator_impurity/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') import numpy as np from dmrgpy import spinchain spins = ["S=1/2" for i in range(4)] # spin 1/2 heisenberg chain spins = spins + ["S=1"] + spins # put S=1 in the middle n = len(spins) # total number of spins ...
1,278
20.677966
69
py
dmrgpy
dmrgpy-master/examples/readme_examples/static_correlator_S1/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') from dmrgpy import spinchain n = 30 spins = ["S=1" for i in range(n)] # S=1 in each site sc = spinchain.Spin_Chain(spins) # create spin chain object h = 0 # initialize Hamiltonian for i in range(len(spins)-1...
792
23.030303
69
py
dmrgpy
dmrgpy-master/examples/readme_examples/map_nonlocal_edge_correlator/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') import numpy as np from dmrgpy import spinchain n = 10 # create an S=1/2 spin chain spins = ["S=1/2" for i in range(n)] # spin 1/2 heisenberg chain # create first neighbor exchange sc = spinchain.Spin_Chain(...
1,248
19.47541
69
py
dmrgpy
dmrgpy-master/examples/readme_examples/bond_dimension_convergence/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') ## Bond dimension energy convergence for an S=1/2 Heisenberg chain from dmrgpy import spinchain import numpy as np n= 30 # size of the chain spins = ["S=1/2" for i in range(n)] # S=1/2 chain sc = spinchain...
1,258
24.693878
69
py
dmrgpy
dmrgpy-master/examples/readme_examples/hubbard_correlator_VS_U/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../../src') from dmrgpy import fermionchain import numpy as np n = 14 # number of sites fc = fermionchain.Spinful_Fermionic_Chain(n) # first neighbor hopping h = 0 for i in range(n-1): h = h + fc.Cdagup[i]*fc.Cup[i+1]...
1,099
21.44898
95
py
dmrgpy
dmrgpy-master/examples/fidelity/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain n = 6 spins = ["S=1/2" for i in range(n)] # spin 1/2 heisenberg chain sc = spinchain.Spin_Chain(spins) # create the spin chain # fidelity of the transverse field...
859
19.47619
66
py
dmrgpy
dmrgpy-master/examples/power_vev/main.py
# Add the root path of the dmrgpy library import os ; import sys ; sys.path.append(os.getcwd()+'/../../src') import numpy as np from dmrgpy import spinchain n = 15 # number of sites in your chain spins = ["S=1/2" for i in range(n)] # create the sites sc = spinchain.Spin_Chain(spins) # create the chain sc.itensor_vers...
1,179
20.851852
75
py