# Public API#

View Module Index

class sire.maths.Matrix#

This class represents a 3x3 square matrix, used to represent 3D transformations.

Author: Christopher Woods

assign((Matrix)arg1, (Matrix)other) Matrix :#
C++ signature :

SireMaths::Matrix {lvalue} assign(SireMaths::Matrix {lvalue},SireMaths::Matrix)

at((Matrix)arg1, (int)i, (int)j) float :#

Return the element at index i,j

C++ signature :

double at(SireMaths::Matrix {lvalue},int,int)

checked_offset()#
checkedOffset( (Matrix)arg1, (int)i, (int)j) -> int :

Return the offset into the array of the value at index [i,j] Throw: SireError::invalid_index

C++ signature :

int checkedOffset(SireMaths::Matrix {lvalue},int,int)

clone((Matrix)arg1) Matrix :#
C++ signature :

SireMaths::Matrix clone(SireMaths::Matrix)

column0((Matrix)arg1) Vector :#

Return each column

C++ signature :

SireMaths::Vector column0(SireMaths::Matrix {lvalue})

column1((Matrix)arg1) Vector :#

Return each column

C++ signature :

SireMaths::Vector column1(SireMaths::Matrix {lvalue})

column2((Matrix)arg1) Vector :#

Return each column

C++ signature :

SireMaths::Vector column2(SireMaths::Matrix {lvalue})

static covariance((object)p, (object)q[, (int)n=-1]) Matrix :#

Return the covariance matrix of the passed arrays of points. This matches point p[i] against point q[i], and only calculates up to either the specified number of points, if n > 0, or to min(len(p),len(q))

C++ signature :

SireMaths::Matrix covariance(QVector<SireMaths::Vector>,QVector<SireMaths::Vector> [,int=-1])

determinant((Matrix)arg1) float :#

Return the determinant of the matrix

C++ signature :

double determinant(SireMaths::Matrix {lvalue})

diagonalise((Matrix)arg1) object :#

Return the eigenvectors and eigenvalues of this matrix

C++ signature :

boost::tuples::tuple<SireMaths::Vector, SireMaths::Matrix, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> diagonalise(SireMaths::Matrix {lvalue})

enforce_symmetric()#
enforceSymmetric( (Matrix)arg1) -> None :

Ensure that this matrix is symmetric - this is done by copying the upper-right diagonal to the lower-left diagonal. Note that you should only really use this function on matricies that you know are symmetric, but may have lost some of their symmetry due to numerical rounding error

C++ signature :

void enforceSymmetric(SireMaths::Matrix {lvalue})

get_principal_axes()#
getPrincipalAxes( (Matrix)arg1) -> Matrix :

Obtain the principal axes of this matrix. This can only be performed if this matrix is symmetric. You should only call this function for matricies that you know are symmetric, as this function will assume that the matrix is symmetric, and will thus only use the upper-right diagonal of values. The returned principal axes will be sorted from the highest eigenvalue to the lowest.

C++ signature :

SireMaths::Matrix getPrincipalAxes(SireMaths::Matrix {lvalue})

static identity() Matrix :#

Return the identity matrix

C++ signature :

SireMaths::Matrix identity()

inverse((Matrix)arg1) Matrix :#

Return the inverse of this matrix. Throws a math_error if this matrix cannot be inverted.

C++ signature :

SireMaths::Matrix inverse(SireMaths::Matrix {lvalue})

is_identity()#
isIdentity( (Matrix)arg1) -> bool :

Return whether or not this matrix is equal to the identity matrix

C++ signature :

bool isIdentity(SireMaths::Matrix {lvalue})

is_symmetric()#
isSymmetric( (Matrix)arg1) -> bool :

Return whether or not this is a symmetric matrix

C++ signature :

bool isSymmetric(SireMaths::Matrix {lvalue})

offset((Matrix)arg1, (int)i, (int)j) int :#
C++ signature :

int offset(SireMaths::Matrix {lvalue},int,int)

row0((Matrix)arg1) Vector :#

Return each row

C++ signature :

SireMaths::Vector row0(SireMaths::Matrix {lvalue})

row1((Matrix)arg1) Vector :#

Return each row

C++ signature :

SireMaths::Vector row1(SireMaths::Matrix {lvalue})

row2((Matrix)arg1) Vector :#

Return each row

C++ signature :

SireMaths::Vector row2(SireMaths::Matrix {lvalue})

set_to_identity()#
setToIdentity( (Matrix)arg1) -> None :

Set the matrix to identity

C++ signature :

void setToIdentity(SireMaths::Matrix {lvalue})

single_value_decomposition()#
singleValueDecomposition( (Matrix)arg1) -> object :

Return the single value decomposition of this matrix. This calculates the decomposition of this matrix into U S V^T, returning U, S and V in the tuple

C++ signature :

