Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
Q
QuizNumer
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
Kittipong Maneewong
QuizNumer
Commits
5d856783
Commit
5d856783
authored
May 23, 2018
by
Kittipong Maneewong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add quiz
parent
8f3cce28
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
285 additions
and
17 deletions
+285
-17
Project_Default.xml
.idea/inspectionProfiles/Project_Default.xml
+18
-0
workspace.xml
.idea/workspace.xml
+194
-15
converter.py
Quiz01/converter.py
+8
-0
double.py
Quiz01/double.py
+11
-0
linear.py
Quiz01/linear.py
+26
-0
mat.py
Quiz01/mat.py
+0
-2
solver.py
Quiz01/solver.py
+28
-0
No files found.
.idea/inspectionProfiles/Project_Default.xml
0 → 100644
View file @
5d856783
<component
name=
"InspectionProjectProfileManager"
>
<profile
version=
"1.0"
>
<option
name=
"myName"
value=
"Project Default"
/>
<inspection_tool
class=
"PyPackageRequirementsInspection"
enabled=
"true"
level=
"WARNING"
enabled_by_default=
"true"
>
<option
name=
"ignoredPackages"
>
<value>
<list
size=
"4"
>
<item
index=
"0"
class=
"java.lang.String"
itemvalue=
"nose"
/>
<item
index=
"1"
class=
"java.lang.String"
itemvalue=
"coverage"
/>
<item
index=
"2"
class=
"java.lang.String"
itemvalue=
"mock"
/>
<item
index=
"3"
class=
"java.lang.String"
itemvalue=
"PyHamcrest"
/>
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
.idea/workspace.xml
View file @
5d856783
...
...
@@ -2,7 +2,13 @@
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"24fc8a58-65b7-42e4-976e-aef7770e9fc8"
name=
"Default"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/.idea/vcs.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/Quiz01/converter.py"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/Quiz01/double.py"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/Quiz01/linear.py"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/Quiz01/solver.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Quiz01/mat.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Quiz01/mat.py"
afterDir=
"false"
/>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"TRACKING_ENABLED"
value=
"true"
/>
...
...
@@ -12,10 +18,60 @@
<option
name=
"LAST_RESOLUTION"
value=
"IGNORE"
/>
</component>
<component
name=
"CoverageDataManager"
>
<SUITE
FILE_PATH=
"coverage/QuizNumer$solver.coverage"
NAME=
"solver Coverage Results"
MODIFIED=
"1527086803930"
SOURCE_PROVIDER=
"com.intellij.coverage.DefaultCoverageFileProvider"
RUNNER=
"coverage.py"
COVERAGE_BY_TEST_ENABLED=
"true"
COVERAGE_TRACING_ENABLED=
"false"
WORKING_DIRECTORY=
"$PROJECT_DIR$/Quiz01"
/>
<SUITE
FILE_PATH=
"coverage/QuizNumer$converter.coverage"
NAME=
"converter Coverage Results"
MODIFIED=
"1527088735129"
SOURCE_PROVIDER=
"com.intellij.coverage.DefaultCoverageFileProvider"
RUNNER=
"coverage.py"
COVERAGE_BY_TEST_ENABLED=
"true"
COVERAGE_TRACING_ENABLED=
"false"
WORKING_DIRECTORY=
"$PROJECT_DIR$/Quiz01"
/>
<SUITE
FILE_PATH=
"coverage/QuizNumer$mat.coverage"
NAME=
"mat Coverage Results"
MODIFIED=
"1527080501840"
SOURCE_PROVIDER=
"com.intellij.coverage.DefaultCoverageFileProvider"
RUNNER=
"coverage.py"
COVERAGE_BY_TEST_ENABLED=
"true"
COVERAGE_TRACING_ENABLED=
"false"
WORKING_DIRECTORY=
"$PROJECT_DIR$/Quiz/Quiz01"
/>
<SUITE
FILE_PATH=
"coverage/QuizNumer$linear.coverage"
NAME=
"linear Coverage Results"
MODIFIED=
"1527082469071"
SOURCE_PROVIDER=
"com.intellij.coverage.DefaultCoverageFileProvider"
RUNNER=
"coverage.py"
COVERAGE_BY_TEST_ENABLED=
"true"
COVERAGE_TRACING_ENABLED=
"false"
WORKING_DIRECTORY=
"$PROJECT_DIR$/Quiz01"
/>
<SUITE
FILE_PATH=
"coverage/QuizNumer$double.coverage"
NAME=
"double Coverage Results"
MODIFIED=
"1527089413305"
SOURCE_PROVIDER=
"com.intellij.coverage.DefaultCoverageFileProvider"
RUNNER=
"coverage.py"
COVERAGE_BY_TEST_ENABLED=
"true"
COVERAGE_TRACING_ENABLED=
"false"
WORKING_DIRECTORY=
"$PROJECT_DIR$/Quiz01"
/>
</component>
<component
name=
"FileEditorManager"
>
<leaf
/>
<leaf>
<file
leaf-file-name=
"linear.py"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Quiz01/linear.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"105"
>
<caret
line=
"7"
column=
"28"
selection-start-line=
"7"
selection-start-column=
"28"
selection-end-line=
"7"
selection-end-column=
"28"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"solver.py"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Quiz01/solver.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"165"
>
<caret
line=
"11"
column=
"16"
lean-forward=
"true"
selection-start-line=
"11"
selection-start-column=
"16"
selection-end-line=
"11"
selection-end-column=
"16"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"converter.py"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Quiz01/converter.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"75"
>
<caret
line=
"5"
column=
"28"
selection-start-line=
"5"
selection-start-column=
"28"
selection-end-line=
"5"
selection-end-column=
"28"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"double.py"
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/Quiz01/double.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"30"
>
<caret
line=
"2"
column=
"21"
selection-start-line=
"2"
selection-start-column=
"21"
selection-end-line=
"2"
selection-end-column=
"21"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"mat.py"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Quiz01/mat.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"60"
>
<caret
line=
"4"
column=
"5"
lean-forward=
"true"
selection-start-line=
"4"
selection-start-column=
"5"
selection-end-line=
"4"
selection-end-column=
"5"
/>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component
name=
"FileTemplateManagerImpl"
>
<option
name=
"RECENT_TEMPLATES"
>
...
...
@@ -36,6 +92,11 @@
<option
name=
"CHANGED_PATHS"
>
<list>
<option
value=
"$PROJECT_DIR$/Quiz/Quiz01/mat.py"
/>
<option
value=
"$PROJECT_DIR$/Quiz01/mat.py"
/>
<option
value=
"$PROJECT_DIR$/Quiz01/linear.py"
/>
<option
value=
"$PROJECT_DIR$/Quiz01/solver.py"
/>
<option
value=
"$PROJECT_DIR$/Quiz01/converter.py"
/>
<option
value=
"$PROJECT_DIR$/Quiz01/double.py"
/>
</list>
</option>
</component>
...
...
@@ -48,10 +109,10 @@
<component
name=
"NodePackageJsonFileManager"
>
<packageJsonPaths
/>
</component>
<component
name=
"ProjectFrameBounds"
extendedState=
"
6
"
>
<option
name=
"x"
value=
"
67
"
/>
<component
name=
"ProjectFrameBounds"
extendedState=
"
4
"
>
<option
name=
"x"
value=
"
721
"
/>
<option
name=
"y"
value=
"25"
/>
<option
name=
"width"
value=
"
1299
"
/>
<option
name=
"width"
value=
"
645
"
/>
<option
name=
"height"
value=
"743"
/>
</component>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"true"
/>
...
...
@@ -70,12 +131,6 @@
<path>
<item
name=
"QuizNumer"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"QuizNumer"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"Quiz"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"QuizNumer"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"QuizNumer"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"Quiz"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"Quiz01"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
</expand>
...
...
@@ -101,7 +156,64 @@
</list>
</option>
</component>
<component
name=
"RunManager"
>
<component
name=
"RunManager"
selected=
"Python.double"
>
<configuration
name=
"converter"
type=
"PythonConfigurationType"
factoryName=
"Python"
temporary=
"true"
>
<module
name=
"QuizNumer"
/>
<option
name=
"INTERPRETER_OPTIONS"
value=
""
/>
<option
name=
"PARENT_ENVS"
value=
"true"
/>
<envs>
<env
name=
"PYTHONUNBUFFERED"
value=
"1"
/>
</envs>
<option
name=
"SDK_HOME"
value=
""
/>
<option
name=
"WORKING_DIRECTORY"
value=
"$PROJECT_DIR$/Quiz01"
/>
<option
name=
"IS_MODULE_SDK"
value=
"true"
/>
<option
name=
"ADD_CONTENT_ROOTS"
value=
"true"
/>
<option
name=
"ADD_SOURCE_ROOTS"
value=
"true"
/>
<EXTENSION
ID=
"PythonCoverageRunConfigurationExtension"
runner=
"coverage.py"
/>
<option
name=
"SCRIPT_NAME"
value=
"$PROJECT_DIR$/Quiz01/converter.py"
/>
<option
name=
"PARAMETERS"
value=
""
/>
<option
name=
"SHOW_COMMAND_LINE"
value=
"false"
/>
<option
name=
"EMULATE_TERMINAL"
value=
"false"
/>
<option
name=
"MODULE_MODE"
value=
"false"
/>
</configuration>
<configuration
name=
"double"
type=
"PythonConfigurationType"
factoryName=
"Python"
temporary=
"true"
>
<module
name=
"QuizNumer"
/>
<option
name=
"INTERPRETER_OPTIONS"
value=
""
/>
<option
name=
"PARENT_ENVS"
value=
"true"
/>
<envs>
<env
name=
"PYTHONUNBUFFERED"
value=
"1"
/>
</envs>
<option
name=
"SDK_HOME"
value=
""
/>
<option
name=
"WORKING_DIRECTORY"
value=
"$PROJECT_DIR$/Quiz01"
/>
<option
name=
"IS_MODULE_SDK"
value=
"true"
/>
<option
name=
"ADD_CONTENT_ROOTS"
value=
"true"
/>
<option
name=
"ADD_SOURCE_ROOTS"
value=
"true"
/>
<EXTENSION
ID=
"PythonCoverageRunConfigurationExtension"
runner=
"coverage.py"
/>
<option
name=
"SCRIPT_NAME"
value=
"$PROJECT_DIR$/Quiz01/double.py"
/>
<option
name=
"PARAMETERS"
value=
""
/>
<option
name=
"SHOW_COMMAND_LINE"
value=
"false"
/>
<option
name=
"EMULATE_TERMINAL"
value=
"false"
/>
<option
name=
"MODULE_MODE"
value=
"false"
/>
</configuration>
<configuration
name=
"linear"
type=
"PythonConfigurationType"
factoryName=
"Python"
temporary=
"true"
>
<module
name=
"QuizNumer"
/>
<option
name=
"INTERPRETER_OPTIONS"
value=
""
/>
<option
name=
"PARENT_ENVS"
value=
"true"
/>
<envs>
<env
name=
"PYTHONUNBUFFERED"
value=
"1"
/>
</envs>
<option
name=
"SDK_HOME"
value=
""
/>
<option
name=
"WORKING_DIRECTORY"
value=
"$PROJECT_DIR$/Quiz01"
/>
<option
name=
"IS_MODULE_SDK"
value=
"true"
/>
<option
name=
"ADD_CONTENT_ROOTS"
value=
"true"
/>
<option
name=
"ADD_SOURCE_ROOTS"
value=
"true"
/>
<EXTENSION
ID=
"PythonCoverageRunConfigurationExtension"
runner=
"coverage.py"
/>
<option
name=
"SCRIPT_NAME"
value=
"$PROJECT_DIR$/Quiz01/linear.py"
/>
<option
name=
"PARAMETERS"
value=
""
/>
<option
name=
"SHOW_COMMAND_LINE"
value=
"false"
/>
<option
name=
"EMULATE_TERMINAL"
value=
"false"
/>
<option
name=
"MODULE_MODE"
value=
"false"
/>
</configuration>
<configuration
name=
"mat"
type=
"PythonConfigurationType"
factoryName=
"Python"
temporary=
"true"
>
<module
name=
"QuizNumer"
/>
<option
name=
"INTERPRETER_OPTIONS"
value=
""
/>
...
...
@@ -121,8 +233,38 @@
<option
name=
"EMULATE_TERMINAL"
value=
"false"
/>
<option
name=
"MODULE_MODE"
value=
"false"
/>
</configuration>
<configuration
name=
"solver"
type=
"PythonConfigurationType"
factoryName=
"Python"
temporary=
"true"
>
<module
name=
"QuizNumer"
/>
<option
name=
"INTERPRETER_OPTIONS"
value=
""
/>
<option
name=
"PARENT_ENVS"
value=
"true"
/>
<envs>
<env
name=
"PYTHONUNBUFFERED"
value=
"1"
/>
</envs>
<option
name=
"SDK_HOME"
value=
""
/>
<option
name=
"WORKING_DIRECTORY"
value=
"$PROJECT_DIR$/Quiz01"
/>
<option
name=
"IS_MODULE_SDK"
value=
"true"
/>
<option
name=
"ADD_CONTENT_ROOTS"
value=
"true"
/>
<option
name=
"ADD_SOURCE_ROOTS"
value=
"true"
/>
<EXTENSION
ID=
"PythonCoverageRunConfigurationExtension"
runner=
"coverage.py"
/>
<option
name=
"SCRIPT_NAME"
value=
"$PROJECT_DIR$/Quiz01/solver.py"
/>
<option
name=
"PARAMETERS"
value=
""
/>
<option
name=
"SHOW_COMMAND_LINE"
value=
"false"
/>
<option
name=
"EMULATE_TERMINAL"
value=
"false"
/>
<option
name=
"MODULE_MODE"
value=
"false"
/>
</configuration>
<list>
<item
itemvalue=
"Python.mat"
/>
<item
itemvalue=
"Python.linear"
/>
<item
itemvalue=
"Python.solver"
/>
<item
itemvalue=
"Python.converter"
/>
<item
itemvalue=
"Python.double"
/>
</list>
<recent_temporary>
<list>
<item
itemvalue=
"Python.double"
/>
<item
itemvalue=
"Python.converter"
/>
<item
itemvalue=
"Python.solver"
/>
<item
itemvalue=
"Python.linear"
/>
<item
itemvalue=
"Python.mat"
/>
</list>
</recent_temporary>
...
...
@@ -149,16 +291,17 @@
<servers
/>
</component>
<component
name=
"ToolWindowManager"
>
<frame
x=
"67"
y=
"25"
width=
"1299"
height=
"743"
extended-state=
"6"
/>
<frame
x=
"721"
y=
"25"
width=
"645"
height=
"743"
extended-state=
"4"
/>
<editor
active=
"true"
/>
<layout>
<window_info
anchor=
"bottom"
id=
"TODO"
order=
"6"
/>
<window_info
anchor=
"bottom"
id=
"Event Log"
side_tool=
"true"
/>
<window_info
anchor=
"bottom"
id=
"Database Changes"
show_stripe_button=
"false"
/>
<window_info
anchor=
"bottom"
id=
"Run"
order=
"2"
visible=
"true"
weight=
"0.328594"
/>
<window_info
a
ctive=
"true"
a
nchor=
"bottom"
id=
"Run"
order=
"2"
visible=
"true"
weight=
"0.328594"
/>
<window_info
anchor=
"bottom"
id=
"Version Control"
/>
<window_info
anchor=
"bottom"
id=
"Python Console"
/>
<window_info
anchor=
"bottom"
id=
"Terminal"
/>
<window_info
active=
"true"
content_ui=
"combo"
id=
"Project"
order=
"0"
visible=
"true"
weight=
"0.24557352
"
/>
<window_info
content_ui=
"combo"
id=
"Project"
order=
"0"
visible=
"true"
weight=
"0.26511627
"
/>
<window_info
anchor=
"bottom"
id=
"Docker"
show_stripe_button=
"false"
/>
<window_info
anchor=
"right"
id=
"Database"
/>
<window_info
anchor=
"right"
id=
"SciView"
/>
...
...
@@ -192,5 +335,40 @@
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Quiz01/mat.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"60"
>
<caret
line=
"4"
column=
"5"
lean-forward=
"true"
selection-start-line=
"4"
selection-start-column=
"5"
selection-end-line=
"4"
selection-end-column=
"5"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Quiz01/solver.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"165"
>
<caret
line=
"11"
column=
"16"
lean-forward=
"true"
selection-start-line=
"11"
selection-start-column=
"16"
selection-end-line=
"11"
selection-end-column=
"16"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Quiz01/linear.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"105"
>
<caret
line=
"7"
column=
"28"
selection-start-line=
"7"
selection-start-column=
"28"
selection-end-line=
"7"
selection-end-column=
"28"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Quiz01/converter.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"75"
>
<caret
line=
"5"
column=
"28"
selection-start-line=
"5"
selection-start-column=
"28"
selection-end-line=
"5"
selection-end-column=
"28"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Quiz01/double.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"30"
>
<caret
line=
"2"
column=
"21"
selection-start-line=
"2"
selection-start-column=
"21"
selection-end-line=
"2"
selection-end-column=
"21"
/>
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
Quiz01/converter.py
0 → 100644
View file @
5d856783
def
single
(
v
):
v
+=
"0"
*
(
32
-
len
(
v
))
sign
=
-
1
if
v
[
0
]
==
'1'
else
1
e
=
sum
([(
int
(
v
[
i
])
*
2
**
(
8
-
i
))
for
i
in
range
(
1
,
9
)])
x
=
1
+
sum
([
int
(
v
[
i
])
*
(
2
**
(
8
-
i
))
for
i
in
range
(
9
,
32
)])
print
(
sign
*
x
*
2
**
(
e
-
127
))
single
(
"01101011101101010000000000000000"
)
single
(
"11001100101111100010000000000000"
)
Quiz01/double.py
0 → 100644
View file @
5d856783
def
double
(
v
):
v
+=
"0"
*
(
64
-
len
(
v
))
v
=
v
.
replace
(
" "
,
""
)
sign
=
(
-
1
)
**
int
(
v
[
0
])
e
=
sum
([
int
(
v
[
i
])
*
(
2
**
(
11
-
i
))
for
i
in
range
(
1
,
12
)])
x
=
1
+
sum
([
int
(
v
[
i
])
*
(
2
**
(
11
-
i
))
for
i
in
range
(
12
,
64
)])
print
(
sign
*
x
*
2
**
(
e
-
1023
))
double
(
"0 01111111111 0000000000000000000000000000000000000000000000000000"
)
double
(
"11000000000000000000000000000000000000000000000000000000000000000"
)
double
(
"01000000001101110000000000000000000000000000000000000000000000000"
)
Quiz01/linear.py
0 → 100644
View file @
5d856783
import
numpy
as
np
def
Ab2Uc
(
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
):
if
A
[
i
,
k
]
!=
0.0
:
lam
=
A
[
i
,
k
]
/
A
[
k
,
k
]
A
[
i
,
k
]
=
0
A
[
i
,
k
+
1
:
n
]
-=
lam
*
A
[
k
,
k
+
1
:
n
]
b
[
i
]
-=
lam
*
b
[
k
]
print
(
A
)
print
(
b
)
A
=
[
[
4
,
-
2
,
1
],
[
-
2
,
4
,
-
2
],
[
1
,
-
2
,
4
]
]
b
=
[
11
,
-
16
,
17
]
Ab2Uc
(
A
,
b
)
Quiz01/mat.py
View file @
5d856783
...
...
@@ -7,4 +7,3 @@ M = [
[
5
,
4
,
3
,
3
],
[
7
,
3
,
6
,
4
]
]
\ No newline at end of file
sub
(
M
,
2
,
2
,
0
,
1
)
\ No newline at end of file
Quiz01/solver.py
0 → 100644
View file @
5d856783
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
):
if
(
A
[
i
,
k
]
!=
0.0
)
:
lam
=
A
[
i
,
k
]
/
A
[
k
,
k
]
A
[
i
,
k
]
=
0
A
[
i
,
k
+
1
:
n
]
-=
lam
*
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
)
A
=
[
[
4
,
-
2
,
1
],
[
-
2
,
4
,
-
2
],
[
1
,
-
2
,
4
]
]
b
=
[
11
,
-
16
,
17
]
solve
(
A
,
b
)
\ No newline at end of file
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