semvec/pypi-packages huggingface dataset:
nullity 0.0.5
A package for all things linear algebra
Keywords: linear, algebra, linear algebra, linalg, lin-alg, linearalgebra, eigen, eigenvalue, eigenvector, nullity, null, null space, rank nullity

# nullity

A Python package for all things linear algebra, built in vanilla python3  
Built during MAT-1001 / Linear Algebra at Ashoka University.

## Installation

The package is available on PyPI:

```ps
pip install nullity
```

To start using, simply import the package in your Python file:

```py
from nullity import Matrix
```

## Usage

**Instantiation**  

```py
m = Matrix(m, n, *args)
```

The matrix must be instantiated by first passing in the number of rows (m), then the number of columns (n), and finally the m*n values of the matrix separated by commas.  

These values are arranged first in rows and then in columns.  
For example:

```py
>>> m = Matrix(2, 3, 1, 2, 3, 4, 5, 6)
>>> print(m)

      1.00       2.00       3.00
      4.00       5.00       6.00

```

**Methods**  

| Function | Output |
| --- | --- |
| `nrows` | Number of rows |
| `ncolumns` | Number of columns |
| `is_square` | Whether the matrix is square |
| `rref` | RREF of the matrix |
| `rank` | Rank of the matrix |
| `nullity` | Nullity (dimension of the null space) of the matrix |
| `is_invertible` | Whether the matrix is invertible |
| `inverse` | Inverse of the invertible matrix |
| `rank_factorization` | The two rank factorized matrices `r` and `c` |
| `row_basis` | Basis of the row space |
| `col_basis` | Basis of the column space |
| `null_basis` | Basis of the null space |
| `transpose` | Transpose of the matrix |
| `plu` | PLU decomposed matrices `p`, `l`, and `u` |
| `det` | Determinant of a square matrix |
| `qr` | QR decomposed matrices `q` and `r` |
| `charpol` | Characteristic polynomial of the matrix |
| `eigenvals` | Eigenvalues of the matrix (from numpy) |
| `eigenvecs` | Eigenvectors corresponding to the respective eigenvalues |
| `svd` | Singular value decomposed matrices `u`, `sigma`, and `v_transpose` |

Along with these, addition and multiplication of 2 matrices is also supprted using the inbuilt operators `+` and `*` respectively.

## Issues

Python's decimal arithmetic often results in incorrect answers. In some cases, approximated output might be sufficient, however in others, errors may be raised.
simple-switch 0.2.0
A simple and flexible switch statement implementation for Python.
Keywords: python, conditional, logic, switch, case, if-else, if, else

# Switch

## Introduction

Switch is a Python library that provides a simple and flexible switch statement implementation. It allows you to write cleaner and more readable code by eliminating the need for long chains of if-else statements.

## Usage
The switch library provides a Switch class that can be used to create switch statements. The Switch class takes a value as an argument, which is the value to be compared against the cases.

The case method takes a condition as an argument. If the condition evaluates to True, the corresponding function is executed. The default method is executed if no match is found.

### Here is an example of how to use the Switch class:
```rb
from switch import Switch

with Switch(1) as s:
    if s.case(s.value == 1):
        pass
    if s.case(s.value == 2):
        pass
    if s.case(s.value == 3):
        print("1, 2, 3!!")
        raise Break()  # Exit the Switch context
    if s.case(s.value == 4):
        print("Won't see this... :(")
    if s.default:
        print('default')
```

## Features:
  - Simple and intuitive syntax
  - Flexible conditions
  - Support for multiple cases
  - Default case handling
  - Exception handling for breaking out of the switch statement
  
## Benefits:
  - Improved code readability
  - Reduced code complexity
  - Easier to maintain and debug
  
## Conclusion:
The switch library is a valuable tool for any Python developer who wants to write cleaner and more readable code. It is a simple and flexible way to implement switch statements in Python.