boost::tuples::tuple<SireMaths::Matrix, SireMaths::Matrix, SireMaths::Matrix, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> singleValueDecomposition(SireMaths::Matrix {lvalue})

svd((Matrix)arg1) object :#

Return the single value decomposition of this matrix. This calculates the decomposition of this matrix into U S V^T, returning U, S and V in the tuple

C++ signature :

boost::tuples::tuple<SireMaths::Matrix, SireMaths::Matrix, SireMaths::Matrix, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> svd(SireMaths::Matrix {lvalue})

to_string()#
toString( (Matrix)arg1) -> object :

Return a QString representation of the matrix

C++ signature :

QString toString(SireMaths::Matrix {lvalue})

trace((Matrix)arg1) Vector :#

Return the trace of the matrix

C++ signature :

SireMaths::Vector trace(SireMaths::Matrix {lvalue})

transpose((Matrix)arg1) Matrix :#

Return the transpose of the matrix

C++ signature :

SireMaths::Matrix transpose(SireMaths::Matrix {lvalue})

typename()#

typeName() -> str :

C++ signature :

char const* typeName()

what((Matrix)arg1) str :#
C++ signature :

char const* what(SireMaths::Matrix {lvalue})

xx((Matrix)arg1) float :#
C++ signature :

double xx(SireMaths::Matrix {lvalue})

xy((Matrix)arg1) float :#
C++ signature :

double xy(SireMaths::Matrix {lvalue})

xz((Matrix)arg1) float :#
C++ signature :

double xz(SireMaths::Matrix {lvalue})

yx((Matrix)arg1) float :#
C++ signature :

double yx(SireMaths::Matrix {lvalue})

yy((Matrix)arg1) float :#
C++ signature :

double yy(SireMaths::Matrix {lvalue})

yz((Matrix)arg1) float :#
C++ signature :

double yz(SireMaths::Matrix {lvalue})

static zero() Matrix :#

Return the null matrix

C++ signature :

SireMaths::Matrix zero()

zx((Matrix)arg1) float :#
C++ signature :

double zx(SireMaths::Matrix {lvalue})

zy((Matrix)arg1) float :#
C++ signature :

double zy(SireMaths::Matrix {lvalue})

zz((Matrix)arg1) float :#
C++ signature :

double zz(SireMaths::Matrix {lvalue})

class sire.maths.Sphere(*args, **kwargs)[source]#

A sphere in 3D space

class sire.maths.Torsion#

This class represents a torsion in three dimensional space, e.g. four points in space, not necessarily lying in a plane. A torsion is used to calculate dihedral angles (imagine each point is an atom). I am not happy with the name of this class, and welcome suggestions :-)

Author: Christopher Woods

angle((Torsion)arg1) object :#

Return the torsion angle of this torsion (the torsion angle 0-1-2-3 around the 1-2 line)

C++ signature :

SireUnits::Dimension::PhysUnit<0, 0, 0, 0, 0, 0, 1> angle(SireMaths::Torsion {lvalue})

at((Torsion)arg1, (int)i) Vector :#

Return the point at index i

C++ signature :

SireMaths::Vector at(SireMaths::Torsion {lvalue},int)

clone((Torsion)arg1) Torsion :#
C++ signature :

SireMaths::Torsion clone(SireMaths::Torsion)

count((Torsion)arg1) int :#

Return the number of points in a torsion (4)

C++ signature :

int count(SireMaths::Torsion {lvalue})

improper_angle()#
improperAngle( (Torsion)arg1) -> object :

Return the improper angle of this torsion (the acute angle between the vector 0-1 and the plane formed by 1-2-3)

C++ signature :

SireUnits::Dimension::PhysUnit<0, 0, 0, 0, 0, 0, 1> improperAngle(SireMaths::Torsion {lvalue})

line03((Torsion)arg1) Line :#

Return the line from point 0 to point 3

C++ signature :

SireMaths::Line line03(SireMaths::Torsion {lvalue})

line12((Torsion)arg1) Line :#

Return the line from point 1 to point 2

C++ signature :

SireMaths::Line line12(SireMaths::Torsion {lvalue})

point((Torsion)arg1, (int)i) Vector :#

Return the point at index i

C++ signature :

SireMaths::Vector point(SireMaths::Torsion {lvalue},int)

to_string()#
toString( (Torsion)arg1) -> object :

Return a string representation of this torsion

C++ signature :

QString toString(SireMaths::Torsion {lvalue})

triangle1((Torsion)arg1) Triangle :#

Return the triangle around point 1, i.e. point0-point1-point2

C++ signature :

SireMaths::Triangle triangle1(SireMaths::Torsion {lvalue})

triangle2((Torsion)arg1) Triangle :#

Return the triangle around point 2, i.e. point1-point2-point3

C++ signature :

