edu.iastate.metnet.analysis
Class MySolver

java.lang.Object
  extended by edu.iastate.metnet.analysis.MySolver

public class MySolver
extends java.lang.Object

linear equation solver
this class solve the problem AX = B in which A, X, B are matrices A and B are type of java.util.List

Author:
Jie Li

Field Summary
(package private) static org.apache.log4j.Logger logger
          log4j faqcility
(package private) static MySolver solver
          singleton pattern
 
Method Summary
 java.lang.String constructMatrix(float[][] fs)
          for a matrix, construct the string like "[1 3 5; 2 5 1; 2 3 8]"; notice that the parser of the scipy is very picky and we must follow the format without additional blank or semicolon
 java.lang.String constructMatrix(java.util.List list)
          for a matrix, construct the string like "[1 3 5; 2 5 1; 2 3 8]"; notice that the parser of the scipy is very picky and we must follow the format without additional blank or semicolon
 java.lang.String constructRowVector(java.util.List list)
          cnstruct the representation of one row of the matrix
 java.lang.String constructVector(float[] fs)
          for a vector, construct the string like "[10;8;3]";
 java.lang.String constructVector(java.util.List list)
          for a vector, construct the string like "[10;8;3]";
static MySolver getInstance()
           
 boolean isCompatible(float[][] a, float[] b)
          check if the a and b has compatible dimension since a is a squar matrix, a.length == b.length and each line of a should has same length
 boolean isCompatible(java.util.List a, java.util.List b)
          check if the a and b has compatible dimension since a is a squar matrix, a.length == b.length and each line of a should has same length
 float[] solve(float[][] a, float[] b)
           
 java.util.List solve(java.util.List a, java.util.List b)
          solve the linear equation
 java.util.List toFloatList(float[] fs)
           
 java.util.List toFloatList(float[][] fs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
log4j faqcility


solver

static MySolver solver
singleton pattern

Method Detail

getInstance

public static MySolver getInstance()

solve

public java.util.List solve(java.util.List a,
                            java.util.List b)
solve the linear equation

Parameters:
a - the matrix
b - the vector
Returns:
the result vector

solve

public float[] solve(float[][] a,
                     float[] b)

constructVector

public java.lang.String constructVector(java.util.List list)
for a vector, construct the string like "[10;8;3]";

Parameters:
list - the vector
Returns:
the string representation of the vector

constructVector

public java.lang.String constructVector(float[] fs)
for a vector, construct the string like "[10;8;3]";

Parameters:
fs - the vector
Returns:
the string representation of the vector

constructRowVector

public java.lang.String constructRowVector(java.util.List list)
cnstruct the representation of one row of the matrix

Parameters:
list - the row of the matrix
Returns:
the string representation of that row

constructMatrix

public java.lang.String constructMatrix(java.util.List list)
for a matrix, construct the string like "[1 3 5; 2 5 1; 2 3 8]"; notice that the parser of the scipy is very picky and we must follow the format without additional blank or semicolon

Parameters:
list - the matrix
Returns:
the string representation of the matrix

toFloatList

public java.util.List toFloatList(float[] fs)

toFloatList

public java.util.List toFloatList(float[][] fs)

constructMatrix

public java.lang.String constructMatrix(float[][] fs)
for a matrix, construct the string like "[1 3 5; 2 5 1; 2 3 8]"; notice that the parser of the scipy is very picky and we must follow the format without additional blank or semicolon

Parameters:
fs - the matrix
Returns:
the string representation of the matrix

isCompatible

public boolean isCompatible(java.util.List a,
                            java.util.List b)
check if the a and b has compatible dimension since a is a squar matrix, a.length == b.length and each line of a should has same length

Parameters:
a - the matrix or list of list
b - the vector
Returns:
true if compatible, false if not

isCompatible

public boolean isCompatible(float[][] a,
                            float[] b)
check if the a and b has compatible dimension since a is a squar matrix, a.length == b.length and each line of a should has same length

Parameters:
a - the matrix or list of list
b - the vector
Returns:
true if compatible, false if not