plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | ISET/iset3d-v3-master | piMateriallib.m | .m | iset3d-v3-master/utilities/material/piMateriallib.m | 7,692 | utf_8 | c749aad8472e7fff50e23c46ebe245a1 | function [materiallib_updated] = piMateriallib
% A library of material properties (deprecated)
%
% Syntax:
% materiallib = piMaterialib;
%
% Brief description:
% All of the material definitions that we use in ISET3d are
% represented in the materiallib. This function creates the material
% lib with the specific pa... |
github | ISET/iset3d-v3-master | piMaterialWrite.m | .m | iset3d-v3-master/utilities/material/piMaterialWrite.m | 5,057 | utf_8 | d53176e3a5d12b14495036c7158f4dbf | function piMaterialWrite(thisR)
%%
% Synopsis:
% piMaterialWrite(thisR)
%
% Brief description:
% Write material and texture information in material pbrt file.
%
% Inputs:
% thisR - recipe.
%
% Outputs:
% None
%
% Description:
% Write the material file from PBRT V3, as input from Cinema 4D
%
% The main sce... |
github | ISET/iset3d-v3-master | piColorPick.m | .m | iset3d-v3-master/utilities/scenes/piColorPick.m | 2,044 | utf_8 | 5fd33c3d0118bff80b7865f861992e73 | function rgb = piColorPick(color,varargin)
% Choose a pre-defined color or randomly pick one of the list
%
% Syntax
% rgb = piColorPick(color,varargin)
%
% Description
% For the moment, there is randomization of the returned color. We
% get something in the range. We are going to create a key/value
% pair that... |
github | ISET/iset3d-v3-master | piMediaWrite.m | .m | iset3d-v3-master/utilities/medium/piMediaWrite.m | 1,325 | utf_8 | 6e886532e54680146c276a1a96fc97f3 | function piMediaWrite(thisR)
% Write the material file from PBRT V3, as input from Cinema 4D
%
% The main scene file (scene.pbrt) includes a scene_materials.pbrt
% file. This routine writes out the materials file from the
% information in the recipe.
%
% HB, SCIEN STANFORD, 2020
%%
p = inputParser;
p.addRequired('thi... |
github | ISET/iset3d-v3-master | piRecipeUpdateAssets.m | .m | iset3d-v3-master/utilities/recipe/piRecipeUpdateAssets.m | 2,055 | utf_8 | 95865cfabbc234f9ecf31c401ef395bf | function thisR = piRecipeUpdateAssets(thisRV1)
% Rearrange the assets in V1 format into V2 format
%
% Description:
% Rearrange the assets with the new structure to make the old recipe
% compatible.
%
%%
p = inputParser;
p.addRequired('thisRV1', @(x)isequal(class(x), 'recipe'));
p.parse(thisRV1);
%% Make sure the ... |
github | ISET/iset3d-v3-master | piRecipeUpdate.m | .m | iset3d-v3-master/utilities/recipe/piRecipeUpdate.m | 3,992 | utf_8 | abbc915b5192c9992b47586b06723f99 | function thisRV2 = piRecipeUpdate(thisRV2)
% Convert a render recipe from V1 structure to V2 structure.
%
% Synopsis
% thisRV2 = piRecipeUpdate(thisRV2)
%
% The change(s) are:
%
% 1. Change material format
% 2. Extract texture from material slot and make it a separate slot.
% 3. Rearrange assets to new tree st... |
github | ISET/iset3d-v3-master | piRecipeDefault.m | .m | iset3d-v3-master/utilities/recipe/piRecipeDefault.m | 12,426 | utf_8 | 2a817c33f6d7e99fbc671177cf2804d1 | function thisR = piRecipeDefault(varargin)
% Returns a recipe to an ISET3d standard scene
%
% Syntax
% thisR = piRecipeDefault(varargin)
%
% Description:
% piRecipeDefault reads in PBRT scene text files in the data/V3
% repository. It is also capable of using ieWebGet to retrieve pbrt
% scenes, from the web and i... |
github | ISET/iset3d-v3-master | piAssetGeneratePattern.m | .m | iset3d-v3-master/utilities/asset/piAssetGeneratePattern.m | 5,381 | utf_8 | 74e79853c59cd1f583245e5ca1f4083a | function [asset, assetPattern] = piAssetGeneratePattern(asset, varargin)
%%
varargin = ieParamFormat(varargin);
p = inputParser;
p.addRequired('asset', @isstruct);
p.addParameter('algorithm', 'halfdivision', @ischar);
% Uniform spread alg
p.addParameter('sz', 1, @isnumeric);
p.addParameter('coretrindex', -1, @isnumeri... |
github | ISET/iset3d-v3-master | piReadDAT.m | .m | iset3d-v3-master/utilities/pbrt/piReadDAT.m | 4,122 | utf_8 | 939863c572c191a44386fa81ecbc7052 | function [imageData, imageSize, lens] = piReadDAT(filename, varargin)
%% Read multispectral data from a .dat file (Stanford format)
%
% [imageData, imageSize, lens] = piReadDAT(filename)
%
% Required Input
% filename - existing .dat file
%
% Optional parameter/val
% maxPlanes -
%
% Returns
%
% Reads multi-spect... |
github | ISET/iset3d-v3-master | piAssetsRebuild.m | .m | iset3d-v3-master/utilities/pbrt/piAssetsRebuild.m | 1,993 | utf_8 | 795b0fc6c9b8d4e6b8ae12e07495a679 | function thisR = piAssetsRebuild(thisR)
%
% Description:
% Rearrange the assets with the new structure to make the old recipe
% compatible.
%
%%
p = inputParser;
p.addRequired('thisR', @(x)isequal(class(x), 'recipe'));
p.parse(thisR);
%% Make sure the modern fields exist in all assets in the old format recipe
fie... |
github | ISET/iset3d-v3-master | writePFM.m | .m | iset3d-v3-master/utilities/pbrt/writePFM.m | 1,310 | utf_8 | 9237c69e65fe2310b2a7eea77f43e65a | % writePFM write an a matrix to a Portable Float Map Image.
%
% [] = writePFM( image, filename, scale )
%
% When image is height x width x 3, the image is considered RGB.
% When image is height x width, the image is considered grayscale.
% scale must be a positive value indicating the overall intensity scale.
function... |
github | ISET/iset3d-v3-master | readPFM.m | .m | iset3d-v3-master/utilities/pbrt/readPFM.m | 1,646 | utf_8 | 70b57ada40ef5141730fb13d94fce5fa | % read_pfm
%
% read_pfm( filename )
% Reads a Portable Float Map (PFM) from file located in filename
% A greyscale PFM (header: 'Pf') is returned as a ( height x width )
% matrix
% An RGB color PFM (header: 'PF') is returned as a ( height x width x 3 )
% matrix
function image = readPFM( filename )
fid = fopen( filenam... |
github | ISET/iset3d-v3-master | piBlock2Struct.m | .m | iset3d-v3-master/utilities/pbrt/piBlock2Struct.m | 3,923 | utf_8 | 16620ac99360047b12e5878917303da3 | % DEPRECATED
function s = piBlock2Struct(blockLines,varargin)
% Parse a block of scene file text (e.g. from piExtractBlock) and
% return it as a structure
%
% s = piBlock2Struct(blockLines,varargin)
%
% Required input
% blockLines - a block of text from the top of a scene.pbrt file
%
% Return
% s - a struct con... |
github | ISET/iset3d-v3-master | piFluorescentPattern.m | .m | iset3d-v3-master/utilities/fluorescent/piFluorescentPattern.m | 12,558 | utf_8 | dbf807faf029c08894a2f305ed5d233d | function thisR = piFluorescentPattern(thisR, assetInfo, varargin)
%% Apply pattern generation algorithms and change pbrt files for the pattern
%
% piFluorescentPattern
%
% Description:
% Steps to add pattern on certain location area are:
% (1) Based on the target location, read corresponding child geometry
% ... |
github | ISET/iset3d-v3-master | piFluorescentMultiCore.m | .m | iset3d-v3-master/utilities/fluorescent/algorithms/piFluorescentMultiCore.m | 5,994 | utf_8 | dc5defa7a3dc6cd0783faa02aa06e085 | function thisR = piFluorescentMultiCore(thisR, assetInfo, varargin)
%% Generate multiple uniformly spreaded pattern on target location
%
% piFluorescentMultiUniform
%
% Description:
% Generate several patterns on target location
%
% Inputs:
% thisR - scene recipe
% TR - triangulat... |
github | ISET/iset3d-v3-master | piFluorescentUniformSpread.m | .m | iset3d-v3-master/utilities/fluorescent/algorithms/piFluorescentUniformSpread.m | 7,890 | utf_8 | 6b0c43bd93eb2a7014a0d8831275f398 | function thisR = piFluorescentUniformSpread(thisR, assetInfo, varargin)
%% Generate a pattern from single triangle
%
% piFluorescentUniformSpread
%
% Description:
% Generate an unifrom oriented pattern from a random single triangle
%
% Inputs:
% thisR - scene recipe
% TR - triangu... |
github | ISET/iset3d-v3-master | piBlender2C4D.m | .m | iset3d-v3-master/utilities/blender/piBlender2C4D.m | 33,904 | utf_8 | 9d6dcd7e8c192950425ec7e8f7e25037 | function fname = piBlender2C4D(fname)
% Converts the exported blender files into C4D format
%
% Synopsis
% fname = piBlender2C4D(fname);
%
% Input:
% fname - PBRT file exported by Blender
%
% Output
% fnane - new filename for C4D compliant file
%
% Description
% This function creates the material and geometry ... |
github | ISET/iset3d-v3-master | pcread_Blender.m | .m | iset3d-v3-master/utilities/blender/pcread_Blender.m | 6,671 | utf_8 | 2549d72c99f96a0d4cf115497feac9a9 | function [ptCloud,texture] = pcread_Blender(filename)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOTE: this is a modification of pcread.m
% that also reads out per-vertex texture coordinates
%%%%%%%%%%%%%%%%%... |
github | ISET/iset3d-v3-master | piGeometryRead_Blender.m | .m | iset3d-v3-master/utilities/blender/piGeometryRead_Blender.m | 14,936 | utf_8 | 2ab79496236215ea2b794da05222fb1b | function renderRecipe = piGeometryRead_Blender(renderRecipe)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOTE: below added
% Adapted from piGeometryRead.m
% to extract scale and rotation information separately ... |
github | ISET/iset3d-v3-master | piRead_Blender.m | .m | iset3d-v3-master/utilities/blender/piRead_Blender.m | 49,638 | utf_8 | 2fd2d5031e4bfa67c3fd5e84e6f679d8 | function thisR = piRead_Blender(fname,varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOTE: below added
% Adapted from piRead.m to also handle a scene file exported from Blender
%%%%%%%%%%%%%%%%%%%%%%%%%%... |
github | ISET/iset3d-v3-master | piWrite_Blender.m | .m | iset3d-v3-master/utilities/blender/piWrite_Blender.m | 25,616 | utf_8 | 360ff1a5d7e4647038905bc7467e780d | function workingDir = piWrite_Blender(thisR,varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOTE: below added
% Adapted from piWrite.m to handle the exporter being set to 'Blender'
%%%%%%%%%%%%%%%%%%%%%%%... |
github | ISET/iset3d-v3-master | piRead.m | .m | iset3d-v3-master/utilities/general-parser/piRead.m | 18,102 | utf_8 | de628328ebacd9decf63a4ab20284021 | function thisR = piRead(fname,varargin)
% Read an parse a PBRT scene file, returning a rendering recipe
%
% Syntax
% thisR = piRead(fname, varargin)
%
% Description
% piREAD parses a pbrt scene file and returns the full set of rendering
% information in the slots of the "recipe" object. The recipe object
% contai... |
github | ISET/iset3d-v3-master | piPBRTReformat.m | .m | iset3d-v3-master/utilities/general-parser/piPBRTReformat.m | 6,522 | utf_8 | 81412976f053c181d95654481c780d2f | function outputFull = piPBRTReformat(fname,varargin)
%% format a pbrt file from arbitrary source to standard format
%
% Syntax:
% outputFull = piPBRTReformat(fname,varargin)
%
% Brief
% PBRT V3 files can appear in many formats. This function uses the PBRT
% docker container to read those files and write out t... |
github | ISET/iset3d-v3-master | piBlockExtract_gp.m | .m | iset3d-v3-master/utilities/general-parser/piBlockExtract_gp.m | 6,600 | utf_8 | 8e6eb9fc411c5f195a418d7243b71270 | function [blockList, blockLinesList] = piBlockExtract(txtLines,varargin)
% Parse text in a scene file, returning the info as a structure
%
% Syntax
% [s, blockLines] = piBlockExtract(txtLines,varargin)
%
% Description
% Used extensively by piRead to parse specific types of text blocks within
% a PBRT scene file.
... |
github | ISET/iset3d-v3-master | piLightGetFromText_gp.m | .m | iset3d-v3-master/utilities/light/piLightGetFromText_gp.m | 10,302 | utf_8 | 2f5c66f6284503ca0c6994439fbceba2 | function lightSources = piLightGetFromText_gp(thisR, intext, varargin)
% Read a light source struct based on the parameters in the recipe
%
% This routine only works for light sources that are exported from
% Cinema 4D. It will not work in all cases. We should fix that.
%
% Inputs
% thisR: Recipe
% intext
% Opti... |
github | ISET/iset3d-v3-master | piLightGetFromWorld.m | .m | iset3d-v3-master/utilities/light/piLightGetFromWorld.m | 8,617 | utf_8 | 6a1a42a08c2b11ea7d4646ec0b607fe5 | function lightSources = piLightGetFromWorld(thisR, varargin)
% Read a light source struct based on the parameters in the recipe
%
% This routine only works for light sources that are exported from
% Cinema 4D. It will not work in all cases. We should fix that.
%
% Inputs
% thisR: Recipe
%
% Optional key/val pairs
... |
github | ISET/iset3d-v3-master | propertiesGUI.m | .m | iset3d-v3-master/external/propertiesGUI.m | 69,330 | utf_8 | 039cb42cf37eaa3a80a1e890e829f1f3 | function [hPropsPane,parameters] = propertiesGUI(hParent, parameters, filename, selectedBranch)
% propertiesGUI displays formatted editable list of properties
%
% Syntax:
%
% Initialization:
% [hPropsPane,parameters] = propertiesGUI(hParent, parameters)
%
% Run-time interaction:
% propertiesGUI(hPropsPane, mo... |
github | ISET/iset3d-v3-master | struct2node.m | .m | iset3d-v3-master/external/struct2node.m | 830 | utf_8 | e7539fd43efc352edd218b41a877e376 | function root = struct2node(S,name)
%STRUCT2NODE returns a parallel uitreenode object for a struct
% ROOT = STRUCT2NODE(S) returns a uitreenode object.
% ROOT = STRUCT2NODE(S,NAME) returns a uitreenode object with the given
% name.
assert(isscalar(S)&&isstruct(S),'function only defined for scalar structs')
if n... |
github | ISET/iset3d-v3-master | unix2dos.m | .m | iset3d-v3-master/external/unix2dos.m | 1,768 | utf_8 | bb3eaa9c87bc6c8c51341a8d847d9494 | function unix2dos(filein,dos2unix)
% UNIX2DOS(FILEIN,DOS2UNIX)
%
% converts text file FILEIN from unix LF format to DOS CRLF format
% if the optional DOS2UNIX parameter is set to true, the conversion is
% done the other way, i.e. DOS to UNIX format
%
% example
% unix2dos('c:\temp\myfile.txt',true)
% converts the file ... |
github | jcorbino/mole-master | tfi.m | .m | mole-master/mole_MATLAB/tfi.m | 1,378 | utf_8 | dd3f11c74046fee428b36d49c0df5b7a | % https://en.wikipedia.org/wiki/Transfinite_interpolation
function [X, Y] = tfi(grid_name, m, n, plot_grid)
% Returns X and Y which are both m by n matrices that contains the physical
% coordinates
%
% Parameters:
% grid_name : String with the name of the grid folder
% m : Number of nodes along th... |
github | jcorbino/mole-master | ttm.m | .m | mole-master/mole_MATLAB/ttm.m | 2,709 | utf_8 | a6c0e55170571a775b8675bb6734f3d7 | % https://www.sciencedirect.com/science/article/pii/0022247X78902172?via%3Dihub
function [X, Y] = ttm(grid_name, m, n, iters, plot_grid)
% Returns X and Y which are both m by n matrices that contains the physical
% coordinates
%
% Parameters:
% grid_name : String with the name of the grid folder
% ... |
github | jcorbino/mole-master | test_curl.m | .m | mole-master/examples_MATLAB/test_curl.m | 1,530 | utf_8 | 7aa2465d04817eb7f4d8a59bb33ead8b | % This file does not uses the curl2D(...) function provided by the library.
% It just tests the 2D mimetic divergence applied to an auxiliary vector
% field to obtain the equivalent curl. The proper way to solve problems
% that involve the curl operator is by calling the function curl2D(...)
clc
close all
a... |
github | jcorbino/mole-master | richards.m | .m | mole-master/examples_MATLAB/richards.m | 2,342 | utf_8 | 0925d9ff80524af89a1669f7f48f23c8 | % Solves the highly nonlinear Richard's equation in 1D using the mixed form
% approach and Newton's method to find the roots F(x) = 0
function richards
clc
close all
addpath('../mole_MATLAB');
% Spatial and temporal discretization
k = 4;
m = 60;
a = 0;
b = 40;
dx = (b-a)/m;
... |
github | smart-media-lab/An-Ant-Colony-Optimization-Algorithm-For-Image-Edge-Detection-master | edge_CEC_2008_main.m | .m | An-Ant-Colony-Optimization-Algorithm-For-Image-Edge-Detection-master/edge_CEC_2008_main.m | 12,126 | utf_8 | 6a8bf236907d87135addee0723242305 | function edge_CEC_2008_main
%
% This is a demo program of image edge detection using ant colony, based on
% the paper, "An Ant Colony Optimization Algorithm For Image Edge
% Detection," IEEE Congress on Evolutionary Computation (CEC), pp. 751-756, Hongkong,
% Jun. 2008.
%
%
% Input:
% gray image with a square ... |
github | peterspat/handeyecalibration-master | SplashScreen.m | .m | handeyecalibration-master/app/deps/SplashScreen/SplashScreen-v1p1/SplashScreen.m | 18,934 | utf_8 | 7da473200120c9274129af47f5c0e359 | classdef SplashScreen < hgsetget
%SplashScreen create a splashscreen
%
% s = SplashScreen(title,imagefile) creates a splashscreen using
% the specified image. The title is the name of the window as shown
% in the task-bar. Use "delete(s)" to remove it. Note that images
% must be in PNG,... |
github | peterspat/handeyecalibration-master | getAllSections.m | .m | handeyecalibration-master/app/configuration/getAllSections.m | 246 | utf_8 | 6819ab110aa72dac5bcdf49133860aaf | % Read all section from ini file
% fileDir: File path to *.ini
function [ sections ] = getAllSections( fileDir )
if ~isempty(fileDir)
sections = readConfig(fileDir, 'Sections');
else
fprintf('File dir %s is empty!', fileDir);
end
end
|
github | peterspat/handeyecalibration-master | readConfig.m | .m | handeyecalibration-master/app/configuration/readConfig.m | 427 | utf_8 | 02bc150af09c0b5e5b120f900661adc0 | % Read an ini file
% fileDir: File path
% sectionName: Section to read, 'Sections' reads all sections
function [ sectionData ] = readConfig( fileDir, sectionName )
if ~isempty(fileDir) && ~isempty(sectionName)
I = INI('File', fileDir);
I.read();
sectionData = I.get(char(sectionName));
else
f... |
github | peterspat/handeyecalibration-master | checkNameProperty.m | .m | handeyecalibration-master/app/configuration/checkNameProperty.m | 270 | utf_8 | 289bd240736649cbc4e7f2870c0b4fc6 | % Check if struct contains a name property
% testStruct: Struct to test
% default: Default name
function [ structName ] = checkNameProperty( testStruct, default )
if isfield(testStruct, 'name')
structName = testStruct.name;
else
structName = default;
end
end
|
github | peterspat/handeyecalibration-master | writeConfig.m | .m | handeyecalibration-master/app/configuration/writeConfig.m | 487 | utf_8 | 84358b69c9351b3729088603eb949c40 | % Write data to an ini file
% fileDir: File path
% sectionName: Section(s) to write
% sectionData: Data of section(s)
function [ ] = writeConfig( fileDir, sectionName, sectionData )
if ~isempty(sectionName) && ~isempty(sectionData) && ~isempty(fileDir)
I = INI();
for i = 1:length(sectionName)
I.a... |
github | peterspat/handeyecalibration-master | startSimulation.m | .m | handeyecalibration-master/app/simulation/startSimulation.m | 192 | utf_8 | c8e03cd345265f420af0a45e9ffa0322 | % Start simulation
% simCon: Struct with simulation vars
function [] = startSimulation( simCon )
ret = simCon.vrep.simxStartSimulation(simCon.clientID, simCon.vrep.simx_opmode_oneshot);
end
|
github | peterspat/handeyecalibration-master | getSimTcpPose.m | .m | handeyecalibration-master/app/simulation/getSimTcpPose.m | 543 | utf_8 | 4dee1682a2320fd172fb81906a0c8fe5 | % Get current TCP pose from simulation
% simCon: Struct with simulation vars
function [res, tcpPose] = getSimTcpPose(simCon)
[errTcp, positionTcp] = simCon.vrep.simxGetObjectPosition(simCon.clientID, simCon.tcpHandle, simCon.baseHandle,...
simCon.vrep.simx_opmode_streaming);
[errTcpOrient, orientationTcp] = simC... |
github | peterspat/handeyecalibration-master | initialiseSimHandles.m | .m | handeyecalibration-master/app/simulation/initialiseSimHandles.m | 1,603 | utf_8 | c3e9ffc4d915a66369d50fea7910b5e3 | % Initialize simulation handles
% simCon: Struct with simulation vars
function [err, simCon] = initialiseSimHandles(simCon)
% Error handling?
[errVisionHandle, simCon.visionHandle] = simCon.vrep.simxGetObjectHandle(simCon.clientID, 'Vision_sensor#', simCon.vrep.simx_opmode_blocking);
[errBaseHandle, simCon.baseHandle... |
github | peterspat/handeyecalibration-master | stopSimulation.m | .m | handeyecalibration-master/app/simulation/stopSimulation.m | 343 | utf_8 | c426226268561c2826a09a585232e1e1 | % Stop simulatin
% Disconnect
% simCon: Struct with simulation vars
function [] = stopSimulation( simCon )
simCon.vrep.simxStopSimulation(simCon.clientID, simCon.vrep.simx_opmode_oneshot);
%close connection
simCon.vrep.simxGetPingTime(simCon.clientID); %make sure the last command could be sent
simCon.vrep.simxFinish(... |
github | peterspat/handeyecalibration-master | setTcpPose.m | .m | handeyecalibration-master/app/simulation/setTcpPose.m | 587 | utf_8 | 60b3e44bf5bbdf0d52b04e64bb6e9926 | % Set a TCP pose in simulation
% simCon: Struct with simulation vars
% tcpPose: TCP pose to simulate
function [res] = setTcpPose( simCon, tcpPose )
errSetTcpOrientation = simCon.vrep.simxSetObjectOrientation(simCon.clientID, simCon.tcpHandle, simCon.baseHandle, deg2rad(tcpPose(4:6)), simCon.vrep.simx_opmode_onesho... |
github | peterspat/handeyecalibration-master | convertSimData.m | .m | handeyecalibration-master/app/simulation/convertSimData.m | 879 | utf_8 | 1e857a4885b9f376895f1bc006f35668 | % Create a 4x4 hom matrix with converted orientaion for MATLAB
% Orientation has to be in ZYX
% simPosition: Simulated position of tcp
% simOrientation: Simulated orientation of tcp
function [ tcpPose ] = convertSimData(simPosition, simOrientation)
rotationX = [ 1 0 0;
0 cos(simO... |
github | peterspat/handeyecalibration-master | connectToSimulation.m | .m | handeyecalibration-master/app/simulation/connectToSimulation.m | 226 | utf_8 | e786f52bdbd44cd550dfcdfd3b9d89de | % Connect to simulation using API
function [simCon] = connectToSimulation()
simCon.vrep = remApi('remoteApi');
simCon.vrep.simxFinish(-1);
simCon.clientID = simCon.vrep.simxStart('127.0.0.1', 19997, true, true, 5000, 5);
end
|
github | peterspat/handeyecalibration-master | takePictureSimulation.m | .m | handeyecalibration-master/app/simulation/takePictureSimulation.m | 928 | utf_8 | bf4fbec845910aa4ffcc93e2bf31d62f | % Capture a picture from simulated camera
% simCon: Struct with simulation vars
% imageNumber: Number to enumerate images
% filePath: Path to store images
function [res, imgPath, imgName] = takePictureSimulation(simCon, imageNumber, filePath )
%Error?
[err, ~, image] = simCon.vrep.simxGetVisionSensorImage2(sim... |
github | peterspat/handeyecalibration-master | rpyToRotationMatrix.m | .m | handeyecalibration-master/app/utils/rpyToRotationMatrix.m | 496 | utf_8 | 94cceeb29ec6b80214caa8497a521f36 | % Create a 3x3 matrix from RPY
% angleRoll: Roll in deg
% anglePitch: Pitch in deg
% angleYaw: Yaw in deg
function matrix = rpyToRotationMatrix( angleRoll, anglePitch, angleYaw )
rz = [cosd(angleYaw) -sind(angleYaw) 0 ;
sind(angleYaw) cosd(angleYaw) 0;
0 0 1];
ry = [ cosd(anglePitch) 0 sind(anglePitch);
... |
github | peterspat/handeyecalibration-master | rotationMatrixToRPY.m | .m | handeyecalibration-master/app/utils/rotationMatrixToRPY.m | 300 | utf_8 | 44b80f2dc7353e596c69aa72098cba5e | % Convert a 3x3 matrix to RPY
% homMatrix: 3x3 matrix
function [ roll, pitch, yaw ] = rotationMatrixToRPY( homMatrix )
%roll, pitch, yaw in degrees
quat = rotm2quat(homMatrix(1:3, 1:3));
[yaw, pitch, roll] = quat2angle(quat);
yaw = rad2deg(yaw);
pitch = rad2deg(pitch);
roll = rad2deg(roll);
end
|
github | peterspat/handeyecalibration-master | intrinsicCalib.m | .m | handeyecalibration-master/app/calibration/intrinsicCalib.m | 2,491 | utf_8 | 75cc9a9a60fa7069a5df7a94df8802bb | % Computes intrinsic calibration based on input images
% calibImgPaths: Pathvector to input images
% tileSize: Checkerboard tile size
% untes: Calibration units (m or mm)
function [cameraParams, imagesUsed, correctedPoses, estimationErrors] = intrinsicCalib(calibImgPaths, tileSize, units)
% Detect checkerboards in im... |
github | peterspat/handeyecalibration-master | handEyeCalibrationTSAI.m | .m | handeyecalibration-master/app/calibration/handEyeCalibrationTSAI.m | 1,874 | utf_8 | d0a4277e76eeafc8fcac1275700d304e | % Computes hand eye calibration with Wengert and Lazax implementation
% Removes all poses based on reject images by intrinsic calibration
% cartCalibPoses: Cartesian calibration poses
% correctedPoeses: Corrected cartesian calibration poses
% imagesUsed: Mask (vector) with rejected and accepted images
function [ handE... |
github | peterspat/handeyecalibration-master | skew.m | .m | handeyecalibration-master/app/calibration/hand_eye_lazax/skew.m | 313 | utf_8 | 1ffb7c9e3ac57fd105e333a17e4fffdc | % skew - returns skew matrix of a 3x1 vector.
% cross(V,U) = skew(V)*U
%
% S = skew(V)
%
% 0 -Vz Vy
% S = Vz 0 -Vx
% -Vy Vx 0
%
% See also: cross
function S = skew(V)
S = [
0 -V(3) V(2)
V(3) 0 -V(1)
-V(2) V(1) 0
];
return |
github | peterspat/handeyecalibration-master | transl.m | .m | handeyecalibration-master/app/calibration/hand_eye_lazax/transl.m | 781 | utf_8 | ff802c2504225549449b1ebf4ec39c92 | %TRANSL Translational transform
%
% T= TRANSL(X, Y, Z)
% T= TRANSL( [X Y Z] )
%
% [X Y Z]' = TRANSL(T)
%
% [X Y Z] = TRANSL(TG)
%
% Returns a homogeneous transformation representing a
% translation of X, Y and Z.
%
% The third form returns the translational part of a
% homogenous transform as a 3-element column vector... |
github | peterspat/handeyecalibration-master | ishomog.m | .m | handeyecalibration-master/app/calibration/hand_eye_lazax/ishomog.m | 120 | utf_8 | 9e91b52f6191f56268e36e6b17c5c26f | %ISHOMOG test if argument is a homogeneous transformation (4x4)
function h = ishomog(tr)
h = all(size(tr) == [4 4]);
|
github | peterspat/handeyecalibration-master | HandEye.m | .m | handeyecalibration-master/app/calibration/hand_eye_lazax/HandEye.m | 3,686 | utf_8 | 4a3056c97c55081a586cefacff970721 | % handEye - performs hand/eye calibration
%
% gHc = handEye(bHg, wHc)
%
% bHg - pose of gripper relative to the robot base..
% (Gripper center is at: g0 = Hbg * [0;0;0;1] )
% Matrix dimensions are 4x4xM, where M is ..
% .. number of camera positions.
% Algorithm gives ... |
github | peterspat/handeyecalibration-master | rot2quat.m | .m | handeyecalibration-master/app/calibration/hand_eye_lazax/rot2quat.m | 559 | utf_8 | 17bdf7e834443b999dad81f1941d8c5b | % rot2quat - converts a rotation matrix (3x3) to a unit quaternion(3x1)
%
% q = rot2quat(R)
%
% R - 3x3 rotation matrix, or 4x4 homogeneous matrix
% q - 3x1 unit quaternion
% q = sin(theta/2) * v
% teta - rotation angle
% v - unit rotation axis, |v| = 1
%
%
% See also: quat2rot, r... |
github | peterspat/handeyecalibration-master | numcols.m | .m | handeyecalibration-master/app/calibration/hand_eye_lazax/numcols.m | 108 | utf_8 | 065bc5186f4187d9937109be1e3194f6 | %
% NUMCOLS(m)
%
% Return the number of columns in the matrix m
%
function c = numcols(m)
[x,c] = size(m);
|
github | peterspat/handeyecalibration-master | quat2rot.m | .m | handeyecalibration-master/app/calibration/hand_eye_lazax/quat2rot.m | 641 | utf_8 | f35d0832ae79ccda637f8f65f5d4705d | % quat2rot - a unit quaternion(3x1) to converts a rotation matrix (3x3)
%
% R = quat2rot(q)
%
% q - 3x1 unit quaternion
% R - 4x4 homogeneous rotation matrix (translation component is zero)
% q = sin(theta/2) * v
% teta - rotation angle
% v - unit rotation axis, |v| = 1
%
% See also:... |
github | peterspat/handeyecalibration-master | crossprod.m | .m | handeyecalibration-master/app/calibration/handy_eye_wengert/crossprod.m | 785 | utf_8 | 5003fcd4c9985c427422dada94d1cadb | %Defines the crossproduct as defined in hartley and zisserman
% [e2]x = as defined on p554 = [ 0,-e3,e2;
% e3,0,-e1;
% -e2.e1.0 ]
%
%Author: Christian Wengert,
% Institute of Computer Vision
% Swiss Feder... |
github | peterspat/handeyecalibration-master | TSAIleastSquareCalibration.m | .m | handeyecalibration-master/app/calibration/handy_eye_wengert/TSAIleastSquareCalibration.m | 3,251 | utf_8 | 3494e4560a73c011d5d50c374452a10d | %This computes the hand-eye calibration using Tsai and Lenz' method
%see the paper "A New Technique for Fully Autonomous and Efficient 3D
%Robotics Hand-Eye Calibration, Tsai, R.Y. and Lenz, R.K" for further
%details
%
%Input:
%Hmarker2world a 4x4xNumber_of_Views Matrix of the form
% Hmarker2worl... |
github | peterspat/handeyecalibration-master | rosConnection.m | .m | handeyecalibration-master/app/robot/rosConnection.m | 713 | utf_8 | d3bb04ea30dbdd628f7b9a6253c35d27 | % Connect to ROS
% masterIp: IP of rosmaster
% localhosIp: Local IP
% nodeName: Name of connecting node
function [ rosCon ] = rosConnection(masterIp, localhosIp, nodeName)
%ROS simple MATLAB connection
% Start
rosshutdown;
rosinit(masterIp, 'NodeHost',localhosIp,'NodeName',nodeName);
% Init Subscribers / Publishers ... |
github | peterspat/handeyecalibration-master | moveRobotToJointAngles.m | .m | handeyecalibration-master/app/robot/moveRobotToJointAngles.m | 555 | utf_8 | c556560501b466ee015284ab2a8e4896 | % Move robot to joint angles using ROS
% rosCon: Struct with ROS vars
% jointAngles: Robot joint angles
% vel: Robot velocity
function [ res ] = moveRobotToJointAngles( rosCon, jointAngles, vel)
res = 1;
if length(jointAngles) == 7
rosCon.jointsLWR1.Position = jointAngles;
rosCon.jointsLWR1.Velocity = [vel; ... |
github | peterspat/handeyecalibration-master | takePictureRobot.m | .m | handeyecalibration-master/app/robot/takePictureRobot.m | 616 | utf_8 | bd202700e1c3c0956695317d2312ba4a | % Capture a picture from a camera mounted on the robot
% shutterSpeed: Speed of shutter
% gain: Camera gain
% imagePath: Path to store image
function [imgPath, imgName] = takePictureRobot(shutterSpeed, gain, imagePath)
% shutterSpeed [ms], gain [db], metadata [struct]
metadata.sequence.saveDir = imagePath;
url = 'http... |
github | peterspat/handeyecalibration-master | getOrientationFromRPY.m | .m | handeyecalibration-master/app/robot/getOrientationFromRPY.m | 460 | utf_8 | 93e47455e67491680f25f42a2d5c9363 | % Compute orientation for ROS quaternion from RPY in degrees
% rollDegrees: Roll in deg
% pitchDegrees: Pitch in deg
% yawDegrees: Yaw in deg
function orientation = getOrientationFromRPY(rollDegrees, pitchDegrees, yawDegrees)
quat = angle2quat(deg2rad(yawDegrees),deg2rad(pitchDegrees),deg2rad(rollDegrees));
orientat... |
github | peterspat/handeyecalibration-master | reachedRobotJointAngles.m | .m | handeyecalibration-master/app/robot/reachedRobotJointAngles.m | 596 | utf_8 | ebb33ab452857b51860cd22d3c6e3be6 | % Check if robot has reached target joint angels
% rosCon: Struct with ROS vars
% targetJointAngles: Joint angles to reach
% precision: Succes stopping condition (err <= precision)
function [ res ] = reachedRobotJointAngles( rosCon, targetJointAngles, precision )
res = 0;
robotPose = getRobotPose(rosCon);
if length(... |
github | peterspat/handeyecalibration-master | moveRobotToCartPose.m | .m | handeyecalibration-master/app/robot/moveRobotToCartPose.m | 434 | utf_8 | 731d8009f0816c5b59c86779c037f022 | % Move the robot to a cart pose using ROS
% rosCon: Struct with ROS vars
% pose: Cartesian poose
function [res] = moveRobotToCartPose( rosCon, pose )
res = 1;
cartLWR1.Position.X = pose(1);
cartLWR1.Position.Y = pose(2);
cartLWR1.Position.Z = pose(3);
cartLWR1.Orientation = getOrientationFromRPY(pose(4), pose(5), po... |
github | peterspat/handeyecalibration-master | getRPYFromROSPose.m | .m | handeyecalibration-master/app/robot/getRPYFromROSPose.m | 281 | utf_8 | 436d5deb21db9e297099619a0ee21f7d | % Compute RPY from ROS pose
% pose: ROS pose
function [roll, pitch, yaw] = getRPYFromROSPose(pose)
[yaw, pitch, roll] = quat2angle([pose.Orientation.W pose.Orientation.X pose.Orientation.Y pose.Orientation.Z]);
roll = rad2deg(roll);
pitch = rad2deg(pitch);
yaw = rad2deg(yaw);
end |
github | peterspat/handeyecalibration-master | getRobotPose.m | .m | handeyecalibration-master/app/robot/getRobotPose.m | 458 | utf_8 | 043a4de9c7da9da2615236930ce1cdc9 | % Get current robot pose from ROS
% Store joint angles and cart pose
function [ robotPose ] = getRobotPose( rosCon )
cartLWR1 = receive(rosCon.subCartLWR1);
jointsLWR1 = receive(rosCon.subJointsLWR1);
[roll, pitch, yaw] = getRPYFromROSPose(cartLWR1);
% Store cart pose as a vector
robotPose.Cart = [cartLWR1.Positio... |
github | panji530/Maximizing-rigidity-revisited-master | getAngleCos.m | .m | Maximizing-rigidity-revisited-master/getAngleCos.m | 978 | utf_8 | 9b3f7e48885380519b2a1e9a38ceb781 | % This work was done while the first author was in the University of Adelaide. Copyright reserved.
function C = getAngleCos(m, NgIdx)
% compute the negative cosine of angles between legs
% Inputs: m -- 2D image coordinates
% NgIdx -- index of neighbors of each point
% KK -- intrinsic camera matrix
% Out... |
github | panji530/Maximizing-rigidity-revisited-master | RegisterToGTH.m | .m | Maximizing-rigidity-revisited-master/RegisterToGTH.m | 567 | utf_8 | f48500aa470477f5eddef5ca30181246 | % reference reconstruction to ground truth
function [Q,alpha,signo]=RegisterToGTH(Q,Qg)
% Author: Ajad Chhatkuli et al.
Qx=Q(1,:);
Qy=Q(2,:);
Qz=Q(3,:);
px=Qg(1,:);
py=Qg(2,:);
pz=Qg(3,:);
signo=1;
alpha=(inv(Qx(:)'*Qx(:)+Qy(:)'*Qy(:)+Qz(:)'*Qz(:))*(Qx(:)'*px(:)+Qy(:)'*py(:)+Qz(:)'*pz(:)));
Qx=alpha.*Qx;Qy=alpha.*Qy;Qz... |
github | panji530/Maximizing-rigidity-revisited-master | getNeighborsVis.m | .m | Maximizing-rigidity-revisited-master/getNeighborsVis.m | 634 | utf_8 | 91baff8a3ed1c9356de06d69f642ecde | % This work was done while the first author was in the University of Adelaide. Copyright reserved.
function [ IDX,dist_sort ] = getNeighborsVis( m, Ng, visb, opt )
% Author: Ajad Chhatkuli et al.
% Modified by Pan Ji
if(nargin<4)
opt = 'cityblock';
end
% get triangulation using pdist functions: Ng number of neighbo... |
github | roschkoenig/NMDAR-Ab_Encephalitis-master | plotshaded.m | .m | NMDAR-Ab_Encephalitis-master/Mouse IgG Model/Scripts/Other Tools/plotshaded.m | 872 | utf_8 | 879e9c099db8e6ea9d0607f55c81054b | % This functions was made by Jakob Voigts and is taken from:
% http://jvoigts.scripts.mit.edu/blog/nice-shaded-plots/
function varargout = plotshaded(x,y,fstr);
% x: x coordinates
% y: either just one y vector, or 2xN or 3xN matrix of y-data
% fstr: format ('r' or 'b--' etc)
%
% example
% x=[-10:.1:10];plotshaded(x,[s... |
github | matteomaspero/Manual-gold-FM-localisation-master | distinguishable_colors.m | .m | Manual-gold-FM-localisation-master/utils/distinguishable_colors.m | 5,753 | utf_8 | 57960cf5d13cead2f1e291d1288bccb2 | function colors = distinguishable_colors(n_colors,bg,func)
% DISTINGUISHABLE_COLORS: pick colors that are maximally perceptually distinct
%
% When plotting a set of lines, you may want to distinguish them by color.
% By default, Matlab chooses a small set of colors and cycles among them,
% and so if you have more than ... |
github | lequangduong/gimbalcontrol-master | GimbalModelCode.m | .m | gimbalcontrol-master/GimbalModelCode.m | 12,002 | utf_8 | 685127edcd54aaa01fca004e75ec7784 | %% =============== Declaration =================
clc;clear;close all
% ========= Notation of all joint angles is theta 1, 2, 3
gimbal.param.n = 3;
gimbal.param.theta = sym('theta_',[gimbal.param.n 1],'real');
gimbal.param.u = sym('u_' ,[gimbal.param.n 1],'real');
% === q = theta; %This variable is equivalen... |
github | lequangduong/gimbalcontrol-master | main.m | .m | gimbalcontrol-master/main.m | 19,011 | utf_8 | d7529a0a63127dd14d75555e1bd8060e | clc;clear;close all
load('variable.mat')
%% ============ SCHEME variable.mat ====================
% gimble
% - param
% -- n -> Number of DoF
% -- stime -> sample time
% -- t -> time
% -- tf -> time finite
% -- theta ... |
github | ylucet/CCA-master | plq_dom_test.m | .m | CCA-master/tests/plq_dom_test.m | 819 | utf_8 | 1f5e7cb8f3611c4ae041590a04bb1780 | function tests = plq_dom_test()
tests = functiontests(localfunctions);
end
function b = test1(testCase)
b=true;
%full domains
p=[inf 1 0 0];I=plq_dom(p);
b=b & isequal(I,[-inf,inf]);
p=[0,0,-1,0;inf,0,1,0];I=plq_dom(p);
b=b & isequal(I,[-inf,inf]);
%left bounded
p=[0,0,0,inf;1,0,0,0;inf,1,0,0];I=plq_d... |
github | ylucet/CCA-master | plq_isConvex_test.m | .m | CCA-master/tests/plq_isConvex_test.m | 1,238 | utf_8 | a57d12c698b2ddd5c1565a7989902260 | function tests = plq_isConvex_test()
tests = functiontests(localfunctions);
end
function b = testAbs(testCase)
%abs function
p = [0,0,-1,0;inf,0,1,0];
b = plq_isConvex(p);
assert(b)
end
function b = testQuartic(testCase)
function y=f(x), y=x.^4;end
function dy=df(x), dy=4*x.^3;end
x=linspace(-2,2,4)';
... |
github | ylucet/CCA-master | plq_build_test.m | .m | CCA-master/tests/plq_build_test.m | 6,169 | utf_8 | a2dc3cf6e53b7a7334edbba2621ec953 | function tests = plq_build_test()
tests = functiontests(localfunctions);
end
% unit tests ==========================================================
%1st order model
function [b] = testexp(testCase)
x=linspace(0,4)';
plqf = plq_build(x,@exp,@exp);
y=plq_eval(plqf,x);
b = norm(y-exp(x))<1E-8;
assert(all(all(b)... |
github | ylucet/CCA-master | plq_minPt_test.m | .m | CCA-master/tests/plq_minPt_test.m | 2,092 | utf_8 | f65cdffb0d2e26077dfbd7d8fd1d3a99 | function tests = plq_minPt_test()
tests = functiontests(localfunctions);
end
% I = Indicator, E = Exponential, C = Conjugate, L = Linear, Q = Quadratic
function b = prim(p, fmin, xmin)
[fm,xm] = plq_minPt(p);
b = isequal(fmin,fm) & isequal(xmin,xm);
end
function b = test1(testCase)
p = [inf, 0, 1, 0];
fmin =... |
github | ylucet/CCA-master | rock_test.m | .m | CCA-master/tests/rock_test.m | 1,017 | utf_8 | a0ec30a22e9ef8f2982e5ecb0c6a59ee | function tests = rock_test()
tests = functiontests(localfunctions);
end
% Author: Bryan Gardiner
% For: Yves Lucet
% Date: Summer 2008
function b = testRockBasic1(testCase)
b = false;
a = [1,2,4,5];
bm = [-5,-3,-1,10];
bp = [-3,-2, 1,20];
B = [a;bm;bp];
Rexp(:,:,1) = [1,0,-5,5;2,0,-3,3;4,0,-2,1;5,0,1,-1... |
github | ylucet/CCA-master | plq_check_test.m | .m | CCA-master/tests/plq_check_test.m | 463 | utf_8 | 107fd822df7f91bf0cbd3db320182676 | function tests = plq_check_test()
tests = functiontests(localfunctions);
end
function [b] = test1(testCase)
p=[-1 0 0 inf;0 0 0 0; 1 0 0 1;inf 0 0 inf];%discontinuous
b=~plq_check(p,2);
assert(b)
end
function [b] = test2(testCase)
p=[-1 0 0 inf;0 0 0 0; -0.5 0 0 0;inf 0 0 inf];%x nonincreasing
b=~plq_check(... |
github | ylucet/CCA-master | gph_plot_test.m | .m | CCA-master/tests/gph_plot_test.m | 1,841 | utf_8 | 56cfadfcda9ffb0521109901da31f976 | function tests = gph_plot_test()
tests = functiontests(localfunctions);
end
% Unit test file for _gph_plotbounds
function [b] = testPass1(testCase)
fabs=[-1 0 0 1 ; -1 -1 1 1; 1 0 0 1 ];
L{1} = fabs;
rect = gph_plotbounds(L);
b = all(rect==[-1.2,-1.2,1.2,1.2]);
assert(all(all(b)));
end
function [b] = testP... |
github | ylucet/CCA-master | epsUnique_test.m | .m | CCA-master/tests/epsUnique_test.m | 766 | utf_8 | 9fe5b12441090c3511a93dbd37640705 | function tests = epsUnique_test()
tests = functiontests(localfunctions);
end
function [b] = test1(testCase)
X=[1;1;2];eps=1E-6;
[Xu,ku]=epsUnique(X,eps);
b=isequal(Xu,[1;2]) & isequal(ku,[1;3]);
assert(b)
end
function [b] = test2(testCase)
eps=1E-6;
X=[1;1;1;1;1+eps/10;2];
[Xu,ku]=epsUnique(X,eps);
b... |
github | ylucet/CCA-master | plq_max_test.m | .m | CCA-master/tests/plq_max_test.m | 8,048 | utf_8 | 32cfd6fc916d604c3ae8c439d66df850 | function tests = plq_max_test()
tests = functiontests(localfunctions);
end
%L: Linear, Q: Quadratic, I: Indicator, PW: Piecewise
function [b] = testLLMax(testCase)
b = false;
plqf1 = [inf,0,1,0];
plqf2 = [inf,0,-1,0];
result = plq_max(plqf1,plqf2);
% x=linspace(-5,5,25)';
% ymax = plq_eval(result,x);
% plot2d(... |
github | ylucet/CCA-master | plq_eval_test.m | .m | CCA-master/tests/plq_eval_test.m | 1,197 | utf_8 | 56b29d6c76bfd5148a2e5d2933802243 | function tests = plq_eval_test()
tests = functiontests(localfunctions);
end
% Test-script for plq_eval (Yves Lucet - 2006-06-21)
%
% unit tests ==========================================================
function [b] = testXinsidex(testCase)
X=[1;2;4;5;7;8;9];
plqf=[3,0.5,0,0;6,0,0,0;inf,0,1,0];
[y,k] = plq_eval(plq... |
github | ylucet/CCA-master | plq_proj_test.m | .m | CCA-master/tests/plq_proj_test.m | 1,122 | utf_8 | 6e2c687000e97947354aa5350ad41526 | function tests = plq_proj_test()
tests = functiontests(localfunctions);
end
% Author: Yves Lucet
% Whatsit: Test file for plq_proj
function [b] = testProj(testCase)
b = false;
if (exist('quapro'))
n=200;
x=linspace(-2,2,n)';f=abs(abs(x)-1);
[plqr,fr]=plq_proj(f,x,2);
pr=plq_eval(p... |
github | ylucet/CCA-master | plq_scalar_test.m | .m | CCA-master/tests/plq_scalar_test.m | 3,865 | utf_8 | ce7c53d773b04e3bf179ca20dcb05878 | function tests = plq_scalar_test()
tests = functiontests(localfunctions);
end
% Unit test file for gph_scalar
function [b] = testAbs(testCase)
p =[0 0 -1 0; inf 0 1 0];%abs function
q=plq_scalar(p,3);
qq=[0 0 -3 0; inf 0 3 0];
b = plq_isEqual(q,qq);
q=plq_scalar(p,0);
qq=[inf 0 0 0];
b = b & ... |
github | ylucet/CCA-master | plq_gpa_test.m | .m | CCA-master/tests/plq_gpa_test.m | 1,301 | utf_8 | 779ac07969e1615ae3c1c2fb0e2f6c31 | function tests = plq_gpa_test()
tests = functiontests(localfunctions);
end
% I = Indicator, E = Exponential, C = Conjugate, L = Linear, Q = Quadratic
function [b] = testAbs(testCase)
p0=[0,0,-1,0;inf,0,1,0];p1=p0;
p =plq_gpa(p0,p1,0.5,1);
q = [-0.2 0 -1 -0.1;0.2 2.5 0 0;inf,0,1,-0.1];
b = plq_isEqual(p,q);
as... |
github | ylucet/CCA-master | gph_lft_test.m | .m | CCA-master/tests/gph_lft_test.m | 3,172 | utf_8 | ae2eaff95ae2cab27e1d839f20556c26 | function tests = gph_lft_test()
tests = functiontests(localfunctions);
end
% Unit test file for gph_lft
function b = testIsBounded(testCase)
g = [-1, 0, 0, 1;-1, -1, 1, 1;1, 0, 0, 1];%abs
b = all(gph_isBounded(g)==[false false]);
g = [-1 -1 1 1;-1 0 0 1;inf 0 0 inf];%I_[-1,1]
b = b & all(gph_isBounded(g)==[tru... |
github | ylucet/CCA-master | plq_me_test.m | .m | CCA-master/tests/plq_me_test.m | 1,576 | utf_8 | 6a393b4921d0571cb4962d44258ac6ca | function tests = plq_me_test()
tests = functiontests(localfunctions);
end
function [b] = testMELineWrapper(testCase)
b = false;
lambda=1;
fctn = [inf,0,1,1];
result = plq_me(fctn,lambda);
desired = [inf, 0, 1, 1/2];
b = all(result==desired);
assert(b);
end
function [b] = testMEQuadraticWrapper(testCase)
... |
github | ylucet/CCA-master | plq_prox_test.m | .m | CCA-master/tests/plq_prox_test.m | 2,481 | utf_8 | da01606f2a2a4ed5e18e565307a726df | function tests = gph_me_test()
tests = functiontests(localfunctions);
end
%perform all tests
%p: input plq function
%lambda: input real number lambda >0
function b = prim(p, lambda)
m=plq_me(p,lambda);
r=plq_prox(p,lambda);%monotone but nonconvex
%since there is no plq_compose function
%we numerically evaluat... |
github | ylucet/CCA-master | gph_me_test.m | .m | CCA-master/tests/gph_me_test.m | 3,440 | utf_8 | 26f294d4b3fb39fc2db0705af0255e47 | function tests = gph_me_test()
tests = functiontests(localfunctions);
end
% Unit test file for gph_me
%ME-Line Y=X+1
function [b] = testMELineWrapper(testCase)
b = false;
lambda = 1;
gph = [0 1; 1 1; 1 2]; % f(x) = x + 1
gphme = gph_me(gph, lambda);
X = (-5:0.5:5)';
result = gph_eval(gphme, X);
desired = X... |
github | ylucet/CCA-master | plq_coDirect_test.m | .m | CCA-master/tests/plq_coDirect_test.m | 9,789 | utf_8 | 2bd5d0abcb2e138da04394da2860be0b | function tests = plq_coDirect_test()
tests = functiontests(localfunctions);
end
% Author: Mike Trienis
% For: Dr. Yves Lucet
% Whatsit: A test file for plq convex hull functions plq_coDirect and _plq_conv_on_interval
% I = Indicator, E = Exponential, C = Conjugate, L = Linear, Q = Quadratic
function [b] = t... |
github | ylucet/CCA-master | gph_prox_test.m | .m | CCA-master/tests/gph_prox_test.m | 2,566 | utf_8 | 6dbdbd8c3c030f86ccc9109ea8a5fa49 | function tests = gph_prox_helper()
tests = functiontests(localfunctions);
end
%perform all tests
%P: input gph function
%lambda: input real number lambda >0
function b = helper(p, lambda)
P=gph_plq(p);
M=gph_me(P,lambda);%m=plq_me(p,lambda);
R=gph_prox(P,lambda);%r=plq_prox(p,lambda);%monotone but nonconvex
... |
github | ylucet/CCA-master | plq_clrDuplicateRows_test.m | .m | CCA-master/tests/plq_clrDuplicateRows_test.m | 2,969 | utf_8 | 3526e710c1b7419418a84baffc1b2a09 | function tests = plq_clrDuplicateRows_test()
tests = functiontests(localfunctions);
end
function [b] = testDuplicatePoints(testCase)
plqDirty=[0,1,0,0;0,2,0,0;1,2,3,4;inf,3,0,0];
plqClean=plq_clean(plqDirty);
plqdesired = [0,1,0,0;1,2,3,4;inf,3,0,0];
b = all(plqdesired==plqClean);
assert(all(all(b)));
end
func... |
github | ylucet/CCA-master | gph_eval_test.m | .m | CCA-master/tests/gph_eval_test.m | 3,373 | utf_8 | c61c1ea2049945108aac9473e5a3200e | function tests = gph_eval_test()
tests = functiontests(localfunctions);
end
function [b] = testIndicator(testCase)
eps = 1e-10;
gph = [-1 -1; -1 1; -3 -3];%I_{-1)-3
X = [-3; -2; -1; 0; 1; 2];
Z = gph_eval(gph, X);
expected = [inf; inf; -3; inf; inf; inf];
b = all(expected == Z | abs(expected - Z) < eps);
asser... |
github | ylucet/CCA-master | plq_lft_test.m | .m | CCA-master/tests/plq_lft_test.m | 5,179 | utf_8 | 0f78be12e4f713bb5ae6bdbfe677ce78 | function tests = plq_lft_test()
tests = functiontests(localfunctions);
end
% Author: Mike Trienis
% For: Dr. Yves Lucet
% Whatsit: A test file for plq
%L: Linear, Q: Quadratic, I: Indicator
function [b] = testLLNonsmooth(testCase)
b = false;
plqf = [ -1, 0, -1, -1; inf, 0, 1, 1];
result = plq_lft(plqf);
... |
github | ylucet/CCA-master | plq_ll_test.m | .m | CCA-master/tests/plq_ll_test.m | 572 | utf_8 | 3f3a36bb3694ae2305130129497eea77 | function tests = plq_ll_test()
tests = functiontests(localfunctions);
end
function [b] = test1(testCase)
b = false;
lambda=0.7;mu=0.4;
fctn = [-1,0,-1,-1;0,0,1,1;1,0,-1,1;inf,0,1,-1];
result = plq_ll(fctn,lambda,mu);
desired = [-1.3 0. -1. -1.15; -0.7 1.6666667 3.3333333 1.6666667;
-0.4 0. 1. 0.85; 0.4 ... |
github | ylucet/CCA-master | plq_gph_test.m | .m | CCA-master/tests/plq_gph_test.m | 1,910 | utf_8 | 81f8f57b27605fd0eea546be13c5545a | function tests = plq_gph_test()
tests = functiontests(localfunctions);
end
% Unit test file for plq_gph
function [b] = testAbs(testCase)
b = false;
%abs function
gph = [-1, 0, 0, 1; ...
-1, -1, 1, 1; ...
1, 0, 0, 1];
plq = plq_gph(gph);
expected = [0,0,-1,0; inf,0,1,0];
b = all(p... |
github | ylucet/CCA-master | plq_pa_test.m | .m | CCA-master/tests/plq_pa_test.m | 1,642 | utf_8 | 1b5fa5acc52497af96a880c288bc398a | function tests = plq_pa_test()
tests = functiontests(localfunctions);
end
% I = Indicator, E = Exponential, C = Conjugate, L = Linear, Q = Quadratic
function b = testL2Lpa(testCase)
lambda_pa = 0.5;
f1 = [inf, 0, 1, 0];
f2 = [inf, 0, -1, 5];
desired = [inf,0,0,2];
result = plq_pa(f1,f2,lambda_pa);
result2 = pl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.