Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ it releases that version ([RELEASING.md](https://github.com/energy-models/mathsp

## Upcoming version

- feat(language): a parameter value that is null or NaN is refused when the data is attached ([#788](https://github.com/energy-models/mathspec/pull/788))
- fix(language): a where string names several columns in at's over= and into=, as an expression does ([#782](https://github.com/energy-models/mathspec/pull/782))
- fix(language): a file whose terms read each other's sums is refused at load ([#780](https://github.com/energy-models/mathspec/pull/780))
- fix(language): dual(c) is the rate at which the optimal objective rises with the right side of c, so an equality has a sign too ([#751](https://github.com/energy-models/mathspec/pull/751))
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/language/absence.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ The [grammar](expressions.md#where-strings) says what a `where:` may hold.
Nothing else creates absence. **A missing parameter row is not absence.** It
reads as the value that contributes nothing: `0` as a coefficient, and `false`
in a `where`.
A missing row is the only gap a parameter has: a null or NaN value is
[refused](declarations.md#parameters) when the data is attached.

Where no such value exists, loading is refused. There are four such positions:
a divisor, a `bounds:` entry, the whole constant side of a comparison, and a
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/language/declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ The column has to match the `dtype`:
| `bool` | a boolean column | `1` and `0` are not booleans. Cast the column |
| `str` | a string column | |

**A null or NaN value is refused** when the data is attached. A coordinate
with no value has no row. `inf` and `-inf` are values.

Only `float` and `int` are values. A `str` parameter is a label and a `bool`
parameter is a mask: each selects rows in a
[`where`](expressions.md#where-strings), and writing either as a coefficient,
Expand Down
4 changes: 3 additions & 1 deletion src/mathspec/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,9 @@ class ParameterDeclaration:

``dtype`` is what the declaration claims the values are, and a consumer
attaching data refuses a column that is not it — so the *declaration* is
what is read, rather than whatever the column happens to hold.
what is read, rather than whatever the column happens to hold. It
refuses a null or NaN value too: a coordinate with no value has no row,
and ``inf`` is a value.
"""

dims: tuple[str, ...]
Expand Down
Loading