congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
MLUInt8
Code IndexAdd Tabnine 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)

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

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • addToBackStack (FragmentTransaction)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Path (java.nio.file)
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Runner (org.openjdk.jmh.runner)
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now