Skip to content

Commit 9fb84cb

Browse files
authored
Merge pull request #1120 from murrayrm/userguide-22Dec2024
add information on _ssmatrix, _check_shape
2 parents 11d753f + 875cc30 commit 9fb84cb

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

README.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ from the github repository or archive, unpack, and run from within the
110110
toplevel `python-control` directory::
111111

112112
pip install .
113-
113+
114114
Article and Citation Information
115115
================================
116116

@@ -129,7 +129,6 @@ the library is available on IEEE Explore. If the Python Control Systems Library
129129

130130
or the GitHub site: https://github.com/python-control/python-control
131131

132-
133132
Development
134133
===========
135134

@@ -178,4 +177,3 @@ Your contributions are welcome! Simply fork the GitHub repository and send a
178177
Please see the `Developer's Wiki`_ for detailed instructions.
179178

180179
.. _Developer's Wiki: https://github.com/python-control/python-control/wiki
181-

control/mateqn.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,33 @@ def _slycot_or_scipy(method):
606606

607607
# Utility function to check matrix dimensions
608608
def _check_shape(M, n, m, square=False, symmetric=False, name="??"):
609+
"""Check the shape and properties of a 2D array.
610+
611+
This function can be used to check to make sure a 2D array_like has the
612+
right shape, along with other properties. If not, an appropriate error
613+
message is generated.
614+
615+
Parameters
616+
----------
617+
M : array_like
618+
Array to be checked.
619+
n : int
620+
Expected number of rows.
621+
m : int
622+
Expected number of columns.
623+
square : bool, optional
624+
If True, check to make sure the matrix is square.
625+
symmetric : bool, optional
626+
If True, check to make sure the matrix is symmetric.
627+
name : str
628+
Name of the matrix (for use in error messages).
629+
630+
Returns
631+
-------
632+
M : 2D array
633+
Input array, converted to 2D if needed.
634+
635+
"""
609636
M = np.atleast_2d(M)
610637

611638
if (square or symmetric) and M.shape[0] != M.shape[1]:

control/statesp.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,13 +2269,15 @@ def _parse_list(signals, signame='input', prefix='u'):
22692269
def _ssmatrix(data, axis=1, square=None, rows=None, cols=None, name=None):
22702270
"""Convert argument to a (possibly empty) 2D state space matrix.
22712271
2272-
The axis keyword argument makes it convenient to specify that if the
2273-
input is a vector, it is a row (axis=1) or column (axis=0) vector.
2272+
This function can be used to process the matrices that define a
2273+
state-space system. The axis keyword argument makes it convenient
2274+
to specify that if the input is a vector, it is a row (axis=1) or
2275+
column (axis=0) vector.
22742276
22752277
Parameters
22762278
----------
22772279
data : array, list, or string
2278-
Input data defining the contents of the 2D array
2280+
Input data defining the contents of the 2D array.
22792281
axis : 0 or 1
22802282
If input data is 1D, which axis to use for return object. The
22812283
default is 1, corresponding to a row matrix.

doc/develop.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,9 @@ processing and parsing operations:
629629
exception.pandas_check
630630
exception.slycot_check
631631
iosys._process_iosys_keywords
632+
mateqn._check_shape
632633
statesp._convert_to_statespace
634+
statesp._ssmatrix
633635
xferfcn._convert_to_transfer_function
634636

635637

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy