提交 ccaaf770 authored 作者: David Warde-Farley's avatar David Warde-Farley

Rename PSD_hint -> psd and added docstring.

Pursuant to discussion at https://github.com/Theano/Theano/pull/153/files#r187252 I've renamed the function. I also added a docstring. Conflicts: theano/sandbox/linalg/ops.py
上级 bb6261c4
...@@ -164,8 +164,14 @@ class HintsOptimizer(Optimizer): ...@@ -164,8 +164,14 @@ class HintsOptimizer(Optimizer):
theano.compile.mode.optdb.register('HintsOpt', HintsOptimizer(), -1, 'fast_run', 'fast_compile') theano.compile.mode.optdb.register('HintsOpt', HintsOptimizer(), -1, 'fast_run', 'fast_compile')
def PSD_hint(v): def psd(v):
return Hint(psd=True,symmetric=True)(v) """
Apply a hint that the variable `v` is positive semi-definite, i.e.
it is a symmetric matrix and x^T A x >= for any vector x.
"""
return Hint(psd=True, symmetric=True)(v)
def is_psd(v): def is_psd(v):
return hints(v).get('psd', False) return hints(v).get('psd', False)
def is_symmetric(v): def is_symmetric(v):
...@@ -521,7 +527,7 @@ alloc_diag = AllocDiag() ...@@ -521,7 +527,7 @@ alloc_diag = AllocDiag()
def diag(x): def diag(x):
"""Numpy-compatibility method """Numpy-compatibility method
If `x` is a matrix, return its diagonal. If `x` is a matrix, return its diagonal.
If `x` is a vector return a matrix with it as its diagonal. If `x` is a vector return a matrix with it as its diagonal.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论