Codota Logo
MLUInt8
Code IndexAdd Codota to your IDE (free)

How to use
MLUInt8
in
com.jmatio.types

Best Java code snippets using com.jmatio.types.MLUInt8 (Showing top 20 results out of 315)

  • Common ways to obtain MLUInt8
private void myMethod () {
MLUInt8 m =
  • Codota IconString name;new MLUInt8(name, dims, type, attributes)
  • Smart code suggestions by Codota
}
origin: com.diffplug.matsim/matfilerw

/**
 * <a href="http://math.nist.gov/javanumerics/jama/">Jama</a> [math.nist.gov] style: 
 * construct a 2D real matrix from <code>byte[][]</code>
 * 
 * Note: array is converted to Byte[]
 * 
 * @param name - array name
 * @param vals - two-dimensional array of values
 */
public MLUInt8(String name, byte[][] vals) {
  this(name, byte2DToByte(vals), vals.length);
}
origin: diffplug/matfilerw

/**
 * <a href="http://math.nist.gov/javanumerics/jama/">Jama</a> [math.nist.gov] style: 
 * construct a matrix from a one-dimensional packed array
 * 
 * @param name - array name
 * @param vals - One-dimensional array of doubles, packed by columns (ala Fortran).
 * @param m - Number of rows
 */
public MLUInt8(String name, byte[] vals, int m) {
  this(name, castToByte(vals), m);
}
origin: com.diffplug.matsim/matfilerw

public Byte buldFromBytes(byte[] bytes) {
  if (bytes.length != getBytesAllocated()) {
    throw new IllegalArgumentException(
        "To build from byte array I need array of size: "
            + getBytesAllocated());
  }
  return bytes[0];
}
origin: com.diffplug.matsim/matfilerw

/**
 * Gets two-dimensional real array.
 * 
 * @return - 2D real array
 */
public byte[][] getArray() {
  byte[][] result = new byte[getM()][];
  for (int m = 0; m < getM(); m++) {
    result[m] = new byte[getN()];
    for (int n = 0; n < getN(); n++) {
      result[m][n] = get(m, n);
    }
  }
  return result;
}
origin: it.geosolutions.imageio-ext/imageio-ext-jmatio

/**
 * Gets two-dimensional real array.
 * 
 * @return - 2D real array
 */
public byte[][] getArray()
{
  final int M = getM();
  final int N = getN();
  byte[][] result = new byte[M][];
  
  for ( int m = 0; m < M; m++ )
  {
    result[m] = new byte[N];
    for ( int n = 0; n < N; n++ )
    {               
      result[m][n] = getReal(m,n);
    }
  }
  return result;
}
/**
origin: org.tallison/jmatio

mlArray = new MLUInt8(name, dims, type, attributes);
    if (content.getRealByteBuffer() != null) {
          new ByteBufferInputStream(content.getRealByteBuffer(),
              content.getRealByteBuffer().limit()))) {
        Object o = ois.readObject();
        mlArray = new MLJavaObject(arrName, className, o);
origin: diffplug/matfilerw

@Test
public void testBenchmarkUInt8() throws Exception {
  final String fileName = "bigbyte.mat";
  final String name = "bigbyte";
  final int SIZE = 1024;
  MLUInt8 mluint8 = new MLUInt8(name, new int[]{SIZE, SIZE});
  // write array to file
  ArrayList<MLArray> list = new ArrayList<MLArray>();
  list.add(mluint8);
  // write arrays to file
  new MatFileWriter(getTempFile(fileName), list);
  // read array form file
  MatFileReader mfr = new MatFileReader(getTempFile(fileName));
  MLArray mlArrayRetrived = mfr.getMLArray(name);
  for (int i = 0; i < mlArrayRetrived.getSize(); i++) {
    ((MLNumericArray<?>) mlArrayRetrived).get(i);
  }
  // test if MLArray objects are equal
  assertEquals("Test if value red from file equals value stored", mluint8, mlArrayRetrived);
}
origin: diffplug/matfilerw

MLUInt8 mluint8 = new MLUInt8(name, src, 3);
  boolean result = Arrays.equals(src2D[i], ((MLUInt8) mlArrayRetrived).getArray()[i]);
  assertEquals("2D array match", true, result);
MLArray mlMLUInt82D = new MLUInt8(name, src2D);
origin: com.diffplug.matsim/matfilerw

private static void parseMCOS(MLUInt8 mcosData, Set<MLObjectPlaceholder> mcosPlaceholders) throws IOException {
  ByteBuffer buffer = mcosData.getRealByteBuffer();
  ByteBufferInputStream dataStream = new ByteBufferInputStream(buffer, buffer.limit());
  Map<String, MLArray> mcosContent = matFile.getContent();
  MLCell mcosInfo = (MLCell) ((MLStructure) mcosContent.get("@0")).getField("MCOS");
  ByteBuffer mcosDataBuf = ((MLUInt8) mcosInfo.get(0)).getRealByteBuffer();
origin: diffplug/matfilerw

@Test
public void testUInt8() throws Exception {
  String fileName = "uint8.mat";
  String arrName = "arr";
  MatFileReader mfr;
  MLArray src;
  // read array form file
  mfr = new MatFileReader(getTestFile(fileName));
  assertEquals("Test min. value from file:" + fileName + " array: " + arrName, (byte) 0,
      (byte) ((MLUInt8) mfr.getMLArray(arrName)).get(0, 0), 0.001);
  assertEquals("Test max. value from file:" + fileName + " array: " + arrName, (byte) 255,
      (byte) ((MLUInt8) mfr.getMLArray(arrName)).get(0, 1), 0.001);
  src = mfr.getMLArray(arrName);
  // write
  fileName = "uint8out.mat";
  ArrayList<MLArray> towrite = new ArrayList<MLArray>();
  towrite.add(mfr.getMLArray(arrName));
  new MatFileWriter(getTempFile(fileName), towrite);
  // read again
  mfr = new MatFileReader(getTempFile(fileName));
  assertEquals("Test min. value from file:" + fileName + " array: " + arrName, (byte) 0,
      (byte) ((MLUInt8) mfr.getMLArray(arrName)).get(0, 0), 0.001);
  assertEquals("Test max. value from file:" + fileName + " array: " + arrName, (byte) 255,
      (byte) ((MLUInt8) mfr.getMLArray(arrName)).get(0, 1), 0.001);
  assertEquals("Test if array retrieved from " + fileName + " equals source array", src, mfr.getMLArray(arrName));
}
origin: org.tallison/jmatio

/**
 * Gets two-dimensional real array.
 * 
 * @return - 2D real array
 */
