text:
function fusedImg= imagesFusion(imgCell, varargin)
%% imagesFusion
% Combine/Fuse/Mix images together with user defined weighting/opasity.
%
%% Syntax
% imagesFusion({img_1, img_2, img_3,... }); % user will be prompted for mask definition
% imagesFusion({img_1, img_2, img_3,... }, {mask_1, mask_2, mask_3,...});
%
%% Description
% This is a small function designed to fuse/blend images together. We have found it to be
%  handy in several cases- both for images and videos (see Example III for videos fusion).
%  It can be used for comparing several image processing methods, applied to an image.
%  While image processing algorithms are frequently evaluated by comparing resulting
%  images side  by side, via concatenation or subplot it results in large images. The
%  proposed function allows presenting several methods, each applied to a user defined
%  region of the image,  so several methods are evaluated on a single image. This is
%  expected to be even better for videos, where camera motion will result in scene
%  migrations between areas. We have found this function to be useful in generation of
%  test images for segmentation algorithms evaluation. Several texture images were
%  combined in a mosaic, subject to further segmentation. This function can be used for
%  combinations of different images, though we believe imagesMixture to be a more
%  appropriate function for this task. While having only a few inputs parameters, the
%  function allows the user to control the region of each image, and the inter-image
%  opacities, so both soft and sharp margins are possible.
%
%% Input arguments (defaults exist):
% imgCell-    a cell array of images, subject t blending. The images should be of same
%    dimentions (height, wifth and number of colors) and class. If images size and class
%    vary, all will be comnverted to maximal image dimanetions prior tp blending. This may
%    result in image impairment...
%
% The following inputs must be specified by a "inputName"- "inputValue" pairs.
%
% isDrawnMasks- a logicla flag enabling the generation of blendMatrixCell via user drawing
%    each missing region.
% blendMatrixCell- a cell array of blending matrixes. As in case of images, blending
%    matrixes are expected to be of same dimentions, though different cases are taken care
%    of. The matrixes values should be floating type with values [0:1]. Basing on those
%    values, new image will be blended into curren mosaic. By using value between 0 and 1
%    user can achieve soft meargins and varying image blendings. It is assumed that the
%    first image will be fully integarted into the mosaic (to avoid empty spots), though
%    this rule can be override, by explicit declaration of fisrt blendMatrixCell element.
%    In case of missing blending matrixes, an automated mask will be generated, or user
%    will be prompted to draw a mask, while previous mask will be presented for his
%    convinince. It is expected that the number of blendMatrixCell elements will be same
%    as number of input images or one less. In the later case, first image will be fully
%    utilised (it's blending matrix will be all ones).
% isDrawLine- a logical varibale drawing a line on regions bordres when enabled (true).
% lineWidth- the width (in pixels) of the line drawn when 'isDrawLine' is enabled.
%
%% Output arguments
%   fusedImg- a resuting image of same type as MAJORITY of inputa images, and of
%     dimentions of maximal image, incorpoating all input images (imgCell), blended
%     accourding to the blendMatrixCell.
%
%% Issues & Comments
% Get 'mask2poly' function (http://www.mathworks.com/matlabcentral/fileexchange/32112-mask2poly)
% and 'addMarkerLines2Img' function (http://www.mathworks.com/matlabcentral/fileexchange/37427-plot-on-an-image-addmarkerlines2img)
% to use 'isDrawLine' mode.
%
%% Example I
% img1=imread('peppers.png');
% img2=imread('cameraman.tif');
%
% fusedImg= imagesFusion({img1, img2});
% figure;
% imshow(fusedImg);
% title('Fusion based on a predefined mask');
%
% mask1=false( size(img1, 1), size(img1, 2) );
% mask1(:, round(size(img1, 2)/2):end )=true;
% softFilt=ones(1,25);
% softFilt=softFilt/sum(softFilt(:));
% maskSoftEdge=imfilter(double(mask1), softFilt, 'same', 'symmetric');
% fusedImg= imagesFusion({img1, img2}, 'blendMatrixCell', {maskSoftEdge});
% figure;
% imshow(fusedImg);
% title('Fusion based on a predefined mask with SOFT edges');
%
%% Example II
% img=imread('peppers.png');
%
% H = fspecial('disk', 20);
% blurred = imfilter(img, H, 'replicate');
%
% noisy = imnoise(img,'gaussian', 0, 0.005);
%
% fusedImg= imagesFusion({img, blurred, noisy}, 'isDrawnMasks', true,...
%  'isDrawLine', true, 'lineWidth', 2);
% figure;
% imshow(fusedImg);
% title('Fusion of "peppers" image [original, blurred, noised]');
%
%% Example III (fusion application to Videos)
% % note apply2VideoFrames must be avalible
% % ( http://www.mathworks.com/matlabcentral/fileexchange/32351-apply2videoframes )
% % no other input video files in Matlab default path was found
% matlabVfile1='rhinos.avi';
% matlabVfile2='xylophone.mpg';
% % generated via drawBlenMaskCellArray, and added to this contribution
% load('myMask.mat');
% % Use drawBlenMaskCellArray to generate ROI's applied to multiple images/videos
% outVideoFileFuse12=apply2VideoFrames('inVideo', {matlabVfile2, matlabVfile1},...
%    'isSaveAllFrames', false, 'hAppliedFunc', @imagesFusion, 'isCellInput', true,...
%    'PARAMS', 'blendMatrixCell', blendMaskCell);
% implay(outVideoFileFuse12);
%
%% See also
% - subplot
% - imagesMixture    % an alternative way to combine images
%    http://www.mathworks.com/matlabcentral/fileexchange/36749-images-blendingmixturephotomontage
% - concatVideo2D    % an alternatove way to compare videos
%    http://www.mathworks.com/matlabcentral/fileexchange/33951-concatenate-video-files-subplot-style
%
%% Revision history
% First version: Nikolay S. 2012-07-08.
% Last update:   Nikolay S. 2012-07-04.
%
% *List of Changes:*
% 2012-07-09
% - isDrawLine added- to enables lines drawing around regions.
% 2012-07-08
% - An automated mask generation sub function added.
% - Video example added.
%

%% Default variables
isDrawLine=false;
isDrawnMasks=false;
blendMatrixCell=[];
lineWidth=1;

%% Load uses params, overifding default ones
if nargin>1
   for iArg=1:2:length(varargin) % automatically get all input pairs and store in local vairables
      assignin_value(varargin{iArg}, varargin{iArg+1});
   end
end

%% local params
calcClass='double'; % numeric class used thorugth caculations/filtering etc...
% Can be replced by single, float32 etc, to improve speed
lineClr={'r', 'g', 'b', 'm', 'c', 'k', 'y'}; % colors for plotting lines around regions

%% Investigate inputs- dimentions and classes

imgH = cellfun('size', imgCell, 1);
imgW = cellfun('size', imgCell, 2);
imgClr = cellfun('size', imgCell, 3);
maxH=max(imgH);
maxW=max(imgW);
maxClr=max(imgClr);

%% find majority images class, to define output image class
imgClasses=cellfun(@class, imgCell, 'UniformOutput', false);
currTypes=unique(imgClasses);
classCount=0;
for iType=1:length(currTypes)
   currClassCount=sum(strcmpi(imgClasses, currTypes{iType}));
   if currClassCount>classCount
      classCount=currClassCount;
      commonClass=currTypes{iType};
   end
end

%% Take care of blendMatrixCell elements
nImages=length(imgCell);
if isempty(blendMatrixCell)
   if ~isDrawnMasks
      blendMatrixCell=generateBlenMasks(nImages, [maxH, maxW]);
   else
      blendMatrixCell={[]};
   end
end

nBlenMat=length(blendMatrixCell);
if nImages > nBlenMat % append with all ones blending- for the first image
   blendMatrixCell=cat(1, ones([maxH, maxW], calcClass), blendMatrixCell);
   nBlenMat=nBlenMat+1;
   if nImages > nBlenMat % if appending was not enougth, add empty cells
      tmpBlendMatrixCell=blendMatrixCell;
      blendMatrixCell=cell(1, nImages);
      blendMatrixCell(1:nBlenMat)=tmpBlendMatrixCell;
   end

   fusedImg=cast(imresize(imgCell{1}, [maxH, maxW]), calcClass); % init fusedImg with first image
   if size(fusedImg, 3)~=maxClr
      fusedImg=repmat(fusedImg, [1, 1, maxClr]);
   end
   iStartImg=2;
else
   fusedImg=zeros(maxH, maxW, maxClr, calcClass); % init fusedImg with zeros
   iStartImg=1;
end

for iImg=iStartImg:nImages
   % go thotugh all input images and blendign matrixes. Reshape is needed, and combine
   % together.
   %% bring blendMatrixCell elements to common size and type
   currBlendMat=blendMatrixCell{iImg};
   currBlendMat=min(currBlendMat, 1);
   currBlendMat=max(currBlendMat, 0);
   if isempty(currBlendMat) % if an empty mask are detected- fill the gap!
      currBlendMat=drawBlenMask(blendMatrixCell(1:(iImg-1)),[maxH, maxW]);
      blendMatrixCell{iImg}=currBlendMat; % store to present during next drawings
   end
   if size(currBlendMat, 1)~=maxH || size(currBlendMat, 2)~=maxW
      % blend matrix must have appropriate dimentions (height width)
      currBlendMat=imresize(currBlendMat, [maxH, maxW], 'nearest');
   end
   if size(currBlendMat, 3)~=maxClr
      % blend matrix must have appropriate number of color dimentions
      currBlendMat=repmat(currBlendMat, [1, 1, maxClr]);
   end
   if ~strcmpi(class(currBlendMat), calcClass) % Convert blend matrix to float
      currBlendMat=cast(currBlendMat, calcClass);
   end

   %% bring imgCell images to common size and type
   currImg=imgCell{iImg};
   if size(currImg, 1)~=maxH || size(currImg, 2)~=maxW
      currImg=imresize(currImg, [maxH, maxW]); % resize image if needed
   end
   if size(currImg, 3)~=maxClr
      currImg=repmat(currImg, [1, 1, maxClr]); % convert to RGB if needed
   end
   if ~strcmpi(class(currImg), calcClass) % Convert blend matrix to float, if non-float
      currImg=cast(currImg, calcClass);
   end
   %
   %Fuse current image, using current blend matrix
   fusedImg=(1-currBlendMat).*fusedImg + currBlendMat.*currImg;
   if isDrawLine
      if exist('mask2poly', 'file')~=2
         warning('To use ''isDrawLine'' mode add mask2poly to Matlab path.');
      end
      if exist('addMarkerLines2Img', 'file')~=2
         warning('To use ''isDrawLine'' mode add addMarkerLines2Img to Matlab path.');
      end

      if exist('mask2poly', 'file')==2 && exist('addMarkerLines2Img', 'file')==2
         lineTraj=mask2poly(currBlendMat(:,:,1)>0, 'Inner', 'None');
         lineTraj=fliplr(lineTraj); % X-Y Cols-Raws issue
         fusedImg=addMarkerLines2Img( fusedImg, lineTraj , lineWidth,...
            lineClr{1+mod( iImg, length(lineClr) )} );
      end % if isDrawLine
   end % if isDrawLine
end % for iImg=iStartImg:nImages

% cast resulting image to class presnt in majotiry of input images
if ~strcmpi(commonClass, calcClass)
   fusedImg=cast(fusedImg, commonClass);
end

%% Servise functions

function currBlendMask=drawBlenMask(blendMaskCell, maskDim)
% generate user defined masks
nBlendMask=length(blendMaskCell);
prevMaskMat=zeros(maskDim, 'uint8');

for iMask=1:nBlendMask
   prevMaskMat(blendMaskCell{iMask}>0)=iMask;
end

figH=figure;
imshow(prevMaskMat, []);
% title({'Select ROI by left clicking mouse and moving the pointer around.',...
%    'Release to finish.'},...
%    'FontSize', 18, 'Color', [1,0,0]);
text(0.5, 0.9, {'Select ROI by left clicking mouse', 'and moving the pointer around.',...
   'Release to finish.'}, 'FontSize', 16, 'Color', [1,0,0],...
   'HorizontalAlignment', 'center', 'Units', 'normalized');

imfreehandH=imfreehand;
currBlendMask=createMask(imfreehandH);
delete(imfreehandH);
close(figH);

function blendMatrixCell=generateBlenMasks(nMasks, maskSize)
% generated automated mask- diivde image into "Pie" style slices.
x=linspace(-1, 1, maskSize(1));
y=linspace(-1, 1, maskSize(2));
[X,Y] = meshgrid(x,y);
Theta=mod(180+90+atan2(Y, X)/pi*180, 360); % make Y axis direction=0°,
% convert all values to be 0:360, and begin from left side
slsieRes=360/nMasks;
blendMatrixCell=cell(1, nMasks);
% maskMat=zeros(maskSize);
for iSlise=1:nMasks
   blendMatrixCell{iSlise}=Theta>(iSlise-1)*slsieRes & Theta<=iSlise*slsieRes;
   %    maskMat(blendMatrixCell{iSlise})=iSlise;
end

% figure;
% imshow(maskMat, []);


text:
class User < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,
         :confirmable, :lockable, :timeoutable

  # Setup accessible (or protected) attributes for your model
#  attr_accessible :email, :password, :password_confirmation, :remember_me,
#                  :is_admin, :gets_daily_dharma
  # attr_accessible :title, :body
  #

  validates :is_admin, :inclusion => [true, false]
  validates :gets_daily_dharma, :inclusion => [true, false]
end

redpajama_set_name: RedPajamaGithub


text:
package com.auto.test.service;

import java.util.Date;
import java.util.List;
import javax.transaction.Transactional;
import com.auto.test.entity.AResult;

@Transactional
public interface IApiResultService{

	List<AResult> findAll();

	List<AResult> findByProjectVersionTime(Integer pid, Integer vid, Date startTime, Date endTime);

	AResult findById(Integer id);

	Integer create(AResult aResult);

	AResult update(AResult aResult);

	void delete(Integer id);

}


text:
package org.onosproject.ovsdb.rfc.schema;

import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;

import java.util.Map;
import java.util.Objects;
import java.util.Set;

/**
 * A schema for the database represented by database-schema, which consists of
 * a set of tables.
 */
public final class DatabaseSchema {

    private final String name;
    private final String version;
    private final Map<String, TableSchema> tableSchemas;

    /**
     * Constructs a DatabaseSchema object.
     * @param name the name of database
     * @param version the version of database
     * @param tableSchemas a map of TableSchema
     */
    public DatabaseSchema(String name, String version,
                          Map<String, TableSchema> tableSchemas) {
        checkNotNull(name, "name cannot be null");
        checkNotNull(version, "version cannot be null");
        checkNotNull(tableSchemas, "tableSchemas cannot be null");
        this.name = name;
        this.version = version;
        this.tableSchemas = tableSchemas;
    }

    /**
     * Returns the name of database.
     * @return the name of database
     */
    public String name() {
        return name;
    }

    /**
     * Returns the version of database.
     * @return the version of database
     */
    public String version() {
        return version;
    }

    /**
     * Returns a map of TableSchema.
     * @return a map of TableSchema
     */
    public Map<String, TableSchema> tableSchemas() {
        return tableSchemas;
    }

    /**
     * Returns a set of table name.
     * @return a set of table name
     */
    public Set<String> getTableNames() {
        return this.tableSchemas.keySet();
    }

    /**
     * Determine whether contain the table.
     * @param tableName table name
     * @return boolean
     */
    public boolean hasTable(String tableName) {
        return this.getTableNames().contains(tableName);
    }

    /**
     * Returns the TableSchema whose name is the tableName.
     * @param tableName table name
     * @return TableSchema
     */
    public TableSchema getTableSchema(String tableName) {
        TableSchema table = tableSchemas.get(tableName);
        return table;
    }

    /**
     * generate initialization columns in each table namely _uuid and _version.
     */
    public void generateInitializationColumns() {
        for (TableSchema tableSchema : tableSchemas.values()) {
            tableSchema.generateInitializationColumns();
        }
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, version, tableSchemas);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof DatabaseSchema) {
            final DatabaseSchema other = (DatabaseSchema) obj;
            return Objects.equals(this.name, other.name)
                    && Objects.equals(this.version, other.version)
                    && Objects.equals(this.tableSchemas, other.tableSchemas);
        }
        return false;
    }

    @Override
    public String toString() {
        return toStringHelper(this).add("name", name).add("version", version)
                .add("tableSchemas", tableSchemas).toString();
    }
}


text:
var subjectFactory = require('./subject/factory');
var ThrowStrategy = require('./strategy/throwStrategy');

module.exports = subjectFactory.newSubject.bind(subjectFactory, new ThrowStrategy());


text:
package com.rbmhtechnology.vind.api.result;

/**
 * Created on 05.04.18.
 */
public class DeleteResult {

    private final Long queryTime;
    private Long elapsedTime;

    public DeleteResult(Long queryTime) {
        this.queryTime = queryTime;
    }

    public Long getQueryTime() {
        return queryTime;
    }

    public Long getElapsedTime() {
        return elapsedTime;
    }

    public DeleteResult setElapsedTime(Long elapsedTime) {
        this.elapsedTime = elapsedTime;
        return this;
    }
}


text:
package de.atomfrede.jenkins.view;

import de.atomfrede.jenkins.domain.AnalysisResult;
import de.atomfrede.jenkins.domain.Checkstyle;
import de.atomfrede.jenkins.domain.DuplicatedCode;
import de.atomfrede.jenkins.domain.Findbugs;

public class MetricsBuild {

	private AnalysisResult currentAnalysisResult, lastAnalysisResult;

	private Findbugs currentFindbugsResult, lastFindbugsResult;

	private Checkstyle currentCheckstyleResult, lastCheckstyleResult;

	private DuplicatedCode currentDry, lastDry;

	public void initWithEmptyResults() {
		currentAnalysisResult = new AnalysisResult();
		lastAnalysisResult = new AnalysisResult();

		currentAnalysisResult = new Findbugs();
		lastFindbugsResult = new Findbugs();

		currentCheckstyleResult = new Checkstyle();
		lastCheckstyleResult = new Checkstyle();

		currentDry = new DuplicatedCode();
		lastDry = new DuplicatedCode();
	}

	public AnalysisResult getCurrentAnalysisResult() {
		return currentAnalysisResult;
	}

	public void setCurrentAnalysisResult(AnalysisResult currentAnalysisResult) {
		this.currentAnalysisResult = currentAnalysisResult;
	}

	public AnalysisResult getLastAnalysisResult() {
		return lastAnalysisResult;
	}

	public void setLastAnalysisResult(AnalysisResult lastAnalysisResult) {
		this.lastAnalysisResult = lastAnalysisResult;
	}

	public Findbugs getCurrentFindbugsResult() {
		return currentFindbugsResult;
	}

	public void setCurrentFindbugsResult(Findbugs currentFindbugsResult) {
		this.currentFindbugsResult = currentFindbugsResult;
	}

	public Findbugs getLastFindbugsResult() {
		return lastFindbugsResult;
	}

	public void setLastFindbugsResult(Findbugs lastFindbugsResult) {
		this.lastFindbugsResult = lastFindbugsResult;
	}

	public Checkstyle getCurrentCheckstyleResult() {
		return currentCheckstyleResult;
	}

	public void setCurrentCheckstyleResult(Checkstyle currentCheckstyleResult) {
		this.currentCheckstyleResult = currentCheckstyleResult;
	}

	public Checkstyle getLastCheckstyleResult() {
		return lastCheckstyleResult;
	}

	public void setLastCheckstyleResult(Checkstyle lastCheckstyleResult) {
		this.lastCheckstyleResult = lastCheckstyleResult;
	}

	public DuplicatedCode getCurrentDry() {
		return currentDry;
	}

	public void setCurrentDry(DuplicatedCode currentDry) {
		this.currentDry = currentDry;
	}

	public DuplicatedCode getLastDry() {
		return lastDry;
	}

	public void setLastDry(DuplicatedCode lastDry) {
		this.lastDry = lastDry;
	}
}


text:
package test

import (
	"context"
	"net/url"
	"os"
	"strings"
	"testing"

	"github.com/flimzy/kivik"
	"github.com/go-kivik/kiviktest"
	"github.com/go-kivik/kiviktest/kt"
	"github.com/gopherjs/gopherjs/js"
)

func init() {
	if pouchDB := js.Global.Get("PouchDB"); pouchDB != js.Undefined {
		memPouch := js.Global.Get("PouchDB").Call("defaults", map[string]interface{}{
			"db": js.Global.Call("require", "memdown"),
		})
		js.Global.Set("PouchDB", memPouch)
	}
}

// RegisterPouchDBSuites registers the PouchDB test suites.
func RegisterPouchDBSuites() {
	kiviktest.RegisterSuite(kiviktest.SuitePouchLocal, kt.SuiteConfig{
		"PreCleanup.skip": true,

		// Features which are not supported by PouchDB
		"Log.skip":         true,
		"Flush.skip":       true,
		"Security.skip":    true, // FIXME: Perhaps implement later with a plugin?
		"SetSecurity.skip": true, // FIXME: Perhaps implement later with a plugin?
		"DBUpdates.skip":   true,

		"AllDBs.skip":   true, // FIXME: Find a way to test with the plugin
		"CreateDB.skip": true, // FIXME: No way to validate if this works unless/until allDbs works
		"DBExists.skip": true, // FIXME: Maybe fix this if/when allDBs works?

		"AllDocs/Admin.databases":                        []string{},
		"AllDocs/RW/group/Admin/WithDocs/UpdateSeq.skip": true,

		"Find/Admin.databases":                []string{},
		"Find/RW/group/Admin/Warning.warning": "no matching index found, create an index to optimize query time",

		"Explain.databases": []string{},
		"Explain.plan": &kivik.QueryPlan{
			Index: map[string]interface{}{
				"ddoc": nil,
				"name": "_all_docs",
				"type": "special",
				"def":  map[string]interface{}{"fields": []interface{}{map[string]string{"_id": "asc"}}},
			},
			Selector: map[string]interface{}{"_id": map[string]interface{}{"$gt": nil}},
			Options: map[string]interface{}{
				"bookmark":  "nil",
				"conflicts": false,
				"r":         []int{49},
				"sort":      map[string]interface{}{},
				"use_index": []interface{}{},
			},
			Range: map[string]interface{}{
				"start_key": nil,
			},
		},

		"Query/RW/group/Admin/WithDocs/UpdateSeq.skip": true,

		"Version.version":        `^6\.\d\.\d$`,
		"Version.vendor":         `^PouchDB$`,
		"Version.vendor_version": `^6\.\d\.\d$`,

		"Get/RW/group/Admin/bogus.status":  kivik.StatusNotFound,
		"Get/RW/group/NoAuth/bogus.status": kivik.StatusNotFound,

		"Rev/RW/group/Admin/bogus.status":  kivik.StatusNotFound,
		"Rev/RW/group/NoAuth/bogus.status": kivik.StatusNotFound,

		"Delete/RW/Admin/group/MissingDoc.status":       kivik.StatusNotFound,
		"Delete/RW/Admin/group/InvalidRevFormat.status": kivik.StatusBadRequest,
		"Delete/RW/Admin/group/WrongRev.status":         kivik.StatusConflict,

		"Stats/Admin.skip": true, // No predefined DBs for Local PouchDB

		"BulkDocs/RW/Admin/group/Mix/Conflict.status": kivik.StatusConflict,

		"GetAttachment/RW/group/Admin/foo/NotFound.status": kivik.StatusNotFound,

		"GetAttachmentMeta/RW/group/Admin/foo/NotFound.status": kivik.StatusNotFound,

		"PutAttachment/RW/group/Admin/Conflict.status": kivik.StatusConflict,

		// "DeleteAttachment/RW/group/Admin/NotFound.status": kivik.StatusNotFound, // https://github.com/pouchdb/pouchdb/issues/6409
		"DeleteAttachment/RW/group/Admin/NoDoc.status": kivik.StatusNotFound,

		"Put/RW/Admin/group/LeadingUnderscoreInID.status": kivik.StatusBadRequest,
		"Put/RW/Admin/group/Conflict.status":              kivik.StatusConflict,

		"CreateIndex/RW/Admin/group/EmptyIndex.status":   kivik.StatusInternalServerError,
		"CreateIndex/RW/Admin/group/BlankIndex.status":   kivik.StatusBadRequest,
		"CreateIndex/RW/Admin/group/InvalidIndex.status": kivik.StatusInternalServerError,
		"CreateIndex/RW/Admin/group/NilIndex.status":     kivik.StatusInternalServerError,
		"CreateIndex/RW/Admin/group/InvalidJSON.status":  kivik.StatusBadRequest,

		"GetIndexes.databases": []string{},

		"DeleteIndex/RW/Admin/group/NotFoundDdoc.status": kivik.StatusNotFound,
		"DeleteIndex/RW/Admin/group/NotFoundName.status": kivik.StatusNotFound,

		"Replicate.skip": true, // No need to do this for both Local and Remote

		"Query/RW/group/Admin/WithoutDocs/ScanDoc.status": kivik.StatusBadRequest,
	})
	kiviktest.RegisterSuite(kiviktest.SuitePouchRemote, kt.SuiteConfig{
		// Features which are not supported by PouchDB
		"Log.skip":         true,
		"Flush.skip":       true,
		"Session.skip":     true,
		"Security.skip":    true, // FIXME: Perhaps implement later with a plugin?
		"SetSecurity.skip": true, // FIXME: Perhaps implement later with a plugin?
		"DBUpdates.skip":   true,

		"PreCleanup.skip": true,

		"AllDBs.skip": true, // FIXME: Perhaps a workaround can be found?

		"CreateDB/RW/NoAuth.status":         kivik.StatusUnauthorized,
		"CreateDB/RW/Admin/Recreate.status": kivik.StatusPreconditionFailed,

		"DBExists.databases":              []string{"_users", "chicken"},
		"DBExists/Admin/_users.exists":    true,
		"DBExists/Admin/chicken.exists":   false,
		"DBExists/NoAuth/_users.exists":   true,
		"DBExists/NoAuth/chicken.exists":  false,
		"DBExists/RW/group/Admin.exists":  true,
		"DBExists/RW/group/NoAuth.exists": true,

		"DestroyDB/RW/NoAuth/NonExistantDB.status": kivik.StatusNotFound,
		"DestroyDB/RW/Admin/NonExistantDB.status":  kivik.StatusNotFound,
		"DestroyDB/RW/NoAuth/ExistingDB.status":    kivik.StatusUnauthorized,

		"AllDocs.databases":                                  []string{"_replicator", "_users", "chicken"},
		"AllDocs/Admin/_replicator.expected":                 []string{"_design/_replicator"},
		"AllDocs/Admin/_replicator.offset":                   0,
		"AllDocs/Admin/_users.expected":                      []string{"_design/_auth"},
		"AllDocs/Admin/chicken.status":                       kivik.StatusNotFound,
		"AllDocs/NoAuth/_replicator.status":                  kivik.StatusUnauthorized,
		"AllDocs/NoAuth/_users.status":                       kivik.StatusUnauthorized,
		"AllDocs/NoAuth/chicken.status":                      kivik.StatusNotFound,
		"AllDocs/Admin/_replicator/WithDocs/UpdateSeq.skip":  true,
		"AllDocs/Admin/_users/WithDocs/UpdateSeq.skip":       true,
		"AllDocs/RW/group/Admin/WithDocs/UpdateSeq.skip":     true,
		"AllDocs/RW/group/Admin/WithoutDocs/UpdateSeq.skip":  true,
		"AllDocs/RW/group/NoAuth/WithDocs/UpdateSeq.skip":    true,
		"AllDocs/RW/group/NoAuth/WithoutDocs/UpdateSeq.skip": true,

		"Find.skip":        true, // Find doesn't work with CouchDB 1.6, which we use for these tests
		"Explain.skip":     true, // Find does't work with CouchDB 1.6, which we use for these tests
		"CreateIndex.skip": true, // Find doesn't work with CouchDB 1.6, which we use for these tests
		"GetIndexes.skip":  true, // Find doesn't work with CouchDB 1.6, which we use for these tests
		"DeleteIndex.skip": true, // Find doesn't work with CouchDB 1.6, which we use for these tests

		"Query/RW/group/Admin/WithDocs/UpdateSeq.skip":  true,
		"Query/RW/group/NoAuth/WithDocs/UpdateSeq.skip": true,

		"Version.version":        `^6\.\d\.\d$`,
		"Version.vendor":         `^PouchDB$`,
		"Version.vendor_version": `^6\.\d\.\d$`,

		"Get/RW/group/Admin/bogus.status":  kivik.StatusNotFound,
		"Get/RW/group/NoAuth/bogus.status": kivik.StatusNotFound,

		"Rev/RW/group/Admin/bogus.status":  kivik.StatusNotFound,
		"Rev/RW/group/NoAuth/bogus.status": kivik.StatusNotFound,

		"Delete/RW/Admin/group/MissingDoc.status":        kivik.StatusNotFound,
		"Delete/RW/Admin/group/InvalidRevFormat.status":  kivik.StatusBadRequest,
		"Delete/RW/Admin/group/WrongRev.status":          kivik.StatusConflict,
		"Delete/RW/NoAuth/group/MissingDoc.status":       kivik.StatusNotFound,
		"Delete/RW/NoAuth/group/InvalidRevFormat.status": kivik.StatusBadRequest,
		"Delete/RW/NoAuth/group/WrongRev.status":         kivik.StatusConflict,
		"Delete/RW/NoAuth/group/DesignDoc.status":        kivik.StatusUnauthorized,

		"Stats.databases":             []string{"_users", "chicken"},
		"Stats/Admin/chicken.status":  kivik.StatusNotFound,
		"Stats/NoAuth/chicken.status": kivik.StatusNotFound,

		"BulkDocs/RW/NoAuth/group/Mix/Conflict.status": kivik.StatusConflict,
		"BulkDocs/RW/Admin/group/Mix/Conflict.status":  kivik.StatusConflict,

		"GetAttachment/RW/group/Admin/foo/NotFound.status":  kivik.StatusNotFound,
		"GetAttachment/RW/group/NoAuth/foo/NotFound.status": kivik.StatusNotFound,

		"GetAttachmentMeta/RW/group/Admin/foo/NotFound.status":  kivik.StatusNotFound,
		"GetAttachmentMeta/RW/group/NoAuth/foo/NotFound.status": kivik.StatusNotFound,

		"PutAttachment/RW/group/Admin/Conflict.status":         kivik.StatusInternalServerError, // Couch 2.0 bug
		"PutAttachment/RW/group/NoAuth/Conflict.status":        kivik.StatusInternalServerError, // Couch 2.0 bug
		"PutAttachment/RW/group/NoAuth/UpdateDesignDoc.status": kivik.StatusUnauthorized,
		"PutAttachment/RW/group/NoAuth/CreateDesignDoc.status": kivik.StatusUnauthorized,

		// "DeleteAttachment/RW/group/Admin/NotFound.status":  kivik.StatusNotFound, // COUCHDB-3362
		// "DeleteAttachment/RW/group/NoAuth/NotFound.status": kivik.StatusNotFound, // COUCHDB-3362
		"DeleteAttachment/RW/group/Admin/NoDoc.status":      kivik.StatusInternalServerError, // Couch 2.0 bug
		"DeleteAttachment/RW/group/NoAuth/NoDoc.status":     kivik.StatusInternalServerError, // Couch 2.0 bug
		"DeleteAttachment/RW/group/NoAuth/DesignDoc.status": kivik.StatusUnauthorized,

		"Put/RW/Admin/group/LeadingUnderscoreInID.status":  kivik.StatusBadRequest,
		"Put/RW/Admin/group/Conflict.status":               kivik.StatusConflict,
		"Put/RW/NoAuth/group/DesignDoc.status":             kivik.StatusUnauthorized,
		"Put/RW/NoAuth/group/LeadingUnderscoreInID.status": kivik.StatusBadRequest,
		"Put/RW/NoAuth/group/Conflict.status":              kivik.StatusConflict,

		"Replicate.NotFoundDB": func() string {
			var dsn string
			for _, env := range []string{"KIVIK_TEST_DSN_COUCH16", "KIVIK_TEST_DSN_COUCH20", "KIVIK_TEST_DSN_CLOUDANT"} {
				dsn = os.Getenv(env)
				if dsn != "" {
					break
				}
			}
			parsed, _ := url.Parse(dsn)
			parsed.User = nil
			return strings.TrimSuffix(parsed.String(), "/") + "/doesntexist"

		}(),
		"Replicate.prefix":                                       "none",
		"Replicate.timeoutSeconds":                               5,
		"Replicate.mode":                                         "pouchdb",
		"Replicate/RW/Admin/group/MissingSource/Results.status":  kivik.StatusUnauthorized,
		"Replicate/RW/Admin/group/MissingTarget/Results.status":  kivik.StatusUnauthorized,
		"Replicate/RW/NoAuth/group/MissingSource/Results.status": kivik.StatusUnauthorized,
		"Replicate/RW/NoAuth/group/MissingTarget/Results.status": kivik.StatusUnauthorized,

		"Query/RW/group/Admin/WithoutDocs/ScanDoc.status":  kivik.StatusBadRequest,
		"Query/RW/group/NoAuth/WithoutDocs/ScanDoc.status": kivik.StatusBadRequest,
	})
}

// PouchLocalTest runs the PouchDB tests against a local database.
func PouchLocalTest(t *testing.T) {
	client, err := kivik.New(context.Background(), "pouch", "")
	if err != nil {
		t.Errorf("Failed to connect to PouchDB driver: %s", err)
		return
	}
	clients := &kt.Context{
		RW:    true,
		Admin: client,
	}
	kiviktest.RunTestsInternal(clients, kiviktest.SuitePouchLocal, t)
}

// PouchRemoteTest runs the PouchDB tests against a remote CouchDB database.
func PouchRemoteTest(t *testing.T) {
	kiviktest.DoTest(kiviktest.SuitePouchRemote, "KIVIK_TEST_DSN_COUCH20", t)
}


text:
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_HLO_MEMORY_SCHEDULER_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_HLO_MEMORY_SCHEDULER_H_

#include <vector>

#include "absl/container/flat_hash_map.h"
#include "tensorflow/compiler/xla/service/hlo_instruction.h"
#include "tensorflow/compiler/xla/service/hlo_module.h"
#include "tensorflow/compiler/xla/service/hlo_ordering.h"
#include "tensorflow/compiler/xla/service/hlo_pass_interface.h"
#include "tensorflow/compiler/xla/service/hlo_schedule.h"
#include "tensorflow/compiler/xla/service/logical_buffer.h"
#include "tensorflow/compiler/xla/service/tuple_points_to_analysis.h"
#include "tensorflow/compiler/xla/statusor.h"
#include "tensorflow/compiler/xla/types.h"

namespace xla {

// A memory scheduler computes an execution sequence for the HLO instructions in
// 'computation' that minimizes peak memory, given a points-to analysis result
// that describes buffer aliasing, together with a target-specific size function
// that maps a tensor's logical size to its padded size.
typedef std::function<StatusOr<HloInstructionSequence>(
    const HloComputation&, const TuplePointsToAnalysis&,
    const LogicalBuffer::SizeFunction&,
    const absl::flat_hash_map<const HloComputation*, int64>&)>
    MemorySchedulerAlgorithm;

// List scheduler
StatusOr<HloInstructionSequence> ListMemoryScheduler(
    const HloComputation& computation,
    const TuplePointsToAnalysis& points_to_analysis,
    const LogicalBuffer::SizeFunction& size_function,
    const absl::flat_hash_map<const HloComputation*, int64>&
        memory_by_computation);

// DFS-order scheduler
StatusOr<HloInstructionSequence> DFSMemoryScheduler(
    const HloComputation& computation,
    const TuplePointsToAnalysis& points_to_analysis,
    const LogicalBuffer::SizeFunction& size_function,
    const absl::flat_hash_map<const HloComputation*, int64>&
        memory_by_computation);

// Naive Post Order scheduler
StatusOr<HloInstructionSequence> PostOrderMemoryScheduler(
    const HloComputation& computation,
    const TuplePointsToAnalysis& points_to_analysis,
    const LogicalBuffer::SizeFunction& size_function,
    const absl::flat_hash_map<const HloComputation*, int64>&
        memory_by_computation);

// The default scheduling algorithm. Runs both the list scheduler
// and the DFS scheduler, and chooses whichever returns a lower min-memory,
// not accounting for fragmentation.
StatusOr<HloInstructionSequence> DefaultMemoryScheduler(
    const HloComputation& computation,
    const TuplePointsToAnalysis& points_to_analysis,
    const LogicalBuffer::SizeFunction& size_function,
    const absl::flat_hash_map<const HloComputation*, int64>&
        memory_by_computation);

// Returns an HloSchedule which seeks to minimize the memory required for
// the computation. size_function is the function returning the number of bytes
// required for a LogicalBuffer.
StatusOr<HloSchedule> ScheduleModule(
    const HloModule& module, const LogicalBuffer::SizeFunction& size_function,
    const MemorySchedulerAlgorithm& algorithm = {});

// Computes the schedule for a single computation.
// Currently only used by the GPU backend.
StatusOr<HloInstructionSequence> ScheduleComputation(
    const HloComputation& computation,
    const LogicalBuffer::SizeFunction& size_function);

// A pass which schedules the HLO instructions in a module. The HloModule's
// schedule field is set to the resulting HloSchedule using
// HloModule::set_schedule.
class HloMemoryScheduler : public HloModulePass {
 public:
  // size_function is the function returning the number of bytes required for a
  // LogicalBuffer. algorithm is the memory scheduling algorithm to use. If not
  // specified, then DefaultMemoryScheduler is used.
  HloMemoryScheduler(const LogicalBuffer::SizeFunction& size_function,
                     const MemorySchedulerAlgorithm& algorithm = {});
  ~HloMemoryScheduler() override = default;
  absl::string_view name() const override { return "hlo-memory-scheduler"; }

  StatusOr<bool> Run(HloModule* module) override;

 private:
  LogicalBuffer::SizeFunction size_function_;
  MemorySchedulerAlgorithm algorithm_;
};

// A pass which produces a naive, but correct schedule. The schedule is produced
// using a DFS traversal of the graph with no attempt to minimize memory use.
class HloTrivialScheduler : public HloModulePass {
 public:
  absl::string_view name() const override { return "hlo-trivial-scheduler"; }

  StatusOr<bool> Run(HloModule* module) override;
};

// A trivial pass which clears the schedule currently set on the
// HloModule. After this pass runs HloModudle::has_schedule will return false.
class HloDescheduler : public HloModulePass {
 public:
  HloDescheduler() = default;
  ~HloDescheduler() override = default;
  absl::string_view name() const override { return "hlo-descheduler"; }

  StatusOr<bool> Run(HloModule* module) override;
};

}  // namespace xla

#endif  // TENSORFLOW_COMPILER_XLA_SERVICE_HLO_MEMORY_SCHEDULER_H_


text:
#pragma once

namespace humoto
{
    namespace qpoases
    {
        /**
         * @brief Parameters of the solver
         */
        class HUMOTO_LOCAL SolverParameters : public humoto::SolverParametersBase
        {
            #define HUMOTO_CONFIG_SECTION_ID "SolverParameters"
            #define HUMOTO_CONFIG_CONSTRUCTOR SolverParameters
            #define HUMOTO_CONFIG_ENTRIES \
                HUMOTO_CONFIG_PARENT_CLASS(humoto::SolverParametersBase) \
                \
                HUMOTO_CONFIG_SCALAR_(max_number_of_iterations) \
                HUMOTO_CONFIG_SCALAR_(max_cpu_time) \
                \
                HUMOTO_CONFIG_MEMBER_CLASS(options_, "QPoasesParameters")
            #include HUMOTO_CONFIG_DEFINE_ACCESSORS

            private:
                class HUMOTO_LOCAL QPoasesParameters : public qpOASES::Options, public humoto::config::ConfigurableBase
                {
                    #define HUMOTO_CONFIG_SECTION_ID "QPoasesParameters"
                    #define HUMOTO_CONFIG_CONSTRUCTOR QPoasesParameters
                    #define HUMOTO_CONFIG_ENTRIES \
                        HUMOTO_CONFIG_ENUM(enableRamping)\
                        HUMOTO_CONFIG_ENUM(enableFarBounds)\
                        HUMOTO_CONFIG_ENUM(enableFlippingBounds)\
                        HUMOTO_CONFIG_ENUM(enableRegularisation)\
                        HUMOTO_CONFIG_ENUM(enableFullLITests)\
                        HUMOTO_CONFIG_ENUM(enableNZCTests)\
                        HUMOTO_CONFIG_SCALAR(enableDriftCorrection)\
                        HUMOTO_CONFIG_SCALAR(enableCholeskyRefactorisation)\
                        HUMOTO_CONFIG_ENUM(enableEqualities)\
                        HUMOTO_CONFIG_SCALAR(terminationTolerance)\
                        HUMOTO_CONFIG_SCALAR(boundTolerance)\
                        HUMOTO_CONFIG_SCALAR(boundRelaxation)\
                        HUMOTO_CONFIG_SCALAR(epsNum)\
                        HUMOTO_CONFIG_SCALAR(epsDen)\
                        HUMOTO_CONFIG_SCALAR(maxPrimalJump)\
                        HUMOTO_CONFIG_SCALAR(maxDualJump)\
                        HUMOTO_CONFIG_SCALAR(initialRamping)\
                        HUMOTO_CONFIG_SCALAR(finalRamping)\
                        HUMOTO_CONFIG_SCALAR(initialFarBounds)\
                        HUMOTO_CONFIG_SCALAR(growFarBounds)\
                        HUMOTO_CONFIG_ENUM(initialStatusBounds)\
                        HUMOTO_CONFIG_SCALAR(epsFlipping)\
                        HUMOTO_CONFIG_SCALAR(numRegularisationSteps)\
                        HUMOTO_CONFIG_SCALAR(epsRegularisation)\
                        HUMOTO_CONFIG_SCALAR(numRefinementSteps)\
                        HUMOTO_CONFIG_SCALAR(epsIterRef)\
                        HUMOTO_CONFIG_SCALAR(epsLITests)\
                        HUMOTO_CONFIG_SCALAR(epsNZCTests)\
                        HUMOTO_CONFIG_SCALAR(rcondSMin)\
                        HUMOTO_CONFIG_ENUM(enableInertiaCorrection)\
                        HUMOTO_CONFIG_ENUM(enableDropInfeasibles)\
                        HUMOTO_CONFIG_SCALAR(dropBoundPriority)\
                        HUMOTO_CONFIG_SCALAR(dropEqConPriority)\
                        HUMOTO_CONFIG_SCALAR(dropIneqConPriority)
                    #include HUMOTO_CONFIG_DEFINE_ACCESSORS

                    public:
                        QPoasesParameters()
                        {
                            setDefaults();
                        }

                        /**
                         * @brief Initialize to default parameters
                         */
                        void setDefaults()
                        {
                            setToMPC ();
                        }
                };

            public:
                /// Parameters for qpOASES
                QPoasesParameters   options_;

                /// Limit on the number of iterations
                int                 max_number_of_iterations_;

                /// Limit on the computation time
                double              max_cpu_time_;

            public:
                void setDefaults()
                {
                    max_number_of_iterations_ = 1000;
                    max_cpu_time_ = 0.0;
                }

                /**
                 * @brief Default constructor
                 */
                SolverParameters()
                {
                    setDefaults();
                }
        };

        /**
         * @brief QP solver.
         *
         * Solves hierarchy as an optimization problem of the following form:
         *                 minimize     1/2* x' H x + x' g
         *                 subject to   lb  <=  x <= ub
         *                              lbA <= A x <= ubA
         * where 'x' is solution, 'H' -- Hessian matrix, 'g' -- gradient
         * vector, 'lb' and 'ub' vectors of simple lower and upper bounds, 'Ax'
         * -- matrix of general constraints with bounds 'lbA' and 'ubA'.
         */
        class HUMOTO_LOCAL Solver : public humoto::QPSolverMixin< humoto::SolverGuessSolutionActiveSet<SolverParameters> >
        {
            private:
                /// If set the active set is returned
                bool                active_set_guess_provided_;

                humoto::QPProblem_ILU_ALU       qp_problem_;

                /// Guess of the solution
                const double * solution_guess_;

                ///@{
                /// The active set guess for qpOASES
                qpOASES::Bounds         qpoases_active_set_guess_bounds_;
                qpOASES::Constraints    qpoases_active_set_guess_constraints_;
                ///@}

                Eigen::VectorXd     qpoases_active_set_bounds_;
                Eigen::VectorXd     qpoases_active_set_constraints_;

                /// Nonzero if constraints are specified
                std::size_t    number_of_constraints_;

                qpOASES::QProblem *  qp_;

            private:
                /// @copydoc humoto::Solver::initialize
                void initialize(  const humoto::OptimizationProblem   &hierarchy,
                                  const humoto::SolutionStructure     &sol_structure)
                {
                    reset();

                    hierarchy.getQPProblem(qp_problem_, sol_structure);

                    number_of_constraints_ = qp_problem_.getGeneralConstraints().getNumberOfConstraints();

                    qp_ = new qpOASES::QProblem(sol_structure.getNumberOfVariables(),
                                                number_of_constraints_,
                                                qpOASES::HST_SEMIDEF);
                }

                /// @copydoc humoto::Solver::solveHierarchy
                void solveHierarchy(humoto::Solution &solution,
                                    const humoto::OptimizationProblem &hierarchy)
                {
                    qpOASES::real_t     max_time = parameters_.max_cpu_time_;

                    qpOASES::real_t     *max_time_ptr = NULL;

                    const qpOASES::real_t     * lb_ptr = NULL;
                    const qpOASES::real_t     * ub_ptr = NULL;

                    Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> A_rm;
                    const qpOASES::real_t     *A_ptr = NULL;
                    const qpOASES::real_t     *lbA_ptr = NULL;
                    const qpOASES::real_t     *ubA_ptr = NULL;

                    const qpOASES::real_t     *solution_guess_ptr = NULL;

                    qpOASES::Bounds         *active_set_bounds_ptr = NULL;
                    qpOASES::Constraints    *active_set_constraints_ptr = NULL;

                    qpOASES::returnValue    qpoases_return_value;

                    if (max_time != 0.0)
                    {
                        max_time_ptr = &max_time;
                    }

                    if (qp_problem_.getSimpleBounds().getNumberOfConstraints() > 0)
                    {
                        lb_ptr = qp_problem_.getSolutionLowerBounds().data();
                        ub_ptr = qp_problem_.getSolutionUpperBounds().data();
                    }

                    if (number_of_constraints_ > 0)
                    {
                        // Note: qpOASES expects rowMajor data, Eigen is colMajor by default
                        //       only A needs to be handled since H is symmetric and the rest
                        //       are vectors
                        A_rm = qp_problem_.getGeneralConstraints().getA();
                        A_ptr = A_rm.data();

                        lbA_ptr = qp_problem_.getGeneralConstraints().getLowerBounds().data();
                        ubA_ptr = qp_problem_.getGeneralConstraints().getUpperBounds().data();
                    }

                    if (NULL != solution_guess_)
                    {
                        solution_guess_ptr = solution_guess_;
                    }

                    if (active_set_guess_provided_)
                    {
                        active_set_bounds_ptr       = &qpoases_active_set_guess_bounds_;
                        active_set_constraints_ptr  = &qpoases_active_set_guess_constraints_;
                    }

                    int number_of_iterations = parameters_.max_number_of_iterations_;

                    qp_->setOptions (parameters_.options_);
                    qpoases_return_value =
                        qp_->init(  qp_problem_.getHessian().data(),
                                    qp_problem_.getGradient().data(),
                                    A_ptr,
                                    lb_ptr,
                                    ub_ptr,
                                    lbA_ptr,
                                    ubA_ptr,
                                    number_of_iterations,
                                    max_time_ptr,
                                    solution_guess_ptr,
                                    NULL, // Optimal dual solution vector
                                    active_set_bounds_ptr,
                                    active_set_constraints_ptr);

                    qp_->getPrimalSolution( solution.x_.data() );

                    switch (qpoases_return_value)
                    {
                        case qpOASES::SUCCESSFUL_RETURN:
                            solution.return_status_ = SolverStatus::OK;
                            break;
                        case qpOASES::RET_MAX_NWSR_REACHED:
                            solution.return_status_ = SolverStatus::MAX_ITER;
                            break;
                        default:
                            solution.return_status_ = SolverStatus::OTHER;
                            break;
                    }

                    try
                    {
                        humoto::qpoases::Solution &qpoases_solution = dynamic_cast<humoto::qpoases::Solution &> (solution);

                        qpoases_solution.qpoases_return_value_ = qpoases_return_value;
                        qpoases_solution.number_of_iterations_ = number_of_iterations;
                    }
                    catch(...)
                    {
                        // not critical
                    }

                    solution_guess_ = NULL;
                    active_set_guess_provided_ = false;
                }

                /// @copydoc humoto::SolverGuessActiveSetMixin::getActiveSet
                void getActiveSet(  humoto::ActiveSet                   &active_set,
                                    const humoto::OptimizationProblem   &hierarchy)
                {
                    if (qp_problem_.getSimpleBounds().getNumberOfConstraints() > 0)
                    {
                        qpoases_active_set_bounds_.resize(qp_problem_.getSimpleBounds().getNumberOfVariables());
                        qp_->getWorkingSetBounds(qpoases_active_set_bounds_.data());
                    }

                    if (number_of_constraints_ > 0)
                    {
                        qpoases_active_set_constraints_.resize(number_of_constraints_);
                        qp_->getWorkingSetConstraints(qpoases_active_set_constraints_.data());
                    }

                    hierarchy.initializeActiveSet(active_set);

                    // Objective level includes only equalities by design.
                    if (0 == number_of_constraints_ + qp_problem_.getSimpleBounds().getNumberOfConstraints())
                    {
                        // no constraints -- objective on the first level
                        active_set.set(0, ConstraintActivationType::EQUALITY);
                    }
                    else
                    {
                        active_set.set(1, ConstraintActivationType::EQUALITY);
                    }

                    for (std::size_t i = 0; i < number_of_constraints_; ++i)
                    {
                        if (qpoases_active_set_constraints_[i] == -1.0)
                        {
                            active_set[0][i] = ConstraintActivationType::LOWER_BOUND;
                        }
                        else
                        {
                            if (qpoases_active_set_constraints_[i] == 0.0)
                            {
                                active_set[0][i] = ConstraintActivationType::INACTIVE;
                            }
                            else
                            {
                                if (qpoases_active_set_constraints_[i] == 1.0)
                                {
                                    active_set[0][i] = ConstraintActivationType::UPPER_BOUND;
                                }
                                else
                                {
                                    HUMOTO_THROW_MSG("Active set returned by qpOASES is incorrectly initialized.");
                                }
                            }
                        }
                    }

                    for (std::size_t i = 0; i < qp_problem_.getSimpleBounds().getNumberOfConstraints(); ++i)
                    {
                        std::size_t var_index = qp_problem_.getSimpleBounds().getIndices()[i];

                        if (qpoases_active_set_bounds_[var_index] == -1.0)
                        {
                            if (qp_problem_.getSimpleBounds().getLowerBounds()[i] < qp_problem_.getSolutionLowerBounds()[var_index])
                            {
                                active_set[0][number_of_constraints_ + i] = ConstraintActivationType::INACTIVE;
                            }
                            else
                            {
                                active_set[0][number_of_constraints_ + i] = ConstraintActivationType::LOWER_BOUND;
                            }
                        }
                        else
                        {
                            if (qpoases_active_set_bounds_[var_index] == 0.0)
                            {
                                active_set[0][number_of_constraints_ + i] = ConstraintActivationType::INACTIVE;
                            }
                            else
                            {
                                if (qpoases_active_set_bounds_[var_index] == 1.0)
                                {
                                    if (qp_problem_.getSimpleBounds().getUpperBounds()[i] > qp_problem_.getSolutionUpperBounds()[var_index])
                                    {
                                        active_set[0][number_of_constraints_ + i] = ConstraintActivationType::INACTIVE;
                                    }
                                    else
                                    {
                                        active_set[0][number_of_constraints_ + i] = ConstraintActivationType::UPPER_BOUND;
                                    }
                                }
                                else
                                {
                                    HUMOTO_THROW_MSG("Active set returned by qpOASES is incorrectly initialized.");
                                }
                            }
                        }
                    }
                }

                /**
                 * @copydoc humoto::SolverGuessActiveSetMixin::setActiveSet
                 *
                 * @attention One variable may be simply bounded multiple
                 * times. In this case, the guess is set to the guess for the
                 * last bound on the level.
                 */
                void setActiveSet(  const humoto::ActiveSet             &active_set,
                                    const humoto::OptimizationProblem   &hierarchy)
                {
                    active_set_guess_provided_ = true;

                    qpoases_active_set_guess_constraints_.init(number_of_constraints_);

                    for (std::size_t i = 0; i < number_of_constraints_; ++i)
                    {
                        ConstraintActivationType::Type type = active_set[0][i];

                        switch (type)
                        {
                            case ConstraintActivationType::LOWER_BOUND:
                                qpoases_active_set_guess_constraints_.setupConstraint(i, qpOASES::ST_LOWER);
                                break;
                            case ConstraintActivationType::INACTIVE:
                                qpoases_active_set_guess_constraints_.setupConstraint(i, qpOASES::ST_INACTIVE);
                                break;
                            case ConstraintActivationType::UPPER_BOUND:
                                qpoases_active_set_guess_constraints_.setupConstraint(i, qpOASES::ST_UPPER);
                                break;
                            case ConstraintActivationType::EQUALITY:
                                qpoases_active_set_guess_constraints_.setupConstraint(i, qpOASES::ST_LOWER);
                                break;
                            default:
                                HUMOTO_THROW_MSG("Incorrectly initialized active set guess.");
                                break;
                        }
                    }

                    qpoases_active_set_guess_bounds_.init(qp_problem_.getSimpleBounds().getNumberOfVariables());
                    qpoases_active_set_guess_bounds_.setupAllFree();
                    for (std::size_t i = 0; i < qp_problem_.getSimpleBounds().getNumberOfConstraints() ; ++i)
                    {
                        std::size_t var_index = qp_problem_.getSimpleBounds().getIndices()[i];
                        ConstraintActivationType::Type type = active_set[0][number_of_constraints_+i];

                        switch (type)
                        {
                            case ConstraintActivationType::LOWER_BOUND:
                                qpoases_active_set_guess_bounds_.setupBound(var_index, qpOASES::ST_LOWER);
                                break;
                            case ConstraintActivationType::INACTIVE:
                                // all bounds are already inactive due to setupAllFree().
                                //qpoases_active_set_guess_bounds_.setupBound(var_index, qpOASES::ST_INACTIVE);
                                break;
                            case ConstraintActivationType::UPPER_BOUND:
                                qpoases_active_set_guess_bounds_.setupBound(var_index, qpOASES::ST_UPPER);
                                break;
                            case ConstraintActivationType::EQUALITY:
                                qpoases_active_set_guess_bounds_.setupBound(var_index, qpOASES::ST_LOWER);
                                break;
                            default:
                                HUMOTO_THROW_MSG("Incorrectly initialized active set guess.");
                                break;
                        }
                    }
                }

                /// @copydoc humoto::SolverGuessSolutionMixin::setSolutionGuess
                void setSolutionGuess(const humoto::Solution & solution_guess)
                {
                    solution_guess_ = solution_guess.x_.data();
                }

                /// @copydoc humoto::Solver::reset
                void reset()
                {
                    number_of_constraints_ = 0;

                    active_set_guess_provided_ = false;

                    solution_guess_ = NULL;

                    if (qp_ != NULL)
                    {
                        delete qp_;
                        qp_ = NULL;
                    }
                }

            public:
                /**
                 * @brief Default constructor (with default parameters)
                 */
                Solver()
                {
                    qp_ = NULL;
                    reset();
                }

                /**
                 * @brief Destructor
                 */
                ~Solver()
                {
                    reset();
                }

                /**
                 * @brief Set parameters.
                 *
                 * @param[in] parameters parameters
                 */
                explicit Solver(const SolverParameters &parameters)
                {
                    qp_ = NULL;
                    reset();
                    setParameters(parameters);
                }

                /**
                 * @brief Log a QP problem
                 *
                 * @param[in,out] logger logger
                 * @param[in] parent parent
                 * @param[in] name name
                 */
                void log(   humoto::Logger &logger HUMOTO_GLOBAL_LOGGER_IF_DEFINED,
                            const LogEntryName &parent = LogEntryName(),
                            const std::string &name = "qpoases") const
                {
                    LogEntryName subname = parent; subname.add(name);
                    qp_problem_.log(logger, subname);
                }
        };
    }
}


text:
opal_unsupported_filter "Hash" do
  fails "Hash#[]= duplicates and freezes string keys"
  fails "Hash#[]= duplicates string keys using dup semantics" # TypeError: can't define singleton
  fails "Hash#[]= raises a RuntimeError if called on a frozen instance"
  fails "Hash#assoc only returns the first matching key-value pair for identity hashes"
  fails "Hash#clear raises a RuntimeError if called on a frozen instance"
  fails "Hash#compare_by_identity raises a RuntimeError on frozen hashes"
  fails "Hash#default= raises a RuntimeError if called on a frozen instance"
  fails "Hash#default_proc= raises a RuntimeError if self is frozen"
  fails "Hash#delete raises a RuntimeError if called on a frozen instance"
  fails "Hash#delete_if raises a RuntimeError if called on a frozen instance"
  fails "Hash#initialize is private"
  fails "Hash#initialize raises a RuntimeError if called on a frozen instance"
  fails "Hash#inspect does not raise if inspected result is not default external encoding" # Mock 'utf_16be' expected to receive 'inspect' exactly 1 times but received it 0 times
  fails "Hash#inspect returns a tainted string if self is tainted and not empty"
  fails "Hash#inspect returns an untrusted string if self is untrusted and not empty"
  fails "Hash#keep_if raises a RuntimeError if called on a frozen instance"
  fails "Hash#merge! checks frozen status before coercing an object with #to_hash"
  fails "Hash#merge! raises a RuntimeError on a frozen instance that is modified"
  fails "Hash#merge! raises a RuntimeError on a frozen instance that would not be modified"
  fails "Hash#rehash raises a RuntimeError if called on a frozen instance"
  fails "Hash#reject! raises a RuntimeError if called on a frozen instance that is modified"
  fails "Hash#reject! raises a RuntimeError if called on a frozen instance that would not be modified"
  fails "Hash#reject! returns an Enumerator if called on a frozen instance"
  fails "Hash#replace raises a RuntimeError if called on a frozen instance that is modified"
  fails "Hash#replace raises a RuntimeError if called on a frozen instance that would not be modified"
  fails "Hash#select! raises a RuntimeError if called on a frozen instance that would not be modified"
  fails "Hash#select! raises a RuntimeError if called on an empty frozen instance"
  fails "Hash#shift raises a RuntimeError if called on a frozen instance"
  fails "Hash#store duplicates and freezes string keys"
  fails "Hash#store duplicates string keys using dup semantics" # TypeError: can't define singleton
  fails "Hash#store raises a RuntimeError if called on a frozen instance"
  fails "Hash#to_a returns a tainted array if self is tainted"
  fails "Hash#to_a returns an untrusted array if self is untrusted"
  fails "Hash#to_proc the returned proc passed as a block to instance_exec always retrieves the original hash's values"
  fails "Hash#to_proc the returned proc raises ArgumentError if not passed exactly one argument"
  fails "Hash#to_s does not raise if inspected result is not default external encoding" # Mock 'utf_16be' expected to receive 'inspect' exactly 1 times but received it 0 times
  fails "Hash#to_s returns a tainted string if self is tainted and not empty"
  fails "Hash#to_s returns an untrusted string if self is untrusted and not empty"
  fails "Hash#update checks frozen status before coercing an object with #to_hash"
  fails "Hash#update raises a RuntimeError on a frozen instance that is modified"
  fails "Hash#update raises a RuntimeError on a frozen instance that would not be modified"
end


text:
title: Asa
inshort: Topimaso mikasika ny asa
translator: Microsoft Cognitive Services
---

Asa dia ireo topimaso Mikasika ny asa araka izay aseho ao amin' ny Biraoko 365.

Ireo loharanom-pitaovana
---------

-

Mitovy amin' ny taratasy fangatahana
--------------------

-Wunderlist

-Nalaminao Microsoft

-Google asa

-Apple asa

-Pandaharam Microsoft

Metadata
--------

-Fizarana ivelany tsy mahazaka

-Application hita ao amin' ny finday