nl_tokens: PDF // FUNCTION : pdf ( x [ opts ] ) Evaluates the probability density function ( PDF ) for a Normal distribution .
pl_tokens: function pdf ( x , options ) { /* jshint newcap:false */ var opts = { } , ctor , err , out , dt , d ; if ( arguments . length > 1 ) { err = validate ( opts , options ) ; if ( err ) { throw err ; } } opts . mu = typeof opts . mu !== 'undefined' ? opts . mu : 0 ; opts . sigma = typeof opts . sigma !== 'undefined' ? opts . sigma : 1 ; if ( isNumber ( x ) ) { return pdf1 ( x , opts . mu , opts . sigma ) ; } if ( isMatrixLike ( x ) ) { if ( opts . copy !== false ) { dt = opts . dtype || 'float64' ; ctor = ctors ( dt ) ; if ( ctor === null ) { throw new Error ( 'pdf()::invalid option. Data type option does not have a corresponding array constructor. Option: `' + dt + '`.' ) ; } // Create an output matrix: d = new ctor ( x . length ) ; out = matrix ( d , x . shape , dt ) ; } else { <mask> = x ; } return pdf5 ( out , x , opts . mu , opts . sigma ) ; } if ( isTypedArrayLike ( x ) ) { if ( opts . copy === false ) { out = x ; } else { dt = opts . dtype || 'float64' ; ctor = ctors ( dt ) ; if ( ctor === null ) { throw new Error ( 'pdf()::invalid option. Data type option does not have a corresponding array constructor. Option: `' + dt + '`.' ) ; } out = new ctor ( x . length ) ; } return pdf6 ( out , x , opts . mu , opts . sigma ) ; } if ( isArrayLike ( x ) ) { // Handle deepset first... if ( opts . path ) { opts . sep = opts . sep || '.' ; return pdf4 ( x , opts . mu , opts . sigma , opts . path , opts . sep ) ; } // Handle regular and accessor arrays next... if ( opts . copy === false ) { out = x ; } else if ( opts . dtype ) { ctor = ctors ( opts . dtype ) ; if ( ctor === null ) { throw new TypeError ( 'pdf()::invalid option. Data type option does not have a corresponding array constructor. Option: `' + opts . dtype + '`.' ) ; } out = new ctor ( x . length ) ; } else { out = new Array ( x . length ) ; } if ( opts . accessor ) { return pdf3 ( out , x , opts . mu , opts . sigma , opts . accessor ) ; } return pdf2 ( out , x , opts . mu , opts . sigma ) ; } return NaN ; }