/*ARGSUSED1*/ static void devfs_inactive(struct vnode *vp, struct cred *cred) { int destroy; struct dv_node *dv = VTODV(vp); dcmn_err2(("devfs_inactive: %s\n", dv->dv_name)); mutex_enter(&vp->v_lock); ASSERT(vp->v_count >= 1); --vp->v_count; destroy = (DV_STALE(dv) && vp->v_count == 0); mutex_exit(&vp->v_lock); /* stale nodes cannot be rediscovered, destroy it here */ if (destroy) dv_destroy(dv, 0); }
void test_mult(void) { bsc_hist_t *H; csc_mat_t *M; dv_t *x, *x2, *y; int i; printf("Testing matrix-vector multiplication..."); fflush(stdout); x= dv_new(RC_NCOLS); x2= dv_new(RC_NCOLS); y= dv_new(RC_NROWS); if(!x || !x2 || !y) { perror("dv_new"); abort(); } dv_uniform(y, 1.0); H= bsc_random(RC_NROWS, RC_NCOLS, RC_NENT, 1); M= bsc_normalise(H); bsc_hist_destroy(H); if(!csc_check(M, 1)) abort(); mult_csc_dv(x, y, M); for(i= 0; i < RC_NCOLS; i++) { int j; float s= 0.0; for(j= M->ci[i]; j < M->ci[i+1]; j++) s+= M->entries[j]; assert(abs(s - x->entries[i]) - PROB_DELTA); } printf(" done.\n"); #if 0 printf("Testing strided (%d) matrix-vector multiplication...", RC_STRIDE); fflush(stdout); csc_stride(M, RC_STRIDE); if(!csc_check(M, 1)) abort(); csc_str_mult_nv(x2, y, M); for(i= 0; i < x->length; i++) assert(x->entries[i] == x2->entries[i]); printf(" done.\n"); printf("Testing strided (%d) collision-free multiplication...", RC_STRIDE); fflush(stdout); csc_make_cfree(M, RC_CFSPAN); if(!csc_check(M, 1)) abort(); csc_mult_cf(x2, y, M); for(i= 0; i < x->length; i++) assert(x->entries[i] == x2->entries[i]); printf(" done.\n"); #endif csc_mat_destroy(M); dv_destroy(x); dv_destroy(x2); dv_destroy(y); }