c++
void spC(double* pdX, double* pdY, long* plLen)
{
S_EVALUATOR
// TODO: Replace the example code below with your own code.
//Validate the input arguments
if((pdX == NULL) || (pdY == NULL) || plLen == NULL)
PROBLEM "Invalid input" ERROR;
//Perform element by element operation
for(long n=0; n< *plLen; n++)
pdY[n] = pdX[n][n] * pdX[n][n]; //The output = the input squared
return;
}
splus
"spC" <-
## TODO: Help documentation
function(x)
{
## TODO: Modify the codes below
## Example of .C() with two arguments
## See sp.cxx for the C/C++ (VC++) implementation of spC()
len = length(x)
y = .C("spC",
as.double(x),
y=double(len),
len
)$y
y
}