typerig.core.objects.matrix
typerig.core.objects.matrix
# MODULE: TypeRig / Core / Matrix (Object) # ---------------------------------------------------------- # A slight adaptation of... # "Basic Table, Matrix and Vector functions for Python 2+" # (C) Raymond Hettinger, 2002 # ----------------------------------------------------------- # (C) Vassil Kateliev, 2017-2020 (http://www.kateliev.com) # (C) Karandash Type Foundry (http://www.karandash.eu) #------------------------------------------------------------ # www.typerig.com
Modules
- math
- operator
- random
Classes
- builtin.list(builtin.object)
class LowerTri(Triangular)
- Method resolution order:
- LowerTri
- Triangular
- Square
- Matrix
- Table
- builtin.list
- builtin.object
Methods from Triangular
- det(self)
- eigs(self)
Methods from Square
- pow(self, exp)
-
Raise a square matrix to an integer power (i.e. A**3 is the same as A.mmul(A.mmul(A))
- hessenberg(self)
-
Householder reduction to Hessenberg Form (zeroes below the diagonal) while keeping the same eigenvalues as self.
- inverse(self)
Methods from Matrix
- augment(self, otherMat)
-
Make a new matrix with the two original matrices laid side by side
- diag(self)
-
Return a vector composed of elements on the matrix diagonal
- qr(self, ROnly=0)
-
QR decomposition using Householder reflections: Q*R==self, Q.tr()*Q==I(n), R upper triangular
- rank(self)
- solve(self, b)
-
Divide matrix into a column vector or matrix and iterate to improve the solution
- tr(self)
-
Tranpose elements so that Transposed[i][j] = Original[j][i]
- trace(self)
Descriptors from Matrix
- cols
- rows
- size
Methods from Table
- abs(self)
- add(self, rhs)
- div(self, rhs)
- eq(self, rhs)
- getslice(self, i, j)
- mul(self, rhs)
- neg(self)
- radd(self, lhs)
- rdiv(self, lhs)
- rmul(self, lhs)
- rsub(self, lhs)
- str(self)
- sub(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors from Table
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
Attributes from Table
- dim = 1
Methods from builtin.list
- contains(...)
-
x.__contains__(y) <==> y in x
- delitem(...)
-
x.__delitem__(y) <==> del x[y]
- delslice(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- getattribute(...)
-
x.__getattribute__('name') <==> x.name
- getitem(...)
-
x.__getitem__(y) <==> x[y]
- reversed(...)
-
L.__reversed__() -- return a reverse iterator over the list
- setitem(...)
-
x.__setitem__(i, y) <==> x[i]=y
- setslice(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- sizeof(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from builtin.list
- hash = None
- new = <built-in method new of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
class Matrix(Table)
- Method resolution order:
- Matrix
- Table
- builtin.list
- builtin.object
Methods
- augment(self, otherMat)
-
Make a new matrix with the two original matrices laid side by side
- diag(self)
-
Return a vector composed of elements on the matrix diagonal
- qr(self, ROnly=0)
-
QR decomposition using Householder reflections: Q*R==self, Q.tr()*Q==I(n), R upper triangular
- rank(self)
- solve(self, b)
-
Divide matrix into a column vector or matrix and iterate to improve the solution
- tr(self)
-
Tranpose elements so that Transposed[i][j] = Original[j][i]
- trace(self)
Descriptors
- cols
- rows
- size
Methods from Table
- abs(self)
- add(self, rhs)
- div(self, rhs)
- eq(self, rhs)
- getslice(self, i, j)
- mul(self, rhs)
- neg(self)
- radd(self, lhs)
- rdiv(self, lhs)
- rmul(self, lhs)
- rsub(self, lhs)
- str(self)
- sub(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors from Table
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
Attributes from Table
- dim = 1
Methods from builtin.list
- contains(...)
-
x.__contains__(y) <==> y in x
- delitem(...)
-
x.__delitem__(y) <==> del x[y]
- delslice(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- getattribute(...)
-
x.__getattribute__('name') <==> x.name
- getitem(...)
-
x.__getitem__(y) <==> x[y]
- reversed(...)
-
L.__reversed__() -- return a reverse iterator over the list
- setitem(...)
-
x.__setitem__(i, y) <==> x[i]=y
- setslice(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- sizeof(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from builtin.list
- hash = None
- new = <built-in method new of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
class Square(Matrix)
- Method resolution order:
- Square
- Matrix
- Table
- builtin.list
- builtin.object
Methods
- pow(self, exp)
-
Raise a square matrix to an integer power (i.e. A**3 is the same as A.mmul(A.mmul(A))
- det(self)
- eigs(self)
-
Estimate principal eigenvalues using the QR with shifts method
- hessenberg(self)
-
Householder reduction to Hessenberg Form (zeroes below the diagonal) while keeping the same eigenvalues as self.
- inverse(self)
Methods from Matrix
- augment(self, otherMat)
-
Make a new matrix with the two original matrices laid side by side
- diag(self)
-
Return a vector composed of elements on the matrix diagonal
- qr(self, ROnly=0)
-
QR decomposition using Householder reflections: Q*R==self, Q.tr()*Q==I(n), R upper triangular
- rank(self)
- solve(self, b)
-
Divide matrix into a column vector or matrix and iterate to improve the solution
- tr(self)
-
Tranpose elements so that Transposed[i][j] = Original[j][i]
- trace(self)
Descriptors from Matrix
- cols
- rows
- size
Methods from Table
- abs(self)
- add(self, rhs)
- div(self, rhs)
- eq(self, rhs)
- getslice(self, i, j)
- mul(self, rhs)
- neg(self)
- radd(self, lhs)
- rdiv(self, lhs)
- rmul(self, lhs)
- rsub(self, lhs)
- str(self)
- sub(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors from Table
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
Attributes from Table
- dim = 1
Methods from builtin.list
- contains(...)
-
x.__contains__(y) <==> y in x
- delitem(...)
-
x.__delitem__(y) <==> del x[y]
- delslice(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- getattribute(...)
-
x.__getattribute__('name') <==> x.name
- getitem(...)
-
x.__getitem__(y) <==> x[y]
- reversed(...)
-
L.__reversed__() -- return a reverse iterator over the list
- setitem(...)
-
x.__setitem__(i, y) <==> x[i]=y
- setslice(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- sizeof(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from builtin.list
- hash = None
- new = <built-in method new of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
class Table(builtin.list)
# - Classes ------------------------------
- Method resolution order:
- Table
- builtin.list
- builtin.object
Methods
- abs(self)
- add(self, rhs)
- div(self, rhs)
- eq(self, rhs)
- getslice(self, i, j)
- init(self, elems)
- mul(self, rhs)
- neg(self)
- radd(self, lhs)
- rdiv(self, lhs)
- rmul(self, lhs)
- rsub(self, lhs)
- str(self)
- sub(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
Attributes
- dim = 1
Methods from builtin.list
- contains(...)
-
x.__contains__(y) <==> y in x
- delitem(...)
-
x.__delitem__(y) <==> del x[y]
- delslice(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- getattribute(...)
-
x.__getattribute__('name') <==> x.name
- getitem(...)
-
x.__getitem__(y) <==> x[y]
- reversed(...)
-
L.__reversed__() -- return a reverse iterator over the list
- setitem(...)
-
x.__setitem__(i, y) <==> x[i]=y
- setslice(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- sizeof(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from builtin.list
- hash = None
- new = <built-in method new of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
class Triangular(Square)
- Method resolution order:
- Triangular
- Square
- Matrix
- Table
- builtin.list
- builtin.object
Methods
- det(self)
- eigs(self)
Methods from Square
- pow(self, exp)
-
Raise a square matrix to an integer power (i.e. A**3 is the same as A.mmul(A.mmul(A))
- hessenberg(self)
-
Householder reduction to Hessenberg Form (zeroes below the diagonal) while keeping the same eigenvalues as self.
- inverse(self)
Methods from Matrix
- augment(self, otherMat)
-
Make a new matrix with the two original matrices laid side by side
- diag(self)
-
Return a vector composed of elements on the matrix diagonal
- qr(self, ROnly=0)
-
QR decomposition using Householder reflections: Q*R==self, Q.tr()*Q==I(n), R upper triangular
- rank(self)
- solve(self, b)
-
Divide matrix into a column vector or matrix and iterate to improve the solution
- tr(self)
-
Tranpose elements so that Transposed[i][j] = Original[j][i]
- trace(self)
Descriptors from Matrix
- cols
- rows
- size
Methods from Table
- abs(self)
- add(self, rhs)
- div(self, rhs)
- eq(self, rhs)
- getslice(self, i, j)
- mul(self, rhs)
- neg(self)
- radd(self, lhs)
- rdiv(self, lhs)
- rmul(self, lhs)
- rsub(self, lhs)
- str(self)
- sub(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors from Table
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
Attributes from Table
- dim = 1
Methods from builtin.list
- contains(...)
-
x.__contains__(y) <==> y in x
- delitem(...)
-
x.__delitem__(y) <==> del x[y]
- delslice(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- getattribute(...)
-
x.__getattribute__('name') <==> x.name
- getitem(...)
-
x.__getitem__(y) <==> x[y]
- reversed(...)
-
L.__reversed__() -- return a reverse iterator over the list
- setitem(...)
-
x.__setitem__(i, y) <==> x[i]=y
- setslice(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- sizeof(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from builtin.list
- hash = None
- new = <built-in method new of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
class UpperTri(Triangular)
- Method resolution order:
- UpperTri
- Triangular
- Square
- Matrix
- Table
- builtin.list
- builtin.object
Methods from Triangular
- det(self)
- eigs(self)
Methods from Square
- pow(self, exp)
-
Raise a square matrix to an integer power (i.e. A**3 is the same as A.mmul(A.mmul(A))
- hessenberg(self)
-
Householder reduction to Hessenberg Form (zeroes below the diagonal) while keeping the same eigenvalues as self.
- inverse(self)
Methods from Matrix
- augment(self, otherMat)
-
Make a new matrix with the two original matrices laid side by side
- diag(self)
-
Return a vector composed of elements on the matrix diagonal
- qr(self, ROnly=0)
-
QR decomposition using Householder reflections: Q*R==self, Q.tr()*Q==I(n), R upper triangular
- rank(self)
- solve(self, b)
-
Divide matrix into a column vector or matrix and iterate to improve the solution
- tr(self)
-
Tranpose elements so that Transposed[i][j] = Original[j][i]
- trace(self)
Descriptors from Matrix
- cols
- rows
- size
Methods from Table
- abs(self)
- add(self, rhs)
- div(self, rhs)
- eq(self, rhs)
- getslice(self, i, j)
- mul(self, rhs)
- neg(self)
- radd(self, lhs)
- rdiv(self, lhs)
- rmul(self, lhs)
- rsub(self, lhs)
- str(self)
- sub(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors from Table
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
Attributes from Table
- dim = 1
Methods from builtin.list
- contains(...)
-
x.__contains__(y) <==> y in x
- delitem(...)
-
x.__delitem__(y) <==> del x[y]
- delslice(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- getattribute(...)
-
x.__getattribute__('name') <==> x.name
- getitem(...)
-
x.__getitem__(y) <==> x[y]
- reversed(...)
-
L.__reversed__() -- return a reverse iterator over the list
- setitem(...)
-
x.__setitem__(i, y) <==> x[i]=y
- setslice(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- sizeof(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from builtin.list
- hash = None
- new = <built-in method new of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
class Vec(Table)
- Method resolution order:
- Vec
- Table
- builtin.list
- builtin.object
Methods
- cross(self, otherVec)
-
Compute a Vector or Cross Product with another vector
- dot(self, otherVec)
- house(self, index)
-
Compute a Householder vector which zeroes all but the index element after a reflection
- norm(self)
- normalize(self)
- outer(self, otherVec)
- ratval(self, x)
-
Vec([10,20,30,40,50]).ratfit(5) evaluates to (10*x**2 + 20*x + 30) / (40*x**2 + 50*x + 1) at x=5.
Methods from Table
- abs(self)
- add(self, rhs)
- div(self, rhs)
- eq(self, rhs)
- getslice(self, i, j)
- init(self, elems)
- mul(self, rhs)
- neg(self)
- radd(self, lhs)
- rdiv(self, lhs)
- rmul(self, lhs)
- rsub(self, lhs)
- str(self)
- sub(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors from Table
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
Attributes from Table
- dim = 1
Methods from builtin.list
- contains(...)
-
x.__contains__(y) <==> y in x
- delitem(...)
-
x.__delitem__(y) <==> del x[y]
- delslice(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- getattribute(...)
-
x.__getattribute__('name') <==> x.name
- getitem(...)
-
x.__getitem__(y) <==> x[y]
- reversed(...)
-
L.__reversed__() -- return a reverse iterator over the list
- setitem(...)
-
x.__setitem__(i, y) <==> x[i]=y
- setslice(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- sizeof(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from builtin.list
- hash = None
- new = <built-in method new of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
Functions
- Mat(elems)
-
Factory function to create a new matrix.
- eye(m=1, n=None)
-
Identity matrix with side length m-by-m or m-by-n
- funToVec(tgtfun, low=-1, high=1, steps=40, EqualSpacing=0)
-
Compute x,y points from evaluating a target function over an interval (low to high) at evenly spaces points or with Chebyshev abscissa spacing (default)
- funfit((xvec, yvec), basisfuns)
-
Solves design matrix for approximating to basis functions
- genmat(m, n, func)
- getconj(z)
- getimag(z)
- getreal(z)
- hilb(m=1, n=None)
-
Hilbert matrix with side length m-by-m or m-by-n. Elem[i][j]=1/(i+j+1)
- iszero(z)
-
# - Helpers ------------------------------
- polyfit((xvec, yvec), degree=2)
-
Solves Vandermonde design matrix for approximating polynomial coefficients
- rand(m=1, n=None)
-
Random matrix with side length m-by-m or m-by-n
- ratfit((xvec, yvec), degree=2)
-
Solves design matrix for approximating rational polynomial coefficients (a*x**2 + b*x + c)/(d*x**2 + e*x + 1)
- zeroes(m=1, n=None)
-
Zero matrix with side length m-by-m or m-by-n.
Table
typerig.core.objects.matrix.Table = class Table(__builtin__.list)
# - Classes ------------------------------
- Method resolution order:
- Table
- __builtin__.list
- __builtin__.object
Methods
- __abs__(self)
- __add__(self, rhs)
- __div__(self, rhs)
- __eq__(self, rhs)
- __getslice__(self, i, j)
- __init__(self, elems)
- __mul__(self, rhs)
- __neg__(self)
- __radd__(self, lhs)
- __rdiv__(self, lhs)
- __rmul__(self, lhs)
- __rsub__(self, lhs)
- __str__(self)
- __sub__(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
Attributes
- dim = 1
Methods from __builtin__.list
- __contains__(...)
-
x.__contains__(y) <==> y in x
- __delitem__(...)
-
x.__delitem__(y) <==> del x[y]
- __delslice__(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- __getattribute__(...)
-
x.__getattribute__('name') <==> x.name
- __getitem__(...)
-
x.__getitem__(y) <==> x[y]
- __reversed__(...)
-
L.__reversed__() -- return a reverse iterator over the list
- __setitem__(...)
-
x.__setitem__(i, y) <==> x[i]=y
- __setslice__(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- __sizeof__(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from __builtin__.list
- __hash__ = None
- __new__ = <built-in method __new__ of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
__add__
- typerig.core.objects.matrix.Table.concat = __add__(...)
-
x.__add__(y) <==> x+y
dim
typerig.core.objects.matrix.Table.dim = 1
map
- typerig.core.objects.matrix.Table.map = map(self, op, rhs=None) unbound typerig.core.objects.matrix.Table method
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
Vec
typerig.core.objects.matrix.Vec = class Vec(Table)
- Method resolution order:
- Vec
- Table
- __builtin__.list
- __builtin__.object
Methods
- cross(self, otherVec)
-
Compute a Vector or Cross Product with another vector
- dot(self, otherVec)
- house(self, index)
-
Compute a Householder vector which zeroes all but the index element after a reflection
- norm(self)
- normalize(self)
- outer(self, otherVec)
- ratval(self, x)
-
Vec([10,20,30,40,50]).ratfit(5) evaluates to (10*x**2 + 20*x + 30) / (40*x**2 + 50*x + 1) at x=5.
Methods from Table
- __abs__(self)
- __add__(self, rhs)
- __div__(self, rhs)
- __eq__(self, rhs)
- __getslice__(self, i, j)
- __init__(self, elems)
- __mul__(self, rhs)
- __neg__(self)
- __radd__(self, lhs)
- __rdiv__(self, lhs)
- __rmul__(self, lhs)
- __rsub__(self, lhs)
- __str__(self)
- __sub__(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors from Table
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
Attributes from Table
- dim = 1
Methods from __builtin__.list
- __contains__(...)
-
x.__contains__(y) <==> y in x
- __delitem__(...)
-
x.__delitem__(y) <==> del x[y]
- __delslice__(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- __getattribute__(...)
-
x.__getattribute__('name') <==> x.name
- __getitem__(...)
-
x.__getitem__(y) <==> x[y]
- __reversed__(...)
-
L.__reversed__() -- return a reverse iterator over the list
- __setitem__(...)
-
x.__setitem__(i, y) <==> x[i]=y
- __setslice__(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- __sizeof__(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from __builtin__.list
- __hash__ = None
- __new__ = <built-in method __new__ of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
cross
- typerig.core.objects.matrix.Vec.cross = cross(self, otherVec) unbound typerig.core.objects.matrix.Vec method
-
Compute a Vector or Cross Product with another vector
house
- typerig.core.objects.matrix.Vec.house = house(self, index) unbound typerig.core.objects.matrix.Vec method
-
Compute a Householder vector which zeroes all but the index element after a reflection
polyval
- typerig.core.objects.matrix.Vec.polyval = polyval(self, x) unbound typerig.core.objects.matrix.Vec method
-
Vec([6,3,4]).polyval(5) evaluates to 6*x**2 + 3*x + 4 at x=5
ratval
- typerig.core.objects.matrix.Vec.ratval = ratval(self, x) unbound typerig.core.objects.matrix.Vec method
-
Vec([10,20,30,40,50]).ratfit(5) evaluates to (10*x**2 + 20*x + 30) / (40*x**2 + 50*x + 1) at x=5.
Matrix
typerig.core.objects.matrix.Matrix = class Matrix(Table)
- Method resolution order:
- Matrix
- Table
- __builtin__.list
- __builtin__.object
Methods
- __init__(self, elems)
-
Form a matrix from a list of lists or a list of Vecs
- augment(self, otherMat)
-
Make a new matrix with the two original matrices laid side by side
- diag(self)
-
Return a vector composed of elements on the matrix diagonal
- mmul(self, other)
-
Matrix multiply by another matrix or a column vector
- qr(self, ROnly=0)
-
QR decomposition using Householder reflections: Q*R==self, Q.tr()*Q==I(n), R upper triangular
- rank(self)
- solve(self, b)
-
Divide matrix into a column vector or matrix and iterate to improve the solution
- tr(self)
-
Tranpose elements so that Transposed[i][j] = Original[j][i]
- trace(self)
Descriptors
- cols
- rows
- size
Methods from Table
- __abs__(self)
- __add__(self, rhs)
- __div__(self, rhs)
- __eq__(self, rhs)
- __getslice__(self, i, j)
- __mul__(self, rhs)
- __neg__(self)
- __radd__(self, lhs)
- __rdiv__(self, lhs)
- __rmul__(self, lhs)
- __rsub__(self, lhs)
- __str__(self)
- __sub__(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors from Table
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
Attributes from Table
- dim = 1
Methods from __builtin__.list
- __contains__(...)
-
x.__contains__(y) <==> y in x
- __delitem__(...)
-
x.__delitem__(y) <==> del x[y]
- __delslice__(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- __getattribute__(...)
-
x.__getattribute__('name') <==> x.name
- __getitem__(...)
-
x.__getitem__(y) <==> x[y]
- __reversed__(...)
-
L.__reversed__() -- return a reverse iterator over the list
- __setitem__(...)
-
x.__setitem__(i, y) <==> x[i]=y
- __setslice__(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- __sizeof__(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from __builtin__.list
- __hash__ = None
- __new__ = <built-in method __new__ of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
tr
- typerig.core.objects.matrix.Matrix.tr = tr(self) unbound typerig.core.objects.matrix.Matrix method
-
Tranpose elements so that Transposed[i][j] = Original[j][i]
star
- typerig.core.objects.matrix.Matrix.star = star(self) unbound typerig.core.objects.matrix.Matrix method
-
Return the Hermetian adjoint so that Star[i][j] = Original[j][i].conjugate()
diag
- typerig.core.objects.matrix.Matrix.diag = diag(self) unbound typerig.core.objects.matrix.Matrix method
-
Return a vector composed of elements on the matrix diagonal
mmul
- typerig.core.objects.matrix.Matrix.mmul = mmul(self, other) unbound typerig.core.objects.matrix.Matrix method
-
Matrix multiply by another matrix or a column vector
augment
- typerig.core.objects.matrix.Matrix.augment = augment(self, otherMat) unbound typerig.core.objects.matrix.Matrix method
-
Make a new matrix with the two original matrices laid side by side
qr
- typerig.core.objects.matrix.Matrix.qr = qr(self, ROnly=0) unbound typerig.core.objects.matrix.Matrix method
-
QR decomposition using Householder reflections: Q*R==self, Q.tr()*Q==I(n), R upper triangular
solve
- typerig.core.objects.matrix.Matrix.solve = solve(self, b) unbound typerig.core.objects.matrix.Matrix method
-
Divide matrix into a column vector or matrix and iterate to improve the solution
Square
typerig.core.objects.matrix.Square = class Square(Matrix)
- Method resolution order:
- Square
- Matrix
- Table
- __builtin__.list
- __builtin__.object
Methods
- __pow__(self, exp)
-
Raise a square matrix to an integer power (i.e. A**3 is the same as A.mmul(A.mmul(A))
- det(self)
- eigs(self)
-
Estimate principal eigenvalues using the QR with shifts method
- hessenberg(self)
-
Householder reduction to Hessenberg Form (zeroes below the diagonal) while keeping the same eigenvalues as self.
- inverse(self)
Methods from Matrix
- __init__(self, elems)
-
Form a matrix from a list of lists or a list of Vecs
- augment(self, otherMat)
-
Make a new matrix with the two original matrices laid side by side
- diag(self)
-
Return a vector composed of elements on the matrix diagonal
- mmul(self, other)
-
Matrix multiply by another matrix or a column vector
- qr(self, ROnly=0)
-
QR decomposition using Householder reflections: Q*R==self, Q.tr()*Q==I(n), R upper triangular
- rank(self)
- solve(self, b)
-
Divide matrix into a column vector or matrix and iterate to improve the solution
- tr(self)
-
Tranpose elements so that Transposed[i][j] = Original[j][i]
- trace(self)
Descriptors from Matrix
- cols
- rows
- size
Methods from Table
- __abs__(self)
- __add__(self, rhs)
- __div__(self, rhs)
- __eq__(self, rhs)
- __getslice__(self, i, j)
- __mul__(self, rhs)
- __neg__(self)
- __radd__(self, lhs)
- __rdiv__(self, lhs)
- __rmul__(self, lhs)
- __rsub__(self, lhs)
- __str__(self)
- __sub__(self, rhs)
- conjugate(self)
- exists(self, predicate)
- flatten(self)
- forall(self, predicate)
- imag(self)
- map(self, op, rhs=None)
-
Apply a unary operator to every element in the matrix or a binary operator to corresponding elements in two arrays. If the dimensions are different, broadcast the smaller dimension over the larger (i.e. match a scalar to every element in a vector or a vector to a matrix).
- prod(self)
- real(self)
- sum(self)
Descriptors from Table
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
Attributes from Table
- dim = 1
Methods from __builtin__.list
- __contains__(...)
-
x.__contains__(y) <==> y in x
- __delitem__(...)
-
x.__delitem__(y) <==> del x[y]
- __delslice__(...)
-
x.__delslice__(i, j) <==> del x[i:j] Use of negative indices is not supported.
- __getattribute__(...)
-
x.__getattribute__('name') <==> x.name
- __getitem__(...)
-
x.__getitem__(y) <==> x[y]
- __reversed__(...)
-
L.__reversed__() -- return a reverse iterator over the list
- __setitem__(...)
-
x.__setitem__(i, y) <==> x[i]=y
- __setslice__(...)
-
x.__setslice__(i, j, y) <==> x[i:j]=y Use of negative indices is not supported.
- __sizeof__(...)
-
L.__sizeof__() -- size of L in memory, in bytes
- index(...)
-
L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
- pop(...)
-
L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
- remove(...)
-
L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.
- sort(...)
-
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Attributes from __builtin__.list
- __hash__ = None
- __new__ = <built-in method __new__ of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
lu
- typerig.core.objects.matrix.Square.lu = lu(self) unbound typerig.core.objects.matrix.Square method
-
Factor a square matrix into lower and upper triangular form such that L.mmul(U)==A
hessenberg
- typerig.core.objects.matrix.Square.hessenberg = hessenberg(self) unbound typerig.core.objects.matrix.Square method
-
Householder reduction to Hessenberg Form (zeroes below the diagonal) while keeping the same eigenvalues as self.
eigs
- typerig.core.objects.matrix.Square.eigs = eigs(self) unbound typerig.core.objects.matrix.Square method
-
Estimate principal eigenvalues using the QR with shifts method
Mat
- typerig.core.objects.matrix.Mat = Mat(elems)
-
Factory function to create a new matrix.
funToVec
- typerig.core.objects.matrix.funToVec = funToVec(tgtfun, low=-1, high=1, steps=40, EqualSpacing=0)
-
Compute x,y points from evaluating a target function over an interval (low to high) at evenly spaces points or with Chebyshev abscissa spacing (default)
funfit
- typerig.core.objects.matrix.funfit = funfit((xvec, yvec), basisfuns)
-
Solves design matrix for approximating to basis functions
polyfit
- typerig.core.objects.matrix.polyfit = polyfit((xvec, yvec), degree=2)
-
Solves Vandermonde design matrix for approximating polynomial coefficients
ratfit
- typerig.core.objects.matrix.ratfit = ratfit((xvec, yvec), degree=2)
-
Solves design matrix for approximating rational polynomial coefficients (a*x**2 + b*x + c)/(d*x**2 + e*x + 1)
zeroes
- typerig.core.objects.matrix.zeroes = zeroes(m=1, n=None)
-
Zero matrix with side length m-by-m or m-by-n.
eye
- typerig.core.objects.matrix.eye = eye(m=1, n=None)
-
Identity matrix with side length m-by-m or m-by-n
hilb
- typerig.core.objects.matrix.hilb = hilb(m=1, n=None)
-
Hilbert matrix with side length m-by-m or m-by-n. Elem[i][j]=1/(i+j+1)
rand
- typerig.core.objects.matrix.rand = rand(m=1, n=None)
-
Random matrix with side length m-by-m or m-by-n