B = -A.   Changes the sign of elements in A and stores it in B. A and B can be the same instance.

@param A (Input) Matrix. Not modified.
@param B (Output) Matrix. Modified.
490574
public static void changeSign(DMatrixSparseCSC A , DMatrixSparseCSC B ) {
        if( A != B ) {
            B.copyStructure(A);
        }

        for (int i = 0; i < A.nz_length; i++) {
            B.nz_values[i] = -A.nz_values[i];
        }
    }
1352111
public static void changeSign( DMatrix2x2 a )
    {
        a.a11 = -a.a11; a.a12 = -a.a12;
        a.a21 = -a.a21; a.a22 = -a.a22;
    }
1369305
protected void init(DMatrixRMaj A ) {
        UBV = A;

        m = UBV.numRows;
        n = UBV.numCols;

        min = Math.min(m,n);
        int max = Math.max(m,n);

        if( b.length < max+1 ) {
            b = new double[ max+1 ];
            u = new double[ max+1 ];
        }
        if( gammasU.length < m ) {
            gammasU = new double[ m ];
        }
        if( gammasV.length < n ) {
            gammasV = new double[ n ];
        }
    }
956647
@Override
    public Matrix applyCommon(Matrix a, Matrix b) {
        int n = a.rows() * b.rows();
        int m = a.columns() * b.columns();
        int p = b.rows();
        int q = b.columns();

        Matrix result = a.blankOfShape(n, m);

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                result.set(i, j, a.get(i / p, j / q) * b.get(i % p, j % q));
            }
        }

        return result;
    }
267032
public static boolean sameDimensions(Matrix A, Matrix B)
    {
        return A.rows() == B.rows() && A.cols() == B.cols();
    }
851509
public static void elementPower(double a , DMatrixD1 B , DMatrixD1 C ) {

        if( B.numRows != C.numRows || B.numCols != C.numCols ) {
            throw new MatrixDimensionException("All matrices must be the same shape");
        }

        int size = B.getNumElements();
        for( int i = 0; i < size; i++ ) {
            C.data[i] = Math.pow(a, B.data[i]);
        }
    }
943969
public static void checkIdenticalShape(DMatrixRBlock A , DMatrixRBlock B ) {
        if( A.blockLength != B.blockLength )
            throw new IllegalArgumentException("Block size is different");
        if( A.numRows != B.numRows )
            throw new IllegalArgumentException("Number of rows is different");
        if( A.numCols != B.numCols )
            throw new IllegalArgumentException("NUmber of columns is different");
    }
250346
public void swap( Element<T> a , Element<T> b ) {
		if (a.next == b) {
			if( a.previous != null ) {
				a.previous.next = b;
			}
			if( b.next != null ) {
				b.next.previous = a;
			}
			Element<T> tmp = a.previous;
			a.previous = b;
			a.next = b.next;
			b.previous = tmp;
			b.next = a;
			if( first == a )
				first = b;
			if( last == b )
				last = a;
		} else if (a.previous == b) {
			if( a.next != null ) {
				a.next.previous = b;
			}
			if( b.previous != null ) {
				b.previous.next = a;
			}
			Element<T> tmp = a.next;
			a.next = b;
			a.previous = b.previous;
			b.previous = a;
			b.next = tmp;

			if( first == b )
				first = a;
			if( last == a )
				last = b;
		} else {
			if (a.next != null) {
				a.next.previous = b;
			}
			if (a.previous != null) {
				a.previous.next = b;
			}
			if (b.next != null) {
				b.next.previous = a;
			}
			if (b.previous != null) {
				b.previous.next = a;
			}
			Element<T> tempNext = b.next;
			Element<T> tempPrev = b.previous;
			b.next = a.next;
			b.previous = a.previous;
			a.next = tempNext;
			a.previous = tempPrev;

			if (a.next == null)
				last = a;
			else if (b.next == null)
				last = b;
			if (a.previous == null)
				first = a;
			else if (b.previous == null)
				first = b;
		}
	}
1061036
public static void elementDiv( DMatrix4 a , DMatrix4 b) {
        a.a1 /= b.a1;
        a.a2 /= b.a2;
        a.a3 /= b.a3;
        a.a4 /= b.a4;
    }
