Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SpartanBotsOutlab67
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roshan Rabinarayan
SpartanBotsOutlab67
Commits
46527776
Commit
46527776
authored
Oct 02, 2020
by
Sanchit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All parts of 1 except c and Readme
parent
70a324d1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
Readme.txt
Readme.txt
+6
-0
q1/triwizard.py
q1/triwizard.py
+10
-8
No files found.
Readme.txt
0 → 100644
View file @
46527776
https://en.wikipedia.org/wiki/Rotation_matrix
https://www.geeksforgeeks.org/numpy-cumsum-in-python/
https://www.javatpoint.com/numpy-pad
https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.groupby.html
https://scipython.com/book/chapter-6-numpy/examples/creating-a-rotation-matrix-in-numpy/
\ No newline at end of file
q1/triwizard.py
View file @
46527776
...
...
@@ -6,7 +6,7 @@ import random # for testing
def
avada_kedavra
(
my_list
):
# Create an array 'a0' from this list 'my_list'
#my_integer=random.sample(range(1,101), 25) to test
a0
=
np
.
array
(
my_
integer
)
a0
=
np
.
array
(
my_
list
)
# print a0
print
(
"a0 at beginning:
\n
{}"
.
format
(
a0
))
...
...
@@ -107,13 +107,13 @@ def expelliarmus(arr, theta, axis):
[
s
,
c
,
0
],
[
0
,
0
,
1
]])
if
axis
==
'X'
:
res
=
np
.
dot
(
mat
,
rot_array_x
)
res
=
np
.
dot
(
arr
,
rot_array_x
)
return
(
res
.
round
(
decimals
=
2
))
if
axis
==
'Y'
:
res
=
np
.
dot
(
mat
,
rot_array_y
)
res
=
np
.
dot
(
arr
,
rot_array_y
)
return
(
res
.
round
(
decimals
=
2
))
if
axis
==
'Z'
:
res
=
np
.
dot
(
mat
,
rot_array_z
)
res
=
np
.
dot
(
arr
,
rot_array_z
)
return
(
res
.
round
(
decimals
=
2
))
...
...
@@ -131,8 +131,11 @@ def crucio(arr):
# 'arr': int 1-D array; dim: (n,)
# k: integer
# return type: int 1-D array; dim: (n+k-1,)
def
leviosa
(
arr
,
k
):
pass
def
leviosa
(
arr
,
k
):
arr
=
np
.
pad
(
arr
,(
0
,
k
-
1
))
cumm_ar
=
np
.
cumsum
(
arr
)
cumm_ar
[
k
:]
=
cumm_ar
[
k
:]
-
cumm_ar
[:
-
k
]
return
cumm_ar
# ---- Task (g) -------
...
...
@@ -140,7 +143,6 @@ def leviosa(arr, k):
# k: integer
# return type: n-D integer array; dim: (m,k)
def
accio
(
mat
,
k
):
pass
return
np
.
fliplr
(
np
.
argsort
(
mat
))[:,:
k
]
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