mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
ad9948d5d4
* Adding new implementation Adding my python implementation of Gaussian Elimination pivoting as a numerical linear algebra algorithm * Delete linear_algebra/src/GaussianEliminationpivoting.py * Adding new implementation Adding my python implementation of Gaussian Elimination pivoting as a numerical linear algebra algorithm * Delete linear_algebra/src/gaussianeliminationpivoting.py * Adding new implementation Adding my python implementation of Gaussian Elimination pivoting as a numerical linear algebra algorithm for the third time because the last two times had conflict with the rules in PR * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Delete linear_algebra/src/gaussianeliminationpivoting.py * Adding gaussianeliminationpivoting.py Adding my python implementation of Gaussian Elimination pivoting as a numerical linear algebra algorithm for the fourth time because the last three times had conflict with the rules in PR and bots * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussianeliminationpivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussianeliminationpivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussianeliminationpivoting.py I changed a to matrix and coeff_matrix for better clarity * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussianeliminationpivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussianeliminationpivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussianeliminationpivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update and rename gaussianeliminationpivoting.py to gaussian_elimination_pivoting.py renamed the file * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * Delete linear_algebra/src/gaussian_elimination_pivoting.py * Add files via upload * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Delete linear_algebra/src/gaussian_elimination_pivoting/text.py * Add files via upload * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update linear_algebra/src/gaussian_elimination_pivoting/gaussian_elimination_pivoting.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * Update gaussian_elimination_pivoting.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com> |
||
---|---|---|
.. | ||
src | ||
__init__.py | ||
gaussian_elimination.py | ||
jacobi_iteration_method.py | ||
lu_decomposition.py | ||
README.md |
Linear algebra library for Python
This module contains classes and functions for doing linear algebra.
Overview
class Vector
-
- This class represents a vector of arbitrary size and related operations.
Overview of the methods:
- constructor(components) : init the vector
- set(components) : changes the vector components.
- __str__() : toString method
- component(i): gets the i-th component (0-indexed)
- __len__() : gets the size / length of the vector (number of components)
- euclidean_length() : returns the eulidean length of the vector
- operator + : vector addition
- operator - : vector subtraction
- operator * : scalar multiplication and dot product
- copy() : copies this vector and returns it
- change_component(pos,value) : changes the specified component
-
function zero_vector(dimension)
- returns a zero vector of 'dimension'
-
function unit_basis_vector(dimension, pos)
- returns a unit basis vector with a one at index 'pos' (0-indexed)
-
function axpy(scalar, vector1, vector2)
- computes the axpy operation
-
function random_vector(N, a, b)
- returns a random vector of size N, with random integer components between 'a' and 'b' inclusive
class Matrix
-
- This class represents a matrix of arbitrary size and operations on it.
Overview of the methods:
- __str__() : returns a string representation
- operator * : implements the matrix vector multiplication implements the matrix-scalar multiplication.
- change_component(x, y, value) : changes the specified component.
- component(x, y) : returns the specified component.
- width() : returns the width of the matrix
- height() : returns the height of the matrix
- determinant() : returns the determinant of the matrix if it is square
- operator + : implements the matrix-addition.
- operator - : implements the matrix-subtraction
-
function square_zero_matrix(N)
- returns a square zero-matrix of dimension NxN
-
function random_matrix(W, H, a, b)
- returns a random matrix WxH with integer components between 'a' and 'b' inclusive
Documentation
This module uses docstrings to enable the use of Python's in-built help(...)
function.
For instance, try help(Vector)
, help(unit_basis_vector)
, and help(CLASSNAME.METHODNAME)
.
Usage
Import the module lib.py
from the src directory into your project.
Alternatively, you can directly use the Python bytecode file lib.pyc
.
Tests
src/tests.py
contains Python unit tests which can be run with python3 -m unittest -v
.