215125
public static void addEquals( DMatrix4x4 a , DMatrix4x4 b ) {
        a.a11 += b.a11;
        a.a12 += b.a12;
        a.a13 += b.a13;
        a.a14 += b.a14;
        a.a21 += b.a21;
        a.a22 += b.a22;
        a.a23 += b.a23;
        a.a24 += b.a24;
        a.a31 += b.a31;
        a.a32 += b.a32;
        a.a33 += b.a33;
        a.a34 += b.a34;
        a.a41 += b.a41;
        a.a42 += b.a42;
        a.a43 += b.a43;
        a.a44 += b.a44;
    }
664465
public static boolean equal(byte[] a, byte[] b) {
       if (a == b)
          return (true);
       if ((a == null) || (b == null))
          return (false);
       if (a.length != b.length)
          return (false);
       for (int i = 0; i < a.length; i++)
          if (a[i] != b[i])
             return (false);
       return (true);
    }
555209
public static void changeSign( DMatrix5x5 a )
    {
        a.a11 = -a.a11; a.a12 = -a.a12; a.a13 = -a.a13; a.a14 = -a.a14; a.a15 = -a.a15;
        a.a21 = -a.a21; a.a22 = -a.a22; a.a23 = -a.a23; a.a24 = -a.a24; a.a25 = -a.a25;
        a.a31 = -a.a31; a.a32 = -a.a32; a.a33 = -a.a33; a.a34 = -a.a34; a.a35 = -a.a35;
        a.a41 = -a.a41; a.a42 = -a.a42; a.a43 = -a.a43; a.a44 = -a.a44; a.a45 = -a.a45;
        a.a51 = -a.a51; a.a52 = -a.a52; a.a53 = -a.a53; a.a54 = -a.a54; a.a55 = -a.a55;
    }
961587
public static void elementDiv( DMatrix2 a , DMatrix2 b) {
        a.a1 /= b.a1;
        a.a2 /= b.a2;
    }
673387
private static void checkKhatriRaoArguments(Matrix A, Matrix B) {
        if (A.numColumns() != B.numColumns())
            throw new IndexOutOfBoundsException(
                    "A.numColumns != B.numColumns (" + A.numColumns() + " != "
                            + B.numColumns() + ")");
    }
1254670
public static FloatMatrix symmetricGeneralizedEigenvalues(FloatMatrix A, FloatMatrix B) {
        A.assertSquare();
        B.assertSquare();
        FloatMatrix W = new FloatMatrix(A.rows);
        SimpleBlas.sygvd(1, 'N', 'U', A.dup(), B.dup(), W);
        return W;
    }
348444
function(a, b)
	{
		if ((a == null && b != null) || (a != null && b == null) ||
			(a != null && b != null && a.length != b.length))
		{
			return false;
		}
		else if (a != null && b != null)
		{
			for (var i = 0; i < a.length; i++)
			{
				if (a[i] == b[i] || (a[i] != null && !a[i].equals(b[i])))
				{
					return false;
				}
			}
		}
		
		return true;
	}
1224424
public static void mult(DMatrixRBlock A , DMatrixRBlock B , DMatrixRBlock C )
    {
        if( A.numCols != B.numRows )
            throw new IllegalArgumentException("Columns in A are incompatible with rows in B");
        if( A.numRows != C.numRows )
            throw new IllegalArgumentException("Rows in A are incompatible with rows in C");
        if( B.numCols != C.numCols )
            throw new IllegalArgumentException("Columns in B are incompatible with columns in C");
        if( A.blockLength != B.blockLength || A.blockLength != C.blockLength )
            throw new IllegalArgumentException("Block lengths are not all the same.");

        final int blockLength = A.blockLength;

        DSubmatrixD1 Asub = new DSubmatrixD1(A,0, A.numRows, 0, A.numCols);
        DSubmatrixD1 Bsub = new DSubmatrixD1(B,0, B.numRows, 0, B.numCols);
        DSubmatrixD1 Csub = new DSubmatrixD1(C,0, C.numRows, 0, C.numCols);

        MatrixMult_DDRB.mult(blockLength,Asub,Bsub,Csub);
    }