libcrystfel 0.11.0
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
rational.h File Reference

Data Structures

struct  Rational
 

Typedefs

typedef struct _rationalmatrix RationalMatrix
 

Functions

Rational rtnl_zero (void)
 
Rational rtnl (signed long long int num, signed long long int den)
 
double rtnl_as_double (Rational r)
 
Rational rtnl_mul (Rational a, Rational b)
 
Rational rtnl_div (Rational a, Rational b)
 
Rational rtnl_add (Rational a, Rational b)
 
Rational rtnl_sub (Rational a, Rational b)
 
signed int rtnl_cmp (Rational a, Rational b)
 
Rational rtnl_abs (Rational a)
 
char * rtnl_format (Rational rt)
 
Rationalrtnl_list (signed int num_min, signed int num_max, signed int den_min, signed int den_max, int *pn)
 
RationalMatrixrtnl_mtx_new (unsigned int rows, unsigned int cols)
 
RationalMatrixrtnl_mtx_copy (const RationalMatrix *m)
 
Rational rtnl_mtx_get (const RationalMatrix *m, int i, int j)
 
void rtnl_mtx_set (const RationalMatrix *m, int i, int j, Rational v)
 
RationalMatrixrtnl_mtx_from_intmat (const IntegerMatrix *m)
 
RationalMatrixrtnl_mtx_identity (int rows)
 
IntegerMatrixintmat_from_rtnl_mtx (const RationalMatrix *m)
 
void rtnl_mtx_free (RationalMatrix *mtx)
 
RationalMatrixrtnlmtx_times_rtnlmtx (const RationalMatrix *A, const RationalMatrix *B)
 
RationalMatrixrtnlmtx_times_intmat (const RationalMatrix *A, const IntegerMatrix *B)
 
RationalMatrixintmat_times_rtnlmtx (const IntegerMatrix *a, const RationalMatrix *b)
 
int transform_fractional_coords_rtnl (const RationalMatrix *P, const Rational *ivec, Rational *ans)
 
void transform_fractional_coords_rtnl_inverse (const RationalMatrix *P, const Rational *vec, Rational *ans)
 
void rtnl_mtx_print (const RationalMatrix *m)
 
Rational rtnl_mtx_det (const RationalMatrix *m)
 
int rtnl_mtx_is_identity (const RationalMatrix *m)
 
int rtnl_mtx_is_perm (const RationalMatrix *m)
 

Detailed Description

Rational numbers (including rational matrices)

Typedef Documentation

◆ RationalMatrix

typedef struct _rationalmatrix RationalMatrix

The RationalMatrix is an opaque data structure representing a matrix of rational numbers.

Function Documentation

◆ rtnl_format()

char * rtnl_format ( Rational  rt)
Parameters
rtA Rational

Formats rt as a string

Returns
A string which should be freed by the caller

◆ rtnl_mtx_new()

RationalMatrix * rtnl_mtx_new ( unsigned int  rows,
unsigned int  cols 
)
Parameters
rowsNumber of rows that the new matrix is to have
colsNumber of columns that the new matrix is to have

Allocates a new RationalMatrix with all elements set to zero.

Returns
A new RationalMatrix, or NULL on error.

◆ rtnl_mtx_print()

void rtnl_mtx_print ( const RationalMatrix m)
Parameters
mA RationalMatrix

Prints m to stderr.