Applies Givens rotation to sparse vectors one of which is in compressed form.

@param N The number of elements in vectors X and Y
@param X a sparse vector
@param Y a full-storage vector
@param c a scalar
@param s a scalar
975588
@Override
    public void rot(long N, INDArray X, INDArray Y, double c, double s) {


        if (X instanceof BaseSparseNDArray) {
            BaseSparseNDArray sparseX = (BaseSparseNDArray) X;

            switch (X.data().dataType()) {
                case DOUBLE:
                    droti(N, X, sparseX.getVectorCoordinates(), Y, c, s);
                    break;
                case FLOAT:
                    sroti(N, X, sparseX.getVectorCoordinates(), Y, c, s);
                    break;
                case HALF:
                    hroti(N, X, sparseX.getVectorCoordinates(), Y, c, s);
                    break;
                default:
                    throw new UnsupportedOperationException();
            }
        } else {
            throw new UnsupportedOperationException();
        }
    }
864754
public static void permutationVector( DMatrixSparseCSC P , int[] vector) {
        if( P.numCols != P.numRows ) {
            throw new MatrixDimensionException("Expected a square matrix");
        } else if( P.nz_length != P.numCols ) {
            throw new IllegalArgumentException("Expected N non-zero elements in permutation matrix");
        } else if( vector.length < P.numCols ) {
            throw new IllegalArgumentException("vector is too short");
        }

        int M = P.numCols;

        for (int i = 0; i < M; i++) {
            if( P.col_idx[i+1] != i+1 )
                throw new IllegalArgumentException("Unexpected number of elements in a column");

            vector[P.nz_rows[i]] = i;
        }
    }
292230
public void rotateByAxis(float angle, float x, float y, float z) {
        getTransform().rotateByAxis(angle, x, y, z);
        if (mTransformCache.rotateByAxis(angle, x, y, z)) {
            onTransformChanged();
        }
    }
1164752
public static SparseMatrix block(Matrix a, Matrix b, Matrix c, Matrix d) {
        return CRSMatrix.block(a, b, c, d);
    }
784875
@Override
  public void write (final int c)
  {
    final int nNewCount = m_nCount + 1;
    if (nNewCount > m_aBuf.length)
      m_aBuf = Arrays.copyOf (m_aBuf, Math.max (m_aBuf.length << 1, nNewCount));
    m_aBuf[m_nCount] = (char) c;
    m_nCount = nNewCount;
  }
274681
public static int cusparseScsrmv(
        cusparseHandle handle, 
        int transA, 
        int m, 
        int n, 
        int nnz, 
        Pointer alpha, 
        cusparseMatDescr descrA, 
        Pointer csrSortedValA, 
        Pointer csrSortedRowPtrA, 
        Pointer csrSortedColIndA, 
        Pointer x, 
        Pointer beta, 
        Pointer y)
    {
        return checkResult(cusparseScsrmvNative(handle, transA, m, n, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, x, beta, y));
    }
117951
@Override
    public void rot90(INDArray toRotate) {
        if (!toRotate.isMatrix())
            throw new IllegalArgumentException("Only rotating matrices");

        INDArray start = toRotate.transpose();
        for (int i = 0; i < start.rows(); i++)
            start.putRow(i, reverse(start.getRow(i)));

    }
176171
public static void zeroTriangle( boolean upper , DMatrixRBlock A )
    {
        int blockLength = A.blockLength;

        if( upper ) {
            for( int i = 0; i < A.numRows; i += blockLength ) {
                int h = Math.min(blockLength,A.numRows-i);

                for( int j = i; j < A.numCols; j += blockLength ) {
                    int w = Math.min(blockLength,A.numCols-j);

                    int index = i*A.numCols + h*j;

                    if( j == i ) {
                        for( int k = 0; k < h; k++ ) {
                            for( int l = k+1; l < w; l++ ) {
                                A.data[index + w*k+l ] = 0;
                            }
                        }
                    } else {
                        for( int k = 0; k < h; k++ ) {
                            for( int l = 0; l < w; l++ ) {
                                A.data[index + w*k+l ] = 0;
                            }
                        }
                    }
                }
            }
        } else {
            for( int i = 0; i < A.numRows; i += blockLength ) {
                int h = Math.min(blockLength,A.numRows-i);

                for( int j = 0; j <= i; j += blockLength ) {
                    int w = Math.min(blockLength,A.numCols-j);

                    int index = i*A.numCols + h*j;

                    if( j == i ) {
                        for( int k = 0; k < h; k++ ) {
                            int z = Math.min(k,w);
                            for( int l = 0; l < z; l++ ) {
                                A.data[index + w*k+l ] = 0;
                            }
                        }
                    } else {
                        for( int k = 0; k < h; k++ ) {
                            for( int l = 0; l < w; l++ ) {
                                A.data[index + w*k+l ] = 0;
                            }
                        }
                    }
                }
            }
        }
    }
