Skip to content

Commit 2bf51a0

Browse files
committed
notes
1 parent b01b9ea commit 2bf51a0

4 files changed

Lines changed: 4 additions & 136 deletions

File tree

docs/en/releases/unreleased.ipynb

Lines changed: 1 addition & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/ja/releases/unreleased.ipynb

Lines changed: 1 addition & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

markdowns/en/releases/unreleased.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,7 @@ def problem(problem):
5454
problem
5555
```
5656

57-
Comprehensions used with `jm.genarray` MUST satisfy the following conditions:
58-
59-
1. It must be a **generator expression** enclosed in parentheses (or omitted). List comprehensions enclosed in `[ ]` are not supported.
60-
2. The `for` clause must be a single loop of the form `for p in e`, where `e` is a natural-number expression or tuple expression of natural numbers, and `p` is a pattern.
61-
+ `p` may be any pattern that matches `e`.
62-
57+
Only one `for .. in ...` clause is allowed in a `genarray` comprehension.
6358
The following is an example that raises an error because it uses multiple `for` clauses:
6459

6560
```{code-cell} ipython3
@@ -76,25 +71,6 @@ except SyntaxError as e:
7671
print(str(e))
7772
```
7873

79-
Also, the right-hand side of `in` in `genarray` specifies only the shape.
80-
In particular, be careful not to use `jm.product` as shown below, because it creates a set and results in an error:
81-
82-
```{code-cell} ipython3
83-
try:
84-
85-
@jm.Problem.define("genarray example")
86-
def _(problem):
87-
N = problem.Natural()
88-
M = problem.Natural()
89-
a = problem.Float(shape=(N, M))
90-
x = problem.BinaryVar(shape=N)
91-
Sums = problem.NamedExpr(
92-
jm.genarray(a[i, j] * x[i] for i, j in jm.product(N, M))
93-
)
94-
except Exception as e:
95-
print(str(e))
96-
```
97-
9874
### Support for `min` / `max` along axes
9975

10076
Previously, {py:func}`jm.sum <jijmodeling.sum>` and {py:meth}`Expression.sum <jijmodeling.Expression.sum>` supported taking sums along a specific axis of a multidimensional array via the `axis` keyword argument.

markdowns/ja/releases/unreleased.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,7 @@ def problem(problem):
5454
problem
5555
```
5656

57-
`jm.genarray` で使える内包表記は以下の条件に従う必要があります:
58-
59-
1. 丸括弧で囲まれた**ジェネレータ式**であること。 `[ ]` で囲まれたリスト内包表記は利用できません。
60-
2. `for` 部は自然数式または自然数のタプル式 `e` パターン `p` に対し、 `for p in e` の形の単一のループであること。
61-
+ `p``E` に合致するパターンであれば何でも構いません。
62-
57+
`genarray` の内包表記では、`for .. in ...` は一つしか許容されません。
6358
以下は、複数の `for`-節を使ってしまい、エラーになっている例です:
6459

6560
```{code-cell} ipython3
@@ -76,25 +71,6 @@ except SyntaxError as e:
7671
print(str(e))
7772
```
7873

79-
また、`genarray``in` の右辺はあくまでもシェイプを指定するものです。
80-
特に、以下のように`jm.product` を使ってしまうと集合になってしまい、エラーとなるので注意してください:
81-
82-
```{code-cell} ipython3
83-
try:
84-
85-
@jm.Problem.define("genarray example")
86-
def _(problem):
87-
N = problem.Natural()
88-
M = problem.Natural()
89-
a = problem.Float(shape=(N, M))
90-
x = problem.BinaryVar(shape=N)
91-
Sums = problem.NamedExpr(
92-
jm.genarray(a[i, j] * x[i] for i, j in jm.product(N, M))
93-
)
94-
except Exception as e:
95-
print(str(e))
96-
```
97-
9874
## 軸に沿った `min` / `max` のサポート
9975

10076
旧来は {py:func}`jm.sum <jijmodeling.sum>` や {py:meth}`Expression.sum <jijmodeling.Expression.sum>` では `axis` キーワード引数により、多次元配列の特定の軸に沿った和を取ることができましたが、今回のバージョンからは {py:func}`jm.min <jijmodeling.min>` と {py:func}`jm.max <jijmodeling.max>`(そしてその対応する `Expression` メソッド)にも同様の機能が追加されました。

0 commit comments

Comments
 (0)