UNPKG

4.02 kBMarkdownView Raw
1## Linear Algebra
2
3## Instance Functionality
4
5### add( arg )
6
7Adds value to all entries.
8
9 jStat([[1,2,3]]).add( 2 ) === [[3,4,5]];
10
11### subtract( arg )
12
13Subtracts all entries by value.
14
15 jStat([[4,5,6]]).subtract( 2 ) === [[2,3,4]];
16
17### divide( arg )
18
19Divides all entries by value.
20
21 jStat([[2,4,6]]).divide( 2 ) === [[1,2,3]];
22
23### multiply( arg )
24
25Multiplies all entries by value.
26
27 jStat([[1,2,3]]).multiply( 2 ) === [[2,4,6]];
28
29### dot( arg )
30
31Takes dot product.
32
33### pow( arg )
34
35Raises all entries by value.
36
37 jStat([[1,2,3]]).pow( 2 ) === [[1,4,9]];
38
39### exp()
40
41Exponentiates all entries.
42
43 jStat([[0,1]]).exp() === [[1, 2.718281828459045]]
44
45### log()
46
47Returns the natural logarithm of all entries.
48
49 jStat([[1, 2.718281828459045]]).log() === [[0,1]];
50
51### abs()
52
53Returns the absolute values of all entries.
54
55 jStat([[1,-2,-3]]).abs() === [[1,2,3]];
56
57### norm()
58
59Computes the norm of a vector. Note that if a matrix is passed, then the
60first row of the matrix will be used as a vector for `norm()`.
61
62### angle( arg )
63
64Computes the angle between two vectors. Note that if a matrix is passed, then
65the first row of the matrix will be used as the vector for `angle()`.
66
67## Static Functionality
68
69### add( arr, arg )
70
71Adds `arg` to all entries of `arr` array.
72
73### subtract( arr, arg )
74
75Subtracts all entries of the `arr` array by `arg`.
76
77### divide( arr, arg )
78
79Divides all entries of the `arr` array by `arg`.
80
81### multiply( arr, arg )
82
83Multiplies all entries of the `arr` array by `arg`.
84
85### dot( arr1, arr2 )
86
87Takes the dot product of the `arr1` and `arr2` arrays.
88
89### outer( A, B )
90
91Takes the outer product of the `A` and `B` arrays.
92
93 outer([1,2,3],[4,5,6]) === [[4,5,6],[8,10,12],[12,15,18]]
94
95### pow( arr, arg )
96
97Raises all entries of the `arr` array to the power of `arg`.
98
99### exp( arr )
100
101Exponentiates all entries in the `arr` array.
102
103### log( arr )
104
105Returns the natural logarithm of all entries in the `arr` array
106
107### abs( arr )
108
109Returns the absolute values of all entries in the `arr` array
110
111### norm( arr )
112
113Computes the norm of the `arr` vector.
114
115### angle( arr1, arr2 )
116
117Computes the angle between the `arr1` and `arr2` vectors.
118
119### aug( A, B )
120
121Augments matrix `A` by matrix `B`. Note that this method returns a plain matrix,
122not a jStat object.
123
124### det( A )
125
126Calculates the determinant of matrix `A`.
127
128### inv( A )
129
130Returns the inverse of the matrix `A`.
131
132### gauss_elimination( A, B )
133
134Performs Gaussian Elimination on matrix `A` augmented by matrix `B`.
135
136### gauss_jordan( A, B )
137
138Performs Gauss-Jordan Elimination on matrix `A` augmented by matrix `B`.
139
140### lu( A )
141
142Perform the LU decomposition on matrix `A`.
143
144`A` -> `[L,U]`
145
146st.
147
148`A = LU`
149
150`L` is lower triangular matrix.
151
152`U` is upper triangular matrix.
153
154### cholesky( A )
155
156Performs the Cholesky decomposition on matrix `A`.
157
158`A` -> `T`
159
160st.
161
162`A = TT'`
163
164`T` is lower triangular matrix.
165
166### gauss_jacobi( A, b, x, r )
167
168Solves the linear system `Ax = b` using the Gauss-Jacobi method with an initial guess of `r`.
169
170### gauss_seidel( A, b, x, r )
171
172Solves the linear system `Ax = b` using the Gauss-Seidel method with an initial guess of `r`.
173
174### SOR( A, b, x, r, w )
175
176Solves the linear system `Ax = b` using the sucessive over-relaxation method with an initial guess of `r` and parameter `w` (omega).
177
178### householder( A )
179
180Performs the householder transformation on the matrix `A`.
181
182### QR( A )
183
184Performs the Cholesky decomposition on matrix `A`.
185
186`A` -> `[Q,R]`
187
188`Q` is the orthogonal matrix.
189
190`R` is the upper triangular.
191
192### lstsq( A, b )
193
194Solves least squard problem for Ax=b as QR decomposition way.
195
196If `b` is of the `[[b1], [b2], [b3]]` form, the method will return an array of the `[[x1], [x2], [x3]]` form solution.
197
198Otherwise, if `b` is of the `[b1, b2, b3]` form, the method will return an array of the `[x1,x2,x3]` form solution.
199
200
201
202
203### jacobi()
204
205### rungekutta()
206
207### romberg()
208
209### richardson()
210
211### simpson()
212
213### hermite()
214
215### lagrange()
216
217### cubic_spline()
218
219### gauss_quadrature()
220
221### PCA()