SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.vector.doubles.dense.operation
Class CreateVector

java.lang.Object
  extended by com.numericalmethod.suanshu.vector.doubles.dense.operation.CreateVector

public class CreateVector
extends java.lang.Object

CreateVector a new vector from an existing vector. These are the utility functions to create a vector from existing ones.


Method Summary
static Vector concat(Vector... vectors)
          Take an array of vectors and concatenate them into one vector.
static Vector diagonal(Matrix A)
          Take the diagonal of a matrix.
static Vector foreach(Vector vector, UnivariateRealFunction f)
          Produce a new vector in which each entry is the result of applying the function to the corresponding entry of this vector.
static Vector subDiagonal(Matrix A)
          Take the sub-diagonal of a matrix.
static Vector subVector(Vector v, int from, int to)
          Get a sub-vector from a vector v.
static Vector superDiagonal(Matrix A)
          Take the super-diagonal of a matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

concat

public static Vector concat(Vector... vectors)
Take an array of vectors and concatenate them into one vector.

Parameters:
vectors - an array of vector, e.g., [v1, v2, v3, ...]
Returns:
c(v1, v2, v3, ...)

foreach

public static Vector foreach(Vector vector,
                             UnivariateRealFunction f)
Produce a new vector in which each entry is the result of applying the function to the corresponding entry of this vector.

This vector is not changed after this method call.

Parameters:
f - the function f to be applied to each entry of this vector
vector - a vector
Returns:
[ f(vi) ] for all is

subVector

public static Vector subVector(Vector v,
                               int from,
                               int to)
Get a sub-vector from a vector v.

Parameters:
v - the vector
from - the beginning index
to - the ending index
Returns:
v[from : to]

diagonal

public static Vector diagonal(Matrix A)
Take the diagonal of a matrix.

Parameters:
A - a matrix
Returns:
a vector whose entries are Ai

superDiagonal

public static Vector superDiagonal(Matrix A)
Take the super-diagonal of a matrix.

Parameters:
A - a matrix
Returns:
a vector whose entries are Ai,i+1

subDiagonal

public static Vector subDiagonal(Matrix A)
Take the sub-diagonal of a matrix.

Parameters:
A - a matrix
Returns:
a vector whose entries are Ai+1,i

SuanShu, a Java numerical and statistical library

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