text:
/**
 * Bilaniuk, Olexa, Hamid Bazargani, and Robert Laganiere. "Fast Target
 * Recognition on Mobile Devices: Revisiting Gaussian Elimination for the
 * Estimation of Planar Homographies." In Computer Vision and Pattern
 * Recognition Workshops (CVPRW), 2014 IEEE Conference on, pp. 119-125.
 * IEEE, 2014.
 */

/* Include Guards */
#ifndef __OPENCV_RHO_H__
#define __OPENCV_RHO_H__

/* Includes */
#include <opencv2/core.hpp>
#include <stdint.h>

/* Defines */

/* Flags */
#ifndef RHO_FLAG_NONE
#define RHO_FLAG_NONE                        (0U<<0)
#endif
#ifndef RHO_FLAG_ENABLE_NR
#define RHO_FLAG_ENABLE_NR                   (1U<<0)
#endif
#ifndef RHO_FLAG_ENABLE_REFINEMENT
#define RHO_FLAG_ENABLE_REFINEMENT           (1U<<1)
#endif
#ifndef RHO_FLAG_ENABLE_FINAL_REFINEMENT
#define RHO_FLAG_ENABLE_FINAL_REFINEMENT     (1U<<2)
#endif

/* Namespace cv */
namespace cv{

/* Data structures */

/**
 * Homography Estimation context.
 */

struct RHO_HEST;
typedef struct RHO_HEST RHO_HEST;

/* Functions */

/**
 * Initialize the estimator context, by allocating the aligned buffers
 * internally needed.
 *
 * @return A pointer to the context if successful; NULL if an error occured.
 */

Ptr<RHO_HEST> rhoInit(void);

/**
 * Ensure that the estimator context's internal table for non-randomness
 * criterion is at least of the given size, and uses the given beta. The table
 * should be larger than the maximum number of matches fed into the estimator.
 *
 * A value of N of 0 requests deallocation of the table.
 *
 * @param [in] p     The initialized estimator context
 * @param [in] N     If 0, deallocate internal table. If > 0, ensure that the
 *                   internal table is of at least this size, reallocating if
 *                   necessary.
 * @param [in] beta  The beta-factor to use within the table.
 * @return 0 if unsuccessful; non-zero otherwise.
 */

int  rhoEnsureCapacity(Ptr<RHO_HEST> p, unsigned N, double beta);

/**
 * Seeds the internal PRNG with the given seed.
 *
 * Although it is not required to call this function, since context
 * initialization seeds itself with entropy from rand(), this function allows
 * reproducible results by using a specified seed.
 *
 * @param [in] p    The estimator context whose PRNG is to be seeded.
 * @param [in] seed The 64-bit integer seed.
 */

void rhoSeed(Ptr<RHO_HEST> p, uint64_t seed);

/**
 * Estimates the homography using the given context, matches and parameters to
 * PROSAC.
 *
 * The given context must have been initialized.
 *
 * The matches are provided as two arrays of N single-precision, floating-point
 * (x,y) points. Points with corresponding offsets in the two arrays constitute
 * a match. The homography estimation attempts to find the 3x3 matrix H which
 * best maps the homogeneous-coordinate points in the source array to their
 * corresponding homogeneous-coordinate points in the destination array.
 *
 *     Note: At least 4 matches must be provided (N >= 4).
 *     Note: A point in either array takes up 2 floats. The first of two stores
 *           the x-coordinate and the second of the two stores the y-coordinate.
 *           Thus, the arrays resemble this in memory:
 *
 *           src =    [x0, y0, x1, y1, x2, y2, x3, y3, x4, y4, ...]
 *           Matches:     |       |       |       |       |
 *           dst =    [x0, y0, x1, y1, x2, y2, x3, y3, x4, y4, ...]
 *     Note: The matches are expected to be provided sorted by quality, or at
 *           least not be worse-than-random in ordering.
 *
 * A pointer to the base of an array of N bytes can be provided. It serves as
 * an output mask to indicate whether the corresponding match is an inlier to
 * the returned homography, if any. A zero indicates an outlier; A non-zero
 * value indicates an inlier.
 *
 * The PROSAC estimator requires a few parameters of its own. These are:
 *
 *     - The maximum distance that a source point projected onto the destination
 *           plane can be from its putative match and still be considered an
 *           inlier. Must be non-negative.
 *           A sane default is 3.0.
 *     - The maximum number of PROSAC iterations. This corresponds to the
 *           largest number of samples that will be drawn and tested.
 *           A sane default is 2000.
 *     - The RANSAC convergence parameter. This corresponds to the number of
 *           iterations after which PROSAC will start sampling like RANSAC.
 *           A sane default is 2000.
 *     - The confidence threshold. This corresponds to the probability of
 *           finding a correct solution. Must be bounded by [0, 1].
 *           A sane default is 0.995.
 *     - The minimum number of inliers acceptable. Only a solution with at
 *           least this many inliers will be returned. The minimum is 4.
 *           A sane default is 10% of N.
 *     - The beta-parameter for the non-randomness termination criterion.
 *           Ignored if non-randomness criterion disabled, otherwise must be
 *           bounded by (0, 1).
 *           A sane default is 0.35.
 *     - Optional flags to control the estimation. Available flags are:
 *           HEST_FLAG_NONE:
 *               No special processing.
 *           HEST_FLAG_ENABLE_NR:
 *               Enable non-randomness criterion. If set, the beta parameter
 *               must also be set.
 *           HEST_FLAG_ENABLE_REFINEMENT:
 *               Enable refinement of each new best model, as they are found.
 *           HEST_FLAG_ENABLE_FINAL_REFINEMENT:
 *               Enable one final refinement of the best model found before
 *               returning it.
 *
 * The PROSAC estimator optionally accepts an extrinsic initial guess of H.
 *
 * The PROSAC estimator outputs a final estimate of H provided it was able to
 * find one with a minimum of supporting inliers. If it was not, it outputs
 * the all-zero matrix.
 *
 * The extrinsic guess at and final estimate of H are both in the same form:
 * A 3x3 single-precision floating-point matrix with step 3. Thus, it is a
 * 9-element array of floats, with the elements as follows:
 *
 *     [ H00, H01, H02,
 *       H10, H11, H12,
 *       H20, H21, 1.0 ]
 *
 * Notice that the homography is normalized to H22 = 1.0.
 *
 * The function returns the number of inliers if it was able to find a
 * homography with at least the minimum required support, and 0 if it was not.
 *
 *
 * @param [in/out] p       The context to use for homography estimation. Must
 *                             be already initialized. Cannot be NULL.
 * @param [in]     src     The pointer to the source points of the matches.
 *                             Must be aligned to 4 bytes. Cannot be NULL.
 * @param [in]     dst     The pointer to the destination points of the matches.
 *                             Must be aligned to 4 bytes. Cannot be NULL.
 * @param [out]    inl     The pointer to the output mask of inlier matches.
 *                             Must be aligned to 4 bytes. May be NULL.
 * @param [in]     N       The number of matches. Minimum 4.
 * @param [in]     maxD    The maximum distance. Minimum 0.
 * @param [in]     maxI    The maximum number of PROSAC iterations.
 * @param [in]     rConvg  The RANSAC convergence parameter.
 * @param [in]     cfd     The required confidence in the solution.
 * @param [in]     minInl  The minimum required number of inliers. Minimum 4.
 * @param [in]     beta    The beta-parameter for the non-randomness criterion.
 * @param [in]     flags   A union of flags to fine-tune the estimation.
 * @param [in]     guessH  An extrinsic guess at the solution H, or NULL if
 *                         none provided.
 * @param [out]    finalH  The final estimation of H, or the zero matrix if
 *                         the minimum number of inliers was not met.
 *                         Cannot be NULL.
 * @return                 The number of inliers if the minimum number of
 *                         inliers for acceptance was reached; 0 otherwise.
 */

unsigned rhoHest(Ptr<RHO_HEST> p,       /* Homography estimation context. */
                 const float*  src,     /* Source points */
                 const float*  dst,     /* Destination points */
                 char*         inl,     /* Inlier mask */
                 unsigned      N,       /*  = src.length = dst.length = inl.length */
                 float         maxD,    /*   3.0 */
                 unsigned      maxI,    /*  2000 */
                 unsigned      rConvg,  /*  2000 */
                 double        cfd,     /* 0.995 */
                 unsigned      minInl,  /*     4 */
                 double        beta,    /*  0.35 */
                 unsigned      flags,   /*     0 */
                 const float*  guessH,  /* Extrinsic guess, NULL if none provided */
                 float*        finalH); /* Final result. */

/* End Namespace cv */
}

