Ticket #6159 (closed defect: fixed)

Opened 8 months ago

Last modified 7 months ago

[with patch, positive review] Implement real_part for CDF and CC

Reported by: jason Owned by: AlexGhitza
Priority: major Milestone: sage-4.1.1
Component: basic arithmetic Keywords:
Cc: Author(s): Alex Ghitza
Report Upstream: Reviewer(s): Burcin Erocal
Merged in: sage-4.1.1.alpha0 Work issues:

Description

sage: CC(I).real_part()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/jason/.sage/temp/littleone/9440/_home_jason__sage_init_sage_0.py in <module>()

AttributeError: 'sage.rings.complex_number.ComplexNumber' object has no attribute 'real_part'


sage: CDF(I).real_part()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/jason/.sage/temp/littleone/9440/_home_jason__sage_init_sage_0.py in <module>()

AttributeError: 'sage.rings.complex_double.ComplexDoubleElement' object has no attribute 'real_part'

but

sage: (3+I).real_part()
3

Attachments

trac_6159.patch Download (2.3 KB) - added by AlexGhitza 7 months ago.

Change History

Changed 7 months ago by AlexGhitza

  • summary changed from Implement real_part for CDF and CC to [with patch, needs review] Implement real_part for CDF and CC
  • author set to Alex Ghitza

Done in the attached patch. I even threw in imag_part() for free.

Changed 7 months ago by AlexGhitza

Changed 7 months ago by AlexGhitza

  • owner changed from somebody to AlexGhitza
  • status changed from new to assigned

Changed 7 months ago by burcin

  • reviewer set to Burcin Erocal
  • summary changed from [with patch, needs review] Implement real_part for CDF and CC to [with patch, positive review] Implement real_part for CDF and CC

Looks good.

Changed 7 months ago by mvngu

  • merged set to sage-4.1.1.alpha0

After a first merge of the patch trac_6159.patch and running full doctests on the Sage library, I got this failure:

sage -t -long devel/sage-exp/sage/modules/vector_double_dense.pyx
**********************************************************************
File "/scratch/mvngu/release/sage-4.1.1.alpha0/devel/sage-exp/sage/modules/vector_double_dense.pyx", line 656:
    sage: v.stats_kurtosis()
Expected:
    -1.23
Got:
    doctest:106: SyntaxWarning: assertion is always true, perhaps remove parentheses?
    -1.23
**********************************************************************
1 items had failures:
   1 of   6 in __main__.example_29
***Test Failed*** 1 failures.
For whitespace errors, see the file /scratch/mvngu/release/sage-4.1.1.alpha0/tmp/.doctest_vector_double_dense.py
	 [2.6 s]

I then unmerged that patch, and all doctests passed. As another attempt, I merged trac_6159.patch a second time, ran all doctests in the Sage library, and they passed.

Changed 7 months ago by mvngu

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.