Saravanan666/pypi-org huggingface dataset:
Package: matrix-class
Matrix Class LibraryThis Python library provides an implementation of a matrix using classes, offering a range of functionalities for matrix operations.InstallationInstall the library using pip:pipinstallmatrix_classFeaturesInitialization: Create matrices with specified rows and columns.Item Assignment and Retrieval: Set and get values of specific cells in the matrix.Matrix Properties: Access the number of rows and columns in the matrix.String Representation: Print the matrix in a readable format.Determinant Calculation: Compute the determinant of the matrix.Matrix Arithmetic: Perform addition, subtraction, and multiplication (with both scalars and other matrices).Matrix Transposition: Transpose the matrix, swapping rows with columns.Matrix Inversion: Invert a matrix, provided it is square and has a non-zero determinant.Matrix Complementation: Calculate the complement of a matrix.UsageBelow are some examples of how to use the Matrix class:frommatriximportMatrix# Create a new Matrix with specified dimensionsmatrix=Matrix(3,3)# Set and get valuesmatrix[1,1]=5.0value=matrix[1,1]# Access matrix propertiesrows=matrix.rowscolumns=matrix.columns# Print the matrixprint(matrix)# Perform arithmetic operationssum_matrix=matrix1+matrix2difference=matrix1-matrix2product=matrix1*matrix2scaled_matrix=matrix*2.0# Transpose and invert matricestransposed_matrix=matrix.get_transported()inverse_matrix=matrix.get_inverse()ContributingContributions to enhance the Matrix Class Library are welcomed. Please open an issue first to discuss proposed changes. Ensure to update tests as appropriate.LicenseThis library is released under theMIT License.
Package: matrix-client
Matrix Client SDK for PythonMatrix client-server SDK for Python 2.7 and 3.4+Project StatusWe strongly recommend using thematrix-niolibrary rather than this
sdk. It is both more featureful and more actively maintained.This sdk is currently lightly maintained without any person ultimately
responsible for the project. Pull-requestsmaybe reviewed, but no
new-features or bug-fixes are being actively developed. For more info
or to volunteer to help, please seehttps://github.com/matrix-org/matrix-python-sdk/issues/279or come
chat in#matrix-python-sdk:matrix.org.InstallationStable releaseInstall with pip from pypi. This will install all necessary dependencies as well.pipinstallmatrix_clientDevelopment versionInstall usingsetup.pyin root project directory. This will also install all
needed dependencies.gitclonehttps://github.com/matrix-org/matrix-python-sdk.gitcdmatrix-python-sdkpythonsetup.pyinstallUsageThe SDK provides 2 layers of interaction. The low-level layer just wraps the
raw HTTP API calls. The high-level layer wraps the low-level layer and provides
an object model to perform actions on.Client:frommatrix_client.clientimportMatrixClientclient=MatrixClient("http://localhost:8008")# New usertoken=client.register_with_password(username="foobar",password="monkey")# Existing usertoken=client.login(username="foobar",password="monkey")room=client.create_room("my_room_alias")room.send_text("Hello!")API:frommatrix_client.apiimportMatrixHttpApimatrix=MatrixHttpApi("https://matrix.org",token="some_token")response=matrix.send_message("!roomid:matrix.org","Hello!")StructureThe SDK is split into two modules:apiandclient.APIThis contains the raw HTTP API calls and has minimal business logic. You can
set the access token (token) to use for requests as well as set a custom
transaction ID (txn_id) which will be incremented for each request.ClientThis encapsulates the API module and provides object models such asRoom.SamplesA collection of samples are included, written in Python 3.You can either install the SDK, or run the sample like this:PYTHONPATH=.pythonsamples/samplename.pyBuilding the DocumentationThe documentation can be built by installingsphinxandsphinx_rtd_theme.Simple runmakeinsidedocswhich will list the avaliable output formats.
Package: matrix-client-harmonyqt
Matrix Client SDK for PythonThis is a Matrix client-server SDK for Python 2.7 and 3.4+Community discussion on usage of this SDK and development of this SDK can be
found at#matrix-python-sdk:matrix.org.Documentation can be found athttp://matrix-org.github.io/matrix-python-sdk/InstallationStable releaseInstall with pip from pypi. This will install all necessary dependencies as well.pipinstallmatrix_clientDevelopment versionInstall usingsetup.pyin root project directory. This will also install all
needed dependencies.gitclonehttps://github.com/matrix-org/matrix-python-sdk.gitcdmatrix-python-sdkpythonsetup.pyinstallE2E developmentThe Olm bindings are not yet hosted on PyPI. Hence it it necessary to pass--process-dependency-linkswhen installing with pip, in order to fetch them
from their Git repository. For example replacepython setup.py installin
the above instructions bypip install--process-dependency-links.[e2e].UsageThe SDK provides 2 layers of interaction. The low-level layer just wraps the
raw HTTP API calls. The high-level layer wraps the low-level layer and provides
an object model to perform actions on.Client:frommatrix_client.clientimportMatrixClientclient=MatrixClient("http://localhost:8008")# New usertoken=client.register_with_password(username="foobar",password="monkey")# Existing usertoken=client.login_with_password(username="foobar",password="monkey")room=client.create_room("my_room_alias")room.send_text("Hello!")API:frommatrix_client.apiimportMatrixHttpApimatrix=MatrixHttpApi("https://matrix.org",token="some_token")response=matrix.send_message("!roomid:matrix.org","Hello!")StructureThe SDK is split into two modules:apiandclient.APIThis contains the raw HTTP API calls and has minimal business logic. You can
set the access token (token) to use for requests as well as set a custom
transaction ID (txn_id) which will be incremented for each request.ClientThis encapsulates the API module and provides object models such asRoom.SamplesA collection of samples are included, written in Python 3.You can either install the SDK, or run the sample like this:PYTHONPATH=.pythonsamples/samplename.pyBuilding the DocumentationThe documentation can be built by installingsphinxandsphinx_rtd_theme.Simple runmakeinsidedocswhich will list the avaliable output formats.
Package: matrix-common
matrix-python-commonCommon utilities for Synapse, Sydent and Sygnal.Installationpipinstallmatrix-commonUsageimportmatrix_commonDevelopmentIn a virtual environment with pip ≥ 21.1, runpipinstall-e.[dev]To run the unit tests, you can either use:tox-epyortrialtestsTo run the linters andmypytype checker, use./scripts-dev/lint.sh.ReleasingThe exact steps for releasing will vary; but this is an approach taken by the
Synapse developers (assuming a Unix-like shell):Set a shell variable to the version you are releasing (this just makes
subsequent steps easier):version=X.Y.ZUpdatesetup.cfgso that theversionis correct.Stage the changed files and commit.gitadd-u
gitcommit-mv$version-nPush your changes.gitpushWhen ready, create a signed tag for the release:gittag-sv$versionBase the tag message on the changelog.Push the tag.gitpushorigintagv$versionIf applicable:
Create arelease, based on the tag you just pushed, on GitHub or GitLab.If applicable:
Create a source distribution and upload it to PyPI:python-mbuild
twineuploaddist/matrix_common-$version*
Package: matrix-completion
Matrix completion in PythonLast update: February 2020.Python code for a few approaches at low-dimensional matrix completion.These methods operate in-memory and do not scale beyond size 1000 x 1000 or so.Installationpip3installmatrix-completionMethodsNuclear norm minimization (very slow) [1]Singular value thresholding [2]Alternating least squares [3,4]Biased alternating least squares [5]Usageimportnumpyasnpfrommatrix_completionimportsvt_solve,calc_unobserved_rmseU=np.random.randn(20,5)V=np.random.randn(15,5)R=np.random.randn(20,15)+np.dot(U,V.T)mask=np.round(np.random.rand(20,15))R_hat=svt_solve(R,mask)print("RMSE:",calc_unobserved_rmse(U,V,R_hat,mask))Note that here, the mask is a matrix with entries either 1 (indicating observed) or 0 (indicating missing).See theexamples/directory for more details.References[1] Emmanuel Candès and Benjamin Recht. 2012. Exact matrix completion via convex optimization. Commun. ACM 55, 6 (June 2012), 111-119. DOI:https://doi.org/10.1145/2184319.2184343[2] Jian-Feng Cai, Emmanuel J. Candès, and Zuowei Shen. 2010. A Singular Value Thresholding Algorithm for Matrix Completion. SIAM J. on Optimization 20, 4 (March 2010), 1956-1982. DOI=http://dx.doi.org/10.1137/080738970[3] Yifan Hu, Yehuda Koren, and Chris Volinsky. 2008. Collaborative Filtering for Implicit Feedback Datasets. In Proceedings of the 2008 Eighth IEEE International Conference on Data Mining (ICDM '08). IEEE Computer Society, Washington, DC, USA, 263-272. DOI=http://dx.doi.org/10.1109/ICDM.2008.22[4] Ruslan Salakhutdinov and Andriy Mnih. 2007. Probabilistic Matrix Factorization. In Proceedings of the 20th International Conference on Neural Information Processing Systems (NIPS'07), J. C. Platt, D. Koller, Y. Singer, and S. T. Roweis (Eds.). Curran Associates Inc., USA, 1257-1264.[5] Paterek, Arkadiusz. “Improving regularized singular value decomposition for collaborative filtering.” (2007).LicenseThis code is available under the Eclipse Public License.
Package: matrix-conv
MatrixConvMatrixConvis a graph convolutional filter for graphs where the node features are n-dimensional matrices, such as 2D or 3D images, such as ascene graph. The filter applies a (non-graph) convolution, i.e.torch.nn.Conv{1/2/3}d, to transform the node features. Node embeddings are updated like so:Whereφrandφmare CNNs (torch.nn.Conv{1/2/3}d), andWeis a weight matrix.InstallationThis module can be installed withpip:$pipinstallmatrix_convUsageMatrixConvis built on PyTorch Geometric and derives from theMessagePassingmodule. It expects an input graph where each node's "features" is a matrix (either 1D, 2D, or 3D).MatrixConv, similarly toNNConv, also incorporates any available edge features when collecting messages from a node's neighbors.Parameters:in_channels(int): Number of channels in the input node matrix (e.g. if each node's features is a 3x5 matrix with 2 input channels, thenin_channels=2)out_channels(int): Number of channels in the output node embeddingmatrix_dims(listortuple): Dimensions of matrix associated with node (e.g. if each node's features is a 3x5 matrix, thenmatrix_dims=[3, 5])num_edge_attr(int): Number of edge attributes/featureskernel_dims(listortuple): Dimensions of the convolving kernel in the CNNaggr(string,optional): The message aggregation scheme to use ("add", "mean", "max")root_cnn(bool,optional): If set toFalse, the layer will not add the CNN-transformed root node features to the outputbias(bool,optional): If set toFalse, the layer will not learn an additive bias**kwargs(optional): Additional arguments fortorch.nn.Conv{1/2/3}dExample Usage:importtorchfrommatrix_convimportMatrixConv# Convolutional layerconv_layer=MatrixConv(in_channels=1,out_channels=10,matrix_dims=[5,5,5],num_edge_attr=3,kernel_dims=[2,3,3])# Your input graph (see: https://pytorch-geometric.readthedocs.io/en/latest/notes/introduction.html#data-handling-of-graphs)x=torch.randn((3,1,5,5,5),dtype=torch.float)# Shape is [num_nodes, in_channels, *matrix_dims]edge_index=torch.tensor([[0,1,1,2],[1,0,2,1]],dtype=torch.long)edge_attr=torch.randn((4,3),dtype=torch.float)# Your output graphx=conv_layer(x,edge_index,edge_attr)# Shape is now [3, 10, 4, 3, 3]To-Do:Show example of using this in a graph classifier (include stacking)
Package: matrix-decomposition
This ismatrix-decomposition, a library to approximate Hermitian (dense and sparse) matrices by positive definite matrices. Furthermore it allows to decompose (factorize) positive definite matrices and solve associated systems of linear equations.Release infoThere are several ways to obtain and install this package.CondaTo install this package withcondarun:conda install-cjorematrix-decompositionhttps://anaconda.org/jore/matrix-decompositionpipTo install this package withpiprun:pip install'matrix-decomposition'https://pypi.python.org/pypi/matrix-decompositionGitHubTo clone this package withgitrun:git clonehttps://github.com/jor-/matrix-decomposition.gitTo install this package after that withpythonrun:cdmatrix-decomposition;python setup.py installhttps://github.com/jor-/matrix-decompositionZenodoDocumentationhttps://matrix-decomposition.readthedocs.ioTest statusCopyrightCopyright (C) 2017-2019  Joscha Reimerjor@informatik.uni-kiel.deThis program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
Package: matrixdraw
Drawing on a matrixWhat is this?The module allows you to create a symbolic matrix and draw different lines on it, after which you can convert the drawn lines into a beautiful structure.Quick GuideDrawing a simple, beautiful line:my_picture = РЎanvas_matrix(10,10)
my_picture.makeline(1, 1, 8, 9)
my_picture.beautify()
my_picture.pt()UsingUsing the library is as simple and convenient as possible:Let's import it first:
First, import everything from the library (use thefrom...import *construct).To start working with the module, you need to create an object with the classCanvas_matrix, in this case we are creating a 10 by 10 matrix filled with spaces:my_picture = РЎanvas_matrix(10,10," ")This class has several methods that will help you master this library:.pt()- prints the entire matrix, if pt = True, the garden will be printed after printing for the next print:my_picture.pt(pt = False).makeline(x1, y1, x2, y2)- draws a line at two points, the coordinates start at 1, that is, the coordinate at the upper left point will be[0,0]my_picture.makeline(1, 1, 8, 9).point(x, y, r)- draws a point in x, y coordinates with the same width and height r:my_picture.point(5, 7, 2).local_draw- stores the coordinates of the local drawing, you no longer need to count the coordinates from the origin, but only from the beginning of the local coordinates:my_picture.local_draw = [x, y].beautify()- Transforms a boring picture from identical symbols into a beautiful picture with different symbols:my_picture.beautify()an example of drawing a simple picture:t = РЎanvas_matrix(10,25)
t.local_draw = [7,0]
t.makeline(0, 0, 4, 2)
t.makeline(20, 2)
t.makeline(25, -1)
t.local_draw = [2,4]
t.point(0,0)
t.point(10,-1)
t.beautify()
t.pt(False)
Package: matrix-enum
MatrixEnumMatrixEnumis a package that provides convenient extensions to python's
builtin enums to allow for simple construction of enum multi-dimensional members.frommatrix_enumimportMatrixEnum,MemberclassMyEnum(MatrixEnum):ONE=Member(digit=1,title='one',roman='I')TWO=Member(digit=2,title='two',roman='II')# Keeps classic enum functionality>>>MyEnum.ONEisMyEnum.TWOFalse>>>MyEnum.ONEisMyEnum.ONETrue# Automatically adds attributes to all enum members>>>MyEnum.ONE.digit1>>>MyEnum.ONE.title'one'# `Member` attributes are reversible>>>MyEnum.ONEisMyEnum(1)True>>>MyEnum.TWOisMyEnum('II')True>>>1inMyEnumTrue>>>'two'inMyEnumTrueInstallationYou can either install the package with pip:$pipinstallmatrix_enumor clone the repo and install:$gitclonehttps://github.com/klaviyo/matrix_enum.git
$pipinstall-ematrix_enum/Local DevelopmentFor information on local development, testing, and contributing, see theContribution guidelines for this project.APIMatrixEnumandMembersMatrixEnumextends the basic pythonEnumwith the following restrictions:All members must be of typeMember.AllMembers must have the same attributes.All values ofMemberattributes must be unique across ALL attributes.Memberattributes cannot use any reserved__dunder__attributes or the
namesnameorvalue.ValidThe following is a validMatrixEnum:frommatrix_enumimportMatrixEnum,MemberclassMyEnum(MatrixEnum):ONE=Member(digit=1,title='one',roman='I')TWO=Member(digit=2,title='two',roman='II')Invalid EnumsAll of the following areINVALIDMatrixEnumsand will raise aValueError:# INVALID: The members have to be of class MemberclassNonMembers(MatrixEnum):ONE=1TWO=2# INVALID: Members have the same value for 'digit'classDuplicateValue(MatrixEnum):ONE=Member(digit=1)OTHER_ONE=Member(digit=1)# INVALID: Members can't have the same value across different attributesclassDuplicateValue2(MatrixEnum):FOO=Member(digit=1,other_digit=2)BAR=Member(digit=3,other_digit=1)# INVALID: Members have different attributesclassUnevenAttrs(MatrixEnum):ONE=Member(digit=1,title='one')TWO=Member(digit=2,roman='II')AddingextrasYou can add duplicated values toMembers using theextramethod.Theseextras will be available as attributes to members but cannot be used
to lookup enum members by value.classAnimalEnum(MatrixEnum):CAT=Member(title='cat').extra(num_paws=4)DOG=Member(title='dog').extra(num_paws=4)FISH=Member(title='fish').extra(num_paws=0)>>>AnimalEnum.CAT.num_paws4>>>AnimalEnum(4)ValueError:4isnotavalidAnimalEnumLinksCode:https://github.com/klaviyo/matrix_enumRelease:https://pypi.org/project/matrix_enum/Changelog:https://github.com/klaviyo/matrix_enum/blob/master/CHANGELOG.mdThis package is owned and maintained byKlaviyo. Check out oureng blog.
Package: matrix-factorization
Matrix FactorizationShort and simple implementation of kernel matrix factorization with online-updating for use in collaborative recommender systems built on top of scikit-learn.PrerequisitesPython 3numbanumpypandasscikit-learnscipyInstallationpip install matrix_factorizationUsagefrommatrix_factorizationimportBaselineModel,KernelMF,train_update_test_splitimportpandasaspdfromsklearn.metricsimportmean_squared_error# Movie data found here https://grouplens.org/datasets/movielens/cols=["user_id","item_id","rating","timestamp"]movie_data=pd.read_csv("../data/ml-100k/u.data",names=cols,sep="\t",usecols=[0,1,2],engine="python")X=movie_data[["user_id","item_id"]]y=movie_data["rating"]# Prepare data for online learning(X_train_initial,y_train_initial,X_train_update,y_train_update,X_test_update,y_test_update,)=train_update_test_split(movie_data,frac_new_users=0.2)# Initial trainingmatrix_fact=KernelMF(n_epochs=20,n_factors=100,verbose=1,lr=0.001,reg=0.005)matrix_fact.fit(X_train_initial,y_train_initial)# Update model with new usersmatrix_fact.update_users(X_train_update,y_train_update,lr=0.001,n_epochs=20,verbose=1)pred=matrix_fact.predict(X_test_update)rmse=mean_squared_error(y_test_update,pred,squared=False)print(f"\nTest RMSE:{rmse:.4f}")# Get recommendationsuser=200items_known=X_train_initial.query("user_id == @user")["item_id"]matrix_fact.recommend(user=user,items_known=items_known)Check examples/recommender-system.ipynb for complete examplesLicenseThis project is licensed under the MIT LicenseReferences :book:Steffen Rendle, Lars Schmidt-Thieme. Online-updating regularized kernel matrix factorization models for large-scale recommender systemshttps://dl.acm.org/doi/10.1145/1454008.1454047
Package: matrix-floppy
matrix-floppy 💾Save your Matrix history.MotivationMy motivation for writing this application is to give me an offline browseable
and searchable archive of my Matrix chat history. This can be handy if my
homeserver is down, or if I want to move homeserver, or just to be able to
search encrypted chat history without needing to use Element Desktop.FeaturesMedia types:Unencrypted messagesEncrypted messagesImagesVideosReactionsOperation modes:BatchReal-time clientOutput formats:HTMLPlain-textJSONInstallationUsepython3 setup.py installto install this package. You can do this
system-wide or inside a virtualenv at your preference.For development, dependencies are managed using thePipfilealthough arequirements.txtfile is also provided, generated via a make target.LicenseCopyright (C) Iain R. Learmonth 2021. SeeCOPYINGfor permissions.
Package: matrixfuncs
matrix-functionsThe krylov space is a vector space generated by a square matrix and the Cayley-Hamilton theorem which states that every square matrix is a root of its own characteristic polynomial. From this it follows that $A^n$ is a linear combination of $\unicode{x1D7D9}=A^0,\ A,\ A^2,\ \dots,\ A^{n-1}$ and therefore every polynomial in A is such a linear combination:$$
A^m = \sum_{k=0}^{n-1} \alpha_{mk} A^k
$$It turns out that $\alpha_{mk}$ only depends on the eigenvalues $\lambda_1,\ \dots,\ \lambda_n$. Because of this every matrix function can be expressed in the krylov space if the function is analytical in the eigenvalues:$$
A^m = \sum_{k=0}^{n-1} A^k \sum_{j=1}^{k+1} \Lambda_{k+1-j} \sum_{l=1}^r \sum_{p=0}^{\min(\mu_l-1,m-j)} \bar\beta_{lp} \lambda_l^{m-j-p} \frac{(m-j)!}{(m-j-p)!}
$$$$
f(A) = \sum_{k=0}^{n-1} A^k \sum_{j=1}^{k+1} \Lambda_{k+1-j} \sum_{l=1}^r \sum_{p=0}^{\mu_l-1} \bar\beta_{lp} \sum_{q=0}^p \binom pq (-1)^{p-q}\frac{(j-1+p-q)!}{(j-1)!} \lambda_l^{-j-p+q} f^{(q)}(\lambda_l)
$$Example# One can show that sin(x) = 2cos(a)sin(x-a) - sin(x-2a). So for `x=0` and `a=.2` we can define a# matrix `M` such that [sin(x+na), sin(x+(n-1)a)] = matrix_power(M, n) @ [sin(x), sin(x-a)]:importnumpyasnpfrommatrixfuncsimport*importmatplotlib.pyplotasplta=.2M=np.array([[2*np.cos(a),-1],[1,0]])fornin[0,1,10,100,1000,10000]:sinNa=[1,0]@np.linalg.matrix_power(M,n)@np.sin([0,-a])error=(sinNa-np.sin(n*a))**2print('n:',error)# n: 0.0# n: 0.0# n: 4.930380657631324e-30# n: 1.199857436841159e-27# n: 9.247078067402441e-26# n: 3.397767010759534e-24# In order to generalize the discrete n to a continous variable we have to replace# matrix_power(M, n) with something like exp(n*log(M)). For calculating the function of a matrix# we can use MFunc.krylovM=KrylovSpace(M)mfn=MFunc.fromKrylov(krylovM)mfn0=[1,0]@mfn@np.sin([0,-a])# Compare the numeric evaluation of sin to numpy's implementation in 1000 points between 0 and 2pi:ts=np.linspace(0,2*np.pi,1000)sinFromMFunc=mfn0(lambdaevs:np.exp(np.outer(np.log(evs),ts/a))).coeffssints=np.sin(ts)error=np.sum((sinFromMFunc-sints)**2)print(error)# 1.1051029979680703e-26plt.plot(ts,sinFromMFunc)plt.savefig('sinFromMFunc.png',dpi=200)
Package: matrixHandler
MATRIXHANDLERA small module which adds you to manipulate matrixes in Python3.
Code is still under development, features such as matrix division and power TBA.The code is made for Python3Installation$ pip3 install matrixHandlerExamplefrompymatriximportmatrix# creates a 2x3 matrix based on a listmatrix1=Matrice([[1,2],[3,4],[5,6]])# creates another 3x2 matrixmatrix2=Matrice([[10,9,8],[7,6,5]])# multiples both matrixesmultMatrix=matrix1*matrix2# displays the resultprint(multMatrix)Output:[14,12][28,24][42,36]