#endif


text:
import re
import os
import json
import sys
import platform
from glob import glob
from constants import DEF_CORE_SITE_XML, DEF_HBASE_HOME
from common import cmd_output, err, Version, ParseXML

PREFIX = 'get_'
NA = 'N/A' # not available
NS = 'N/S' # not supported
OK = 'OK'

def deco(func):
    def wrapper(self):
        if PREFIX in func.__name__:
            name = func.__name__.replace(PREFIX, '')
            return name, func(self)
        else:
            return
    return wrapper

class Discover(object):
    """ discover functions, to add a new discover function,
        simply add a new def with name get_xx and decorated
        by 'deco', then return result in string format:

        @deco
        def get_xx(self):
            # do something
            return result
    """

    def __init__(self, dbcfgs):
        self.CPUINFO = cmd_output('cat /proc/cpuinfo')
        self.MEMINFO = cmd_output('cat /proc/meminfo')
        self.SYSCTLINFO = cmd_output('sysctl -a')
        self.version = Version()
        self.dbcfgs = dbcfgs

    def _parse_string(self, info, string):
        try:
            info = info.split('\n')
            string_line = [line for line in info if string in line][0]
        except IndexError:
            err('Cannot get %s info' % string)

        return string_line

    def _get_cpu_info(self, string):
        return self._parse_string(self.CPUINFO, string).split(':')[1].strip()

    def _get_mem_info(self, string):
        return self._parse_string(self.MEMINFO, string).split(':')[1].split()[0]

    def _get_sysctl_info(self, string):
        return self._parse_string(self.SYSCTLINFO, string).split('=')[1].strip()

    @deco
    def get_linux(self):
        """ get linux version """
        os_dist, os_ver = platform.dist()[:2]
        if os_dist not in self.version.get_version('linux'):
            return NA
        else:
            if not os_ver.split('.')[0] in self.version.get_version(os_dist):
                return NA
        return '%s-%s' % (os_dist, os_ver)

    @deco
    def get_firewall_status(self):
        """ get firewall running status """
        iptables_stat = cmd_output('iptables -nL|grep -vE "(Chain|target)"').strip()
        if iptables_stat:
            return 'Running'
        else:
            return 'Stopped'

    @deco
    def get_pidmax(self):
        """ get kernel pid max setting """
        return self._get_sysctl_info('kernel.pid_max')

    @deco
    def get_default_java(self):
        """ get default java version """
        jdk_path = glob('/usr/java/*') + \
                   glob('/usr/jdk64/*') + \
                   glob('/usr/lib/jvm/java-*-openjdk.x86_64')

        jdk_list = {} # {jdk_version: jdk_path}
        for path in jdk_path:
            jdk_ver = cmd_output('%s/bin/javac -version' % path)

            try:
                main_ver, sub_ver = re.search(r'(\d\.\d\.\d)_(\d+)', jdk_ver).groups()
                # don't support JDK version less than 1.7.0_65
                if main_ver == '1.7.0' and int(sub_ver) < 65:
                    continue
                jdk_list[main_ver] = path
            except AttributeError:
                continue

        # auto detect JDK1.8/1.7
        if jdk_list.has_key('1.8.0'):
            return jdk_list['1.8.0']
        elif jdk_list.has_key('1.7.0'):
            return jdk_list['1.7.0']
        else:
            return NA

    @deco
    def get_hive(self):
        """ get Hive status """
        hive_stat = cmd_output('which hive')
        if 'no hive' in hive_stat:
            return NA
        else:
            return OK

    def _get_core_site_info(self, name):
        if self.dbcfgs.has_key('hadoop_home'): # apache distro
            core_site_xml = '%s/etc/hadoop/core-site.xml' % self.dbcfgs['hadoop_home']
        else:
            core_site_xml = DEF_CORE_SITE_XML

        if os.path.exists(core_site_xml):
            p = ParseXML(core_site_xml)
            return p.get_property(name)
        else:
            return NA

    @deco
    def get_hadoop_authentication(self):
        return self._get_core_site_info('hadoop.security.authentication')

    @deco
    def get_hbase(self):
        """ get HBase version """
        if self.dbcfgs.has_key('hbase_home'): # apache distro
            hbase_home = self.dbcfgs['hbase_home']
        else:
            hbase_home = DEF_HBASE_HOME
        hbase_ver = cmd_output('%s/bin/hbase version | head -n1' % hbase_home)

        support_hbase_ver = self.version.get_version('hbase')
        try:
            hbase_ver = re.search(r'HBase (\d\.\d)', hbase_ver).groups()[0]
        except AttributeError:
            return NA
        if hbase_ver not in support_hbase_ver:
            return NS
        return hbase_ver

    @deco
    def get_cpu_model(self):
        """ get CPU model """
        return self._get_cpu_info('model name')

    @deco
    def get_cpu_cores(self):
        """ get CPU cores """
        return self.CPUINFO.count('processor')

    @deco
    def get_arch(self):
        """ get CPU architecture """
        arch = platform.processor()
        if not arch:
            arch = 'Unknown'
        return arch

    @deco
    def get_mem_total(self):
        """ get total memory size """
        mem = self._get_mem_info('MemTotal')
        memsize = mem.split()[0]

        return "%0.1f GB" % round(float(memsize) / (1024 * 1024), 2)

    @deco
    def get_mem_free(self):
        """ get current free memory size """
        free = self._get_mem_info('MemFree')
        buffers = self._get_mem_info('Buffers')
        cached = self._get_mem_info('Cached')
        memfree = float(free) + float(buffers) + float(cached)

        return "%0.1f GB" % round(memfree / (1024 * 1024), 2)

    @deco
    def get_ext_interface(self):
        """ get external network interface """
        return cmd_output('ip route |grep default|awk \'{print $5}\'')

    @deco
    def get_rootdisk_free(self):
        """ get root disk space left """
        space = cmd_output('df -h|grep "\/$" | awk \'{print $4}\'')
        return space.strip()

    @deco
    def get_python_ver(self):
        """ get python version """
        return platform.python_version()

    @deco
    def get_home_dir(self):
        if self.dbcfgs.has_key('traf_user'):
            traf_user = self.dbcfgs['traf_user']
            return cmd_output("getent passwd %s | awk -F: '{print $6}' | sed 's/\/%s//g'" % (traf_user, traf_user))
        else:
            return ''

    @deco
    def get_traf_status(self):
        """ get trafodion running status """
        mon_process = cmd_output('ps -ef|grep -v grep|grep -c "monitor COLD"')
        if int(mon_process) > 0:
            return 'Running'
        else:
            return 'Stopped'

