text stringlengths 81 112k |
|---|
Create a Geometry from a Shapely geometry and the specified SRID.
The Shapely geometry will not be modified.
def from_shapely(sgeom, srid=None):
"""
Create a Geometry from a Shapely geometry and the specified SRID.
The Shapely geometry will not be modified.
"""
if SHAP... |
Get the geometry as an (E)WKB.
def wkb(self):
"""
Get the geometry as an (E)WKB.
"""
return self._to_wkb(use_srid=True, dimz=self.dimz, dimm=self.dimm) |
Get the type of the geometry in PostGIS format, including additional
dimensions and SRID if they exist.
def postgis_type(self):
"""
Get the type of the geometry in PostGIS format, including additional
dimensions and SRID if they exist.
"""
dimz = "Z" if self.dimz else ""... |
Calculates the Poisson log-likelihood.
Args:
data (array): 2d numpy array of genes x cells
means (array): 2d numpy array of genes x k
Returns:
cells x k array of log-likelihood for each cell/cluster pair
def poisson_ll(data, means):
"""
Calculates the Poisson log-likelihood.
... |
Calculates Poisson LL(p1|p2).
def poisson_ll_2(p1, p2):
"""
Calculates Poisson LL(p1|p2).
"""
p1_1 = p1 + eps
p2_1 = p2 + eps
return np.sum(-p2_1 + p1_1*np.log(p2_1)) |
Calculates the Poisson distance between two vectors.
p1 can be a sparse matrix, while p2 has to be a dense matrix.
def poisson_dist(p1, p2):
"""
Calculates the Poisson distance between two vectors.
p1 can be a sparse matrix, while p2 has to be a dense matrix.
"""
# ugh...
p1_ = p1 + eps
... |
Delete the variants of a case.
def delete(ctx, family_file, family_type, case_id):
"""Delete the variants of a case."""
if not (family_file or case_id):
LOG.error("Please provide a family file")
ctx.abort()
adapter = ctx.obj['adapter']
# Get a ped_parser.Family object from family file... |
Builds weekly, monthly and yearly dictionaries
def update_energy(self, bypass_check: bool = False):
"""Builds weekly, monthly and yearly dictionaries"""
if bypass_check or (not bypass_check and self.update_time_check):
self.get_weekly_energy()
if 'week' in self.energy:
... |
Turn on nightlight
def turn_on_nightlight(self):
"""Turn on nightlight"""
body = helpers.req_body(self.manager, 'devicestatus')
body['uuid'] = self.uuid
body['mode'] = 'auto'
response, _ = helpers.call_api(
'/15a/v1/device/nightlightstatus',
'put',
... |
Usage: echo_sedml input-filename output-filename
def main (args):
"""Usage: echo_sedml input-filename output-filename
"""
if len(args) != 3:
print(main.__doc__)
sys.exit(1)
d = libsedml.readSedML(args[1]);
if ( d.getErrorLog().getNumFailsWithSeverity(libsedml.LIBSEDML_SEV_ERROR) > 0):
print (d.g... |
Create the aiohttp session and run the example.
async def main() -> None:
"""Create the aiohttp session and run the example."""
logging.basicConfig(level=logging.INFO)
async with ClientSession() as websession:
try:
client = Client(websession)
await client.profile.login('<E... |
dynamic importing
def my_import(name):
""" dynamic importing """
module, attr = name.rsplit('.', 1)
mod = __import__(module, fromlist=[attr])
klass = getattr(mod, attr)
return klass() |
This tag will check to see if they have the FACEBOOK_LIKE_APP_ID setup
correctly in the django settings, if so then it will pass the data
along to the intercom_tag template to be displayed.
If something isn't perfect we will return False, which will then not
install the javascript since... |
This tag will check to see if they have the FACEBOOK_APP_ID setup
correctly in the django settings, if so then it will pass the data
along to the intercom_tag template to be displayed.
If something isn't perfect we will return False, which will then not
install the javascript since it i... |
Add a variant to the structural variants collection
The process of adding an SV variant differs quite a bit from the
more straight forward case of SNV/INDEL.
Variants are represented in the database by clusters that are two intervals,
one interval for start(pos) and on... |
Check if there are any overlapping sv clusters
Search the sv variants with chrom start end_chrom end and sv_type
Args:
variant (dict): A variant dictionary
Returns:
variant (dict): A variant dictionary
def get_structural_variant(self, variant):
"""Check if there ar... |
Return all structural variants in the database
Args:
chromosome (str)
end_chromosome (str)
sv_type (str)
pos (int): Left position of SV
end (int): Right position of SV
Returns:
variants (Iterable(Variant))
def get_sv_variants(sel... |
Search what clusters a variant belongs to
Args:
variant_id(str): From ID column in vcf
Returns:
clusters()
def get_clusters(self, variant_id):
"""Search what clusters a variant belongs to
Args:
variant_id(str): From ID colum... |
Runs state estimation for multiple initializations, returning the result with the highest log-likelihood. All the arguments are passed to the underlying state estimation functions (poisson_estimate_state, nb_estimate_state, zip_estimate_state).
Args:
data (array): genes x cells
clusters (int): numb... |
Build details dictionary
def get_details(self):
"""Build details dictionary"""
body = helpers.req_body(self.manager, 'devicedetail')
head = helpers.req_headers(self.manager)
r, _ = helpers.call_api('/131airpurifier/v1/device/deviceDetail',
method='post',... |
Turn Air Purifier on
def turn_on(self):
"""Turn Air Purifier on"""
if self.device_status != 'on':
body = helpers.req_body(self.manager, 'devicestatus')
body['uuid'] = self.uuid
body['status'] = 'on'
head = helpers.req_headers(self.manager)
r,... |
Adjust Fan Speed by Specifying 1,2,3 as argument or cycle
through speeds increasing by one
def fan_speed(self, speed: int = None) -> bool:
"""Adjust Fan Speed by Specifying 1,2,3 as argument or cycle
through speeds increasing by one"""
body = helpers.req_body(self.manager, 'devi... |
Set mode to manual, auto or sleep
def mode_toggle(self, mode: str) -> bool:
"""Set mode to manual, auto or sleep"""
head = helpers.req_headers(self.manager)
body = helpers.req_body(self.manager, 'devicestatus')
body['uuid'] = self.uuid
if mode != body['mode'] and mode in ['sleep... |
Arbitrary dimensionality fourier series.
The first parameter is a_0, and the second parameter is the interval/scale
parameter.
The parameters are altering sin and cos paramters.
n = (len(a)-2)/2
def fourier_series(x, *a):
"""
Arbitrary dimensionality fourier series.
The first parameter ... |
Given an undirected adjacency list and a pairwise distance matrix between
all nodes: calculates distances along graph from start node.
Args:
start (int): start node
edges (list): adjacency list of tuples
distances (array): 2d array of distances between nodes
Returns:
dict o... |
Arbitrary dimension polynomial.
def poly_curve(x, *a):
"""
Arbitrary dimension polynomial.
"""
output = 0.0
for n in range(0, len(a)):
output += a[n]*x**n
return output |
Lineage graph produced by minimum spanning tree
Args:
means (array): genes x clusters - output of state estimation
weights (array): clusters x cells - output of state estimation
curve_function (string): either 'poly' or 'fourier'. Default: 'poly'
curve_dimensions (int): number of pa... |
Args:
starting_node (int): index of the starting node
edges (list): list of tuples (node1, node2)
fitted_vals (array): output of lineage (2 x cells)
Returns:
A 1d array containing the pseudotime value of each cell.
def pseudotime(starting_node, edges, fitted_vals):
"""
Args... |
Set up countries data from data in form provided by UNStats and World Bank
Args:
iso3 (str): ISO3 code for country
country (hxl.Row): Country information
Returns:
None
def _add_countriesdata(cls, iso3, country):
# type: (str, hxl.Row) -> None
"""
... |
Set up countries data from data in form provided by UNStats and World Bank
Args:
countries (str): Countries data in HTML format provided by UNStats
Returns:
None
def set_countriesdata(cls, countries):
# type: (str) -> None
"""
Set up countries data from... |
Read countries data from OCHA countries feed (falling back to file)
Args:
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
Returns:
List[Dict[Dict]]: Countries dictionaries
def countriesdata(cls, use_live=True):
# type... |
Set World Bank url from which to retrieve countries data
Args:
url (str): World Bank url from which to retrieve countries data. Defaults to internal value.
Returns:
None
def set_ocha_url(cls, url=None):
# type: (str) -> None
"""
Set World Bank url from ... |
Get country information from ISO3 code
Args:
iso3 (str): ISO3 code for which to get country information
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
exception (Optional[ExceptionUpperBound]): An exception to raise if cou... |
Get country name from ISO3 code
Args:
iso3 (str): ISO3 code for which to get country name
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
exception (Optional[ExceptionUpperBound]): An exception to raise if country not found... |
Get ISO2 from ISO3 code
Args:
iso3 (str): ISO3 code for which to get ISO2 code
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
exception (Optional[ExceptionUpperBound]): An exception to raise if country not found. Defaults ... |
Get country name from ISO2 code
Args:
iso2 (str): ISO2 code for which to get country information
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
exception (Optional[ExceptionUpperBound]): An exception to raise if country no... |
Get country name from ISO2 code
Args:
iso2 (str): ISO2 code for which to get country name
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
exception (Optional[ExceptionUpperBound]): An exception to raise if country not found... |
Get M49 from ISO3 code
Args:
iso3 (str): ISO3 code for which to get M49 code
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
exception (Optional[ExceptionUpperBound]): An exception to raise if country not found. Defaults to... |
Get country name from M49 code
Args:
m49 (int): M49 numeric code for which to get country information
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
exception (Optional[ExceptionUpperBound]): An exception to raise if count... |
Get country name from M49 code
Args:
m49 (int): M49 numeric code for which to get country name
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
exception (Optional[ExceptionUpperBound]): An exception to raise if country not ... |
Expands abbreviation(s) in country name in various ways (eg. FED -> FEDERATED, FEDERAL etc.)
Args:
country (str): Country with abbreviation(s)to expand
Returns:
List[str]: Uppercase country name with abbreviation(s) expanded in various ways
def expand_countryname_abbrevs(cls, ... |
Simplifies country name by removing descriptive text eg. DEMOCRATIC, REPUBLIC OF etc.
Args:
country (str): Country name to simplify
Returns:
Tuple[str, List[str]]: Uppercase simplified country name and list of removed words
def simplify_countryname(cls, country):
# typ... |
Get ISO3 code for cls. Only exact matches or None are returned.
Args:
country (str): Country for which to get ISO3 code
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
exception (Optional[ExceptionUpperBound]): An exception... |
Get ISO3 code for cls. A tuple is returned with the first value being the ISO3 code and the second
showing if the match is exact or not.
Args:
country (str): Country for which to get ISO3 code
use_live (bool): Try to get use latest data from web rather than file in package. Defa... |
Get countries (ISO3 codes) in region
Args:
region (Union[int,str]): Three digit UNStats M49 region code or region name
use_live (bool): Try to get use latest data from web rather than file in package. Defaults to True.
exception (Optional[ExceptionUpperBound]): An exception ... |
Command for profiling of samples. User may upload variants used in profiling
from a vcf, update the profiles for all samples, and get some stats
from the profiles in the database.
Profiling is used to monitor duplicates in the database. The profile is
based on the variants in the 'profi... |
Add several variants to the profile_variant collection in the
database
Args:
profile_variants(list(models.ProfileVariant))
def add_profile_variants(self, profile_variants):
"""Add several variants to the profile_variant collection in the
database
Args:
... |
Returns the ZIP parameters that best fit a given data set.
Args:
data (array): 2d array of genes x cells belonging to a given cluster
Returns:
L (array): 1d array of means
M (array): 1d array of zero-inflation parameter
def zip_fit_params(data):
"""
Returns the ZIP parameters ... |
Performs hard EM clustering using the zero-inflated Poisson distribution.
Args:
data (array): A 2d array- genes x cells
k (int): Number of clusters
init (array, optional): Initial centers - genes x k array. Default: None, use kmeans++
max_iters (int, optional): Maximum number of ite... |
Dimensionality reduction using MDS, while running diffusion on W.
Args:
means (array): genes x clusters
weights (array): clusters x cells
d (int): desired dimensionality
Returns:
W_reduced (array): array of shape (d, cells)
def diffusion_mds(means, weights, d, diffusion_rounds... |
Dimensionality reduction using MDS.
Args:
means (array): genes x clusters
weights (array): clusters x cells
d (int): desired dimensionality
Returns:
W_reduced (array): array of shape (d, cells)
def mds(means, weights, d):
"""
Dimensionality reduction using MDS.
Ar... |
Does a MDS on the data directly, not on the means.
Args:
data (array): genes x cells
d (int): desired dimensionality
Returns:
X, a cells x d matrix
def dim_reduce_data(data, d):
"""
Does a MDS on the data directly, not on the means.
Args:
data (array): genes x cel... |
Get a case from the database
Search the cases with the case id
Args:
case (dict): A case dictionary
Returns:
mongo_case (dict): A mongo case dictionary
def case(self, case):
"""Get a case from the database
Search the cases with... |
Return the number of cases in the database
Args:
snv_cases(bool): If only snv cases should be searched
sv_cases(bool): If only snv cases should be searched
Returns:
cases (Iterable(Case)): A iterable with mongo cases
def nr_cases(self, snv_cases=None, sv_cases=None... |
Add a case to the case collection
If the case exists and update is False raise error.
Args:
db (MongoClient): A connection to the mongodb
case (dict): A case dictionary
update(bool): If existing case should be updated
Returns:
mongo_case_id(Obje... |
Delete case from the database
Delete a case from the database
Args:
case (dict): A case dictionary
def delete_case(self, case):
"""Delete case from the database
Delete a case from the database
Args:
case (dict): A case dictiona... |
Build a list of sink proxies. sink proxies are a two-level ordered
dictionary. The first level contains the lst of drivers, and the second
level contains the list of sink proxies for each driver:
drv1-->sink1
| |->sink2
|
drv2-->sink1
|->sink2
def make_sink_proxies(drivers):
''... |
Returns a ProfileVariant object
Args:
variant (cyvcf2.Variant)
Returns:
variant (models.ProfileVariant)
def build_profile_variant(variant):
"""Returns a ProfileVariant object
Args:
variant (cyvcf2.Variant)
Returns:
variant (models.ProfileVariant)
"""
chr... |
Add loqus specific information to a VCF header
Args:
vcf_obj(cyvcf2.VCF)
def add_headers(vcf_obj, nr_cases=None, sv=False):
"""Add loqus specific information to a VCF header
Args:
vcf_obj(cyvcf2.VCF)
"""
vcf_obj.add_info_to_header(
{
'ID':"Obs",
'N... |
Return cyvcf2 VCF object
Args:
file_path(str)
Returns:
vcf_obj(cyvcf2.VCF)
def get_file_handle(file_path):
"""Return cyvcf2 VCF object
Args:
file_path(str)
Returns:
vcf_obj(cyvcf2.VCF)
"""
LOG.debug("Check if file end is correct")
if not os.path.exis... |
Check if there are any problems with the vcf file
Args:
vcf_path(str)
expected_type(str): 'sv' or 'snv'
Returns:
vcf_info(dict): dict like
{
'nr_variants':<INT>,
'variant_type': <STR> in ['snv', 'sv'],
'individuals': <LIST> individual positio... |
Return True if s is a LDAP DN.
def is_dn(s):
"""Return True if s is a LDAP DN."""
if s == '':
return True
rm = DN_REGEX.match(s)
return rm is not None and rm.group(0) == s |
Write string line as one or more folded lines.
def _fold_line(self, line):
"""Write string line as one or more folded lines."""
if len(line) <= self._cols:
self._output_file.write(line)
self._output_file.write(self._line_sep)
else:
pos = self._cols
... |
Return True if attr_value has to be base-64 encoded.
This is the case because of special chars or because attr_type is in
self._base64_attrs
def _needs_base64_encoding(self, attr_type, attr_value):
"""Return True if attr_value has to be base-64 encoded.
This is the case because of spe... |
Write a single attribute type/value pair.
def _unparse_attr(self, attr_type, attr_value):
"""Write a single attribute type/value pair."""
if self._needs_base64_encoding(attr_type, attr_value):
if not isinstance(attr_value, bytes):
attr_value = attr_value.encode(self._encodin... |
:type entry: Dict[string, List[string]]
:param entry: Dictionary holding an entry
def _unparse_entry_record(self, entry):
"""
:type entry: Dict[string, List[string]]
:param entry: Dictionary holding an entry
"""
for attr_type in sorted(entry.keys()):
for attr... |
Detect and write the changetype.
def _unparse_changetype(self, mod_len):
"""Detect and write the changetype."""
if mod_len == 2:
changetype = 'add'
elif mod_len == 3:
changetype = 'modify'
else:
raise ValueError("modlist item of wrong length")
... |
:type modlist: List[Tuple]
:param modlist: List of additions (2-tuple) or modifications (3-tuple)
def _unparse_change_record(self, modlist):
"""
:type modlist: List[Tuple]
:param modlist: List of additions (2-tuple) or modifications (3-tuple)
"""
mod_len = len(modlist[0]... |
Write an entry or change record to the output file.
:type dn: string
:param dn: distinguished name
:type record: Union[Dict[string, List[string]], List[Tuple]]
:param record: Either a dictionary holding an entry or a list of
additions (2-tuple) or modifications (3-tuple).
... |
Strip trailing line separators from s, but no other whitespaces.
def _strip_line_sep(self, s):
"""Strip trailing line separators from s, but no other whitespaces."""
if s[-2:] == b'\r\n':
return s[:-2]
elif s[-1:] == b'\n':
return s[:-1]
else:
return ... |
Iter input unfoled lines. Skip comments.
def _iter_unfolded_lines(self):
"""Iter input unfoled lines. Skip comments."""
line = self._input_file.readline()
while line:
self.line_counter += 1
self.byte_counter += len(line)
line = self._strip_line_sep(line)
... |
Iter input lines in blocks separated by blank lines.
def _iter_blocks(self):
"""Iter input lines in blocks separated by blank lines."""
lines = []
for line in self._iter_unfolded_lines():
if line:
lines.append(line)
elif lines:
self.record... |
Parse a single attribute type/value pair.
def _parse_attr(self, line):
"""Parse a single attribute type/value pair."""
colon_pos = line.index(b':')
attr_type = line[0:colon_pos].decode('ascii')
if line[colon_pos:].startswith(b'::'):
attr_value = base64.decodestring(line[col... |
Check dn attribute for issues.
def _check_dn(self, dn, attr_value):
"""Check dn attribute for issues."""
if dn is not None:
self._error('Two lines starting with dn: in one record.')
if not is_dn(attr_value):
self._error('No valid string-representation of '
... |
Check changetype attribute for issues.
def _check_changetype(self, dn, changetype, attr_value):
"""Check changetype attribute for issues."""
if dn is None:
self._error('Read changetype: before getting valid dn: line.')
if changetype is not None:
self._error('Two lines st... |
Parse a single entry record from a list of lines.
def _parse_entry_record(self, lines):
"""Parse a single entry record from a list of lines."""
dn = None
entry = OrderedDict()
for line in lines:
attr_type, attr_value = self._parse_attr(line)
if attr_type == 'dn... |
Creates an objective function and its derivative for W, given M and X (data)
Args:
m (array): genes x clusters
X (array): genes x cells
Z (array): zero-inflation parameters - genes x 1
def _create_w_objective(m, X, Z=None):
"""
Creates an objective function and its derivative for W... |
Uses a Zero-inflated Poisson Mixture model to estimate cell states and
cell state mixing weights.
Args:
data (array): genes x cells
clusters (int): number of mixture components
init_means (array, optional): initial centers - genes x clusters. Default: kmeans++ initializations
in... |
Generates kmeans++ initial centers.
Args:
data (array): A 2d array- genes x cells
k (int): Number of clusters
centers (array, optional): if provided, these are one or more known cluster centers. 2d array of genes x number of centers (<=k).
Returns:
centers - a genes x k array o... |
Performs Poisson hard EM on the given data.
Args:
data (array): A 2d array- genes x cells. Can be dense or sparse; for best performance, sparse matrices should be in CSC format.
k (int): Number of clusters
init (array, optional): Initial centers - genes x k array. Default: None, use kmeans+... |
Display cases in the database.
def cases(ctx, case_id, to_json):
"""Display cases in the database."""
adapter = ctx.obj['adapter']
cases = []
if case_id:
case_obj = adapter.case({'case_id':case_id})
if not case_obj:
LOG.info("Case {0} does not exist in database".format(cas... |
Display variants in the database.
def variants(ctx, variant_id, chromosome, end_chromosome, start, end, variant_type,
sv_type):
"""Display variants in the database."""
if sv_type:
variant_type = 'sv'
adapter = ctx.obj['adapter']
if (start or end):
if not (chromosome and s... |
Index the database.
def index(ctx, view):
"""Index the database."""
adapter = ctx.obj['adapter']
if view:
click.echo(adapter.indexes())
return
adapter.ensure_indexes() |
r"""Diagonal of :math:`\mathrm A\mathrm B^\intercal`.
If ``A`` is :math:`n\times p` and ``B`` is :math:`p\times n`, it is done in
:math:`O(pn)`.
Args:
A (array_like): Left matrix.
B (array_like): Right matrix.
out (:class:`numpy.ndarray`, optional): copy result to.
Returns:
... |
r"""Dot product of a matrix and a diagonal one.
Args:
L (array_like): Left matrix.
R (array_like): Right matrix.
out (:class:`numpy.ndarray`, optional): copy result to.
Returns:
:class:`numpy.ndarray`: Resulting matrix.
def ddot(L, R, left=None, out=None):
r"""Dot product ... |
r"""Product of a Cholesky matrix with itself transposed.
Args:
L (array_like): Cholesky matrix.
out (:class:`numpy.ndarray`, optional): copy result to.
Returns:
:class:`numpy.ndarray`: :math:`\mathrm L\mathrm L^\intercal`.
def cdot(L, out=None):
r"""Product of a Cholesky matrix wi... |
Rank data for arrays contaning NaN values.
Parameters
----------
X : array_like
Array of values.
axis : int, optional
Axis value. Defaults to `1`.
inplace : bool, optional
Defaults to `False`.
Returns
-------
array_like
Ranked array.
Examples
-... |
r"""Log of the pseudo-determinant.
It assumes that ``K`` is a positive semi-definite matrix.
Args:
K (array_like): matrix.
Returns:
float: log of the pseudo-determinant.
def plogdet(K):
r"""Log of the pseudo-determinant.
It assumes that ``K`` is a positive semi-definite matrix.
... |
r"""Economic eigen decomposition for symmetric matrices.
A symmetric matrix ``K`` can be decomposed in
:math:`\mathrm Q_0 \mathrm S_0 \mathrm Q_0^\intercal + \mathrm Q_1\
\mathrm S_1 \mathrm Q_1^ \intercal`, where :math:`\mathrm S_1` is a zero
matrix with size determined by ``K``'s rank deficiency.
... |
r"""Economic eigen decomposition for symmetric matrices ``dot(G, G.T)``.
It is theoretically equivalent to ``economic_qs(dot(G, G.T))``.
Refer to :func:`numpy_sugar.economic_qs` for further information.
Args:
G (array_like): Matrix.
Returns:
tuple: ``((Q0, Q1), S0)``.
def economic_qs... |
r"""Cartesian indexing.
Returns a sequence of n-tuples indexing each element of a hypothetical
matrix of the given shape.
Args:
shape (tuple): tuple of dimensions.
Returns:
array_like: indices.
Example
-------
.. doctest::
>>> from numpy_sugar import cartesian
... |
r"""Find the unique elements of an array.
It uses ``dask.array.unique`` if necessary.
Args:
ar (array_like): Input array.
Returns:
array_like: the sorted unique elements.
def unique(ar):
r"""Find the unique elements of an array.
It uses ``dask.array.unique`` if necessary.
A... |
r"""Natural logarithm of a LU decomposition.
Args:
LU (tuple): LU decomposition.
Returns:
tuple: sign and log-determinant.
def lu_slogdet(LU):
r"""Natural logarithm of a LU decomposition.
Args:
LU (tuple): LU decomposition.
Returns:
tuple: sign and log-determinan... |
r"""Solve for LU decomposition.
Solve the linear equations :math:`\mathrm A \mathbf x = \mathbf b`,
given the LU factorization of :math:`\mathrm A`.
Args:
LU (array_like): LU decomposition.
b (array_like): Right-hand side.
Returns:
:class:`numpy.ndarray`: The solution to the s... |
r"""Return the least-squares solution to a linear matrix equation.
Args:
A (array_like): Coefficient matrix.
b (array_like): Ordinate values.
Returns:
:class:`numpy.ndarray`: Least-squares solution.
def lstsq(A, b):
r"""Return the least-squares solution to a linear matrix equation... |
r"""Diagonal of :math:`\mathrm A\mathrm B^\intercal`.
If ``A`` is :math:`n\times p` and ``B`` is :math:`p\times n`, it is done in
:math:`O(pn)`.
Args:
A (array_like): Left matrix.
B (array_like): Right matrix.
Returns:
:class:`numpy.ndarray`: Resulting diagonal.
def dotd(A, B... |
r"""Economic Singular Value Decomposition.
Args:
G (array_like): Matrix to be factorized.
epsilon (float): Threshold on the square root of the eigen values.
Default is ``sqrt(finfo(float).eps)``.
Returns:
:class:`numpy.ndarray`: Unitary matrix.
:class:`... |
r"""Solver for the linear equations of two variables and equations only.
It uses Householder reductions to solve ``Ax = y`` in a robust manner.
Parameters
----------
A : array_like
Coefficient matrix.
y : array_like
Ordinate values.
Returns
-------
:class:`numpy.ndarra... |
r"""Solve for the linear equations :math:`\mathrm A \mathbf x = \mathbf b`.
Args:
A (array_like): Coefficient matrix.
b (array_like): Ordinate values.
Returns:
:class:`numpy.ndarray`: Solution ``x``.
def solve(A, b):
r"""Solve for the linear equations :math:`\mathrm A \mathbf x = ... |
r"""Robust solve for the linear equations.
Args:
A (array_like): Coefficient matrix.
b (array_like): Ordinate values.
Returns:
:class:`numpy.ndarray`: Solution ``x``.
def rsolve(A, b, epsilon=_epsilon):
r"""Robust solve for the linear equations.
Args:
A (array_like): ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.