Loading...
Searching...
No Matches
semic.cc File Reference
`#include "kernel/mod2.h"`
`#include <stdio.h>`
`#include <string.h>`
`#include "misc/intvec.h"`
`#include "misc/mylimits.h"`
`#include "kernel/spectrum/GMPrat.h"`
`#include "kernel/spectrum/semic.h"`

Go to the source code of this file.

## Macros

#define | SEMIC_CC

## Functions

spectrum | operator+ (const spectrum &s1, const spectrum &s2)
spectrum | operator* (int k, const spectrum &spec)
ostream & | operator<< (ostream &s, const spectrum &spec)

## Macro Definition Documentation

## SEMIC_CC

#define SEMIC_CC

Definition at line 8 of file semic.cc.

## Function Documentation

## operator*()

spectrum operator* | ( | int | k,
|  | const spectrum & | spec )

Definition at line 219 of file semic.cc.

{
if( k == 0 )
{
spectrum result;
return result;
}
else
{
spectrum result( spec );
result.mu *= k;
result.pg *= k;
for( int i=0; i<result.n; i++ )
{
result.w[i] *= k;
}
return result;
}
}
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
spectrum
Definition semic.h:64
result
return result
Definition facAbsBiFact.cc:76

## operator+()

spectrum operator+ | ( | const spectrum & | s1,
|  | const spectrum & | s2 )

Definition at line 134 of file semic.cc.

{
int i1=0, i2=0, i3=0;
spectrum result;
do
{
if( i1 >= s1.n )
{
i2++;
}
else if( i2 >= s2.n )
{
i1++;
}
else if( s1.s[i1] < s2.s[i2] )
{
i1++;
}
else if( s1.s[i1] == s2.s[i2] )
{
i1++;
i2++;
}
else
{
i2++;
}
i3++;
}
while( i1 < s1.n || i2 < s2.n );
result.copy_new( i3 );
result.n = i3;
i1 = i2 = i3 = 0;
do
{
if( i1 >= s1.n )
{
result.s[i3] = s2.s[i2];
result.w[i3] = s2.w[i2];
i2++;
}
else if( i2 >= s2.n )
{
result.s[i3] = s1.s[i1];
result.w[i3] = s1.w[i1];
i1++;
}
else if( s1.s[i1] < s2.s[i2] )
{
result.s[i3] = s1.s[i1];
result.w[i3] = s1.w[i1];
i1++;
}
else if( s1.s[i1] == s2.s[i2] )
{
result.s[i3] = s1.s[i1];
result.w[i3] = s1.w[i1] + s2.w[i2];
i1++;
i2++;
}
else
{
result.s[i3] = s2.s[i2];
result.w[i3] = s2.w[i2];
i2++;
}
i3++;
}
while( i1 < s1.n || i2 < s2.n );
result.mu = s1.mu + s2.mu;
result.pg = s1.pg + s2.pg;
return result;
}
spectrum::mu
int mu
Definition semic.h:67
spectrum::s
Rational * s
Definition semic.h:70
spectrum::n
int n
Definition semic.h:69
spectrum::pg
int pg
Definition semic.h:68
spectrum::w
int * w
Definition semic.h:71

## operator<<()

ostream & operator<< | ( | ostream & | s,
|  | const spectrum & | spec )

Definition at line 249 of file semic.cc.

{
for( int i=0; i<spec.n; i++ )
{
if( i>0 )
{
#ifdef SEMIC_STDOUT
s << "+";
#else
fprintf( stdout,"+" );
#endif
}
#ifdef SEMIC_STDOUT
s << spec.w[i] << "*t^";
#else
fprintf( stdout,"%d*t^",spec.w[i] );
#endif
s << spec.s[i];
}
return s;
}
s
const CanonicalForm int s
Definition facAbsFact.cc:51