-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: Change datatypes of A matrices in linprog #9362
Conversation
* Change datatype of ``A_ub`` from ``1D array`` to ``2D array`` * Change dataype of ``A_eq`` from ``array_like`` to ``2D array`` * Add full description of tableau ``T`` in simplex method * Shorten descriptions of ``A_ub``, ``A_eq`` and ``A``
scipy/optimize/_linprog.py
Outdated
2D array which, when matrix-multiplied by ``x``, gives the values of | ||
the upper-bound inequality constraints at ``x``. | ||
A_ub : 2D array, optional | ||
2D array such that ``A_ub`` @ ``x`` gives the values of the upper-bound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @
sign doesn't render well in the docs between two code markups. But it is my subjective view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole expression A @ x
is code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ilayn I thought the convention is to mark variables as variable_name
? Looking at the picture I agree it looks odd. If you think it's worth rewriting I can do it tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the relevant guidelines are:
https://numpydoc.readthedocs.io/en/latest/format.html
http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
The double-backtick quotes I think for the most part are used for inline code samples, which A_ub @ x
in principle is.
Also note that the tableau table code should probably be put in a multiline literal block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the numpy guidelines:
Enclose variables in single backticks.
So, technically, this should be: A
@ x
, right? To me A @ x
still looks better/readable and worth going back and changing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes since you are referring to a math expression rather than the individual variables involved, I guess A @ x
would be clearer. But again, just a suggestion, I don't have a strong opinion.
Since we are at it, the return parameter in scipy/scipy/optimize/_linprog.py Line 260 in 120caab
doesn't have an argument and hence marks the whole sentence as the output type argument. Maybe something like
with a clickable link can be more informative. |
@ilayn do you think we can merge this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that the _ub
variables have A_ub @ x
in their docstrings but _eq
variables A_eq
@ x
. Is that a copy/paste slip or they have different meanings? I think I didn't get that point.
But if we are happy with those, it is good to go. Please go ahead and merge. They look good to me.
scipy/optimize/_linprog.py
Outdated
the equality constraints at ``x``. | ||
b_eq : array_like, optional | ||
A_eq : 2D, optional | ||
2D array such that ``A_eq`` @ ``x`` gives the values of the equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting of @
scipy/optimize/_linprog_util.py
Outdated
2D array such that ``A_ub @ x`` gives the values of the upper-bound | ||
inequality constraints at ``x``. | ||
A_eq : 2D array, optional | ||
2D array such that ``A_eq`` @ ``x`` gives the values of the equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting of @
scipy/optimize/_linprog_util.py
Outdated
2D array such that ``A_ub @ x`` gives the values of the upper-bound | ||
inequality constraints at ``x``. | ||
A_eq : 2D array, optional | ||
2D array such that ``A_eq`` @ ``x`` gives the values of the equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting of @
scipy/optimize/_linprog_util.py
Outdated
the equality constraints at ``x``. | ||
b_eq : array_like, optional | ||
A_eq : 2D array, optional | ||
2D array such that ``A_eq`` @ ``x`` gives the values of the equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting of @
scipy/optimize/_linprog_util.py
Outdated
the equality constraints at ``x``. | ||
b_eq : 1D array | ||
A_eq : 2D array, optional | ||
2D array such that ``A_eq`` @ ``x`` gives the values of the equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting of @
scipy/optimize/_linprog_util.py
Outdated
the equality constraints at ``x``. | ||
b_eq : array_like | ||
A_eq : 2D array, optional | ||
2D array such that ``A_eq`` @ ``x`` gives the values of the equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting of @
scipy/optimize/_linprog_util.py
Outdated
the equality constraints at ``x``. | ||
b_eq : array_like, optional | ||
A_eq : 2D array, optional | ||
2D array such that ``A_eq`` @ ``x`` gives the values of the equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting of @
scipy/optimize/_linprog_util.py
Outdated
b_eq : 1D array | ||
constraint (row) in ``A_ub``. | ||
A_eq : 2D array, optional | ||
2D array such that ``A_eq`` @ ``x`` gives the values of the equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting of @
scipy/optimize/_linprog_util.py
Outdated
1D array of values representing the upper-bound of each inequality | ||
constraint (row) in ``A_ub``. | ||
A_eq : 2D array, optional | ||
2D array such that ``A_eq`` @ ``x`` gives the values of the equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting of @
scipy/optimize/_linprog_util.py
Outdated
1D array of values representing the upper-bound of each inequality | ||
constraint (row) in ``A_ub``. | ||
A_eq : 2D array, optional | ||
2D array such that ``A_eq`` @ ``x`` gives the values of the equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting of @
@ilayn Yes, that was a copy paste slip, I've changed it now and will merge once the tests pass. |
The Travis failure is not related and is due to #9190 that uses |
I've just restarted the failing case to make sure it wasn't a hiccup of some sort. |
closes #9323
A_ub
from1D array
to2D array
A_eq
fromarray_like
to2D array
T
in simplex methodA_ub
,A_eq
andA