Exemplo n.º 1
0
 def test_xplib(self):
     # pass
     # self.assertEqual(funcs.tupleProduct((2, 3)), 6)
     CTL.setXP(None)
     with self.assertRaises(AttributeError) as context:
         simplestExample()
     CTL.setXP(np)
     res = simplestExample()
     print('res = {}'.format(res))
Exemplo n.º 2
0
 def test_cupy(self):
     # pass
     # self.assertEqual(funcs.tupleProduct((2, 3)), 6)
     try:
         import cupy as cp
     except:
         return
     CTL.setXP(cp)
     res = simplestExample()
     print('res = {}'.format(res))
Exemplo n.º 3
0
def main(argv):
    if len(argv) < 2: 
        print('Usage: ./CORONER [input_file]')
        sys.exit(1)

    inpoot_file = argv[1]

    ast = parse_input(inpoot_file)

    print("\nCTL ALGORITHM: SERIAL")
    CTL.execute_ctl_serial(ast)
    
    print("\nCTL ALGORITHM: PARALLEL")
    CTL.execute_ctl_parallel(ast)

    print("\nMARK SWEEP ALGORITHM")
    MARKSWEEP.mark_sweep(ast)

    sys.exit(0)
Exemplo n.º 4
0
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 20:52:12 2015

@author: Travis
"""

from numpy import *
import CTL

###
# Runtime
###
recordList = ["31"]
order = 10
#lowPassFilter = [None, [order, 0.1], [order, 0.25], [order, 0.5]]
lowPassFilter = [[order, 0.05]]
for lpf in lowPassFilter:
    CTL.fullAnalysis(recordList, 'physionetdata/', lpf, 1)
Exemplo n.º 5
0
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 20:52:12 2015

@author: Travis
"""

from numpy import *
import CTL

###
# Runtime
###
# Had to lower embedding dimension and N due to small datasets
embeddingDim = 10
N = 2

recordList = ["SockeyeSalmon", "ElephantSeal", "ChumSalmon", "Beaver"]
order = 2
lowPassFilter = [None, [order, 0.1], [order, 0.25], [order, 0.5]]
for lpf in lowPassFilter:
    CTL.fullAnalysis(recordList, 'populationdata/', lpf, 0, embeddingDim, N)
Exemplo n.º 6
0
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 20:52:12 2015

@author: Travis
"""

from numpy import *
import CTL

###
# Runtime
###
# Had to lower embedding dimension and N due to small datasets
embeddingDim = 10
N = 2

recordList = ["SockeyeSalmon", "ElephantSeal", "ChumSalmon", "Beaver"]
order = 2
lowPassFilter = [None, [order, 0.1], [order, 0.25], [order, 0.5]]
for lpf in lowPassFilter:
    CTL.fullAnalysis(recordList, "populationdata/", lpf, 0, embeddingDim, N)
Exemplo n.º 7
0
parentdir = os.path.dirname(currentdir)
sys.path.append(os.path.join(parentdir, 'src'))

from CTL.tensor.tensor import Tensor
from CTL.tensor.contract.link import makeLink
from CTL.tensor.contract.optimalContract import contractAndCostWithSequence
from CTL.examples.MPS import contractWithMPS

from CTL.models.Ising import IsingSiteTensor, IsingEdgeMatrix, IsingTNFromUndirectedGraph, exactZFromGraphIsing
from CTL.funcs.graphFuncs import squareLatticeFBC, squareLatticeFBC

import numpy as np
import cupy as cp
import CTL

CTL.setXP(cp)


def contractHandmadeTN():
    print('contractHandmadeTN():')
    a = Tensor(shape=(3, 5, 7), labels=['a3', 'a5', 'a7'])
    b = Tensor(shape=(2, 4, 5), labels=['b2', 'b4', 'b5'])
    c = Tensor(shape=(2, 7, 7, 7), labels=['c2', 'c71', 'c72', 'c73'])
    d = Tensor(shape=(7, 7, 3, 4), labels=['d71', 'd72', 'd3', 'd4'])
    e = Tensor(shape=(3, 3, 5), labels=['e31', 'e32', 'e5'])
    f = Tensor(shape=(2, 2, 5), labels=['f21', 'f22', 'f5'])
    g = Tensor(shape=(4, 4, 3, 3), labels=['g41', 'g42', 'g31', 'g32'])
    makeLink('a3', 'e31', a, e)
    makeLink('a5', 'b5', a, b)
    makeLink('a7', 'c72', a, c)
Exemplo n.º 8
0
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 20:52:12 2015

@author: Travis
"""

from numpy import *
import CTL

###
# Runtime
###
#recordList = ["DowJonesOpen", "DowJonesClose", "DowJonesHigh", "DowJonesLow"]
recordList = ["DowJonesClose"]
order = 10
lowPassFilter = [None, [order, 0.1], [order, 0.25], [order, 0.5]]
for lpf in lowPassFilter:
    CTL.fullAnalysis(recordList, 'financialdata/', lpf)
Exemplo n.º 9
0
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 20:52:12 2015

@author: Travis
"""

from numpy import *
import CTL

###
# Runtime
###
recordList = ["AirTemp"]
order = 10
lowPassFilter = [None, [order, 0.1], [order, 0.25], [order, 0.5]]
for lpf in lowPassFilter:
    CTL.fullAnalysis(recordList, 'climatedata/', lpf)
Exemplo n.º 10
0
def HOTRGImpurityExample(beta=0.5):
    print('test magnet for Ising model, beta = {}'.format(beta))
    # beta = 0.6

    symmetryBroken = 1e-5
    a = squareIsingTensor(beta=beta, symmetryBroken=symmetryBroken)
    hotrg = HOTRG(a, chiH=16)
    for _ in range(20):
        hotrg.iterate()

    mTensor = squareIsingTensor(beta=beta,
                                obs="M",
                                symmetryBroken=symmetryBroken)
    impurityTN = ImpurityTensorNetwork([a, mTensor], 2)
    impurityTN.setRG(hotrg)

    for _ in range(20):
        impurityTN.iterate()
    M = impurityTN.measureObservables()
    M = [x[1] for x in M]
    exactM = infiniteIsingExactM(1.0 / beta)
    print('magnet = {}'.format(M[-1] * 0.5))
    print('exact magnet = {}'.format(exactM))


if __name__ == '__main__':
    CTL.setXP(None)
    CTL.setXP(np)
    simplestExample()
    HOTRGImpurityExample(beta=0.6)
    twoTensorsContraction()