R/chkArgs2.R

Defines functions chkArgs2

chkArgs2 <- function( x, y, rho, opt ) {
  stopifnot( length( x ) >= 1, length( y ) >= 1, length( rho ) >= 1 )
  if ( length( x ) > 1 && length( y )   > 1 ) stopifnot( length( x ) == length( y ) )
  if ( length( x ) > 1 && length( rho ) > 1 ) stopifnot( length( x ) == length( rho ) )
  if ( length( y ) > 1 && length( rho ) > 1 ) stopifnot( length( y ) == length( rho ) )
  stopifnot( any( !is.na( rho ) ) )
  rho <- rho[ !is.na( rho ) ]
  stopifnot( all( abs( rho ) <= 1 ) )
  stopifnot( isa( x, "numeric" ) || isa( x, "mpfr" ) )
  stopifnot( identical( class( x ), class( y ) ) )
  stopifnot( identical( class( x ), class( rho ) ) )
  if ( isa( x, "mpfr" ) ) {
    prec_x   <- getPrec( x )
    prec_y   <- getPrec( y )
    prec_rho <- getPrec( rho )
    stopifnot( all( prec_x == prec_x[ 1 ] ) )
    stopifnot( all( prec_y == prec_x[ 1 ] ) )
    stopifnot( all( prec_rho == prec_x[ 1 ] ) )
  }
  stopifnot( length( opt ) == 1, is.logical( opt ), !is.na( opt ) )
  return( TRUE )
}

Try the Phi2rho package in your browser

Any scripts or data that you put into this service are public.

Phi2rho documentation built on June 27, 2026, 5:07 p.m.