-
Notifications
You must be signed in to change notification settings - Fork 5
/
mex_dlange.c
52 lines (37 loc) · 924 Bytes
/
mex_dlange.c
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
#include "mex.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <sys/timeb.h>
#include "config.h"
#ifdef BLAS_UNDERSCORE
#define DLANGE dlange_
#else
#define DLANGE dlange
#endif
double DLANGE(char *, long *, long *, double *, long *, double *);
double wtime()
{
struct timeb T;
static time_t time_diff;
static time_t mill_diff;
double dt;
(void) ftime( &T );
time_diff = T.time;
mill_diff = T.millitm;
dt = ((double) time_diff) + (1e-3) * ((double) mill_diff);
return dt;
}
void mexFunction(int nargout, mxArray *argout[], int nargin, const mxArray *argin[])
{
long n, ld;
double norm;
double *A, dummy;
ld = mxGetM(argin[0]);
n = mxGetN(argin[0]);
A = mxGetPr(argin[0]);
/* Compute */
norm = DLANGE("F", &ld, &n, A, &ld, &dummy);
argout[0] = mxCreateDoubleScalar(norm);
}