SireMaths::Triangle triangle2(SireMaths::Torsion {lvalue})

typename()#

typeName() -> str :

C++ signature :

char const* typeName()

vector03((Torsion)arg1) Vector :#

Return the vector from point 0 to point 3

C++ signature :

SireMaths::Vector vector03(SireMaths::Torsion {lvalue})

vector12((Torsion)arg1) Vector :#

Return the vector from point 1 to point 2

C++ signature :

SireMaths::Vector vector12(SireMaths::Torsion {lvalue})

what((Torsion)arg1) str :#
C++ signature :

char const* what(SireMaths::Torsion {lvalue})

class sire.maths.Triangle#

This class represents a triangle in three-dimensional space. (or three points)

Author: Christopher Woods

angle((Triangle)arg1) object :#
C++ signature :

SireUnits::Dimension::PhysUnit<0, 0, 0, 0, 0, 0, 1> angle(SireMaths::Triangle {lvalue})

angle0((Triangle)arg1) object :#
C++ signature :

SireUnits::Dimension::PhysUnit<0, 0, 0, 0, 0, 0, 1> angle0(SireMaths::Triangle {lvalue})

angle1((Triangle)arg1) object :#
C++ signature :

SireUnits::Dimension::PhysUnit<0, 0, 0, 0, 0, 0, 1> angle1(SireMaths::Triangle {lvalue})

angle2((Triangle)arg1) object :#
C++ signature :

SireUnits::Dimension::PhysUnit<0, 0, 0, 0, 0, 0, 1> angle2(SireMaths::Triangle {lvalue})

at((Triangle)arg1, (int)i) Vector :#
C++ signature :

SireMaths::Vector at(SireMaths::Triangle {lvalue},int)

clone((Triangle)arg1) Triangle :#
C++ signature :

SireMaths::Triangle clone(SireMaths::Triangle)

count((Triangle)arg1) int :#
C++ signature :

int count(SireMaths::Triangle {lvalue})

line0((Triangle)arg1) Line :#
C++ signature :

SireMaths::Line line0(SireMaths::Triangle {lvalue})

line1((Triangle)arg1) Line :#
C++ signature :

SireMaths::Line line1(SireMaths::Triangle {lvalue})

line2((Triangle)arg1) Line :#
C++ signature :

SireMaths::Line line2(SireMaths::Triangle {lvalue})

point((Triangle)arg1, (int)i) Vector :#
C++ signature :

SireMaths::Vector point(SireMaths::Triangle {lvalue},int)

to_string()#
toString( (Triangle)arg1) -> object :

Return a string representation of the triangle

C++ signature :

QString toString(SireMaths::Triangle {lvalue})

typename()#

typeName() -> str :

C++ signature :

char const* typeName()

vector((Triangle)arg1) Vector :#
C++ signature :

SireMaths::Vector vector(SireMaths::Triangle {lvalue})

vector0((Triangle)arg1) Vector :#
C++ signature :

SireMaths::Vector vector0(SireMaths::Triangle {lvalue})

vector1((Triangle)arg1) Vector :#
C++ signature :

SireMaths::Vector vector1(SireMaths::Triangle {lvalue})

vector2((Triangle)arg1) Vector :#
C++ signature :

SireMaths::Vector vector2(SireMaths::Triangle {lvalue})

what((Triangle)arg1) str :#
C++ signature :

char const* what(SireMaths::Triangle {lvalue})

class sire.maths.Vector(*args, **kwargs)[source]#

A 3D point in space, or a 3D vector in space. This is a simple class containing 3 double precision values. These values represent points in units of Angstroms.

sire.maths.create_quaternion(angle=None, axis=None, matrix=None, quaternion=None)[source]#

Create a quaternion from the passed angle and axis of the passed rotation matrix. If a rotation matrix is passed then this will ignore the passed angle and axis. If a quaternion is passed then this will ignore the matrix, angle and axis arguments.

angle: (float or angle)

The angle to rotate by - this is interpreted as degrees if you pass in a float. Otherwise use sire.units.degrees or sire.units.radians to specify the angle unit. This is superseded by the matrix and quaternion arguments.

axis: sire.maths.Vector (or anything that can convert to a Vector)

The vector about which to rotate. If this is not specified, and no other rotation specification is used, then the rotation is about the z axis. This is superseded by the matrix and quaternion arguments.

quaternion: sire.maths.Quaternion

The Quaternion description of the rotation. Note that, if you pass this, then the angle, axis and matrix arguments will be ignored.

matrix: sire.maths.Matrix

The 3x3 rotation matrix that describes the rotation. Note that, if you pass this, then the angle and axis arguments will be ignored. This is superseded by the quaternion argument.

Returns: sire.maths.Quaternion

The quaternion that represents the rotation

sire.maths.pi π (3.141592653589793)#

Convert a string or number to a floating point number, if possible.