Skip to content

Commit

Permalink
Refactor imports from math
Browse files Browse the repository at this point in the history
  • Loading branch information
adtzlr committed Feb 28, 2024
1 parent 97e00e3 commit 35d172f
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 127 deletions.
2 changes: 1 addition & 1 deletion src/tensortrax/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""

__version__ = "0.17.1"
__version__ = "0.18.0"
12 changes: 3 additions & 9 deletions src/tensortrax/_evaluate.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
r"""
_
| | ████████╗██████╗ █████╗ ██╗ ██╗
| |_ ___ _ __ ___ ___ _ __╚══██╔══╝██╔══██╗██╔══██╗╚██╗██╔╝
| __/ _ \ '_ \/ __|/ _ \| '__| ██║ ██████╔╝███████║ ╚███╔╝
| || __/ | | \__ \ (_) | | ██║ ██╔══██╗██╔══██║ ██╔██╗
\__\___|_| |_|___/\___/|_| ██║ ██║ ██║██║ ██║██╔╝ ██╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
"""
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""

from copy import copy
Expand All @@ -15,7 +9,7 @@
from joblib import Parallel, cpu_count, delayed

from ._tensor import Tensor, Δδ, broadcast_to, f, δ
from .math._special import from_triu_1d, from_triu_2d, triu_1d
from .math.special import from_triu_1d, from_triu_2d, triu_1d


def take(fun, item=0):
Expand Down
10 changes: 2 additions & 8 deletions src/tensortrax/_helpers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
r"""
_
| | ████████╗██████╗ █████╗ ██╗ ██╗
| |_ ___ _ __ ___ ___ _ __╚══██╔══╝██╔══██╗██╔══██╗╚██╗██╔╝
| __/ _ \ '_ \/ __|/ _ \| '__| ██║ ██████╔╝███████║ ╚███╔╝
| || __/ | | \__ \ (_) | | ██║ ██╔══██╗██╔══██║ ██╔██╗
\__\___|_| |_|___/\___/|_| ██║ ██║ ██║██║ ██║██╔╝ ██╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
"""
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""


Expand Down
10 changes: 2 additions & 8 deletions src/tensortrax/_tensor.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
r"""
_
| | ████████╗██████╗ █████╗ ██╗ ██╗
| |_ ___ _ __ ___ ___ _ __╚══██╔══╝██╔══██╗██╔══██╗╚██╗██╔╝
| __/ _ \ '_ \/ __|/ _ \| '__| ██║ ██████╔╝███████║ ╚███╔╝
| || __/ | | \__ \ (_) | | ██║ ██╔══██╗██╔══██║ ██╔██╗
\__\___|_| |_|___/\___/|_| ██║ ██║ ██║██║ ██║██╔╝ ██╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
"""
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""

from copy import deepcopy
Expand Down
13 changes: 3 additions & 10 deletions src/tensortrax/math/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
r"""
_
| | ████████╗██████╗ █████╗ ██╗ ██╗
| |_ ___ _ __ ___ ___ _ __╚══██╔══╝██╔══██╗██╔══██╗╚██╗██╔╝
| __/ _ \ '_ \/ __|/ _ \| '__| ██║ ██████╔╝███████║ ╚███╔╝
| || __/ | | \__ \ (_) | | ██║ ██╔══██╗██╔══██║ ██╔██╗
\__\___|_| |_|___/\___/|_| ██║ ██║ ██║██║ ██║██╔╝ ██╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
"""
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""

