COX Library sutil.cox


file sutil

scalar utilities


!

int infix operator !(int n; int k) precedence infix *;

symbol type
infix operator (prototype)
declaration
int infix operator !(int n; int k) precedence infix *;
description
Binomial coefficient, computed by sequential multiplication and division.
example
     print 6!3;
     Output: 20

location
"sutil.h", line 67


AGG_iii

typedef AGG_iii

symbol type
typedef
declaration
typedef aggregate _AGG_iii {
  int d,a,b;
} AGG_iii;
description


Compmat

MATRIX prefix operator Compmat(const MATRIX & A) precedence 28;

symbol type
prefix operator (prototype)
declaration
MATRIX prefix operator Compmat(const MATRIX & A) precedence 28;
description
returns the comparison matrix of a matrix a
location
"sutil.h", line 159


Factor

VECTOR prefix operator Factor(unsigned long n) precedence 28;

symbol type
prefix operator (prototype)
declaration
VECTOR prefix operator Factor(unsigned long n) precedence 28;
description
returns a VECTOR of prime factors of n.
example
   print Factor 12;
   Output: (2 2 3)

location
"sutil.h", line 35


IsPrime

int prefix operator IsPrime(unsigned long n) precedence 28;

symbol type
prefix operator (prototype)
declaration
int prefix operator IsPrime(unsigned long n) precedence 28;
description
returns 1, if n is prime, otherwise 0.
example
    if ( IsPrime n )
      print "n is prime";
     else print "n is not prime";

location
"sutil.h", line 20


Primes

VECTOR prefix operator Primes(unsigned long int Dim) precedence 28;

symbol type
prefix operator (prototype)
declaration
VECTOR prefix operator Primes(unsigned long int Dim) precedence 28;
description
returns a VECTOR of the Dim smallest primes.
example
   print Primes 5;
   Output: (2 3 5)
  
remarks
This routine is based on sieve.c of emx+gcc
location
"sutil.h", line 11


Remainder

double prefix operator Remainder(double x, double y) precedence 28;

symbol type
prefix operator (prototype)
declaration
double prefix operator Remainder(double x, double y) precedence 28;
description
returns the remainder after division. The Remainder(x,y) is x/y-floor(x/y)
example
   print Remainder(-6,4)
   Output: -2

location
"sutil.h", line 28


[]

VECTOR prefix operator [](int Dimension, double ...);

symbol type
prefix operator (prototype)
declaration
VECTOR prefix operator [](int Dimension, double ...);
description
Creates a VECTOR from a bracketed list of doubles
example
    v = [1,2,3];

location
"sutil.h", line 163

COMPLEX_VECTOR prefix operator [](int Dimension, COMPLEX ...);

symbol type
prefix operator (prototype)
declaration
COMPLEX_VECTOR prefix operator [](int Dimension, COMPLEX ...);
description
Creates a COMPLEX_VECTOR from a bracketed list of COMPLEX numbers.
example
    v = [1+3*I,2,3];

location
"sutil.h", line 169

MATRIX prefix operator [](int Dimension, const VECTOR & ...);

symbol type
prefix operator (prototype)
declaration
MATRIX prefix operator [](int Dimension, const VECTOR & ...);
description
Creates a MATRIX from a bracketed list of row VECTORs.
example
    M = [[1,2,3],[4,5,6],[7,8,9]];

location
"sutil.h", line 175

COMPLEX_MATRIX prefix operator [](int Dimension, const COMPLEX_VECTOR & ...);

symbol type
prefix operator (prototype)
declaration
COMPLEX_MATRIX prefix operator [](int Dimension, const COMPLEX_VECTOR & ...);
description
Creates a COMPLEX_MATRIX from a bracketed list of row COMPLEX_VECTORs.
example
    M = [[1,2,3],[4,I,6],[7,8,9]];

location
"sutil.h", line 181


gcd

int prefix operator gcd(int m, int n) precedence 28;

symbol type
prefix operator (prototype)
declaration
int prefix operator gcd(int m, int n) precedence 28;
description
returns the gcd of two numbers m,n:
example
   print gcd(8,6);
   Output: 2

location
"sutil.h", line 42

AGG_iii prefix operator gcd(int m, int n) precedence 28;

symbol type
prefix operator (prototype)
declaration
AGG_iii prefix operator gcd(int m, int n) precedence 28;
description
returns the gcd (d) of two numbers m,n and two
additional integers (a,b) which satisfy d=a*m+b*n.
example
   (d,a,b) = gcd(m,n);

location
"sutil.h", line 53


lcm

int prefix operator lcm(int m, int n) precedence 28;

symbol type
prefix operator (prototype)
declaration
int prefix operator lcm(int m, int n) precedence 28;
description
returns the lcm of two numbers m,n:
example
   print lcm(8,6);
   Output: 24

location
"sutil.h", line 60


relerr

double prefix operator relerr(const double x, const double y) precedence 28;

symbol type
prefix operator (prototype)
declaration
double prefix operator relerr(const double x, const double y) precedence 28;
description
computes the relative error between two numbers.
Below eps (= 1e-10) switch to absolute error.
location
"sutil.h", line 84

