7
7
#include <lapacke.h>
8
8
#include "kernel/operators.h"
9
9
10
+ /**
11
+ * Matrix-matrix multiplication i.e. linear transformation of matrices A and B.
12
+ *
13
+ * @param return_value
14
+ * @param a
15
+ * @param b
16
+ */
10
17
void tensor_matmul (zval * return_value , zval * a , zval * b )
11
18
{
12
19
unsigned int i , j ;
@@ -64,6 +71,13 @@ void tensor_matmul(zval * return_value, zval * a, zval * b)
64
71
efree (vc );
65
72
}
66
73
74
+ /**
75
+ * Dot product between vectors A and B.
76
+ *
77
+ * @param return_value
78
+ * @param a
79
+ * @param b
80
+ */
67
81
void tensor_dot (zval * return_value , zval * a , zval * b )
68
82
{
69
83
unsigned int i ;
@@ -85,6 +99,12 @@ void tensor_dot(zval * return_value, zval * a, zval * b)
85
99
RETVAL_DOUBLE (sigma );
86
100
}
87
101
102
+ /**
103
+ * Return the multiplicative inverse of a square matrix A.
104
+ *
105
+ * @param return_value
106
+ * @param a
107
+ */
88
108
void tensor_inverse (zval * return_value , zval * a )
89
109
{
90
110
unsigned int i , j ;
@@ -140,6 +160,12 @@ void tensor_inverse(zval * return_value, zval * a)
140
160
efree (pivots );
141
161
}
142
162
163
+ /**
164
+ * Return the (Moore-Penrose) pseudoinverse of a general matrix A.
165
+ *
166
+ * @param return_value
167
+ * @param a
168
+ */
143
169
void tensor_pseudoinverse (zval * return_value , zval * a )
144
170
{
145
171
unsigned int i , j ;
@@ -201,6 +227,12 @@ void tensor_pseudoinverse(zval * return_value, zval * a)
201
227
efree (vb );
202
228
}
203
229
230
+ /**
231
+ * Return the row echelon form of matrix A.
232
+ *
233
+ * @param return_value
234
+ * @param a
235
+ */
204
236
void tensor_ref (zval * return_value , zval * a )
205
237
{
206
238
unsigned int i , j ;
@@ -265,6 +297,12 @@ void tensor_ref(zval * return_value, zval * a)
265
297
efree (pivots );
266
298
}
267
299
300
+ /**
301
+ * Compute the Cholesky decomposition of matrix A and return the lower triangular matrix.
302
+ *
303
+ * @param return_value
304
+ * @param a
305
+ */
268
306
void tensor_cholesky (zval * return_value , zval * a )
269
307
{
270
308
unsigned int i , j ;
@@ -314,6 +352,12 @@ void tensor_cholesky(zval * return_value, zval * a)
314
352
efree (va );
315
353
}
316
354
355
+ /**
356
+ * Compute the LU factorization of matrix A and return a tuple with lower, upper, and permutation matrices.
357
+ *
358
+ * @param return_value
359
+ * @param a
360
+ */
317
361
void tensor_lu (zval * return_value , zval * a )
318
362
{
319
363
unsigned int i , j ;
@@ -404,6 +448,12 @@ void tensor_lu(zval * return_value, zval * a)
404
448
efree (pivots );
405
449
}
406
450
451
+ /**
452
+ * Compute the eigendecomposition of a general matrix A and return the eigenvalues and eigenvectors in a tuple.
453
+ *
454
+ * @param return_value
455
+ * @param a
456
+ */
407
457
void tensor_eig (zval * return_value , zval * a )
408
458
{
409
459
unsigned int i , j ;
@@ -466,6 +516,12 @@ void tensor_eig(zval * return_value, zval * a)
466
516
efree (vr );
467
517
}
468
518
519
+ /**
520
+ * Compute the eigendecomposition of a symmetric matrix A and return the eigenvalues and eigenvectors in a tuple.
521
+ *
522
+ * @param return_value
523
+ * @param a
524
+ */
469
525
void tensor_eig_symmetric (zval * return_value , zval * a )
470
526
{
471
527
unsigned int i , j ;
@@ -524,6 +580,12 @@ void tensor_eig_symmetric(zval * return_value, zval * a)
524
580
efree (wr );
525
581
}
526
582
583
+ /**
584
+ * Compute the singular value decomposition of a matrix A and return the singular values, and unitary matrices U and VT in a tuple.
585
+ *
586
+ * @param return_value
587
+ * @param a
588
+ */
527
589
void tensor_svd (zval * return_value , zval * a )
528
590
{
529
591
unsigned int i , j ;
0 commit comments