from .._tensor import broadcast_to, dual2real, ravel, reshape, squeeze
from . import _linalg as linalg
from . import _math_array as base
from . import _special as special
from . import linalg, special
from ._math_tensor import (
abs,
array,
Expand Down
16 changes: 0 additions & 16 deletions src/tensortrax/math/_linalg/__init__.py

This file was deleted.

11 changes: 2 additions & 9 deletions src/tensortrax/math/_math_array.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
r"""
_
| | ████████╗██████╗ █████╗ ██╗ ██╗
| |_ ___ _ __ ___ ___ _ __╚══██╔══╝██╔══██╗██╔══██╗╚██╗██╔╝
| __/ _ \ '_ \/ __|/ _ \| '__| ██║ ██████╔╝███████║ ╚███╔╝
| || __/ | | \__ \ (_) | | ██║ ██╔══██╗██╔══██║ ██╔██╗
\__\___|_| |_|___/\___/|_| ██║ ██║ ██║██║ ██║██╔╝ ██╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
"""

tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""
import numpy as np

from .._tensor import Tensor, f
Expand Down
11 changes: 2 additions & 9 deletions src/tensortrax/math/_math_tensor.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
r"""
_
| | ████████╗██████╗ █████╗ ██╗ ██╗
| |_ ___ _ __ ___ ___ _ __╚══██╔══╝██╔══██╗██╔══██╗╚██╗██╔╝
| __/ _ \ '_ \/ __|/ _ \| '__| ██║ ██████╔╝███████║ ╚███╔╝
| || __/ | | \__ \ (_) | | ██║ ██╔══██╗██╔══██║ ██╔██╗
\__\___|_| |_|___/\___/|_| ██║ ██║ ██║██║ ██║██╔╝ ██╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
"""

tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""
import numpy as np

from .._tensor import Tensor, Δ, Δδ, broadcast_to, einsum, f, matmul, δ
Expand Down
31 changes: 0 additions & 31 deletions src/tensortrax/math/_special/__init__.py

This file was deleted.

10 changes: 10 additions & 0 deletions src/tensortrax/math/linalg/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""

from ._linalg_array import det as _det
from ._linalg_array import inv as _inv
from ._linalg_array import pinv as _pinv
from ._linalg_tensor import det, eigh, eigvalsh, expm, inv, pinv

__all__ = ["_det", "_inv", "_pinv", "det", "eigh", "eigvalsh", "expm", "inv", "pinv"]
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
r"""
_
| | ████████╗██████╗ █████╗ ██╗ ██╗
| |_ ___ _ __ ___ ___ _ __╚══██╔══╝██╔══██╗██╔══██╗╚██╗██╔╝
| __/ _ \ '_ \/ __|/ _ \| '__| ██║ ██████╔╝███████║ ╚███╔╝
| || __/ | | \__ \ (_) | | ██║ ██╔══██╗██╔══██║ ██╔██╗
\__\___|_| |_|___/\___/|_| ██║ ██║ ██║██║ ██║██╔╝ ██╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
"""
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""

import numpy as np
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
r"""
_
| | ████████╗██████╗ █████╗ ██╗ ██╗
| |_ ___ _ __ ___ ___ _ __╚══██╔══╝██╔══██╗██╔══██╗╚██╗██╔╝
| __/ _ \ '_ \/ __|/ _ \| '__| ██║ ██████╔╝███████║ ╚███╔╝
| || __/ | | \__ \ (_) | | ██║ ██╔══██╗██╔══██║ ██╔██╗
\__\___|_| |_|___/\___/|_| ██║ ██║ ██║██║ ██║██╔╝ ██╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
"""
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""


import numpy as np

from ..._tensor import Tensor, Δ, Δδ, einsum, f, matmul, δ
from .._math_tensor import exp, sum, transpose
from .._special._special_tensor import ddot
from ..special._special_tensor import ddot
from . import _linalg_array as linalg

dot = matmul
Expand Down
25 changes: 25 additions & 0 deletions src/tensortrax/math/special/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""

from ._special_tensor import (
ddot,
dev,
from_triu_1d,
from_triu_2d,
sym,
tresca,
triu_1d,
von_mises,
)

__all__ = [
"ddot",
"dev",
"from_triu_1d",
"from_triu_2d",
"sym",
"tresca",
"triu_1d",
"von_mises",
]
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
r"""
_
| | ████████╗██████╗ █████╗ ██╗ ██╗
| |_ ___ _ __ ___ ___ _ __╚══██╔══╝██╔══██╗██╔══██╗╚██╗██╔╝
| __/ _ \ '_ \/ __|/ _ \| '__| ██║ ██████╔╝███████║ ╚███╔╝
| || __/ | | \__ \ (_) | | ██║ ██╔══██╗██╔══██║ ██╔██╗
\__\___|_| |_|___/\___/|_| ██║ ██║ ██║██║ ██║██╔╝ ██╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
"""
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""

import numpy as np

from ..._tensor import Tensor
from .. import _math_array as array
from .._linalg import _linalg_tensor as linalg
from .._math_tensor import einsum, sqrt, trace, transpose
from ..linalg import _linalg_tensor as linalg


def ddot(A, B):
Expand Down

0 comments on commit 35d172f

Please sign in to comment.