ext/lbfgsb/src/linpack.c in lbfgsb-0.4.1 vs ext/lbfgsb/src/linpack.c in lbfgsb-0.5.0
- old
+ new
@@ -1,15 +1,14 @@
/**
* L-BFGS-B is released under the “New BSD License” (aka “Modified BSD License”
* or “3-clause license”)
* Please read attached file License.txt
*/
-
-#include "linpack.h"
#include "blas.h"
+#include "linpack.h"
-static long c__1 = 1;
+static F77_int c__1 = 1;
/**
* dpofa factors a double precision symmetric positive definite
* matrix.
*
@@ -21,36 +20,36 @@
*
* a double precision(lda, n)
* the symmetric matrix to be factored. only the
* diagonal and upper triangle are used.
*
- * lda long
+ * lda integer
* the leading dimension of the array a .
*
- * n long
+ * n integer
* the order of the matrix a .
*
* on return
*
* a an upper triangular matrix r so that a = trans(r)*r
* where trans(r) is the transpose.
* the strict lower triangle is unaltered.
* if info .ne. 0 , the factorization is not complete.
*
- * info long
+ * info integer
* = 0 for normal return.
* = k signals an error condition. the leading minor
* of order k is not positive definite.
*
* linpack. this version dated 08/14/78 .
* cleve moler, university of new mexico, argonne national lab.
*/
-int lbfgsb_rb_dpofa_(double* a, long* lda, long* n, long* info) {
- long a_dim1, a_offset, i__1, i__2, i__3;
- static long j, k;
+void dpofa_(double* a, F77_int* lda, F77_int* n, F77_int* info) {
+ F77_int a_dim1, a_offset, i__1, i__2, i__3;
+ static F77_int j, k;
static double s, t;
- static long jm1;
+ static F77_int jm1;
a_dim1 = *lda;
a_offset = 1 + a_dim1;
a -= a_offset;
@@ -63,11 +62,11 @@
goto L20;
}
i__2 = jm1;
for (k = 1; k <= i__2; ++k) {
i__3 = k - 1;
- t = a[k + j * a_dim1] - lbfgsb_rb_ddot_(&i__3, &a[k * a_dim1 + 1], &c__1, &a[j * a_dim1 + 1], &c__1);
+ t = a[k + j * a_dim1] - ddot_(&i__3, &a[k * a_dim1 + 1], &c__1, &a[j * a_dim1 + 1], &c__1);
t /= a[k + k * a_dim1];
a[k + j * a_dim1] = t;
s += t * t;
}
L20:
@@ -78,11 +77,11 @@
}
a[j + j * a_dim1] = sqrt(s);
}
*info = 0;
L40:
- return 0;
+ return;
}
/**
* dtrsl solves systems of the form
*
@@ -99,20 +98,20 @@
* t contains the matrix of the system. the zero
* elements of the matrix are not referenced, and
* the corresponding elements of the array can be
* used to store other information.
*
- * ldt long
+ * ldt integer
* ldt is the leading dimension of the array t.
*
- * n long
+ * n integer
* n is the order of the system.
*
* b double precision(n).
* b contains the right hand side of the system.
*
- * job long
+ * job integer
* job specifies what kind of system is to be solved.
* if job is
*
* 00 solve t*x=b, t lower triangular,
* 01 solve t*x=b, t upper triangular,
@@ -122,21 +121,21 @@
* on return
*
* b b contains the solution, if info .eq. 0.
* otherwise b is unaltered.
*
- * info long
+ * info integer
* info contains zero if the system is nonsingular.
* otherwise info contains the index of
* the first zero diagonal element of t.
*
* linpack. this version dated 08/14/78 .
* g. w. stewart, university of maryland, argonne national lab.
*/
-int lbfgsb_rb_dtrsl_(double* t, long* ldt, long* n, double* b, long* job, long* info) {
- long t_dim1, t_offset, i__1, i__2;
- static long j, jj, case__;
+void dtrsl_(double* t, F77_int* ldt, F77_int* n, double* b, F77_int* job, F77_int* info) {
+ F77_int t_dim1, t_offset, i__1, i__2;
+ static F77_int j, jj, case__;
static double temp;
/* check for zero diagonal elements. */
t_dim1 = *ldt;
t_offset = 1 + t_dim1;
@@ -179,11 +178,11 @@
}
i__1 = *n;
for (j = 2; j <= i__1; ++j) {
temp = -b[j - 1];
i__2 = *n - j + 1;
- lbfgsb_rb_daxpy_(&i__2, &temp, &t[j + (j - 1) * t_dim1], &c__1, &b[j], &c__1);
+ daxpy_(&i__2, &temp, &t[j + (j - 1) * t_dim1], &c__1, &b[j], &c__1);
b[j] /= t[j + j * t_dim1];
}
L40:
goto L140;
@@ -195,11 +194,11 @@
}
i__1 = *n;
for (jj = 2; jj <= i__1; ++jj) {
j = *n - jj + 1;
temp = -b[j + 1];
- lbfgsb_rb_daxpy_(&j, &temp, &t[(j + 1) * t_dim1 + 1], &c__1, &b[1], &c__1);
+ daxpy_(&j, &temp, &t[(j + 1) * t_dim1 + 1], &c__1, &b[1], &c__1);
b[j] /= t[j + j * t_dim1];
}
L70:
goto L140;
@@ -211,11 +210,11 @@
}
i__1 = *n;
for (jj = 2; jj <= i__1; ++jj) {
j = *n - jj + 1;
i__2 = jj - 1;
- b[j] -= lbfgsb_rb_ddot_(&i__2, &t[j + 1 + j * t_dim1], &c__1, &b[j + 1], &c__1);
+ b[j] -= ddot_(&i__2, &t[j + 1 + j * t_dim1], &c__1, &b[j + 1], &c__1);
b[j] /= t[j + j * t_dim1];
}
L100:
goto L140;
@@ -226,13 +225,13 @@
goto L130;
}
i__1 = *n;
for (j = 2; j <= i__1; ++j) {
i__2 = j - 1;
- b[j] -= lbfgsb_rb_ddot_(&i__2, &t[j * t_dim1 + 1], &c__1, &b[1], &c__1);
+ b[j] -= ddot_(&i__2, &t[j * t_dim1 + 1], &c__1, &b[1], &c__1);
b[j] /= t[j + j * t_dim1];
}
L130:
L140:
L150:
- return 0;
+ return;
}