Opened 9 years ago

Closed 9 years ago

#10537 closed defect (fixed)

Fix dictionary input to sparse vector constructor

Reported by: rbeezer Owned by: jason, was
Priority: major Milestone: sage-4.6.2
Component: linear algebra Keywords:
Cc: Merged in: sage-4.6.2.alpha3
Authors: Rob Beezer Reviewers: Dmitrii Pasechnik
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

A dictionary can be used to specify the entries of a vector, and then the result will be sparse. The degree of the vector is implicitly determined by the largest key/index. You can fool this by creating a zero entry with a large key/index. But then problems arise later if you try to use this constructor with a dictionary created programatically - you can't fool it twice.

So working with sparse matrices is either unreliable (as described), or inefficient (convert from dictionaries to lists and back again).

Patch slowly ate away at the old prepare_dict until almost nothing was left, and then it got subsumed into prepare. Passes all tests in sage/modules and I will run full tests overnight.

Depends on 4.6.1.alpha3 and #10364 which had improved error messages for this situation.

Attachments (1)

trac_10537_dictionary_vector_input.patch (7.9 KB) - added by rbeezer 9 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 9 years ago by rbeezer

  • Authors set to Rob Beezer
  • Status changed from new to needs_review

Patchbot:

Apply trac_10537_dictionary_vector_input.patch

Depends on #10364

Changed 9 years ago by rbeezer

comment:2 Changed 9 years ago by dimpase

  • Status changed from needs_review to positive_review

comment:3 Changed 9 years ago by jdemeyer

  • Reviewers set to Dmitrii Pasechnik

comment:4 Changed 9 years ago by jdemeyer

  • Merged in set to sage-4.6.2.alpha3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.