MCPcopy Create free account
hub / github.com/Singular/Singular / spaddProc

Function spaddProc

Singular/ipshell.cc:4423–4455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4421// ----------------------------------------------------------------------------
4422
4423BOOLEAN spaddProc( leftv result,leftv first,leftv second )
4424{
4425 semicState state;
4426
4427 // -----------------
4428 // check arguments
4429 // -----------------
4430
4431 lists l1 = (lists)first->Data( );
4432 lists l2 = (lists)second->Data( );
4433
4434 if( (state=list_is_spectrum( l1 )) != semicOK )
4435 {
4436 WerrorS( "first argument is not a spectrum:" );
4437 list_error( state );
4438 }
4439 else if( (state=list_is_spectrum( l2 )) != semicOK )
4440 {
4441 WerrorS( "second argument is not a spectrum:" );
4442 list_error( state );
4443 }
4444 else
4445 {
4446 spectrum s1= spectrumFromList ( l1 );
4447 spectrum s2= spectrumFromList ( l2 );
4448 spectrum sum( s1+s2 );
4449
4450 result->rtyp = LIST_CMD;
4451 result->data = (char*)(getList(sum));
4452 }
4453
4454 return (state!=semicOK);
4455}
4456
4457// ----------------------------------------------------------------------------
4458// this procedure is called from the interpreter

Callers 1

jjSYSTEMFunction · 0.85

Calls 6

list_is_spectrumFunction · 0.85
WerrorSFunction · 0.85
list_errorFunction · 0.85
spectrumFromListFunction · 0.85
getListFunction · 0.70
DataMethod · 0.45

Tested by

no test coverage detected