clifford.Layout

class clifford.Layout(sig, bladeTupList, firstIdx=0, names=None)[source]

Layout stores information regarding the geometric algebra itself and the internal representation of multivectors.

It is constructed like this:

Layout(signature, bladeTupList, firstIdx=0, names=None)

The arguments to be passed are interpreted as follows:

signature – the signature of the vector space. This should be

a list of positive and negative numbers where the sign determines the sign of the inner product of the corresponding vector with itself. The values are irrelevant except for sign. This list also determines the dimensionality of the vectors. Signatures with zeroes are not permitted at this time.

Examples:

signature = [+1, -1, -1, -1] # Hestenes’, et al. Space-Time Algebra signature = [+1, +1, +1] # 3-D Euclidean signature

bladeTupList – list of tuples corresponding to the blades in the whole

algebra. This list determines the order of coefficients in the internal representation of multivectors. The entry for the scalar must be an empty tuple, and the entries for grade-1 vectors must be singleton tuples. Remember, the length of the list will be 2**dims.

Example:

bladeTupList = [(), (0,), (1,), (0,1)] # 2-D

firstIdx – the index of the first vector. That is, some systems number

the base vectors starting with 0, some with 1. Choose by passing the correct number as firstIdx. 0 is the default.

names – list of names of each blade. When pretty-printing multivectors,

use these symbols for the blades. names should be in the same order as bladeTupList. You may use an empty string for scalars. By default, the name for each non-scalar blade is ‘e’ plus the indices of the blade as given in bladeTupList.

Example:

names = [‘’, ‘s0’, ‘s1’, ‘i’] # 2-D

Layout’s Members:

dims – dimensionality of vectors (== len(signature))

sig – normalized signature (i.e. all values are +1 or -1)

firstIdx – starting point for vector indices

bladeTupList – list of blades

gradeList – corresponding list of the grades of each blade

gaDims – 2**dims

einf – if conformal returns einf

eo – if conformal returns eo

names – pretty-printing symbols for the blades

even – dictionary of even permutations of blades to the canonical blades

odd – dictionary of odd permutations of blades to the canonical blades

gmt – multiplication table for geometric product [1]

imt – multiplication table for inner product [1]

omt – multiplication table for outer product [1]

lcmt – multiplication table for the left-contraction [1]

[1] The multiplication tables are NumPy arrays of rank 3 with indices like

the tensor g_ijk discussed above.

Attributes

I

the psuedoScalar

basis_names

basis_vectors

basis_vectors_lst

blades

blades_list

Ordered list of blades in this layout (with scalar as [0])

metric

pseudoScalar

the psuedoScalar

rotor_mask

scalar

the scalar of value 1, for this GA (a MultiVector object)

Methods

MultiVector

create a multivector in this layout

__init__

Initialize self.

bases

Returns a dictionary mapping basis element names to their MultiVector instances, optionally for specific grades

blades_of_grade

return all blades of a given grade,

dict_to_multivector

Takes a dictionary of coefficient values and converts it into a MultiVector object

get_grade_projection_matrix

Returns the matrix M_g that performs grade projection via left multiplication eg.

get_left_gmt_matrix

This produces the matrix X that performs left multiplication with x eg.

get_right_gmt_matrix

This produces the matrix X that performs right multiplication with x eg.

gmt_func_generator

grade_mask

imt_func_generator

lcmt_func_generator

load_ga_file

Takes a ga file Checks it is the same signature as this layout Loads the data into an MVArray

omt_func_generator

parse_multivector

Parses a multivector string into a MultiVector object

randomMV

Convenience method to create a random multivector.

randomRotor

generate a random Rotor.

randomV

generate n random 1-vector s