Giter VIP home page Giter VIP logo

mxl's Introduction

Matrix calculations

Installing:

pip install -i https://test.pypi.org/simple/ qztr-mxl

В библиотеке реализованы следующие операции:

  1. Объявить константы 0 и единичной матриц
  2. Умножение матрицы на скаляр
  3. Сложение матриц одинакового размера
  4. умножение матриц одинакового размера
  5. вычисление определителя
  6. сравнение на равенство
  7. обратная матрица

  1. Объявить константы 0 и единичной матриц

Для начала имопртируем класс solver:

from mxl import solver

Метод создания статической нулевой матрицы раземерности 5х5:

matrixZ = solver.mZ # нулевая матрица
matrix1 = solver.m1 # единичная матрица

>>> matrixZ
[[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]

Метод создания нулевой матрицы размерности C,R:

matrix1 = solver.define_1matrix(C,R)
matrixZ = solver.define_Zmatrix(C,R)

>>> matrix1
[[1, 1], [1, 1]]

Умножение матрицы на скаляр:

s_mul = solver.matmulvec(M, v)

>>> v = [1,2,3]
>>> s_mul = solver.matmulvec(matrix1, v)
>>> s_mul
[3, 3]

Сложение матриц одинакового размера:

add = solver.matrix_addition(A, B)

>>> add = solver.matrix_addition(matrix1, matrix1)
>>> add
[[2, 2], [2, 2]]

Умножение матриц одинакового размера:

m_mul = solver.matrix_mul(A, B)

>>> y = [[3,3],[0,0]]
>>> m_mul = solver.matrix_mul(matrix1, y)
>>> m_mul
[[3, 3], [3, 3]]

Вычисление определителя

det = solver.determinant(matrix)

>>> det = solver.determinant(matrix1)
>>> det
0

Сравнение на равенство

check = solver.check_matrix_equality(A, B)

>>> check = solver.check_matrix_equality(y, y)
>>> check
True

Обратная матрица

inv = inverse(matrix)

>>> inv = solver.inverse(matrix1)
>>> inv
Матрица вырожденная
Обратная для неё не существует

mxl's People

Contributors

qztr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.