WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.6% of users enabled 2FA.

Commit db68888b authored by John Zhang's avatar John Zhang
Browse files

3D vector product test added

parent 60f30ac4
......@@ -19,6 +19,26 @@ def rand_list_of(n):
return [rffi.r_longlong(unpack('i', pack('I', getrandbits(32)))[0]) for i in range(n)]
def test_vec3prod():
def prod(v1, v2):
a = v1[0] * v2[0]
b = v1[1] * v2[1]
c = v1[2] * v2[2]
return a + b + c
fnc, (db, bdlgen) = fncptr_from_rpy_func(prod, [rffi.CArrayPtr(rffi.LONGLONG), rffi.CArrayPtr(rffi.LONGLONG)], rffi.LONGLONG)
bdlgen.mu.current_thread_as_mu_thread(rmu.null(rmu.MuCPtr))
with lltype.scoped_alloc(rffi.CArray(rffi.LONGLONG), 3) as vec1:
vec1[0] = 1
vec1[1] = 2
vec1[2] = 3
with lltype.scoped_alloc(rffi.CArray(rffi.LONGLONG), 3) as vec2:
vec2[0] = 4
vec2[1] = 5
vec2[2] = 6
assert fnc(vec1, vec2) == 32
def test_find_min():
def find_min(xs, sz):
m = xs[0]
......
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