public byte[][] getArray()
{
  byte[][] result = new byte[getM()][];
  
  for ( int m = 0; m < getM(); m++ )
  {
    result[m] = new byte[ getN() ];
    for ( int n = 0; n < getN(); n++ )
    {               
      result[m][n] = getReal(m,n);
    }
  }
  return result;
}
/**
origin: diffplug/matfilerw

/**
 * Gets two-dimensional real array.
 * 
 * @return - 2D real array
 */
public byte[][] getArray() {
  byte[][] result = new byte[getM()][];
  for (int m = 0; m < getM(); m++) {
    result[m] = new byte[getN()];
    for (int n = 0; n < getN(); n++) {
      result[m][n] = get(m, n);
    }
  }
  return result;
}
origin: gradusnikov/jmatio

mlArray = new MLUInt8(name, dims, type, attributes);
      new ByteBufferInputStream( content.getRealByteBuffer(), 
                    content.getRealByteBuffer().limit()  ) );
  try
origin: com.diffplug.matsim/matfilerw

mlArray = new MLUInt8(name, dims, type, attributes);
origin: diffplug/matfilerw

private static void parseMCOS(MLUInt8 mcosData, Set<MLObjectPlaceholder> mcosPlaceholders) throws IOException {
  ByteBuffer buffer = mcosData.getRealByteBuffer();
  ByteBufferInputStream dataStream = new ByteBufferInputStream(buffer, buffer.limit());
  Map<String, MLArray> mcosContent = matFile.getContent();
  MLCell mcosInfo = (MLCell) ((MLStructure) mcosContent.get("@0")).getField("MCOS");
  ByteBuffer mcosDataBuf = ((MLUInt8) mcosInfo.get(0)).getRealByteBuffer();
origin: gradusnikov/jmatio

/**
 * Gets two-dimensional real array.
 * 
 * @return - 2D real array
 */
public byte[][] getArray()
{
  byte[][] result = new byte[getM()][];
  
  for ( int m = 0; m < getM(); m++ )
  {
    result[m] = new byte[ getN() ];
    for ( int n = 0; n < getN(); n++ )
    {               
      result[m][n] = getReal(m,n);
    }
  }
  return result;
}
/**
origin: diffplug/matfilerw

mlArray = new MLUInt8(name, dims, type, attributes);
origin: diffplug/matfilerw

/**
 * <a href="http://math.nist.gov/javanumerics/jama/">Jama</a> [math.nist.gov] style: 
 * construct a 2D real matrix from <code>byte[][]</code>
 * 
 * Note: array is converted to Byte[]
 * 
 * @param name - array name
 * @param vals - two-dimensional array of values
 */
public MLUInt8(String name, byte[][] vals) {
  this(name, byte2DToByte(vals), vals.length);
}
origin: org.tallison/jmatio

/**
 * <a href="http://math.nist.gov/javanumerics/jama/">Jama</a> [math.nist.gov] style: 
 * construct a matrix from a one-dimensional packed array
 * 
 * @param name - array name
 * @param vals - One-dimensional array of doubles, packed by columns (ala Fortran).
 * @param m - Number of rows
 */
public MLUInt8(String name, byte[] vals, int m)
{
  this(name, castToByte( vals ), m );
}
/* (non-Javadoc)
origin: org.tallison/jmatio

public Byte buldFromBytes(byte[] bytes)
{
  if ( bytes.length != getBytesAllocated() )
  {
    throw new IllegalArgumentException( 
          "To build from byte array I need array of size: " 
              + getBytesAllocated() );
  }
  return bytes[0];
}
public byte[] getByteArray(Byte value)
com.jmatio.typesMLUInt8

Javadoc

Class represents UInt8 (byte) array (matrix)

Most used methods

  • <init>
    Jama [http://math.nist.gov/javanumerics/jama/] [math.nist.gov] style: construct a 2D real matrix fro
  • byte2DToByte
    Converts byte[][] to Byte[]
  • castToByte
    Casts Double[] to byte[]
  • getBytesAllocated
  • getM
  • getN
  • getRealByteBuffer
  • get
    Override to accelerate the performance
  • getReal
  • getArray
    Gets two-dimensional real array.

Popular in Java

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • startActivity (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now