aboutsummaryrefslogtreecommitdiff
path: root/include/libmath.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libmath.h')
-rw-r--r--include/libmath.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/include/libmath.h b/include/libmath.h
index b0ae434..1da414a 100644
--- a/include/libmath.h
+++ b/include/libmath.h
@@ -148,11 +148,13 @@ typedef uint32 blas·Flag;
void blas·rot(int len, double *x, double *y, double cos, double sin);
void blas·rotg(double *a, double *b, double *cos, double *sin);
error blas·rotm(int len, double *x, double *y, double p[5]);
-void blas·scale(int len, double *x, double a);
+void blas·scale(int len, double a, double *x);
void blas·copy(int len, double *x, double *y);
void blas·swap(int len, double *x, double *y);
void blas·axpy(int len, double a, double *x, double *y);
-double blas·dot(int len, double *x, double *y);
+double blas·dot(int len, double *x, int incx, double *y, int incy);
+double blas·norm(int len, double *x);
+double blas·sum(int len, double *x);
int blas·argmax(int len, double *x);
int blas·argmin(int len, double *x);
@@ -172,25 +174,19 @@ void blas·trsm(blas·Flag f, int nrow, int ncol, double a, double *m1, double
// -----------------------------------------------------------------------
// higher level linear algebra
-struct linalg·Header
-{
- void *h;
- mem·Allocator heap;
-
- double *data;
-};
-
typedef struct math·Vector
{
- int len;
- struct linalg·Header;
+ double *data;
+ int len;
} math·Vector;
+#define math·slicev(vec, lo, hi) (struct math·Vector){.len=((hi)-(lo)), .data=((vec).data + (lo))}
+
typedef struct math·Matrix
{
- int dim[2];
+ double *data;
blas·Flag kind;
- struct linalg·Header;
+ int dim[2];
} math·Matrix;
// TODO: tensor ala numpy