Core Parallel Datastructures

class NTPolySwig.Matrix_ps(*args)

A Module For Performing Distributed Sparse Matrix Operations.

Conjugate()

Compute the complex conjugate of a matrix

Dot(matB)

this = dot(this,matB):type matB: Matrix_ps

Parameters:

matB – the matrix to dot.

Dot_c(matB)

this = dot(this,matB):type matB: Matrix_ps

Parameters:

matB – the matrix to dot.

FillDense()

This routine will fill a dense matrix so that every element has a given a value of 1. This is useful as a starting point for further filtering or mapping operations.

FillDistributedPermutation(lb, permuterows=True)

Fill the matrix based on a permutation.:type lb: Permutation

Parameters:
  • lb – the permutation.:type permuterows: boolean, optional

  • permuterows – true if this is a row permutation matrix.

FillFromTripletList(*args)
Overload 1:

Fill in the matrix based on the contents of triplet lists.:type triplet_list: TripletList_r

Parameters:

triplet_list – list of values. Need to be absolute coordinates.


Overload 2:

Fill in the matrix based on the contents of triplet lists.:type triplet_list: TripletList_c

Parameters:

triplet_list – list of values. Need to be absolute coordinates.

FillIdentity()

Fills this matrix as the identity matrix.

Gemm(matA, matB, memory_pool, alpha=1.0, beta=0.0, threshold=0.0)

this := alpha*matA*matB+ beta*this (GEMM):type matA: Matrix_ps

Parameters:
  • matA – first mat.:type matB: Matrix_ps

  • matB – second mat.:type memory_pool: PMatrixMemoryPool

  • memory_pool – memory pool for intermediates.:type alpha: float, optional

  • alpha – scaling factor.:type beta: float, optional

  • beta – scaling factor.:type threshold: float, optional

  • threshold – for flushing small values.

GetActualDimension()

get the actual dimension of the matrix.

GetLogicalDimension()

the logical dimension is scaled so each process has an even slice.

GetMatrixBlock(*args)
Overload 1:

Extract an arbitrary block of a matrix into a triplet list. Block is defined by the row/column start/end values. This is slower than GetTripletList, because communication is required. Data is returned with absolute coordinates. :type triplet_list: TripletList_r

Parameters:
  • triplet_list – the list to fill. :type start_row: int

  • start_row – the starting row for data to store on this process. :type end_row: int

  • end_row – the ending row for data to store on this process. :type start_column: int

  • start_column – the starting col for data to store on this process :type end_column: int

  • end_column – the ending col for data to store on this process


Overload 2:

Extract an arbitrary block of a matrix into a triplet list. Block is defined by the row/column start/end values. This is slower than GetTripletList, because communication is required. Data is returned with absolute coordinates. :type triplet_list: TripletList_c

Parameters:
  • triplet_list – the list to fill. :type start_row: int

  • start_row – the starting row for data to store on this process. :type end_row: int

  • end_row – the ending row for data to store on this process. :type start_column: int

  • start_column – the starting col for data to store on this process :type end_column: int

  • end_column – the ending col for data to store on this process

GetMatrixSlice(submatrix, start_row, end_row, start_column, end_column)

Copy an arbitrary slice from a matrix into a new smaller matrix. NTPoly only works with square matrices, so if the number of rows and columns is different the matrix is resized to the maximum size. :type submatrix: Matrix_ps

Parameters:
  • submatrix – the slice to fill. :type start_row: int

  • start_row – the starting row to include in this matrix. :type end_row: int

  • end_row – the ending row to include in this matrix. :type start_column: int

  • start_column – the starting column to include in this matrix. :type end_column: int

  • end_column – the last column to include in this matrix.

GetSize()

Get the total number of non-zero entries in the matrix

GetTripletList(*args)
Overload 1:

Extracts a triplet list of the data that is stored on this process. Data is returned with absolute coordinates. :type triplet_list: TripletList_r

Parameters:

triplet_list – the list to fill.


Overload 2:

Extracts a triplet list of the data that is stored on this process. Data is returned with absolute coordinates. :type triplet_list: TripletList_c

Parameters:

triplet_list – the list to fill.

Increment(matB, alpha=1.0, threshold=0.0)

this = alpha*MatB + this (AXPY):type matB: Matrix_ps

Parameters:
  • matB – the matrix to add.:type alpha: float, optional

  • alpha – scaling factor.:type threshold: float, optional

  • threshold – for flushing small values.

IsIdentity()

Determine if this is the identity matrix.

Norm()

compute the norm of a matrix.

PairwiseMultiply(matA, matB)

Elementwise multiplication. C_ij = A_ij * B_ij. Also known as a Hadamard:type matA: Matrix_ps

Parameters:
  • matA – first mat.:type matB: Matrix_ps

  • matB – second mat.

Resize(new_size)

Change the size of a matrix. If the new size is smaller, then values outside that range are deleted. IF the new size is bigger, zero padding is applied. Warning: this requires a full data redistribution.

Scale(constant)

scale the matrix by a constatn. constant the value to scale by.

Trace()

compute the trace of a matrix.

Transpose(matA)

Transpose a sparse matrix.

WriteToBinary(file_name)

Write the matrix to a custom binary format.:type file_name: string

Parameters:

file_name – file to write to.

WriteToMatrixMarket(file_name)

Write the matrix to the matrix market format.:type file_name: string

Parameters:

file_name – file to write to.

property thisown

The membership flag

class NTPolySwig.PMatrixMemoryPool(Matrix)

A memory pool datatype that can be reused for matrix matrix multiplication this is to prevent excessive alloc/dealloc.

property thisown

The membership flag

class NTPolySwig.ProcessGrid(*args)

A datatype which stores a process grid and all its communicators.

GetMyColumn()

Get the column of the current process.

GetMyRow()

Get the row of the current process.

GetMySlice()

Get the slice of the current process.

GetNumColumns()

Get the number of columns in this grid.

GetNumRows()

Get the number of rows in this grid.

GetNumSlices()

Get the number of slices in this grid.

WriteInfo()

Write out some basic information about this process grid to the log.

property thisown

The membership flag