Skip to main content

No project description provided

Project description

martstelm_DE2v2.1.5

A package containing utility functions for matrix operations including transpose, 1D windowing, and 2D convolution.

Installation

You can install the package using pip:

pip install martstelm_DE2v2.1.5

Usage

Importing the Functions

from package.module import transpose2d, window1d, convolution2d

Functions

1. transpose2d

Transpose a 2D matrix.

Arguments:

  • input_matrix (List[List[float]]): A 2D list representing the matrix to be transposed.

Returns:

  • List[List[float]]: The transposed 2D list.

Example:

matrix = [
    [1, 2, 3],
    [4, 5, 6]
]

transposed_matrix = transpose2d(matrix)
print(transposed_matrix)
# Output: [[1, 4], [2, 5], [3, 6]]

2. window1d

Generate a 1D sliding window view of the input array.

Arguments:

  • input_array (Union[List, np.ndarray]): The input array.
  • size (int): The size of each window.
  • shift (int, optional): The shift between consecutive windows. Defaults to 1.
  • stride (int, optional): The stride within each window. Defaults to 1.

Returns:

  • List[Union[List, np.ndarray]]: A list of windows.

Example:

array = [1, 2, 3, 4, 5]
windows = window1d(array, size=3, shift=1)
print(windows)
# Output: [[1, 2, 3], [2, 3, 4], [3, 4, 5]]

3. convolution2d

Perform a 2D convolution on the input matrix using the given kernel.

Arguments:

  • input_matrix (np.ndarray): The input matrix.
  • kernel (np.ndarray): The convolution kernel.
  • stride (int, optional): The stride of the convolution. Defaults to 1.

Returns:

  • np.ndarray: The result of the convolution.

Example:

import numpy as np

input_matrix = np.array([
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
])

kernel = np.array([
    [1, 0],
    [0, -1]
])

convolution_result = convolution2d(input_matrix, kernel)
print(convolution_result)
# Output: [[ -4.  -4.]
#          [-4. -4.]]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mst_package-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mst_package-0.1.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file mst_package-0.1.0.tar.gz.

File metadata

  • Download URL: mst_package-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Windows/10

File hashes

Hashes for mst_package-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6f171ffd1c2af7b03df8eb259889f0887073dccc79ad5f30c9257f22b13e1335
MD5 fe7829e2e3f3ce0f80a0ec01d9f089dc
BLAKE2b-256 53b73325294e1b22b12428e9778f3c823e4ccb046347e02d0ae30ec74f74a9f2

See more details on using hashes here.

File details

Details for the file mst_package-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mst_package-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Windows/10

File hashes

Hashes for mst_package-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff5ef242d1e20e61f75fc63a1a44a7f898334acd47dbcdff3d7e7f67a3926b88
MD5 caf29d0e18f3b9814a52175f757dafa1
BLAKE2b-256 783b2adf80a18e24f02f21986cba768a9905d6f7ab1fa6ce4fbb763d1c44a3b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page