Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct vec3{
- long s; # What are s and u for?
- long u;
- };
- -----------------------------------------------------------------------
- cdef vec3 * matrix_to_m1ri(M):
- cdef vec3 t
- cdef vec3 *R = <vec3 *>sage_malloc(M1RI_BITS * sizeof(vec3))
- cdef long ptr, i
- i = 0
- for row in M:
- t.u = 0
- t.s = 0
- ptr = 1
- j = 0
- for x in row:
- if x != 0:
- t.u |= ptr
- if x == 2: # Why check x!=0 and x==2? I think this will make sense if I know
- t.s |= ptr # what long s and long u are.
- ptr += ptr
- R[i] = t
- i+=1
- return R
- -------------------------------------------------------------------------
- cdef vec3 * print_m1ri(vec3 *M):
- cdef long i, j, ptr
- global D
- for i from 0 <= i < M1RI_BITS:
- ptr = 1
- s = ''
- for j from 0 <= j < M1RI_BITS:
- if M[i].u&ptr:
- if M[i].s&ptr:
- s += ':' # We printing the matrix using only
- else: # : . ? and the space characters?
- s += '.' # What sort of output is this?
- elif M[i].s & ptr:
- s += '?'
- else:
- s += ' '
- ptr += ptr
- print s
Advertisement
Add Comment
Please, Sign In to add comment