-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathval.ijs
More file actions
43 lines (38 loc) · 1.21 KB
/
val.ijs
File metadata and controls
43 lines (38 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
NB. lapack validation
NB.
NB. validation routines that check argument is a matrix:
NB. vmatrix
NB. vhermitian
NB. vorthogonal
NB. vsquare
NB. vsymmetric
NB.
NB. validation routines that check argument is either
NB. a matrix or vector:
NB. vmatrixorvector
isreal=: -: +
iscomplex=: -.@isreal
isvector=: 1: = #@$
ismatrix=: 2: = #@$
ismatrixorvector=: 1 2 e.~ #@$
issquare=: =/ @ $
issymmetric=: -: |:
ishermitian=: -: +@|:
NB. =========================================================
isorthogonal=: 3 : 0
q=. y mp |: y
*./ 0 = clean ,q - idmat $q
)
NB. =========================================================
isunitary=: 3 : 0
q=. y mp + |: y
*./ 0 = clean ,q - idmat $q
)
NB. =========================================================
f=. 2 : 'm&(13!:8)@(#&12)@(0 e. v)'
vmatrix=: 'argument should be a matrix' f ismatrix
vmatrixorvector=: 'argument should be either a matrix or vector' f ismatrixorvector
vhermitian=: 'argument should be a hermitian matrix' f ishermitian [ vmatrix
vorthogonal=: 'argument should be an orthogonal matrix' f isorthogonal [ vmatrix
vsquare=: 'argument should be a square matrix' f issquare [ vmatrix
vsymmetric=: 'argument should be a symmetric matrix' f issymmetric [ vmatrix