Opened 11 years ago

Last modified 10 years ago

#10793 closed defect

FanMorphism defined by matrices are dangerous — at Initial Version

Reported by: vbraun Owned by: AlexGhitza
Priority: critical Milestone: sage-4.7.2
Component: linear algebra Keywords: sd31
Cc: rbeezer, kcrisman Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Here I use a projection matrix to map a 3d cone to a 2d cone:

sage: projection = matrix(ZZ,[[1,0,0],[0,1,0]])
sage: projection
[1 0 0]
[0 1 0]
sage: cone3d = Cone([(1,0,0),(0,1,0)])
sage: cone2d = Cone([ projection*r for r in cone3d.rays() ])
sage: cone2d.rays()
(N(0, 1), N(1, 0))

If you use the same matrix in FanMorphism, you get an unexpected result:

sage: FanMorphism( projection, Fan([cone3d]), Fan([cone2d]) )
Fan morphism defined by the matrix
[1 0]
[0 0]
[1 0]
Domain fan: Rational polyhedral fan in 3-d lattice N
Codomain fan: Rational polyhedral fan in 2-d lattice N

Sharp eyes reveal that the matrix is not the one I wanted; I understand that Sage expects a left matrix action. But having gotten a matrix of the wrong shape, no error is produced. Only a nonsensical output? Expected behavior would be an error, stating that the matrix dimensions do not match.

For reference, the correct way to construct the morphism is with the transposed matrix.

sage: FanMorphism( projection.transpose(), Fan([cone3d]), Fan([cone2d]) )
Fan morphism defined by the matrix
[1 0]
[0 1]
[0 0]
Domain fan: Rational polyhedral fan in 3-d lattice N
Codomain fan: Rational polyhedral fan in 2-d lattice N

Change History (0)

Note: See TracTickets for help on using tickets.