mpi.fruitfly.math.datastructures
Class FloatArrayND

java.lang.Object
  extended by mpi.fruitfly.math.datastructures.FloatArray
      extended by mpi.fruitfly.math.datastructures.FloatArrayND

public class FloatArrayND
extends FloatArray

Title: N-Dimensional Array Access

Description: This class creates an N-dimensional float array as 1-dimensional array and provides addressing for arbitrary position. Be careful, there is no checking for valid inputs at all!

Copyright: Copyright (c) 2007

Company: MPI-CBG Dresden/Germany

* Permission to use, copy, modify and distribute this version of this software or any parts of it and its documentation or any parts of it ("the software"), for any purpose is hereby granted, provided that the above copyright notice and this permission notice appear intact in all copies of the software and that you do not sell the software, or include the software in a commercial package. The release of this software into the public domain does not imply any obligation on the part of the author to release future versions into the public domain. The author is free to make upgraded or improved versions of the software available for a fee or commercially only. Commercial licensing of the software is available by contacting the author. THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.


Field Summary
 
Fields inherited from class mpi.fruitfly.math.datastructures.FloatArray
data
 
Constructor Summary
FloatArrayND(int[] n)
          Create N-dimensional float array
 
Method Summary
 FloatArrayND clone()
           
 float get(int[] i)
          Return the value for a given positions in the nth-dimension
 int getPos(int[] i)
          Return the position in a 1-dimensional array for a given positions in the nth-dimension
 void set(float value, int[] i)
          Sets the value for a given positions in the n-dimensional array
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FloatArrayND

public FloatArrayND(int[] n)
Create N-dimensional float array

Parameters:
n - - The entries are the sizes in each dimension
Method Detail

clone

public FloatArrayND clone()
Specified by:
clone in class FloatArray

getPos

public final int getPos(int[] i)
Return the position in a 1-dimensional array for a given positions in the nth-dimension

Parameters:
i - - The entries are the positions in each dimension
Returns:
the position in a 1-dimensional array

get

public final float get(int[] i)
Return the value for a given positions in the nth-dimension

Parameters:
i - - The entries are the positions in each dimension
Returns:
the value for given position

set

public final void set(float value,
                      int[] i)
Sets the value for a given positions in the n-dimensional array

Parameters:
i - - The entries are the positions in each dimension