You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
-
# BlockTensor
1
+
# BlockArray
2
2
3
-
BlockTensor is a package for working with tensors logically partitioned into blocks (or subtensors) in a nested format. For example, block matrices and block vectors can be created as:
3
+
BlockArray is a package for working with tensors logically partitioned into blocks (or subtensors) in a nested format. For example, block matrices and block vectors can be created as:
4
4
```python
5
-
fromblocktensor.tensor importBlockTensor
6
-
fromblocktensor.linalg import mult_mat_vec
5
+
fromBlockArray.tensor importBlockArray
6
+
fromBlockArray.linalg import mult_mat_vec
7
7
8
8
# model the block vector
9
9
# [x0, x1]
10
10
# where x0 = np.array([1, 2, 3])
11
11
# x1 = np.array([4, 5])
12
-
x =BlockTensor([np.array([1, 2, 3]), np.array([4, 5])])
12
+
x =BlockArray([np.array([1, 2, 3]), np.array([4, 5])])
`BlockTensor` has two main attributes: an underlying `LabelledArray` that stores the subtensors in an n-d layout and a `bshape` attributes that stores the shape of the blocks along each axis.
76
+
`BlockArray` has two main attributes: an underlying `LabelledArray` that stores the subtensors in an n-d layout and a `bshape` attributes that stores the shape of the blocks along each axis.
77
77
78
-
For example, consider a `BlockTensor` `A` with the block shape `((10, 5), (2, 4))`.
78
+
For example, consider a `BlockArray` `A` with the block shape `((10, 5), (2, 4))`.
79
79
This represents a matrix with blocks of size 10 and 5 along the rows, and blocks of size 2 and 4 along the columns. Subtensors of `A` would then have shapes:
Copy file name to clipboardExpand all lines: docs/source/intro.rst
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
Introduction
3
3
************
4
4
5
-
This package provides a ``BlockTensor`` object that makes it easier to work with tensors that are logically divided into multiple blocks or subtensors.
6
-
The basic usage of the ``BlockTensor`` is illustrated below for the case of a block matrix and block vector::
5
+
This package provides a ``BlockArray`` object that makes it easier to work with tensors that are logically divided into multiple blocks or subtensors.
6
+
The basic usage of the ``BlockArray`` is illustrated below for the case of a block matrix and block vector::
7
7
8
8
import numpy as np
9
-
from blocktensor.tensor import BlockTensor
9
+
from blocktensor.tensor import BlockArray
10
10
11
11
# `A` is a block representation of the matrix
12
12
# [[1, 2, 3],
@@ -24,15 +24,15 @@ The basic usage of the ``BlockTensor`` is illustrated below for the case of a bl
24
24
[[7, 8]])
25
25
A11 = np.array(
26
26
[[9]])
27
-
A = BlockTensor([[A00, A01], [A10, A11]], labels=(('a', 'b'), ('a', 'b')))
27
+
A = BlockArray([[A00, A01], [A10, A11]], labels=(('a', 'b'), ('a', 'b')))
28
28
29
29
30
30
# `X` is a block representation of the vector
31
31
# [1, 2, 3]
32
32
# the first block is labelled 'a' and the second 'b'
33
33
X0 = np.array([1, 2])
34
34
X1 = np.array([3])
35
-
X = BlockTensor([X0, X1], labels=(('a', 'b'),))
35
+
X = BlockArray([X0, X1], labels=(('a', 'b'),))
36
36
37
37
In the above example, the matrix ``A`` is represented by 2 row blocks (with corresponding submatrix row sizes 2 and 1) and 2 column blocks (with corresponding submatrix column sizes 2 and 1) while the vector ``X`` is represented with two row blocks (with corresponding subvector sizes 2 and 1).
38
38
Blocks of ``A`` and ``X`` are also labelled; labels are useful to organize blocks since blocks often represent different different systems.
@@ -47,9 +47,9 @@ Indexing block tensors works similarly to indexing in ``numpy`` with some additi
47
47
* ``tensor[0]`` returns subtensor ``a``
48
48
* ``tensor[-1]`` returns subtensor ``c``
49
49
* range of indices by slice
50
-
* ``tensor[0:2]`` returns a ``BlockTensor`` with subtensors ``(a, b)``
51
-
* ``tensor[:]`` returns the same ``BlockTensor`` as ``tensor``
50
+
* ``tensor[0:2]`` returns a ``BlockArray`` with subtensors ``(a, b)``
51
+
* ``tensor[:]`` returns the same ``BlockArray`` as ``tensor``
52
52
* range of indices by list of single indices
53
-
* ``tensor[['a', 'b']]`` returns a ``BlockTensor`` with subtensors ``(a, b)``
54
-
* ``tensor[[0, 1]]`` returns a ``BlockTensor`` with subtensors ``(a, b)``
55
-
* ``tensor[[0, -1]]`` returns a ``BlockTensor`` with subtensors ``(a, c)``
53
+
* ``tensor[['a', 'b']]`` returns a ``BlockArray`` with subtensors ``(a, b)``
54
+
* ``tensor[[0, 1]]`` returns a ``BlockArray`` with subtensors ``(a, b)``
55
+
* ``tensor[[0, -1]]`` returns a ``BlockArray`` with subtensors ``(a, c)``
0 commit comments