Ask Your Question

rafarob32's profile - activity

2017-11-01 08:45:42 -0600 received badge  Famous Question (source)
2017-01-05 15:17:01 -0600 received badge  Notable Question (source)
2016-04-21 05:08:15 -0600 commented question rational numbers with cython

Sorry, I don't know how to use mpq_t attribute. Should I import some library for it? How do it? Thanks in advance.

2016-04-21 02:26:47 -0600 received badge  Scholar (source)
2016-04-21 02:26:41 -0600 received badge  Supporter (source)
2016-04-20 14:42:23 -0600 received badge  Editor (source)
2016-04-20 12:41:05 -0600 commented question rational numbers with cython

I re-edited with an example. Thanks.

2016-04-20 10:25:18 -0600 received badge  Popular Question (source)
2016-04-20 10:07:20 -0600 asked a question rational numbers with cython

I want to work efficiently with rational numbers under the context %cython but I don`t know how. Can anyone suggest any ideas? Thank you.

An example:

  %cython

    def rational_partitions(n):
        sol = [i/n for i in range(n)]
        for a in sol[0:-1]:
            for b in sol[1:]:
                k=2
                while abs(b-a)/k>1/n:
                    sol.append(abs(b-a)/k)
                    k += 1
        return sol

rational_partitions(10)
2015-05-04 10:05:17 -0600 received badge  Student (source)
2015-05-04 08:59:21 -0600 asked a question LU decomposition for a matrix

There is an inconsistency in the use of the LU decomposition of a matrix. If matrix A is declared in the RDF ring then P, L, U = A.LU () provides PA = LU but if A is declared in the RR ring (or QQ, ZZ,...) then A = PLU. Therefore in a case P is P.transpose () on the other.