/*--------------------------------------------------------------------------*/
Function::ReturnValue sci_zeros(types::typed_list &in, int _iRetCount, types::typed_list &out)
{
- for(int i = 0 ; i < in.size() ; i++)
- {
- if(in[i]->isDouble() == false)
- {
- Scierror(999, _("%s: Wrong type for input argument #%d: Matrix expected.\n"), "zeros", i + 1);
- return Function::Error;
- }
- }
-
Double* pOut = NULL;
- if(in.size() == 0)
+ if (in.size() == 0)
{
pOut = new Double(0);
}
- else if(in.size() == 1)
+ else if (in.size() == 1)
{
+ if (in[0]->isGenericType() == false || in[0]->isContainer())
+ {
+ Scierror(999, _("%s: Wrong type for input argument #%d: Matrix expected.\n"), "zeros", 1);
+ return Function::Error;
+ }
+
Double* pIn = in[0]->getAs<Double>();
int iDims = pIn->getDims();
int* piDims = pIn->getDimsArray();
}
else //size > 1
{
+ for (int i = 0 ; i < in.size() ; i++)
+ {
+ if (in[i]->isDouble() == false)
+ {
+ Scierror(999, _("%s: Wrong type for input argument #%d: Matrix expected.\n"), "zeros", i + 1);
+ return Function::Error;
+ }
+ }
+
int iDims = static_cast<int>(in.size());
int* piDims = new int[iDims];
- for(int i = 0 ; i < iDims ; i++)
+ for (int i = 0 ; i < iDims ; i++)
{
Double* pIn = in[i]->getAs<Double>();
- if(pIn->isScalar() == false || pIn->isComplex())
+ if (pIn->isScalar() == false || pIn->isComplex())
{
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), "zeros", i + 1);
return Function::Error;
}
pOut->setZeros();
- //for(int i = 0 ; i < pOut->getSize() ; i++)
- //{
- // pOut->set(i,i);
- //}
+
out.push_back(pOut);
return Function::OK;
}