Skip to main content
`Ctrl`+`K`

# BVSetRandomSign

Set the entries of a `BV` to values 1 or -1 with equal probability.

## Synopsis

    #include "slepcbv.h"
    PetscErrorCode BVSetRandomSign(BV bv)

Logically Collective

## Input Parameter

- bv - basis vectors

## Notes

All active columns (except the leading ones) are modified.

This function is used, e.g., in contour integral methods when estimating the number of eigenvalues enclosed by the contour via an unbiased estimator of \(\operatorname{tr}(f(A))\) [Bai et al., 1996].

## Developer Notes

The current implementation obtains random numbers and then replaces them with -1 or 1 depending on the value being less than 0.5 or not.

## References

[Bai96]

Z. Bai, G. Fahey, and G. Golub. Some large-scale matrix computation problems. J. Comput. Appl. Math., 74(1–2):71–89, 1996. doi:10.1016/0377-0427(96)00018-0.

## See Also

BV: Basis Vectors, `BVSetRandomContext()`, `BVSetRandom()`, `BVSetRandomColumn()`, `BVSetActiveColumns()`

## Level

advanced

## Location

src/sys/classes/bv/interface/bvops.c

Index of all BV routines Table of Contents for all manual pages Index of all manual pages