def run():
    try:
        dbcfgs_json = sys.argv[1]
    except IndexError:
        err('No db config found')
    dbcfgs = json.loads(dbcfgs_json)
    discover = Discover(dbcfgs)
    methods = [m for m in dir(discover) if m.startswith(PREFIX)]
    result = {}
    for method in methods:
        key, value = getattr(discover, method)() # call method
        result[key] = value

    print json.dumps(result)

# main
if __name__ == '__main__':
    run()

redpajama_set_name: RedPajamaGithub


text:
//  (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
//  Hinnant & John Maddock 2000.
//  Use, modification and distribution are subject to the Boost Software License,
//  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt).
//
//  See http://www.boost.org/libs/type_traits for most recent version including documentation.

#ifndef BOOST_TT_REMOVE_CONST_HPP_INCLUDED
#define BOOST_TT_REMOVE_CONST_HPP_INCLUDED

#include <boost_1_56_0/type_traits/is_volatile.hpp>
#include <boost_1_56_0/type_traits/detail/cv_traits_impl.hpp>
#include <boost_1_56_0/config.hpp>
#include <boost_1_56_0/detail/workaround.hpp>

#include <cstddef>

// should be the last #include
#include <boost_1_56_0/type_traits/detail/type_trait_def.hpp>

namespace boost_1_56_0 {

namespace detail {

template <typename T, bool is_vol>
struct remove_const_helper
{
    typedef T type;
};

template <typename T>
struct remove_const_helper<T, true>
{
    typedef T volatile type;
};

template <typename T>
struct remove_const_impl
{
    typedef typename remove_const_helper<
       typename cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(T)>::unqualified_type
        , ::boost_1_56_0::is_volatile<T>::value
        >::type type;
};

#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
//
// We can't filter out rvalue_references at the same level as
// references or we get ambiguities from msvc:
//
template <typename T>
struct remove_const_impl<T&&>
{
    typedef T&& type;
};
#endif

} // namespace detail

// * convert a type T to non-const type - remove_const<T>

BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename boost_1_56_0::detail::remove_const_impl<T>::type)
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_const,T&,T&)
#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const[N],T type[N])
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const volatile[N],T volatile type[N])
#endif

} // namespace boost_1_56_0

#include <boost_1_56_0/type_traits/detail/type_trait_undef.hpp>

#endif // BOOST_TT_REMOVE_CONST_HPP_INCLUDED


text:
package org.apache.flink.runtime.checkpoint.channel;

import org.apache.flink.runtime.checkpoint.InflightDataRescalingDescriptor;
import org.apache.flink.runtime.checkpoint.RescaleMappings;
import org.apache.flink.runtime.io.network.api.writer.ResultPartitionWriter;
import org.apache.flink.runtime.io.network.buffer.BufferBuilder;
import org.apache.flink.runtime.io.network.buffer.NetworkBufferPool;
import org.apache.flink.runtime.io.network.partition.ResultPartition;
import org.apache.flink.runtime.io.network.partition.ResultPartitionBuilder;

import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import java.util.HashSet;

import static org.junit.Assert.assertEquals;

/** Test of different implementation of {@link ResultSubpartitionRecoveredStateHandler}. */
public class ResultSubpartitionRecoveredStateHandlerTest extends RecoveredChannelStateHandlerTest {
    private static final int preAllocatedSegments = 3;
    private NetworkBufferPool networkBufferPool;
    private ResultPartition partition;
    private ResultSubpartitionRecoveredStateHandler rstHandler;
    private ResultSubpartitionInfo channelInfo;

    @Before
    public void setUp() throws IOException {
        // given: Segment provider with defined number of allocated segments.
        channelInfo = new ResultSubpartitionInfo(0, 0);

        networkBufferPool = new NetworkBufferPool(preAllocatedSegments, 1024);
        partition = new ResultPartitionBuilder().setNetworkBufferPool(networkBufferPool).build();
        partition.setup();

        rstHandler = buildResultStateHandler(partition);
    }

    private ResultSubpartitionRecoveredStateHandler buildResultStateHandler(
            ResultPartition partition) {
        return new ResultSubpartitionRecoveredStateHandler(
                new ResultPartitionWriter[] {partition},
                false,
                new InflightDataRescalingDescriptor(
                        new InflightDataRescalingDescriptor
                                        .InflightDataGateOrPartitionRescalingDescriptor[] {
                            new InflightDataRescalingDescriptor
                                    .InflightDataGateOrPartitionRescalingDescriptor(
                                    new int[] {1},
                                    RescaleMappings.identity(1, 1),
                                    new HashSet<>(),
                                    InflightDataRescalingDescriptor
                                            .InflightDataGateOrPartitionRescalingDescriptor
                                            .MappingType.IDENTITY)
                        }));
    }

    @Test
    public void testRecycleBufferBeforeRecoverWasCalled() throws Exception {
        // when: Request the buffer.
        RecoveredChannelStateHandler.BufferWithContext<BufferBuilder> bufferWithContext =
                rstHandler.getBuffer(new ResultSubpartitionInfo(0, 0));

        // and: Recycle buffer outside.
        bufferWithContext.buffer.close();

        // Close the partition for flushing the cached recycled buffers to the segment provider.
        partition.close();

        // then: All pre-allocated segments should be successfully recycled.
        assertEquals(preAllocatedSegments, networkBufferPool.getNumberOfAvailableMemorySegments());
    }

    @Test
    public void testRecycleBufferAfterRecoverWasCalled() throws Exception {
        // when: Request the buffer.
        RecoveredChannelStateHandler.BufferWithContext<BufferBuilder> bufferWithContext =
                rstHandler.getBuffer(channelInfo);

        // and: Pass the buffer to recovery.
        rstHandler.recover(channelInfo, 0, bufferWithContext);

        // Close the partition for flushing the cached recycled buffers to the segment provider.
        partition.close();

        // then: All pre-allocated segments should be successfully recycled.
        assertEquals(preAllocatedSegments, networkBufferPool.getNumberOfAvailableMemorySegments());
    }
}


