Package org.renjin.primitives.matrix

Source Code of org.renjin.primitives.matrix.TransposingMatrixTest

package org.renjin.primitives.matrix;

import org.junit.Test;
import org.renjin.primitives.sequence.DoubleSequence;
import org.renjin.sexp.AttributeMap;
import org.renjin.sexp.DoubleVector;
import org.renjin.sexp.IntArrayVector;
import org.renjin.sexp.Symbols;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;


public class TransposingMatrixTest {

@Test
  public void transposed() {
    DoubleVector x = new DoubleSequence(1,1,12);
    x = (DoubleVector)x.setAttribute(Symbols.DIM, new IntArrayVector(4,3));

    DoubleVector y = new TransposingMatrix(x, AttributeMap.dim(3, 4));
    assertThat(y.getElementAsDouble(9), equalTo(4d));
    assertThat(y.getElementAsDouble(4), equalTo(6d));
  }
}
TOP

Related Classes of org.renjin.primitives.matrix.TransposingMatrixTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.