Skip to content

Commit 9d9e43b

Browse files
committed
handle special case for single value matrix
1 parent c31ccd2 commit 9d9e43b

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/Math-Matrix/PMMatrix.class.st

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ PMMatrix >> eigen [
498498
matrix eigen values.
499499
matrix eigen vectors."
500500

501+
self numberOfColumns == 1 & self numberOfRows == 1 ifTrue: [ ^ PMSingleValueMatrixHelper matrix: self ].
502+
501503
self isSymmetric
502504
ifTrue: [ ^ self asSymmetricMatrix eigen ]
503505
ifFalse: [ self error: 'Eigenvalues and eigenvectors of non-symmetric matrix are currently not supported' ]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Class {
2+
#name : 'PMSingleValueMatrixHelper',
3+
#superclass : 'PMJacobiTransformationHelper',
4+
#category : 'Math-Matrix',
5+
#package : 'Math-Matrix'
6+
}
7+
8+
{ #category : 'initialization' }
9+
PMSingleValueMatrixHelper >> initialize: aSingleValueMatrix [
10+
11+
eigenvalues := Array with: (aSingleValueMatrix at: 1 at: 1).
12+
eigenvectors := PMVector with: (PMVector ones: 1)
13+
]

0 commit comments

Comments
 (0)