from math import sqrt
from cvxopt import matrix
-from cvxopt.lapack import syev
+from cvxopt.lapack import syevr
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
--------
"""
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
--------
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.
domain_dim = symmat.size[0]
eigs = matrix(0, (domain_dim, 1), tc='d')
- syev(symmat, eigs)
+ syevr(symmat, eigs)
return list(eigs)
Returns
-------
+
matrix
A ``domain_dim``-by-``domain_dim`` dense integer identity matrix.
+ Raises
+ ------
+
+ ValueError
+ If you ask for the identity on zero or fewer dimensions.
+
Examples
--------
Returns
-------
+
float
The inner product of ``vec1`` and ``vec2``.
+ Raises
+ ------
+
+ TypeError
+ If the lengths of ``vec1`` and ``vec2`` differ.
+
Examples
--------