Latin Hypercube Samples (lhs)  1.0
R, C++, and Rcpp code to generate Latin hypercube samples
All Classes Namespaces Files Functions Variables Typedefs Macros Pages
oa_r.cpp File Reference
#include "oa_r.h"

Functions

RcppExport SEXP oa_type1 (SEXP type, SEXP q, SEXP ncol, SEXP bRandom)
 
RcppExport SEXP oa_type2 (SEXP type, SEXP int1, SEXP q, SEXP ncol, SEXP bRandom)
 
RcppExport SEXP create_galois_field (SEXP q)
 
RcppExport SEXP poly_prod (SEXP p, SEXP n, SEXP xton, SEXP p1, SEXP p2)
 
RcppExport SEXP poly_sum (SEXP p, SEXP n, SEXP p1, SEXP p2)
 
RcppExport SEXP poly2int (SEXP p, SEXP n, SEXP poly)
 

Detailed Description

Author
Robert Carnell
License:\n GNU General Public License (GPL v3)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Function Documentation

◆ create_galois_field()

RcppExport SEXP create_galois_field ( SEXP  q)

Create a Galois Field object

Parameters
qthe number of symbols in the array
Returns
a List Galois field components

prime modulus exponent q = p^n — Polynomial vector length

prime modulus q = p^n

the order of the field q = p^n — field element vector length

characteristic polynomial of length u_n

Indicator of which row of poly is the multiplicative inverse of this row of length u_q

row number of which row of poly is the negative (additive inverse) of this row of length u_q

root

sum field of dimension u_q x u_q

product field of dimension u_q x u_q

polynomial field of dimension u_q x u_n

◆ oa_type1()

RcppExport SEXP oa_type1 ( SEXP  type,
SEXP  q,
SEXP  ncol,
SEXP  bRandom 
)

An entry point for a set of Orthogonal Array algorithms

See also
oacpp::COrthogonalArray::bose
oacpp::COrthogonalArray::bosebush
oacpp::COrthogonalArray::bush
oacpp::COrthogonalArray::addelkemp
oacpp::COrthogonalArray::addelkemp3
Todo:
test if q, ncol, n is a vector, Rcpp::as<int> should throw
Todo:
test of NA's are not caught as expected
Todo:
test if infinities are not caught as expected
Todo:
do tests in c++ for all to determine what must be checked in R
Parameters
typeThe type of orthogonal array algorithm to use
  • bose
  • bosebush
  • bush
  • addelkemp
  • addelkemp3
qthe number of symbols in the array
ncolthe number of columns in the array
bRandomwhether the array should be randomized
Returns
an integer matrix

◆ oa_type2()

RcppExport SEXP oa_type2 ( SEXP  type,
SEXP  int1,
SEXP  q,
SEXP  ncol,
SEXP  bRandom 
)

An entry point for a set of Orthogonal Array algorithms

See also
oacpp::COrthogonalArray::busht
oacpp::COrthogonalArray::bosebushl
oacpp::COrthogonalArray::addelkempn
Parameters
typeThe type of orthogonal array algorithm to use
  • busht
  • bosebushl
  • addelkempn
int1a parameter that depends on the context
  • busht: the strength
  • bosebush: lambda
  • addelkemp: the exponent on q
qthe number of symbols in the array
ncolthe number of columns in the array
bRandomwhether the array should be randomized
Returns
an integer matrix

◆ poly2int()

RcppExport SEXP poly2int ( SEXP  p,
SEXP  n,
SEXP  poly 
)

Convert polynomial to integer in 0..q-1

Parameters
ppolynomial multiplier
nthe length of poly
polythe polynomial
Returns
an integer

◆ poly_prod()

RcppExport SEXP poly_prod ( SEXP  p,
SEXP  n,
SEXP  xton,
SEXP  p1,
SEXP  p2 
)

Multiplication in polynomial representation

Parameters
pmodulus
u_nlength of p1 and p2
xtoncharacteristic polynomial
p1polynomial 1
p2polynomial 2
prodthe product of the polynomials

◆ poly_sum()

RcppExport SEXP poly_sum ( SEXP  p,
SEXP  n,
SEXP  p1,
SEXP  p2 
)

Addition in polynomial representation

Parameters
pmodulus
u_nthe length of p1 and p2
p1polynomial 1
p2polynomial 2
sumthe sum of the polynomials