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 |
|---|---|---|---|---|---|---|
MrMustard-develop | MrMustard-develop/mrmustard/physics/gaussian.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 30,017 | 30.798729 | 124 | py |
MrMustard-develop | MrMustard-develop/mrmustard/physics/husimi.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 1,492 | 32.177778 | 77 | py |
MrMustard-develop | MrMustard-develop/mrmustard/physics/__init__.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 4,420 | 30.35461 | 207 | py |
MrMustard-develop | MrMustard-develop/mrmustard/training/callbacks.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 10,500 | 35.58885 | 101 | py |
MrMustard-develop | MrMustard-develop/mrmustard/training/parametrized.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 8,096 | 42.767568 | 100 | py |
MrMustard-develop | MrMustard-develop/mrmustard/training/parameter.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 8,751 | 33.1875 | 100 | py |
MrMustard-develop | MrMustard-develop/mrmustard/training/__init__.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,344 | 31.569444 | 94 | py |
MrMustard-develop | MrMustard-develop/mrmustard/training/trainer.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 17,735 | 38.85618 | 241 | py |
MrMustard-develop | MrMustard-develop/mrmustard/training/parameter_update.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,948 | 36.807692 | 96 | py |
MrMustard-develop | MrMustard-develop/mrmustard/training/optimizer.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 12,222 | 41.58885 | 117 | py |
MrMustard-develop | MrMustard-develop/mrmustard/lab/detectors.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 18,436 | 41.093607 | 120 | py |
MrMustard-develop | MrMustard-develop/mrmustard/lab/circuit.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 4,141 | 35.017391 | 112 | py |
MrMustard-develop | MrMustard-develop/mrmustard/lab/gates.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 32,866 | 35.478357 | 159 | py |
MrMustard-develop | MrMustard-develop/mrmustard/lab/__init__.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 1,017 | 32.933333 | 75 | py |
MrMustard-develop | MrMustard-develop/mrmustard/lab/states.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 19,178 | 36.240777 | 188 | py |
MrMustard-develop | MrMustard-develop/mrmustard/lab/abstract/transformation.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 14,737 | 37.181347 | 125 | py |
MrMustard-develop | MrMustard-develop/mrmustard/lab/abstract/measurement.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 6,981 | 35.941799 | 114 | py |
MrMustard-develop | MrMustard-develop/mrmustard/lab/abstract/state.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 26,431 | 38.333333 | 180 | py |
MrMustard-develop | MrMustard-develop/mrmustard/lab/abstract/__init__.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 830 | 38.571429 | 108 | py |
MrMustard-develop | MrMustard-develop/mrmustard/utils/wigner.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,527 | 36.176471 | 135 | py |
MrMustard-develop | MrMustard-develop/mrmustard/utils/circdrawer.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 3,728 | 33.527778 | 109 | py |
MrMustard-develop | MrMustard-develop/mrmustard/utils/graphics.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 6,397 | 35.982659 | 98 | py |
MrMustard-develop | MrMustard-develop/mrmustard/utils/xptensor.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 26,653 | 42.199352 | 138 | py |
MrMustard-develop | MrMustard-develop/mrmustard/utils/__init__.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 680 | 39.058824 | 77 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/autocast.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,873 | 39.478873 | 105 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/torch.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 12,620 | 32.745989 | 109 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/mmtensor.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 8,475 | 37.527273 | 97 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/math_interface.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 39,318 | 31.255127 | 110 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/__init__.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,161 | 33.870968 | 134 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/caching.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 1,558 | 35.255814 | 92 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/tensorflow.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 22,806 | 35.785484 | 133 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/numba/compactFock_diagonal_grad.py | """
This module calculates the derivatives of the diagonal of the Fock representation (i.e. the PNR detection probabilities of all modes)
by applying the derivated recursion relation in a selective manner.
"""
import numpy as np
import numba
from numba import njit, int64
from numba.cpython.unsafe.tuple import tuple_se... | 12,198 | 38.22508 | 180 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/numba/compactFock_1leftoverMode_grad.py | """
This module calculates the derivatives for all possible Fock representations of mode 0, where all other modes are PNR detected.
This is done by applying the derivated recursion relation in a selective manner.
"""
import numpy as np
import numba
from numba import njit, int64
from numba.cpython.unsafe.tuple import t... | 22,924 | 29.896226 | 180 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/numba/compactFock_helperFunctions.py | """
This module contains helper functions that are used in
compactFock_diagonal_amps.py, compactFock_diagonal_grad.py, compactFock_1leftoverMode_amps.py and compactFock_1leftoverMode_grad.py
"""
import numpy as np
from numba import njit, int64
from numba.typed import Dict
import numba
SQRT = np.sqrt(np.arange(1000)) ... | 1,441 | 30.347826 | 131 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/numba/__init__.py | 0 | 0 | 0 | py | |
MrMustard-develop | MrMustard-develop/mrmustard/math/numba/compactFock_1leftoverMode_amps.py | """
This module calculates all possible Fock representations of mode 0,where all other modes are PNR detected.
This is done by applying the recursion relation in a selective manner.
"""
import numba
import numpy as np
from numba import int64, njit
from numba.cpython.unsafe.tuple import tuple_setitem
from mrmustard.ma... | 13,071 | 37.447059 | 180 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/numba/compactFock_diagonal_amps.py | """
This module calculates the diagonal of the Fock representation (i.e. the PNR detection probabilities of all modes)
by applying the recursion relation in a selective manner.
"""
import numpy as np
import numba
from numba import njit, int64
from numba.cpython.unsafe.tuple import tuple_setitem
from mrmustard.math.num... | 7,530 | 40.607735 | 180 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/numba/compactFock_inputValidation.py | """
This module contains helper functions that are used in
compactFock_diagonal_amps.py, compactFock_diagonal_grad.py, compactFock_1leftoverMode_amps.py and compactFock_1leftoverMode_grad.py
to validate the input provided by the user.
"""
from typing import Iterable
import numpy as np
from mrmustard.math.numba.compact... | 3,475 | 40.380952 | 131 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/steps.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 8,657 | 37.651786 | 99 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/neighbors.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 3,125 | 40.68 | 100 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/pivots.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 1,871 | 32.428571 | 92 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/__init__.py | 0 | 0 | 0 | py | |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/paths.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,925 | 34.682927 | 95 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/strategies/binomial.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 5,776 | 34.881988 | 112 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/strategies/vanilla.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 3,588 | 29.415254 | 96 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/strategies/displacement.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 5,356 | 37.264286 | 117 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/strategies/__init__.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 721 | 35.1 | 74 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/strategies/squeezer.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 6,062 | 31.079365 | 100 | py |
MrMustard-develop | MrMustard-develop/mrmustard/math/lattice/strategies/beamsplitter.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 7,575 | 35.956098 | 116 | py |
MrMustard-develop | MrMustard-develop/tests/conftest.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 983 | 36.846154 | 95 | py |
MrMustard-develop | MrMustard-develop/tests/test_logger.py | # Copyright 2010 Pallets
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redist... | 7,021 | 39.825581 | 94 | py |
MrMustard-develop | MrMustard-develop/tests/test_typing.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 3,929 | 32.87931 | 100 | py |
MrMustard-develop | MrMustard-develop/tests/random.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 10,658 | 26.61399 | 95 | py |
MrMustard-develop | MrMustard-develop/tests/__init__.py | 0 | 0 | 0 | py | |
MrMustard-develop | MrMustard-develop/tests/test_settings.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 1,257 | 30.45 | 74 | py |
MrMustard-develop | MrMustard-develop/tests/test_about.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 1,240 | 30.820513 | 82 | py |
MrMustard-develop | MrMustard-develop/tests/test_lab/test_states.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 9,954 | 31.639344 | 97 | py |
MrMustard-develop | MrMustard-develop/tests/test_lab/test_detectors.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 16,745 | 40.656716 | 131 | py |
MrMustard-develop | MrMustard-develop/tests/test_lab/test_circuit.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,175 | 34.096774 | 97 | py |
MrMustard-develop | MrMustard-develop/tests/test_lab/test_state.py | import numpy as np
from mrmustard.lab import Attenuator, Gaussian
def test_addition():
"""Test that addition of Gaussians is correct"""
G0 = Gaussian(1, cutoffs=[10])
G1 = Gaussian(1, cutoffs=[10])
mixed = G0 + G1
assert np.allclose(mixed.dm([10]), G0.dm([10]) + G1.dm([10]))
def test_multipli... | 1,117 | 21.36 | 65 | py |
MrMustard-develop | MrMustard-develop/tests/test_lab/test_gates_fock.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 11,293 | 33.328267 | 102 | py |
MrMustard-develop | MrMustard-develop/tests/test_physics/test_fidelity.py | import numpy as np
import pytest
from thewalrus.quantum import real_to_complex_displacements
from thewalrus.random import random_covariance
from mrmustard import physics
from mrmustard.lab import Coherent, Fock, State
from mrmustard.math import Math
from mrmustard.physics import fock as fp
from mrmustard.physics impor... | 7,715 | 48.461538 | 105 | py |
MrMustard-develop | MrMustard-develop/tests/test_physics/test_bargmann.py | import numpy as np
from mrmustard.lab import Attenuator, Dgate, Gaussian, Ggate
from mrmustard.physics.bargmann import (
wigner_to_bargmann_Choi,
wigner_to_bargmann_psi,
wigner_to_bargmann_rho,
wigner_to_bargmann_U,
)
def test_wigner_to_bargmann_psi():
"""Test that the Bargmann representation of ... | 1,831 | 32.925926 | 94 | py |
MrMustard-develop | MrMustard-develop/tests/test_physics/test_gaussian/__init__.py | 0 | 0 | 0 | py | |
MrMustard-develop | MrMustard-develop/tests/test_physics/test_gaussian/test_gaussian_utils.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,602 | 30.361446 | 92 | py |
MrMustard-develop | MrMustard-develop/tests/test_physics/test_gaussian/test_symplectics.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 8,681 | 39.381395 | 127 | py |
MrMustard-develop | MrMustard-develop/tests/test_physics/test_fock/test_fock.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 15,809 | 37.004808 | 112 | py |
MrMustard-develop | MrMustard-develop/tests/test_utils/test_wigner.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 3,612 | 27.904 | 97 | py |
MrMustard-develop | MrMustard-develop/tests/test_utils/test_graphics.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 944 | 32.75 | 74 | py |
MrMustard-develop | MrMustard-develop/tests/test_utils/test_xptensor.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 10,810 | 38.600733 | 100 | py |
MrMustard-develop | MrMustard-develop/tests/test_utils/test_gaussian_utils.py | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,359 | 36.460317 | 92 | py |
MrMustard-develop | MrMustard-develop/tests/test_utils/test_circuitdrawer.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 3,455 | 28.538462 | 96 | py |
MrMustard-develop | MrMustard-develop/tests/test_math/test_special.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 1,305 | 32.487179 | 95 | py |
MrMustard-develop | MrMustard-develop/tests/test_math/test_compactFock.py | """
Unit tests for mrmustard.math.numba.compactFock~
"""
import numpy as np
from hypothesis import given
from hypothesis import strategies as st
from mrmustard.lab import Ggate, SqueezedVacuum, State, Vacuum
from mrmustard.math import Math
from mrmustard.physics import fidelity, normalize
from mrmustard.physics.bargma... | 4,894 | 38.16 | 133 | py |
MrMustard-develop | MrMustard-develop/tests/test_math/test_interface.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,035 | 29.848485 | 95 | py |
MrMustard-develop | MrMustard-develop/tests/test_math/test_mmtensor.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 7,421 | 35.925373 | 92 | py |
MrMustard-develop | MrMustard-develop/tests/test_math/test_lattice.py | # Copyright 2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 964 | 31.166667 | 74 | py |
MrMustard-develop | MrMustard-develop/tests/test_training/test_trainer.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 8,398 | 32.730924 | 98 | py |
MrMustard-develop | MrMustard-develop/tests/test_training/test_riemannian_opt.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 3,665 | 40.659091 | 100 | py |
MrMustard-develop | MrMustard-develop/tests/test_training/test_parameter.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,252 | 30.732394 | 89 | py |
MrMustard-develop | MrMustard-develop/tests/test_training/test_opt.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 16,618 | 32.709939 | 97 | py |
MrMustard-develop | MrMustard-develop/tests/test_training/test_parametrized.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 5,919 | 35.54321 | 89 | py |
MrMustard-develop | MrMustard-develop/tests/test_training/test_callbacks.py | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2,361 | 31.356164 | 96 | py |
MrMustard-develop | MrMustard-develop/doc/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup -----------------------... | 4,913 | 30.299363 | 97 | py |
MrMustard-develop | MrMustard-develop/doc/_ext/edit_on_github.py | """
Sphinx extension to add ReadTheDocs-style "Edit on GitHub" links to the
sidebar.
Loosely based on https://github.com/astropy/astropy/pull/347
"""
import os
import warnings
__licence__ = "BSD (3 clause)"
def get_github_url(app, view, path):
return "https://github.com/{project}/{view}/{branch}/{path}".format... | 1,210 | 25.326087 | 72 | py |
OpusTools | OpusTools-master/benchmarks.py | import time
import opustools
import cProfile
print(opustools.__path__)
from opustools import OpusRead
def printResults(**arguments):
avg_time = 0
for i in range(3):
start = time.time()
eprinter = OpusRead(**arguments)
eprinter.printPairs()
#cProfile.runctx('eprinter.printPairs... | 3,409 | 49.895522 | 142 | py |
OpusTools | OpusTools-master/opustools_pkg/setup.py | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="opustools",
version="1.5.3",
author="Mikko Aulamo",
author_email="mikko.aulamo@helsinki.fi",
description="Tools to read OPUS",
long_description=long_description,
long_description_c... | 754 | 29.2 | 61 | py |
OpusTools | OpusTools-master/opustools_pkg/tests/test_opus_langid.py | import os
import unittest
import zipfile
import shutil
import tempfile
from opustools.opus_langid import OpusLangid
class TestOpusLangid(unittest.TestCase):
@classmethod
def setUpClass(self):
self.tempdir = tempfile.mkdtemp()
with open(os.path.join(self.tempdir, 'xml_fi.xml'), 'w') as f:
... | 9,581 | 50.240642 | 93 | py |
OpusTools | OpusTools-master/opustools_pkg/tests/test_opus_read.py | import os
import unittest
from unittest import mock
import io
import sys
import xml.parsers.expat
import gzip
import shutil
import zipfile
import tempfile
import bz2
from opustools import OpusRead, OpusGet
from opustools.parse.block_parser import BlockParserError
from opustools.parse.sentence_parser import SentencePar... | 105,359 | 53.141829 | 103 | py |
OpusTools | OpusTools-master/opustools_pkg/tests/test_block_parser.py | import unittest
import tempfile
import shutil
import os
from opustools.util import file_open
from opustools.parse.block_parser import BlockParser
class TestBlockParser(unittest.TestCase):
@classmethod
def setUpClass(self):
self.tempdir = tempfile.mkdtemp()
self.xml_path = os.path.join(self.t... | 9,433 | 40.017391 | 167 | py |
OpusTools | OpusTools-master/opustools_pkg/tests/test_sentence_parser.py | import unittest
import tempfile
import shutil
import os
from opustools.parse.block_parser import BlockParser
from opustools.parse.sentence_parser import SentenceParser
from opustools.util import file_open
class TestSentenceParser(unittest.TestCase):
@classmethod
def setUpClass(self):
self.tempdir = t... | 7,103 | 40.302326 | 112 | py |
OpusTools | OpusTools-master/opustools_pkg/tests/test_opus_get.py | import sys
import io
import os
import tempfile
import shutil
import unittest
from unittest import mock
from opustools.opus_get import OpusGet
class TestOpusGet(unittest.TestCase):
@classmethod
def setUpClass(self):
self.tempdir = tempfile.mkdtemp()
self.maxDiff = None
@classmethod
de... | 4,754 | 39.29661 | 157 | py |
OpusTools | OpusTools-master/opustools_pkg/tests/__init__.py | from .test_block_parser import TestBlockParser
from .test_sentence_parser import TestSentenceParser
from .test_alignment_parser import TestAlignmentParser
from .test_opus_read import TestOpusRead, add_to_root_dir
from .test_opus_cat import TestOpusCat
from .test_opus_get import TestOpusGet
from .test_opus_langid import... | 385 | 41.888889 | 57 | py |
OpusTools | OpusTools-master/opustools_pkg/tests/test_db_operations.py | import sqlite3
import unittest
from opustools import DbOperations
#DB_FILE = 'tests/testdata.db'
#db_operations.DB_FILE = DB_FILE
class TestDbOperations(unittest.TestCase):
@classmethod
def setUpClass(self):
self.dbo = DbOperations(db_file='tests/testdata.db')
def test_get_latest_bilingual(self... | 6,543 | 43.821918 | 160 | py |
OpusTools | OpusTools-master/opustools_pkg/tests/test_opus_cat.py | import os
import sys
import io
import shutil
import tempfile
import unittest
from unittest import mock
from opustools import OpusCat
from tests import add_to_root_dir
class TestOpusCat(unittest.TestCase):
@classmethod
def setUpClass(self):
self.maxDiff = None
if ('OPUSCAT_TEST_TEMPDIR' in os... | 6,219 | 41.027027 | 79 | py |
OpusTools | OpusTools-master/opustools_pkg/tests/test_alignment_parser.py | import unittest
import tempfile
import shutil
import os
import gzip
from opustools.parse.block_parser import BlockParser
from opustools.parse.alignment_parser import AlignmentParser
from opustools.util import file_open
class TestAlignmentParser(unittest.TestCase):
@classmethod
def setUpClass(self):
s... | 3,436 | 43.064103 | 167 | py |
OpusTools | OpusTools-master/opustools_pkg/opustools/opus_cat.py | import argparse
import zipfile
import os
from .opus_get import OpusGet
from .parse.block_parser import BlockParser
from .parse.sentence_parser import SentenceParser
def parse_type(preprocessing, get_annotations):
def xml_parse(bp, block, sentence, no_ids, maximum):
if block.name == 's':
sid = ... | 7,024 | 35.780105 | 99 | py |
OpusTools | OpusTools-master/opustools_pkg/opustools/formatting.py | import html
def file_header_type(wmode, write, source_lang):
"""Select function for adding file header"""
tmxheader = ('<?xml version="1.0" encoding="utf-8"?>\n<tmx '
'version="1.4.">\n<header srclang="' + source_lang +
'"\n\tadminlang="en"\n\tsegtype="sentence"\n\tdatatype='
'"PlainT... | 13,741 | 32.517073 | 78 | py |
OpusTools | OpusTools-master/opustools_pkg/opustools/opus_read.py | import os
import re
from .parse.alignment_parser import AlignmentParser
from .parse.sentence_parser import SentenceParser, SentenceParserError
from .util import file_open
from .formatting import *
from .opus_file_handler import OpusFileHandler
def skip_regex_type(n, N):
"Select function to skip document names"
... | 12,490 | 37.912773 | 98 | py |
OpusTools | OpusTools-master/opustools_pkg/opustools/opus_file_handler.py | import os
import sys
import zipfile
from .util import file_open
from .opus_get import OpusGet
class OpusFileHandler:
def __init__(self, download_dir, source_zip, target_zip, directory,
release, preprocess, fromto, suppress_prompts):
self.directory = directory
self.release = release
... | 5,458 | 37.992857 | 83 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.