Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
nam
ProxPython
Commits
a7d46f52
Commit
a7d46f52
authored
Sep 27, 2019
by
robin.requadt
Browse files
Upload New File
parent
f81e5e7c
Changes
1
Hide whitespace changes
Inline
Side-by-side
TestSuite/testing_Algorithms/test_KM.py
0 → 100644
View file @
a7d46f52
import
numpy
as
np
import
unittest
from
proxtoolbox.Algorithms.KM
import
*
from
proxtoolbox.ProxOperators.P_binary
import
*
from
proxtoolbox.ProxOperators.P_RN
import
*
from
proxtoolbox.ProxOperators.P_M
import
*
# input: config={'proxoperators':[P_binary,P_RN,P_avg],'beta0':2 ,'beta_max':2,'beta_switch':1,'prox_idx':2,'iter':10,'prox_idx':2,'support_idx':np.array([1,2]),'Nx':8,'Ny':0,'Nz':0,'Prox':[P_binary,P_RN], 'norm_data':1, 'product_space_dimension':5,'beta_0':2,'Fx':np.array([1,2,3]),'phi':2}
#u=[1,2,5,6,-5,-6],
class
test_KM
(
unittest
.
TestCase
):
def
test_KM
(
self
):
config
=
{
'proxoperators'
:[
P_binary
,
P_RN
,
P_M
],
'beta0'
:
2
,
'beta_max'
:
2
,
'beta_switch'
:
1
,
'prox_idx'
:
2
,
'iter'
:
10
,
'prox_idx'
:
2
,
'support_idx'
:
np
.
array
([
1
,
2
]),
'Nx'
:
8
,
'Ny'
:
0
,
'Nz'
:
0
,
'Prox'
:[
P_binary
,
P_RN
],
'norm_data'
:
1
,
'product_space_dimension'
:
5
,
'beta_0'
:
2
,
'Fx'
:
np
.
array
([
1
,
2
,
3
]),
'phi'
:
2
,
'T'
:
P_M
,
'M'
:
np
.
array
([
1
,
2
,
2
,
2
,
2
,
12
])}
self
.
pro
=
KM
(
config
)
u
=
np
.
array
([
1
,
2
,
5
,
6
,
-
5
,
-
6
])
self
.
assertEqual
(
self
.
pro
.
evaluate
(
u
).
tolist
(),
np
.
array
([
1000
,
1001
,
1004
,
1005
,
994
,
993
]).
tolist
())
if
__name__
==
'__main__'
:
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment