SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.matrix.doubles.operation
Class Pow

java.lang.Object
  extended by com.numericalmethod.suanshu.matrix.doubles.matrixtype.MatrixMathImpl<T>
      extended by com.numericalmethod.suanshu.matrix.doubles.matrixtype.MatrixStorageImpl<DenseMatrix>
          extended by com.numericalmethod.suanshu.matrix.doubles.matrixtype.dense.DenseMatrix
              extended by com.numericalmethod.suanshu.matrix.doubles.operation.Pow
All Implemented Interfaces:
DeepCopyable, AbelianGroup<Matrix>, Monoid<Matrix>, Ring<Matrix>, Matrix, MatrixAccessor, MatrixRing, Densifiable, MatrixDimension

public class Pow
extends DenseMatrix

This computes a square DenseMatrix A to the power of integer n, An.

To avoid overflow of double precision, we represent the result as a product of

 An = basescale * B;
 
E.g.,
 An = 1e100scale * B = 10100 * scale * B
 

All entries in B can be represented in double precision.


Field Summary
 Matrix B
          a double precision matrix
 double base
          the radix or base refers to the number b in an expression of the form bn
 int scale
          the exponent
 
Constructor Summary
Pow(Matrix A, int exponent)
          Construct the matrix Aexponent so that Aexponent = (1e100)scale * B
Pow(Matrix A, int exponent, double base)
          Construct the matrix Aexponent so that Aexponent = basescale * B
 
Method Summary
 
Methods inherited from class com.numericalmethod.suanshu.matrix.doubles.matrixtype.dense.DenseMatrix
add, deepCopy, getColumn, getColumn, getMatrixData, getRow, getRow, getSample, minus, multiply, multiply, ONE, overwrite, scaled, t, toDense, ZERO
 
Methods inherited from class com.numericalmethod.suanshu.matrix.doubles.matrixtype.MatrixStorageImpl
equals, get, hashCode, set, setMatrixData
 
Methods inherited from class com.numericalmethod.suanshu.matrix.doubles.matrixtype.MatrixMathImpl
add, call, minus, multiply, nCols, nRows, opposite, setColumn, setColumn, setRow, setRow, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

base

public final double base
the radix or base refers to the number b in an expression of the form bn

See Also:
Wikipedia: Radix

scale

public final int scale
the exponent


B

public final Matrix B
a double precision matrix

Constructor Detail

Pow

public Pow(Matrix A,
           int exponent,
           double base)
Construct the matrix Aexponent so that
Aexponent = basescale * B

Parameters:
A - a matrix
exponent - a positive integer exponent
base - the base to scale down the product to avoid overflow

Pow

public Pow(Matrix A,
           int exponent)
Construct the matrix Aexponent so that
Aexponent = (1e100)scale * B

Parameters:
A - a matrix
exponent - a positive integer exponent

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.