X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Fdunshire%2Fmatrices.py;h=3670d8f1e07db9cb0de23bce7b9a3fdbea9b0dfb;hb=e708b535dd508993c2c58dbf552d9acc47d23e49;hp=38d4afe78efaad7665b71d936c8ba9e8309de581;hpb=ff576f2eddae5554e4888d99b092d73e19619a91;p=dunshire.git diff --git a/src/dunshire/matrices.py b/src/dunshire/matrices.py index 38d4afe..3670d8f 100644 --- a/src/dunshire/matrices.py +++ b/src/dunshire/matrices.py @@ -9,15 +9,24 @@ from cvxopt.lapack import syev import options + def append_col(left, right): """ - Append the matrix ``right`` to the right side of the matrix ``left``. + Append two matrices side-by-side. Parameters ---------- + left, right : matrix The two matrices to append to one another. + Returns + ------- + + matrix + A new matrix consisting of ``right`` appended to the right + of ``left``. + Examples -------- @@ -39,15 +48,23 @@ def append_col(left, right): """ return matrix([left.trans(), right.trans()]).trans() + def append_row(top, bottom): """ - Append the matrix ``bottom`` to the bottom of the matrix ``top``. + Append two matrices top-to-bottom. Parameters ---------- + top, bottom : matrix The two matrices to append to one another. + Returns + ------- + + matrix + A new matrix consisting of ``bottom`` appended below ``top``. + Examples -------- @@ -84,9 +101,15 @@ def eigenvalues(symmat): symmat : matrix The real symmetric matrix whose eigenvalues you want. + Returns + ------- + + list of float + A list of the eigenvalues (in no particular order) of ``symmat``. Raises ------ + TypeError If the input matrix is not symmetric. @@ -129,6 +152,7 @@ def identity(domain_dim): Returns ------- + matrix A ``domain_dim``-by-``domain_dim`` dense integer identity matrix. @@ -163,6 +187,7 @@ def inner_product(vec1, vec2): Returns ------- + float The inner product of ``vec1`` and ``vec2``.