Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the 'sage.rings.complex_mpc' optional extension is broken in sage-4.8.alpha3 and over #12223

Closed
kiwifb opened this issue Dec 22, 2011 · 11 comments

Comments

@kiwifb
Copy link
Member

kiwifb commented Dec 22, 2011

The optional mpc package installs fine but when I execute sage -b to built the sage code I get

Successfully installed mpc-0.8.3-dev-svn793
Now cleaning up tmp files.
Making Sage/Python scripts relocatable...
Finished installing mpc-0.8.3-dev-svn793.spkg
fbissey@QCD-nzi3 /home/work/fbissey/sandbox/sage-4.8.alpha4 $ ./sage -b

----------------------------------------------------------
sage: Building and installing modified Sage library files.


Installing c_lib
scons: `install' is up to date.
Updating Cython code....
Building sage/rings/complex_mpc.pyx because it depends on /home/work/fbissey/sandbox/sage-4.8.alpha4/local/include/mpc.h.
Execute 1 commands (using 1 threads)
python `which cython`  --old-style-globals --disable-function-redefinition --embed-positions --directive cdivision=True,autotestdict=False,fast_getattr=True -I/home/work/fbissey/sandbox/sage-4.8.alpha4/devel/sage-main -o sage/rings/complex_mpc.c sage/rings/complex_mpc.pyx
sage/rings/complex_mpc.pyx --> /home/work/fbissey/sandbox/sage-4.8.alpha4/local/lib/python2.6/site-packages//sage/rings/complex_mpc.pyx
Time to execute 1 commands: 3.12862586975 seconds
Finished compiling Cython code (time = 4.00216197968 seconds)
running install
running build
running build_py
running build_ext
building 'sage.rings.complex_mpc' extension
Execute 1 commands (using 1 threads)
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/home/work/fbissey/sandbox/sage-4.8.alpha4/local/include -I/home/work/fbissey/sandbox/sage-4.8.alpha4/local/include/csage -I/home/work/fbissey/sandbox/sage-4.8.alpha4/devel/sage/sage/ext -I/home/work/fbissey/sandbox/sage-4.8.alpha4/local/include/python2.6 -c sage/rings/complex_mpc.c -o build/temp.linux-x86_64-2.6/sage/rings/complex_mpc.o -w
sage/rings/complex_mpc.c: In function '__pyx_pf_4sage_5rings_11complex_mpc_15MPComplexNumber_16__float__':
sage/rings/complex_mpc.c:9720:48: error: cast specifies array type
error: command 'gcc' failed with exit status 1
sage: There was an error installing modified sage library code.

Component: packages: optional

Author: Jeroen Demeyer

Reviewer: François Bissey

Merged: sage-5.0.beta5

Issue created by migration from https://trac.sagemath.org/ticket/12223

@kiwifb kiwifb added this to the sage-5.0 milestone Dec 22, 2011
@kiwifb
Copy link
Member Author

kiwifb commented Dec 22, 2011

comment:1

the faulty C code:

    /* "sage/rings/complex_mpc.pyx":1107
 *         if mpfr_zero_p(self.value.im):
 *             return mpfr_get_d(<mpfr_t> self.value.re,\
 *                                    rnd_re((<MPComplexField_class>self._parent).__rnd))             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "can't convert complex to float; use abs(z)"
 */
    __pyx_t_2 = PyFloat_FromDouble(mpfr_get_d(((mpfr_t)((struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber *)__pyx_v_self)->value->re), __pyx_f_4sage_5rings_11complex_mpc_rnd_re(((struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexField_class *)((struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base._parent)->__pyx___rnd))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}  <=line 9720
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "sage/rings/complex_mpc.pyx":1109
 *                                    rnd_re((<MPComplexField_class>self._parent).__rnd))
 *         else:
 *             raise TypeError, "can't convert complex to float; use abs(z)"             # <<<<<<<<<<<<<<
 *
 *     def __complex__(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_76), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("sage.rings.complex_mpc.MPComplexNumber.__float__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

@kiwifb
Copy link
Member Author

kiwifb commented Jan 25, 2012

comment:2

I am putting this to blocker since the spkg builds correctly and then because the extension is broken it breaks sage -b.

@jdemeyer
Copy link

comment:3

Just wondering: why isn't this a standard package? I guess complex arithmetic in Sage would benefit from it.

@kiwifb
Copy link
Member Author

kiwifb commented Jan 31, 2012

comment:4

There was some discussion a while back when David Kirkby put it in shape last. If I remember correctly the gist of it was that you could do complex arithmetic some other way in sage and that there wasn't much benefits from it. I would have to dig sage-devel to find it.

@jdemeyer
Copy link

comment:5

Attachment: 12223_mpc.patch.gz

@jdemeyer
Copy link

Author: Jeroen Demeyer

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

comment:6

See #12515 to make this a standard spkg.

@kiwifb
Copy link
Member Author

kiwifb commented Feb 16, 2012

Reviewer: François Bissey

@kiwifb
Copy link
Member Author

kiwifb commented Feb 16, 2012

comment:7

Ok I tested the patch and it works. I am giving this a positive review.

@jdemeyer
Copy link

Merged: sage-5.0.beta5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants