Skip to main content

A python module to create random matrices.

Project description

PyPI - Version PyPI - License PyPI - Downloads Publish PyPi CI

pymatroh

With the pymatroh module you can create different kind of matrices for testing purposes.

Table of contents

  1. Introduction
  2. Getting started
    1. Prerequisites
    2. Installation
  3. How to use
    1. How to import
    2. Using the module
    3. Using the cli
  4. Releasing
  5. License

Introduction

The intention of this module is to create matrices of different kinds for testing purposes.

You can create only integer matrices, float or complex matrices. Mixing these values is currently not implemented.

Getting started

Prerequisites

  • Python installed
  • Operatingsystem: Linux or Windows, not tested on mac
  • IDE like VS Code, if you want to contribute or change the code

Installation

There are two ways to install this module depending on the way you work and the preinstalled modules:

  1. pip install pymatroh

  2. python -m pip install pymatroh

How to use

How to Import

You can import the module in two ways:

import pymatroh
  • This will import all functions. Even the ones that are not supposed to be used.
from pymatroh import *
  • This will import only the significant functions, meant for using.

Using the module

Depending on the way you imported the module, the following examples look a bit different.

Example 1: Using import <modulename>

# Import module.
import pymatroh
# Create integer matrix with just one value.
im = pymatroh.Matrix(1,1)
print(im.create_int_matrix())  

Result:

[[53]]

Example 2: Using from <modulename> import <submodule/class>

# Import class matrix from pymatroh package.
from pymatroh import Matrix
# Create float matrix.
fm = Matrix(2,2)
print(fm.create_float_matrix())

Result:

[[0.3476066056691818, 82.64139933693019], [55.6682714565969, 37.442624968338635]]

Example 3: Using parameter applyround.

# Import class matrix from pymatroh package.
from pymatroh import Matrix
# Create float matrix.
fm = Matrix(2,2,applyround=True)
print(fm.create_float_matrix())

Result:

[[16.466, 24.297], [50.782, 36.962]]

Using the cli

With the cli interface you can create python matrices and use them in scripts or export them to file to use it in other projects.

To show the help run the following command:

python -m pymatroh -h

Result:

usage: __main__.py [-h] [-row ROW] [-col COLUMN] [-rnge RANGE] [-mtype MATRIXTYPE] [-round ROUND]

options:
  -h, --help            show this help message and exit

Matrix:
  -row ROW, --row ROW   Row count.
  -col COLUMN, --column COLUMN
                        Column count.
  -rnge RANGE, --range RANGE
                        Integer range. Default = 100.
  -mtype MATRIXTYPE, --matrixtype MATRIXTYPE
                        Type of matrix. You can specify int,float or complex.
  -round ROUND, --round ROUND
                        Rounds the result by 3 digits.

Using the module via cli:

python -m pymatroh --row 2 --col 1 --round True --matrixtype float

Result:

[[69.856], [30.491]]

Releasing

Releases are published automatically when a tag is pushed to GitHub.

# Create release variable.
$Release = "x.x.x"
# Create commit.
git commit --allow-empty -m "Release $Release"
# Create tag.
git tag -a $Release -m "Version $Release"
# Push from original.
git push origin --tags
# Push from fork.
git push upstream --tags

License

MIT

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

pymatroh-0.0.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

pymatroh-0.0.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file pymatroh-0.0.2.tar.gz.

File metadata

  • Download URL: pymatroh-0.0.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for pymatroh-0.0.2.tar.gz
Algorithm Hash digest
SHA256 673251cc07ad1129ff46d04518c9d5335bad213f0cbbb482cd33142f0e9dcc2d
MD5 e0d833040edb7c4232f48f8d85174883
BLAKE2b-256 0d8491fff7fe17afaa9cea1aa260b555053bb349ae47dbb89097660438132fae

See more details on using hashes here.

File details

Details for the file pymatroh-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pymatroh-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for pymatroh-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 15d43331f707b3b17f63c6681899025ad4a4608e0c3b43e2b082e4d3f09dcce2
MD5 8f7416943a774ac96b122fef1008f0b2
BLAKE2b-256 894b796bc907d94aba6edc1d71ec3549e3bb6ae4ccdcd9dbc2a7760e2bf7f4fc

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