input
stringlengths
10
828
output
stringlengths
5
107
private string get internal long format string suffix if this length 1 suffix else suffix s final string builder sb new string builder final formatter formatter new formatter sb locale us formatter format d s s this length this units get long format suffix return sb to string
returns periods in long format e
public double itm asset probability read only return cum d1
probability of being in the money in the asset martingale measure i
private string get internal short format final string builder sb new string builder final formatter formatter new formatter sb locale us formatter format d s this length this units get short format return sb to string
output periods in short format e
private void check max iterations final int max iterations ql require max iterations 0 expected max iterations must be greater 0 todo message
checks if code max iterations code is 1
public boolean is non singular for int j 0 j n j if lu lu addr op j j 0 return false return true
is the matrix nonsingular
public matrix l final matrix l new matrix m n for int i 0 i m i for int j 0 j n j if i j l l addr op i j lu lu addr op i j else if i j l l addr op i j 1 0 xxx not needed else l data l addr op i j 0 0 return l
return lower triangular factor
public matrix u final matrix u new matrix n n for int i 0 i n i for int j 0 j n j if i j u u addr op i j lu lu addr op i j xxx not needed else u data u addr op i j 0 0 return u
return upper triangular factor
public matrix l return l clone
return triangular factor
public matrix get v return v clone
return the eigenvector matrix
public matrix u return u clone new matrix u m math min m 1 n
return the left singular vectors
public matrix v return v clone new matrix v n n
return the right singular vectors
public matrix get d final matrix d new matrix n n for int i 0 i n i for int j 0 j n j d d addr op i j 0 0 d d addr op i i d i if e i 0 d d addr op i i 1 e i else if e i 0 d d addr op i i 1 e i return d
return the block diagonal eigenvalue matrix
public array singular values return s clone
return the one dimensional array of singular values
public matrix s return s clone
return the diagonal matrix of singular values
public double cond return s s addr op 0 s math min m n 1
two norm condition number
public int rank final double eps math pow 2 0 52 0 final double tol math max m n s s addr op 0 eps int r 0 for int i 0 i s size i if s s addr op i tol r return r
effective numerical matrix rank
public double get final int pos return addr op pos
retrieves an element of code this code matrix
public void set final int pos final double value addr op pos value
stores a value into an element of code this code matrix
public double value final array x function evaluation return cost function value x
call cost function computation and increment evaluation counter
public array values final array x function evaluation return cost function values x
call cost values computation and increment evaluation counter
public void gradient final array grad f final array x gradient evaluation cost function gradient grad f x
call cost function gradient computation and increment evaluation counter
public double value and gradient final array grad f final array x function evaluation gradient evaluation return cost function value and gradient grad f x
call cost function computation and it gradient
public void gradient final array grad final array x read only final double eps finite difference epsilon double fp fm final array xx x clone for int i 0 i x size i xx i eps xx set i eps xx get i fp value xx xx i 2 0 eps xx set i xx get i 2 0 eps fm value xx grad i 0 5 fp fm eps grad set i 0 5 fp fm eps xx i x i xx set i x get i
method to overload to compute gradient f the first derivative of
public double value and gradient final array grad final array x read only gradient grad x return value x
method to overload to compute gradient f the first derivative of
public double function value read only return this function value
value of cost function
public double gradient norm value read only return this squared norm
value of cost function gradient norm
public int function evaluation read only return this function evaluation
number of evaluation of cost function
public int gradient evaluation read only return this gradient evaluation
number of evaluation of cost function gradient
public matrix negative return mul assign 1
returns the negative of code this code matrix
public void set seed final int seed we use a long masked by 0xffffffff l as a poor man unsigned int long long mt seed mt 0 int long mt for mti 1 mti n mti see knuth taocp vol2 3rd ed p 106 for multiplier initializer from the 2002 01 09 c version by makoto matsumoto long mt 1812433253l long mt long mt 30 mti 0xffffffff l mt mti int long mt
reinitialize the generator as if just built with the given int seed
public void set seed final long seed if mt null this is probably a spurious call from base class constructor we do nothing and wait for the set seed in our own constructors after array allocation return set seed new int int seed 32 int seed 0xffffffffl
reinitialize the generator as if just built with the given long seed
public matrix covariance read only final real double sample weight weight sum ql require sample weight 0 0 unsufficient sample weight final real double sample number samples ql require sample number 1 0 unsufficient sample number final array m mean final real double inv 1 0 sample weight final matrix result quadratic sum mul inv result sub assign m outer product m result mul assign sample number sample number 1 0 return result
returns the covariance matrix
public symmetric schur decomposition schur return new symmetric schur decomposition this
symmetric schur decomposition
public svd svd return new svd this
singular value decomposition
public void add final double datum add datum 1 0
adds a sequence of data to the set with default weight
public void add final double datum final real double weight if dimension 0 stat wasn t initialized yet final integer int dimension datum length ql require dimension 0 null dimension reset size dimension ql require datum length dimension sample size mismatch final array array new array datum quadratic sum add assign array outer product array mul assign weight for size int i 0 i dimension i stats i add datum i weight
adds a sequence of data to the set each with its weight
public matrix transpose final int offset addr is fortran 1 0 final matrix result new matrix cols rows this flags final address matrix address matrix offset src this addr offset offset offset final address matrix address matrix offset dst result addr offset offset offset for int row offset row rows offset row src set row row src set col offset dst set row offset dst set col row for int col offset col cols offset col result dst op this src op src next col dst next row return result
returns the transpose of code this code matrix
public void add final array datum add datum 1 0
adds a sequence of data to the set with default weight
public array diagonal ql require rows cols matrix must be square qa rg verified final array result new array cols int addr 0 for int i 0 i cols i result i addr addr cols 1 return result
returns a diagonal from code this code matrix if it is square
public void add sequence final double datum for int i 0 i datum length i add datum i
adds a sequence of data to the set with default weight
public void add sequence final double datum final double weights ql require datum length weights length incompatible array sizes for int i 0 i datum length i add datum i weights i
adds a sequence of data to the set each with its weight
public matrix inverse ql require this rows this cols matrix is not square return new ludecomposition this solve new identity rows
returns an inverse matrix from code this code matrix
public void add sequence final array datum for int i 0 i datum size i add datum get i
adds a sequence of data to the set with default weight
public void add sequence final array datum final array weights ql require datum size weights size incompatible array sizes for int i 0 i datum size i add datum get i weights get i
adds a sequence of data to the set each with its weight
public void reset samples new array list comparable pair double double sorted true
resets the data to a null set
public void sort read only if sorted collections sort samples sorted true
sort the data set in increasing order
private void check final int n if n 0 throw new arithmetic exception factorial expected n 0
checks if code n code is 0
private double incomplete gamma function series repr final double a final double x final double accuracy final int max iteration if x 0 0 return 0 0 real final double gln new gamma function log value a real double ap a real double del 1 0 a real double sum del for int n 1 n max iteration n ap del x ap sum del if math abs del math abs sum accuracy return sum math exp x a math log x gln throw new arithmetic exception accuracy not reached
computes the incomplete gamma function by using the series
private double binomial coefficient ln final int n final int k ql require n 0 n 0 not allowed todo message ql require k 0 k 0 not allowed todo message ql require n k n k not allowed todo message return factorial ln n factorial ln k factorial ln n k
computes the natural logarithm of the binomial coefficient
public double op final double x final double sn math sin this asr x 1 0 5 return math exp sn hk hs 1 0 sn sn
computes equation 3 see references
public double op final double x double xs a x 1 xs math abs xs xs final double rs math sqrt 1 xs final double asr bs xs hk 2 if asr 100 0 return a math exp asr math exp hk 1 rs 2 1 rs rs 1 c xs 1 d xs return 0 0
computes equation 6 see references br
public double log value final double x read only ql require x 0 0 positive argument required todo message double temp x 5 5 temp x 0 5 math log temp double ser 1 000000000190015 ser c1 x 1 0 ser c2 x 2 0 ser c3 x 3 0 ser c4 x 4 0 ser c5 x 5 0 ser c6 x 6 0 return temp math log 2 5066282746310005 ser x
computes the log of the gamma
public int factors return size
returns the number of independent factors of the process
public array expectation final time double t0 final array x0 final time double dt read only return apply x0 discretization drift discretization this t0 x0 dt
returns the expectation
public matrix std deviation final time double t0 final array x0 final time double dt read only return discretization diffusion discretization this t0 x0 dt xxx
returns the standard deviation
public matrix covariance final time double t0 final array x0 final time double dt read only return discretization covariance discretization this t0 x0 dt xxx
returns the covariance
public array evolve final time double t0 final array x0 final time double dt final array dw read only return apply expectation t0 x0 dt std deviation t0 x0 dt mul dw
returns the asset value after a time interval
public array apply final array x0 final array dx read only return x0 add dx
applies a change to the asset value
public void add final exchange rate rate final date start date final date end date key final int k hash rate source rate target if data get k null data put k new array list entry data get k add 0 new entry rate start date end date
adds an exchange rate
public void add final exchange rate rate add rate date min date date max date
adds an exchange rate to the repository
public exchange rate lookup final currency source final currency target return lookup source target date todays date exchange rate type derived
looks up an exchange rate in the repository
public void fill row final int row final array array ql require cols array size array is incompatible if this addr is contiguous array addr is contiguous system arraycopy array 0 addr op row 0 cols else final address array address array offset src array addr offset final address matrix address matrix offset dst this addr offset row 0 for int col 0 col cols col dst op array src op src next index dst next col
overwrites contents of a certain row
public void clear data clear add known rates
removes all manually added exchange rates from this exchange rate manager
public int hash final currency c1 final currency c2 return math min c1 numeric code c2 numeric code 1000 math max c1 numeric code c2 numeric code
creates a hash for two currencies
public void fill col final int col final array array ql require rows array size array is incompatible qa rg verified if this addr is contiguous array addr is contiguous cols 1 system arraycopy array 0 0 size else final address array address array offset src array addr offset final address matrix address matrix offset dst this addr offset 0 col for int row 0 row rows row dst op array src op src next index dst next row
overwrites contents of a certain column
private exchange rate direct lookup final currency source final currency target final date date if system get property experimental null throw new unsupported operation exception work in progress exchange rate rate null ql require rate fetch source target date null no direct conversion available todo message return rate
fetches a exchange rate from the repository
public exchange rate fetch final currency source final currency target final date date final list entry rates data get hash source target final int i match validate at rates date return i rates size 1 rates get i rate null
fetches an exchange rate from the hash map
private int match final int list final int value for int i 0 i list length i if value list i return i return 1
returns the index of the first element equals to a specific value
private int match validate at final list entry rates final date date final valid at va new valid at date for int i 0 i rates size i if va operator rates get i return i return 1
returns the index of the first valid element
public double div final money money if currency eq money currency return value money value else if conversion type money conversion type base currency conversion final money tmp1 this clone tmp1 convert to base final money tmp2 money clone tmp2 convert to base recursive return this div tmp2 else if conversion type money conversion type automated conversion final money tmp money clone tmp convert to money currency recursive return this div tmp else throw new library exception currency mismatch and no conversion specified todo message
returns the the value of this instance divided by another instance
protected void wrapped notify final observer observer final observable observable final object arg xxx obs observer update observable arg observer update
this method is intended to encapsulate the notification semantics in
public boolean payoff at expiry return this payoff at expiry
returns the payoff at expiry
protected void check range final date d final boolean extrapolate read only ql require d ge reference date date before reference date todo message ql require extrapolate allows extrapolation d le max date date is past max curve todo message
this method performs date range check
protected void check range time final double t final boolean extrapolate read only ql require t 0 0 negative time given todo message ql require extrapolate allows extrapolation t max time closeness is close enough t max time time is past max curve todo message
this method performs date range check
public business day convention business day convention read only return bdc
the business day convention used in tenor to date conversion
public double volatility final period option tenor final double strike return volatility option tenor strike false
returns the volatility for a given option tenor and strike rate
public double volatility final date option date final double strike return volatility option date strike false
returns the volatility for a given option date and strike rate
public double black variance final period option tenor final double strike return black variance option tenor strike false
returns the black variance for a given option tenor and strike rate
public double black variance final date option date final double strike return black variance option date strike false
returns the black variance for a given option date and strike rate
public double black variance final time double option time final double strike return black variance option time strike false
returns the black variance for a given option time and strike rate
public smile section smile section final period option tenor return smile section option tenor false
returns the smile for a given option tenor
public smile section smile section final date option date return smile section option date false
returns the smile for a given option date
public smile section smile section final time double option time return smile section option time false
returns the smile for a given option time
public date set evaluation date final date evaluation date final date proxy proxy date proxy attrs get get evaluation date proxy assign evaluation date return proxy
changes the value of field evaluation date
private void gen rand all int i 0 r1 4 n 2 r2 4 n 1 for i 4 n pos1 i 4 do recursion sfmt i sfmt i sfmt i 4 pos1 sfmt r1 sfmt r2 r1 r2 r2 i for i 4 n i 4 do recursion sfmt i sfmt i sfmt i 4 pos1 n sfmt r1 sfmt r2 r1 r2 r2 i
fills the internal state array with pseudorandom integers
private void period certification int inner 0 for int i 0 i 4 i inner sfmt i parity i for int i 16 i 0 i 1 inner inner i check ok return if inner 1 0 return otherwise twiddle a couple bits of the internal state for int i 0 i 4 i int work 1 for int j 0 j 32 j if work parity i 0 sfmt i work return work 1
certifies the period of 2 sup
public void seed int seed sfmt 0 seed for int i 1 i n32 i int prev sfmt i 1 sfmt i 1812433253 prev prev 30 i period certification idx n32
initializes the internal state array with a 32 bit seed
private int func1 int x return x x 27 1664525
helper function used by
private int func2 int x return x x 27 1566083941
helper function used by
public assigned responsibility assigned responsibility return assigned responsibility responsibility
returns an object tree with assigned responsibility at its apex
private assigned responsibility assigned responsibility responsibility resp assigned responsibility result new assigned responsibility init result result set from date date result set to date date result add party signature party signature new party party signature new party party signature new party result set responsibility resp return result
returns an assigned responsibility with three signatures signed by
public party role party role make a new party relationship return one of its participants party role result null set party role roles party relationship get participants for party role role roles result role return result
creates an entity tree beginning with party role
public feature value get feature feature feature return get features get feature
gets the license features value
public safe creative api get api return api
get low level api interface
public void set relations relation type relation type list work works if relation map null relation map new hash map relation type list work relation map put relation type works
sets a list of related works
public string get base search url return string utils default if empty base search url default api search url
gets api search endpoint url
public void set base search url string base search url this base search url base search url
sets api search endpoint url
public auth key get auth key return auth key
gets current authorization key pair
public void add t item get list add item
adds an item
public void set auth key auth key auth key this auth key auth key
sets current authorization key pair