ajmath.c


Function ajRound

Rounds an integer to be a multiple of a given number.

Prototype

ajint ajRound (
      ajuint i,
      ajuint vround
);

TypeNameRead/WriteDescription
ajuintiInputInteger to round.
ajuintvroundInputRounding multiple.
ajint RETURNResult.

From EMBOSS 1.0.0


Function ajRoundFloat

Rounds a floating point number to have bits free for cumulative addition

Prototype

float ajRoundFloat (
      float a,
      ajuint nbits
);

TypeNameRead/WriteDescription
floataInputFloat to round.
ajuintnbitsInputNumber of bits to free.
float RETURNResult.

From EMBOSS 6.2.0


Function ajCvtRecToPol

Converts Cartesian coordinates to polar

Prototype

void ajCvtRecToPol (
      float x,
      float y,
      float* radius,
      float* angle
);

TypeNameRead/WriteDescription
floatxInputX coordinate
floatyInputY coordinate
float*radiusOutputRadius
float*angleOutputAngle
void RETURN

From EMBOSS 6.2.0


Function ajCvtPolToRec

Converts polar coordinates to Cartesian

Prototype

void ajCvtPolToRec (
      float radius,
      float angle,
      float* x,
      float* y
);

TypeNameRead/WriteDescription
floatradiusInputRadius
floatangleInputAngle
float*xOutputX coordinate
float*yOutputY coordinate
void RETURN

From EMBOSS 6.2.0


Function ajCvtDegToRad

Converts degrees to radians

Prototype

float ajCvtDegToRad (
      float degrees
);

TypeNameRead/WriteDescription
floatdegreesInputDegrees
float RETURNRadians

From EMBOSS 6.2.0


Function ajCvtRadToDeg

Converts radians to degrees

Prototype

float ajCvtRadToDeg (
      float radians
);

TypeNameRead/WriteDescription
floatradiansInputRadians
float RETURNDegrees

From EMBOSS 6.2.0


Function ajCvtGaussToProb

Returns a probability given a Gaussian distribution

Prototype

double ajCvtGaussToProb (
      float mean,
      float sd,
      float score
);

TypeNameRead/WriteDescription
floatmeanInputmean
floatsdInputsd
floatscoreInputscore
double RETURNprobability

From EMBOSS 6.2.0


Function ajMathGmean

Calculate a geometric mean

Prototype

float ajMathGmean (
      const float* s,
      ajint n
);

TypeNameRead/WriteDescription
const float*sInputarray of values
ajintnInputnumber of values
float RETURNgeometric mean

From EMBOSS 6.2.0


Function ajMathModulo

Modulo always returning positive number

Prototype

ajint ajMathModulo (
      ajint a,
      ajint b
);

TypeNameRead/WriteDescription
ajintaInputvalue1
ajintbInputvalue2
ajint RETURNvalue1 modulo value2

From EMBOSS 6.2.0


Function ajRandomSeed

Seed for the ajRandomDouble routine

Prototype

void ajRandomSeed (
      void
);

TypeNameRead/WriteDescription
void RETURN

From EMBOSS 1.0.0


Function ajRandomNumber

Generate a pseudo-random number between 0-32767

Prototype

ajint ajRandomNumber (
      void
);

TypeNameRead/WriteDescription
ajint RETURNRandom number

From EMBOSS 1.0.0


Function ajRandomDouble

Generate a random number between 0-1.0

Prototype

double ajRandomDouble (
      void
);

TypeNameRead/WriteDescription
double RETURNRandom number

From EMBOSS 6.2.0


Function ajMathCrc32

Calculates the SwissProt style CRC32 checksum for a protein sequence. This seems to be a bit reversal of a standard CRC32 checksum.

Prototype

ajuint ajMathCrc32 (
      const AjPStr seq
);

TypeNameRead/WriteDescription
const AjPStrseqInputSequence as a string
ajuint RETURNCRC32 checksum.

From EMBOSS 6.2.0


Function ajMathCrc64

Calculate 64-bit crc

Prototype

unsigned long long ajMathCrc64 (
      const AjPStr thys
);

TypeNameRead/WriteDescription
const AjPStrthysInputsequence
unsigned long long RETURN64-bit CRC

From EMBOSS 6.2.0


Function ajCvtSposToPos

Converts a string position into a true position. If ipos is negative, it is counted from the end of the string rather than the beginning.

Prototype

size_t ajCvtSposToPos (
      size_t len,
      ajlong ipos
);

TypeNameRead/WriteDescription
size_tlenInputString length.
ajlongiposInputPosition (0 start, negative from the end).
size_t RETURNstring position between 0 and (length minus 1).

From EMBOSS 6.2.0


Function ajCvtSposToPosStart

Converts a position into a true position. If ipos is negative, it is counted from the end of the string rather than the beginning.

Prototype

size_t ajCvtSposToPosStart (
      size_t len,
      size_t imin,
      ajlong ipos
);

TypeNameRead/WriteDescription
size_tlenInputmaximum length.
size_timinInputStart position (0 start, no negative values).
ajlongiposInputPosition (0 start, negative from the end).
size_t RETURNstring position between 0 and (length minus 1).

From EMBOSS 6.2.0


Function ajNumLengthDouble

Returns the length of a number written as an integer

Prototype

ajuint ajNumLengthDouble (
      double dnumber
);

TypeNameRead/WriteDescription
doublednumberInputDouble precision value
ajuint RETURNNumber of digits

From EMBOSS 4.1.0


Function ajNumLengthFloat

Returns the length of a number written as an integer

Prototype

ajuint ajNumLengthFloat (
      float fnumber
);

TypeNameRead/WriteDescription
floatfnumberInputSingle precision value
ajuint RETURNNumber of digits

From EMBOSS 4.1.0


Function ajNumLengthInt

Returns the length of a number written as an integer

Prototype

ajuint ajNumLengthInt (
      ajlong inumber
);

TypeNameRead/WriteDescription
ajlonginumberInputInteger
ajuint RETURNNumber of digits

From EMBOSS 4.1.0


Function ajNumLengthUint

Returns the length of a number written as an integer

Prototype

ajuint ajNumLengthUint (
      ajulong inumber
);

TypeNameRead/WriteDescription
ajulonginumberInputUnsigned integer
ajuint RETURNNumber of digits

From EMBOSS 4.1.0