Returns a compressed version of the
given ndarray
@param array the array to compress
@param algorithm the algorithm to compress with
@return a compressed copy of this ndarray
323531
public INDArray compress(INDArray array, String algorithm) {
        algorithm = algorithm.toUpperCase();
        if (!codecs.containsKey(algorithm))
            throw new RuntimeException("Non-existent compression algorithm requested: [" + algorithm + "]");

        return codecs.get(algorithm).compress(array);
    }
1049226
private static function getAlgorithmClass($algorithm)
    {
        if (self::isAlgorithmSupported($algorithm)) {
            return self::getSupportedAlgorithms()[$algorithm];
        }
        throw new \InvalidArgumentException(sprintf('Algorithm "%s" is not supported.', $algorithm));
    }
132054
private static function superEncode($array)
    {
        if (is_array($array) && !empty($array)) {
            foreach ($array as $key => $value) {
                if (is_array($value)) {
                    $array[$key] = self::superEncode($value);
                } else {
                    $array[$key] = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
                }
            }
        }

        return $array;
    }
445154
function _encryption_algorithm_to_crypt_instance($algorithm)
    {
        switch ($algorithm) {
            case '3des-cbc':
                return new TripleDES();
            case '3des-ctr':
                return new TripleDES(Base::MODE_CTR);
            case 'aes256-cbc':
            case 'aes192-cbc':
            case 'aes128-cbc':
                return new Rijndael();
            case 'aes256-ctr':
            case 'aes192-ctr':
            case 'aes128-ctr':
                return new Rijndael(Base::MODE_CTR);
            case 'blowfish-cbc':
                return new Blowfish();
            case 'blowfish-ctr':
                return new Blowfish(Base::MODE_CTR);
            case 'twofish128-cbc':
            case 'twofish192-cbc':
            case 'twofish256-cbc':
            case 'twofish-cbc':
                return new Twofish();
            case 'twofish128-ctr':
            case 'twofish192-ctr':
            case 'twofish256-ctr':
                return new Twofish(Base::MODE_CTR);
            case 'arcfour':
            case 'arcfour128':
            case 'arcfour256':
                return new RC4();
        }
        return null;
    }
369011
public static String[] sortStringArray(String[] array) {
        if (isEmpty(array)) {
            return new String[0];
        }
        Arrays.sort(array);
        return array;
    }
1100957
public static String getChecksum(String algorithm, byte[] bytes) {
        final MessageDigest digest = getMessageDigest(algorithm);
        final byte[] b = digest.digest(bytes);
        return getHex(b);
    }
891735
public static float[] toFloat(int[] array) {
        float[] n = new float[array.length];
        for (int i = 0; i < array.length; i++) {
            n[i] = (float) array[i];
        }
        return n;
    }
523541
private function arrayCopy(array $array) {
    $result = array();
    foreach ($array as $key => $val) {
      if (is_array($val)) {
        $result[$key] = self::arrayCopy($val);
      }
      elseif (is_object($val)) {
        $result[$key] = clone $val;
      }
      else {
        $result[$key] = $val;
      }
    }
    return $result;
  }
901380
@Override
    public INDArray compress(float[] data, int[] shape, char order) {
        FloatPointer pointer = new FloatPointer(data);

        DataBuffer shapeInfo = Nd4j.getShapeInfoProvider().createShapeInformation(ArrayUtil.toLongArray(shape), order, DataType.FLOAT).getFirst();
        DataBuffer buffer = compressPointer(DataTypeEx.FLOAT, pointer, data.length, 4);

        return Nd4j.createArrayFromShapeBuffer(buffer, shapeInfo);
    }
971821
public static KeyPair generateKeyPair(String algorithm, int keySize) {
        KeyPairGenerator keyPairGenerator;
        try {
            keyPairGenerator = KeyPairGenerator.getInstance(algorithm);
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalArgumentException(e);
        }
        keyPairGenerator.initialize(keySize);
        return keyPairGenerator.generateKeyPair();
    }
1353589
public static byte[] copy( byte[] array )
	{
		byte[] result = new byte[array.length];
		System.arraycopy(array, 0, result, 0, array.length);
		return result;
	}
134442
private static String[][] resizeArray(String[][] array, int size)
    {
        if (array.length == size) return array;
        String[][] nArray = new String[size][];
        System.arraycopy(array, 0, nArray, 0, size);
        return nArray;
    }
20229
public function getCompressionAlgorithm()
    {
        if (isset($this->raw->compression)) {
            if (is_string($this->raw->compression)) {
                if (false === defined('Phar::' . $this->raw->compression)) {
                    throw new InvalidArgumentException(
                        sprintf(
                            'The compression algorithm "%s" is not supported.',
                            $this->raw->compression
                        )
                    );
                }

                $value = constant('Phar::' . $this->raw->compression);

                // Phar::NONE is not valid for compressFiles()
                if (Phar::NONE === $value) {
                    return null;
                }

                return $value;
            }

            return $this->raw->compression;
        }

        return null;
    }
247252
public static Basic1DMatrix fromBinary(byte[] array) {
        ByteBuffer buffer = ByteBuffer.wrap(array);

        if (buffer.get() != MATRIX_TAG) {
            throw new IllegalArgumentException("Can not decode Basic1DMatrix from the given byte array.");
        }

        int rows = buffer.getInt();
        int columns = buffer.getInt();
        int capacity = rows * columns;
        double[] values = new double[capacity];

        for (int i = 0; i < capacity; i++) {
            values[i] = buffer.getDouble();
        }

        return new Basic1DMatrix(rows, columns, values);
    }
425558
def algorithm=(alg)
      if alg.kind_of?(Array) then
        if alg.size == 1 then
          @algorithm = alg.first
        else
          @algorithm = alg
        end
      else
        @algorithm = Algorithm.algorithm_from_name(alg) unless Algorithm::EXISTING == alg
      end
      return @algorithm
    end
678734
public static byte[] copy(byte[] array) {
		byte[] newArray = new byte[array.length];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}
399750
public static IBlur getIBlurAlgorithm(EBlurAlgorithm algorithm, ContextWrapper contextWrapper) {
        RenderScript rs = contextWrapper.getRenderScript();
        Context ctx = contextWrapper.getContext();

        switch (algorithm) {
            case RS_GAUSS_FAST:
                return new RenderScriptGaussianBlur(rs);
            case RS_BOX_5x5:
                return new RenderScriptBox5x5Blur(rs);
            case RS_GAUSS_5x5:
                return new RenderScriptGaussian5x5Blur(rs);
            case RS_STACKBLUR:
                return new RenderScriptStackBlur(rs, ctx);
            case STACKBLUR:
                return new StackBlur();
            case GAUSS_FAST:
                return new GaussianFastBlur();
            case BOX_BLUR:
                return new BoxBlur();
            default:
                return new IgnoreBlur();
        }
    }