text:
/*! \file SiconosMatrix.hpp
  Interface for matrices handling.
*/

#ifndef __SiconosMatrix__
#define __SiconosMatrix__

#include <stddef.h>                    // for size_t
#include <iosfwd>                      // for ostream
#include "CSparseMatrix.h"             // for CSparseMatrix
#include "SiconosAlgebraTypeDef.hpp"   // for DenseMat, BandedMat, IdentityMat
#include "SiconosFwd.hpp"              // for SiconosMatrix
#include "SiconosSerialization.hpp"    // for ACCEPT_SERIALIZATION
#include "SiconosVisitor.hpp"          // for VIRTUAL_ACCEPT_VISITORS
class BlockVector;

/** Union of DenseMat pointer, TriangMat pointer BandedMat, SparseMat, SymMat, Zero and Identity mat pointers.
 */
union MATRIX_UBLAS_TYPE
{
  DenseMat *Dense;    // num = 1
  TriangMat *Triang;  // num = 2
  SymMat *Sym;        // num = 3
  SparseMat *Sparse;  // num = 4
  BandedMat *Banded;  // num = 5
  ZeroMat *Zero;      // num = 6
  IdentityMat *Identity; // num = 7
  SparseCoordinateMat *SparseCoordinate; // num = 8
};
/** A STL vector of int */
typedef std::vector<int> VInt;
TYPEDEF_SPTR(VInt)

/**
   Abstract class to provide interface for matrices handling

   Matrices can be either block or Simple.
   See Derived classes for details.

   In Siconos, a "matrix" can be either a SimpleMatrix or a BlockMatrix, ie a container of several pointers to SiconosMatrix

   You can find an overview on how to build and use vectors and matrices in siconos users guide .

*/
class SiconosMatrix //: public std::enable_shared_from_this<SiconosMatrix>
{
protected:
  ACCEPT_SERIALIZATION(SiconosMatrix);

  /** A number to specify the type of the matrix: (block or ublas-type)
   *  0-> BlockMatrix, 1 -> DenseMat, 2 -> TriangMat, 3 -> SymMat, 4->SparseMat, 5->BandedMat, 6->zeroMat, 7->IdentityMat
   */
  Siconos::UBLAS_TYPE _num;

  /** bool _isSymmetric;
   *  Boolean = true if the Matrix is symmetric
   */
  bool _isSymmetric;

  /** bool _isPositiveDefinite;
   *  Boolean = true if the Matrix is positive definite
   */
  bool _isPositiveDefinite;

  /** default constructor */
  SiconosMatrix() {};

  /** basic constructor
   *
   *  \param type unsigned int type-number of the vector
   */
  SiconosMatrix(Siconos::UBLAS_TYPE type);

  /** computes y = subA*x (init =true) or += subA * x (init = false), subA being a submatrix of A (all columns, and rows between start and start+sizeY).
   *  If x is a block vector, it call the present function for all blocks.
   *
   *  \param A a pointer to SiconosMatrix
   *  \param startRow an int, sub-block position
   *  \param x a pointer to a SiconosVector
   *  \param y a pointer to a SiconosVector
   *  \param init a bool
   */
  void private_prod(unsigned int startRow, const SiconosVector& x, SiconosVector& y, bool init) const;

  /** computes res = subA*x +res, subA being a submatrix of A (rows from startRow to startRow+sizeY and columns between startCol and startCol+sizeX).
   *  If x is a block vector, it call the present function for all blocks.
   *
   *  \param A a pointer to SiconosMatrix
   *  \param startRow an int, sub-block position
   *  \param startCol an int, sub-block position
   *  \param x a pointer to a SiconosVector
   *  \param res a DenseVect
   */
  void private_addprod(unsigned int startRow, unsigned int startCol, const SiconosVector& x, SiconosVector& res) const;

public:

  /** Destructor. */
  virtual ~SiconosMatrix() {};

  /** true if the matrix is block else false.
   *
   *  \return a bool
   */
  inline bool isBlock(void) const
  {
    if (_num == Siconos::BLOCK) return true ;
    else return false;
  }

  /** determines if the matrix has been inversed in place
   *
   *  \return true if the matrix is inversed
   */
  inline virtual bool isPLUInversed() const
  {
    return false;
  };

  /** true if the matrix is symmetric (the flag is just returned)
   *
   *  \return true if the matrix is symmetric
   */
  inline bool isSymmetric() const
  {
    return _isSymmetric;
  }

  /** set the flag _isSymmetric */
  inline void setIsSymmetric(bool b)
  {
    _isSymmetric= b;
  }

  /** true if the matrix is definite positive (the flag is just returned)
   *
   *  \return true if the matrix is
   */
  inline bool isPositiveDefinite() const
  {
    return _isPositiveDefinite;
  }

  /** set the flag _isPositiveDefinite */
  inline void setIsPositiveDefinite(bool b)
  {
    _isPositiveDefinite= b ;
  }

  /** determines if the matrix is symmetric up to a given tolerance
   *
   *  \return true if the matrix is inversed
   */
  virtual bool checkSymmetry(double tol) const =0;

  /** determines if the matrix has been PLU factorized
   *
   *  \return true if the matrix is factorized
   */
  inline virtual bool isPLUFactorized() const
  {
    return false;
  };

  /** determines if the matrix has been PLU factorized in place
   *
   *  \return true if the matrix is factorized
   */
  inline virtual bool isPLUFactorizedInPlace() const
  {
    return false;
  };

  /** determines if the matrix has been Cholesky factorized
   *
   *  \return true if the matrix is factorized
   */
  inline virtual bool isCholeskyFactorized() const
  {
    return false;
  };

  /** determines if the matrix has been QR factorized
   *
   *  \return true if the matrix is factorized
   */
  inline bool isQRFactorized() const
  {
    return false;
  }

  inline virtual SP::VInt ipiv() const
  {
    SP::VInt dummy;
    return dummy;
  }

  /** determines if the matrix has been factorized
   *
   *  \return true if the matrix is factorized
   */
  inline virtual bool isFactorized() const
  {
    return (isPLUFactorized() || isPLUFactorizedInPlace() || isCholeskyFactorized() || isQRFactorized());
  };

  /** get the number of rows or columns of the matrix
   *
   *  \param index 0 for rows, 1 for columns
   *  \return an int
   */
  virtual unsigned int size(unsigned int index) const = 0;

  /** get the attribute num of current matrix
   *
   *  \return an unsigned int.
   */
  inline Siconos::UBLAS_TYPE num() const
  {
    return _num;
  };

  /** get the number of block (i=0, row, i=1 col)
   *
   *  \param i unsigned int(i=0, row, i=1 col)
   *  \return an unsigned int. 1 as default for SimpleMatrix.
   */
  inline virtual unsigned int numberOfBlocks(unsigned int i) const
  {
    return 1;
  };