VECTOR prefix operator relerr(const VECTOR &x, const VECTOR &y);

symbol type
prefix operator (prototype)
declaration
VECTOR prefix operator relerr(const VECTOR &x, const VECTOR &y);
description
computes the relative error between two VECTORs.
Below eps (= 1e-10) switch to absolute error.
location
"sutil.h", line 89

VECTOR prefix operator relerr(const COMPLEX_VECTOR &x, const COMPLEX_VECTOR &y);

symbol type
prefix operator (prototype)
declaration
VECTOR prefix operator relerr(const COMPLEX_VECTOR &x, const COMPLEX_VECTOR &y);
description
computes the relative error between two COMPLEX_VECTORs.
Below eps (= 1e-10) switch to absolute error.
location
"sutil.h", line 94

MATRIX prefix operator relerr(const MATRIX &x, const MATRIX &y);

symbol type
prefix operator (prototype)
declaration
MATRIX prefix operator relerr(const MATRIX &x, const MATRIX &y);
description
computes the relative error between two matrices.
Below eps (= 1e-10) switch to absolute error.
location
"sutil.h", line 99

MATRIX prefix operator relerr(const COMPLEX_MATRIX &x, const COMPLEX_MATRIX &y);

symbol type
prefix operator (prototype)
declaration
MATRIX prefix operator relerr(const COMPLEX_MATRIX &x, const COMPLEX_MATRIX &y);
description
computes the relative error between two complex matrices.
Below eps (= 1e-10) switch to absolute error.
location
"sutil.h", line 104


rnd

double prefix operator rnd(double x, int digits, int mode) precedence 28;

symbol type
prefix operator (prototype)
declaration
double prefix operator rnd(double x, int digits, int mode) precedence 28;
description
round x to digits decimal places;
rounding is ignored for digits=0
mode is optional, default is 0 for nearest

mode > 0 rounding upwards
mode = 0 rounding to nearest
mode < 0 rounding downwards
location
"sutil.h", line 110

double prefix operator rnd(double x, int digits);

symbol type
prefix operator (prototype)
declaration
double prefix operator rnd(double x, int digits);
description
round x to digits decimal places;
rounding is ignored for digits=0
mode defaults to 0 (round to nearest)
location
"sutil.h", line 120

VECTOR prefix operator rnd(const VECTOR & x, int digits, int mode);

symbol type
prefix operator (prototype)
declaration
VECTOR prefix operator rnd(const VECTOR & x, int digits, int mode);
description
round x to digits decimal places;
rounding is ignored for digits=0
mode is optional, default is 0 for nearest

mode > 0 rounding upwards
mode = 0 rounding to nearest
mode < 0 rounding downwards
location
"sutil.h", line 126

VECTOR prefix operator rnd(const VECTOR & x, int digits);

symbol type
prefix operator (prototype)
declaration
VECTOR prefix operator rnd(const VECTOR & x, int digits);
description
round x to digits decimal places;
rounding is ignored for digits=0
mode defaults to 0 (round to nearest)
location
"sutil.h", line 136

MATRIX prefix operator rnd(const MATRIX & x, int digits, int mode);

symbol type
prefix operator (prototype)
declaration
MATRIX prefix operator rnd(const MATRIX & x, int digits, int mode);
description
round x to digits decimal places;
rounding is ignored for digits=0
mode is optional, default is 0 for nearest

mode > 0 rounding upwards
mode = 0 rounding to nearest
mode < 0 rounding downwards
location
"sutil.h", line 142

MATRIX prefix operator rnd(const MATRIX & x, int digits);

symbol type
prefix operator (prototype)
declaration
MATRIX prefix operator rnd(const MATRIX & x, int digits);
description
round x to digits decimal places;
rounding is ignored for digits=0
mode defaults to 0 (round to nearest)
location
"sutil.h", line 152


xRange

VECTOR prefix operator xRange(double a, double b, int n) precedence 28;

symbol type
prefix operator (prototype)
declaration
VECTOR prefix operator xRange(double a, double b, int n) precedence 28;
description
Returns a row vector with n elements ranging from min(a,b)..max(a,b).
The result vector includes the endpoints.
location
"sutil.h", line 74

VECTOR prefix operator xRange(double a, double b) precedence 28;

symbol type
prefix operator (prototype)
declaration
VECTOR prefix operator xRange(double a, double b) precedence 28;
description
Returns a row vector with 100 elements ranging from min(a,b)..max(a,b).
The result vector includes the endpoints.
location
"sutil.h", line 79


sutil Function Index

!

  • !, infix operator
  • [

  • [], prefix operator
  • c

  • Compmat, prefix operator
  • f

  • Factor, prefix operator
  • g

  • gcd, prefix operator
  • i

  • IsPrime, prefix operator
  • l

  • lcm, prefix operator
  • p

  • Primes, prefix operator
  • r

  • relerr, prefix operator
  • Remainder, prefix operator
  • rnd, prefix operator
  • x

  • xRange, prefix operator

  • sutil Data Type Index

    a

  • AGG_iii, typedef