forked from fricas/fricas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
numarr.spad
157 lines (124 loc) · 4.9 KB
/
numarr.spad
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
)abbrev domain DFVEC DoubleFloatVector
++ Description: This is a low-level domain which implements vectors
++ (one dimensional arrays) of double precision floating point
++ numbers. Indexing is 0 based, there is no bound checking (unless
++ provided by lower level).
DoubleFloatVector : VectorCategory DoubleFloat with
qnew : Integer -> %
++ qnew(n) creates a new uninitialized vector of length n.
== add
Qelt1 ==> DELT$Lisp
Qsetelt1 ==> DSETELT$Lisp
qelt(x, i) == Qelt1(x, i)
qsetelt!(x, i, s) == Qsetelt1(x, i, s)
Qsize ==> DLEN$Lisp
Qnew ==> MAKE_DOUBLE_VECTOR$Lisp
Qnew1 ==> MAKE_DOUBLE_VECTOR1$Lisp
#x == Qsize x
minIndex x == 0
empty() == Qnew(0$Lisp)
qnew(n) == Qnew(n)
new(n, x) == Qnew1(n, x)
qelt(x, i) == Qelt1(x, i)
elt(x : %, i : Integer) == Qelt1(x, i)
qsetelt!(x, i, s) == Qsetelt1(x, i, s)
setelt!(x : %, i : Integer, s : DoubleFloat) ==
Qsetelt1(x, i, s)
fill!(x, s) ==
for i in 0..((Qsize(x)) - 1) repeat Qsetelt1(x, i, s)
x
)abbrev domain DFMAT DoubleFloatMatrix
++ Description: This is a low-level domain which implements matrices
++ (two dimensional arrays) of double precision floating point
++ numbers. Indexing is 0 based, there is no bound checking (unless
++ provided by lower level).
DoubleFloatMatrix : MatrixCategory(DoubleFloat,
DoubleFloatVector,
DoubleFloatVector)
== add
R ==> DoubleFloat
Qelt2 ==> DAREF2$Lisp
Qsetelt2 ==> DSETAREF2$Lisp
Qnrows ==> DANROWS$Lisp
Qncols ==> DANCOLS$Lisp
Qnew ==> MAKE_DOUBLE_MATRIX$Lisp
Qnew1 ==> MAKE_DOUBLE_MATRIX1$Lisp
minRowIndex x == 0
minColIndex x == 0
nrows x == Qnrows(x)
ncols x == Qncols(x)
maxRowIndex x == Qnrows(x) - 1
maxColIndex x == Qncols(x) - 1
qelt(m, i, j) == Qelt2(m, i, j)
elt(m : %, i : Integer, j : Integer) : R == Qelt2(m, i, j)
qsetelt!(m, i, j, r) == Qsetelt2(m, i, j, r)
setelt!(m : %, i : Integer, j : Integer, r : R) == Qsetelt2(m, i, j, r)
empty() == Qnew(0$Integer, 0$Integer)
qnew(rows, cols) == Qnew(rows, cols)
new(rows, cols, a) == Qnew1(rows, cols, a)
)abbrev domain CDFVEC ComplexDoubleFloatVector
++ Description: This is a low-level domain which implements vectors
++ (one dimensional arrays) of complex double precision floating point
++ numbers. Indexing is 0 based, there is no bound checking (unless
++ provided by lower level).
ComplexDoubleFloatVector : VectorCategory Complex DoubleFloat with
qnew : Integer -> %
++ qnew(n) creates a new uninitialized vector of length n.
vector : List Complex DoubleFloat -> %
++ vector(l) converts the list l to a vector.
== add
Qelt1 ==> CDELT$Lisp
Qsetelt1 ==> CDSETELT$Lisp
qelt(x, i) == Qelt1(x, i)
qsetelt!(x, i, s) == Qsetelt1(x, i, s)
Qsize ==> CDLEN$Lisp
Qnew ==> MAKE_CDOUBLE_VECTOR$Lisp
#x == Qsize x
minIndex x == 0
empty() == Qnew(0$Lisp)
qnew(n) == Qnew(n)
new(n, x) ==
res : % := Qnew(n)
fill!(res, x)
qelt(x, i) == Qelt1(x, i)
elt(x : %, i : Integer) == Qelt1(x, i)
qsetelt!(x, i, s) == Qsetelt1(x, i, s)
setelt!(x : %, i : Integer, s : Complex DoubleFloat) ==
Qsetelt1(x, i, s)
fill!(x, s) ==
for i in 0..((Qsize(x)) - 1) repeat Qsetelt1(x, i, s)
x
)abbrev domain CDFMAT ComplexDoubleFloatMatrix
++ Description: This is a low-level domain which implements matrices
++ (two dimensional arrays) of complex double precision floating point
++ numbers. Indexing is 0 based, there is no bound checking (unless
++ provided by lower level).
ComplexDoubleFloatMatrix : MatrixCategory(Complex DoubleFloat,
ComplexDoubleFloatVector,
ComplexDoubleFloatVector)
== add
R ==> Complex DoubleFloat
NNI ==> Integer
Qelt2 ==> CDAREF2$Lisp
Qsetelt2 ==> CDSETAREF2$Lisp
Qnrows ==> CDANROWS$Lisp
Qncols ==> CDANCOLS$Lisp
Qnew ==> MAKE_CDOUBLE_MATRIX$Lisp
minRowIndex x == 0
minColIndex x == 0
nrows x == Qnrows(x)
ncols x == Qncols(x)
maxRowIndex x == Qnrows(x) - 1
maxColIndex x == Qncols(x) - 1
qelt(m, i, j) == Qelt2(m, i, j)
elt(m : %, i : Integer, j : Integer) : R == Qelt2(m, i, j)
qsetelt!(m, i, j, r) == Qsetelt2(m, i, j, r)
setelt!(m : %, i : Integer, j : Integer, r : R) == Qsetelt2(m, i, j, r)
empty() == Qnew(0$Integer, 0$Integer)
qnew(rows, cols) == Qnew(rows, cols)
new(rows, cols, a) ==
res : % := Qnew(rows, cols)
for i in 0..(rows - 1) repeat
for j in 0..(cols - 1) repeat
Qsetelt2(res, i, j, a)
res