Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
solver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Littichai Buddaken
solver
Commits
6e06af00
Commit
6e06af00
authored
May 24, 2018
by
Littichai Buddaken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
22154fa8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
0 deletions
+28
-0
__init__.py
solver/__init__.py
+0
-0
solver.py
solver/solver.py
+15
-0
__init__.py
solver/tests/__init__.py
+0
-0
test_example.py
solver/tests/test_example.py
+13
-0
No files found.
solver/__init__.py
0 → 100644
View file @
6e06af00
solver/solver.py
0 → 100644
View file @
6e06af00
import
numpy
as
np
def
solve
(
A
,
b
):
A
=
np
.
array
(
A
,
float
)
b
=
np
.
array
(
b
,
float
)
n
=
len
(
b
)
for
k
in
range
(
0
,
n
-
1
):
for
i
in
range
(
k
+
1
,
n
):
lam
=
A
[
i
,
k
]
/
A
[
k
,
k
]
A
[
i
,
k
]
=
0
A
[
i
,
k
+
1
:
n
]
-=
A
[
k
,
k
+
1
:
n
]
b
[
i
]
-=
lam
*
b
[
k
]
x
=
b
.
copy
()
for
k
in
range
(
n
-
1
,
-
1
,
-
1
):
x
[
k
]
=
b
[
k
]
-
np
.
dot
(
A
[
k
,
k
+
1
:
n
],
x
[
k
+
1
:
n
])
/
A
[
k
,
k
]
print
(
"x ="
,
x
)
solver/tests/__init__.py
0 → 100644
View file @
6e06af00
solver/tests/test_example.py
0 → 100644
View file @
6e06af00
"""
Example test.
"""
from
hamcrest
import
(
assert_that
,
equal_to
,
is_
,
)
def
test_math
():
assert_that
(
1
+
1
,
is_
(
equal_to
(
2
)))
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