aboutsummaryrefslogtreecommitdiff
path: root/redist/sba
diff options
context:
space:
mode:
authorJustin Berger <j.david.berger@gmail.com>2018-04-20 22:31:18 -0600
committerJustin Berger <j.david.berger@gmail.com>2018-04-20 22:50:20 -0600
commita1027bceebb36afc4fa9d082277478abd8101eda (patch)
treef9692cad198f8e39e4fa0fe6cdd4cf1d5abcef5c /redist/sba
parent3c007f47a30b70f00fd642b14ef8f4127c46ffc3 (diff)
downloadlibsurvive-a1027bceebb36afc4fa9d082277478abd8101eda.tar.gz
libsurvive-a1027bceebb36afc4fa9d082277478abd8101eda.tar.bz2
Enabled and then cleaned up warnings
Diffstat (limited to 'redist/sba')
-rw-r--r--redist/sba/sba_crsm.c43
-rw-r--r--redist/sba/sba_levmar.c46
-rw-r--r--redist/sba/sba_levmar_wrap.c8
3 files changed, 7 insertions, 90 deletions
diff --git a/redist/sba/sba_crsm.c b/redist/sba/sba_crsm.c
index 9ba11f1..ea38042 100644
--- a/redist/sba/sba_crsm.c
+++ b/redist/sba/sba_crsm.c
@@ -22,9 +22,6 @@
#include "sba.h"
-static void sba_crsm_print(struct sba_crsm *sm, FILE *fp);
-static void sba_crsm_build(struct sba_crsm *sm, int *m, int nr, int nc);
-
/* allocate a sparse CRS matrix */
void sba_crsm_alloc(struct sba_crsm *sm, int nr, int nc, int nnz) {
int msz;
@@ -50,46 +47,6 @@ void sba_crsm_free(struct sba_crsm *sm) {
sm->val = sm->colidx = sm->rowptr = NULL;
}
-static void sba_crsm_print(struct sba_crsm *sm, FILE *fp) {
- register int i;
-
- fprintf(fp, "matrix is %dx%d, %d non-zeros\nval: ", sm->nr, sm->nc, sm->nnz);
- for (i = 0; i < sm->nnz; ++i)
- fprintf(fp, "%d ", sm->val[i]);
- fprintf(fp, "\ncolidx: ");
- for (i = 0; i < sm->nnz; ++i)
- fprintf(fp, "%d ", sm->colidx[i]);
- fprintf(fp, "\nrowptr: ");
- for (i = 0; i <= sm->nr; ++i)
- fprintf(fp, "%d ", sm->rowptr[i]);
- fprintf(fp, "\n");
-}
-
-/* build a sparse CRS matrix from a dense one. intended to serve as an example for sm creation */
-static void sba_crsm_build(struct sba_crsm *sm, int *m, int nr, int nc) {
- int nnz;
- register int i, j, k;
-
- /* count nonzeros */
- for (i = nnz = 0; i < nr; ++i)
- for (j = 0; j < nc; ++j)
- if (m[i * nc + j] != 0)
- ++nnz;
-
- sba_crsm_alloc(sm, nr, nc, nnz);
-
- /* fill up the sm structure */
- for (i = k = 0; i < nr; ++i) {
- sm->rowptr[i] = k;
- for (j = 0; j < nc; ++j)
- if (m[i * nc + j] != 0) {
- sm->val[k] = m[i * nc + j];
- sm->colidx[k++] = j;
- }
- }
- sm->rowptr[nr] = nnz;
-}
-
/* returns the index of the (i, j) element. No bounds checking! */
int sba_crsm_elmidx(struct sba_crsm *sm, int i, int j) {
register int low, high, mid, diff;
diff --git a/redist/sba/sba_levmar.c b/redist/sba/sba_levmar.c
index 2f85f2a..e5c499f 100644
--- a/redist/sba/sba_levmar.c
+++ b/redist/sba/sba_levmar.c
@@ -99,46 +99,6 @@ static double sba_mean_repr_error(int n, int mnp, double *x, double *hx, struct
return err / ((double)(nprojs));
}
-/* print the solution in p using sba's text format. If cnp/pnp==0 only points/cameras are printed */
-static void sba_print_sol(int n, int m, double *p, int cnp, int pnp, double *x, int mnp, struct sba_crsm *idxij,
- int *rcidxs, int *rcsubs) {
- register int i, j, ii;
- int nnz;
- double *ptr;
-
- if (cnp) {
- /* print camera parameters */
- for (j = 0; j < m; ++j) {
- ptr = p + cnp * j;
- for (ii = 0; ii < cnp; ++ii)
- printf("%g ", ptr[ii]);
- printf("\n");
- }
- }
-
- if (pnp) {
- /* 3D & 2D point parameters */
- printf("\n\n\n# X Y Z nframes frame0 x0 y0 frame1 x1 y1 ...\n");
- for (i = 0; i < n; ++i) {
- ptr = p + cnp * m + i * pnp;
- for (ii = 0; ii < pnp; ++ii) // print 3D coordinates
- printf("%g ", ptr[ii]);
-
- nnz = sba_crsm_row_elmidxs(idxij, i, rcidxs, rcsubs); /* find nonzero x_ij, j=0...m-1 */
- printf("%d ", nnz);
-
- for (j = 0; j < nnz; ++j) { /* point i projecting on camera rcsubs[j] */
- ptr = x + idxij->val[rcidxs[j]] * mnp;
-
- printf("%d ", rcsubs[j]);
- for (ii = 0; ii < mnp; ++ii) // print 2D coordinates
- printf("%g ", ptr[ii]);
- }
- printf("\n");
- }
- }
-}
-
/* Compute e=x-y for two n-vectors x and y and return the squared L2 norm of e.
* e can coincide with either x or y.
* Uses loop unrolling and blocking to reduce bookkeeping overhead & pipeline
@@ -623,7 +583,7 @@ int sba_motstr_levmar_x(
* measurements vector x
*/
- double *pa, *pb, *ea, *eb, *dpa, *dpb; /* pointers into p, jac, eab and dp respectively */
+ double *ea, *eb, *dpa, *dpb; /* pointers into p, jac, eab and dp respectively */
/* submatrices sizes */
int Asz, Bsz, ABsz, Usz, Vsz, Wsz, Ysz, esz, easz, ebsz, YWtsz, Wtdasz, Sblsz, covsz;
@@ -793,8 +753,8 @@ int sba_motstr_levmar_x(
jac = W + Wsz + ((Wsz > ABsz) ? nvis * (Wsz - ABsz) : 0);
/* set up auxiliary pointers */
- pa = p;
- pb = p + m * cnp;
+ // pa = p;
+ // pb = p + m * cnp;
ea = eab;
eb = eab + m * cnp;
dpa = dp;
diff --git a/redist/sba/sba_levmar_wrap.c b/redist/sba/sba_levmar_wrap.c
index 159a040..50948ea 100644
--- a/redist/sba/sba_levmar_wrap.c
+++ b/redist/sba/sba_levmar_wrap.c
@@ -73,7 +73,7 @@ static void sba_motstr_Qs(double *p, struct sba_crsm *idxij, int *rcidxs, int *r
register int i, j;
int cnp, pnp, mnp;
double *pa, *pb, *paj, *pbi, *pxij;
- int n, m, nnz;
+ int m, nnz;
struct wrap_motstr_data_ *wdata;
void (*proj)(int j, int i, double *aj, double *bi, double *xij, void *proj_adata);
void *proj_adata;
@@ -85,7 +85,7 @@ static void sba_motstr_Qs(double *p, struct sba_crsm *idxij, int *rcidxs, int *r
proj = wdata->proj;
proj_adata = wdata->adata;
- n = idxij->nr;
+ // n = idxij->nr;
m = idxij->nc;
pa = p;
pb = p + m * cnp;
@@ -117,7 +117,7 @@ static void sba_motstr_Qs_jac(double *p, struct sba_crsm *idxij, int *rcidxs, in
register int i, j;
int cnp, pnp, mnp;
double *pa, *pb, *paj, *pbi, *pAij, *pBij;
- int n, m, nnz, Asz, Bsz, ABsz, idx;
+ int m, nnz, Asz, Bsz, ABsz, idx;
struct wrap_motstr_data_ *wdata;
void (*projac)(int j, int i, double *aj, double *bi, double *Aij, double *Bij, void *projac_adata);
void *projac_adata;
@@ -129,7 +129,7 @@ static void sba_motstr_Qs_jac(double *p, struct sba_crsm *idxij, int *rcidxs, in
projac = wdata->projac;
projac_adata = wdata->adata;
- n = idxij->nr;
+ // n = idxij->nr;
m = idxij->nc;
pa = p;
pb = p + m * cnp;