Skip to content

Commit

Permalink
Properly declare [sd]rotg in tokyo.pxd and return array instead of tu…
Browse files Browse the repository at this point in the history
…ple.
  • Loading branch information
dpo committed Jan 29, 2011
1 parent 469ff64 commit f761f09
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
6 changes: 6 additions & 0 deletions tokyo.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ cdef int isamax(np.ndarray x)
cdef int idamax_(int N, double *x, int dx)
cdef int idamax(np.ndarray x)

# Generate a Givens plane rotation: [a,b,c,s] <- rotg(a,b).
cdef np.ndarray srotg_(float a, float b)
cdef np.ndarray srotg(float a, float b)

cdef np.ndarray drotg_(double a, double b)
cdef np.ndarray drotg(double a, double b)

###########################################
#
Expand Down
18 changes: 11 additions & 7 deletions tokyo.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -208,22 +208,26 @@ cdef int idamax(np.ndarray x):
return lib_idamax(x.shape[0], <double*>x.data, 1)


# Generate a Givens plane rotation: (a,b,c,s) <- rot(a,b).
cdef tuple srotg_(float a, float b):
# Generate a Givens plane rotation: [a,b,c,s] <- rotg(a,b).
cdef np.ndarray srotg_(float a, float b):
cdef np.ndarray x = svnewempty(4)
cdef float aa = a, bb = b, c = 0.0, s = 0.0
lib_srotg(&aa, &bb, &c, &s)
return (aa, bb, c, s)
x[0] = aa ; x[1] = bb ; x[2] = c ; x[3] = s
return x

cdef tuple srotg(float a, float b):
cdef np.ndarray srotg(float a, float b):
return srotg_(a, b)


cdef tuple drotg_(double a, double b):
cdef np.ndarray drotg_(double a, double b):
cdef np.ndarray x = dvnewempty(4)
cdef double aa = a, bb = b, c = 0.0, s = 0.0
lib_drotg(&aa, &bb, &c, &s)
return (aa, bb, c, s)
x[0] = aa ; x[1] = bb ; x[2] = c ; x[3] = s
return x

cdef tuple drotg(double a, double b):
cdef np.ndarray drotg(double a, double b):
return drotg_(a, b)


Expand Down

0 comments on commit f761f09

Please sign in to comment.