  /** reserved to BlockMatrix - get the index tab for rows
   *
   *  \return a pointer to a standard vector of int
   */
  virtual const SP::Index tabRow() const ;

  /** reserved to BlockMatrix - get the index tab of columns
   *
   *  \return a pointer to a standard vector of int
   */
  virtual const SP::Index tabCol() const ;

  /** get DenseMat matrix
   *
   *  \param row an unsigned int position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int position of the block (column) - Useless for SimpleMatrix
   *  \return a DenseMat
   */
  virtual const DenseMat getDense(unsigned int row = 0, unsigned int col = 0) const =  0;

  /** get TriangMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a TriangMat
   */
  virtual const TriangMat getTriang(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get SymMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a SymMat
   */
  virtual const SymMat getSym(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get BandedMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a BandedMat
   */
  virtual const BandedMat getBanded(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get SparseMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a SparseMat
   */
  virtual const SparseMat getSparse(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get SparseCoordinateMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a SparseCoordinateMat
   */
  virtual const SparseCoordinateMat getSparseCoordinate(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get ZeroMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a ZeroMat
   */
  virtual const ZeroMat getZero(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get  getIdentity matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return an IdentityMat
   */
  virtual const IdentityMat getIdentity(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get a pointer on DenseMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a DenseMat*
   */
  virtual  DenseMat* dense(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get a pointer on TriangMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a TriangMat*
   */
  virtual TriangMat* triang(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get a pointer on SymMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a SymMat*
   */
  virtual SymMat* sym(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get a pointer on BandedMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a BandedMat*
   */
  virtual BandedMat* banded(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get a pointer on SparseMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a SparseMat*
   */
  virtual SparseMat* sparse(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get a pointer on SparseCoordinateMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a SparseCoordinateMat*
   */
  virtual SparseCoordinateMat* sparseCoordinate(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get a pointer on ZeroMat matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return a ZeroMat*
   */
  virtual ZeroMat* zero_mat(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** get a pointer on Identity matrix
   *
   *  \param row an unsigned int, position of the block (row) - Useless for SimpleMatrix
   *  \param col an unsigned int, position of the block (column) - Useless for SimpleMatrix
   *  \return an IdentityMat*
   */
  virtual IdentityMat* identity(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** return the address of the array of double values of the matrix
   *  ( for block(i,j) if this is a block matrix)
   *
   *  \param row position for the required block
   *  \param col position for the required block
   *  \return double* : the pointer on the double array
   */
  virtual double* getArray(unsigned int row = 0, unsigned int col = 0) const = 0;

  /** sets all the values of the matrix to 0.0
   */
  virtual void zero() = 0;

  /** Initialize the matrix with random values
   */
  virtual void randomize() = 0;

  /** Initialize a symmetric matrix with random values
   */
  virtual void randomize_sym()= 0;

  /** set an identity matrix
   */
  virtual void eye() = 0;

  /** resize the matrix with nbrow rows and nbcol columns, upper and lower are only useful for BandedMatrix .
   *  The existing elements of the matrix are preseved when specified.
   *
   *  \param nbrow
   *  \param nbcol
   *  \param lower,upper for banded matrices
   *  \param preserve
   */
  virtual void resize(unsigned int nbrow, unsigned int nbcol,
                      unsigned int lower = 0, unsigned int upper = 0, bool preserve = true) = 0;

  /** compute the infinite norm of the matrix
   *
   *  \return a double
   */
  virtual double normInf() const = 0;

  /** display data on standard output
   */
  virtual void display() const = 0;

  /** display data on standard output
   */
  virtual void displayExpert(bool brief = true ) const = 0;

  /** put data of the matrix into a std::string
   *
   *  \return std::string
   */
  virtual std::string toString() const = 0;

  // Note: in the following functions, row and col are general;
  // that means that for a SimpleMatrix m, m(i,j) is index (i,j) element but
  // for a BlockMatrix w that contains 2 SiconosMatrix of size 3
  // w(1, 4) corresponds to the element (1,1) of the second matrix.
  /** get or set the element matrix[i,j]
   *
   *  \param i an unsigned int i
   *  \param j an unsigned int j
   *  \return the element matrix[i,j]
   */
  virtual double& operator()(unsigned int i, unsigned int j) = 0;

  /** get or set the element matrix[i,j]
   *
   *  \param i an unsigned int i
   *  \param j an unsigned int j
   *  \return the element matrix[i,j]
   */
  virtual double operator()(unsigned int i, unsigned int j) const = 0;

  /** return the element matrix[i,j]
   *
   *  \param i an unsigned int i
   *  \param j an unsigned int j
   *  \return a double
   */
  virtual double getValue(unsigned int i, unsigned int j) const = 0;

  /** set the element matrix[i,j]
   *
   *  \param i an unsigned int i
   *  \param j an unsigned int j
   *  \param value
   */
  virtual void setValue(unsigned int i, unsigned int j, double value) = 0;

  /** get block at position row-col if BlockMatrix, else if SimpleMatrix return this
   *
   *  \param row unsigned int row
   *  \param col unsigned int col
   *  \return SP::SiconosMatrix
   */
  virtual SP::SiconosMatrix block(unsigned int row = 0, unsigned int col = 0)
  {
    THROW_EXCEPTION("must be implemented");
  };

  /** get block at position row-col if BlockMatrix, else if SimpleMatrix return this
   *
   *  \param row unsigned int row
   *  \param col unsigned int col
   *  \return SPC::SiconosMatrix
   */
  virtual SPC::SiconosMatrix block(unsigned int row = 0, unsigned int col = 0) const
  {
    THROW_EXCEPTION("must be implemented");
  };

  /** get row index of current matrix and save it into vOut
   *
   *  \param index row we want to get
   *  \param[out] vOut SiconosVector that will contain the desired row
   */
  virtual void getRow(unsigned int index, SiconosVector& vOut) const = 0;

  /** get column index of current matrix and save it into vOut
   *
   *  \param index column we want to get
   *  \param[out] vOut SiconosVector that will contain the desired column
   */
  virtual void getCol(unsigned int index, SiconosVector& vOut) const = 0;

  /** set line row of the current matrix with vector v
   *
   *  \param index row we want to set
   *  \param vIn SiconosVector containing the new row
   */
  virtual void setRow(unsigned int index, const SiconosVector& vIn) = 0;

  /** set column col of the current matrix with vector v
   *
   *  \param index column we want to set
   *  \param vIn a SiconosVector containing the new column
   */
  virtual void setCol(unsigned int index, const SiconosVector& vIn) = 0;

  /** transpose in place: x->trans() is x = transpose of x.
   */
  virtual void trans() = 0;

  /** transpose a matrix: x->trans(m) is x = transpose of m.
   *
   *  \param m the matrix to be transposed.
   */
  virtual void trans(const SiconosMatrix& m) = 0;

  /** operator =
   *
   *  \param m the matrix to be copied
   *  \return SiconosMatrix&
   */
  virtual SiconosMatrix& operator  = (const SiconosMatrix& m) = 0;

  /** operator = to a DenseMat
   *
   *  \param m the DenseMat to be copied
   *  \return SiconosMatrix&
   */
  virtual SiconosMatrix& operator  = (const DenseMat& m) = 0;

  /** operator +=
   *
   *  \param m a matrix to add
   *  \return SiconosMatrix&
   */
  virtual SiconosMatrix& operator +=(const SiconosMatrix& m) = 0;

  /** operator -=
   *
   *  \param m a matrix to subtract
   *  \return SiconosMatrix&
   */
  virtual SiconosMatrix& operator -=(const SiconosMatrix& m) = 0;

  virtual void updateNumericsMatrix() =0;

  virtual NumericsMatrix * numericsMatrix() const
  {
    return nullptr;
  };

  /** computes a LU factorization of a general M-by-N matrix
   *  with partial pivoting and row interchanges.
   *  The result is returned in this (InPlace).
   *  Based on Blas dgetrf function for dense matrix and
   *  ublas cholesky decomposition for sparse matrix
   *  (work only for a symmetric matrix and very slow because it uses
   *  matric accessor)
   *  use preferably PLUFactorize()
   */
  virtual void PLUFactorizationInPlace() = 0;

  /** computes a factorization of a general M-by-N matrix
   *  The implementation is based on an internal NumericsMatrix
   */
  virtual void Factorize() = 0;

  /** compute inverse of this thanks to LU factorization with partial pivoting.
   *  This method inverts U and then computes inv(A) by solving the system
   *  inv(A)*L = inv(U) for inv(A).
   *  The result is returned in this (InPlace).
   *  Based on Blas dgetri function for dense function
   */
  virtual void  PLUInverseInPlace() = 0;

  /** solves a system of linear equations A * X = B  (A=this)
   *  for a general N-by-N matrix A using the LU factorization computed
   *  by PLUFactorizationInPlace.
   *  Based on Blas dgetrs function for dense matrix.
   *
   *  \param[in,out] B on input the RHS matrix b; on output the result x
   */
  virtual void  PLUForwardBackwardInPlace(SiconosMatrix &B) = 0;

  /** solves a system of linear equations A * X = B  (A=this)
   *  for a general N-by-N matrix A using the LU factorization computed
   *  by PLUFactorize.
   *
   *  \param[in,out] B on input the RHS matrix b; on output the result x
   */
  virtual void  Solve(SiconosMatrix &B) = 0;

  /** solves a system of linear equations A * X = B  (A=this)
   *  for a general N-by-N matrix A using the LU factorization computed
   *  by PLUFactorizationInPlace.
   *  Based on Blas dgetrs function for dense matrix.
   *
   *  \param[in,out] B on input the RHS matrix b; on output the result x
   */
  virtual void   PLUForwardBackwardInPlace(SiconosVector &B) = 0;

  /** solves a system of linear equations A * X = B  (A=this)
   *  for a general N-by-N matrix A using the LU factorization computed
   *  by PLUFactorize.
   *
   *  \param[in,out] B on input the RHS matrix b; on output the result x
   */
  virtual void   Solve(SiconosVector &B) = 0;

  /** set to false all LU indicators. Useful in case of
      assignment for example.
  */
  virtual void resetLU()
  {
    THROW_EXCEPTION(" SiconosMatrix::resetLU not yet implemented for BlockMatrix.");
  };

  /** set to false all factorization indicators. Useful in case of
      assignment for example.
  */
  virtual void resetFactorizationFlags()
  {
    THROW_EXCEPTION(" SiconosMatrix::resetFactorizationFlags not yet implemented for BlockMatrix.");
  };

  /** return the number of non-zero in the matrix
   *
   *  \param tol the tolerance to consider a number zero (not used if the matrix is sparse)
   *  \return the number of non-zeros
   */
  virtual size_t nnz(double tol = 1e-14);

  /** Fill CSparseMatrix compresses column sparse matrix
   *
   *  \param csc the compressed column sparse matrix
   *  \param row_off
   *  \param col_off
   *  \param tol the tolerance under which a number is considered as equal to zero
   *  \return true if function worked.
   *  \warning not clear that it works for an empty csr matrix with row_off =0  and col_off =0
   */
  bool fillCSC(CSparseMatrix* csc, size_t row_off, size_t col_off, double tol = 1e-14);

  /** Fill CSparseMatrix compresses column sparse matrix
   *
   *  \param csc the compressed column sparse matrix
   *  \param tol the tolerance under which a number is considered as equal to zero
   *  \return true if function worked.
   */
  bool fillCSC(CSparseMatrix* csc, double tol = 1e-14);

  bool fromCSC(CSparseMatrix* csc);

  /** return the number of non-zero in the matrix
   *
   *  \param csc the compressed column sparse matrix
   *  \param row_off
   *  \param col_off
   *  \param tol the tolerance to consider a number zero (not used if the matrix is sparse)
   *  \return the number of non-zeros
   */
  bool fillTriplet(CSparseMatrix* csc, size_t row_off, size_t col_off, double tol = 1e-14);

  VIRTUAL_ACCEPT_VISITORS(SiconosMatrix);

  /** \defgroup SiconosMatrixFriends

      List of friend functions of the SimpleMatrix class

      Declared in SimpleMatrixFriends.hpp.
      Implemented in SimpleMatrixFriends.cpp.

   */

  // grant access to private_prod
  friend void prod(const SiconosMatrix& A, const SiconosVector& x, BlockVector& y, bool init);
  // grant access to private_addprod
  friend void prod(const SiconosMatrix& A, const BlockVector& x, SiconosVector& y, bool init);

  /** send data of the matrix to an ostream
   *
   *  \param os An output stream
   *  \param sm a SiconosMatrix
   *  \return The same output stream
   */
  friend std::ostream& operator<<(std::ostream& os, const SiconosMatrix& sm);

  /** multiply the current matrix with a scalar
   *
   *  \param m the matrix to operate on
   *  \param s the scalar
   *  \return SiconosMatrix&
   */
  friend SiconosMatrix& operator *=(SiconosMatrix& m, const double& s);

  /** divide the current matrix with a scalar
   *
   *  \param m the matrix to operate on
   *  \param s the scalar
   *  \return SiconosMatrix&
   */
  friend SiconosMatrix& operator /=(SiconosMatrix& m, const double& s);

};

#endif


text:
package org.apache.flink.table.descriptors;

import org.apache.flink.streaming.connectors.kafka.partitioner.FlinkFixedPartitioner;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;

/**
 * Tests for the {@link Kafka} descriptor.
 */
public class KafkaTest extends DescriptorTestBase {

	@Override
	public List<Descriptor> descriptors() {
		final Descriptor earliestDesc =
			new Kafka()
				.version("0.8")
				.startFromEarliest()
				.topic("WhateverTopic");

		final Descriptor specificOffsetsDesc =
			new Kafka()
				.version("0.11")
				.topic("MyTable")
				.startFromSpecificOffset(0, 42L)
				.startFromSpecificOffset(1, 300L)
				.property("zookeeper.stuff", "12")
				.property("kafka.stuff", "42");

		final Map<Integer, Long> offsets = new HashMap<>();
		offsets.put(0, 42L);
		offsets.put(1, 300L);

		final Properties properties = new Properties();
		properties.put("zookeeper.stuff", "12");
		properties.put("kafka.stuff", "42");

		final Descriptor specificOffsetsMapDesc =
			new Kafka()
				.version("0.11")
				.topic("MyTable")
				.startFromSpecificOffsets(offsets)
				.properties(properties)
				.sinkPartitionerCustom(FlinkFixedPartitioner.class);

		return Arrays.asList(earliestDesc, specificOffsetsDesc, specificOffsetsMapDesc);
	}

	@Override
	public List<Map<String, String>> properties() {
		final Map<String, String> props1 = new HashMap<>();
		props1.put("connector.property-version", "1");
		props1.put("connector.type", "kafka");
		props1.put("connector.version", "0.8");
		props1.put("connector.topic", "WhateverTopic");
		props1.put("connector.startup-mode", "earliest-offset");

		final Map<String, String> props2 = new HashMap<>();
		props2.put("connector.property-version", "1");
		props2.put("connector.type", "kafka");
		props2.put("connector.version", "0.11");
		props2.put("connector.topic", "MyTable");
		props2.put("connector.startup-mode", "specific-offsets");
		props2.put("connector.specific-offsets.0.partition", "0");
		props2.put("connector.specific-offsets.0.offset", "42");
		props2.put("connector.specific-offsets.1.partition", "1");
		props2.put("connector.specific-offsets.1.offset", "300");
		props2.put("connector.properties.0.key", "zookeeper.stuff");
		props2.put("connector.properties.0.value", "12");
		props2.put("connector.properties.1.key", "kafka.stuff");
		props2.put("connector.properties.1.value", "42");

		final Map<String, String> props3 = new HashMap<>();
		props3.put("connector.property-version", "1");
		props3.put("connector.type", "kafka");
		props3.put("connector.version", "0.11");
		props3.put("connector.topic", "MyTable");
		props3.put("connector.startup-mode", "specific-offsets");
		props3.put("connector.specific-offsets.0.partition", "0");
		props3.put("connector.specific-offsets.0.offset", "42");
		props3.put("connector.specific-offsets.1.partition", "1");
		props3.put("connector.specific-offsets.1.offset", "300");
		props3.put("connector.properties.0.key", "zookeeper.stuff");
		props3.put("connector.properties.0.value", "12");
		props3.put("connector.properties.1.key", "kafka.stuff");
		props3.put("connector.properties.1.value", "42");
		props3.put("connector.sink-partitioner", "custom");
		props3.put("connector.sink-partitioner-class", FlinkFixedPartitioner.class.getName());

		return Arrays.asList(props1, props2, props3);
	}

	@Override
	public DescriptorValidator validator() {
		return new KafkaValidator();
	}
}


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	>
<Button
	android:id="@+id/insert"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:onClick="mOnClick"
	android:text="Insert"
	/>
<Button
	android:id="@+id/delete"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:onClick="mOnClick"
	android:text="Delete"
	/>
<Button
	android:id="@+id/update"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:onClick="mOnClick"
	android:text="Update"
	/>
<Button
	android:id="@+id/select"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:onClick="mOnClick"
	android:text="Select"
	/>
<EditText
	android:id="@+id/edittext"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	/>
</LinearLayout>


text:
/*-------------------------------------------------------------------------------
 This file is part of Ranger.

 Ranger is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 Ranger is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Ranger. If not, see <http://www.gnu.org/licenses/>.

 Written by:

 Marvin N. Wright
 Institut für Medizinische Biometrie und Statistik
 Universität zu Lübeck
 Ratzeburger Allee 160
 23562 Lübeck
 Germany

 http://www.imbs-luebeck.de
 #-------------------------------------------------------------------------------*/

#ifndef TREE_H_
#define TREE_H_

#include <vector>
#include <random>
#include <iostream>

#include "RangerLib/globals.h"
#include "RangerLib/utility/Data.h"

class Tree {
public:
  Tree();

  // Create from loaded forest
  Tree(std::vector<std::vector<size_t>>& child_nodeIDs, std::vector<size_t>& split_varIDs,
      std::vector<double>& split_values);

  virtual ~Tree();

  void init(Data* data, uint mtry, size_t dependent_varID, size_t num_samples, uint seed,
      std::vector<size_t>* deterministic_varIDs, std::vector<size_t>* split_select_varIDs,
      std::vector<double>* split_select_weights, ImportanceMode importance_mode, uint min_node_size,
      bool sample_with_replacement, bool memory_saving_splitting, SplitRule splitrule,
      std::vector<double>* case_weights, bool keep_inbag, double sample_fraction, double alpha, double minprop,
      bool holdout, uint num_random_splits);

  virtual void initInternal() = 0;

  void grow(std::vector<double>* variable_importance);

  void predict(const Data* prediction_data, bool oob_prediction);

  void computePermutationImportance(std::vector<double>* forest_importance, std::vector<double>* forest_variance);

  void appendToFile(std::ofstream& file);
  virtual void appendToFileInternal(std::ofstream& file) = 0;

  const std::vector<std::vector<size_t> >& getChildNodeIDs() const {
    return child_nodeIDs;
  }
  const std::vector<double>& getSplitValues() const {
    return split_values;
  }
  const std::vector<size_t>& getSplitVarIDs() const {
    return split_varIDs;
  }

  const std::vector<size_t>& getOobSampleIDs() const {
    return oob_sampleIDs;
  }
  size_t getNumSamplesOob() const {
    return num_samples_oob;
  }

  const std::vector<size_t>& getInbagCounts() const {
    return inbag_counts;
  }

protected:
  void createPossibleSplitVarSubset(std::vector<size_t>& result);

  bool splitNode(size_t nodeID);
  virtual bool splitNodeInternal(size_t nodeID, std::vector<size_t>& possible_split_varIDs) = 0;

  void createEmptyNode();
  virtual void createEmptyNodeInternal() = 0;

  size_t dropDownSamplePermuted(size_t permuted_varID, size_t sampleID, size_t permuted_sampleID);
  void permuteAndPredictOobSamples(size_t permuted_varID, std::vector<size_t>& permutations);

  virtual double computePredictionAccuracyInternal() = 0;

  void bootstrap();
  void bootstrapWithoutReplacement();

  void bootstrapWeighted();
  void bootstrapWithoutReplacementWeighted();

  virtual void cleanUpInternal() = 0;

  size_t dependent_varID;
  uint mtry;

  // Number of samples (all samples, not only inbag for this tree)
  size_t num_samples;

  // Number of OOB samples
  size_t num_samples_oob;

  // Minimum node size to split, like in original RF nodes of smaller size can be produced
  uint min_node_size;

  // Weight vector for selecting possible split variables, one weight between 0 (never select) and 1 (always select) for each variable
  // Deterministic variables are always selected
  std::vector<size_t>* deterministic_varIDs;
  std::vector<size_t>* split_select_varIDs;
  std::vector<double>* split_select_weights;

  // Bootstrap weights
  std::vector<double>* case_weights;

  // Splitting variable for each node
  std::vector<size_t> split_varIDs;

  // Value to split at for each node, for now only binary split
  // For terminal nodes the prediction value is saved here
  std::vector<double> split_values;

  // Vector of left and right child node IDs, 0 for no child
  std::vector<std::vector<size_t>> child_nodeIDs;

  // For each node a vector with IDs of samples in node
  std::vector<std::vector<size_t>> sampleIDs;

  // IDs of OOB individuals, sorted
  std::vector<size_t> oob_sampleIDs;

  // Holdout mode
  bool holdout;

  // Inbag counts
  bool keep_inbag;
  std::vector<size_t> inbag_counts;

  // Random number generator
  std::mt19937_64 random_number_generator;

  // Pointer to original data
  Data* data;

  // Variable importance for all variables
  std::vector<double>* variable_importance;
  ImportanceMode importance_mode;

  // When growing here the OOB set is used
  // Terminal nodeIDs for prediction samples
  std::vector<size_t> prediction_terminal_nodeIDs;

  bool sample_with_replacement;
  double sample_fraction;

  bool memory_saving_splitting;
  SplitRule splitrule;
  double alpha;
  double minprop;
  uint num_random_splits;

private:
  DISALLOW_COPY_AND_ASSIGN(Tree);
};

#endif /* TREE_H_ */


text:
class IOThread;

namespace net {
class SingleRequestHostResolver;
}

// Base class for web socket proxy functions.
class WebSocketProxyPrivate
    : public AsyncExtensionFunction, public content::NotificationObserver {
 public:
  WebSocketProxyPrivate();
  virtual ~WebSocketProxyPrivate();

 protected:
  // Custom finalization.
  virtual void CustomFinalize() = 0;

  // ExtensionFunction implementation.
  virtual bool RunImpl() OVERRIDE;

  // content::NotificationObserver implementation.
  virtual void Observe(
      int type, const content::NotificationSource& source,
      const content::NotificationDetails& details) OVERRIDE;

  // Destination hostname.
  std::string hostname_;
  // Destination IP address.
  net::AddressList addr_;
  // Destination port.
  int port_;
  // Proxy accepts websocket connections on this port.
  int listening_port_;
  // Whether TLS should be used.
  bool do_tls_;
  // Requested parameters of connection.
  std::map<std::string, std::string> map_;

 private:
  // Finalizes and sends respond. Overwrite 'CustomFinalize' in inherited
  // classes.
  void Finalize();

  // Callback for DNS resolution.
  void OnHostResolution(int result);

  // Posts task to the IO thread, which will make dns resolution.
  void ResolveHost();
  // Executes on IO thread. Performs DNS resolution.
  void ResolveHostIOPart(IOThread* io_thread);

  // Used to signal timeout (when waiting for proxy initial launch).
  base::OneShotTimer<WebSocketProxyPrivate> timer_;
  // Used to register for notifications.
  content::NotificationRegistrar registrar_;
  // Used to cancel host resolution when out of scope.
  scoped_ptr<net::SingleRequestHostResolver> resolver_;
  // Callback which is called when host is resolved.
  bool is_finalized_;
};

// New API function for web socket proxy, which should be used.
class WebSocketProxyPrivateGetURLForTCPFunction
    : public WebSocketProxyPrivate {
 public:
  WebSocketProxyPrivateGetURLForTCPFunction();
  virtual ~WebSocketProxyPrivateGetURLForTCPFunction();

 private:
  // ExtensionFunction implementation.
  virtual bool RunImpl() OVERRIDE;

  // WebSocketProxyPrivate implementation:
  virtual void CustomFinalize() OVERRIDE;

  DECLARE_EXTENSION_FUNCTION_NAME("webSocketProxyPrivate.getURLForTCP")
};

// Legacy API function for web socket proxy, to be eliminated.
class WebSocketProxyPrivateGetPassportForTCPFunction
    : public WebSocketProxyPrivate {
 public:
  WebSocketProxyPrivateGetPassportForTCPFunction();
  virtual ~WebSocketProxyPrivateGetPassportForTCPFunction();

 private:
  // WebSocketProxyPrivate implementation:
  virtual void CustomFinalize() OVERRIDE;

  DECLARE_EXTENSION_FUNCTION_NAME("webSocketProxyPrivate.getPassportForTCP")
};

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_SOCKET_PROXY_PRIVATE_API_H_


text:
package RocketLauncher::View::Web::JSON;

use strict;
use base 'Catalyst::View::JSON';

=head1 NAME

RocketLauncher:View::Web::JSON - Catalyst JSON View

=head1 SYNOPSIS

See L<RocketLauncher>

=head1 DESCRIPTION

Catalyst JSON View.

=head1 AUTHOR

A clever guy

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;


text:
=pod

=head1 NAME

EVP_KEYEXCH-X25519,
EVP_KEYEXCH-X448
- X25519 and X448 Key Exchange algorithm support

=head1 DESCRIPTION

Key exchange support for the B<X25519> and B<X448> key types.

=head2 Key exchange parameters

=over 4

=item "pad" (B<OSSL_EXCHANGE_PARAM_PAD>) <unsigned integer>

See L<provider-keyexch(7)/Common Key Exchange parameters>.

=back

=head1 EXAMPLES

Keys for the host and peer can be generated as shown in
L<EVP_PKEY-X25519(7)/Examples>.

The code to generate a shared secret is identical to
L<EVP_KEYEXCH-DH(7)/Examples>.

=head1 SEE ALSO

L<EVP_PKEY-FFC(7)>,
L<EVP_PKEY-DH(7)>
L<EVP_PKEY(3)>,
L<provider-keyexch(7)>,
L<provider-keymgmt(7)>,
L<OSSL_PROVIDER-default(7)>,
L<OSSL_PROVIDER-FIPS(7)>,

=head1 COPYRIGHT

Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License").  You may not use
this file except in compliance with the License.  You can obtain a copy
in the file LICENSE in the source distribution or at
L<https://www.openssl.org/source/license.html>.

=cut


text:
class Kul::Processor < Sinatra::Base

  settings = Kul.settings
  settings.set_options(self)

  get '/favicon.ico' do
    send_file 'favicon.ico'
  end

  get '/*' do |path|
    handle_action path, :GET
  end

  post '/*' do |path|
    handle_action path, :POST
  end

  put '/*' do |path|
    handle_action path, :PUT
  end

  delete '/*' do |path|
    handle_action path, :DELETE
  end

  def handle_action(path, verb)
    stuff = { path: path, params: params, processor: self, verb: verb }
    stuff[:session] = session if Kul.settings.enable_sessions
    request = Kul::FrameworkFactory.create_request stuff
    response = request.handle
    content_type response.content_type if response.respond_to? :content_type
    return response.render if response.respond_to? :render
    response.to_s
  rescue => e
    # TODO: replace this with logging
    puts "Recieved error: #{e.to_s}"
    puts e.backtrace
    ResponseError.new(message: e.to_s).render
  end

end