263582
public static long access2d(DMatrixRMaj a , DMatrixRMaj b , DMatrixRMaj c )
    {
        long timeBefore = System.currentTimeMillis();

        for( int i = 0; i < a.numRows; i++ ) {

            for( int j = 0; j < b.numCols; j++ ) {
                c.set(i,j,a.get(i,0)*b.get(0,j));
            }

            for( int k = 1; k < b.numRows; k++ ) {
                for( int j = 0; j < b.numCols; j++ ) {
//                    c.set(i,j, c.get(i,j) + a.get(i,k)*b.get(k,j));
                    c.data[i*b.numCols+j] +=a.get(i,k)*b.get(k,j);
                }
            }
        }

        return System.currentTimeMillis() - timeBefore;
    }
706044
public static double rotatedWidth( double width , double c , double s )
	{
		return Math.abs(c)*width + Math.abs(s)*width;
	}
796806
public static void divRow(Matrix A, int i, double c)
    {
        divRow(A, i, 0, A.cols(), c);
    }
116220
void initialize(DMatrixSparseCSC A) {
        m = A.numRows;
        n = A.numCols;
        int s = 4*n + (ata ? (n+m+1) : 0);

        gw.reshape(s);
        w = gw.data;

        // compute the transpose of A
        At.reshape(A.numCols,A.numRows,A.nz_length);
        CommonOps_DSCC.transpose(A,At,gw);

        // initialize w
        Arrays.fill(w,0,s,-1); // assign all values in workspace to -1

        ancestor = 0;
        maxfirst = n;
        prevleaf = 2*n;
        first    = 3*n;
    }
311030
public static <T extends SparseDoubleVector> SparseMatrix asSparseMatrix(
            List<T> vectors, int columns) {
        return new SparseListMatrix<T>(vectors, columns);
    }
927251
private static void rotate(final Vector v, final int a, final int b, final int shift) {
		final int size = b - a;
		final int r = size - shift;
		final int g = gcd(size, r);
		for (int i = 0; i < g; i++) {
			int to = i;
			final Object tmp = v.elementAt(a + to);
			for (int from = (to + r) % size; from != i; from = (to + r) % size) {
				v.setElementAt(v.elementAt(a + from), a + to);
				to = from;
			}
			v.setElementAt(tmp, a + to);
		}
	}
648759
public static int cusparseSroti(
        cusparseHandle handle, 
        int nnz, 
        Pointer xVal, 
        Pointer xInd, 
        Pointer y, 
        Pointer c, 
        Pointer s, 
        int idxBase)
    {
        return checkResult(cusparseSrotiNative(handle, nnz, xVal, xInd, y, c, s, idxBase));
    }
417554
public static Scsd cs_dalloc(int m, int n) {
        Scsd S;
        S = new Scsd();
        S.p = new int[m];
        S.r = new int[m + 6];
        S.q = new int[n];
        S.s = new int[n + 6];
        S.cc = new int[5];
        S.rr = new int[5];
        return S;
    }
316337
protected static double subtractedMagnitudeSqrd(DoubleVector c,
                                                   DoubleVector v) {
        if (v instanceof SparseDoubleVector) {
            SparseDoubleVector sv = (SparseDoubleVector) v;
            int[] nonZeros = sv.getNonZeroIndices();

            double magnitude = Math.pow(c.magnitude(), 2);
            for (int i : nonZeros) {
                double value = c.get(i);
                magnitude -= Math.pow(value, 2);
                magnitude += Math.pow(value - v.get(i), 2);
            }
            return magnitude;
        } else {
            double magnitude = 0;
            for (int i = 0; i < c.length(); ++i)
                magnitude += Math.pow(c.get(i) - v.get(i), 2);
            return magnitude;
        }
    }