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

Trouble with deepcopy of vectorspaces where the inner product matrix is specified #10606

Closed
jonhanke opened this issue Jan 12, 2011 · 18 comments
Closed

Comments

@jonhanke
Copy link

There are some serious problems using deepcopy on vectorspaces where the inner_product_matrix is specified. This fails over GF(p) for large primes, and over RR.

Please see also Ticket #10577 for a related problem over GF(2).

sage: V = VectorSpace(GF(46337), 2, inner_product_matrix=DiagonalMatrix(ZZ, [1,1]))
sage: deepcopy(V)
Ambient quadratic space of dimension 2 over Finite Field of size 46337
Inner product matrix:
[1 0]
[0 1]
sage: 
sage: V = VectorSpace(GF(46349), 2, inner_product_matrix=DiagonalMatrix(ZZ, [1,1]))
sage: deepcopy(V)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/jonhanke/Documents/SAGE/sage-4.6/<ipython console> in <module>()

/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python/copy.pyc in deepcopy(x, memo, _nil)
    187                             raise Error(
    188                                 "un(deep)copyable object of type %s" % cls)
--> 189                 y = _reconstruct(x, rv, 1, memo)
    190 
    191     memo[d] = y

/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python/copy.pyc in _reconstruct(x, info, deep, memo)
    320         dictiter = None
    321     if deep:
--> 322         args = deepcopy(args, memo)
    323     y = callable(*args)
    324     memo[id(x)] = y

/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python/copy.pyc in deepcopy(x, memo, _nil)
    160     copier = _deepcopy_dispatch.get(cls)
    161     if copier:
--> 162         y = copier(x, memo)
    163     else:
    164         try:

/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python/copy.pyc in _deepcopy_tuple(x, memo)
    233     y = []
    234     for a in x:
--> 235         y.append(deepcopy(a, memo))
    236     d = id(x)
    237     try:

/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python/copy.pyc in deepcopy(x, memo, _nil)
    160     copier = _deepcopy_dispatch.get(cls)
    161     if copier:
--> 162         y = copier(x, memo)
    163     else:
    164         try:

/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python/copy.pyc in _deepcopy_tuple(x, memo)
    233     y = []
    234     for a in x:
--> 235         y.append(deepcopy(a, memo))
    236     d = id(x)
    237     try:

/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python/copy.pyc in deepcopy(x, memo, _nil)
    171             copier = getattr(x, "__deepcopy__", None)
    172             if copier:
--> 173                 y = copier(memo)
    174             else:
    175                 reductor = dispatch_table.get(cls)

TypeError: __deepcopy__() takes no arguments (1 given)

CC: @williamstein @jonhanke

Component: linear algebra

Keywords: copy, vectorspace

Author: Frédéric Chapoton

Branch/Commit: bf855a3

Reviewer: Travis Scrimshaw

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

@jonhanke jonhanke added this to the sage-5.11 milestone Jan 12, 2011
@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@fchapoton
Copy link
Contributor

comment:5

Works in 8.2.b7

@fchapoton fchapoton removed this from the sage-6.4 milestone Mar 10, 2018
@simonbrandhorst
Copy link

comment:6

Shouldn't we add a doctest to show the bug is fixed?

@tscrim
Copy link
Collaborator

tscrim commented May 5, 2018

comment:7

Replying to @simonbrandhorst:

Shouldn't we add a doctest to show the bug is fixed?

Feel free to add one.

@fchapoton
Copy link
Contributor

Changed author from Jonathan Hanke to Frédéric Chapoton

@fchapoton
Copy link
Contributor

Branch: u/chapoton/10606

@fchapoton
Copy link
Contributor

Commit: eb0d0d5

@fchapoton
Copy link
Contributor

comment:8

doctest added, please review


New commits:

eb0d0d5trac 10606 adding a doctest

@fchapoton fchapoton added this to the sage-8.3 milestone May 6, 2018
@tscrim
Copy link
Collaborator

tscrim commented May 6, 2018

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented May 6, 2018

comment:9

LGTM.

@fchapoton
Copy link
Contributor

comment:11

there is a typo Z Z

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 6, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

6ba9925fix a typo

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 6, 2018

Changed commit from eb0d0d5 to 6ba9925

@fchapoton
Copy link
Contributor

comment:13

corrected and tested. I am setting back to positive

@fchapoton
Copy link
Contributor

comment:14

pyflakes plugin is not happy

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 6, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

bf855a3fixing pyflakes

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 6, 2018

Changed commit from 6ba9925 to bf855a3

@fchapoton
Copy link
Contributor

comment:16

done, setting back to positive

@vbraun
Copy link
Member

vbraun commented May 15, 2018

Changed branch from u/chapoton/10606 to bf855a3

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

8 participants