Commit 9421e010 authored by Marco Selig's avatar Marco Selig

probing forwards kwargs 'quargs'.

parent 2f36b272
...@@ -7954,7 +7954,7 @@ class operator(object): ...@@ -7954,7 +7954,7 @@ class operator(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def tr(self,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,loop=False): def tr(self,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,loop=False,**kwargs):
""" """
Computes the trace of the operator Computes the trace of the operator
...@@ -7998,9 +7998,9 @@ class operator(object): ...@@ -7998,9 +7998,9 @@ class operator(object):
""" """
if(domain is None): if(domain is None):
domain = self.domain domain = self.domain
return trace_probing(self,function=self.times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var)(loop=loop) return trace_probing(self,function=self.times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var,**kwargs)(loop=loop)
def inverse_tr(self,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,loop=False): def inverse_tr(self,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,loop=False,**kwargs):
""" """
Computes the trace of the inverse operator Computes the trace of the inverse operator
...@@ -8044,11 +8044,11 @@ class operator(object): ...@@ -8044,11 +8044,11 @@ class operator(object):
""" """
if(domain is None): if(domain is None):
domain = self.target domain = self.target
return trace_probing(self,function=self.inverse_times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var)(loop=loop) return trace_probing(self,function=self.inverse_times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var,**kwargs)(loop=loop)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def diag(self,bare=False,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,save=False,path="tmp",prefix="",loop=False): def diag(self,bare=False,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,save=False,path="tmp",prefix="",loop=False,**kwargs):
""" """
Computes the diagonal of the operator via probing. Computes the diagonal of the operator via probing.
...@@ -8115,7 +8115,7 @@ class operator(object): ...@@ -8115,7 +8115,7 @@ class operator(object):
""" """
if(domain is None): if(domain is None):
domain = self.domain domain = self.domain
diag = diagonal_probing(self,function=self.times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var,save=save,path=path,prefix=prefix)(loop=loop) diag = diagonal_probing(self,function=self.times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var,save=save,path=path,prefix=prefix,**kwargs)(loop=loop)
## weight if ... ## weight if ...
if(not domain.discrete)and(bare): if(not domain.discrete)and(bare):
if(isinstance(diag,tuple)): ## diag == (diag,variance) if(isinstance(diag,tuple)): ## diag == (diag,variance)
...@@ -8125,7 +8125,7 @@ class operator(object): ...@@ -8125,7 +8125,7 @@ class operator(object):
else: else:
return diag return diag
def inverse_diag(self,bare=False,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,save=False,path="tmp",prefix="",loop=False): def inverse_diag(self,bare=False,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,save=False,path="tmp",prefix="",loop=False,**kwargs):
""" """
Computes the diagonal of the inverse operator via probing. Computes the diagonal of the inverse operator via probing.
...@@ -8192,7 +8192,7 @@ class operator(object): ...@@ -8192,7 +8192,7 @@ class operator(object):
""" """
if(domain is None): if(domain is None):
domain = self.target domain = self.target
diag = diagonal_probing(self,function=self.inverse_times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var,save=save,path=path,prefix=prefix)(loop=loop) diag = diagonal_probing(self,function=self.inverse_times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var,save=save,path=path,prefix=prefix,**kwargs)(loop=loop)
## weight if ... ## weight if ...
if(not domain.discrete)and(bare): if(not domain.discrete)and(bare):
if(isinstance(diag,tuple)): ## diag == (diag,variance) if(isinstance(diag,tuple)): ## diag == (diag,variance)
...@@ -10361,9 +10361,11 @@ class probing(object): ...@@ -10361,9 +10361,11 @@ class probing(object):
var : bool var : bool
whether the variance will be additionally returned, when the whether the variance will be additionally returned, when the
instance is called instance is called
quargs : dict
Keyword arguments passed to `function` in each call.
""" """
def __init__(self,op=None,function=None,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False): def __init__(self,op=None,function=None,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,**quargs):
""" """
initializes a probing instance initializes a probing instance
...@@ -10465,6 +10467,8 @@ class probing(object): ...@@ -10465,6 +10467,8 @@ class probing(object):
self.var = bool(var) self.var = bool(var)
self.quargs = quargs
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def configure(self,**kwargs): def configure(self,**kwargs):
...@@ -10539,7 +10543,7 @@ class probing(object): ...@@ -10539,7 +10543,7 @@ class probing(object):
depends on the function. depends on the function.
""" """
f = self.function(probe) f = self.function(probe,**self.quargs)
if(isinstance(f,field)): if(isinstance(f,field)):
return f.val return f.val
else: else:
...@@ -10646,7 +10650,7 @@ class probing(object): ...@@ -10646,7 +10650,7 @@ class probing(object):
def __call__(self,loop=False,**kwargs): def __call__(self,loop=False,**kwargs):
""" """
starts the probing process. Starts the probing process.
All keyword arguments that can be given to `configure` can also be All keyword arguments that can be given to `configure` can also be
given to `__call__` and have the same effect. given to `__call__` and have the same effect.
...@@ -10774,9 +10778,11 @@ class trace_probing(probing): ...@@ -10774,9 +10778,11 @@ class trace_probing(probing):
var : bool var : bool
whether the variance will be additionally returned, when the whether the variance will be additionally returned, when the
instance is called instance is called
quargs : dict
Keyword arguments passed to `function` in each call.
""" """
def __init__(self,op,function=None,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False): def __init__(self,op,function=None,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,**quargs):
""" """
initializes a trace probing instance initializes a trace probing instance
...@@ -10874,6 +10880,8 @@ class trace_probing(probing): ...@@ -10874,6 +10880,8 @@ class trace_probing(probing):
self.var = bool(var) self.var = bool(var)
self.quargs = quargs
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def probing(self,idnum,probe): def probing(self,idnum,probe):
...@@ -10892,7 +10900,7 @@ class trace_probing(probing): ...@@ -10892,7 +10900,7 @@ class trace_probing(probing):
result : float result : float
the result of `probe.dot(function(probe))` the result of `probe.dot(function(probe))`
""" """
f = self.function(probe) f = self.function(probe,**self.quargs)
if(f is None): if(f is None):
return None return None
else: else:
...@@ -11020,9 +11028,11 @@ class diagonal_probing(probing): ...@@ -11020,9 +11028,11 @@ class diagonal_probing(probing):
save : {string, None} save : {string, None}
the path and prefix for saved probe files. None in the case where the path and prefix for saved probe files. None in the case where
the probing results are stored in the RAM. the probing results are stored in the RAM.
quargs : dict
Keyword arguments passed to `function` in each call.
""" """
def __init__(self,op,function=None,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,save=False,path="tmp",prefix=""): def __init__(self,op,function=None,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=None,var=False,save=False,path="tmp",prefix="",**quargs):
""" """
initializes a diagonal probing instance initializes a diagonal probing instance
...@@ -11141,6 +11151,8 @@ class diagonal_probing(probing): ...@@ -11141,6 +11151,8 @@ class diagonal_probing(probing):
else: else:
self.save = None self.save = None
self.quargs = quargs
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def configure(self,**kwargs): def configure(self,**kwargs):
...@@ -11231,7 +11243,7 @@ class diagonal_probing(probing): ...@@ -11231,7 +11243,7 @@ class diagonal_probing(probing):
result : ndarray result : ndarray
the result of `probe*(function(probe))` the result of `probe*(function(probe))`
""" """
f = self.function(probe) f = self.function(probe,**self.quargs)
if(f is None): if(f is None):
return None return None
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment