JavaView© v3.95.000

jvx.numeric
Class PnSparseMatrix

java.lang.Object
  extended byjv.object.PsObject
      extended byjvx.numeric.PnSparseMatrix
All Implemented Interfaces:
java.lang.Cloneable, PsUpdateIf, java.io.Serializable
Direct Known Subclasses:
PnStiffMatrix

public class PnSparseMatrix
extends PsObject

Sparse matrix representation.

Class was extracted from earlier code in jvx.numeric.PnStiffMatrix.

See Also:
Serialized Form

Field Summary
 int m_nop
          Dimension of full matrix.
 PiVector[] m_sindx
          For each row of the full matrix exists an array listing the column position of each non-zero entry.
 PiVector m_snoe
          Count number of entries in each line of the sparse matrix, i.e. count number of connected edges and add 1 for itself (the diagonal entry).
 PdVector[] m_stiff
          For each row of the full matrix exists an array listing the non-zero values.
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
 
Constructor Summary
PnSparseMatrix()
           
 
Method Summary
static PdVector diagonalSolve(PnSparseMatrix smat, PdVector x, PdVector b, int dim)
          Solve equation smat*x=b assuming that smat is diagonal matrix.
 int getIndex(int aLine, int anIndex)
          For given component s[aLine][anIndex] of the full matrix s this method finds the position in the index vector m_sindx[aLine] of the row aLine which refers to the full matrix component.
static PdVector leftMult(PnSparseMatrix smat, PdVector in, PdVector out)
          Compute out=smat*in.
static PdVector leftMult(PnSparseMatrix smat, PdVector in, PdVector out, int dim)
          Compute out=smat*in.
static void multScalar(PnSparseMatrix smat, double d)
          Multiply all entries of matrix with given factor.
static PdVector rightMult(PnSparseMatrix smat, PdVector in, PdVector out)
          Compute out=in*smat.
static PdVector rightMult(PnSparseMatrix smat, PdVector in, PdVector out, int dim)
          Compute out=in*smat.
 java.lang.String toString()
          Create a full matrix and print all components in a multi-line string representation.
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, init, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, update, updatePanels
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_nop

public int m_nop
Dimension of full matrix.


m_snoe

public PiVector m_snoe
Count number of entries in each line of the sparse matrix, i.e. count number of connected edges and add 1 for itself (the diagonal entry).


m_sindx

public PiVector[] m_sindx
For each row of the full matrix exists an array listing the column position of each non-zero entry.

See Also:
m_stiff

m_stiff

public PdVector[] m_stiff
For each row of the full matrix exists an array listing the non-zero values. The instance variable m_sindx has stored the column index. Therefore, the double component s[i][j] of the full matrix is stored in m_stiff[i][_j] if m_sindx[i][_j] == j.

See Also:
m_sindx
Constructor Detail

PnSparseMatrix

public PnSparseMatrix()
Method Detail

getIndex

public int getIndex(int aLine,
                    int anIndex)
For given component s[aLine][anIndex] of the full matrix s this method finds the position in the index vector m_sindx[aLine] of the row aLine which refers to the full matrix component. If position is not found, then the component is added to the index vector by appending the value anIndex.

This method is the central method for handling the sparse matrix representation.


toString

public java.lang.String toString()
Create a full matrix and print all components in a multi-line string representation.

Overrides:
toString in class PsObject

leftMult

public static PdVector leftMult(PnSparseMatrix smat,
                                PdVector in,
                                PdVector out,
                                int dim)
Compute out=smat*in. The arrays in and out must have length = dim*(dim of smat). The array in usually contains the position of vertices, listing all coordinates of one vertex before the next. Setting dim = dim of vertices allows to multiply each coordinate of the vertices with smat. If the vector out is null, a new vector is created.


leftMult

public static PdVector leftMult(PnSparseMatrix smat,
                                PdVector in,
                                PdVector out)
Compute out=smat*in. If the vector out is null, a new vector is created.


rightMult

public static PdVector rightMult(PnSparseMatrix smat,
                                 PdVector in,
                                 PdVector out,
                                 int dim)
Compute out=in*smat. The arrays in and out must have length >= dim*(dim of smat). The array in usually contains the position of vertices, listing all coordinates of one vertex before the next. Setting dim equal to dim of vertices allows to multiply each coordinate of the vertices with smat. If the vector out is null, a new vector is created.


rightMult

public static PdVector rightMult(PnSparseMatrix smat,
                                 PdVector in,
                                 PdVector out)
Compute out=in*smat. If the vector out is null, a new vector is created.


diagonalSolve

public static PdVector diagonalSolve(PnSparseMatrix smat,
                                     PdVector x,
                                     PdVector b,
                                     int dim)
Solve equation smat*x=b assuming that smat is diagonal matrix.


multScalar

public static void multScalar(PnSparseMatrix smat,
                              double d)
Multiply all entries of matrix with given factor.


JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.