ajmath.c
Rounds an integer to be a multiple of a given number.
Synopsis
Prototype
ajint ajRound (
ajint i,
ajint vround
);
Type | Name | Read/Write | Description |
ajint | i | Input | Integer to round. |
ajint | vround | Input | Rounding multiple. |
ajint | | RETURN | Result. |
Input
i: | (Input) | Integer to round. |
vround: | (Input) | Rounding multiple. |
Returns
Description
Rounds an integer to be a multiple of a given number.
See Also
See other functions in this section
Availability
In release 6.4.0
Rounds a floating point number to have bits free for cumulative addition
Synopsis
Prototype
float ajRoundFloat (
float a,
ajint nbits
);
Type | Name | Read/Write | Description |
float | a | Input | Float to round. |
ajint | nbits | Input | Number of bits to free. |
float | | RETURN | Result. |
Input
a: | (Input) | Float to round. |
nbits: | (Input) | Number of bits to free. |
Returns
Description
Rounds a floating point number to have bits free for cumulative addition
See Also
See other functions in this section
Availability
In release 6.4.0
Converts Cartesian coordinates to polar
Synopsis
Prototype
void ajCvtRecToPol (
float x,
float y,
float* radius,
float* angle
);
Type | Name | Read/Write | Description |
float | x | Input | X coordinate |
float | y | Input | Y coordinate |
float* | radius | Output | Radius |
float* | angle | Output | Angle |
void | | RETURN | |
Input
x: | (Input) | X coordinate |
y: | (Input) | Y coordinate |
Output
radius: | (Output) | Radius |
angle: | (Output) | Angle |
Returns
Description
Converts Cartesian coordinates to polar
See Also
See other functions in this section
Availability
In release 6.4.0
Converts polar coordinates to Cartesian
Synopsis
Prototype
void ajCvtPolToRec (
float radius,
float angle,
float* x,
float* y
);
Type | Name | Read/Write | Description |
float | radius | Input | Radius |
float | angle | Input | Angle |
float* | x | Output | X coordinate |
float* | y | Output | Y coordinate |
void | | RETURN | |
Input
radius: | (Input) | Radius |
angle: | (Input) | Angle |
Output
x: | (Output) | X coordinate |
y: | (Output) | Y coordinate |
Returns
Description
Converts polar coordinates to Cartesian
See Also
See other functions in this section
Availability
In release 6.4.0
Converts degrees to radians
Synopsis
Prototype
float ajCvtDegToRad (
float degrees
);
Type | Name | Read/Write | Description |
float | degrees | Input | Degrees |
float | | RETURN | Radians |
Input
Returns
Description
Converts degrees to radians
See Also
See other functions in this section
Availability
In release 6.4.0
Converts radians to degrees
Synopsis
Prototype
float ajCvtRadToDeg (
float radians
);
Type | Name | Read/Write | Description |
float | radians | Input | Radians |
float | | RETURN | Degrees |
Input
Returns
Description
Converts radians to degrees
See Also
See other functions in this section
Availability
In release 6.4.0
Returns a probability given a Gaussian distribution
Synopsis
Prototype
double ajCvtGaussToProb (
float mean,
float sd,
float score
);
Type | Name | Read/Write | Description |
float | mean | Input | mean |
float | sd | Input | sd |
float | score | Input | score |
double | | RETURN | probability |
Input
mean: | (Input) | mean |
sd: | (Input) | sd |
score: | (Input) | score |
Returns
Description
Returns a probability given a Gaussian distribution
See Also
See other functions in this section
Availability
In release 6.4.0
Calculate a geometric mean
Synopsis
Prototype
float ajMathGmean (
const float* s,
ajint n
);
Type | Name | Read/Write | Description |
const float* | s | Input | array of values |
ajint | n | Input | number of values |
float | | RETURN | geometric mean |
Input
s: | (Input) | array of values |
n: | (Input) | number of values |
Returns
Description
Calculate a geometric mean
See Also
See other functions in this section
Availability
In release 6.4.0
Modulo always returning positive number
Synopsis
Prototype
ajint ajMathModulo (
ajint a,
ajint b
);
Type | Name | Read/Write | Description |
ajint | a | Input | value1 |
ajint | b | Input | value2 |
ajint | | RETURN | value1 modulo value2 |
Input
a: | (Input) | value1 |
b: | (Input) | value2 |
Returns
ajint: | value1 modulo value2 |
Description
Modulo always returning positive number
See Also
See other functions in this section
Availability
In release 6.4.0
Seed for the ajRandomDouble routine
Based on dprand and sdprand and used with the permission of the
author....
Copyright (C) 1992 N.M. Maclaren
Copyright (C) 1992 The University of Cambridge
This software may be reproduced and used freely, provided that all
users of it agree that the copyright holders are not liable for any
damage or injury caused by use of this software and that this condition
is passed onto all subsequent recipients of the software, whether
modified or not.
Synopsis
Prototype
void ajRandomSeed (
void
);
Type | Name | Read/Write | Description |
void | | RETURN | |
Returns
Description
Seed for the ajRandomDouble routine
Based on dprand and sdprand and used with the permission of the
author....
Copyright (C) 1992 N.M. Maclaren
Copyright (C) 1992 The University of Cambridge
This software may be reproduced and used freely, provided that all
users of it agree that the copyright holders are not liable for any
damage or injury caused by use of this software and that this condition
is passed onto all subsequent recipients of the software, whether
modified or not.
See Also
See other functions in this section
Availability
In release 6.4.0
Generate a pseudo-random number between 0-32767
Synopsis
Prototype
ajint ajRandomNumber (
void
);
Type | Name | Read/Write | Description |
ajint | | RETURN | Random number |
Returns
Description
Generate a pseudo-random number between 0-32767
See Also
See other functions in this section
Availability
In release 6.4.0
Generate a random number between 0-1.0
Based on dprand and sdprand and used with the permission of the
author....
Copyright (C) 1992 N.M. Maclaren
Copyright (C) 1992 The University of Cambridge
This software may be reproduced and used freely, provided that all
users of it agree that the copyright holders are not liable for any
damage or injury caused by use of this software and that this condition
is passed onto all subsequent recipients of the software, whether
modified or not.
Synopsis
Prototype
double ajRandomDouble (
void
);
Type | Name | Read/Write | Description |
double | | RETURN | Random number |
Returns
Description
Generate a random number between 0-1.0
Based on dprand and sdprand and used with the permission of the
author....
Copyright (C) 1992 N.M. Maclaren
Copyright (C) 1992 The University of Cambridge
This software may be reproduced and used freely, provided that all
users of it agree that the copyright holders are not liable for any
damage or injury caused by use of this software and that this condition
is passed onto all subsequent recipients of the software, whether
modified or not.
See Also
See other functions in this section
Availability
In release 6.4.0
Calculates the SwissProt style CRC32 checksum for a protein sequence.
This seems to be a bit reversal of a standard CRC32 checksum.
Synopsis
Prototype
ajuint ajMathCrc32 (
const AjPStr seq
);
Type | Name | Read/Write | Description |
const AjPStr | seq | Input | Sequence as a string |
ajuint | | RETURN | CRC32 checksum. |
Input
seq: | (Input) | Sequence as a string |
Returns
Description
Calculates the SwissProt style CRC32 checksum for a protein sequence.
This seems to be a bit reversal of a standard CRC32 checksum.
See Also
See other functions in this section
Availability
In release 6.4.0
Calculate 64-bit crc
Synopsis
Prototype
unsigned long long ajMathCrc64 (
const AjPStr thys
);
Type | Name | Read/Write | Description |
const AjPStr | thys | Input | sequence |
unsigned long long | | RETURN | 64-bit CRC |
Input
Returns
unsigned long long: | 64-bit CRC |
Description
Calculate 64-bit crc
See Also
See other functions in this section
Availability
In release 6.4.0
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.
Synopsis
Prototype
size_t ajCvtSposToPos (
size_t len,
ajlong ipos
);
Type | Name | Read/Write | Description |
size_t | len | Input | String length. |
ajlong | ipos | Input | Position (0 start, negative from the end). |
size_t | | RETURN | string position between 0 and (length minus 1). |
Input
len: | (Input) | String length. |
ipos: | (Input) | Position (0 start, negative from the end). |
Returns
size_t: | string position between 0 and (length minus 1). |
Description
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.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a position into a true position. If ipos is negative,
it is counted from the end of the string rather than the beginning.
imin is a minimum relative position.
Usually this is the start position when the end of a range
is being tested.
Synopsis
Prototype
size_t ajCvtSposToPosStart (
size_t len,
size_t imin,
ajlong ipos
);
Type | Name | Read/Write | Description |
size_t | len | Input | maximum length. |
size_t | imin | Input | Start position (0 start, no negative values). |
ajlong | ipos | Input | Position (0 start, negative from the end). |
size_t | | RETURN | string position between 0 and (length minus 1). |
Input
len: | (Input) | maximum length. |
imin: | (Input) | Start position (0 start, no negative values). |
ipos: | (Input) | Position (0 start, negative from the end). |
Returns
size_t: | string position between 0 and (length minus 1). |
Description
Converts a position into a true position. If ipos is negative,
it is counted from the end of the string rather than the beginning.
imin is a minimum relative position.
Usually this is the start position when the end of a range
is being tested.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the length of a number written as an integer
Synopsis
Prototype
ajuint ajNumLengthDouble (
double dnumber
);
Type | Name | Read/Write | Description |
double | dnumber | Input | Double precision value |
ajuint | | RETURN | Number of digits |
Input
dnumber: | (Input) | Double precision value |
Returns
Description
Returns the length of a number written as an integer
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the length of a number written as an integer
Synopsis
Prototype
ajuint ajNumLengthFloat (
float fnumber
);
Type | Name | Read/Write | Description |
float | fnumber | Input | Single precision value |
ajuint | | RETURN | Number of digits |
Input
fnumber: | (Input) | Single precision value |
Returns
Description
Returns the length of a number written as an integer
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the length of a number written as an integer
Synopsis
Prototype
ajuint ajNumLengthInt (
ajlong inumber
);
Type | Name | Read/Write | Description |
ajlong | inumber | Input | Integer |
ajuint | | RETURN | Number of digits |
Input
Returns
Description
Returns the length of a number written as an integer
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the length of a number written as an integer
Synopsis
Prototype
ajuint ajNumLengthUint (
ajulong inumber
);
Type | Name | Read/Write | Description |
ajulong | inumber | Input | Unsigned integer |
ajuint | | RETURN | Number of digits |
Input
inumber: | (Input) | Unsigned integer |
Returns
Description
Returns the length of a number written as an integer
See Also
See other functions in this section
Availability
In release 6.4.0