bairstow package¶
Submodules¶
bairstow.aberth module¶
bairstow.autocorr module¶
bairstow.matrix2 module¶
- class bairstow.matrix2.Matrix2(x: Vector2, y: Vector2)[source]¶
Bases:
object- det() float[source]¶
The det function calculates the determinant of a 2x2 matrix. :return: The determinant of the matrix.
Examples
>>> m = Matrix2(Vector2(1.0, 2.0), Vector2(3.0, 4.0)) >>> print(m.det()) -2.0
- mdot(rhs: Vector2) Vector2[source]¶
The mdot function performs a matrix-vector product.
- Parameters:
rhs (Vector2) – The parameter rhs is a Vector2 object that represents the right-hand side vector in the matrix-vector product
- Returns:
The method mdot returns a Vector2 object.
Examples
>>> m = Matrix2(Vector2(1.0, 2.0), Vector2(3.0, 4.0)) >>> print(m.mdot(Vector2(5.0, 6.0))) <17.0, 39.0>
- property x¶
The function returns the value of the private variable _x. :return: The property x is returning the value of the private variable _x.
Examples
>>> m = Matrix2(Vector2(1.0, 2.0), Vector2(3.0, 4.0)) >>> print(m.x) <1.0, 2.0>
- property y¶
The function returns the value of the private variable _y. :return: The property y is returning the value of the private variable _y.
Examples
>>> m = Matrix2(Vector2(1.0, 2.0), Vector2(3.0, 4.0)) >>> print(m.y) <3.0, 4.0>
bairstow.robin module¶
- class bairstow.robin.Robin(num_parts: int)[source]¶
Bases:
objectRound Robin
The Robin class implements a round-robin algorithm for cycling through a list of parts, and the exclude method returns an iterator starting from a specified part.
- exclude(from_part: int) RobinIterator[source]¶
The exclude function returns a RobinIterator object that excludes a specified part of a cycle.
- Parameters:
from_part (int) – The from_part parameter is an integer that represents the starting index of the cycle that should be excluded
- Returns:
The exclude method is returning a RobinIterator object.
Examples
>>> r = Robin(5) >>> iter = r.exclude(3) >>> iter.cur.data == 3 True >>> iter.stop.data == 3 True
- class bairstow.robin.RobinIterator(node: SlNode)[source]¶
Bases:
objectThe RobinIterator class is an iterator that iterates over a singly linked list starting from a given node.
bairstow.rootfinding module¶
bairstow.skeleton module¶
This is a skeleton file that can serve as a starting point for a Python
console script. To run this script uncomment the following lines in the
[options.entry_points] section in setup.cfg:
console_scripts =
fibonacci = bairstow.skeleton:run
Then run pip install . (or pip install -e . for editable mode)
which will install the command fibonacci inside your current environment.
Besides console scripts, the header (i.e. until _logger…) of this file can
also be used as template for Python modules.
Note
This file can be renamed depending on your needs or safely removed if not needed.
References
- bairstow.skeleton.main(args)[source]¶
Wrapper allowing
fib()to be called with string arguments in a CLI fashionInstead of returning the value from
fib(), it prints the result to thestdoutin a nicely formatted message.- Parameters:
args (List[str]) – command line parameters as list of strings (for example
["--verbose", "42"]).
- bairstow.skeleton.parse_args(args)[source]¶
Parse command line parameters
- Parameters:
args (List[str]) – command line parameters as list of strings (for example
["--help"]).- Returns:
command line parameters namespace
- Return type:
bairstow.vector2 module¶
- class bairstow.vector2.Vector2(x, y)[source]¶
Bases:
object- dot(rhs)[source]¶
The dot function calculates the dot product of two vectors.
- Parameters:
rhs – rhs is the right-hand side vector that we want to calculate the dot product with
- Returns:
The dot product of the two vectors.
Examples
>>> v1 = Vector2(1, 2) >>> v2 = Vector2(3, 4) >>> v1.dot(v2) 11
- property x¶
The function returns the value of the private variable _x. :return: The property x is returning the value of the private variable _x.
- property y¶
The function returns the value of the private variable _y. :return: The method y is returning the value of the attribute _y.