From 70eb898129a58342fb5ea59c80898f1dd7765938 Mon Sep 17 00:00:00 2001 From: Walter Perdan Date: Fri, 15 May 2020 00:02:22 +0200 Subject: [PATCH 01/34] restoring ARMulti --- lib/SRC/ARMulti/Makefile.in | 93 +++++ lib/SRC/ARMulti/arMultiFreeConfig.c | 62 ++++ lib/SRC/ARMulti/arMultiGetTransMat.c | 271 +++++++++++++++ lib/SRC/ARMulti/arMultiGetTransMatStereo.c | 378 +++++++++++++++++++++ lib/SRC/ARMulti/arMultiReadConfigFile.c | 232 +++++++++++++ 5 files changed, 1036 insertions(+) create mode 100644 lib/SRC/ARMulti/Makefile.in create mode 100644 lib/SRC/ARMulti/arMultiFreeConfig.c create mode 100644 lib/SRC/ARMulti/arMultiGetTransMat.c create mode 100644 lib/SRC/ARMulti/arMultiGetTransMatStereo.c create mode 100644 lib/SRC/ARMulti/arMultiReadConfigFile.c diff --git a/lib/SRC/ARMulti/Makefile.in b/lib/SRC/ARMulti/Makefile.in new file mode 100644 index 0000000..b2d4f6a --- /dev/null +++ b/lib/SRC/ARMulti/Makefile.in @@ -0,0 +1,93 @@ +# +# Makefile +# ARToolKit5 +# +# This file is part of ARToolKit. +# +# ARToolKit is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# ARToolKit is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with ARToolKit. If not, see . +# +# As a special exception, the copyright holders of this library give you +# permission to link this library with independent modules to produce an +# executable, regardless of the license terms of these independent modules, and to +# copy and distribute the resulting executable under terms of your choice, +# provided that you also meet, for each linked independent module, the terms and +# conditions of the license of that module. An independent module is a module +# which is neither derived from nor based on this library. If you modify this +# library, you may extend this exception to your version of the library, but you +# are not obligated to do so. If you do not wish to do so, delete this exception +# statement from your version. +# +# Copyright 2015 Daqri, LLC. +# Copyright 2002-2015 ARToolworks, Inc. +# +# Author(s): Hirokazu Kato, Philip Lamb +# + +# +# For instalation. Change this to your settings. +# +INC_DIR = ../../../include +LIB_DIR = ../.. +# +# compiler +# +CC= @CC@ +CFLAG= @CFLAG@ -I$(INC_DIR) +# +# For making the library +# +AR=@AR@ +ARFLAGS=@ARFLAGS@ +RANLIB= @RANLIB@ +# +# products +# +LIB= ${LIB_DIR}/libARMulti.a +INCLUDE= ${INC_DIR}/AR/config.h \ + ${INC_DIR}/AR/arConfig.h \ + ${INC_DIR}/AR/matrix.h \ + ${INC_DIR}/AR/param.h \ + ${INC_DIR}/AR/ar.h \ + ${INC_DIR}/AR/arMulti.h +# +# compilation control +# +LIBOBJS= ${LIB}(arMultiReadConfigFile.o) \ + ${LIB}(arMultiFreeConfig.o) \ + ${LIB}(arMultiGetTransMat.o) \ + ${LIB}(arMultiGetTransMatStereo.o) + + +all: ${LIBOBJS} + +${LIBOBJS}: ${INCLUDE} + +.c.a: + ${CC} -c ${CFLAG} $< + ${AR} ${ARFLAGS} $@ $*.o + ${RANLIB} + rm -f $*.o + +clean: + rm -f *.o + rm -f ${LIB} + +allclean: + rm -f *.o + rm -f ${LIB} + rm -f Makefile + +distclean: + rm -f *.o + rm -f Makefile diff --git a/lib/SRC/ARMulti/arMultiFreeConfig.c b/lib/SRC/ARMulti/arMultiFreeConfig.c new file mode 100644 index 0000000..3b1a3b8 --- /dev/null +++ b/lib/SRC/ARMulti/arMultiFreeConfig.c @@ -0,0 +1,62 @@ +/* + * arMultiFreeConfig.c + * ARToolKit5 + * + * This file is part of ARToolKit. + * + * ARToolKit is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ARToolKit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with ARToolKit. If not, see . + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce an + * executable, regardless of the license terms of these independent modules, and to + * copy and distribute the resulting executable under terms of your choice, + * provided that you also meet, for each linked independent module, the terms and + * conditions of the license of that module. An independent module is a module + * which is neither derived from nor based on this library. If you modify this + * library, you may extend this exception to your version of the library, but you + * are not obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * + * Copyright 2015 Daqri, LLC. + * Copyright 2002-2015 ARToolworks, Inc. + * + * Author(s): Hirokazu Kato + * + */ +/******************************************************* + * + * Author: Hirokazu Kato + * + * kato@sys.im.hiroshima-cu.ac.jp + * + * Revision: 1.0 + * Date: 01/09/05 + * + *******************************************************/ + +#include +#include +#include +#include +#include + +int arMultiFreeConfig( ARMultiMarkerInfoT *config ) +{ + free( config->marker ); + free( config ); + config = NULL; + + return 0; +} + diff --git a/lib/SRC/ARMulti/arMultiGetTransMat.c b/lib/SRC/ARMulti/arMultiGetTransMat.c new file mode 100644 index 0000000..d263d7b --- /dev/null +++ b/lib/SRC/ARMulti/arMultiGetTransMat.c @@ -0,0 +1,271 @@ +/* + * arMultiGetTransMat.c + * ARToolKit5 + * + * This file is part of ARToolKit. + * + * ARToolKit is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ARToolKit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with ARToolKit. If not, see . + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce an + * executable, regardless of the license terms of these independent modules, and to + * copy and distribute the resulting executable under terms of your choice, + * provided that you also meet, for each linked independent module, the terms and + * conditions of the license of that module. An independent module is a module + * which is neither derived from nor based on this library. If you modify this + * library, you may extend this exception to your version of the library, but you + * are not obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * + * Copyright 2015 Daqri, LLC. + * Copyright 2002-2015 ARToolworks, Inc. + * + * Author(s): Hirokazu Kato, Philip Lamb + * + */ +/******************************************************* + * + * Author: Hirokazu Kato + * + * kato@sys.im.hiroshima-cu.ac.jp + * + * Revision: 1.0 + * Date: 01/09/05 + * + *******************************************************/ + +#include +#include +#include +#include +#include + +static ARdouble arGetTransMatMultiSquare2(AR3DHandle *handle, ARMarkerInfo *marker_info, int marker_num, + ARMultiMarkerInfoT *config, int robustFlag); + +ARdouble arGetTransMatMultiSquare(AR3DHandle *handle, ARMarkerInfo *marker_info, int marker_num, + ARMultiMarkerInfoT *config) +{ + return arGetTransMatMultiSquare2(handle, marker_info, marker_num, config, 0); +} + +ARdouble arGetTransMatMultiSquareRobust(AR3DHandle *handle, ARMarkerInfo *marker_info, int marker_num, + ARMultiMarkerInfoT *config) +{ + return arGetTransMatMultiSquare2(handle, marker_info, marker_num, config, 1); +} + +static ARdouble arGetTransMatMultiSquare2(AR3DHandle *handle, ARMarkerInfo *marker_info, int marker_num, + ARMultiMarkerInfoT *config, int robustFlag) +{ + ARdouble *pos2d, *pos3d; + ARdouble trans1[3][4], trans2[3][4]; + ARdouble err, err2; + int max, maxArea; + int vnum; + int dir; + int i, j, k; + //char mes[12]; + + //ARLOG("-- Pass1--\n"); + for( i = 0; i < config->marker_num; i++ ) { + k = -1; + if( config->marker[i].patt_type == AR_MULTI_PATTERN_TYPE_TEMPLATE ) { + for( j = 0; j < marker_num; j++ ) { + if( marker_info[j].idPatt != config->marker[i].patt_id ) continue; + if( marker_info[j].cfPatt < config->cfPattCutoff ) continue; + if( k == -1 ) k = j; + else if( marker_info[k].cfPatt < marker_info[j].cfPatt ) k = j; + } + config->marker[i].visible = k; + if( k >= 0 ) marker_info[k].dir = marker_info[k].dirPatt; + } + else { // config->marker[i].patt_type == AR_MULTI_PATTERN_TYPE_MATRIX + for( j = 0; j < marker_num; j++ ) { + // Check if we need to examine the globalID rather than patt_id. + if (marker_info[j].idMatrix == 0 && marker_info[j].globalID != 0ULL) { + if( marker_info[j].globalID != config->marker[i].globalID ) continue; + } else { + if( marker_info[j].idMatrix != config->marker[i].patt_id ) continue; + } + if( marker_info[j].cfMatrix < config->cfMatrixCutoff ) continue; + if( k == -1 ) k = j; + else if( marker_info[k].cfMatrix < marker_info[j].cfMatrix ) k = j; + } + config->marker[i].visible = k; + if( k >= 0 ) marker_info[k].dir = marker_info[k].dirMatrix; + } + //if(k>=0) ARLOG(" *%d\n",i); + } + + //ARLOG("-- Pass2--\n"); + vnum = 0; + for( i = 0; i < config->marker_num; i++ ) { + if( (j=config->marker[i].visible) < 0 ) continue; + + //glColor3f( 1.0, 1.0, 0.0 ); + //sprintf(mes,"%d",i); + //argDrawStringsByIdealPos( mes, marker_info[j].pos[0], marker_info[j].pos[1] ); + err = arGetTransMatSquare(handle, &marker_info[j], config->marker[i].width, trans2); + //ARLOG(" [%d:dir=%d] err = %f (%f,%f,%f)\n", i, marker_info[j].dir, err, trans2[0][3], trans2[1][3], trans2[2][3]); + if( err > AR_MULTI_POSE_ERROR_CUTOFF_EACH_DEFAULT ) { + config->marker[i].visible = -1; + if (marker_info[j].cutoffPhase == AR_MARKER_INFO_CUTOFF_PHASE_NONE) marker_info[j].cutoffPhase = AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR; + continue; + } + //ARLOG(" *%d\n",i); + + // Use the largest (in terms of 2D coordinates) marker's pose estimate as the + // input for the initial estimate for the pose estimator. + if( vnum == 0 || maxArea < marker_info[j].area ) { + maxArea = marker_info[j].area; + max = i; + for( j = 0; j < 3; j++ ) { + for( k = 0; k < 4; k++ ) trans1[j][k] = trans2[j][k]; + } + } + vnum++; + } + if( vnum == 0 || vnum < config->min_submarker) { + config->prevF = 0; + return -1; + } + arUtilMatMul( (const ARdouble (*)[4])trans1, (const ARdouble (*)[4])config->marker[max].itrans, trans2 ); + + arMalloc(pos2d, ARdouble, vnum*4*2); + arMalloc(pos3d, ARdouble, vnum*4*3); + + j = 0; + for( i = 0; i < config->marker_num; i++ ) { + if( (k=config->marker[i].visible) < 0 ) continue; + + dir = marker_info[k].dir; + pos2d[j*8+0] = marker_info[k].vertex[(4-dir)%4][0]; + pos2d[j*8+1] = marker_info[k].vertex[(4-dir)%4][1]; + pos2d[j*8+2] = marker_info[k].vertex[(5-dir)%4][0]; + pos2d[j*8+3] = marker_info[k].vertex[(5-dir)%4][1]; + pos2d[j*8+4] = marker_info[k].vertex[(6-dir)%4][0]; + pos2d[j*8+5] = marker_info[k].vertex[(6-dir)%4][1]; + pos2d[j*8+6] = marker_info[k].vertex[(7-dir)%4][0]; + pos2d[j*8+7] = marker_info[k].vertex[(7-dir)%4][1]; + pos3d[j*12+0] = config->marker[i].pos3d[0][0]; + pos3d[j*12+1] = config->marker[i].pos3d[0][1]; + pos3d[j*12+2] = config->marker[i].pos3d[0][2]; + pos3d[j*12+3] = config->marker[i].pos3d[1][0]; + pos3d[j*12+4] = config->marker[i].pos3d[1][1]; + pos3d[j*12+5] = config->marker[i].pos3d[1][2]; + pos3d[j*12+6] = config->marker[i].pos3d[2][0]; + pos3d[j*12+7] = config->marker[i].pos3d[2][1]; + pos3d[j*12+8] = config->marker[i].pos3d[2][2]; + pos3d[j*12+9] = config->marker[i].pos3d[3][0]; + pos3d[j*12+10] = config->marker[i].pos3d[3][1]; + pos3d[j*12+11] = config->marker[i].pos3d[3][2]; + j++; + } + + + if( config->prevF == 0 ) { + if( robustFlag ) { + err = arGetTransMat( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + if( err >= AR_MULTI_POSE_ERROR_CUTOFF_COMBINED_DEFAULT ) { + icpSetInlierProbability( handle->icpHandle, 0.8 ); + err = arGetTransMatRobust( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + if( err >= AR_MULTI_POSE_ERROR_CUTOFF_COMBINED_DEFAULT ) { + icpSetInlierProbability( handle->icpHandle, 0.6 ); + err = arGetTransMatRobust( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + if( err >= AR_MULTI_POSE_ERROR_CUTOFF_COMBINED_DEFAULT ) { + icpSetInlierProbability( handle->icpHandle, 0.4 ); + err = arGetTransMatRobust( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + if( err >= AR_MULTI_POSE_ERROR_CUTOFF_COMBINED_DEFAULT ) { + icpSetInlierProbability( handle->icpHandle, 0.0 ); + err = arGetTransMatRobust( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + } + } + } + } + } + else { + err = arGetTransMat( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + } + free(pos3d); + free(pos2d); + } + else { + if( robustFlag ) { + err2 = arGetTransMat( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, trans1 ); + err = arGetTransMat( handle, config->trans, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + if( err >= AR_MULTI_POSE_ERROR_CUTOFF_COMBINED_DEFAULT ) { + icpSetInlierProbability( handle->icpHandle, 0.8 ); + err2 = arGetTransMatRobust( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, trans1 ); + err = arGetTransMatRobust( handle, config->trans, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + if( err >= AR_MULTI_POSE_ERROR_CUTOFF_COMBINED_DEFAULT ) { + icpSetInlierProbability( handle->icpHandle, 0.6 ); + err2 = arGetTransMatRobust( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, trans1 ); + err = arGetTransMatRobust( handle, config->trans, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + if( err >= AR_MULTI_POSE_ERROR_CUTOFF_COMBINED_DEFAULT ) { + icpSetInlierProbability( handle->icpHandle, 0.4 ); + err2 = arGetTransMatRobust( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, trans1 ); + err = arGetTransMatRobust( handle, config->trans, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + if( err >= AR_MULTI_POSE_ERROR_CUTOFF_COMBINED_DEFAULT ) { + icpSetInlierProbability( handle->icpHandle, 0.0 ); + err2 = arGetTransMatRobust( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, trans1 ); + err = arGetTransMatRobust( handle, config->trans, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + } + } + } + } + } + else { + err2 = arGetTransMat( handle, trans2, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, trans1 ); + err = arGetTransMat( handle, config->trans, (ARdouble (*)[2])pos2d, (ARdouble (*)[3])pos3d, vnum*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + } + free(pos3d); + free(pos2d); + } + + if (err < AR_MULTI_POSE_ERROR_CUTOFF_COMBINED_DEFAULT) config->prevF = 1; + else { + config->prevF = 0; + for (i = 0; i < config->marker_num; i++) { + if ((k = config->marker[i].visible) < 0) continue; + if (marker_info[k].cutoffPhase == AR_MARKER_INFO_CUTOFF_PHASE_NONE) marker_info[k].cutoffPhase = AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI; + } + } + + return err; +} diff --git a/lib/SRC/ARMulti/arMultiGetTransMatStereo.c b/lib/SRC/ARMulti/arMultiGetTransMatStereo.c new file mode 100644 index 0000000..1cf8822 --- /dev/null +++ b/lib/SRC/ARMulti/arMultiGetTransMatStereo.c @@ -0,0 +1,378 @@ +/* + * arMultiGetTransMatStereo.c + * ARToolKit5 + * + * This file is part of ARToolKit. + * + * ARToolKit is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ARToolKit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with ARToolKit. If not, see . + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce an + * executable, regardless of the license terms of these independent modules, and to + * copy and distribute the resulting executable under terms of your choice, + * provided that you also meet, for each linked independent module, the terms and + * conditions of the license of that module. An independent module is a module + * which is neither derived from nor based on this library. If you modify this + * library, you may extend this exception to your version of the library, but you + * are not obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * + * Copyright 2015 Daqri, LLC. + * Copyright 2002-2015 ARToolworks, Inc. + * + * Author(s): Hirokazu Kato + * + */ +/******************************************************* + * + * Author: Hirokazu Kato + * + * kato@sys.im.hiroshima-cu.ac.jp + * + * Revision: 1.0 + * Date: 01/12/11 + * + *******************************************************/ + +#include +#include +#include +#include +#include + +#define THRESH_1 4.0 +#define THRESH_2 20.0 + +static ARdouble arGetTransMatMultiSquareStereo2(AR3DStereoHandle *handle, + ARMarkerInfo *marker_infoL, int marker_numL, + ARMarkerInfo *marker_infoR, int marker_numR, + ARMultiMarkerInfoT *config, int robustFlag); + + +ARdouble arGetTransMatMultiSquareStereo(AR3DStereoHandle *handle, + ARMarkerInfo *marker_infoL, int marker_numL, + ARMarkerInfo *marker_infoR, int marker_numR, + ARMultiMarkerInfoT *config) +{ + return arGetTransMatMultiSquareStereo2(handle, marker_infoL, marker_numL, marker_infoR, marker_numR, + config, 0); +} + +ARdouble arGetTransMatMultiSquareStereoRobust(AR3DStereoHandle *handle, + ARMarkerInfo *marker_infoL, int marker_numL, + ARMarkerInfo *marker_infoR, int marker_numR, + ARMultiMarkerInfoT *config) +{ + return arGetTransMatMultiSquareStereo2(handle, marker_infoL, marker_numL, marker_infoR, marker_numR, + config, 1); +} + + +static ARdouble arGetTransMatMultiSquareStereo2(AR3DStereoHandle *handle, + ARMarkerInfo *marker_infoL, int marker_numL, + ARMarkerInfo *marker_infoR, int marker_numR, + ARMultiMarkerInfoT *config, int robustFlag) + +{ + ARdouble *pos2dL = NULL, *pos3dL = NULL; + ARdouble *pos2dR = NULL, *pos3dR = NULL; + ARdouble trans1[3][4], trans2[3][4]; + ARdouble err, err2; + int max, maxArea; + int vnumL, vnumR; + int dir; + int i, j, k; + + for( i = 0; i < config->marker_num; i++ ) { + k = -1; + if( config->marker[i].patt_type == AR_MULTI_PATTERN_TYPE_TEMPLATE ) { + for( j = 0; j < marker_numL; j++ ) { + if( marker_infoL[j].idPatt != config->marker[i].patt_id ) continue; + if( marker_infoL[j].cfPatt < 0.50 ) continue; + if( k == -1 ) k = j; + else if( marker_infoL[k].cfPatt < marker_infoL[j].cfPatt ) k = j; + } + config->marker[i].visible = k; + if( k >= 0 ) { + marker_infoL[k].dir = marker_infoL[k].dirPatt; + } + } + else { + for( j = 0; j < marker_numL; j++ ) { + if( marker_infoL[j].idMatrix != config->marker[i].patt_id ) continue; + if( marker_infoL[j].cfMatrix < 0.50 ) continue; + if( k == -1 ) k = j; + else if( marker_infoL[k].cfMatrix < marker_infoL[j].cfMatrix ) k = j; + } + config->marker[i].visible = k; + if( k >= 0 ) { + marker_infoL[k].dir = marker_infoL[k].dirMatrix; + } + } + + k = -1; + if( config->marker[i].patt_type == AR_MULTI_PATTERN_TYPE_TEMPLATE ) { + for( j = 0; j < marker_numR; j++ ) { + if( marker_infoR[j].idPatt != config->marker[i].patt_id ) continue; + if( marker_infoR[j].cfPatt < 0.50 ) continue; + if( k == -1 ) k = j; + else if( marker_infoR[k].cfPatt < marker_infoR[j].cfPatt ) k = j; + } + config->marker[i].visibleR = k; + if( k >= 0 ) { + marker_infoR[k].dir = marker_infoR[k].dirPatt; + } + } + else { + for( j = 0; j < marker_numR; j++ ) { + if( marker_infoR[j].idMatrix != config->marker[i].patt_id ) continue; + if( marker_infoR[j].cfMatrix < 0.50 ) continue; + if( k == -1 ) k = j; + else if( marker_infoR[k].cfMatrix < marker_infoR[j].cfMatrix ) k = j; + } + config->marker[i].visibleR = k; + if( k >= 0 ) { + marker_infoR[k].dir = marker_infoR[k].dirMatrix; + } + } + } + + vnumL = 0; + for( i = 0; i < config->marker_num; i++ ) { + if( (j=config->marker[i].visible) == -1 ) continue; + + err = arGetTransMatSquareStereo( handle, &marker_infoL[j], NULL, config->marker[i].width, trans2 ); + if( err > THRESH_1 ) { + config->marker[i].visible = -1; +//ARLOG("err = %f\n", err); + continue; + } + + if( vnumL == 0 || maxArea < marker_infoL[j].area ) { + maxArea = marker_infoL[j].area; + max = i; + for( j = 0; j < 3; j++ ) { + for( k = 0; k < 4; k++ ) trans1[j][k] = trans2[j][k]; + } + } + vnumL++; + } + vnumR = 0; + for( i = 0; i < config->marker_num; i++ ) { + if( (j=config->marker[i].visibleR) == -1 ) continue; + + err = arGetTransMatSquareStereo( handle, NULL, &marker_infoR[j], config->marker[i].width, trans2 ); + if( err > THRESH_1 ) { + config->marker[i].visibleR = -1; +//ARLOG("err = %f\n", err); + continue; + } + + if( (vnumL == 0 && vnumR == 0) || maxArea < marker_infoR[j].area ) { + maxArea = marker_infoR[j].area; + max = i; + for( j = 0; j < 3; j++ ) { + for( k = 0; k < 4; k++ ) trans1[j][k] = trans2[j][k]; + } + } + vnumR++; + } +//ARLOG("vnumL=%d, vnumR=%d\n", vnumL, vnumR); + if( (vnumL == 0 && vnumR == 0) || (vnumL < config->min_submarker && vnumR < config->min_submarker) ) { + config->prevF = 0; +//ARLOG("**** NG.\n"); + return -1; + } + + + if(vnumL > 0) { + arMalloc(pos2dL, ARdouble, vnumL*4*2); + arMalloc(pos3dL, ARdouble, vnumL*4*3); + } + if(vnumR > 0) { + arMalloc(pos2dR, ARdouble, vnumR*4*2); + arMalloc(pos3dR, ARdouble, vnumR*4*3); + } + + j = 0; + for( i = 0; i < config->marker_num; i++ ) { + if( (k=config->marker[i].visible) < 0 ) continue; + dir = marker_infoL[k].dir; + pos2dL[j*8+0] = marker_infoL[k].vertex[(4-dir)%4][0]; + pos2dL[j*8+1] = marker_infoL[k].vertex[(4-dir)%4][1]; + pos2dL[j*8+2] = marker_infoL[k].vertex[(5-dir)%4][0]; + pos2dL[j*8+3] = marker_infoL[k].vertex[(5-dir)%4][1]; + pos2dL[j*8+4] = marker_infoL[k].vertex[(6-dir)%4][0]; + pos2dL[j*8+5] = marker_infoL[k].vertex[(6-dir)%4][1]; + pos2dL[j*8+6] = marker_infoL[k].vertex[(7-dir)%4][0]; + pos2dL[j*8+7] = marker_infoL[k].vertex[(7-dir)%4][1]; + pos3dL[j*12+0] = config->marker[i].pos3d[0][0]; + pos3dL[j*12+1] = config->marker[i].pos3d[0][1]; + pos3dL[j*12+2] = config->marker[i].pos3d[0][2]; + pos3dL[j*12+3] = config->marker[i].pos3d[1][0]; + pos3dL[j*12+4] = config->marker[i].pos3d[1][1]; + pos3dL[j*12+5] = config->marker[i].pos3d[1][2]; + pos3dL[j*12+6] = config->marker[i].pos3d[2][0]; + pos3dL[j*12+7] = config->marker[i].pos3d[2][1]; + pos3dL[j*12+8] = config->marker[i].pos3d[2][2]; + pos3dL[j*12+9] = config->marker[i].pos3d[3][0]; + pos3dL[j*12+10] = config->marker[i].pos3d[3][1]; + pos3dL[j*12+11] = config->marker[i].pos3d[3][2]; + j++; + } + + j = 0; + for( i = 0; i < config->marker_num; i++ ) { + if( (k=config->marker[i].visibleR) < 0 ) continue; + dir = marker_infoR[k].dir; + pos2dR[j*8+0] = marker_infoR[k].vertex[(4-dir)%4][0]; + pos2dR[j*8+1] = marker_infoR[k].vertex[(4-dir)%4][1]; + pos2dR[j*8+2] = marker_infoR[k].vertex[(5-dir)%4][0]; + pos2dR[j*8+3] = marker_infoR[k].vertex[(5-dir)%4][1]; + pos2dR[j*8+4] = marker_infoR[k].vertex[(6-dir)%4][0]; + pos2dR[j*8+5] = marker_infoR[k].vertex[(6-dir)%4][1]; + pos2dR[j*8+6] = marker_infoR[k].vertex[(7-dir)%4][0]; + pos2dR[j*8+7] = marker_infoR[k].vertex[(7-dir)%4][1]; + pos3dR[j*12+0] = config->marker[i].pos3d[0][0]; + pos3dR[j*12+1] = config->marker[i].pos3d[0][1]; + pos3dR[j*12+2] = config->marker[i].pos3d[0][2]; + pos3dR[j*12+3] = config->marker[i].pos3d[1][0]; + pos3dR[j*12+4] = config->marker[i].pos3d[1][1]; + pos3dR[j*12+5] = config->marker[i].pos3d[1][2]; + pos3dR[j*12+6] = config->marker[i].pos3d[2][0]; + pos3dR[j*12+7] = config->marker[i].pos3d[2][1]; + pos3dR[j*12+8] = config->marker[i].pos3d[2][2]; + pos3dR[j*12+9] = config->marker[i].pos3d[3][0]; + pos3dR[j*12+10] = config->marker[i].pos3d[3][1]; + pos3dR[j*12+11] = config->marker[i].pos3d[3][2]; + j++; + } + + if( config->prevF == 0 ) { + arUtilMatMul( (const ARdouble (*)[4])trans1, (const ARdouble (*)[4])config->marker[max].itrans, trans2 ); + if( robustFlag ) { + err = arGetTransMatStereo( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + if( err >= THRESH_2 ) { + icpStereoSetInlierProbability( handle->icpStereoHandle, 0.8 ); + err = arGetTransMatStereoRobust( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + if( err >= THRESH_2 ) { + icpStereoSetInlierProbability( handle->icpStereoHandle, 0.6 ); + err = arGetTransMatStereoRobust( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + if( err >= THRESH_2 ) { + icpStereoSetInlierProbability( handle->icpStereoHandle, 0.4 ); + err = arGetTransMatStereoRobust( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + if( err >= THRESH_2 ) { + icpStereoSetInlierProbability( handle->icpStereoHandle, 0.0 ); + err = arGetTransMatStereoRobust( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + } + } + } + } + } + else { + err = arGetTransMatStereo( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + } + } + else { + arUtilMatMul( (const ARdouble (*)[4])trans1, (const ARdouble (*)[4])config->marker[max].itrans, trans2 ); + if( robustFlag ) { + err2 = arGetTransMatStereo( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, trans1 ); + err = arGetTransMatStereo( handle, config->trans, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + if( err >= THRESH_2 ) { + icpStereoSetInlierProbability( handle->icpStereoHandle, 0.8 ); + err2 = arGetTransMatStereoRobust( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, trans1 ); + err = arGetTransMatStereoRobust( handle, config->trans, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + if( err >= THRESH_2 ) { + icpStereoSetInlierProbability( handle->icpStereoHandle, 0.6 ); + err2 = arGetTransMatStereoRobust( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, trans1 ); + err = arGetTransMatStereoRobust( handle, config->trans, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + if( err >= THRESH_2 ) { + icpStereoSetInlierProbability( handle->icpStereoHandle, 0.4 ); + err2 = arGetTransMatStereoRobust( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, trans1 ); + err = arGetTransMatStereoRobust( handle, config->trans, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + if( err >= THRESH_2 ) { + icpStereoSetInlierProbability( handle->icpStereoHandle, 0.0 ); + err2 = arGetTransMatStereoRobust( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, trans1 ); + err = arGetTransMatStereoRobust( handle, config->trans, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + } + } + } + } + } + else { + err2 = arGetTransMatStereo( handle, trans2, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, trans1 ); + err = arGetTransMatStereo( handle, config->trans, (ARdouble (*)[2])pos2dL, (ARdouble (*)[3])pos3dL, vnumL*4, + (ARdouble (*)[2])pos2dR, (ARdouble (*)[3])pos3dR, vnumR*4, config->trans ); + if( err2 < err ) { + for( j = 0; j < 3; j++ ) for( i = 0; i < 4; i++ ) config->trans[j][i] = trans1[j][i]; + err = err2; + } + } + } + + if( vnumL > 0 ) { + free(pos3dL); + free(pos2dL); + } + if( vnumR > 0 ) { + free(pos3dR); + free(pos2dR); + } + + if( err < THRESH_2 ) { + config->prevF = 1; + } + else { + config->prevF = 0; + } + + return err; +} diff --git a/lib/SRC/ARMulti/arMultiReadConfigFile.c b/lib/SRC/ARMulti/arMultiReadConfigFile.c new file mode 100644 index 0000000..f0a1a0f --- /dev/null +++ b/lib/SRC/ARMulti/arMultiReadConfigFile.c @@ -0,0 +1,232 @@ +/* + * arMultiReadConfigFile.c + * ARToolKit5 + * + * This file is part of ARToolKit. + * + * ARToolKit is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ARToolKit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with ARToolKit. If not, see . + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce an + * executable, regardless of the license terms of these independent modules, and to + * copy and distribute the resulting executable under terms of your choice, + * provided that you also meet, for each linked independent module, the terms and + * conditions of the license of that module. An independent module is a module + * which is neither derived from nor based on this library. If you modify this + * library, you may extend this exception to your version of the library, but you + * are not obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * + * Copyright 2015 Daqri, LLC. + * Copyright 2002-2015 ARToolworks, Inc. + * + * Author(s): Hirokazu Kato, Philip Lamb + * + */ +/******************************************************* + * + * Author: Hirokazu Kato + * + * kato@sys.im.hiroshima-cu.ac.jp + * + * Revision: 1.0 + * Date: 01/09/05 + * + *******************************************************/ + +#include +#include +#include +#include +#include +#include + +static char *get_buff( char *buf, int n, FILE *fp ); + +ARMultiMarkerInfoT *arMultiReadConfigFile( const char *filename, ARPattHandle *pattHandle ) +{ + FILE *fp; + ARMultiEachMarkerInfoT *marker; + ARMultiMarkerInfoT *marker_info; + ARdouble wpos3d[4][2]; + char buf[256], pattPath[2048], dummy; + int num; + int patt_type = 0; + int i, j; + + if ((fp = fopen(filename, "r")) == NULL) { + ARLOGe("Error: unable to open multimarker config file '%s'.\n", filename); + ARLOGperror(NULL); + return NULL; + } + + get_buff(buf, 256, fp); + if( sscanf(buf, "%d", &num) != 1 ) { + ARLOGe("Error processing multimarker config file '%s': First line must be number of marker configs to read.\n", filename); + fclose(fp); + return NULL; + } + ARLOGd("Reading %d markers from multimarker file '%s'\n", num, filename); + + arMalloc(marker, ARMultiEachMarkerInfoT, num); + + for( i = 0; i < num; i++ ) { + get_buff(buf, 256, fp); + if (sscanf(buf, +#if defined(__LP64__) && !defined(__APPLE__) + "%lu%c", +#else + "%llu%c", +#endif + &(marker[i].globalID), &dummy) != 1) { // Try first as matrix code. + + if (!pattHandle) { + ARLOGe("Error processing multimarker config file '%s': pattern '%s' specified in multimarker configuration while in barcode-only mode.\n", filename, buf); + goto bail; + } + if (!arUtilGetDirectoryNameFromPath(pattPath, filename, sizeof(pattPath), 1)) { // Get directory prefix. + ARLOGe("Error processing multimarker config file '%s': Unable to determine directory name.\n", filename); + goto bail; + } + strncat(pattPath, buf, sizeof(pattPath) - strlen(pattPath) - 1); // Add name of file to open. + if ((marker[i].patt_id = arPattLoad(pattHandle, pattPath)) < 0) { + ARLOGe("Error processing multimarker config file '%s': Unable to load pattern '%s'.\n", filename, pattPath); + goto bail; + } + marker[i].patt_type = AR_MULTI_PATTERN_TYPE_TEMPLATE; + patt_type |= 0x01; + } else { + + if ((marker[i].globalID & 0xffff8000ULL) == 0ULL) marker[i].patt_id = (int)(marker[i].globalID & 0x00007fffULL); // If upper 33 bits are zero, use lower 31 bits as regular matrix code. + else marker[i].patt_id = 0; + ARLOGd("Marker %3d is matrix code %llu.\n", i + 1, marker[i].globalID); + marker[i].patt_type = AR_MULTI_PATTERN_TYPE_MATRIX; + patt_type |= 0x02; + } + + get_buff(buf, 256, fp); + if( sscanf(buf, +#ifdef ARDOUBLE_IS_FLOAT + "%f", +#else + "%lf", +#endif + &marker[i].width) != 1 ) { + ARLOGe("Error processing multimarker config file '%s', marker definition %3d: First line must be pattern width.\n", filename, i + 1); + goto bail; + } + + j = 0; + get_buff(buf, 256, fp); + if( sscanf(buf, +#ifdef ARDOUBLE_IS_FLOAT + "%f %f %f %f", +#else + "%lf %lf %lf %lf", +#endif + &marker[i].trans[j][0], + &marker[i].trans[j][1], + &marker[i].trans[j][2], + &marker[i].trans[j][3]) != 4 ) { + // Perhaps this is an old ARToolKit v2.x multimarker file? + // If so, then the next line is two values (center) and should be skipped. + float t1, t2; + if( sscanf(buf, + "%f %f", + &t1, &t2) != 2 ) { + ARLOGe("Error processing multimarker config file '%s', marker definition %3d: Lines 2 - 4 must be marker transform.\n", filename, i + 1); + goto bail; + } + } else j++; + do { + get_buff(buf, 256, fp); + if( sscanf(buf, +#ifdef ARDOUBLE_IS_FLOAT + "%f %f %f %f", +#else + "%lf %lf %lf %lf", +#endif + &marker[i].trans[j][0], + &marker[i].trans[j][1], + &marker[i].trans[j][2], + &marker[i].trans[j][3]) != 4 ) { + ARLOGe("Error processing multimarker config file '%s', marker definition %3d: Lines 2 - 4 must be marker transform.\n", filename, i + 1); + goto bail; + } + j++; + } while (j < 3); + arUtilMatInv( (const ARdouble (*)[4])marker[i].trans, marker[i].itrans ); + + wpos3d[0][0] = -marker[i].width/2.0; + wpos3d[0][1] = marker[i].width/2.0; + wpos3d[1][0] = marker[i].width/2.0; + wpos3d[1][1] = marker[i].width/2.0; + wpos3d[2][0] = marker[i].width/2.0; + wpos3d[2][1] = -marker[i].width/2.0; + wpos3d[3][0] = -marker[i].width/2.0; + wpos3d[3][1] = -marker[i].width/2.0; + for( j = 0; j < 4; j++ ) { + marker[i].pos3d[j][0] = marker[i].trans[0][0] * wpos3d[j][0] + + marker[i].trans[0][1] * wpos3d[j][1] + + marker[i].trans[0][3]; + marker[i].pos3d[j][1] = marker[i].trans[1][0] * wpos3d[j][0] + + marker[i].trans[1][1] * wpos3d[j][1] + + marker[i].trans[1][3]; + marker[i].pos3d[j][2] = marker[i].trans[2][0] * wpos3d[j][0] + + marker[i].trans[2][1] * wpos3d[j][1] + + marker[i].trans[2][3]; + } + } + + fclose(fp); + + arMalloc(marker_info, ARMultiMarkerInfoT, 1); + marker_info->marker = marker; + marker_info->marker_num = num; + marker_info->min_submarker = 0; + marker_info->prevF = 0; + if( (patt_type & 0x03) == 0x03 ) marker_info->patt_type = AR_MULTI_PATTERN_DETECTION_MODE_TEMPLATE_AND_MATRIX; + else if( patt_type & 0x01 ) marker_info->patt_type = AR_MULTI_PATTERN_DETECTION_MODE_TEMPLATE; + else marker_info->patt_type = AR_MULTI_PATTERN_DETECTION_MODE_MATRIX; + marker_info->cfPattCutoff = AR_MULTI_CONFIDENCE_PATTERN_CUTOFF_DEFAULT; + marker_info->cfMatrixCutoff = AR_MULTI_CONFIDENCE_MATRIX_CUTOFF_DEFAULT; + + return marker_info; + +bail: + fclose(fp); + free(marker); + return NULL; +} + +static char *get_buff(char *buf, int n, FILE *fp) +{ + char *ret; + size_t l; + + do { + ret = fgets(buf, n, fp); + if (ret == NULL) return (NULL); // EOF or error. + + // Remove NLs and CRs from end of string. + l = strlen(buf); + while (l > 0) { + if (buf[l - 1] != '\n' && buf[l - 1] != '\r') break; + l--; + buf[l] = '\0'; + } + } while (buf[0] == '#' || buf[0] == '\0'); // Reject comments and blank lines. + + return (ret); +} From 0947a3a0da3643daadcf6e7faf95ef9da932d1e3 Mon Sep 17 00:00:00 2001 From: Walter Perdan Date: Fri, 15 May 2020 00:31:24 +0200 Subject: [PATCH 02/34] video.c for javascript5 and similar --- lib/SRC/Video/video.c | 317 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 lib/SRC/Video/video.c diff --git a/lib/SRC/Video/video.c b/lib/SRC/Video/video.c new file mode 100644 index 0000000..7f0bb3d --- /dev/null +++ b/lib/SRC/Video/video.c @@ -0,0 +1,317 @@ +/* + * video.c + * ARToolKit5 + * + * This file is part of ARToolKit. + * + * ARToolKit is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ARToolKit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with ARToolKit. If not, see . + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce an + * executable, regardless of the license terms of these independent modules, and to + * copy and distribute the resulting executable under terms of your choice, + * provided that you also meet, for each linked independent module, the terms and + * conditions of the license of that module. An independent module is a module + * which is neither derived from nor based on this library. If you modify this + * library, you may extend this exception to your version of the library, but you + * are not obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * + * Copyright 2015-2016 Daqri, LLC. + * Copyright 2003-2015 ARToolworks, Inc. + * + * Author(s): Hirokazu Kato, Philip Lamb + * + */ +/* + * author: Hirokazu Kato ( kato@sys.im.hiroshima-cu.ac.jp ) + * + * Revision: 6.0 Date: 2003/09/29 + */ +#include +#include + +static AR2VideoParamT *vid = NULL; + +AR_VIDEO_MODULE arVideoGetDefaultModule( void ) +{ +#if defined(ARVIDEO_INPUT_DEFAULT_V4L2) + return AR_VIDEO_MODULE_V4L2; +#elif defined(ARVIDEO_INPUT_DEFAULT_1394) + return AR_VIDEO_MODULE_1394; +#elif defined(ARVIDEO_INPUT_DEFAULT_GSTREAMER) + return AR_VIDEO_MODULE_GSTREAMER; +#elif defined(ARVIDEO_INPUT_DEFAULT_AVFOUNDATION) + return AR_VIDEO_MODULE_AVFOUNDATION; +#elif defined(ARVIDEO_INPUT_DEFAULT_IMAGE) + return AR_VIDEO_MODULE_IMAGE; +#elif defined(ARVIDEO_INPUT_DEFAULT_ANDROID) + return AR_VIDEO_MODULE_ANDROID; +#elif defined(ARVIDEO_INPUT_DEFAULT_WINDOWS_MEDIA_FOUNDATION) + return AR_VIDEO_MODULE_WINDOWS_MEDIA_FOUNDATION; +#elif defined(ARVIDEO_INPUT_DEFAULT_WINDOWS_MEDIA_CAPTURE) + return AR_VIDEO_MODULE_WINDOWS_MEDIA_CAPTURE; +#else + return AR_VIDEO_MODULE_DUMMY; +#endif +} + +int arVideoOpen( const char *config ) +{ + if( vid != NULL ) { + ARLOGe("arVideoOpen: Error, video device already open.\n"); + return -1; + } + vid = ar2VideoOpen( config ); + if( vid == NULL ) return -1; + + return 0; +} + +int arVideoOpenAsync(const char *config, void (*callback)(void *), void *userdata) +{ + if( vid != NULL ) { + ARLOGe("arVideoOpenAsync: Error, video device already open.\n"); + return -1; + } + vid = ar2VideoOpenAsync(config, callback, userdata); + if( vid == NULL ) return -1; + + return 0; +} + +int arVideoClose( void ) +{ + int ret; + + if( vid == NULL ) return -1; + + ret = ar2VideoClose( vid ); + vid = NULL; + + return ret; +} + +int arVideoDispOption( void ) +{ + if( vid == NULL ) return -1; + + return ar2VideoDispOption( vid ); +} + +AR_VIDEO_MODULE arVideoGetModule( void ) +{ + if( vid == NULL ) return -1; + + return ar2VideoGetModule(vid); +} + +int arVideoGetId( ARUint32 *id0, ARUint32 *id1 ) +{ + if( vid == NULL ) return -1; + + return ar2VideoGetId( vid, id0, id1 ); +} + +int arVideoGetSize( int *x, int *y ) +{ + if( vid == NULL ) return -1; + + return ar2VideoGetSize( vid, x, y ); +} + +int arVideoGetPixelSize( void ) +{ + if( vid == NULL ) return -1; + + return ar2VideoGetPixelSize( vid ); +} + +AR_PIXEL_FORMAT arVideoGetPixelFormat( void ) +{ + if( vid == NULL ) return ((AR_PIXEL_FORMAT)-1); + + return ar2VideoGetPixelFormat( vid ); +} + +AR2VideoBufferT *arVideoGetImage( void ) +{ + if( vid == NULL ) return NULL; + + return ar2VideoGetImage(vid); +} + +int arVideoCapStart( void ) +{ + if( vid == NULL ) return -1; + + return ar2VideoCapStart( vid ); +} + +int arVideoCapStartAsync(AR_VIDEO_FRAME_READY_CALLBACK callback, void *userdata) +{ + if( vid == NULL ) return -1; + + return ar2VideoCapStartAsync(vid, callback, userdata); +} + +int arVideoCapStop( void ) +{ + if( vid == NULL ) return -1; + + return ar2VideoCapStop( vid ); +} + +int arVideoGetParami( int paramName, int *value ) +{ + if (paramName == AR_VIDEO_GET_VERSION) return (ar2VideoGetParami(NULL, AR_VIDEO_GET_VERSION, NULL)); + + if( vid == NULL ) return -1; + + return ar2VideoGetParami( vid, paramName, value ); +} + +int arVideoSetParami( int paramName, int value ) +{ + if( vid == NULL ) return -1; + + return ar2VideoSetParami( vid, paramName, value ); +} + +int arVideoGetParamd( int paramName, double *value ) +{ + if( vid == NULL ) return -1; + + return ar2VideoGetParamd( vid, paramName, value ); +} + +int arVideoSetParamd( int paramName, double value ) +{ + if( vid == NULL ) return -1; + + return ar2VideoSetParamd( vid, paramName, value ); +} + +int arVideoGetParams( const int paramName, char **value ) +{ + if( vid == NULL ) return -1; + + return ar2VideoGetParams( vid, paramName, value ); +} + +int arVideoSetParams( const int paramName, const char *value ) +{ + if( vid == NULL ) return -1; + + return ar2VideoSetParams( vid, paramName, value ); +} + +int arVideoSaveParam( char *filename ) +{ + if( vid == NULL ) return -1; + + return ar2VideoSaveParam( vid, filename ); +} + +int arVideoLoadParam( char *filename ) +{ + if( vid == NULL ) return -1; + + return ar2VideoLoadParam( vid, filename ); +} + +int arVideoSetBufferSize(const int width, const int height) +{ + if( vid == NULL ) return -1; + + return ar2VideoSetBufferSize( vid, width, height ); +} + +int arVideoGetBufferSize(int *width, int *height) +{ + if( vid == NULL ) return -1; + + return ar2VideoGetBufferSize( vid, width, height ); +} + +int arVideoGetCParam(ARParam *cparam) +{ + if (vid == NULL) return -1; + + return ar2VideoGetCParam(vid, cparam); +} + +int arVideoGetCParamAsync(void (*callback)(const ARParam *, void *), void *userdata) +{ + if (vid == NULL) return -1; + + return ar2VideoGetCParamAsync(vid, callback, userdata);; +} + +// N.B. This function is duplicated in libAR, so that libAR doesn't need to +// link to libARvideo. Therefore, if changes are made here they should be duplicated there. +int arVideoUtilGetPixelSize( const AR_PIXEL_FORMAT arPixelFormat ) +{ + switch( arPixelFormat ) { + case AR_PIXEL_FORMAT_RGB: + case AR_PIXEL_FORMAT_BGR: + return 3; + case AR_PIXEL_FORMAT_RGBA: + case AR_PIXEL_FORMAT_BGRA: + case AR_PIXEL_FORMAT_ABGR: + case AR_PIXEL_FORMAT_ARGB: + return 4; + case AR_PIXEL_FORMAT_MONO: + case AR_PIXEL_FORMAT_420v: // Report only size of luma pixels (i.e. plane 0). + case AR_PIXEL_FORMAT_420f: // Report only size of luma pixels (i.e. plane 0). + case AR_PIXEL_FORMAT_NV21: // Report only size of luma pixels (i.e. plane 0). + return 1; + case AR_PIXEL_FORMAT_2vuy: + case AR_PIXEL_FORMAT_yuvs: + case AR_PIXEL_FORMAT_RGB_565: + case AR_PIXEL_FORMAT_RGBA_5551: + case AR_PIXEL_FORMAT_RGBA_4444: + return 2; + default: + return (0); + } +} + +// N.B. This function is duplicated in libAR, so that libAR doesn't need to +// link to libARvideo. Therefore, if changes are made here they should be duplicated there. +const char *arVideoUtilGetPixelFormatName(const AR_PIXEL_FORMAT arPixelFormat) +{ + const char *names[] = { + "AR_PIXEL_FORMAT_RGB", + "AR_PIXEL_FORMAT_BGR", + "AR_PIXEL_FORMAT_RGBA", + "AR_PIXEL_FORMAT_BGRA", + "AR_PIXEL_FORMAT_ABGR", + "AR_PIXEL_FORMAT_MONO", + "AR_PIXEL_FORMAT_ARGB", + "AR_PIXEL_FORMAT_2vuy", + "AR_PIXEL_FORMAT_yuvs", + "AR_PIXEL_FORMAT_RGB_565", + "AR_PIXEL_FORMAT_RGBA_5551", + "AR_PIXEL_FORMAT_RGBA_4444", + "AR_PIXEL_FORMAT_420v", + "AR_PIXEL_FORMAT_420f", + "AR_PIXEL_FORMAT_NV21" + }; + if ((int)arPixelFormat < 0 || (int)arPixelFormat > AR_PIXEL_FORMAT_MAX) { + ARLOGe("arVideoUtilGetPixelFormatName: Error, unrecognised pixel format (%d).\n", (int)arPixelFormat); + return (NULL); + } + return (names[(int)arPixelFormat]); +} From c315ed571a219cb4a8cb9452efea262930d277ab Mon Sep 17 00:00:00 2001 From: Walter Perdan Date: Fri, 15 May 2020 10:47:20 +0200 Subject: [PATCH 03/34] removing other not necessary files --- include/glStateCache.h | 203 ------------------- include/glStateCache2.h | 140 ------------- lib/SRC/ARUtil/android_system_property_get.c | 77 ------- 3 files changed, 420 deletions(-) delete mode 100644 include/glStateCache.h delete mode 100644 include/glStateCache2.h delete mode 100644 lib/SRC/ARUtil/android_system_property_get.c diff --git a/include/glStateCache.h b/include/glStateCache.h deleted file mode 100644 index eecbe8e..0000000 --- a/include/glStateCache.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * glStateCache.h - * ARToolKit5 - * - * This file is part of ARToolKit. - * - * ARToolKit is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ARToolKit is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with ARToolKit. If not, see . - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce an - * executable, regardless of the license terms of these independent modules, and to - * copy and distribute the resulting executable under terms of your choice, - * provided that you also meet, for each linked independent module, the terms and - * conditions of the license of that module. An independent module is a module - * which is neither derived from nor based on this library. If you modify this - * library, you may extend this exception to your version of the library, but you - * are not obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * - * Copyright 2015 Daqri, LLC. - * Copyright 2008-2015 ARToolworks, Inc. - * - * Author(s): Philip Lamb - * - */ - -// glStateCache optimises OpenGL ES on implementations where -// changes in GL state are expensive, by eliminating redundant -// changes to state. - -#ifndef __glStateCache_h__ -#define __glStateCache_h__ - -#ifndef DISABLE_GL_STATE_CACHE - -#if defined ANDROID -# include -# include -#else -# include -# include -#endif - -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Use of the state cache: -// -// Prior to drawing, a given piece of code should set the state -// it prefers using the calls below. All code that uses the state -// cache should refrain from querying state, and refrain from saving -// and restoring state. The state cache maintains track of the current -// state and no GL calls to make state changes will be made if the -// requested state is already set. -// -// One additional note: If you have some code in your application -// which does NOT use the state cache routines, then the state cache's -// record of the state of the GL machine may be erroneous. In this -// case you will have to call glStateCacheFlush() at the beginning -// of the section of your code which DOES cache state. -// - -// Tells the state cache that changes to state have been made -// elsewhere, and that the cache should be emptied. -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheFlush() -#else -void glStateCacheFlush(void); -#endif -#define glStateCacheBeginAgain glStateCacheFlush // Deprecated name. - -// Depth testing. -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheEnableDepthTest() glEnable(GL_DEPTH_TEST) -#define glStateCacheDisableDepthTest() glDisable(GL_DEPTH_TEST) -#else -void glStateCacheEnableDepthTest(void); -void glStateCacheDisableDepthTest(void); -#endif - -// Client-side vertex and normal operations. -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheEnableClientStateVertexArray() glEnableClientState(GL_VERTEX_ARRAY) -#define glStateCacheDisableClientStateVertexArray() glDisableClientState(GL_VERTEX_ARRAY) -#define glStateCacheEnableClientStateNormalArray() glEnableClientState(GL_NORMAL_ARRAY) -#define glStateCacheDisableClientStateNormalArray() glDisableClientState(GL_NORMAL_ARRAY) -#else -void glStateCacheEnableClientStateVertexArray(void); -void glStateCacheDisableClientStateVertexArray(void); -void glStateCacheEnableClientStateNormalArray(void); -void glStateCacheDisableClientStateNormalArray(void); -#endif -// No longer included in cached state. Definitions retained here for backwards compatibility. -#define glStateCacheVertexPtr(size, type, stride, ptr) glVertexPointer(size, type, stride, ptr) -#define glStateCacheNormalPtr(type, stride, ptr) glNormalPointer(type, stride, ptr) - -// Client-side texture operations. -// The glStateCacheEnableClientStateTexCoordArray()/glStateCacheDisableClientStateTexCoordArray() -// operations all operate on the current active texture set with glStateCacheClientActiveTexture(). -#ifdef DISABLE_GL_STATE_CACHE -#ifdef GL_VERSION_1_3 -# define glStateCacheClientActiveTexture(texture) glClientActiveTexture(texture) -#else -# define glStateCacheClientActiveTexture(texture) -#endif -#define glStateCacheEnableClientStateTexCoordArray() glEnableClientState(GL_TEXTURE_COORD_ARRAY) -#define glStateCacheDisableClientStateTexCoordArray() glDisableClientState(GL_TEXTURE_COORD_ARRAY) -#else -void glStateCacheClientActiveTexture(GLenum texture); -void glStateCacheEnableClientStateTexCoordArray(void); -void glStateCacheDisableClientStateTexCoordArray(void); -#endif -// No longer included in cached state. Definitions retained here for backwards compatibility. -#define glStateCacheTexCoordPtr(size, type, stride, ptr) glTexCoordPointer(size, type, stride, ptr) - -// Server-side texture operations. -// The glStateCacheBindTexture2D()/glStateCacheEnableTex2D()/glStateCacheDisableTex2D() and glStateCacheTexEnv*() -// operations all operate on the current active texture set with glStateCacheActiveTexture(). -#ifdef DISABLE_GL_STATE_CACHE -#ifdef GL_VERSION_1_3 -# define glStateCacheActiveTexture(texture) glActiveTexture(texture) -#else -# define glStateCacheActiveTexture(texture) -#endif -#define glStateCacheBindTexture2D(name) glBindTexture(GL_TEXTURE_2D, name) -#define glStateCacheEnableTex2D() glEnable(GL_TEXTURE_2D) -#define glStateCacheDisableTex2D() glDisable(GL_TEXTURE_2D) -#define glStateCacheTexEnvMode(mode) glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode) -#define glStateCacheTexEnvSrc0(source) glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, source) -#define glStateCacheTexEnvSrc1(source) glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, source) -#define glStateCacheTexEnvCombine(combine) glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, combine) -#else -#define GLSTATECACHE_MAX_COMBINED_TEXTURE_IMAGE_UNITS 8 // Minimum value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS is 8 -void glStateCacheActiveTexture(GLuint texture); -void glStateCacheBindTexture2D(GLuint name); -void glStateCacheEnableTex2D(void); -void glStateCacheDisableTex2D(void); -void glStateCacheTexEnvMode(GLint mode); -void glStateCacheTexEnvSrc0(GLint source); -void glStateCacheTexEnvSrc1(GLint source); -void glStateCacheTexEnvCombine(GLint combine); -#endif - -// Materials and lighting. -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheEnableLighting() glEnable(GL_LIGHTING) -#define glStateCacheDisableLighting() glDisable(GL_LIGHTING) -#define glStateCacheMaterialv(pname, param) glMaterialfv(GL_FRONT_AND_BACK, pname, param) -#define glStateCacheMaterial(pname, param) glMaterialf(GL_FRONT_AND_BACK, pname, param) -#else -void glStateCacheEnableLighting(void); -void glStateCacheDisableLighting(void); -void glStateCacheMaterialv(GLenum pname, GLfloat *param); -void glStateCacheMaterial(GLenum pname, GLfloat param); -#endif - -// Blending. -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheEnableBlend() glEnable(GL_BLEND) -#define glStateCacheDisableBlend() glDisable(GL_BLEND) -#define glStateCacheBlendFunc(sfactor, dfactor) glBlendFunc(sfactor, dfactor) -#else -void glStateCacheEnableBlend(void); -void glStateCacheDisableBlend(void); -void glStateCacheBlendFunc(GLenum sfactor, GLenum dfactor); -#endif - -// Buffer masking operations. -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheColorMask(red, green, blue, alpha) glColorMask(red, green, blue, alpha) -#define glStateCacheDepthMask(flag) glDepthMask(flag) -#else -void glStateCacheColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -void glStateCacheDepthMask(GLboolean flag); -#endif - -// Pixel transfer. -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCachePixelStoreUnpackAlignment(param) glPixelStorei(GL_UNPACK_ALIGNMENT, param) -#else -void glStateCachePixelStoreUnpackAlignment(GLint param); -#endif - -#ifdef __cplusplus -} -#endif - -#endif // !__glStateCache_h__ diff --git a/include/glStateCache2.h b/include/glStateCache2.h deleted file mode 100644 index ebdac1b..0000000 --- a/include/glStateCache2.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * glStateCache2.h - * ARToolKit5 - * - * This file is part of ARToolKit. - * - * ARToolKit is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ARToolKit is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with ARToolKit. If not, see . - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce an - * executable, regardless of the license terms of these independent modules, and to - * copy and distribute the resulting executable under terms of your choice, - * provided that you also meet, for each linked independent module, the terms and - * conditions of the license of that module. An independent module is a module - * which is neither derived from nor based on this library. If you modify this - * library, you may extend this exception to your version of the library, but you - * are not obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * - * Copyright 2015 Daqri, LLC. - * Copyright 2009-2015 ARToolworks, Inc. - * - * Author(s): Philip Lamb - * - */ - -// glStateCache optimises OpenGL ES on implementations where -// changes in GL state are expensive, by eliminating redundant -// changes to state. - -#ifndef __glStateCache2_h__ -#define __glStateCache2_h__ - -#ifndef DISABLE_GL_STATE_CACHE - -#if defined ANDROID -# include -# include -#else -# include -# include -#endif - -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Use of the state cache: -// -// Prior to drawing, a given piece of code should set the state -// it prefers using the calls below. All code that uses the state -// cache should refrain from querying state, and refrain from saving -// and restoring state. The state cache maintains track of the current -// state and no GL calls to make state changes will be made if the -// requested state is already set. -// -// One additional note: If you have some code in your application -// which does NOT use the state cache routines, then the state cache's -// record of the state of the GL machine may be erroneous. In this -// case you will have to call glStateCacheFlush() at the beginning -// of the section of your code which DOES cache state. -// - -// Tells the state cache that changes to state have been made -// elsewhere, and that the cache should be emptied. -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheFlush() -#else -void glStateCacheFlush(void); -#endif -#define glStateCacheBeginAgain glStateCacheFlush // Deprecated name. - -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheEnableDepthTest() glEnable(GL_DEPTH_TEST) -#define glStateCacheDisableDepthTest() glDisable(GL_DEPTH_TEST) -#define glStateCacheEnableBlend() glEnable(GL_BLEND) -#define glStateCacheDisableBlend() glDisable(GL_BLEND) -#else -void glStateCacheEnableDepthTest(void); -void glStateCacheDisableDepthTest(void); -void glStateCacheEnableBlend(void); -void glStateCacheDisableBlend(void); -#endif - -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheActiveTexture(texture) glActiveTexture(texture) -#else -#define GLSTATECACHE_MAX_COMBINED_TEXTURE_IMAGE_UNITS 8 // Minimum value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS is 8 -void glStateCacheActiveTexture(GLuint texture); -#endif - -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheBindTexture2D(name) glBindTexture(GL_TEXTURE_2D, name) -#else -void glStateCacheBindTexture2D(GLuint name); -#endif - -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheBlendFunc(sfactor, dfactor) glBlendFunc(sfactor, dfactor) -#else -void glStateCacheBlendFunc(GLenum sfactor, GLenum dfactor); -#endif - -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheColorMask(red, green, blue, alpha) glColorMask(red, green, blue, alpha) -#else -void glStateCacheColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -#endif - -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCacheDepthMask(flag) glDepthMask(flag) -#else -void glStateCacheDepthMask(GLboolean flag); -#endif - -#ifdef DISABLE_GL_STATE_CACHE -#define glStateCachePixelStoreUnpackAlignment(param) glPixelStorei(GL_UNPACK_ALIGNMENT, param) -#else -void glStateCachePixelStoreUnpackAlignment(GLint param); -#endif - -#ifdef __cplusplus -} -#endif - -#endif // !__glStateCache2_h__ diff --git a/lib/SRC/ARUtil/android_system_property_get.c b/lib/SRC/ARUtil/android_system_property_get.c deleted file mode 100644 index 37395be..0000000 --- a/lib/SRC/ARUtil/android_system_property_get.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * android_system_property_get.c - * ARToolKit5 - * - * This file is part of ARToolKit. - * - * ARToolKit is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ARToolKit is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with ARToolKit. If not, see . - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce an - * executable, regardless of the license terms of these independent modules, and to - * copy and distribute the resulting executable under terms of your choice, - * provided that you also meet, for each linked independent module, the terms and - * conditions of the license of that module. An independent module is a module - * which is neither derived from nor based on this library. If you modify this - * library, you may extend this exception to your version of the library, but you - * are not obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * - * Copyright 2015-2016 Daqri, LLC. - * - * Author(s): Philip Lamb - * - */ - -#include - -#ifdef ANDROID - -#if (__ANDROID_API__ >= 21) - -#include -#include -#include - -// Android 'L' makes __system_property_get a non-global symbol. -// Here we provide a stub which loads the symbol from libc via dlsym. -typedef int (*PFN_SYSTEM_PROP_GET)(const char *, char *); -int android_system_property_get(const char* name, char* value) -{ - static PFN_SYSTEM_PROP_GET __real_system_property_get = NULL; - if (!__real_system_property_get) { - // libc.so should already be open, get a handle to it. - void *handle = dlopen("libc.so", RTLD_NOLOAD); - if (!handle) { - __android_log_print(ANDROID_LOG_ERROR, "ARUtil", "Cannot dlopen libc.so: %s.\n", dlerror()); - } else { - __real_system_property_get = (PFN_SYSTEM_PROP_GET)dlsym(handle, "__system_property_get"); - } - if (!__real_system_property_get) { - __android_log_print(ANDROID_LOG_ERROR, "ARUtil", "Cannot resolve __system_property_get(): %s.\n", dlerror()); - } - } - return (*__real_system_property_get)(name, value); -} - -#else - -int android_system_property_get(const char* name, char* value) -{ - return __system_property_get(name, value); -} - -#endif // __ANDROID_API__ >= 21 - -#endif // ANDROID \ No newline at end of file From 6773be1e14a0db89bee0d0c1b31e59b17aaa375d Mon Sep 17 00:00:00 2001 From: Walter Perdan Date: Fri, 15 May 2020 11:14:05 +0200 Subject: [PATCH 04/34] android.h is not necessary --- include/ARUtil/android.h | 85 ---------------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 include/ARUtil/android.h diff --git a/include/ARUtil/android.h b/include/ARUtil/android.h deleted file mode 100644 index c2617a0..0000000 --- a/include/ARUtil/android.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * android.h - * ARToolKit5 - * - * This file is part of ARToolKit. - * - * ARToolKit is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ARToolKit is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with ARToolKit. If not, see . - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce an - * executable, regardless of the license terms of these independent modules, and to - * copy and distribute the resulting executable under terms of your choice, - * provided that you also meet, for each linked independent module, the terms and - * conditions of the license of that module. An independent module is a module - * which is neither derived from nor based on this library. If you modify this - * library, you may extend this exception to your version of the library, but you - * are not obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * - * Copyright 2015-2016 Daqri, LLC. - * - * Author(s): Philip Lamb - * - */ - -#ifndef __ARUtil_android_h__ -#define __ARUtil_android_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef ANDROID - -#include - -// -// Public codes are defined in http://developer.android.com/reference/java/lang/System.html#getProperty(java.lang.String) . -// Codes below are defined in https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/os/Build.java . -// Items with * are intended for display to the end user. -// - -#define ANDROID_OS_BUILD_VERSION_RELEASE "ro.build.version.release" // * The user-visible version string. E.g., "1.0" or "3.4b5". -#define ANDROID_OS_BUILD_VERSION_INCREMENTAL "ro.build.version.incremental" // The internal value used by the underlying source control to represent this build. -#define ANDROID_OS_BUILD_VERSION_CODENAME "ro.build.version.codename" // The current development codename, or the string "REL" if this is a release build. -#define ANDROID_OS_BUILD_VERSION_SDK "ro.build.version.sdk" // The user-visible SDK version of the framework. - -#define ANDROID_OS_BUILD_MODEL "ro.product.model" // * The end-user-visible name for the end product.. -#define ANDROID_OS_BUILD_MANUFACTURER "ro.product.manufacturer" // The manufacturer of the product/hardware. -#define ANDROID_OS_BUILD_BOARD "ro.product.board" // The name of the underlying board, like "goldfish". -#define ANDROID_OS_BUILD_BRAND "ro.product.brand" // The brand (e.g., carrier) the software is customized for, if any. -#define ANDROID_OS_BUILD_DEVICE "ro.product.device" // The name of the industrial design. -#define ANDROID_OS_BUILD_PRODUCT "ro.product.name" // The name of the overall product. -#define ANDROID_OS_BUILD_HARDWARE "ro.hardware" // The name of the hardware (from the kernel command line or /proc). -#define ANDROID_OS_BUILD_CPU_ABI "ro.product.cpu.abi" // The name of the instruction set (CPU type + ABI convention) of native code. -#define ANDROID_OS_BUILD_CPU_ABI2 "ro.product.cpu.abi2" // The name of the second instruction set (CPU type + ABI convention) of native code. - -#define ANDROID_OS_BUILD_DISPLAY "ro.build.display.id" // * A build ID string meant for displaying to the user. -#define ANDROID_OS_BUILD_HOST "ro.build.host" -#define ANDROID_OS_BUILD_USER "ro.build.user" -#define ANDROID_OS_BUILD_ID "ro.build.id" // Either a changelist number, or a label like "M4-rc20". -#define ANDROID_OS_BUILD_TYPE "ro.build.type" // The type of build, like "user" or "eng". -#define ANDROID_OS_BUILD_TAGS "ro.build.tags" // Comma-separated tags describing the build, like "unsigned,debug". - -#define ANDROID_OS_BUILD_FINGERPRINT "ro.build.fingerprint" // A string that uniquely identifies this build. 'BRAND/PRODUCT/DEVICE:RELEASE/ID/VERSION.INCREMENTAL:TYPE/TAGS'. - -int android_system_property_get(const char* name, char* value); - -#endif // ANDROID - -#ifdef __cplusplus -} -#endif -#endif // !__ARUtil_android_h__ From 7946e7a7cbef767b60471f8c5b7c1d55cf41eac6 Mon Sep 17 00:00:00 2001 From: Walter Perdan Date: Fri, 15 May 2020 13:48:42 +0200 Subject: [PATCH 05/34] removing AR/gsub_es.h, gsub_es2.h, gsub_lite.h --- include/AR/gsub_es.h | 493 --------------------------------------- include/AR/gsub_es2.h | 496 --------------------------------------- include/AR/gsub_lite.h | 512 ----------------------------------------- 3 files changed, 1501 deletions(-) delete mode 100644 include/AR/gsub_es.h delete mode 100644 include/AR/gsub_es2.h delete mode 100644 include/AR/gsub_lite.h diff --git a/include/AR/gsub_es.h b/include/AR/gsub_es.h deleted file mode 100644 index 6de6e34..0000000 --- a/include/AR/gsub_es.h +++ /dev/null @@ -1,493 +0,0 @@ -/* - * gsub_es.h - * ARToolKit5 - * - * Graphics Subroutines (OpenGL ES 1.1) for ARToolKit. - * - * This file is part of ARToolKit. - * - * ARToolKit is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ARToolKit is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with ARToolKit. If not, see . - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce an - * executable, regardless of the license terms of these independent modules, and to - * copy and distribute the resulting executable under terms of your choice, - * provided that you also meet, for each linked independent module, the terms and - * conditions of the license of that module. An independent module is a module - * which is neither derived from nor based on this library. If you modify this - * library, you may extend this exception to your version of the library, but you - * are not obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * - * Copyright 2015 Daqri, LLC. - * Copyright 2008-2015 ARToolworks, Inc. - * - * Author(s): Philip Lamb - * - * Rev Date Who Changes - * 1.0.0 2008-03-30 PRL Rewrite of gsub_lite.c from ARToolKit v4.3.2 for OpenGL ES 1.1 capabilities. - * - */ - -/*! - @header gsub_es - @abstract A collection of useful OpenGL ES 1.1 routines for ARToolKit. - @discussion - gsub_es is the preferred means for drawing camera video - images acquired from ARToolKit's video libraries. It includes - optimized texture handling, and a variety of flexible drawing - options. - - gsub_es also provides utility functions for setting the - OpenGL viewing frustum and camera position based on ARToolKit- - camera parameters and marker positions. - - gsub_es does not depend on GLUT, or indeed, any particular - window or event handling system. It is therefore well suited - to use in applications which have their own window and event - handling code. - - @copyright 2008-2013 Philip Lamb - @version 1.0.0 - */ - -#ifndef __gsub_es_h__ -#define __gsub_es_h__ - -// ============================================================================ -// Public includes. -// ============================================================================ - -#if defined ANDROID -# include -# include -#else -# include -# include -#endif - -#include -#include // ARUint8, AR_PIXEL_FORMAT -#include // ARParam, arParamDecompMat(), arParamObserv2Ideal() -#include "glStateCache.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// ============================================================================ -// Public types and definitions. -// ============================================================================ - -#define ARGL_DISABLE_DISP_IMAGE 0 - -#ifndef TRUE -# define TRUE 1 -#endif -#ifndef FALSE -# define FALSE 0 -#endif - -#if !ARGL_DISABLE_DISP_IMAGE - -/*! - @typedef ARGL_CONTEXT_SETTINGS_REF - @abstract Opaque type to hold ARGL settings for a given OpenGL context. - @discussion - An OpenGL context is an implementation-defined structure which - keeps track of OpenGL state, including textures and display lists. - Typically, individual OpenGL windows will have distinct OpenGL - contexts assigned to them by the host operating system. - - As gsub_lite uses textures and display lists, it must be able to - track which OpenGL context a given texture or display list it is using - belongs to. This is especially important when gsub_lite is being used to - draw into more than one window (and therefore more than one context.) - - Basically, functions which depend on OpenGL state, will require an - ARGL_CONTEXT_SETTINGS_REF to be passed to them. An ARGL_CONTEXT_SETTINGS_REF - is generated by setting the current OpenGL context (e.g. if using GLUT, - you might call glutSetWindow()) and then calling arglSetupForCurrentContext(). - When you have finished using ARGL in a given context, you should call - arglCleanup(), passing in an ARGL_CONTEXT_SETTINGS_REF, to free the - memory used by the settings structure. - @availability First appeared in ARToolKit 2.68. - */ -typedef struct _ARGL_CONTEXT_SETTINGS *ARGL_CONTEXT_SETTINGS_REF; - -#endif - -// ============================================================================ -// Public functions. -// ============================================================================ - -#if !ARGL_DISABLE_DISP_IMAGE - -/*! - @function - @abstract Initialise the gsub_lite library for the current OpenGL context. - @discussion - This function performs required setup of the gsub_lite library - for the current OpenGL context and must be called before any other argl*() - functions are called for this context. - - An OpenGL context holds all of the state of the OpenGL machine, including - textures and display lists etc. There will usually be one OpenGL context - for each window displaying OpenGL content. - - Other argl*() functions whose operation depends on OpenGL state will - require an ARGL_CONTEXT_SETTINGS_REF. This is just so that - they can keep track of per-context variables. - - You should call arglCleanup() passing in the ARGL_CONTEXT_SETTINGS_REF - when you have finished with the library for this context. - @param cparam Pointer to a set of ARToolKit camera parameters for the - current video source. The size of the source image is taken from the - fields xsize and ysize of the ARParam structure pointed to. Also, when - the draw mode is AR_DRAW_BY_TEXTURE_MAPPING (see the documentation for - the global variable arglDrawMode) the field dist_factor of the ARParam - structure pointed to will be taken as the amount to un-warp the supplied - image. - - Prior to ARToolKit v5.0.5, the ARParam structure pointed to had to remain - valid in memory for the duration of the ARGL_CONTEXT_SETTINGS_REF's usage. - As of ARToolKit v5.0.5, the ARParam structure pointed to is copied, and - no longer need be maintained. - @param pixelFormat The type and format of pixels of the images to be drawn by the - gsub library. This value can be changed later by using arglPixelFormatSet() - @result An ARGL_CONTEXT_SETTINGS_REF. See the documentation for this type for more info. - @availability First appeared in ARToolKit 2.68. -*/ -ARGL_CONTEXT_SETTINGS_REF arglSetupForCurrentContext(ARParam *cparam, AR_PIXEL_FORMAT pixelFormat); - -/*! - @function - @abstract Free memory used by gsub_lite associated with the specified context. - @discussion - Should be called after no more argl* functions are needed, in order - to prevent memory leaks etc. - - The library can be setup again for the context at a later time by calling - arglSetupForCurrentContext() again. - @param contextSettings A reference to ARGL's settings for an OpenGL - context, as returned by arglSetupForCurrentContext(). - @availability First appeared in ARToolKit 2.68. -*/ -void arglCleanup(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Display an ARVideo image, by drawing it using OpenGL. - @discussion - This function draws an image from an ARVideo source to the current - OpenGL context. This operation is most useful in video see-through - augmented reality applications for drawing the camera view as a - background image, but can also be used in other ways. - - An undistorted image is drawn with the lower-left corner of the - bottom-left-most pixel at OpenGL screen coordinates (0,0), and the - upper-right corner of the top-right-most pixel at OpenGL screen - coodinates (x * zoom, y * zoom), where x and y are the values of the - fields cparam->xsize and cparam->ysize (see below) and zoom is the - value of the parameter zoom (also see below). If cparam->dist_factor - indicates that an un-warping correction should be applied, the actual - coordinates will differ from the values specified here. - - OpenGL state: Drawing is performed with depth testing and lighting - disabled, and thus leaves the the depth buffer (if any) unmodified. If - pixel transfer is by texturing (see documentation for arglDrawMode), - the drawing is done in replacement texture environment mode. - The depth test enable and lighting enable state and the texture - environment mode are restored before the function returns. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. It - is the callers responsibility to make sure that the current context at the - time arglDisplayImage() is called matches that under which contextSettings - was created. - @availability First appeared in ARToolKit 2.68. -*/ -void arglDispImage(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Display an ARVideo image, by drawing it using OpenGL, using and modifying current OpenGL state. - @discussion - This function is identical to arglDispImage except that whereas - arglDispImage sets an orthographic 2D projection and the OpenGL state - prior to drawing, this function does not. It also does not restore any - changes made to OpenGL state. - - This allows you to do effects with your image, other than just drawing it - 2D and with the lower-left corner of the bottom-left-most pixel attached - to the bottom-left (0,0) of the window. For example, you might use a - perspective projection instead of an orthographic projection with a - glLoadIdentity() / glTranslate() on the modelview matrix to place the - lower-left corner of the bottom-left-most pixel somewhere other than 0,0 - and leave depth-testing enabled. - - See the documentation for arglDispImage() for more information. - @availability First appeared in ARToolKit 2.68.2. - */ -void arglDispImageStateful(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Set compensation for camera lens distortion in arglDispImage to off or on. - @discussion - By default, arglDispImage compensates for the distortion of the camera's - acquired image caused by the lens when it draws. By calling this function - with enabled = FALSE, this compensation will be disabled in the specified - drawing context. It may be re-enabled at any time. - This function is useful if you need to draw an image, but do not know the - extent of the camera's lens distortion (such as during distortion calibration). - While distortion compensation is disabled, the dist_factor[] array in a - the camera cparam structure passed to arglDispImage is ignored. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param enable TRUE to enabled distortion compensation, FALSE to disable it. - The default state for new contexts is enable = TRUE. - @result TRUE if the distortion value was set, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. -*/ -char arglDistortionCompensationSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, char enable); - -/*! - @function - @abstract Enquire as to the enable state of camera lens distortion compensation in arglDispImage. - @discussion - By default, arglDispImage compensates for the distortion of the camera's - acquired image caused by the lens when it draws. This function enquires - as to whether arglDispImage is currently doing compensation or not. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param enable Pointer to an integer value which will be set to TRUE if distortion - compensation is enabled in the specified context, or FALSE if it is disabled. - @result TRUE if the distortion value was retreived, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. - */ -char arglDistortionCompensationGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, char *enable); - -/*! - @function - @abstract Set the current video image drawing scalefactor. - @param zoom The amount to scale the video image up or down. To draw the video - image double size, use a zoom value of 2.0. To draw the video image - half size use a zoom value of 0.5. - */ -char arglSetPixelZoom(ARGL_CONTEXT_SETTINGS_REF contextSettings, float zoom); - -/*! - @function - @abstract Retrieve the current video image drawing scalefactor. - @param zoom The amount to scale the video image up or down. To draw the video - image double size, use a zoom value of 2.0. To draw the video image - half size use a zoom value of 0.5. - */ -char arglGetPixelZoom(ARGL_CONTEXT_SETTINGS_REF contextSettings, float *zoom); - -/*! - @function - @abstract Set the format of pixel data which will be passed to arglDispImage*() - @discussion (description) - In gsub_lite, the format of the pixels (i.e. the arrangement of components - within each pixel) can be changed at runtime. Use this function to inform - gsub_lite the format the pixels being passed to arglDispImage*() functions - are in. This setting applies only to the context passed in parameter - contextSettings. The default format is determined by - the value of AR_DEFAULT_PIXEL_FORMAT at the time the library was built. - Usually, image data is passed in directly from images generated by ARVideo, - and so you should ensure that ARVideo is generating pixels of the same format. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param format A symbolic constant for the pixel format being set. See - AR_PIXEL_FORMAT in ar.h for a list of all possible formats. - @result TRUE if the pixel format value was set, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. -*/ -char arglPixelFormatSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT format); - -/*! - @function - @abstract Get the format of pixel data in which arglDispImage*() is expecting data to be passed. - @discussion This function enquires as to the current format of pixel data being - expected by the arglDispImage*() functions. The default format is determined by - the value of AR_DEFAULT_PIXEL_FORMAT at the time the library was built. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param format A symbolic constant for the pixel format in use. See - AR_PIXEL_FORMAT in ar.h for a list of all possible formats. - @param size The number of bytes of memory occupied per pixel, for the given format. - @result TRUE if the pixel format and size values were retreived, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. -*/ -char arglPixelFormatGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT *format, int *size); - -/*! - @function - @abstract Find out whether ARGL is rotating all OpenGL drawing by 90 degrees. - @discussion - On some OpenGL ES devices, it may be desirable to rotate all OpenGL drawing by 90 - degrees in the window coordinate system, in order to swap the horizontal and - vertical axes of the device. This may be a higher performance solution than - manually swapping rows and columns of submitted data. - - This function queries the current state of whether such a rotation is being performed by ARGL or not. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @result TRUE if a 90 degree rotation is enabled, FALSE if it is disabled. -*/ -char arglGetRotate90(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Set or unset a 90 degree rotation in all OpenGL drawing performed by ARGL. - @discussion - On some OpenGL ES devices, it may be desirable to rotate all OpenGL drawing by 90 - degrees in the window coordinate system, in order to swap the horizontal and - vertical axes of the device. This may be a higher performance solution than - manually swapping rows and columns of submitted data. - - This function enables or disables such an axis swap in ARGL with very little - performance cost, by introducing a 90-degree rotation into the OpenGL projection matrix. - - By default, 90 degree rotation is DISABLED. - @param contextSettings A reference to ARGL's settings for the current OpenGL. - context, as returned by arglSetupForCurrentContext() for this context. - @param rotate90 Set to TRUE or 1 to enable 90 degree rotation, FALSE to disable. -*/ -void arglSetRotate90(ARGL_CONTEXT_SETTINGS_REF contextSettings, char rotate90); - -char arglGetFlipH(ARGL_CONTEXT_SETTINGS_REF contextSettings); -void arglSetFlipH(ARGL_CONTEXT_SETTINGS_REF contextSettings, char flipH); -char arglGetFlipV(ARGL_CONTEXT_SETTINGS_REF contextSettings); -void arglSetFlipV(ARGL_CONTEXT_SETTINGS_REF contextSettings, char flipV); - -/*! - @function - @abstract Specify a desired pixel buffer size larger than the camera image size. - @discussion - By default, the pixel buffer accepted by function arglPixelBufferDataUpload() - is assumed to be tightly packed, row-major array of dimensions - equal to the calibrated camera image size (as passed in the fields arParam.xsize and arParam.ysize - of the ARHandle submitted to arglSetupForCurrentContext(). - - The pixel data buffer submitted may, under some circumstances be allowed to be larger than the - values of the calibrated camera image size (i.e. padded). This may only occur when the - underlying OpenGL ES impementation does not support non-power-of-two textures. For the Apple - iPhone family, this applies to the iPhone, the iPhone 3G, the iPod Touch 1st and 2nd Generation. - The iPhone 3GS and the iPod Touch 3rd Generation support non-power-of-two textures, and thus - padding of the pixel data buffer is not supported on these devices. If padding is desired, - the desired buffer size must be submitted using this function. Check that the - result from this function is TRUE before attempting to upload such a padded buffer. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param bufWidth The desired buffer width, in pixels. - @param bufHeight The desired buffer height, in pixels. - @result TRUE if the desired buffer size is supported, FALSE otherwise. -*/ -char arglPixelBufferSizeSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int bufWidth, int bufHeight); - -/*! - @function - @abstract Query the size of pixel data buffers expected by arglPixelBufferDataUpload(). - @discussion - See function arglPixelBufferSizeSet() for a full discussion. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param bufWidth A pointer to int, which will be filled out with the buffer width, in pixels, or NULL if this value is not required. - @param bufHeight A pointer to int, which will be filled out with the buffer height, in pixels, or NULL if this value is not required.. - @result TRUE if the buffer size was successfully queried, FALSE otherwise. - */ -char arglPixelBufferSizeGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int *bufWidth, int *bufHeight); - -/*! - @function - @abstract Upload a buffer of pixel data to an OpenGL texture for later use by arglDispImage(). - @discussion - ARGL provides the ability to perform distortion-compensated texturing of a camera video image - into the OpenGL context, for the purpose of video-see through augmented reality. This function - uploads the camera image data to an OpenGL texture, ready for later drawing using the function - arglDispImage(). - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param bufDataPtr0 A pointer to the pixel buffer, which is a block of memory from which texture - data will be read. - - The layout of pixel data in the memory pointed to by bufDataPtr is assumed to be - specified by the value of pixelFormat in the ARHandle submitted to arglSetupForCurrentContext(), - but can be changed by calling arglPixelFormatSet() and/or arglPixelBufferSizeSet(). - - By default, the pixel buffer is assumed to be tightly packed, row-major array of dimensions - equal to the calibrated camera image size (as passed in the fields arParam.xsize and arParam.ysize - of the ARHandle submitted to arglSetupForCurrentContext(). - - The pixel data buffer submitted may, under some circumstances be allowed to be larger than the - values of the calibrated camera image size (i.e. padded). See the discussion section of the - documentation for function arglPixelBufferSizeSet() for more information. - - This may only occur when the - underlying OpenGL ES impementation does not support non-power-of-two textures. For the Apple - iPhone family, this applies to the iPhone, the iPhone 3G, the iPod Touch 1st and 2nd Generation. - The iPhone 3GS and the iPod Touch 3rd Generation support non-power-of-two textures, and thus - padding of the pixel data buffer is not supported on these devices. If padding is desired, - the desired buffer size must be submitted using arglPixelBufferSizeSet(). Check that the - result from this function is TRUE before attempting to upload such a padded buffer. - @param bufDataPtr1 NULL for single-plane (interleaved) textures, otherwise for bi-planar textures, - a pointer to the pixel buffer, which is a block of memory from which texture - data will be read for the second plane containing the CbCr components. This plane must have - dimensions of half the size of plane 0, and 2-bytes per pixel (1 byte Cb, 1 byte Cr). - @result TRUE if the pixel buffer was successfully uploaded to OpenGL, FALSE otherwise. -*/ -char arglPixelBufferDataUploadBiPlanar(ARGL_CONTEXT_SETTINGS_REF contextSettings, ARUint8 *bufDataPtr0, ARUint8 *bufDataPtr1); -#define arglPixelBufferDataUpload(contextSettings,bufDataPtr) arglPixelBufferDataUploadBiPlanar(contextSettings,bufDataPtr,NULL) - -#endif // !ARGL_DISABLE_DISP_IMAGE - -/*! - @function - @abstract Check for the availability of an OpenGL extension. - @discussion - Provides the same functionality as the gluCheckExtension() function, - since some platforms don't have GLU version 1.3 or later. - @param extName Name of the extension, e.g. "GL_EXT_texture". - @param extString The OpenGL extensions string, as returned by glGetString(GL_EXTENSIONS); - @result TRUE, if the extension is found, FALSE otherwise. -*/ -GLboolean arglGluCheckExtension(const GLubyte* extName, const GLubyte *extString); - -/*! - @function - @abstract Checks for the presence of an OpenGL capability by version or extension. - @discussion - Checks for the presence of an OpenGL capability by version or extension. - The test returns true if EITHER the OpenGL driver's OpenGL implementation - version meets or exceeds a minimum value (passed in in minVersion) OR - if an OpenGL extension identifier passed in as a character string - is non-NULL, and is found in the current driver's list of supported extensions. - @param minVersion - A binary-coded decimal (i.e. version 1.0 is represented as 0x0100) version number. - If minVersion is zero, (i.e. there is no version of OpenGL with this extension in core) - the version test will always fail, and the result will only be true if the extension - string test passes. - @param extension A string with an extension name to search the drivers extensions - string for. E.g. "GL_EXT_texture". If NULL, the extension name test will always fail, - and the result will only be true if the version number test passes. - @result TRUE If either of the tests passes, or FALSE if both fail. -*/ -int arglGLCapabilityCheck(const unsigned short minVersion, const unsigned char *extension); - -#ifdef __cplusplus -} -#endif -#endif /* !__gsub_es_h__ */ diff --git a/include/AR/gsub_es2.h b/include/AR/gsub_es2.h deleted file mode 100644 index dadcadb..0000000 --- a/include/AR/gsub_es2.h +++ /dev/null @@ -1,496 +0,0 @@ -/* - * gsub_es2.h - * ARToolKit5 - * - * Graphics Subroutines (OpenGL ES 2.x) for ARToolKit. - * - * This file is part of ARToolKit. - * - * ARToolKit is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ARToolKit is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with ARToolKit. If not, see . - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce an - * executable, regardless of the license terms of these independent modules, and to - * copy and distribute the resulting executable under terms of your choice, - * provided that you also meet, for each linked independent module, the terms and - * conditions of the license of that module. An independent module is a module - * which is neither derived from nor based on this library. If you modify this - * library, you may extend this exception to your version of the library, but you - * are not obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * - * Copyright 2015 Daqri, LLC. - * Copyright 2011-2015 ARToolworks, Inc. - * - * Author(s): Philip Lamb - * - */ - -/*! - @header gsub_es2 - @abstract A collection of useful OpenGL ES 2.x routines for ARToolKit. - @discussion - gsub_es2 is the preferred means for drawing camera video - images acquired from ARToolKit's video libraries. It includes - optimized texture handling, and a variety of flexible drawing - options. - - gsub_es2 also provides utility functions for setting the - OpenGL viewing frustum and camera position based on ARToolKit- - camera parameters and marker positions. - - gsub_es2 does not depend on GLUT, or indeed, any particular - window or event handling system. It is therefore well suited - to use in applications which have their own window and event - handling code. - - @copyright 2011-2013 Philip Lamb - @version 1.0.0 - */ - -#ifndef __gsub_es2_h__ -#define __gsub_es2_h__ - -// ============================================================================ -// Public includes. -// ============================================================================ - -#include // ARUint8, AR_PIXEL_FORMAT -#include // ARParam, arParamDecompMat(), arParamObserv2Ideal() -#ifndef _WINRT -# define ARGL_DISABLE_DISP_IMAGE 0 -# include "glStateCache2.h" -#else -# define ARGL_DISABLE_DISP_IMAGE 1 -typedef float GLfloat; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// ============================================================================ -// Public types and definitions. -// ============================================================================ - - - -#ifndef TRUE -# define TRUE 1 -#endif -#ifndef FALSE -# define FALSE 0 -#endif - -#if !ARGL_DISABLE_DISP_IMAGE - -/*! - @typedef ARGL_CONTEXT_SETTINGS_REF - @abstract Opaque type to hold ARGL settings for a given OpenGL context. - @discussion - An OpenGL context is an implementation-defined structure which - keeps track of OpenGL state, including textures and display lists. - Typically, individual OpenGL windows will have distinct OpenGL - contexts assigned to them by the host operating system. - - As gsub_lite uses textures and display lists, it must be able to - track which OpenGL context a given texture or display list it is using - belongs to. This is especially important when gsub_lite is being used to - draw into more than one window (and therefore more than one context.) - - Basically, functions which depend on OpenGL state, will require an - ARGL_CONTEXT_SETTINGS_REF to be passed to them. An ARGL_CONTEXT_SETTINGS_REF - is generated by setting the current OpenGL context (e.g. if using GLUT, - you might call glutSetWindow()) and then calling arglSetupForCurrentContext(). - When you have finished using ARGL in a given context, you should call - arglCleanup(), passing in an ARGL_CONTEXT_SETTINGS_REF, to free the - memory used by the settings structure. - @availability First appeared in ARToolKit 2.68. - */ -typedef struct _ARGL_CONTEXT_SETTINGS *ARGL_CONTEXT_SETTINGS_REF; - -#endif - -// ============================================================================ -// Public functions. -// ============================================================================ - -#if !ARGL_DISABLE_DISP_IMAGE - -/*! - @function - @abstract Initialise the gsub_lite library for the current OpenGL context. - @discussion - This function performs required setup of the gsub_lite library - for the current OpenGL context and must be called before any other argl*() - functions are called for this context. - - An OpenGL context holds all of the state of the OpenGL machine, including - textures and display lists etc. There will usually be one OpenGL context - for each window displaying OpenGL content. - - Other argl*() functions whose operation depends on OpenGL state will - require an ARGL_CONTEXT_SETTINGS_REF. This is just so that - they can keep track of per-context variables. - - You should call arglCleanup() passing in the ARGL_CONTEXT_SETTINGS_REF - when you have finished with the library for this context. - @param cparam Pointer to a set of ARToolKit camera parameters for the - current video source. The size of the source image is taken from the - fields xsize and ysize of the ARParam structure pointed to. Also, when - the draw mode is AR_DRAW_BY_TEXTURE_MAPPING (see the documentation for - the global variable arglDrawMode) the field dist_factor of the ARParam - structure pointed to will be taken as the amount to un-warp the supplied - image. - - The ARParam structure pointed to must remain valid in memory for the duration - of the ARGL_CONTEXT_SETTINGS_REF's usage. - @param pixelFormat The type and format of pixels of the images to be drawn by the - gsub library. This value can be changed later by using arglPixelFormatSet() - @result An ARGL_CONTEXT_SETTINGS_REF. See the documentation for this type for more info. - @availability First appeared in ARToolKit 2.68. -*/ -ARGL_CONTEXT_SETTINGS_REF arglSetupForCurrentContext(ARParam *cparam, AR_PIXEL_FORMAT pixelFormat); - -/*! - @function - @abstract Free memory used by gsub_lite associated with the specified context. - @discussion - Should be called after no more argl* functions are needed, in order - to prevent memory leaks etc. - - The library can be setup again for the context at a later time by calling - arglSetupForCurrentContext() again. - @param contextSettings A reference to ARGL's settings for an OpenGL - context, as returned by arglSetupForCurrentContext(). - @availability First appeared in ARToolKit 2.68. -*/ -void arglCleanup(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Display an ARVideo image, by drawing it using OpenGL. - @discussion - This function draws an image from an ARVideo source to the current - OpenGL context. This operation is most useful in video see-through - augmented reality applications for drawing the camera view as a - background image, but can also be used in other ways. - - An undistorted image is drawn with the lower-left corner of the - bottom-left-most pixel at OpenGL screen coordinates (0,0), and the - upper-right corner of the top-right-most pixel at OpenGL screen - coodinates (x * zoom, y * zoom), where x and y are the values of the - fields cparam->xsize and cparam->ysize (see below) and zoom is the - value of the parameter zoom (also see below). If cparam->dist_factor - indicates that an un-warping correction should be applied, the actual - coordinates will differ from the values specified here. - - OpenGL state: Drawing is performed with depth testing and lighting - disabled, and thus leaves the the depth buffer (if any) unmodified. If - pixel transfer is by texturing (see documentation for arglDrawMode), - the drawing is done in replacement texture environment mode. - The depth test enable and lighting enable state and the texture - environment mode are restored before the function returns. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. It - is the callers responsibility to make sure that the current context at the - time arglDisplayImage() is called matches that under which contextSettings - was created. - @availability First appeared in ARToolKit 2.68. -*/ -void arglDispImage(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Display an ARVideo image, by drawing it using OpenGL, using and modifying current OpenGL state. - @discussion - This function is identical to arglDispImage except that whereas - arglDispImage sets an orthographic 2D projection and the OpenGL state - prior to drawing, this function does not. It also does not restore any - changes made to OpenGL state. - - This allows you to do effects with your image, other than just drawing it - 2D and with the lower-left corner of the bottom-left-most pixel attached - to the bottom-left (0,0) of the window. For example, you might use a - perspective projection instead of an orthographic projection with a - glLoadIdentity() / glTranslate() on the modelview matrix to place the - lower-left corner of the bottom-left-most pixel somewhere other than 0,0 - and leave depth-testing enabled. - - See the documentation for arglDispImage() for more information. - @availability First appeared in ARToolKit 2.68.2. - */ -void arglDispImageStateful(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Set compensation for camera lens distortion in arglDispImage to off or on. - @discussion - By default, arglDispImage compensates for the distortion of the camera's - acquired image caused by the lens when it draws. By calling this function - with enabled = FALSE, this compensation will be disabled in the specified - drawing context. It may be re-enabled at any time. - This function is useful if you need to draw an image, but do not know the - extent of the camera's lens distortion (such as during distortion calibration). - While distortion compensation is disabled, the dist_factor[] array in a - the camera cparam structure passed to arglDispImage is ignored. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param enable TRUE to enabled distortion compensation, FALSE to disable it. - The default state for new contexts is enable = TRUE. - @result TRUE if the distortion value was set, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. -*/ -char arglDistortionCompensationSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, char enable); - -/*! - @function - @abstract Enquire as to the enable state of camera lens distortion compensation in arglDispImage. - @discussion - By default, arglDispImage compensates for the distortion of the camera's - acquired image caused by the lens when it draws. This function enquires - as to whether arglDispImage is currently doing compensation or not. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param enable Pointer to an integer value which will be set to TRUE if distortion - compensation is enabled in the specified context, or FALSE if it is disabled. - @result TRUE if the distortion value was retreived, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. - */ -char arglDistortionCompensationGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, char *enable); - -/*! - @function - @abstract Set the current video image drawing scalefactor. - @param zoom The amount to scale the video image up or down. To draw the video - image double size, use a zoom value of 2.0. To draw the video image - half size use a zoom value of 0.5. - */ -char arglSetPixelZoom(ARGL_CONTEXT_SETTINGS_REF contextSettings, float zoom); - -/*! - @function - @abstract Retrieve the current video image drawing scalefactor. - @param zoom The amount to scale the video image up or down. To draw the video - image double size, use a zoom value of 2.0. To draw the video image - half size use a zoom value of 0.5. - */ -char arglGetPixelZoom(ARGL_CONTEXT_SETTINGS_REF contextSettings, float *zoom); - -/*! - @function - @abstract Set the format of pixel data which will be passed to arglDispImage*() - @discussion (description) - In gsub_lite, the format of the pixels (i.e. the arrangement of components - within each pixel) can be changed at runtime. Use this function to inform - gsub_lite the format the pixels being passed to arglDispImage*() functions - are in. This setting applies only to the context passed in parameter - contextSettings. The default format is determined by - the value of AR_DEFAULT_PIXEL_FORMAT at the time the library was built. - Usually, image data is passed in directly from images generated by ARVideo, - and so you should ensure that ARVideo is generating pixels of the same format. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param format A symbolic constant for the pixel format being set. See - AR_PIXEL_FORMAT in ar.h for a list of all possible formats. - @result TRUE if the pixel format value was set, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. -*/ -char arglPixelFormatSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT format); - -/*! - @function - @abstract Get the format of pixel data in which arglDispImage*() is expecting data to be passed. - @discussion This function enquires as to the current format of pixel data being - expected by the arglDispImage*() functions. The default format is determined by - the value of AR_DEFAULT_PIXEL_FORMAT at the time the library was built. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param format A symbolic constant for the pixel format in use. See - AR_PIXEL_FORMAT in ar.h for a list of all possible formats. - @param size The number of bytes of memory occupied per pixel, for the given format. - @result TRUE if the pixel format and size values were retreived, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. -*/ -char arglPixelFormatGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT *format, int *size); - -/*! - @function - @abstract Find out whether ARGL is rotating all OpenGL drawing by 90 degrees. - @discussion - On some OpenGL ES devices, it may be desirable to rotate all OpenGL drawing by 90 - degrees in the window coordinate system, in order to swap the horizontal and - vertical axes of the device. This may be a higher performance solution than - manually swapping rows and columns of submitted data. - - This function queries the current state of whether such a rotation is being performed by ARGL or not. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @result TRUE if a 90 degree rotation is enabled, FALSE if it is disabled. -*/ -char arglGetRotate90(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Set or unset a 90 degree rotation in all OpenGL drawing performed by ARGL. - @discussion - On some OpenGL ES devices, it may be desirable to rotate all OpenGL drawing by 90 - degrees in the window coordinate system, in order to swap the horizontal and - vertical axes of the device. This may be a higher performance solution than - manually swapping rows and columns of submitted data. - - This function enables or disables such an axis swap in ARGL with very little - performance cost, by introducing a 90-degree rotation into the OpenGL projection matrix. - - By default, 90 degree rotation is DISABLED. - @param contextSettings A reference to ARGL's settings for the current OpenGL. - context, as returned by arglSetupForCurrentContext() for this context. - @param rotate90 Set to TRUE or 1 to enable 90 degree rotation, FALSE to disable. -*/ -void arglSetRotate90(ARGL_CONTEXT_SETTINGS_REF contextSettings, char rotate90); - -char arglGetFlipH(ARGL_CONTEXT_SETTINGS_REF contextSettings); -void arglSetFlipH(ARGL_CONTEXT_SETTINGS_REF contextSettings, char flipH); -char arglGetFlipV(ARGL_CONTEXT_SETTINGS_REF contextSettings); -void arglSetFlipV(ARGL_CONTEXT_SETTINGS_REF contextSettings, char flipV); - -/*! - @function - @abstract Specify a desired pixel buffer size larger than the camera image size. - @discussion - By default, the pixel buffer accepted by function arglPixelBufferDataUpload() - is assumed to be tightly packed, row-major array of dimensions - equal to the calibrated camera image size (as passed in the fields arParam.xsize and arParam.ysize - of the ARHandle submitted to arglSetupForCurrentContext(). - - The pixel data buffer submitted may, under some circumstances be allowed to be larger than the - values of the calibrated camera image size (i.e. padded). This may only occur when the - underlying OpenGL ES impementation does not support non-power-of-two textures. For the Apple - iPhone family, this applies to the iPhone, the iPhone 3G, the iPod Touch 1st and 2nd Generation. - The iPhone 3GS and the iPod Touch 3rd Generation support non-power-of-two textures, and thus - padding of the pixel data buffer is not supported on these devices. If padding is desired, - the desired buffer size must be submitted using this function. Check that the - result from this function is TRUE before attempting to upload such a padded buffer. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param bufWidth The desired buffer width, in pixels. - @param bufHeight The desired buffer height, in pixels. - @result TRUE if the desired buffer size is supported, FALSE otherwise. -*/ -char arglPixelBufferSizeSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int bufWidth, int bufHeight); - -/*! - @function - @abstract Query the size of pixel data buffers expected by arglPixelBufferDataUpload(). - @discussion - See function arglPixelBufferSizeSet() for a full discussion. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param bufWidth A pointer to int, which will be filled out with the buffer width, in pixels, or NULL if this value is not required. - @param bufHeight A pointer to int, which will be filled out with the buffer height, in pixels, or NULL if this value is not required.. - @result TRUE if the buffer size was successfully queried, FALSE otherwise. - */ -char arglPixelBufferSizeGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int *bufWidth, int *bufHeight); - -/*! - @function - @abstract Upload a buffer of pixel data to an OpenGL texture for later use by arglDispImage(). - @discussion - ARGL provides the ability to perform distortion-compensated texturing of a camera video image - into the OpenGL context, for the purpose of video-see through augmented reality. This function - uploads the camera image data to an OpenGL texture, ready for later drawing using the function - arglDispImage(). - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param bufDataPtr0 A pointer to the pixel buffer, which is a block of memory from which texture - data will be read. - - The layout of pixel data in the memory pointed to by bufDataPtr is assumed to be - specified by the value of pixelFormat in the ARHandle submitted to arglSetupForCurrentContext(), - but can be changed by calling arglPixelFormatSet() and/or arglPixelBufferSizeSet(). - - By default, the pixel buffer is assumed to be tightly packed, row-major array of dimensions - equal to the calibrated camera image size (as passed in the fields arParam.xsize and arParam.ysize - of the ARHandle submitted to arglSetupForCurrentContext(). - - The pixel data buffer submitted may, under some circumstances be allowed to be larger than the - values of the calibrated camera image size (i.e. padded). See the discussion section of the - documentation for function arglPixelBufferSizeSet() for more information. - - This may only occur when the - underlying OpenGL ES impementation does not support non-power-of-two textures. For the Apple - iPhone family, this applies to the iPhone, the iPhone 3G, the iPod Touch 1st and 2nd Generation. - The iPhone 3GS and the iPod Touch 3rd Generation support non-power-of-two textures, and thus - padding of the pixel data buffer is not supported on these devices. If padding is desired, - the desired buffer size must be submitted using arglPixelBufferSizeSet(). Check that the - result from this function is TRUE before attempting to upload such a padded buffer. - @param bufDataPtr1 NULL for single-plane (interleaved) textures, otherwise for bi-planar textures, - a pointer to the pixel buffer, which is a block of memory from which texture - data will be read for the second plane containing the CbCr components. This plane must have - dimensions of half the size of plane 0, and 2-bytes per pixel (1 byte Cb, 1 byte Cr). - @result TRUE if the pixel buffer was successfully uploaded to OpenGL, FALSE otherwise. -*/ -char arglPixelBufferDataUploadBiPlanar(ARGL_CONTEXT_SETTINGS_REF contextSettings, ARUint8 *bufDataPtr0, ARUint8 *bufDataPtr1); -#define arglPixelBufferDataUpload(contextSettings,bufDataPtr) arglPixelBufferDataUploadBiPlanar(contextSettings,bufDataPtr,NULL) - -#endif // !ARGL_DISABLE_DISP_IMAGE - -#ifndef _WINRT - -/*! - @function - @abstract Check for the availability of an OpenGL extension. - @discussion - Provides the same functionality as the gluCheckExtension() function, - since some platforms don't have GLU version 1.3 or later. - @param extName Name of the extension, e.g. "GL_EXT_texture". - @param extString The OpenGL extensions string, as returned by glGetString(GL_EXTENSIONS); - @result TRUE, if the extension is found, FALSE otherwise. -*/ -GLboolean arglGluCheckExtension(const GLubyte* extName, const GLubyte *extString); - -/*! - @function - @abstract Checks for the presence of an OpenGL capability by version or extension. - @discussion - Checks for the presence of an OpenGL capability by version or extension. - The test returns true if EITHER the OpenGL driver's OpenGL implementation - version meets or exceeds a minimum value (passed in in minVersion) OR - if an OpenGL extension identifier passed in as a character string - is non-NULL, and is found in the current driver's list of supported extensions. - @param minVersion - A binary-coded decimal (i.e. version 1.0 is represented as 0x0100) version number. - If minVersion is zero, (i.e. there is no version of OpenGL with this extension in core) - the version test will always fail, and the result will only be true if the extension - string test passes. - @param extension A string with an extension name to search the drivers extensions - string for. E.g. "GL_EXT_texture". If NULL, the extension name test will always fail, - and the result will only be true if the version number test passes. - @result TRUE If either of the tests passes, or FALSE if both fail. -*/ -int arglGLCapabilityCheck(const unsigned short minVersion, const unsigned char *extension); - -/* Shader Utilities */ -GLint arglGLCompileShaderFromFile(GLuint *shader, GLenum type, const char *pathname); -GLint arglGLCompileShaderFromString(GLuint *shader, GLenum type, const char *s); -GLint arglGLLinkProgram(GLuint prog); -GLint arglGLValidateProgram(GLuint prog); -void arglGLDestroyShaders(GLuint vertShader, GLuint fragShader, GLuint prog); - -#endif // !_WINRT - -#ifdef __cplusplus -} -#endif -#endif /* !__gsub_es2_h__ */ diff --git a/include/AR/gsub_lite.h b/include/AR/gsub_lite.h deleted file mode 100644 index b738907..0000000 --- a/include/AR/gsub_lite.h +++ /dev/null @@ -1,512 +0,0 @@ -/* - * gsub_lite.h - * ARToolKit5 - * - * Graphics Subroutines (Lite) for ARToolKit. - * - * This file is part of ARToolKit. - * - * ARToolKit is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ARToolKit is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with ARToolKit. If not, see . - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce an - * executable, regardless of the license terms of these independent modules, and to - * copy and distribute the resulting executable under terms of your choice, - * provided that you also meet, for each linked independent module, the terms and - * conditions of the license of that module. An independent module is a module - * which is neither derived from nor based on this library. If you modify this - * library, you may extend this exception to your version of the library, but you - * are not obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * - * Copyright 2015 Daqri, LLC. - * Copyright 2003-2015 ARToolworks, Inc. - * - * Author(s): Philip Lamb - * - */ - -/** - \file gsub_lite.h - \brief A collection of useful OpenGL routines for ARToolKit. - \cond GSUB_LITE - \htmlinclude gsub_lite/index.html -*/ - -/*! - @header gsub_lite - @abstract A collection of useful OpenGL routines for ARToolKit. - @discussion - Sample code for example usage of gsub_lite is included with - ARToolKit, in the directory <AR/examples/simpleLite>. - - gsub_lite is the preferred means for drawing camera video - images acquired from ARToolKit's video libraries. It includes - optimized texture handling, and a variety of flexible drawing - options. - - gsub_lite also provides utility functions for setting the - OpenGL viewing frustum and camera position based on ARToolKit- - camera parameters and marker positions. - - gsub_lite does not depend on GLUT, or indeed, any particular - window or event handling system. It is therefore well suited - to use in applications which have their own window and event - handling code. - - @copyright 2015 Daqri, LLC. - @version 5.2 - */ - -#ifndef __gsub_lite_h__ -#define __gsub_lite_h__ - -// ============================================================================ -// Public includes. -// ============================================================================ - -#ifdef __APPLE__ -# include -#else -# ifdef _WIN32 -# include -# endif -# include -#endif -#include // ARUint8, AR_PIXEL_FORMAT -#include // ARParam, arParamDecompMat(), arParamObserv2Ideal() - -#ifdef __cplusplus -extern "C" { -#endif - -// ============================================================================ -// Public types and definitions. -// ============================================================================ - -#define ARGL_DISABLE_DISP_IMAGE 0 - -#if !ARGL_DISABLE_DISP_IMAGE - -/*! - @typedef ARGL_CONTEXT_SETTINGS_REF - @abstract Opaque type to hold ARGL settings for a given OpenGL context. - @discussion - An OpenGL context is an implementation-defined structure which - keeps track of OpenGL state, including textures and display lists. - Typically, individual OpenGL windows will have distinct OpenGL - contexts assigned to them by the host operating system. - - As gsub_lite uses textures and display lists, it must be able to - track which OpenGL context a given texture or display list it is using - belongs to. This is especially important when gsub_lite is being used to - draw into more than one window (and therefore more than one context.) - - Basically, functions which depend on OpenGL state, will require an - ARGL_CONTEXT_SETTINGS_REF to be passed to them. An ARGL_CONTEXT_SETTINGS_REF - is generated by setting the current OpenGL context (e.g. if using GLUT, - you might call glutSetWindow()) and then calling arglSetupForCurrentContext(). - When you have finished using ARGL in a given context, you should call - arglCleanup(), passing in an ARGL_CONTEXT_SETTINGS_REF, to free the - memory used by the settings structure. - @availability First appeared in ARToolKit 2.68. - */ -typedef struct _ARGL_CONTEXT_SETTINGS *ARGL_CONTEXT_SETTINGS_REF; - -#endif - -// ============================================================================ -// Public functions. -// ============================================================================ - -#if !ARGL_DISABLE_DISP_IMAGE - -/*! - @function - @abstract Initialise the gsub_lite library for the current OpenGL context. - @discussion - This function performs required setup of the gsub_lite library - for the current OpenGL context and must be called before any other argl*() - functions are called for this context. - - An OpenGL context holds all of the state of the OpenGL machine, including - textures and display lists etc. There will usually be one OpenGL context - for each window displaying OpenGL content. - - Other argl*() functions whose operation depends on OpenGL state will - require an ARGL_CONTEXT_SETTINGS_REF. This is just so that - they can keep track of per-context variables. - - You should call arglCleanup() passing in the ARGL_CONTEXT_SETTINGS_REF - when you have finished with the library for this context. - @param cparam Pointer to a set of ARToolKit camera parameters for the - current video source. The size of the source image is taken from the - fields xsize and ysize of the ARParam structure pointed to. Also, when - the draw mode is AR_DRAW_BY_TEXTURE_MAPPING (see the documentation for - the global variable arglDrawMode) the field dist_factor of the ARParam - structure pointed to will be taken as the amount to un-warp the supplied - image. - - Prior to ARToolKit v5.1.5, the ARParam structure pointed to had to remain - valid in memory for the duration of the ARGL_CONTEXT_SETTINGS_REF's usage. - As of ARToolKit v5.1.5, the ARParam structure pointed to is copied, and - no longer need be maintained. - @param pixelFormat The type and format of pixels of the images to be drawn by the - gsub library. This value can be changed later by using arglPixelFormatSet() - @result An ARGL_CONTEXT_SETTINGS_REF. See the documentation for this type for more info. - @availability First appeared in ARToolKit 2.68. -*/ -ARGL_CONTEXT_SETTINGS_REF arglSetupForCurrentContext(ARParam *cparam, AR_PIXEL_FORMAT pixelFormat); - -/*! - @function - @abstract Provide an ARHandle structure from which to extract information about debug mode. - @discussion - This provides support for the debug mode in libAR. If gsub_lite has been compiled - with debug mode support, the passed in ARHandle is used as the source - of whether debug mode is enabled or disabled. If enabled, the binarized - debug image will be drawn instead of the input image. - @param arHandle A pointer to an ARHandle structure from which to extract debug info, - or NULL if debug functionality is not required. Default is NULL. - @result TRUE if the mode was set, FALSE if an error occurred. - @availability First appeared in ARToolKit 4.5.12. - @seealso arglPixelBufferDataUpload arglPixelBufferDataUpload -*/ -int arglSetupDebugMode(ARGL_CONTEXT_SETTINGS_REF contextSettings, ARHandle *arHandle); - - -/*! - @function - @abstract Free memory used by gsub_lite associated with the specified context. - @discussion - Should be called after no more argl* functions are needed, in order - to prevent memory leaks etc. - - The library can be setup again for the context at a later time by calling - arglSetupForCurrentContext() again. - @param contextSettings A reference to ARGL's settings for an OpenGL - context, as returned by arglSetupForCurrentContext(). - @availability First appeared in ARToolKit 2.68. -*/ -void arglCleanup(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Display an ARVideo image, by drawing it using OpenGL. - @discussion - This function draws an image from an ARVideo source to the current - OpenGL context. This operation is most useful in video see-through - augmented reality applications for drawing the camera view as a - background image, but can also be used in other ways. - - An undistorted image is drawn with the lower-left corner of the - bottom-left-most pixel at OpenGL screen coordinates (0,0), and the - upper-right corner of the top-right-most pixel at OpenGL screen - coodinates (x * zoom, y * zoom), where x and y are the values of the - fields cparam->xsize and cparam->ysize (see below) and zoom is the - value of the parameter zoom (also see below). If cparam->dist_factor - indicates that an un-warping correction should be applied, the actual - coordinates will differ from the values specified here. - - OpenGL state: Drawing is performed with depth testing and lighting - disabled, and thus leaves the the depth buffer (if any) unmodified. If - pixel transfer is by texturing (see documentation for arglDrawMode), - the drawing is done in replacement texture environment mode. - The depth test enable and lighting enable state and the texture - environment mode are restored before the function returns. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. It - is the callers responsibility to make sure that the current context at the - time arglDisplayImage() is called matches that under which contextSettings - was created. - @availability First appeared in ARToolKit 2.68. -*/ -void arglDispImage(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Display an ARVideo image, by drawing it using OpenGL, using and modifying current OpenGL state. - @discussion - This function is identical to arglDispImage except that whereas - arglDispImage sets an orthographic 2D projection and the OpenGL state - prior to drawing, this function does not. It also does not restore any - changes made to OpenGL state. - - This allows you to do effects with your image, other than just drawing it - 2D and with the lower-left corner of the bottom-left-most pixel attached - to the bottom-left (0,0) of the window. For example, you might use a - perspective projection instead of an orthographic projection with a - glLoadIdentity() / glTranslate() on the modelview matrix to place the - lower-left corner of the bottom-left-most pixel somewhere other than 0,0 - and leave depth-testing enabled. - - See the documentation for arglDispImage() for more information. - @availability First appeared in ARToolKit 2.68.2. - */ -void arglDispImageStateful(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Set compensation for camera lens distortion in arglDispImage to off or on. - @discussion - By default, arglDispImage compensates for the distortion of the camera's - acquired image caused by the lens when it draws. By calling this function - with enabled = FALSE, this compensation will be disabled in the specified - drawing context. It may be re-enabled at any time. - This function is useful if you need to draw an image, but do not know the - extent of the camera's lens distortion (such as during distortion calibration). - While distortion compensation is disabled, the dist_factor[] array in a - the camera cparam structure passed to arglDispImage is ignored. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param enable TRUE to enabled distortion compensation, FALSE to disable it. - The default state for new contexts is enable = TRUE. - @result TRUE if the distortion value was set, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. -*/ -int arglDistortionCompensationSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int enable); - -/*! - @function - @abstract Enquire as to the enable state of camera lens distortion compensation in arglDispImage. - @discussion - By default, arglDispImage compensates for the distortion of the camera's - acquired image caused by the lens when it draws. This function enquires - as to whether arglDispImage is currently doing compensation or not. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param enable Pointer to an integer value which will be set to TRUE if distortion - compensation is enabled in the specified context, or FALSE if it is disabled. - @result TRUE if the distortion value was retreived, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. - */ -int arglDistortionCompensationGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int *enable); - -/*! - @function - @abstract Set the current video image drawing scalefactor. - @param zoom The amount to scale the video image up or down. To draw the video - image double size, use a zoom value of 2.0. To draw the video image - half size use a zoom value of 0.5. - */ -int arglSetPixelZoom(ARGL_CONTEXT_SETTINGS_REF contextSettings, float zoom); - -/*! - @function - @abstract Retrieve the current video image drawing scalefactor. - @param zoom The amount to scale the video image up or down. To draw the video - image double size, use a zoom value of 2.0. To draw the video image - half size use a zoom value of 0.5. - */ -int arglGetPixelZoom(ARGL_CONTEXT_SETTINGS_REF contextSettings, float *zoom); - -/*! - @function - @abstract Set the format of pixel data which will be passed to arglDispImage*() - @discussion (description) - In gsub_lite, the format of the pixels (i.e. the arrangement of components - within each pixel) can be changed at runtime. Use this function to inform - gsub_lite the format the pixels being passed to arglDispImage*() functions - are in. This setting applies only to the context passed in parameter - contextSettings. The default format is determined by - the value of AR_DEFAULT_PIXEL_FORMAT at the time the library was built. - Usually, image data is passed in directly from images generated by ARVideo, - and so you should ensure that ARVideo is generating pixels of the same format. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param format A symbolic constant for the pixel format being set. See - AR_PIXEL_FORMAT in ar.h for a list of all possible formats. - @result TRUE if the pixel format value was set, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. -*/ -int arglPixelFormatSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT format); - -/*! - @function - @abstract Get the format of pixel data in which arglDispImage*() is expecting data to be passed. - @discussion This function enquires as to the current format of pixel data being - expected by the arglDispImage*() functions. The default format is determined by - the value of AR_DEFAULT_PIXEL_FORMAT at the time the library was built. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param format A symbolic constant for the pixel format in use. See - AR_PIXEL_FORMAT in ar.h for a list of all possible formats. - @param size The number of bytes of memory occupied per pixel, for the given format. - @result TRUE if the pixel format and size values were retreived, FALSE if an error occurred. - @availability First appeared in ARToolKit 2.71. -*/ -int arglPixelFormatGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT *format, int *size); - -/*! - @function - @abstract Find out whether ARGL is rotating all OpenGL drawing by 90 degrees. - @discussion - On some OpenGL ES devices, it may be desirable to rotate all OpenGL drawing by 90 - degrees in the window coordinate system, in order to swap the horizontal and - vertical axes of the device. This may be a higher performance solution than - manually swapping rows and columns of submitted data. - - This function queries the current state of whether such a rotation is being performed by ARGL or not. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @result TRUE if a 90 degree rotation is enabled, FALSE if it is disabled. -*/ -int arglGetRotate90(ARGL_CONTEXT_SETTINGS_REF contextSettings); - -/*! - @function - @abstract Set or unset a 90 degree rotation in all OpenGL drawing performed by ARGL. - @discussion - On some OpenGL ES devices, it may be desirable to rotate all OpenGL drawing by 90 - degrees in the window coordinate system, in order to swap the horizontal and - vertical axes of the device. This may be a higher performance solution than - manually swapping rows and columns of submitted data. - - This function enables or disables such an axis swap in ARGL with very little - performance cost, by introducing a 90-degree rotation into the OpenGL projection matrix. - - By default, 90 degree rotation is DISABLED. - @param contextSettings A reference to ARGL's settings for the current OpenGL. - context, as returned by arglSetupForCurrentContext() for this context. - @param rotate90 Set to TRUE or 1 to enable 90 degree rotation, FALSE to disable. -*/ -void arglSetRotate90(ARGL_CONTEXT_SETTINGS_REF contextSettings, int rotate90); - -int arglGetFlipH(ARGL_CONTEXT_SETTINGS_REF contextSettings); -void arglSetFlipH(ARGL_CONTEXT_SETTINGS_REF contextSettings, int flipH); -int arglGetFlipV(ARGL_CONTEXT_SETTINGS_REF contextSettings); -void arglSetFlipV(ARGL_CONTEXT_SETTINGS_REF contextSettings, int flipV); - -/*! - @function - @abstract Specify a desired pixel buffer size larger than the camera image size. - @discussion - By default, the pixel buffer accepted by function arglPixelBufferDataUpload() - is assumed to be tightly packed, row-major array of dimensions - equal to the calibrated camera image size (as passed in the fields arParam.xsize and arParam.ysize - of the ARHandle submitted to arglSetupForCurrentContext(). - - The pixel data buffer submitted may, under some circumstances be allowed to be larger than the - values of the calibrated camera image size (i.e. padded). This may only occur when the - underlying OpenGL ES impementation does not support non-power-of-two textures. For the Apple - iPhone family, this applies to the iPhone, the iPhone 3G, the iPod Touch 1st and 2nd Generation. - The iPhone 3GS and the iPod Touch 3rd Generation support non-power-of-two textures, and thus - padding of the pixel data buffer is not supported on these devices. If padding is desired, - the desired buffer size must be submitted using this function. Check that the - result from this function is TRUE before attempting to upload such a padded buffer. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param bufWidth The desired buffer width, in pixels. - @param bufHeight The desired buffer height, in pixels. - @result TRUE if the desired buffer size is supported, FALSE otherwise. -*/ -char arglPixelBufferSizeSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int bufWidth, int bufHeight); - -/*! - @function - @abstract Query the size of pixel data buffers expected by arglPixelBufferDataUpload(). - @discussion - See function arglPixelBufferSizeSet() for a full discussion. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param bufWidth A pointer to int, which will be filled out with the buffer width, in pixels, or NULL if this value is not required. - @param bufHeight A pointer to int, which will be filled out with the buffer height, in pixels, or NULL if this value is not required.. - @result TRUE if the buffer size was successfully queried, FALSE otherwise. - */ -char arglPixelBufferSizeGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int *bufWidth, int *bufHeight); - -/*! - @function - @abstract Upload a buffer of pixel data to an OpenGL texture for later use by arglDispImage(). - @discussion - ARGL provides the ability to perform distortion-compensated texturing of a camera video image - into the OpenGL context, for the purpose of video-see through augmented reality. This function - uploads the camera image data to an OpenGL texture, ready for later drawing using the function - arglDispImage(). - - If a pointer to an ARParam structure has been passed in to function arglSetupDebugMode, then - a check will be made whether debug mode is enabled, and if it is, then the buffer pointed to - by this function will be ignored, and instead the debug image will be loaded for texturing. - @param contextSettings A reference to ARGL's settings for the current OpenGL - context, as returned by arglSetupForCurrentContext() for this context. - @param bufDataPtr A pointer to the pixel buffer, which is a block of memory from which texture - data will be read. - - The layout of pixel data in the memory pointed to by bufDataPtr is assumed to be - specified by the value of pixelFormat in the ARHandle submitted to arglSetupForCurrentContext(), - but can be changed by calling arglPixelFormatSet() and/or arglPixelBufferSizeSet(). - - By default, the pixel buffer is assumed to be tightly packed, row-major array of dimensions - equal to the calibrated camera image size (as passed in the fields arParam.xsize and arParam.ysize - of the ARHandle submitted to arglSetupForCurrentContext(). - - The pixel data buffer submitted may, under some circumstances be allowed to be larger than the - values of the calibrated camera image size (i.e. padded). See the discussion section of the - documentation for function arglPixelBufferSizeSet() for more information. - - This may only occur when the underlying OpenGL impementation does not support non-power-of-two - textures. If padding is desired, the desired buffer size must be submitted using - arglPixelBufferSizeSet(). Check that the result from this function is TRUE before attempting to - upload such a padded buffer. - @result TRUE if the pixel buffer was successfully uploaded to OpenGL, FALSE otherwise. - @seealso arglSetupDebugMode arglSetupDebugMode -*/ -int arglPixelBufferDataUpload(ARGL_CONTEXT_SETTINGS_REF contextSettings, ARUint8 *bufDataPtr); - -#endif // !ARGL_DISABLE_DISP_IMAGE - -/*! - @function - @abstract Check for the availability of an OpenGL extension. - @discussion - Provides the same functionality as the gluCheckExtension() function, - since some platforms don't have GLU version 1.3 or later. - @param extName Name of the extension, e.g. "GL_EXT_texture". - @param extString The OpenGL extensions string, as returned by glGetString(GL_EXTENSIONS); - @result TRUE, if the extension is found, FALSE otherwise. - @availability First available in ARToolKit 4.5.0. - */ -GLboolean arglGluCheckExtension(const GLubyte* extName, const GLubyte *extString); - -/*! - @function - @abstract Checks for the presence of an OpenGL capability by version or extension. - @discussion - Checks for the presence of an OpenGL capability by version or extension. - The test returns true if EITHER the OpenGL driver's OpenGL implementation - version meets or exceeds a minimum value (passed in in minVersion) OR - if an OpenGL extension identifier passed in as a character string - is non-NULL, and is found in the current driver's list of supported extensions. - @param minVersion - A binary-coded decimal (i.e. version 1.0 is represented as 0x0100) version number. - If minVersion is zero, (i.e. there is no version of OpenGL with this extension in core) - the version test will always fail, and the result will only be true if the extension - string test passes. - @param extension A string with an extension name to search the drivers extensions - string for. E.g. "GL_EXT_texture". If NULL, the extension name test will always fail, - and the result will only be true if the version number test passes. - @result TRUE If either of the tests passes, or FALSE if both fail. - @availability First available in ARToolKit 4.5.0. - */ -int arglGLCapabilityCheck(const unsigned short minVersion, const unsigned char *extension); - -#ifdef __cplusplus -} -#endif - -/** - \endcond - */ - -#endif /* !__gsub_lite_h__ */ From c390f776f0ef729a2c9964f9e77fdf0cbdc35954 Mon Sep 17 00:00:00 2001 From: Walter Perdan Date: Fri, 15 May 2020 15:29:57 +0200 Subject: [PATCH 06/34] removing Eden lib --- include/Eden/Eden.h | 233 --- include/Eden/EdenError.h | 210 --- include/Eden/EdenGLFont.h | 443 ----- include/Eden/EdenMath.h | 577 ------ include/Eden/EdenMessage.h | 283 --- include/Eden/EdenSound.h | 70 - include/Eden/EdenSurfaces.h | 317 ---- include/Eden/EdenTime.h | 156 -- include/Eden/EdenUtil.h | 184 -- include/Eden/glm.h | 540 ------ include/Eden/gluttext.h | 90 - include/Eden/readtex.h | 102 - lib/SRC/Eden/ALFramework.cpp | 387 ---- lib/SRC/Eden/ALFramework.h | 134 -- lib/SRC/Eden/CWaves.cpp | 688 ------- lib/SRC/Eden/CWaves.h | 141 -- lib/SRC/Eden/EdenError.c | 141 -- lib/SRC/Eden/EdenGLFont.c | 600 ------ lib/SRC/Eden/EdenMath.c | 1001 ---------- lib/SRC/Eden/EdenMessage.c | 642 ------- lib/SRC/Eden/EdenSound.c | 269 --- lib/SRC/Eden/EdenSurfaces.c | 465 ----- lib/SRC/Eden/EdenTime.c | 206 -- lib/SRC/Eden/EdenUtil.c | 411 ---- lib/SRC/Eden/Makefile.in | 109 -- lib/SRC/Eden/glm.c | 2716 --------------------------- lib/SRC/Eden/gluttext/glut_8x13.c | 2041 -------------------- lib/SRC/Eden/gluttext/glut_9x15.c | 2044 -------------------- lib/SRC/Eden/gluttext/glut_bitmap.c | 65 - lib/SRC/Eden/gluttext/glut_bwidth.c | 53 - lib/SRC/Eden/gluttext/glut_hel10.c | 1765 ----------------- lib/SRC/Eden/gluttext/glut_hel12.c | 1775 ----------------- lib/SRC/Eden/gluttext/glut_hel18.c | 1884 ------------------- lib/SRC/Eden/gluttext/glut_mroman.c | 2454 ------------------------ lib/SRC/Eden/gluttext/glut_roman.c | 2455 ------------------------ lib/SRC/Eden/gluttext/glut_stroke.c | 57 - lib/SRC/Eden/gluttext/glut_swidth.c | 55 - lib/SRC/Eden/gluttext/glut_tr10.c | 1764 ----------------- lib/SRC/Eden/gluttext/glut_tr24.c | 2048 -------------------- lib/SRC/Eden/gluttext/glutbitmap.h | 50 - lib/SRC/Eden/gluttext/glutstroke.h | 59 - lib/SRC/Eden/readtex.c | 405 ---- 42 files changed, 30089 deletions(-) delete mode 100644 include/Eden/Eden.h delete mode 100644 include/Eden/EdenError.h delete mode 100644 include/Eden/EdenGLFont.h delete mode 100644 include/Eden/EdenMath.h delete mode 100644 include/Eden/EdenMessage.h delete mode 100644 include/Eden/EdenSound.h delete mode 100644 include/Eden/EdenSurfaces.h delete mode 100644 include/Eden/EdenTime.h delete mode 100644 include/Eden/EdenUtil.h delete mode 100644 include/Eden/glm.h delete mode 100644 include/Eden/gluttext.h delete mode 100644 include/Eden/readtex.h delete mode 100644 lib/SRC/Eden/ALFramework.cpp delete mode 100644 lib/SRC/Eden/ALFramework.h delete mode 100644 lib/SRC/Eden/CWaves.cpp delete mode 100644 lib/SRC/Eden/CWaves.h delete mode 100644 lib/SRC/Eden/EdenError.c delete mode 100644 lib/SRC/Eden/EdenGLFont.c delete mode 100644 lib/SRC/Eden/EdenMath.c delete mode 100644 lib/SRC/Eden/EdenMessage.c delete mode 100644 lib/SRC/Eden/EdenSound.c delete mode 100644 lib/SRC/Eden/EdenSurfaces.c delete mode 100644 lib/SRC/Eden/EdenTime.c delete mode 100644 lib/SRC/Eden/EdenUtil.c delete mode 100644 lib/SRC/Eden/Makefile.in delete mode 100644 lib/SRC/Eden/glm.c delete mode 100644 lib/SRC/Eden/gluttext/glut_8x13.c delete mode 100644 lib/SRC/Eden/gluttext/glut_9x15.c delete mode 100644 lib/SRC/Eden/gluttext/glut_bitmap.c delete mode 100644 lib/SRC/Eden/gluttext/glut_bwidth.c delete mode 100644 lib/SRC/Eden/gluttext/glut_hel10.c delete mode 100644 lib/SRC/Eden/gluttext/glut_hel12.c delete mode 100644 lib/SRC/Eden/gluttext/glut_hel18.c delete mode 100644 lib/SRC/Eden/gluttext/glut_mroman.c delete mode 100644 lib/SRC/Eden/gluttext/glut_roman.c delete mode 100644 lib/SRC/Eden/gluttext/glut_stroke.c delete mode 100644 lib/SRC/Eden/gluttext/glut_swidth.c delete mode 100644 lib/SRC/Eden/gluttext/glut_tr10.c delete mode 100644 lib/SRC/Eden/gluttext/glut_tr24.c delete mode 100644 lib/SRC/Eden/gluttext/glutbitmap.h delete mode 100644 lib/SRC/Eden/gluttext/glutstroke.h delete mode 100644 lib/SRC/Eden/readtex.c diff --git a/include/Eden/Eden.h b/include/Eden/Eden.h deleted file mode 100644 index 4ff55eb..0000000 --- a/include/Eden/Eden.h +++ /dev/null @@ -1,233 +0,0 @@ -// -// Eden.h -// -// Compiler and platform specific constants, needed for entire projects. -// This file should be included with the project as a prefix header -// (i.e., implicitly included from every source file.) -// -// Copyright (c) 2001-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0.0 2001-10-12 PRL Initial version for The SRMS simulator. -// 1.0.1 2004-04-27 PRL Many changes over many moons. -// 1.0.2 2004-08-05 PRL Moved out of SRMSsim. -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -#ifndef __Eden_h__ -#define __Eden_h__ - -// -// Keep it simple: define compiler, platform and architecture capabilities here -// rather than using a configure script. -// - -#include -#ifndef _WIN32 // errno is defined in stdlib.h on Windows. -# include -#endif -#ifdef __ANDROID__ -# include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __ANDROID__ -# define EDEN_LOG(...) __android_log_print(ANDROID_LOG_INFO, "libeden", __VA_ARGS__); -# define EDEN_LOGe(...) __android_log_print(ANDROID_LOG_ERROR, "libeden", __VA_ARGS__); -# define EDEN_LOGperror(s) __android_log_print(ANDROID_LOG_ERROR, "libeden", (s ? "%s: %s\n" : "%s%s\n"), (s ? s : ""), strerror(errno)) -#else -# define EDEN_LOG(...) printf(__VA_ARGS__) -# define EDEN_LOGe(...) fprintf(stderr, __VA_ARGS__) -# define EDEN_LOGperror(s) fprintf(stderr, (s ? "%s: %s\n" : "%s%s\n"), (s ? s : ""), strerror(errno)) -#endif - -// Check architecture endianess using gcc's macro, or assume little-endian by default. -// Also, define attribute to produce a tightly packed structure (i.e. all structures -// byte-aligned.) -// I don't know how to do this in compilers other than GCC at the moment. -#if defined(__GNUC__) -# if defined(__BIG_ENDIAN__) -# define EDEN_BIGENDIAN // Most Significant Byte has greatest address in memory. -# endif -# define EDEN_INLINE_H extern inline -# define EDEN_INLINE_C -# define EDEN_PACKED __attribute__ ((__packed__)) -#else -# define EDEN_PACKED -#endif - -// GCC on macOS. -#if defined(__APPLE__) -# define EDEN_UNIX -# define EDEN_HAVE_PTHREAD_RELATIVE_TIMEDWAIT -# include -# include -# if TARGET_RT_BIG_ENDIAN -# define EDEN_BIGENDIAN // Most Significant Byte has greatest address in memory (ppc). -# elif TARGET_RT_LITTLE_ENDIAN -# undef EDEN_BIGENDIAN -# else -# error -# endif - -# if TARGET_OS_IPHONE -# define EDEN_IPHONEOS -# define EDEN_OPENGLES -# endif - -# if !defined(DARWINONLY) && !TARGET_OS_IPHONE -# define EDEN_MACOSX // Running under macOS. -//# define EDEN_HAVE_HID // Has HID API available (for joystick). -//# define EDEN_HAVE_ARTOOLKIT -# define EDEN_HAVE_MACOSX_CGL -# if !defined(__LP64__) -# define EDEN_HAVE_CARBON -# endif -# endif - -# define EDEN_HAVE_LIBJPEG -# define EDEN_HAVE_OPENAL - -// GCC on Android (NDK) -#elif defined(__ANDROID__) -# define EDEN_UNIX -# define EDEN_OPENGLES -# define EDEN_HAVE_LIBJPEG -# ifndef ANDROID -# define ANDROID -# endif - -// GCC on Cygnus GNU for Windows. -#elif defined(__CYGWIN__) -# define EDEN_UNIX // Its a Unix system too! -# define EDEN_SERIAL_POSIX_ONLY // Use only POSIX-compliant serial calls. - -// GCC on Linux. -#elif defined(__linux__) -# define EDEN_UNIX // Its a Unix-like system. -//# define EDEN_HAVE_ARTOOLKIT - -// GCC on NetBSD. -#elif defined(__NetBSD__) -# define EDEN_UNIX - -// MrC on Mac OS Classic. -#elif defined(__MRC__) -# define EDEN_MACOS -# define EDEN_BIGENDIAN // Most Significant Byte is highest in memory. -# define EDEN_HAVE_HID // Has HID API available (for joystick). -# define EDEN_HAVE_CARBON -# define EDEN_INLINE_H -# define EDEN_INLINE_C - -// Microsoft C++ on Windows. -#elif defined(_MSC_VER) -# include // Is this correct? -# undef EDEN_BIGENDIAN // Least Significant Byte is highest in memory. -# define EDEN_HAVE_LIBJPEG -//# define EDEN_HAVE_OPENAL -//# define EDEN_HAVE_ARTOOLKIT -# pragma warning (disable:4068) // Disable bogus unknown pragma warnings. -# pragma warning (disable:4244) // Disable bogus conversion warnings. -# pragma warning (disable:4305) // Disable bogus conversion warnings. -# define EDEN_INLINE_H __inline -# define EDEN_INLINE_C __inline - -// Generic POSIX-compliant Unix. -#elif defined(_POSIX) -# define EDEN_UNIX -# define EDEN_SERIAL_POSIX_ONLY // Use only POSIX-compliant serial calls. -# define EDEN_INLINE_H -# define EDEN_INLINE_C - -// Irix on SGI hardware. -#elif defined(__sgi) -# define EDEN_BIGENDIAN // Most Significant Byte is highest in memory. -# define EDEN_UNIX // Its a Unix system. -//# define EDEN_HAVE_ARTOOLKIT -# define EDEN_INLINE_H -# define EDEN_INLINE_C - -#else -# error Unrecognised compiler in __FILE__. -#endif - - -// -// Application code which is dependent on platform capabilities. -// - -// Features common to all our supported Unix platforms. -#ifdef EDEN_UNIX -# define EDEN_HAVE_STRINGS_H -# define EDEN_HAVE_CTIME_R_IN_TIME_H -#endif // EDEN_UNIX - -// -// Miscellany. -// - -// Use these definitions rather than those in . -typedef int EDEN_BOOL; -#define EDEN_BOOL_DEFINED -#ifndef TRUE -# define TRUE 1 -#else -# if (TRUE != 1) -# error 'TRUE incorrectly defined somewhere other than __FILE__.' -# endif -#endif -#ifndef FALSE -# define FALSE 0 -#else -# if (FALSE != 0) -# error 'FALSE incorrectly defined somewhere other than __FILE__.' -# endif -#endif - -// ASCII keycodes. -#define EDEN_ASCII_ESC 27 -#define EDEN_ASCII_TAB 9 -#define EDEN_ASCII_BS 8 -#define EDEN_ASCII_CR 13 -#define EDEN_ASCII_DEL 127 - - -#ifdef __cplusplus -} -#endif - -#endif // !__Eden_h__ - diff --git a/include/Eden/EdenError.h b/include/Eden/EdenError.h deleted file mode 100644 index 0e45d08..0000000 --- a/include/Eden/EdenError.h +++ /dev/null @@ -1,210 +0,0 @@ -// -// EdenError.h -// -// Copyright (c) 2004-2012 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0.0 2004-06-01 PRL Pulled together from other headers. -// -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// HeaderDoc documentation included. See http://developer.apple.com/darwin/projects/headerdoc/ - -/*! - @header EdenError - @abstract Error codes and error reporting for the Eden library. - @version 1.0.0 - @updated 2004-06-01 - @discussion -*/ - -#ifndef __EdenError_h__ -#define __EdenError_h__ - -// ============================================================================ -// Includes -// ============================================================================ - -#ifndef __Eden_h__ -# include -#endif -#include // stderr, fprintf(), vfprintf() - -#ifdef __cplusplus -extern "C" { -#endif - -// ============================================================================ -// Public defines -// ============================================================================ - -/*! - @enum EDEN_E_* - @abstract Symbolic codes for errors reported by routines in the Eden Library. - @discussion - As the actual numerical values for certain errors may change from time - to time, these symbolic codes should be used instead. - @constant EDEN_E_NONE No error. - @constant EDEN_E_GENERIC Error. - @constant EDEN_E_OUT_OF_MEMORY Out of memory. - @constant EDEN_E_OVERFLOW Overflow. - @constant EDEN_E_NODATA Data was requested but none was available. - @constant EDEN_E_IOERROR Error during input / output operation. - @constant EDEN_E_EOF End of file reached. - @constant EDEN_E_TIMEOUT Timed out. - @constant EDEN_E_INVALID_COMMAND Invalid command. - @constant EDEN_E_INVALID_ENUM Invalid enumeration. - @constant EDEN_E_THREADS An error occured during a thread-management operation. - @constant EDEN_E_FILE_NOT_FOUND File not found. - @constant EDEN_E_LENGTH_UNAVAILABLE Length not available. - @constant EDEN_E_GENERIC_TOOLBOX Error returned from System tool. - @constant EDEN_E_LIBRARY_NOT_AVAILABLE A required library is not installed. - @constant EDEN_E_LIBRARY_TOO_OLD The minimum version requirement of a library was not met. - @constant EDEN_E_LIBRARY_TOO_NEW The maximum version requirement of a library was not met. - @constant EDEN_E_HARDWARE_GENERIC Hardware error. - @constant EDEN_E_HARDWARE_NOT_AVAILABLE Required hardware is not available. - @constant EDEN_E_BIRD_CONFIGURATION The bird hardware is incorrectly configured. - @constant EDEN_E_BIRD_PHASEERROR Data from the bird was lost and arrived from the bird out-of-phase. - @constant EDEN_E_NET_GENERIC Network error. - @constant EDEN_E_NET_NOT_AVAILABLE Network not available. - @constant EDEN_E_NET_NOT_CONNECTED Network not connected. - */ -enum { - EDEN_E_NONE = 0, - EDEN_E_GENERIC = -1, - EDEN_E_OUT_OF_MEMORY = -2, - EDEN_E_OVERFLOW = -3, - EDEN_E_NODATA = -4, - EDEN_E_IOERROR = -5, - EDEN_E_EOF = -6, - EDEN_E_TIMEOUT = -7, - EDEN_E_INVALID_COMMAND = -8, - EDEN_E_INVALID_ENUM = -9, - EDEN_E_THREADS = -10, - EDEN_E_FILE_NOT_FOUND = -11, - EDEN_E_LENGTH_UNAVAILABLE = -12, - EDEN_E_GENERIC_TOOLBOX = -10001, - EDEN_E_LIBRARY_NOT_AVAILABLE = -10002, - EDEN_E_LIBRARY_TOO_OLD = -10003, - EDEN_E_LIBRARY_TOO_NEW = -10004, - EDEN_E_HARDWARE_GENERIC = -11001, - EDEN_E_HARDWARE_NOT_AVAILABLE = -11002, - EDEN_E_BIRD_CONFIGURATION = -11202, - EDEN_E_BIRD_PHASEERROR = -11203, - EDEN_E_NET_GENERIC = -12001, - EDEN_E_NET_NOT_AVAILABLE = -12002, - EDEN_E_NET_NOT_CONNECTED = -12003, -}; - -// ============================================================================ -// Public types. -// ============================================================================ -/*! - @typedef EDEN_E_t - @abstract Return type of routines in the Eden Library. - @discussion - Zero and positive values are used to report success, and possibly, return data. - An error is indicated by a value less than zero. Symbolic values for the error - codes are available. -*/ -typedef signed int EDEN_E_t; - -// ============================================================================ -// Public globals. -// ============================================================================ - -// ============================================================================ -// Public functions. -// ============================================================================ - -/*! - @function - @abstract Produce an error string from an Eden Library error code. - @discussion - Produces a null-terminated ASCII string with a description of the error - represented by the supplied code, followed by the code itself, in brackets. - See also EdenError_strerror_r, EdenError_perror. - @param code The code to produce the string for, as returned by various routines - in the Eden Library. - @result Pointer to a null-terminated constant character string. - @seealso EdenError_strerror_r EdenError_strerror_r - */ -const char *EdenError_strerror(const EDEN_E_t code); - -/*! - @function - @abstract Produce an error string from an Eden Library error code. - @discussion - Produces an ASCII string with a description of the error - corresponding to the supplied code, and copies up to buflen - characters of the string into strerrbuf - See also EdenError_strerror, EdenError_perror. - @param code The code to produce the string for, as returned by various routines - in the Eden Library. - @param strerrbuf Buffer to copy the error string into. - @param buflen Number of characters available in strerrbuf. The null - terminator counts as one character. - @result - Returns 0 on success. - If the error number is not recognized, returns EINVAL as a warning. - If insufficient storage is provided in strerrbuf (as specified in buflen) - to contain the error string, returns ERANGE and strerrbuf - will contain an error message that has been truncated and NUL terminated - to fit the length specified by buflen. - @seealso EdenError_strerror EdenError_strerror - */ -int EdenError_strerror_r(const EDEN_E_t code, char *strerrbuf, const size_t buflen); - -/*! - @function - @abstract Print an Eden Library error message and code to stderr, with optional string. - @discussion - Finds the error message corresponding to the supplied code, - and writes it, followed by a newline, to the standard error file - descriptor. If the argument string is non-NULL and does not point - to the null character, this string is prepended to the message string - and separated from it by a colon and space (": "); otherwise, only - the error message string is printed. - @param code The code to produce the string for, as returned by various routines - in the Eden Library. - @seealso EdenError_strerror EdenError_strerror - @seealso EdenError_strerror_r EdenError_strerror_r - */ -void EdenError_perror(const EDEN_E_t code, const char *string); - -#ifdef __cplusplus -} -#endif - -#endif // !__EdenError_h__ - diff --git a/include/Eden/EdenGLFont.h b/include/Eden/EdenGLFont.h deleted file mode 100644 index e659187..0000000 --- a/include/Eden/EdenGLFont.h +++ /dev/null @@ -1,443 +0,0 @@ -// -// EdenGLFont.h -// The Eden Library -// -// Copyright (c) 2001-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// Some portions of font loading code based on code by Jeff Molofee, 1999, http://nehe.gamedev.net/ -// -// Rev Date Who Changes -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// HeaderDoc documentation included. See http://developer.apple.com/darwin/projects/headerdoc/ - -/*! - @header EdenGLFont - @abstract Handle font-related operations under OpenGL. - @version 1.0.0 - @updated 2013-11-12 - @discussion - @copyright 2001-2013 Philip Lamb - */ - - -#ifndef __EdenGLFont_h__ -#define __EdenGLFont_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -// ============================================================================ -// Includes. -// ============================================================================ -#ifndef __Eden_h__ -# include -#endif - -#include // EDEN_E_t - -// ============================================================================ -// Defines and types. -// ============================================================================ - -typedef struct _EDEN_GL_FONT_INFO_t EDEN_GL_FONT_INFO_t; - -extern EDEN_GL_FONT_INFO_t *const EDEN_GL_FONT_ID_Stroke_Roman; -extern EDEN_GL_FONT_INFO_t *const EDEN_GL_FONT_ID_Stroke_MonoRoman; -extern EDEN_GL_FONT_INFO_t *const EDEN_GL_FONT_ID_Bitmap16_Geneva; -extern EDEN_GL_FONT_INFO_t *const EDEN_GL_FONT_ID_Bitmap16_OCR_B_10; - -typedef enum { - H_OFFSET_VIEW_LEFT_EDGE_TO_TEXT_LEFT_EDGE, - H_OFFSET_TEXT_RIGHT_EDGE_TO_VIEW_RIGHT_EDGE, - H_OFFSET_VIEW_CENTER_TO_TEXT_CENTER -} H_OFFSET_TYPE; - -typedef enum { - V_OFFSET_VIEW_TEXT_TOP_TO_VIEW_TOP, - V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE, - V_OFFSET_VIEW_CENTER_TO_TEXT_CENTER -} V_OFFSET_TYPE; - -// ============================================================================ -// Functions. -// ============================================================================ - -/*! - @function - @abstract Initialise the font library. - @discussion - Must be called before any access to EdenGLFont*() functions. - @param contextsActiveCount Maximum number of OpenGL contexts. - @result TRUE if succcessful, FALSE in case of error. -*/ -EDEN_BOOL EdenGLFontInit(const int contextsActiveCount); - -/*! - @function - @abstract Finalise the font library. - @discussion - Should be called after no more EdenGLFont*() functions need be called. - @result TRUE if succcessful, FALSE in case of error. -*/ -EDEN_BOOL EdenGLFontFinal(void); - -/*! - @function - @abstract Create a texture font for later use. - @discussion - Creates font info required to use the font contained in the texture file - named at pathname. - - Each character in the texture occupies 16 pixels x 16 pixels. Its width - and height should be stretched to 16 even if this introduces perspective - distortion- this will guarantee the best onscreen resolution. - Each character from the font will be scaled to naturalWidth pixels wide, - naturalHeight pixels tall. - - Note that this function does not load the actual texture resources into - OpenGL and does not require a valid OpenGL context. OpenGL resource - loading is achieved by calling EdenGLFontLoadTextureFontForContext(). - @param fontName A short descriptive name for the font, suitable for presentation to a user, e.g. in a font menu. - @param naturalHeight The height in pixels at which each character, drawn unscaled, will occupy. - @param naturalWidth The width in pixels at which each character, drawn unscaled, will occupy. - @param pathname Pathname (absolute, or relative to current working directory) to font texture file. - @result Pointer to a EDEN_GL_FONT_INFO_t opaque structure. This pointer can be used with other - EdenGLFont functions just as if it was a built-in font. - @seealso EdenGLFontDeleteTextureFont EdenGLFontDeleteTextureFont - @seealso EdenGLFontLoadTextureFontForContext EdenGLFontLoadTextureFontForContext -*/ -EDEN_GL_FONT_INFO_t *EdenGLFontNewTextureFont(const char *fontName, const char *pathname, const float naturalHeight, const float naturalWidth); - -/*! - @function - @abstract Delete a previously created texture font. - @discussion (description) - @param fontInfo_p Pointer to a pointer to EDEN_GL_FONT_INFO_t opaque structure - previously returned from EdenGLFontLoadBitmapFont(). On return, the location - pointed to will be set to NULL. - - Note that this function does not unload the actual texture resources from - OpenGL and does not require a valid OpenGL context. OpenGL resource - loading is achieved by calling EdenGLFontLoadTextureFontForContext() PRIOR - to calling this function. - @seealso EdenGLFontNewTextureFont EdenGLFontNewTextureFont - @seealso EdenGLFontUnloadTextureFontForContext EdenGLFontUnloadTextureFontForContext -*/ -void EdenGLFontDeleteTextureFont(EDEN_GL_FONT_INFO_t **fontInfo_p); - -/*! - @function - @abstract Set the font to be used for subsequent draw calls. - @discussion - Drawing by default uses the font EDEN_GL_FONT_ID_Stroke_MonoRoman. - This function changes the font for subsequent drawing calls. - @param font Pointer to a EDEN_GL_FONT_INFO_t opaque structure, either for one - of the built-in fonts, or previously returned from EdenGLFontNewTextureFont() - @seealso EdenGLFontNewTextureFont EdenGLFontNewTextureFont - @seealso EdenGLFontLoadTextureFontForContext EdenGLFontLoadTextureFontForContext - */ -void EdenGLFontSetFont(EDEN_GL_FONT_INFO_t *font); - -/*! - @function - @abstract Get the font to be used for subsequent draw calls. - @discussion - @result Pointer to a EDEN_GL_FONT_INFO_t opaque structure, either for one - of the built-in fonts, or previously returned from EdenGLFontNewTextureFont() - */ -EDEN_GL_FONT_INFO_t * EdenGLFontGetFont(void); - -/*! - @function - @abstract Set the font size. - @discussion - @param points Font size in points. Default is 16 point. - */ -void EdenGLFontSetSize(const float points); - -/*! - @function - @abstract Get the currently set font size. - @discussion - @result Font size in points. Default is 16 point. - */ -float EdenGLFontGetSize(void); - -/*! - @function - @abstract Set character spacing (i.e. "kerning"). - @discussion - Character spacing is the spacing between the edges of adjacent characters. - @param spacing Spacing expressed as a percentage of the font size. Default is 0.0625f (i.e. 1/16). - */ -void EdenGLFontSetCharacterSpacing(const float spacing); - -/*! - @function - @abstract Get character spacing (i.e. "kerning"). - @discussion - Character spacing is the spacing between the edges of adjacent characters. - @result Spacing expressed as a percentage of the font size. Default is 0.0625f (i.e. 1/16). - */ -float EdenGLFontGetCharacterSpacing(void); - -/*! - @function - @abstract Set line spacing (i.e. "leading"). - @discussion - Default is to 1.125f (i.e. 9/8). - @param spacing Line spacing. - */ -void EdenGLFontSetLineSpacing(const float spacing); - -/*! - @function - @abstract Get line spacing (i.e. "leading"). - @discussion - Default is to 1.125f (i.e. 9/8). - @result Line spacing. - */ -float EdenGLFontGetLineSpacing(void); - -/*! - @function - @abstract Set word spacing (i.e. adjust width of the space character). - @discussion - Word spacing is the spacing between adjacent words. - - This adjustment applies only to non-monospaced fonts. - @param spacing Spacing expressed as a percentage of the normal width of the space character size. Default is 1.0. - */ -void EdenGLFontSetWordSpacing(const float spacing); - -/*! - @function - @abstract Get word spacing (i.e. adjust width of the space character). - @discussion - Word spacing is the spacing between adjacent words. - - This adjustment applies only to non-monospaced fonts. - @result pacing expressed as a percentage of the normal width of the space character size. Default is 1.0. - */ -float EdenGLFontGetWordSpacing(void); - -/*! - @function - @abstract Set set display resolution. - @discussion - The display resolition is used to calculate font heights in pixels. - Default is 72.0f, at which a 16-point font will occupy 16 pixels. - @param pixelsPerInch Display resolution, in pixels per inch. - */ -void EdenGLFontSetDisplayResolution(const float pixelsPerInch); // Pixels per inch. Used to calculate font heights in pixels. Default is 72.0f, at which a 16-point font will occupy 16 pixels. - -/*! - @function - @abstract Get previously set display resolution. - @discussion - The display resolition is used to calculate font heights in pixels. - Default is 72.0f, at which a 16-point font will occupy 16 pixels. - @result Previously set display resolution, in pixels per inch. - */ -float EdenGLFontGetDisplayResolution(void); // Pixels per inch. - -/*! - @function - @abstract Tell the font library about the view size. - @discussion - Normally, this will be called during the windowing system's reshape callback. - @param widthInPixels Width of the view, in pixels. - @param heightInPixels Height of the view, in pixels. -*/ -void EdenGLFontSetViewSize(const float widthInPixels, const float heightInPixels); - -/*! - @function - @abstract Gets the height (in pixels) of the currently selected font. - @discussion - Takes into account font size (in points) and display resolution (in pixels per inch). - @result Height in pixels. - */ -float EdenGLFontGetHeight(void); - -/*! - @function - @abstract Gets the width (in pixels) of a chracter of the currently selected font. - @discussion - Takes into account font size (in points) and display resolution (in pixels per inch). - Does not include any inter-character spacing. - @param c ASCII character code of the character. For texture fonts, the full 8 buts of c are considered. - @result Width in pixels. - */ -float EdenGLFontGetCharacterWidth(const unsigned char c); - -/*! - @function - @abstract Gets the width (in pixels) of a line of characters of the currently selected font. - @discussion - Takes into account font size (in points) and display resolution (in pixels per inch). - Includes inter-character spacing. - @param line A null-terminated (C string) of the characters to measure. - @result Width in pixels. - */ -float EdenGLFontGetLineWidth(const unsigned char *line); - -/*! - @function - @abstract Calculate the width of a block of text (i.e. the width of the widest line) in pixels. - @discussion - Includes inter-character spacing. - @param lines An array of C strings (i.e. an array of (char *)). Each item in the array points to a null-terminated C string. - @param lineCount Number of strings in array 'lines'. - @result Width in pixels. - */ -float EdenGLFontGetBlockWidth(const unsigned char **lines, const unsigned int lineCount); // Returns width in pixels, taking into account font, font size, display resolution, and character spacing. - -/*! - @function - @abstract Calculate the height of a block of text in pixels. - @discussion - Includes effects of line spacing greater than 1.0. - @param lines An array of C strings (i.e. an array of (char *)). Each item in the array points to a null-terminated C string. - @param lineCount Number of strings in array 'lines'. - @result Height in pixels. - */ -float EdenGLFontGetBlockHeight(const unsigned char **lines, const unsigned int lineCount); // Returns height in pixels, taking into account font, font size, display resolution, and line spacing. - -/*! - @function - @abstract - @discussion - Requires a valid OpenGL context at the time of the call. - Make sure EdenSurfacesInit() has been previously called with a valid number of contexts. - @param contextIndex - @param fontInfo - @result - */ -EDEN_BOOL EdenGLFontLoadTextureFontForContext(const int contextIndex, EDEN_GL_FONT_INFO_t *fontInfo); - -/*! - @function - @abstract - @discussion - Requires a valid OpenGL context at the time of the call. - @param contextIndex - @param fontInfo - @result - */ -EDEN_BOOL EdenGLFontUnloadTextureFontForContext(const int contextIndex, EDEN_GL_FONT_INFO_t *fontInfo); - -/*! - @function - @abstract Draw a single line of text into the framebuffer. - @discussion - Should be called once per frame, generally after all other drawing is complete. - Requires a valid OpenGL context at the time of the call. - - Drawing functions respect current projection and modelview matrices, - and depth mode and lighting/color settings, and these are unmodified on return. - Typically however, the aim is to draw window-aligned text, and this function - should be called with the projection matrix set to a 2D orthographic projection - in window coordinates and with the modelview matrix set to identity, i.e. -
-        glMatrixMode(GL_PROJECTION);
-        glOrtho(0.0, windowWidth, 0.0, windowHeight, -1.0, 1.0);
-        glMatrixMode(GL_MODELVIEW);
-        glLoadIdentity();
-        
- - Texture font use modifies blend settings, texturing enable settings, - and vertex, texture coordinate pointers, and enabled client state of vertex, texture - and normal arrays. It also leaves texture matrix indeterminate on return. - @param contextIndex (description) - @param line null-terminated string of characters to draw. - @param hOffset Horizontal offset (in OpenGL coordinates) between the reference points - specified in hOffsetType. - - E.g. when hOffsetType = H_OFFSET_VIEW_LEFT_EDGE_TO_TEXT_LEFT_EDGE, passing 0.0f - will place the text against the left-hand edge of the window. - @param vOffset Vertical offset (in OpenGL coordinates) between the reference points - specified in vOffsetType. - - E.g. when vOffsetType = V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE, passing 0.0f - will place the text against the bottom edge of the window. - @param hOffsetType Specifies left, centered, or right alignment horizontal alignment. - @param vOffsetType Specifies top, centered, or bottom alignment vertical alignment. -*/ -void EdenGLFontDrawLine(const int contextIndex, const unsigned char *line, const float hOffset, const float vOffset, H_OFFSET_TYPE hOffsetType, V_OFFSET_TYPE vOffsetType); - -/*! - @function - @abstract Draw a block of multiple lines of text into the framebuffer. - @discussion - Should be called once per frame, generally after all other drawing is complete. - Requires a valid OpenGL context at the time of the call. - - Drawing functions respect current projection and modelview matrices, - and depth mode and lighting/color settings, and these are unmodified on return. - Typically however, the aim is to draw window-aligned text, and this function - should be called with the projection matrix set to a 2D orthographic projection - in window coordinates and with the modelview matrix set to identity, i.e. -
-        glMatrixMode(GL_PROJECTION);
-        glOrtho(0.0, windowWidth, 0.0, windowHeight, -1.0, 1.0);
-        glMatrixMode(GL_MODELVIEW);
-        glLoadIdentity();
-        
- - Texture font use modifies blend settings, texturing enable settings, - and vertex, texture coordinate pointers, and enabled client state of vertex, texture - and normal arrays. It also leaves texture matrix indeterminate on return. - @param contextIndex (description) - @param lines Array of null-terminated string of characters to draw. - @param lineCount Number of strings in array 'lines'. - @param hOffset Horizontal offset (in OpenGL coordinates) between the reference points - specified in hOffsetType. - - E.g. when hOffsetType = H_OFFSET_VIEW_LEFT_EDGE_TO_TEXT_LEFT_EDGE, passing 0.0f - will place the text against the left-hand edge of the window. - @param vOffset Vertical offset (in OpenGL coordinates) between the reference points - specified in vOffsetType. - - E.g. when vOffsetType = V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE, passing 0.0f - will place the text against the bottom edge of the window. - @param hOffsetType Specifies left, centered, or right alignment horizontal alignment. - @param vOffsetType Specifies top, centered, or bottom alignment vertical alignment. -*/ -void EdenGLFontDrawBlock(const int contextIndex, const unsigned char **lines, const unsigned int lineCount, const float hOffset, const float vOffset, H_OFFSET_TYPE hOffsetType, V_OFFSET_TYPE vOffsetType); - -#ifdef __cplusplus -} -#endif -#endif // !__EdenGLFont_h__ diff --git a/include/Eden/EdenMath.h b/include/Eden/EdenMath.h deleted file mode 100644 index 527dad4..0000000 --- a/include/Eden/EdenMath.h +++ /dev/null @@ -1,577 +0,0 @@ -/* - * EdenMath.h - * The Eden Library - * - * Copyright (c) 2001-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. - * - * Rev Date Who Changes - * 1.0.0 2001-07-28 PRL Initial version. - * - */ - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -/*! - @header EdenMath - @abstract Math utilities. - @discussion - EdenMath forms one part of the Eden library. - @copyright 2001-2013 Philip Lamb - */ - -#ifndef __EdenMath_h__ -#define __EdenMath_h__ - -// ============================================================================ -// Public includes -// ============================================================================ -#ifndef __Eden_h__ -# include -#endif - -#if defined(_WIN32) && !defined(_USE_MATH_DEFINES) -# define _USE_MATH_DEFINES // Make Win32 math.h define M_... constants. -#endif -#include - -// Fixes for missing floating point function declarations in Win32 ISO C. -#if defined(_WIN32) && defined(_MSC_VER) && !defined(__cplusplus) && _MSC_VER < 1600 -# define sinf(x) sin(x) -# define cosf(x) cos(x) -# define tanf(x) tan(x) -# define asinf(x) asin(x) -# define acosf(x) acos(x) -# define atanf(x) atan(x) -# define atan2f(y,x) atan2(y,x) -# define sinhf(x) sinh(x) -# define coshf(x) cosh(x) -# define tanhf(x) tanh(x) -# define expf(x) exp(x) -# define logf(x) log(x) -# define log10f(x) log10(x) -# define modff(x,ip) modf(x,ip) -# define powf(x,y) pow(x,y) -# define sqrtf(x) sqrtf(x) -# define ceilf(x) ceil(x) -# define fabsf(x) fabs(x) -# define floorf(x) floor(x) -# define fmodf(x,y) fmod(x,y) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// ============================================================================ -// Defines -// ============================================================================ - -#ifndef M_PI -/*! - @defined M_PI - @abstract Value of PI. - @discussion - Defined only if not already defined in math.h. -*/ -#define M_PI 3.141592653589793238462643 -#endif - -/*! - @defined PI - @abstract Value of PI. -*/ -#define PI M_PI - -/*! - @defined TWOPI - @abstract (description) - @discussion (description) -*/ -#define TWOPI (2*M_PI) - -/*! - @defined HALFPI - @abstract (description) - @discussion (description) -*/ -#define HALFPI (0.5*M_PI) - -/*! - @defined DTOR - @abstract Convert degrees to radians. - @discussion - Multiply an angle in degrees by this constant to - get the value of the angle in radians. -*/ -#define DTOR 0.0174532925 - -/*! - @defined RTOD - @abstract Convert radians to degrees. - @discussion - Multiply an angle in radians by this constant to - get the value of the angle in degrees. -*/ -#define RTOD 57.2957795 - -/*! - @defined MIN - @abstract Determine minimum of two values. -*/ -#ifndef MIN -#define MIN(x,y) (x < y ? x : y) -#endif - -/*! - @defined MAX - @abstract Determine maximum of two values. -*/ -#ifndef MAX -#define MAX(x,y) (x > y ? x : y) -#endif - -/*! - @defined CROSS - @abstract Vector cross-product in R3. - @discussion - 6 multiplies + 3 subtracts. - Vector cross product calculates a vector with direction - orthogonal to plane formed by the other two vectors, and length - equal to the area of the parallelogram formed by the other two - vectors. - Right hand rule for vector cross products: Point thumb of right - hand in direction of v1, fingers together in direction of v2, - then palm faces in the direction of dest. - */ -#define CROSS(dest,v1,v2) {dest[0] = v1[1]*v2[2] - v1[2]*v2[1]; dest[1] = v1[2]*v2[0] - v1[0]*v2[2]; dest[2] = v1[0]*v2[1] - v1[1]*v2[0];} - -/*! - @defined LENGTH - @abstract (description) - @discussion (description) -*/ -#define LENGTH(v) (sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2])) - -/*! - @defined DOT - @abstract Vector dot-product in R3. - @discussion - 3 multiplies + 2 adds. -*/ -#define DOT(v1,v2) ((v1[0]*v2[0]) + (v1[1]*v2[1]) + (v1[2]*v2[2])) - -/*! - @defined ADD - @abstract (description) - @discussion (description) -*/ -#define ADD(dest,v1,v2) {dest[0] = v1[0] + v2[0]; dest[1] = v1[1] + v2[1]; dest[2] = v1[2] + v2[2];} - -/*! - @defined SUB - @abstract (description) - @discussion (description) -*/ -#define SUB(dest,v1,v2) {dest[0] = v1[0] - v2[0]; dest[1] = v1[1] - v2[1]; dest[2] = v1[2] - v2[2];} - -/*! - @defined AVERAGE - @abstract (description) - @discussion (description) - */ -#define AVERAGE(dest,v1,v2) {dest[0] = (v1[0] + v2[0])*0.5; dest[1] = (v1[1] + v2[1])*0.5; dest[2] = (v1[2] + v2[2])*0.5;} - -/*! - @defined COPY - @abstract (description) - @discussion (description) - */ -#define COPY(dest, v) {dest[0] = v[0]; dest[1] = v[1]; dest[2] = v[2];} - -// ============================================================================ -// Public functions -// ============================================================================ - -/*! - @function - @abstract Normalise a vector. - @discussion - @param v Vector to normalise. -*/ -float EdenMathNormalise(float v[3]); - -/*! - @function - @abstract Normalise a vector. - @discussion - @param v Vector to normalise. -*/ -double EdenMathNormalised(double v[3]); - -/*! - @function - @abstract Calculates the Hessian normal (unit normal vector) to a plane. - @discussion - The plane is specified by three vectors which are points on the plane. - - The normal calculated is of unit length (i.e. it is the Hessian normal). - - See http://mathworld.wolfram.com/HessianNormalForm.html - @param n Vector representing Hessian normal (unit normal vector) to plane. - @param p Value of distance of plane from origin. - The sign of *p determines the side of the plane on which the origin is located. - If > 0, it is in the half-space determined by the direction of n, and if < 0, - it is in the other half-space. - @param p1 Vector describing point on the plane. - @param p2 Vector describing point on the plane. - @param p3 Vector describing point on the plane. -*/ -void EdenMathPointsToPlaneHessianNormal(float n[3], float *p, const float p1[3], const float p2[3], const float p3[3]); - -/*! - @function - @abstract Calculate the general form of a plane, given three points lying on the plane. - @discussion - The general form of a plane is the equation Ax + By + Cz + D = 0. - The plane is specified by three vectors which are points on the plane. - The vector ABC is normal to the plane (not unit normal though). - - See http://mathworld.wolfram.com/Plane.html - @param abc Vector describing the plane. - @param d Value describing the plane. - @param p1 Vector describing point on the plane. - @param p2 Vector describing point on the plane. - @param p3 Vector describing point on the plane. -*/ -void EdenMathPointsToPlane(float abc[3], float *d, const float p1[3], const float p2[3], const float p3[3]); - -/*! - @function - @abstract Calculate the point of intersection (if any) between a line and a plane. - @discussion - See http://mathworld.wolfram.com/Plane.html - @param intersection Pointer to an array of 3 floats which will be - filled out with the coordinates of the point of intersection. - @param u_out If non-null, the float pointed to will be filled out with - the value 'u', representing the point of intersection, relative to the - line segement between p1 and p2. I.e., when u is 0, the intersection is - at p1, and when u is 1 the intersection is at p2. Values of u < 0 or > 1 - indicate the intersection point is outside the line segment (but there IS - still an intersection point). NULL may be passed if you are not interested - in this value. - @param p1 A point lying on the line. - @param p2 Another point lying on the line. - @param abc The vector of values A, B, and C from the general definition of a plane - Ax + By + Cz + D = 0 (see EdenMathPointsToPlane()). - @param abc The value D from the general definition of a plane - Ax + By + Cz + D = 0 (see EdenMathPointsToPlane()). - @result FALSE if the normal to the plane is perpendicular to the line, or - if a required value was not specified, TRUE otherwise. -*/ -EDEN_BOOL EdenMathIntersectionLinePlane(float intersection[3], float *u_out, const float p1[3], const float p2[3], const float abc[3], const float d); - -/*! - @function - @abstract Caclulate signed distance from point to a plane. - @discussion - See http://mathworld.wolfram.com/Point-PlaneDistance.html - @param x0 Position of the point. - @param abc The vector of values A, B, and C from the general definition of a plane - Ax + By + Cz + D = 0 (see EdenMathPointsToPlane()). - @param abc The value D from the general definition of a plane - Ax + By + Cz + D = 0 (see EdenMathPointsToPlane()). - @result The distance from the point to the plane, which is positive if the - point lies on the same side of the plane as the normal to the plane, or - negative if it lies on the opposite side, or 0 if the parameters are invalid. - */ -float EdenMathCalcDistanceToPlane(const float x0[3], const float abc[3], const float d); - -/*! - @function - @abstract Creates a 3x3 identity matrix. - @discussion - @param mtx9 A 3x3 matrix that will receive the output. - */ -void EdenMathIdentityMatrix3by3(float mtx9[9]); - -/*! - @function - @abstract Multiplies 3x3 matrix B into 3x3 matrix A, placing result in C. - @discussion - A, B and C are in column-major form, which is standard for OpenGL - (wheras the usual mathematical matrix notation is row-major.) -*/ -void EdenMathMultMatrix3by3(float C[9], const float B[9], const float A[9]); - -/*! - @function - @abstract Invert a 3x3 matrix A, placing result in Ainv. - @discussion - A and Ainv are in column-major form, which is standard for OpenGL - (wheras the usual mathematical matrix notation is row-major.) -*/ -EDEN_BOOL EdenMathInvertMatrix3by3(float A[9], float Ainv[9]); - -/*! - @function - @abstract Creates a 4x4 identity matrix. - @discussion - @param mtx16 A 4x4 matrix that will receive the output. -*/ -void EdenMathIdentityMatrix(float mtx16[16]); - -/*! - @function - @abstract Multiplies 4x4 matrix B into 4x4 matrix A, placing result in C. - @discussion - A, B and C are in column-major form, which is standard for OpenGL - (wheras the usual mathematical matrix notation is row-major.) -*/ -void EdenMathMultMatrix(float C[16], const float B[16], const float A[16]); - -/*! - @function - @abstract Multiplies 4x4 matrix B into 4x4 matrix A, placing result in C. - @discussion - A, B and C are in column-major form, which is standard for OpenGL - (wheras the usual mathematical matrix notation is row-major.) - */ -void EdenMathMultMatrixd(double C[16], const double B[16], const double A[16]); - -/*! - @function - @abstract Compute inverse of 4x4 transformation matrix - @discussion Code contributed by Jacques Leroy jle\@star.be - @param m Input, 4x4 column-major matrix. - @param out Output, 4x4 column-major matrix. - @result Return TRUE for success, FALSE for failure (singular matrix) -*/ -EDEN_BOOL EdenMathInvertMatrix(float out[16], const float m[16]); - -/*! - @function - @abstract Compute inverse of 4x4 transformation matrix - @discussion Code contributed by Jacques Leroy jle\@star.be - @param m Input, 4x4 column-major matrix. - @param out Output, 4x4 column-major matrix. - @result Return TRUE for success, FALSE for failure (singular matrix) -*/ -EDEN_BOOL EdenMathInvertMatrixd(double out[16], const double m[16]); - -/*! - @function - @abstract Multiples 4x4 matrix A into column vector p, placing result in q. - @discussion - A is in column-major form, which is standard for OpenGL - (wheras the usual mathematical matrix notation is row-major.) -*/ -void EdenMathMultMatrixByVector(float q[4], const float A[16], const float p[4]); - -/*! - @function - @abstract Multiples 4x4 matrix A into column vector p, placing result in q. - @discussion - A is in column-major form, which is standard for OpenGL - (wheras the usual mathematical matrix notation is row-major.) -*/ -void EdenMathMultMatrixByVectord(double q[4], const double A[16], const double p[4]); - -/*! - @function - @abstract Creates a matrix which represents translation by a vector. - @discussion - @param mtx16 A 4x4 matrix that will receive the output in column major form. - @param x X component of the translation vector. - @param y Y component of the translation vector. - @param z Z component of the translation vector. -*/ -void EdenMathTranslationMatrix(float mtx16[16], const float x, const float y, const float z); - -/*! - @function - @abstract Translate a matrix by a vector. - @discussion - @param B A 4x4 matrix that will receive the output in column major form. - @param A A 4x4 matrix that will supply the input in column major form. - @param x X component of the translation vector. - @param y Y component of the translation vector. - @param z Z component of the translation vector. -*/ -void EdenMathTranslateMatrix(float B[16], const float A[16], const float x, const float y, const float z); - -/*! - @function - @abstract Creates a matrix which represents the general case of a rotation about an arbitrary axis. - @discussion - @param mtx16 A 4x4 matrix that will receive the output in column major form. - @param q The angle of rotation measured in a right-hand sense, in radians. - @param x X component of the normalised non-zero vector representing the axis of rotation. - @param y Y component of the normalised non-zero vector representing the axis of rotation. - @param z Z component of the normalised non-zero vector representing the axis of rotation. -*/ -void EdenMathRotationMatrix(float mtx16[16], const float q, const float x, const float y, const float z); - -/*! - @function - @abstract Rotate a matrix about an arbitrary axis. - @discussion (description) - @param B A 4x4 matrix that will receive the output in column major form. - @param A A 4x4 matrix that will supply the input in column major form. - @param q The angle of rotation measured in a right-hand sense, in radians. - @param x X component of the normalised non-zero vector representing the axis of rotation. - @param y Y component of the normalised non-zero vector representing the axis of rotation. - @param z Z component of the normalised non-zero vector representing the axis of rotation. - */ -void EdenMathRotateMatrix(float B[16], const float A[16], const float q, const float x, const float y, const float z); - -void EdenMathScalingMatrix(float mtx16[16], const float x, const float y, const float z); - -void EdenMathScaleMatrix(float B[16], const float A[16], const float x, const float y, const float z); - -/*! - @function - @abstract Creates a rotation matrix that rotates a vector called - "from" into another vector called "to". - @discussion - Author: Tomas Moller, 1999 - @param from Normalised non-zero vector. - @param to Normalised non-zero vector. - @param mtx9 A 3x3 matrix in column-major form which receives the result. -*/ -void EdenMathRotationMatrixFromTo(const float from[3], const float to[3], float mtx9[9]); - -/*! - @function - @abstract Rotate a point about an arbitrary axis. - @discussion - @param p2 Rotated point. - @param p1 Point to rotate. - @param q The angle of rotation measured in a right-hand sense, in radians. - @param a Normalised non-zero vector representing the axis of rotation. - */ -void EdenMathRotatePointAboutAxis(float p2[3], const float p1[3], const float q, const float a[3]); - -/*! - @function - @abstract Rotate a point about an arbitrary axis. - @discussion - @param p2 Rotated point. - @param p1 Point to rotate. - @param q The angle of rotation measured in a right-hand sense, in radians. - @param a Normalised non-zero vector representing the axis of rotation. -*/ -void EdenMathRotatePointAboutAxisd(double p2[3], const double p1[3], const double q, const double a[3]); - -#ifdef __ppc__ -/*! - @function - @abstract Fast calculation of square root. - @discussion - Uses a ppc-only instruction to get an estimate of the - square root, then performs 4 iterations of - Newton-Rhapson refinement to give better precision. - Note: these functions are not IEEE-754 compliant and do not calculate - the last bit correctly. For correct accuary, refer to libm on MacOS X. - Written by A. Sazegari, started on February 2002. - Copyright 2002 Apple Computer, Inc. All rights reserved. - @param arg Pointer to double-precision floating point number. - Will be replaced with the root of the number. - (*arg = (*arg)^0.5). - @availability Available on PowerPC CPUs only. -*/ -void fsqrt(double *arg); - -/*! - @function - @abstract Fast calculation of three square roots. - @discussion - Uses a ppc-only instruction to get an estimate of the - square root, then performs 4 iterations of - Newton-Rhapson refinement to give better precision. - Note: these functions are not IEEE-754 compliant and do not calculate - the last bit correctly. For correct accuary, refer to libm on MacOS X. - Written by A. Sazegari, started on February 2002. - Copyright 2002 Apple Computer, Inc. All rights reserved. - @param arg1 Pointer to double-precision floating point number. - Will be replaced with the root of the number. - @param arg2 Pointer to double-precision floating point number. - Will be replaced with the root of the number. - @param arg3 Pointer to double-precision floating point number. - Will be replaced with the root of the number. - @availability Available on PowerPC CPUs only. - */ -void fsqrt3(double *arg1, double *arg2, double *arg3); - -/*! - @function - @abstract Fast calculation of reciprocal square root. - @discussion - Uses a ppc-only instruction to get an estimate of the - reciprocal square root, then performs 4 iterations of - Newton-Rhapson refinement to give better precision. - Note: these functions are not IEEE-754 compliant and do not calculate - the last bit correctly. For correct accuary, refer to libm on MacOS X. - Written by A. Sazegari, started on February 2002. - Copyright 2002 Apple Computer, Inc. All rights reserved. - @param arg Pointer to double-precision floating point number. - Will be replaced with the reciprocal of the root of the number. - (*arg = (*arg)^-0.5). - @availability Available on PowerPC CPUs only. -*/ -void frsqrt(double *arg); - -/*! - @function - @abstract Fast calculation of three reciprocal square roots. - @discussion - Uses a ppc-only instruction to get an estimate of the - reciprocal square root, then performs 4 iterations of - Newton-Rhapson refinement to give better precision. - Note: these functions are not IEEE-754 compliant and do not calculate - the last bit correctly. For correct accuary, refer to libm on MacOS X. - Written by A. Sazegari, started on February 2002. - Copyright 2002 Apple Computer, Inc. All rights reserved. - @param arg1 Pointer to double-precision floating point number. - Will be replaced with the reciprocal of the root of the number. - @param arg2 Pointer to double-precision floating point number. - Will be replaced with the reciprocal of the root of the number. - @param arg3 Pointer to double-precision floating point number. - Will be replaced with the reciprocal of the root of the number. - @availability Available on PowerPC CPUs only. -*/ -void frsqrt3(double *arg1, double *arg2, double *arg3); -#endif // __ppc__ - -#ifdef __cplusplus -} -#endif - -#endif /* !__EdenMath_h__ */ diff --git a/include/Eden/EdenMessage.h b/include/Eden/EdenMessage.h deleted file mode 100644 index 9c1c225..0000000 --- a/include/Eden/EdenMessage.h +++ /dev/null @@ -1,283 +0,0 @@ -// -// EdenMessage.h -// The Eden Library -// -// Copyright (c) 2001-2012 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// Font loading code based on code by Jeff Molofee, 1999, http://nehe.gamedev.net/ -// -// Rev Date Who Changes -// 1.0.0 2001-12-04 PRL Initial version for The SRMS simulator. -// 1.0.1 2005-09-28 PRL Added headerDoc. -// 1.1.0 2013-02-19 PRL Quick update for OpenGL ES. -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// HeaderDoc documentation included. See http://developer.apple.com/darwin/projects/headerdoc/ - -/*! - @header EdenMessage - @abstract Send messages and show text-input dialog boxes on the screen. - @version 1.0.0 - @updated 2013-11-12 - @discussion - @copyright 2001-2013 Philip Lamb - */ - -#ifndef __EdenMessage_h__ -#define __EdenMessage_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -// ============================================================================ -// Includes. -// ============================================================================ -#ifndef __Eden_h__ -# include -#endif - -#include // EDEN_E_t - -// ============================================================================ -// Defines and types. -// ============================================================================ - -// ============================================================================ -// Global variables. -// ============================================================================ - -// When set to TRUE, signals that EdenMessageDraw() should be called each drawing frame. -extern EDEN_BOOL gEdenMessageDrawRequired; - -// When set to TRUE, signals that keycodes should be sent to EdenMessageInputKeyboard() -extern EDEN_BOOL gEdenMessageKeyboardRequired; - -// ============================================================================ -// Public functions -// ============================================================================ - -/*! - @function - @abstract Initialise the message library. - @discussion - Must be called before any access to EdenMessage*() functions. - @param contextsActiveCount Maximum number of OpenGL contexts. - @result TRUE if succcessful, FALSE in case of error. -*/ -EDEN_BOOL EdenMessageInit(const int contextsActiveCount); - -/*! - @function - @abstract Finalise the message library. - @discussion (description) - Should be called after no more EdenMessage*() functions need be called. - @result TRUE if succcessful, FALSE in case of error. -*/ -EDEN_BOOL EdenMessageFinal(void); - -/*! - @function - @abstract Prepare a message for drawing on the screen. - @discussion - Chops up a message of not more than MESSAGE_LENGTH_MAX characters into lines to - fit inside a shaded box. The maximum dimensions of the box are 50% of the - screen width and 80% of the screen height. The box is padded left and right 4 - character widths and top and bottom one line width. The width of the screen - must allow at least 20 characters to fit on each line. This routine only chops - up the lines. The actual drawing into the framebuffer should done with calls to - EdenMessageDraw(). - This function should only be used in single-threaded applications. In - multi-threaded applications (in which a separate, blockable thread is - available to handle this kind of messaging), the function EdenMessage() should - be used instead, and it will automatically control showing and hiding of - the text. - @param msg The text to place into the message box. - @result EDEN_E_NONE in case of no error, or an error code. -*/ -EDEN_E_t EdenMessageShow(const unsigned char *msg); - -/*! - @function - @abstract Remove a message from drawing on the screen. - @discussion - Removes a message previously shown with EdenMessageShow() from the screen. - This function should only be used in single-threaded applications. In - multi-threaded applications (in which a separate, blockable thread is - available to handle this kind of messaging), the function EdenMessage() should - be used instead, and it will automatically control showing and hiding of - the text. - @result EDEN_E_NONE in case of no error, or an error code. -*/ -EDEN_E_t EdenMessageHide(void); - -/*! - @function - @abstract Prepare a text-input dialog for user interaction. - @discussion - Prepares a prompt message for drawing on the screen, and then place - a cursor at the end of the message, and collects input keystrokes - from the user until the user presses return. - @param prompt The message to show above and to the left of the user's input. - @param minLength Minimum number of characters the user must enter before the routine will - allow the input to be terminated (with the return key.) The return is NOT - included in this number. - @param maxLength Maximum number of characters the user may enter. - @result EDEN_E_NONE in case of no error, or an error code. -*/ -EDEN_E_t EdenMessageInputShow(const unsigned char *prompt, const unsigned int minLength, const unsigned int maxLength, int intOnly, int fpOnly, int alphaOnly); - -/*! - @function - @abstract Remove a text-input dialog for user interaction. - @discussion - Removes a message dialog previously shown with EdenMessageInputShow() from the screen. - This function should only be used in single-threaded applications. In - multi-threaded applications (in which a separate, blockable thread is - available to handle this kind of messaging), the function EdenMessageInput() should - be used instead, and it will automatically control showing and hiding of - the text. - @result EDEN_E_NONE in case of no error, or an error code. -*/ -EDEN_E_t EdenMessageInputHide(void); - -EDEN_BOOL EdenMessageInputIsComplete(void); - -/*! - @function - @abstract Prepare a message for drawing on the screen. - @discussion - Prepares a message for drawing on the screen (by calling through - to EdenMessageShow()), and waits the indicated number of seconds - before hiding the message (by calling through to EdenMessageHide()) - The routine blocks during the wait. It is thus designed to be - used in a multi-threaded application, where other operations, - including the actual drawing, occur in a separate thread. - Applications requiring that the routine routine immediately, such - as single-threaded applications, should not call this routine, but - should manually control the showing and hiding. - @param msg (description) - @param secs How many seconds to show the message for. - @result EDEN_E_NONE in case of no error, or an error code. -*/ -EDEN_E_t EdenMessage(unsigned char *msg, const unsigned int secs); - -/*! - @function - @abstract Prepare a text-input dialog for user interaction. - @discussion - Prepares a prompt message for drawing on the screen, and then place - a cursor at the end of the message, and collects input keystrokes - from the user until the user presses return. - The routine blocks during the wait. It is thus designed to be - used in a multi-threaded application, where other operations, - including the actual drawing and keystroke collection, occur in a - separate thread. - Applications requiring that the routine routine immediately, such - as single-threaded applications, should not call this routine, but - should manually control the showing and hiding. - @param prompt The message to show above and to the left of the user's input. - @param minLength Minimum number of characters the user must enter before the routine will - allow the input to be terminated (with the return key.) The return is NOT - included in this number. - @param maxLength Maximum number of characters the user may enter. - @result EDEN_E_NONE in case of no error, or an error code. -*/ -EDEN_E_t EdenMessageInput(const unsigned char *prompt, const unsigned int minLength, const unsigned int maxLength, int intOnly, int fpOnly, int alphaOnly); - -/*! - @function - @abstract Get the result of an input operation - @discussion - Gets the result of the input operation via a string copy. - @result - A string containing the content. If the user has cancelled input - with the ESC key, NULL will be returned. If the user has not entered - any input, this will point to a null string. - - Note that free() must be called on the result of this function - when the caller has finished with it, to prevent leaking of the result. - */ -unsigned char *EdenMessageInputGetInput(void); - -/*! - @function - @abstract Set the view size to use in calculations when aligning message box. - @discussion - The positioning of the message box is calculated each frame using - the values supplied here. - @param width Viewport width in pixels. - @param height Viewport height in pixels. - */ -void EdenMessageSetViewSize(const float width, const float height); - -void EdenMessageSetBoxParams(const float width, const float padding); - -/*! - @function - @abstract Draw previously-prepared text in a box onto the framebuffer. - @discussion - Draws a shaded white-outlined box box onto the screen and draws - lines of text previously prepared with EdenMessageShow() into it. - When the variable gEdenMessageDrawRequired is set, this function - should be called once per frame, generally after all other - drawing is complete. - - This function is typically called with the projection set to - a 2D orthographic projection. - - This drawing call is required in order to see the output of the - message routines, in both single- and multi-threaded applications. - @param contextIndex (description) -*/ -void EdenMessageDraw(const int contextIndex); - -/*! - @function - @abstract Pass user keystrokes to message library for use in dialogs. - @discussion - This function processes keystrokes for a message dialog. - When the global variable gEdenMessageKeyboardRequired is set, any keystrokes collected - from the user by the calling program should be passed to this function, - which will absorb the keystroke and update the on-screen dialog box appropriately. - This processing call is required in order to capture the user's input for the - message routines, in both single- and multi-threaded applications. - @param keyAsciiCode The ASCII-encoded keystroke. - @result Returns TRUE if the keystroke was processed successfully, FALSE in case of error. -*/ -EDEN_BOOL EdenMessageInputKeyboard(const unsigned char keyAsciiCode); - -#ifdef __cplusplus -} -#endif - -#endif /* !__EdenMessage_h__ */ diff --git a/include/Eden/EdenSound.h b/include/Eden/EdenSound.h deleted file mode 100644 index 2cc289a..0000000 --- a/include/Eden/EdenSound.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// EdenSound.h -// The Eden Library -// -// Copyright (c) 2012-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0 2012-12-23 PRL Initial version -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -#ifndef __EdenSound_h__ -#define __EdenSound_h__ - -#ifndef __Eden_h__ -# include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _EdenSound EdenSound_t; - -EdenSound_t *EdenSoundLoad(const char *pathname); -void EdenSoundUnload(EdenSound_t **sound_p); -void EdenSoundPlay(EdenSound_t *sound); -EDEN_BOOL EdenSoundIsPlaying(EdenSound_t *sound); -void EdenSoundPause(EdenSound_t *sound); -EDEN_BOOL EdenSoundIsPaused(EdenSound_t *sound); -void EdenSoundSetLooping(EdenSound_t *sound, EDEN_BOOL looping); -EDEN_BOOL EdenSoundIsLooping(EdenSound_t *sound); -void EdenSoundStop(EdenSound_t *sound); -EDEN_BOOL EdenSoundIsStopped(EdenSound_t *sound); -void EdenSoundRewind(EdenSound_t *sound); -float EdenSoundGetPlaybackTimeInSecs(EdenSound_t *sound); - -#ifdef __cplusplus -} -#endif //__cplusplus -#endif // !__EdenSound_h__ diff --git a/include/Eden/EdenSurfaces.h b/include/Eden/EdenSurfaces.h deleted file mode 100644 index bafd0ac..0000000 --- a/include/Eden/EdenSurfaces.h +++ /dev/null @@ -1,317 +0,0 @@ -/* - * EdenSurfaces.h - * The Eden Library - * - * Copyright (c) 2001-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. - * - * Rev Date Who Changes - * 1.0.0 2001-11-11 PRL Initial version for The SRMS simulator. - * 1.1.0 2008-07-18 PRL Repurposed for OpenGL ES. - * 1.2.0 2010-09-22 PRL Remove redundant static material handling. - */ - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -/*! - @header EdenSurfaces - @abstract Texture loading, selection, and drawing. - @discussion - EdenSurfaces forms one part of the Eden library. - @copyright 2001-2013 Philip Lamb - */ - -#ifndef __EdenSurfaces_h__ -#define __EdenSurfaces_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* ============================================================================ * - * Includes - * ============================================================================ */ -#ifndef __Eden_h__ -# include -#endif - - -#if defined(EDEN_OPENGL3) -# ifdef EDEN_MACOSX -# include -# else -# include -# endif -#elif defined(EDEN_OPENGLES) -# if defined ANDROID -# include -# include -# else -# include -# include -# endif -#else -# ifdef EDEN_MACOSX -# include -# else -# include -# endif -#endif - - -/* ============================================================================ * - * defines - * ============================================================================ */ -#if 0 -// Symbolic names for faces of objects to texture. -#define TEXTURE_FACE_TOP_BIT 0x01 -#define TEXTURE_FACE_RIGHT_BIT 0x02 -#define TEXTURE_FACE_BACK_BIT 0x04 -#define TEXTURE_FACE_LEFT_BIT 0x08 -#define TEXTURE_FACE_FRONT_BIT 0x10 -#define TEXTURE_FACE_BOTTOM_BIT 0x20 -#endif - -/*! - @typedef - @abstract Scaling mode to use when drawing a texture on a quad. - @constant STRETCH Match texture size to quad, stretching as necessary. - @constant FILL Scale the texture so that its smallest side exactly fills - the largest side of the quad. If the texture and the quad are not the same - ratio, the texture will be cropped. - @constant FIT Scale the texture so that it's largest side exactly fits in - the smallest side of the quad. If the texture and the quad are not the same - ratio, the texture will be surrounded by background texture (letterbox/pillarbox). - @constant UNITY Draw the texture with one pixel per one OpenGL unit, without stretching. - If the texture is larger than the quad, it will be cropped. If it is smaller, it will - be surrounded by background texture. - */ -typedef enum { - STRETCH, - FILL, - FIT, - UNITY -} EDEN_TEXTURE_SCALING_MODE; - -/*! - @typedef - @abstract How to align the texture content when drawing a texture on a quad. - */ -typedef enum { - CENTRE, - TOP_LEFT, - TOP_RIGHT, - BOTTOM_LEFT, - BOTTOM_RIGHT, - LEFT, - TOP, - RIGHT, - BOTTOM -} EDEN_TEXTURE_ALIGNMENT_MODE; - -/* ============================================================================ * -* Public types -* ============================================================================ */ - -typedef unsigned int TEXTURE_INDEX_t; - -/*! - @typedef - @field pathname Pathname of the texture file to load. - @field mipmaps TRUE if mipmaps should be generated (e.g. if the texture will - be drawn scaled to sizes smaller than unity), FALSE otherwise. - @field internalformat OpenGL internal texture format to use. - E.g. this allows a single-channel texture to be loaded as GL_ALPHA rather - than GL_LUMINANCE. Typically GL_RGB or GL_RGBA. - @field min_filter - @field mag_filter - @field wrap_s - @field wrap_t - @field priority - @field env_mode -*/ -typedef struct { - const char *pathname; - GLboolean mipmaps; - GLint internalformat; - GLint min_filter; - GLint mag_filter; - GLint wrap_s; - GLint wrap_t; - GLclampf priority; - GLint env_mode; - //GLfloat env_color[4]; -} TEXTURE_INFO_t; - -/* ============================================================================ * - * Public functions - * ============================================================================ */ - -/*! - @function - @abstract Initialise the EdenSurfaces library. - @discussion - This function must be called prior to any other EdenSurfaces*() functions being called. - - Does NOT require that a valid OpenGL context be available. - @param contextsActiveCount Maximum number of OpenGL contexts that will be in use. Typically 1. - @param textureIndicesMax Maximum number of textures that can be loaded via calls to EdenSurfacesTextureLoad. - @result TRUE if the function succeeded, FALSE otherwise. - */ -EDEN_BOOL EdenSurfacesInit(const int contextsActiveCount, const int textureIndicesMax); - -/*! - @function - @abstract Loads textures into OpenGL texture objects. - @discussion - Loads numTextures textures into OpenGL texture objects, for the specified OpenGL - context (the first context has a contextIndex of 0). - @param contextIndex The index of the OpenGL context into which this texture is being loaded. - (The context must already be active.) Normally 0 if using only one context. - May not be more than contextsActiveCount-1 (as passed to EdenSurfacesInit). - @param numTextures The number of textures being loaded. - @param textureInfo An array (of length numTextures) holding details of each texture - being loaded. - - On OpenGL ES devices with limited non-power-of-two (NPOT) texture support, - the NPOT support will only be available if {mipmaps = FALSE, min_filter/mag_filter - = GL_NEAREST/GL_LINEAR, wrap_s/wrap_t = GL_CLAMP_TO_EDGE}. - @param textureIndices - After loading, the array textureIndices[] holds the index - numbers assigned to each texture. These index numbers may then be used in calls to - EdenSurfacesTextureSet() and EdenSurfacesTextureUnload(). (These indices are of type - TEXTURE_INDEX_t, an unsigned int, greater than or equal to 1, and are only valid - per-OpenGL context.) - In the event of a loading error, the index value of any textures not loaded will - be equal to 0. - @param hasAlpha_out If the calling routine wishes to know if the returned texture contains - an alpha channel it should supply a pointer to a char in parameter hasAlpha_out, and on - return, this char will equal 0 if no alpha channel is present, or 1 otherwise. If this - information is not needed, set hasAlpha_out to NULL - @result TRUE if all textures were loaded correctly, FALSE if one or more were not. - */ -EDEN_BOOL EdenSurfacesTextureLoad(const int contextIndex, const int numTextures, const TEXTURE_INFO_t *textureInfo, TEXTURE_INDEX_t *textureIndices, char *hasAlpha_out); - -EDEN_BOOL EdenSurfacesTextureLoad2(const int contextIndex, const int numTextures, const TEXTURE_INFO_t *textureInfo, TEXTURE_INDEX_t *textureIndices, char *hasAlpha_out, const EDEN_BOOL flipH, const EDEN_BOOL flipV); - -/*! - @function - @abstract Binds the OpenGL texture. - @discussion - @param textureIndex The texture bound is specified by parameter textureIndex. - This index is only valid if the current OpenGL context is contextIndex, and the index - was returned by EdenSurfacesTextureLoad() with the same OpenGL context. - @param contextIndex The index of the OpenGL context with which this texture is being bound. - (The context must already be active.) Normally 0 if using only one context. - May not be more than contextsActiveCount-1 (as passed to EdenSurfacesInit). - */ -void EdenSurfacesTextureSet(const int contextIndex, TEXTURE_INDEX_t textureIndex); - -/*! - @function - @abstract Unloads textures and frees OpenGL texture objects. - @discussion - Unloads numTextures textures from OpenGL texture objects, for the specified OpenGL context. - @param numTextures The number of textures being unloaded. - @param textureIndices After unloading, the corresponding index in textureIndices for each - record in textureInfo[] is set to 0. - @param contextIndex The index of the OpenGL context from this texture is being unloaded. - (The context must already be active.) Normally 0 if using only one context. - May not be more than contextsActiveCount-1 (as passed to EdenSurfacesInit). - @result TRUE if the function succeeded, FALSE otherwise. - */ -EDEN_BOOL EdenSurfacesTextureUnload(const int contextIndex, const int numTextures, TEXTURE_INDEX_t *textureIndices); - -/*! - @function - @abstract Finalise the EdenSurfaces library. - @discussion - This function should be called once no more calls to any other EdenSurfaces*() - functions are required, to free up allocated memory. - Does NOT require that a valid OpenGL context be available. - @result TRUE if the function succeeded, FALSE otherwise. - */ -EDEN_BOOL EdenSurfacesFinal(void); - -/*! - @function - @abstract Draw a texture on a quad using OpenGL. - @discussion - Draws the texture pointed to by index on a surface of size (width, height) OpenGL units, - with the lower-left corner of the surface at the origin, and the surface lying in the X-Y plane. - - To draw at a different position and/or orientation precede with glTranslate/glRotate calls. - @param width Width, in OpenGL units, of the quad on which to draw. - @param height Height, in OpenGL units, of the quad on which to draw. - @param scaleMode determines how the scale factor between pixels in the source - image and OpenGL units on the surface. - @param alignMode determines the placement of the image inside the surface. - @result TRUE if the function succeeded, FALSE otherwise. - */ -EDEN_BOOL EdenSurfacesDraw(const int contextIndex, const TEXTURE_INDEX_t textureIndex, const int width, const int height, const EDEN_TEXTURE_SCALING_MODE scaleMode, const EDEN_TEXTURE_ALIGNMENT_MODE alignMode); - -/*! - @function - @abstract Check for the availability of an OpenGL extension. - @discussion - Provides the same functionality as the gluCheckExtension() function, - since some platforms don't have GLU version 1.3 or later. - @param extName Name of the extension, e.g. "GL_EXT_texture". - @param extString The OpenGL extensions string, as returned by glGetString(GL_EXTENSIONS); - @result TRUE, if the extension is found, FALSE otherwise. -*/ -GLboolean EdenGluCheckExtension(const GLubyte* extName, const GLubyte *extString); - -/*! - @function - @abstract Checks for the presence of an OpenGL capability by version or extension. - @discussion - Checks for the presence of an OpenGL capability by version or extension. - The test returns true if EITHER the OpenGL driver's OpenGL implementation - version meets or exceeds a minimum value (passed in in minVersion) OR - if an OpenGL extension identifier passed in as a character string - is non-NULL, and is found in the current driver's list of supported extensions. - @param minVersion - A binary-coded decimal (i.e. version 1.0 is represented as 0x0100) version number. - If minVersion is zero, (i.e. there is no version of OpenGL with this extension in core) - the version test will always fail, and the result will only be true if the extension - string test passes. - @param extension A string with an extension name to search the drivers extensions - string for. E.g. "GL_EXT_texture". If NULL, the extension name test will always fail, - and the result will only be true if the version number test passes. - @result TRUE If either of the tests passes, or FALSE if both fail. -*/ -int EdenGLCapabilityCheck(const unsigned short minVersion, const unsigned char *extension); - -#ifdef __cplusplus -} -#endif - -#endif /* !__EdenSurfaces_h__ */ diff --git a/include/Eden/EdenTime.h b/include/Eden/EdenTime.h deleted file mode 100644 index 498bad5..0000000 --- a/include/Eden/EdenTime.h +++ /dev/null @@ -1,156 +0,0 @@ -// -// EdenTime.h -// -// Copyright (c) 2001-2012 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0.0 2001-11-26 PRL Initial version for The SRMS simulator. -// 1.0.1 2005-09-07 PRL Misc changes till now. Added headerdoc. -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// HeaderDoc documentation included. See http://developer.apple.com/darwin/projects/headerdoc/ - -/*! - @header EdenTime - @abstract Time utility routines. - @version 1.0.1 - @updated 2005-09-07 - @discussion - EdenTime forms one part of the Eden library, and it makes - use of other parts of the library for its internal operations. - @related EdenLog - @copyright 2005 Philip Lamb - */ -#ifndef __EdenTime_h__ -#define __EdenTime_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -// ============================================================================ -// Public types, defines and includes -// ============================================================================ - -#ifndef __Eden_h__ -# include -#endif - -#if defined(EDEN_UNIX) -# include // struct timespec, struct timeval, gettimeofday() -#else -# ifndef HAVE_STRUCT_TIMESPEC // pthreads_win32 also defines struct timespec. -struct timespec { - long tv_sec; - long tv_nsec; -}; -# endif // !PTHREAD_H -#endif - -// ============================================================================ -// Public functions -// ============================================================================ - -/*! - @function - @abstract Get current time in fractional seconds. - @discussion - Supported via system calls on Unix, WIN32, and MacOS. - Other systems which support GLUT are also supported (with lesser accuracy.) - @result The time. -*/ -double EdenTimeInSeconds(void); - -/*! - @function - @abstract Get current time, add microseconds offset to it, and return as a timespec. - @discussion - Gets an absolute time in seconds and nanoseconds elapsed since - epoch (Jan 1, 1970), add parameter 'microseconds' microseconds - and return in a timespec structure, suitable e.g. for passing to - functions such as pthread_cond_timedwait(). - Supported via system calls on Unix, and WIN32. - @param result Timespec structure which will be filled with the result. - @param microseconds How many microseconds in the future the timespec will be. - -*/ -void EdenTimeAbsolutePlusOffset(struct timespec *result, const long microseconds); - -/*! - @function - @abstract Generate human-readable string representing time. - @discussion (description) - Put character string with a human-readable representation of the - time passed in parameter 'seconds' into 's'. - On Unix, Windows and other platforms supporting the ctime(); - system function call, the string returned will be in ctime - format, i.e. of the format "Thu Nov 24 18:22:48 1986", which - is a string with constant field widths, and taking into account - the current time zone and daylight savings time. - @param seconds The time value, should be the number of seconds - elapsed since epoch (1st Jan 1970), such as generated by - EdenTimeInSeconds(); - @param s Pointer to a character buffer, no smaller than 25 - bytes in size, which will be filled with the string. - @result Pointer to the passed in buffer. -*/ -char *EdenTimeInSecondsToText(const double seconds, char s[25]); - -#ifndef _WINRT -/*! - @function - @abstract Sleep the specified number of microseconds. - @discussion - Uses an OS-dependent routine. On Unix platforms, usleep; On Windows - platforms, Sleep; on Mac OS (Classic) platform, Delay. - @param microseconds How many microseconds (millionths of a second) to sleep. - @availability Not available on Windows Runtime (WinRT). -*/ -void EdenTime_usleep(const unsigned int microseconds); -#endif // !_WINRT - -/*! - @function - @abstract Sleep the specified number of seconds. - @discussion - Uses an OS-dependent routine. On Unix platforms, sleep; On Windows - platforms, Sleep; on Mac OS (Classic) platform, Delay. - @param seconds How many seconds to sleep. -*/ -void EdenTime_sleep(const unsigned int seconds); - -#ifdef __cplusplus -} -#endif - -#endif /* !__EdenTime_h__ */ diff --git a/include/Eden/EdenUtil.h b/include/Eden/EdenUtil.h deleted file mode 100644 index 7de9762..0000000 --- a/include/Eden/EdenUtil.h +++ /dev/null @@ -1,184 +0,0 @@ -// -// EdenUtil.h -// The Eden Library -// -// Various OS-related bits and pieces. -// -// Copyright (c) 2004-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0.0 2004-04-23 PRL Added functions for checking keyboard. -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -/*! - - @header EdenUtil - @abstract Miscellaneous utility routines. - @discussion - EdenUtil forms one part of the Eden library. - @copyright 2004-2013 Philip Lamb - */ - -#ifndef __EdenUtil_h__ -#define __EdenUtil_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -// ============================================================================ -// Public includes -// ============================================================================ - -#ifndef __Eden_h__ -# include -#endif - - -// ============================================================================ -// Public defines and types -// ============================================================================ - -// ============================================================================ -// Global variables -// ============================================================================ - -// ============================================================================ -// Public functions -// ============================================================================ - -/*! - @function - @abstract Do any required setup so that we can check for single keypresses. - @discussion - @result (description) -*/ -EDEN_BOOL EdenKeyboardHitSetup(void); - -/*! - @function - @abstract Check to see if the user has pressed a key on the keyboard. - @discussion - @result (description) -*/ -EDEN_BOOL EdenKeyboardHit(void); - -/*! - @function - @abstract Do any required cleanup from our use of single keypress detection. - @discussion - @result (description) -*/ -EDEN_BOOL EdenKeyboardHitCleanup(void); - -/*! - @function - @abstract Get file name from a path. - @discussion - Given a full or partial pathname passed in string path, - returns a pointer to the first char of the filename - portion of path. - @param path Full or partial pathname. - @result A pointer to the first char of the filename - portion of path. -*/ -char *EdenGetFileNameFromPath(const char *path); - -/*! - @function - @abstract Get file extension from a path. - @discussion - Given a full or partial pathname passed in string path, - returns a string with the extension portion of path, - i.e. the text after the rightmost '.' character, if any. - If the filename contains no '.', NULL is returned. - @param path Full or partial pathname. - @param convertToLowercase If convertToLowercase is TRUE, uppercase - ASCII characters in the extension will be converted to lowercase. - @result A string with the extension portion of path. - NB: The returned string must be freed by the caller. -*/ -char *EdenGetFileExtensionFromPath(const char *path, int convertToLowercase); - -/*! - @function - @abstract Get directory name from a path. - @discussion - Given a full or partial pathname passed in string path, - returns a string with the directory name portion of path. - The string is not terminated by the directory separator. - @param path Full or partial pathname. - @result A string with the directory name portion of path. - NB: The returned string must be freed by the caller. -*/ -char *EdenGetDirectoryNameFromPath(const char *path); - -/*! - @function - @abstract Return the path to the current executable - @discussion - Return the path to the current executable, where such a - linkage between path and execution exists and is readable. - @result NULL if the path could not be determined, - otherwise, the path as a NULL-terminated dynamically-allocated - string. N.B.: free() MUST be called on the returned string - when it is finished with. -*/ -char *EdenGetExecutablePath(void); - - -/*! - @function - @abstract Get a path as a file URI. - @discussion - Given a full or partial pathname passed in string path, - returns a string with the file URI for that path. - - Partial pathnames are handled by concatening with the - process's current working directory. - @param path Full or partial pathname. - - On Windows, both partial pathnames, full pathnames including - the drive letter, or UNC pathnames (beginning with "\\" are - all OK. - @result A string with the the file URI for that path. - NB: The returned string must be freed by the caller (by - calling free() once its use is complete). -*/ -char *EdenGetFileURI(const char *path); - -#ifdef __cplusplus -} -#endif - -#endif /* !__EdenUtil_h__ */ diff --git a/include/Eden/glm.h b/include/Eden/glm.h deleted file mode 100644 index 4ca15dd..0000000 --- a/include/Eden/glm.h +++ /dev/null @@ -1,540 +0,0 @@ -/* - glm.h - Nate Robins, 1997, 2000 - nate@pobox.com, http://www.pobox.com/~nate - - Wavefront OBJ model file format reader/writer/manipulator. - - Includes routines for generating smooth normals with - preservation of edges, welding redundant vertices & texture - coordinate generation (spheremap and planar projections) + more. -*/ - -// -// Updated by Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0.0 ????-??-?? NR Original version released as part of Nate Robin's OpenGL tutors package. -// 1.0.1 2001-11-14 PRL Fix linear texture coordinate generation. -// 1.0.2 2001-11-15 PRL Correct glmUnitize & glmDimensions for model with no -ve vertices, -// and correct glmUnitize to use unit cube, not cube with sides=2.0. -// 1.1.0 2002-01-28 PRL Add glmDrawArrays to use compiled vertex arrays. -// 1.2.0 2002-01-30 PRL glmDraw, glmDrawArrays and glmList are now OpenGL context-specific. -// 1.2.1 2002-02-03 PRL New glmVertexNormals() routine to handle models with polys with > 3 sides more -// consistently. -// 1.3.0 2003-08-06 PRL Now handles materials with dissolve factors for transparency and texture maps -// and dissolve factors. glmReadOBJ is now OpenGL context-specific. -// 1.4.0 2008-07-30 PRL Complete rewrite of glmDrawArrays to now correctly handle normals and texcoords. -// Implementation is now OpenGL|ES 1.1-compliant. -// Fixed a few small bugs in material handling in drawing routines. -// Made glmMax into a macro and added glmMin, & replaced glmAbs with fabsf. -// 1.4.1 2009-04-21 PRL Allow use of multiple materials within a group in the file, by forking off a -// new group. Should now handle models exported from Google Sketchup Pro OK. -// 1.4.2 2010-03-23 PRL Add glmRotate function. Minor changes for correct compilation. -// 1.5.0 2010-09-17 PRL Now supports transparency in materials, including textures. Because depth sorting -// is not yet implemented, overlay of multiple transparent surfaces may produce -// odd visual results. It is recommended that models be sorted back to front -// prior to drawing. -// 1.5.1 2011-03-01 PRL Better handle the case when some but not all faces have normals or texcoords. -// 1.6.0 2011-08-17 PRL Incorporate glStateCache to improve performance on TBDR OpenGL ES renderers. -// 1.7.0 2012-09-28 PRL Added lazy loading of model textures at render time, glmReadOBJ2 to request this. -// 1.7.1 2013-10-02 PRL Added flipping of textures in vertical dimension (some .obj models need it), -// and glmReadOBJ3 to request this. Also, better handles models with odd ordering -// of group and material commands. -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -#ifndef __glm_h__ -#define __glm_h__ - -#define GLM_MATERIAL_TEXTURES // PRL 2003-08-06: Uncomment to build glm with provision for texture mapping in materials. - -#ifdef GLM_MATERIAL_TEXTURES -# ifndef __Eden_h__ -# include -# endif -# include // PRL 20030806: TEXTURE_INFO_t, TEXTURE_INDEX_t, EdenSurfacesTextureLoad(), EdenSurfacesTextureSet(), EdenSurfacesTextureUnload() -#endif // GLM_MATERIAL_TEXTURES - -#ifdef EDEN_MACOSX -# include -#elif defined(EDEN_OPENGLES) -# if defined ANDROID -# include -# include -# else -# include -# include -# endif -#else -# include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define GLM_NONE (0) /* render with only vertices */ -#define GLM_FLAT (1 << 0) /* render with facet normals */ -#define GLM_SMOOTH (1 << 1) /* render with vertex normals */ -#define GLM_TEXTURE (1 << 2) /* render with texture coords */ -#define GLM_COLOR (1 << 3) /* render with colors */ -#define GLM_MATERIAL (1 << 4) /* render with materials */ - -/* GLMmaterial: Structure that defines a material in a model. - */ -typedef struct _GLMmaterial -{ - char* name; /* name of material */ - GLfloat diffuse[4]; /* diffuse component */ - GLfloat ambient[4]; /* ambient component */ - GLfloat specular[4]; /* specular component */ - GLfloat emmissive[4]; /* emmissive component */ - GLfloat shininess; /* specular exponent */ - /* - 0 Color on and Ambient off - 1 Color on and Ambient on - 2 Highlight on - 3 Reflection on and Ray trace on - 4 Transparency: Glass on - Reflection: Ray trace on - 5 Reflection: Fresnel on and Ray trace on - 6 Transparency: Refraction on - Reflection: Fresnel off and Ray trace on - 7 Transparency: Refraction on - Reflection: Fresnel on and Ray trace on - 8 Reflection on and Ray trace off - 9 Transparency: Glass on - Reflection: Ray trace off - 10 Casts shadows onto invisible surfaces - */ - GLint illum; // Illumination model. -#ifdef GLM_MATERIAL_TEXTURES - char* texturemap; // PRL 2003-08-06: path to texture file, relative to material file. - char* texturemappath; // PRL 2012-09-25: path to texture file, relative to working directory. - TEXTURE_INDEX_t texturemap_index; // PRL 2003-08-06: index to loaded texture. 0 indicates not loaded. - char texturemap_hasAlpha; // Whether texture has an alpha channel. -#endif // GLM_MATERIAL_TEXTURES -} GLMmaterial; - -/* GLMtriangle: Structure that defines a triangle in a model. - */ -typedef struct _GLMtriangle { - GLuint vindices[3]; /* array of triangle vertex indices */ - GLuint nindices[3]; /* array of triangle normal indices */ - GLuint tindices[3]; /* array of triangle texcoord indices*/ - GLuint findex; /* index of triangle facet normal */ -} GLMtriangle; - -/* GLMgroup: Structure that defines a group in a model. - */ -typedef struct _GLMgroup { - char* name; /* name of this group */ - GLuint numtriangles; /* number of triangles in this group */ - GLuint* triangles; /* array of triangle _indices_ */ - GLuint material; /* index to material for group */ - struct _GLMgroup* next; /* pointer to next group in model */ -} GLMgroup; - -typedef struct _GLMarray { - GLfloat *vertices; - GLfloat *normals; - GLfloat *texcoords; - GLushort *indices; - GLushort indexCount; - GLMmaterial *material; - struct _GLMarray *next; -} GLMarray; - - -/* GLMmodel: Structure that defines a model. - */ -typedef struct _GLMmodel { - char* pathname; /* path to this model */ - char* mtllibname; /* name of the material library */ - - GLuint numvertices; /* number of vertices in model */ - GLfloat* vertices; /* array of vertices */ - - GLuint numnormals; /* number of normals in model */ - GLfloat* normals; /* array of normals */ - - GLuint numtexcoords; /* number of texcoords in model */ - GLfloat* texcoords; /* array of texture coordinates */ - - GLuint numfacetnorms; /* number of facetnorms in model */ - GLfloat* facetnorms; /* array of facetnorms */ - - GLuint numtriangles; /* number of triangles in model */ - GLMtriangle* triangles; /* array of triangles */ - - GLuint nummaterials; /* number of materials in model */ - GLMmaterial* materials; /* array of materials */ - - GLuint numgroups; /* number of groups in model */ - GLMgroup* groups; /* linked list of groups */ - - GLMarray *arrays; // Optimised arrays of vertices, normals, texcoords for fast drawing. - GLuint arrayMode; // The GLM_* mode with which the arrays were created. - - GLboolean readTextureRequired; // Set if textures need to be read in and submitted to OpenGL. - GLboolean flipTextureV; // Set if textures need to be flipped in vertical dimension. - -} GLMmodel; - - -/* glmUnitize: "unitize" a model by translating it to the origin and - * scaling it to fit in a unit cube around the origin. Returns the - * scalefactor used. - * - * model - properly initialized GLMmodel structure - */ -GLfloat -glmUnitize(GLMmodel* model); - -/* glmDimensions: Calculates the dimensions (width, height, depth) of - * a model. - * - * model - initialized GLMmodel structure - * dimensions - array of 3 GLfloats (GLfloat dimensions[3]) - */ -GLvoid -glmDimensions(GLMmodel* model, GLfloat* dimensions); - -/* glmScale: Scales a model by a given amount. - * - * model - properly initialized GLMmodel structure - * scale - scalefactor (0.5 = half as large, 2.0 = twice as large) - */ -GLvoid -glmScale(GLMmodel* model, GLfloat scale); - -/* glmScaleTextures: Scales a model's textures by a given amount. - * - * model - properly initialized GLMmodel structure - * scale - scalefactor (0.5 = half as large, 2.0 = twice as large) - */ -GLvoid -glmScaleTextures(GLMmodel* model, GLfloat scale); - -/* glmTranslate: Translates (moves) a model by a given amount in x, y, z. - * - * model - properly initialized GLMmodel structure - * offset- vector specifying amount to translate model by. - */ -GLvoid -glmTranslate(GLMmodel* model, const GLfloat offset[3]); - -/* glmRotate: Rotates a model by a given amount angle (in radians) about axis in x, y, z. - * - * model - properly initialized GLMmodel structure - * angle - scalar specifying amount to rotate model by, in radians. - * x, y, z - scalar components of a normalized vector specifiying axis of rotation. - */ -GLvoid -glmRotate(GLMmodel* model, const GLfloat angle, const GLfloat x, const GLfloat y, const GLfloat z); - -/* glmReverseWinding: Reverse the polygon winding for all polygons in - * this model. Default winding is counter-clockwise. Also changes - * the direction of the normals. - * - * model - properly initialized GLMmodel structure - */ -GLvoid -glmReverseWinding(GLMmodel* model); - -/* glmFacetNormals: Generates facet normals for a model (by taking the - * cross product of the two vectors derived from the sides of each - * triangle). Assumes a counter-clockwise winding. - * - * model - initialized GLMmodel structure - */ -GLvoid -glmFacetNormals(GLMmodel* model); - -/* glmVertexNormals: Generates smooth vertex normals for a model. - * First builds a list of all the triangles each vertex is in. Then - * loops through each vertex in the the list averaging all the facet - * normals of the triangles each vertex is in. Finally, sets the - * normal index in the triangle for the vertex to the generated smooth - * normal. If the dot product of a facet normal and the facet normal - * associated with the first triangle in the list of triangles the - * current vertex is in is greater than the cosine of the angle - * parameter to the function, that facet normal is not added into the - * average normal calculation and the corresponding vertex is given - * the facet normal. This tends to preserve hard edges. The angle to - * use depends on the model, but 90 degrees is usually a good start. - * - * model - initialized GLMmodel structure - * angle - maximum angle (in degrees) to smooth across - */ -GLvoid -glmVertexNormals(GLMmodel* model, GLfloat angle); - -/* glmLinearTexture: Generates texture coordinates according to a - * linear projection of the texture map. It generates these by - * linearly mapping the vertices onto a square. - * - * PRL, 20011114: The square lies in the x-z plane and is of the same - * dimension as the model in this plane. Note that this mapping will - * produce highly distored textures on polygons whose projections - * onto the x-z plane have areas approaching zero, i.e. whose facet - * normals have little or no y component. - * - * model - pointer to initialized GLMmodel structure - */ -GLvoid -glmLinearTexture(GLMmodel* model); - -/* glmSpheremapTexture: Generates texture coordinates according to a - * spherical projection of the texture map. Sometimes referred to as - * spheremap, or reflection map texture coordinates. It generates - * these by using the normal to calculate where that vertex would map - * onto a sphere. Since it is impossible to map something flat - * perfectly onto something spherical, there is distortion at the - * poles. This particular implementation causes the poles along the X - * axis to be distorted. - * - * model - pointer to initialized GLMmodel structure - */ -GLvoid -glmSpheremapTexture(GLMmodel* model); - -/* glmDelete: Deletes a GLMmodel structure. - * - * model - initialized GLMmodel structure - * contextIndex - PRL: index to the current OpenGL context (for texturing.) If you have only - * one OpenGL context (the most common case) set this parameter to 0. - */ -GLvoid -glmDelete(GLMmodel* model, const int contextIndex); - -/* glmReadOBJ: Reads a model description from a Wavefront .OBJ file. - * Returns a pointer to the created object which should be free'd with - * glmDelete(). - * - * filename - name of the file containing the Wavefront .OBJ format data. - * contextIndex - PRL: index to the current OpenGL context (for texturing.) - */ -GLMmodel* -glmReadOBJ(const char *filename, const int contextIndex); - -/* glmReadOBJ2: Reads a model description from a Wavefront .OBJ file. - * Returns a pointer to the created object which should be free'd with - * glmDelete(). - * Whereas glReadOBJ will attempt to load and submit to OpenGL any - * textures specified in an accompanying materials file, this variant allows - * texture loading to be delayed until the model is actually to be drawn, - * i.e. lazily loaded. - * - * filename - name of the file containing the Wavefront .OBJ format data. - * contextIndex - PRL: index to the current OpenGL context (for texturing.) - * readTexturesNow - TRUE to load and submit to OpenGL any textures specified - * in an accompanying materials file, or FALSE to lazily load textures - * at the time of a later glmDraw() or glmDrawArrays call(). - */ -GLMmodel* -glmReadOBJ2(const char *filename, const int contextIndex, const GLboolean readTexturesNow); - -/* glmReadOBJ2: Reads a model description from a Wavefront .OBJ file. - * Returns a pointer to the created object which should be free'd with - * glmDelete(). - * Whereas glReadOBJ will attempt to load and submit to OpenGL any - * textures specified in an accompanying materials file, this variant allows - * texture loading to be delayed until the model is actually to be drawn, - * i.e. lazily loaded. - * - * filename - name of the file containing the Wavefront .OBJ format data. - * contextIndex - PRL: index to the current OpenGL context (for texturing.) - * readTexturesNow - TRUE to load and submit to OpenGL any textures specified - * in an accompanying materials file, or FALSE to lazily load textures - * at the time of a later glmDraw() or glmDrawArrays call(). - * flipTextureV - If TRUE, textures will be flipped in the V (vertical) - * dimension as they are loaded. Some .obj files are written with textures flipped - * in this way. If FALSE, behaviour is the same as for glmReadOBJ2(). - */ -GLMmodel* -glmReadOBJ3(const char *filename, const int contextIndex, const GLboolean readTexturesNow, const GLboolean flipTextureV); - -/* glmWriteOBJ: Writes a model description in Wavefront .OBJ format to - * a file. - * - * model - initialized GLMmodel structure - * filename - name of the file to write the Wavefront .OBJ format data to - * mode - a bitwise or of values describing what is written to the file - * GLM_NONE - write only vertices - * GLM_FLAT - write facet normals - * GLM_SMOOTH - write vertex normals - * GLM_TEXTURE - write texture coords - * GLM_FLAT and GLM_SMOOTH should not both be specified. - */ -GLvoid -glmWriteOBJ(GLMmodel* model, char* filename, GLuint mode); - -#ifndef EDEN_OPENGLES -/* glmDraw: Renders the model to the current OpenGL context using the - * mode specified. - * - * model - initialized GLMmodel structure - * mode - a bitwise OR of values describing what is to be rendered. - * GLM_NONE - render with only vertices - * GLM_FLAT - render with facet normals - * GLM_SMOOTH - render with vertex normals - * GLM_TEXTURE - render with texture coords - * GLM_COLOR - render with colors (color material) - * GLM_MATERIAL - render with materials - * GLM_COLOR and GLM_MATERIAL should not both be specified. - * GLM_FLAT and GLM_SMOOTH should not both be specified. - * contextIndex - PRL: index to the current OpenGL context (for texturing.) If you have only - * one OpenGL context (the most common case) set this parameter to 0. - */ -GLvoid -glmDraw(GLMmodel* model, GLuint mode, const int contextIndex); - -/* glmList: Generates and returns a display list for the model using - * the mode specified. - * - * model - initialized GLMmodel structure - * mode - a bitwise OR of values describing what is to be rendered. - * GLM_NONE - render with only vertices - * GLM_FLAT - render with facet normals - * GLM_SMOOTH - render with vertex normals - * GLM_TEXTURE - render with texture coords - * GLM_COLOR - render with colors (color material) - * GLM_MATERIAL - render with materials - * GLM_COLOR and GLM_MATERIAL should not both be specified. - * GLM_FLAT and GLM_SMOOTH should not both be specified. - * contextIndex - PRL: index to the current OpenGL context (for texturing.) If you have only - * one OpenGL context (the most common case) set this parameter to 0. - */ -GLuint -glmList(GLMmodel* model, GLuint mode, const int contextIndex); -#endif // !EDEN_OPENGLES - -/* glmWeld: eliminate (weld) vectors that are within an epsilon of - * each other. - * - * model - initialized GLMmodel structure - * epsilon - maximum difference between vertices - * ( 0.00001 is a good start for a unitized model) - * - */ -GLvoid -glmWeld(GLMmodel* model, GLfloat epsilon); - - -/* glmReadPPM: read a PPM raw (type P6) file. The PPM file has a header - * that should look something like: - * - * P6 - * # comment - * width height max_value - * rgbrgbrgb... - * - * where "P6" is the magic cookie which identifies the file type and - * should be the only characters on the first line followed by a - * carriage return. Any line starting with a # mark will be treated - * as a comment and discarded. After the magic cookie, three integer - * values are expected: width, height of the image and the maximum - * value for a pixel (max_value must be < 256 for PPM raw files). The - * data section consists of width*height rgb triplets (one byte each) - * in binary format (i.e., such as that written with fwrite() or - * equivalent). - * - * The rgb data is returned as an array of unsigned chars (packed - * rgb). The malloc()'d memory should be free()'d by the caller. If - * an error occurs, an error message is sent to stderr and NULL is - * returned. - * - * filename - name of the .ppm file. - * width - will contain the width of the image on return. - * height - will contain the height of the image on return. - * - */ - -GLubyte* -glmReadPPM(const char* filename, int* width, int* height); - -/* glmCreateArrays: Creates a linked list of vertex, normal, and texcoord data arrays and - * a set of triangle indices for the model specified using the mode specified. - * - * Each node in the list represents one group in the model. - * The created arrays are added to the model and do not track any other state changes in - * the model apart from material properties, so if you change the model, or if you wish - * to draw using a different mode, you will need to regenerate the arrays by calling - * glmCreateArrays again. - * - * This function must be called before any call to glmDrawArrays(). - * - * By Philip Lamb, phil@eden.net.nz, 2008-07-30 - * - * model - initialized GLMmodel structure. - * mode - a bitwise OR of values describing what is to be rendered. - * GLM_NONE - render with only vertices - * GLM_FLAT - render with facet normals - * GLM_SMOOTH - render with vertex normals - * GLM_TEXTURE - render with texture coords - * GLM_COLOR - render with colors (color material) - * GLM_MATERIAL - render with materials - * GLM_COLOR and GLM_MATERIAL should not both be specified. - * GLM_FLAT and GLM_SMOOTH should not both be specified. - */ -GLvoid glmCreateArrays(GLMmodel* model, GLuint mode); - -/* glmDeleteArrays: Remove any arrays from a model structure. - * - * This function may be called after all calsl to glmDrawArrays() are complete - * to free up memory associated with the arrays. This will be done - * automatically if the model itself is deleted (by a call to glmDelete()). - * - * By Philip Lamb, phil@eden.net.nz, 2008-07-30 - * - * model - initialized GLMmodel structure. - */ -GLvoid glmDeleteArrays(GLMmodel *model); - - -/* glmDrawArrays: Draws a model using array data created by glmCreateArrays(). - * - * By Philip Lamb, phil@eden.net.nz, 2008-07-30 - * - * model - initialized GLMmodel structure, which has had arrays created. - * contextIndex - index to the current OpenGL context (for texturing.) If you have only - * one OpenGL context (the most common case) set this parameter to 0. - */ -GLvoid glmDrawArrays(GLMmodel* model, const int contextIndex); - -#ifdef __cplusplus -} -#endif - -#endif /* !__glm_h__ */ diff --git a/include/Eden/gluttext.h b/include/Eden/gluttext.h deleted file mode 100644 index feab7f8..0000000 --- a/include/Eden/gluttext.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -// -// Updated by Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// -// Defines glut stroke and bitmap font functions for OpenGL ES-based platforms. -// - -#ifndef __gluttext_h__ -#define __gluttext_h__ - -#ifndef __Eden_h__ -# include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define APIENTRY - -#ifdef EDEN_OPENGLES -# define GLUTTEXT_BITMAP_ENABLE 0 -# define GLUTTEXT_STROKE_ENABLE 1 -#else -# define GLUTTEXT_BITMAP_ENABLE 0 -# define GLUTTEXT_STROKE_ENABLE 0 -#endif - -#if GLUTTEXT_STROKE_ENABLE - -/* Stroke font opaque addresses (use constants instead in source code). */ -extern const struct _StrokeFontRec glutStrokeRoman; -extern const struct _StrokeFontRec glutStrokeMonoRoman; - -/* Stroke font constants (use these in GLUT program). */ - -/* - A proportionally spaced Roman Simplex font for ASCII characters - 32 through 127. The maximum top character in the font is 119.05 - units; the bottom descends 33.33 units. - */ -#define GLUT_STROKE_ROMAN ((void *)&glutStrokeRoman) - -/* - A mono-spaced spaced Roman Simplex font (same characters as - GLUT_STROKE_ROMAN) for ASCII characters 32 through 127. The - maximum top character in the font is 119.05 units; the bottom - descends 33.33 units. Each character is 104.76 units wide. - */ -#define GLUT_STROKE_MONO_ROMAN ((void *)&glutStrokeMonoRoman) - -extern void glutStrokeCharacter(void *font, int character); -extern int glutStrokeWidth(void *font, int character); -extern int glutStrokeLength(void *font, const unsigned char *string); -#endif // GLUTTEXT_STROKE_ENABLE - -#if GLUTTEXT_BITMAP_ENABLE - -/* Bitmap font opaque addresses (use constants instead in source code). */ -extern const struct _BitmapFontRec glutBitmap9By15; -extern const struct _BitmapFontRec glutBitmap8By13; -extern const struct _BitmapFontRec glutBitmapTimesRoman10; -extern const struct _BitmapFontRec glutBitmapTimesRoman24; -extern const struct _BitmapFontRec glutBitmapHelvetica10; -extern const struct _BitmapFontRec glutBitmapHelvetica12; -extern const struct _BitmapFontRec glutBitmapHelvetica18; - -/* Bitmap font constants (use these in GLUT program). */ -#define GLUT_BITMAP_9_BY_15 ((void *)&glutBitmap9By15) -#define GLUT_BITMAP_8_BY_13 ((void *)&glutBitmap8By13) -#define GLUT_BITMAP_TIMES_ROMAN_10 ((void *)&glutBitmapTimesRoman10) -#define GLUT_BITMAP_TIMES_ROMAN_24 ((void *)&glutBitmapTimesRoman24) -#define GLUT_BITMAP_HELVETICA_10 ((void *)&glutBitmapHelvetica10) -#define GLUT_BITMAP_HELVETICA_12 ((void *)&glutBitmapHelvetica12) -#define GLUT_BITMAP_HELVETICA_18 ((void *)&glutBitmapHelvetica18) -extern void glutBitmapCharacter(void *font, int character); -extern int glutBitmapWidth(void *font, int character); -extern int glutBitmapLength(void *font, const unsigned char *string); -#endif // GLUTTEXT_BITMAP_ENABLE - -#ifdef __cplusplus -} -#endif -#endif // !__gluttext_h__ diff --git a/include/Eden/readtex.h b/include/Eden/readtex.h deleted file mode 100644 index ed5e226..0000000 --- a/include/Eden/readtex.h +++ /dev/null @@ -1,102 +0,0 @@ -/* readtex.h */ -/* - * Read an SGI .rgb image file and generate a mipmap texture set. - */ - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -/*! - @header readtex - @abstract Texture loading from file. - @discussion - readtex forms one part of the Eden library. - @copyright 2001-2013 Philip Lamb - */ - -#ifndef READTEX_H -#define READTEX_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __Eden_h__ -# include -#endif - -#include - -#ifdef EDEN_HAVE_LIBJPEG -/*! - @function - @abstract Read a JPEG file and return it as a raw buffer. - @discussion - Reads a JPEG image from a file into a raw buffer. JPEGs in mono and RGB format - are supported. - @param fp File pointer to open jpeg file. - @param w Pointer to location which will be filled with the width of the JPEG image in pixels, - or NULL if this is not required. - @param h Pointer to location which will be filled with the width of the JPEG image in pixels, - or NULL if this is not required. - @param nc Pointer to location which will be filled with the number of components in - the JPEG image in pixels, or NULL if this is not required. - @param dpi Pointer to location which will be filled with the resolution of the jpeg in - dots-per-inch, or NULL if this is not required. - @result A raw buffer holding the jpeg data, beginning with the first component of the - leftmost pixel of the uppermost scanline, and continuing by component, pixel, and line. - This buffer must be free()d when finished with. - */ -unsigned char *jpgread (FILE *fp, int *w, int *h, int *nc, float *dpi); -#endif // EDEN_HAVE_LIBJPEG - -/*! - @function - @abstract Read an image file and return it as a raw buffer. - @discussion - @param imageFile name of image to read. At present, images in SGI format (.sgi or .rgb) - and JPEG format (.jpg or .jpeg) are supported. - @param w Pointer to location which will be filled with the width of the image in pixels, - or NULL if this is not required. - @param h Pointer to location which will be filled with the width of the image in pixels, - or NULL if this is not required. - @param nc Pointer to location which will be filled with the number of components in - the image in pixels, or NULL if this is not required. - @result A raw buffer holding the image data, beginning with the first component of the - leftmost pixel of the uppermost scanline, and continuing by component, pixel, and line. - This buffer must be free()d when finished with. - */ -extern unsigned char *ReadTex(const char *imageFile, int *w, int *h, int *nc); - -#ifdef __cplusplus -} -#endif - -#endif /* !READTEX_H */ diff --git a/lib/SRC/Eden/ALFramework.cpp b/lib/SRC/Eden/ALFramework.cpp deleted file mode 100644 index 5f9fef0..0000000 --- a/lib/SRC/Eden/ALFramework.cpp +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright (c) 2006, Creative Labs Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted provided - * that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of conditions and - * the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - * and the following disclaimer in the documentation and/or other materials provided with the distribution. - * * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or - * promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#ifdef EDEN_HAVE_OPENAL - -// Win32 version of the Creative Labs OpenAL 1.1 Framework for samples -#include "ALFramework.h" -#ifdef __APPLE__ -# include -//# include -# include -#endif -#ifdef _WIN32 -# include "CWaves.h" -#endif -#include - -#ifdef _WIN32 -static CWaves *g_pWaveLoader = NULL; -#endif - -#ifdef _WIN32 -// Imported EFX functions - -// Effect objects -LPALGENEFFECTS alGenEffects = NULL; -LPALDELETEEFFECTS alDeleteEffects = NULL; -LPALISEFFECT alIsEffect = NULL; -LPALEFFECTI alEffecti = NULL; -LPALEFFECTIV alEffectiv = NULL; -LPALEFFECTF alEffectf = NULL; -LPALEFFECTFV alEffectfv = NULL; -LPALGETEFFECTI alGetEffecti = NULL; -LPALGETEFFECTIV alGetEffectiv = NULL; -LPALGETEFFECTF alGetEffectf = NULL; -LPALGETEFFECTFV alGetEffectfv = NULL; - -//Filter objects -LPALGENFILTERS alGenFilters = NULL; -LPALDELETEFILTERS alDeleteFilters = NULL; -LPALISFILTER alIsFilter = NULL; -LPALFILTERI alFilteri = NULL; -LPALFILTERIV alFilteriv = NULL; -LPALFILTERF alFilterf = NULL; -LPALFILTERFV alFilterfv = NULL; -LPALGETFILTERI alGetFilteri = NULL; -LPALGETFILTERIV alGetFilteriv = NULL; -LPALGETFILTERF alGetFilterf = NULL; -LPALGETFILTERFV alGetFilterfv = NULL; - -// Auxiliary slot object -LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots = NULL; -LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots = NULL; -LPALISAUXILIARYEFFECTSLOT alIsAuxiliaryEffectSlot = NULL; -LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti = NULL; -LPALAUXILIARYEFFECTSLOTIV alAuxiliaryEffectSlotiv = NULL; -LPALAUXILIARYEFFECTSLOTF alAuxiliaryEffectSlotf = NULL; -LPALAUXILIARYEFFECTSLOTFV alAuxiliaryEffectSlotfv = NULL; -LPALGETAUXILIARYEFFECTSLOTI alGetAuxiliaryEffectSloti = NULL; -LPALGETAUXILIARYEFFECTSLOTIV alGetAuxiliaryEffectSlotiv = NULL; -LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf = NULL; -LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv = NULL; - -// XRAM functions and enum values - -LPEAXSETBUFFERMODE eaxSetBufferMode = NULL; -LPEAXGETBUFFERMODE eaxGetBufferMode = NULL; -#endif // _WIN32 - -ALenum eXRAMSize = 0; -ALenum eXRAMFree = 0; -ALenum eXRAMAuto = 0; -ALenum eXRAMHardware = 0; -ALenum eXRAMAccessible = 0; - - -// Initialization and enumeration -void ALFWInit() -{ -#ifdef _WIN32 - g_pWaveLoader = new CWaves(); -#endif -} - -void ALFWShutdown() -{ -#ifdef _WIN32 - if (g_pWaveLoader) { - delete g_pWaveLoader; - g_pWaveLoader = NULL; - } -#endif -} - -ALboolean ALFWInitOpenAL() -{ - ALCcontext *pContext = NULL; - ALCdevice *pDevice = NULL; - ALboolean bReturn = AL_FALSE; - - pDevice = alcOpenDevice(NULL); - if (!pDevice) { - ALFWprintf("Error opening OpenAL audio device.\n"); - } else { - ALFWprintf("Opened OpenAL '%s' audio device.\n", alcGetString(pDevice, ALC_DEVICE_SPECIFIER)); - pContext = alcCreateContext(pDevice, NULL); - if (!pContext) { - ALFWprintf("Error creating OpenAL context.\n"); - alcCloseDevice(pDevice); - } else { - alcMakeContextCurrent(pContext); - bReturn = AL_TRUE; - } - } - - return bReturn; -} - -ALboolean ALFWShutdownOpenAL() -{ - ALCcontext *pContext; - ALCdevice *pDevice; - - pContext = alcGetCurrentContext(); - pDevice = alcGetContextsDevice(pContext); - - alcMakeContextCurrent(NULL); - alcDestroyContext(pContext); - if (alcCloseDevice(pDevice) != ALC_TRUE) { - ALFWprintf("Error closing OpenAL audio device.\n"); - } - - return AL_TRUE; -} - -#ifdef _WIN32 -ALboolean ALFWLoadWaveToBuffer(const char *szWaveFile, ALuint uiBufferID, ALenum eXRAMBufferMode) -{ - WAVEID WaveID; - ALint iDataSize, iFrequency; - ALenum eBufferFormat; - ALchar *pData; - ALboolean bReturn = AL_FALSE; - if (g_pWaveLoader) - { - if (SUCCEEDED(g_pWaveLoader->LoadWaveFile(szWaveFile, &WaveID))) - { - if ((SUCCEEDED(g_pWaveLoader->GetWaveSize(WaveID, (unsigned long*)&iDataSize))) && - (SUCCEEDED(g_pWaveLoader->GetWaveData(WaveID, (void**)&pData))) && - (SUCCEEDED(g_pWaveLoader->GetWaveFrequency(WaveID, (unsigned long*)&iFrequency))) && - (SUCCEEDED(g_pWaveLoader->GetWaveALBufferFormat(WaveID, &alGetEnumValue, (unsigned long*)&eBufferFormat)))) - { - // Set XRAM Mode (if application) - if (eaxSetBufferMode && eXRAMBufferMode) - eaxSetBufferMode(1, &uiBufferID, eXRAMBufferMode); - - alGetError(); - alBufferData(uiBufferID, eBufferFormat, pData, iDataSize, iFrequency); - if (alGetError() == AL_NO_ERROR) - bReturn = AL_TRUE; - - g_pWaveLoader->DeleteWaveFile(WaveID); - } - } - } - - return bReturn; -} -#endif // _WIN32 - -#ifdef __APPLE__ -ALboolean ALFWLoadFileToBuffer(const char *inFilePath, ALuint uiBufferID) -{ - OSStatus err = noErr; - UInt32 thePropertySize = 0; - ExtAudioFileRef extRef = NULL; - void *theData = NULL; - ALboolean bReturn = AL_FALSE; - AudioStreamBasicDescription theFileFormat; - AudioStreamBasicDescription theOutputFormat; - SInt64 theFileLengthInFrames; - UInt32 theFramesToRead; - UInt32 dataSize; - - CFURLRef fileURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8 *)inFilePath, (CFIndex)strlen(inFilePath), false); - err = ExtAudioFileOpenURL(fileURL, &extRef); - CFRelease(fileURL); - if (err) { - ALFWprintf("ALFWLoadFileToBuffer: ExtAudioFileOpenURL FAILED, Error = %d\n", (int)err); - goto done; - } - - // Get the audio data format - thePropertySize = sizeof(theFileFormat); - err = ExtAudioFileGetProperty(extRef, kExtAudioFileProperty_FileDataFormat, &thePropertySize, &theFileFormat); - if (err) { - ALFWprintf("ALFWLoadFileToBuffer: ExtAudioFileGetProperty(kExtAudioFileProperty_FileDataFormat) FAILED, Error = %d\n", (int)err); - goto done; - } - if (theFileFormat.mChannelsPerFrame > 2) { - ALFWprintf("ALFWLoadFileToBuffer - Unsupported Format, channel count is greater than stereo\n"); - goto done; - } - - // Set the client format to 16 bit signed integer (native-endian) data - // Maintain the channel count and sample rate of the original source format - theOutputFormat.mSampleRate = theFileFormat.mSampleRate; - theOutputFormat.mChannelsPerFrame = theFileFormat.mChannelsPerFrame; - - theOutputFormat.mFormatID = kAudioFormatLinearPCM; - theOutputFormat.mBytesPerPacket = 2 * theOutputFormat.mChannelsPerFrame; - theOutputFormat.mFramesPerPacket = 1; - theOutputFormat.mBytesPerFrame = 2 * theOutputFormat.mChannelsPerFrame; - theOutputFormat.mBitsPerChannel = 16; - theOutputFormat.mFormatFlags = kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger; - - // Set the desired client (output) data format - err = ExtAudioFileSetProperty(extRef, kExtAudioFileProperty_ClientDataFormat, sizeof(theOutputFormat), &theOutputFormat); - if (err) { - ALFWprintf("ALFWLoadFileToBuffer: ExtAudioFileSetProperty(kExtAudioFileProperty_ClientDataFormat) FAILED, Error = %d\n", (int)err); - goto done; - } - - // Get the total frame count - thePropertySize = sizeof(theFileLengthInFrames); - err = ExtAudioFileGetProperty(extRef, kExtAudioFileProperty_FileLengthFrames, &thePropertySize, &theFileLengthInFrames); - if (err) { - ALFWprintf("ALFWLoadFileToBuffer: ExtAudioFileGetProperty(kExtAudioFileProperty_FileLengthFrames) FAILED, Error = %d\n", (int)err); - goto done; - } - - // Read all the data into memory - theFramesToRead = (UInt32)theFileLengthInFrames; - dataSize = theFramesToRead * theOutputFormat.mBytesPerFrame;; - theData = malloc(dataSize); - if (theData) { - - AudioBufferList theDataBuffer; - theDataBuffer.mNumberBuffers = 1; - theDataBuffer.mBuffers[0].mDataByteSize = dataSize; - theDataBuffer.mBuffers[0].mNumberChannels = theOutputFormat.mChannelsPerFrame; - theDataBuffer.mBuffers[0].mData = theData; - - // Read the data into an AudioBufferList - err = ExtAudioFileRead(extRef, &theFramesToRead, &theDataBuffer); - if (err == noErr) { - // success - // Attach Audio Data to OpenAL Buffer - alBufferData(uiBufferID, (theOutputFormat.mChannelsPerFrame > 1) ? AL_FORMAT_STEREO16 : AL_FORMAT_MONO16, theData, (ALsizei)dataSize, (ALsizei)theOutputFormat.mSampleRate); - bReturn = AL_TRUE; - if (alGetError() != AL_NO_ERROR) { - ALFWprintf("ALFWLoadFileToBuffer: Error buffering data.\n"); - } - } else { - ALFWprintf("ALFWLoadFileToBuffer: ExtAudioFileRead FAILED, Error = %d\n", err); - } - free(theData); - } - -done: - if (extRef) ExtAudioFileDispose(extRef); - return bReturn; -} -#endif // __APPLE__ - -void ALFWprintf( const char* x, ... ) -{ - va_list args; - va_start( args, x ); - vprintf( x, args ); - va_end( args ); -} - -// Extension Queries - -ALboolean ALFWIsXRAMSupported() -{ - ALboolean bXRAM = AL_FALSE; - -#ifdef _WIN32 - if (alIsExtensionPresent("EAX-RAM") == AL_TRUE) - { - // Get X-RAM Function pointers - eaxSetBufferMode = (EAXSetBufferMode)alGetProcAddress("EAXSetBufferMode"); - eaxGetBufferMode = (EAXGetBufferMode)alGetProcAddress("EAXGetBufferMode"); - - if (eaxSetBufferMode && eaxGetBufferMode) - { - eXRAMSize = alGetEnumValue("AL_EAX_RAM_SIZE"); - eXRAMFree = alGetEnumValue("AL_EAX_RAM_FREE"); - eXRAMAuto = alGetEnumValue("AL_STORAGE_AUTOMATIC"); - eXRAMHardware = alGetEnumValue("AL_STORAGE_HARDWARE"); - eXRAMAccessible = alGetEnumValue("AL_STORAGE_ACCESSIBLE"); - - if (eXRAMSize && eXRAMFree && eXRAMAuto && eXRAMHardware && eXRAMAccessible) - bXRAM = AL_TRUE; - } - } -#endif // _WIN32 - - return bXRAM; -} - -ALboolean ALFWIsEFXSupported() -{ - ALboolean bEFXSupport = AL_FALSE; - -#ifdef _WIN32 - ALCcontext *pContext = alcGetCurrentContext(); - ALCdevice *pDevice = alcGetContextsDevice(pContext); - - if (alcIsExtensionPresent(pDevice, (ALCchar*)ALC_EXT_EFX_NAME)) - { - // Get function pointers - alGenEffects = (LPALGENEFFECTS)alGetProcAddress("alGenEffects"); - alDeleteEffects = (LPALDELETEEFFECTS )alGetProcAddress("alDeleteEffects"); - alIsEffect = (LPALISEFFECT )alGetProcAddress("alIsEffect"); - alEffecti = (LPALEFFECTI)alGetProcAddress("alEffecti"); - alEffectiv = (LPALEFFECTIV)alGetProcAddress("alEffectiv"); - alEffectf = (LPALEFFECTF)alGetProcAddress("alEffectf"); - alEffectfv = (LPALEFFECTFV)alGetProcAddress("alEffectfv"); - alGetEffecti = (LPALGETEFFECTI)alGetProcAddress("alGetEffecti"); - alGetEffectiv = (LPALGETEFFECTIV)alGetProcAddress("alGetEffectiv"); - alGetEffectf = (LPALGETEFFECTF)alGetProcAddress("alGetEffectf"); - alGetEffectfv = (LPALGETEFFECTFV)alGetProcAddress("alGetEffectfv"); - alGenFilters = (LPALGENFILTERS)alGetProcAddress("alGenFilters"); - alDeleteFilters = (LPALDELETEFILTERS)alGetProcAddress("alDeleteFilters"); - alIsFilter = (LPALISFILTER)alGetProcAddress("alIsFilter"); - alFilteri = (LPALFILTERI)alGetProcAddress("alFilteri"); - alFilteriv = (LPALFILTERIV)alGetProcAddress("alFilteriv"); - alFilterf = (LPALFILTERF)alGetProcAddress("alFilterf"); - alFilterfv = (LPALFILTERFV)alGetProcAddress("alFilterfv"); - alGetFilteri = (LPALGETFILTERI )alGetProcAddress("alGetFilteri"); - alGetFilteriv= (LPALGETFILTERIV )alGetProcAddress("alGetFilteriv"); - alGetFilterf = (LPALGETFILTERF )alGetProcAddress("alGetFilterf"); - alGetFilterfv= (LPALGETFILTERFV )alGetProcAddress("alGetFilterfv"); - alGenAuxiliaryEffectSlots = (LPALGENAUXILIARYEFFECTSLOTS)alGetProcAddress("alGenAuxiliaryEffectSlots"); - alDeleteAuxiliaryEffectSlots = (LPALDELETEAUXILIARYEFFECTSLOTS)alGetProcAddress("alDeleteAuxiliaryEffectSlots"); - alIsAuxiliaryEffectSlot = (LPALISAUXILIARYEFFECTSLOT)alGetProcAddress("alIsAuxiliaryEffectSlot"); - alAuxiliaryEffectSloti = (LPALAUXILIARYEFFECTSLOTI)alGetProcAddress("alAuxiliaryEffectSloti"); - alAuxiliaryEffectSlotiv = (LPALAUXILIARYEFFECTSLOTIV)alGetProcAddress("alAuxiliaryEffectSlotiv"); - alAuxiliaryEffectSlotf = (LPALAUXILIARYEFFECTSLOTF)alGetProcAddress("alAuxiliaryEffectSlotf"); - alAuxiliaryEffectSlotfv = (LPALAUXILIARYEFFECTSLOTFV)alGetProcAddress("alAuxiliaryEffectSlotfv"); - alGetAuxiliaryEffectSloti = (LPALGETAUXILIARYEFFECTSLOTI)alGetProcAddress("alGetAuxiliaryEffectSloti"); - alGetAuxiliaryEffectSlotiv = (LPALGETAUXILIARYEFFECTSLOTIV)alGetProcAddress("alGetAuxiliaryEffectSlotiv"); - alGetAuxiliaryEffectSlotf = (LPALGETAUXILIARYEFFECTSLOTF)alGetProcAddress("alGetAuxiliaryEffectSlotf"); - alGetAuxiliaryEffectSlotfv = (LPALGETAUXILIARYEFFECTSLOTFV)alGetProcAddress("alGetAuxiliaryEffectSlotfv"); - - if (alGenEffects && alDeleteEffects && alIsEffect && alEffecti && alEffectiv && alEffectf && - alEffectfv && alGetEffecti && alGetEffectiv && alGetEffectf && alGetEffectfv && alGenFilters && - alDeleteFilters && alIsFilter && alFilteri && alFilteriv && alFilterf && alFilterfv && - alGetFilteri && alGetFilteriv && alGetFilterf && alGetFilterfv && alGenAuxiliaryEffectSlots && - alDeleteAuxiliaryEffectSlots && alIsAuxiliaryEffectSlot && alAuxiliaryEffectSloti && - alAuxiliaryEffectSlotiv && alAuxiliaryEffectSlotf && alAuxiliaryEffectSlotfv && - alGetAuxiliaryEffectSloti && alGetAuxiliaryEffectSlotiv && alGetAuxiliaryEffectSlotf && - alGetAuxiliaryEffectSlotfv) - bEFXSupport = AL_TRUE; - } -#endif // _WIN32 - - return bEFXSupport; -} - -#endif // EDEN_HAVE_OPENAL - diff --git a/lib/SRC/Eden/ALFramework.h b/lib/SRC/Eden/ALFramework.h deleted file mode 100644 index abf9135..0000000 --- a/lib/SRC/Eden/ALFramework.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2006, Creative Labs Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted provided - * that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of conditions and - * the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - * and the following disclaimer in the documentation and/or other materials provided with the distribution. - * * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or - * promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ALFRAMEWORK_H_ -#define _ALFRAMEWORK_H_ - -#include -#ifdef __APPLE__ -# include -# include -#else -# include "al.h" -# include "alc.h" -# ifdef _WIN32 -# include -# include -# include -# include -# include "efx.h" -# include "efx-creative.h" -# include "xram.h" -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// Initialization and shutdown -void ALFWInit(); -void ALFWShutdown(); - -// OpenAL initialization and shutdown -ALboolean ALFWInitOpenAL(); -ALboolean ALFWShutdownOpenAL(); - -// File loading functions -#ifdef _WIN32 -ALboolean ALFWLoadWaveToBuffer(const char *szWaveFile, ALuint uiBufferID, ALenum eXRAMBufferMode = 0); -#endif -#ifdef __APPLE__ -ALboolean ALFWLoadFileToBuffer(const char *inFilePath, ALuint uiBufferID); -#endif - -// Extension Queries -ALboolean ALFWIsXRAMSupported(); -ALboolean ALFWIsEFXSupported(); - - -// Utilities -ALvoid ALFWprintf( const ALchar * x, ... ); - -#ifdef _WIN32 -// EFX Extension function pointer variables - -// Effect objects -extern LPALGENEFFECTS alGenEffects; -extern LPALDELETEEFFECTS alDeleteEffects; -extern LPALISEFFECT alIsEffect; -extern LPALEFFECTI alEffecti; -extern LPALEFFECTIV alEffectiv; -extern LPALEFFECTF alEffectf; -extern LPALEFFECTFV alEffectfv; -extern LPALGETEFFECTI alGetEffecti; -extern LPALGETEFFECTIV alGetEffectiv; -extern LPALGETEFFECTF alGetEffectf; -extern LPALGETEFFECTFV alGetEffectfv; - -// Filter objects -extern LPALGENFILTERS alGenFilters; -extern LPALDELETEFILTERS alDeleteFilters; -extern LPALISFILTER alIsFilter; -extern LPALFILTERI alFilteri; -extern LPALFILTERIV alFilteriv; -extern LPALFILTERF alFilterf; -extern LPALFILTERFV alFilterfv; -extern LPALGETFILTERI alGetFilteri; -extern LPALGETFILTERIV alGetFilteriv; -extern LPALGETFILTERF alGetFilterf; -extern LPALGETFILTERFV alGetFilterfv; - -// Auxiliary slot object -extern LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots; -extern LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots; -extern LPALISAUXILIARYEFFECTSLOT alIsAuxiliaryEffectSlot; -extern LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti; -extern LPALAUXILIARYEFFECTSLOTIV alAuxiliaryEffectSlotiv; -extern LPALAUXILIARYEFFECTSLOTF alAuxiliaryEffectSlotf; -extern LPALAUXILIARYEFFECTSLOTFV alAuxiliaryEffectSlotfv; -extern LPALGETAUXILIARYEFFECTSLOTI alGetAuxiliaryEffectSloti; -extern LPALGETAUXILIARYEFFECTSLOTIV alGetAuxiliaryEffectSlotiv; -extern LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf; -extern LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv; - -// XRAM Extension function pointer variables and enum values - -typedef ALboolean (__cdecl *LPEAXSETBUFFERMODE)(ALsizei n, ALuint *buffers, ALint value); -typedef ALenum (__cdecl *LPEAXGETBUFFERMODE)(ALuint buffer, ALint *value); - -extern LPEAXSETBUFFERMODE eaxSetBufferMode; -extern LPEAXGETBUFFERMODE eaxGetBufferMode; - -// X-RAM Enum values -extern ALenum eXRAMSize, eXRAMFree; -extern ALenum eXRAMAuto, eXRAMHardware, eXRAMAccessible; - -#endif // _WIN32 - -#ifdef __cplusplus -} -#endif - -#endif // !_ALFRAMEWORK_H_ diff --git a/lib/SRC/Eden/CWaves.cpp b/lib/SRC/Eden/CWaves.cpp deleted file mode 100644 index 720d4da..0000000 --- a/lib/SRC/Eden/CWaves.cpp +++ /dev/null @@ -1,688 +0,0 @@ -/* - * Copyright (c) 2006, Creative Labs Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted provided - * that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of conditions and - * the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - * and the following disclaimer in the documentation and/or other materials provided with the distribution. - * * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or - * promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#ifdef EDEN_HAVE_OPENAL - -#include "CWaves.h" - -#ifdef _WIN32 - -#include -#include -#include - -#pragma pack(push, 4) - -typedef struct -{ - char szRIFF[4]; - unsigned long ulRIFFSize; - char szWAVE[4]; -} WAVEFILEHEADER; - -typedef struct -{ - char szChunkName[4]; - unsigned long ulChunkSize; -} RIFFCHUNK; - -typedef struct -{ - unsigned short usFormatTag; - unsigned short usChannels; - unsigned long ulSamplesPerSec; - unsigned long ulAvgBytesPerSec; - unsigned short usBlockAlign; - unsigned short usBitsPerSample; - unsigned short usSize; - unsigned short usReserved; - unsigned long ulChannelMask; - GUID guidSubFormat; -} WAVEFMT; - -#pragma pack(pop) - -#if _MSC_VER <= 1310 - -// Wrap around the deprecated functions for VS2003 support -int fopen_s( FILE** pFile, const char *filename, const char *mode ) -{ - *pFile = fopen( filename, mode ); - - return *pFile ? 0 : EBADF; -} - -int strncpy_s( char *strDest, size_t numberOfElements, const char *strSource, size_t count ) -{ - strncpy( strDest, strSource, count ); - - return 0; -} - -#endif - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CWaves::CWaves() -{ - memset(&m_WaveIDs, 0, sizeof(m_WaveIDs)); -} - -CWaves::~CWaves() -{ - long lLoop; - - for (lLoop = 0; lLoop < MAX_NUM_WAVEID; lLoop++) - { - if (m_WaveIDs[lLoop]) - { - if (m_WaveIDs[lLoop]->pData) - delete m_WaveIDs[lLoop]->pData; - - if (m_WaveIDs[lLoop]->pFile) - fclose(m_WaveIDs[lLoop]->pFile); - - delete m_WaveIDs[lLoop]; - m_WaveIDs[lLoop] = 0; - } - } -} - - -WAVERESULT CWaves::LoadWaveFile(const char *szFilename, WAVEID *pWaveID) -{ - WAVERESULT wr = WR_OUTOFMEMORY; - LPWAVEFILEINFO pWaveInfo; - - pWaveInfo = new WAVEFILEINFO; - if (pWaveInfo) - { - if (SUCCEEDED(wr = ParseFile(szFilename, pWaveInfo))) - { - // Allocate memory for sample data - pWaveInfo->pData = new char[pWaveInfo->ulDataSize]; - if (pWaveInfo->pData) - { - // Seek to start of audio data - fseek(pWaveInfo->pFile, pWaveInfo->ulDataOffset, SEEK_SET); - - // Read Sample Data - if (fread(pWaveInfo->pData, 1, pWaveInfo->ulDataSize, pWaveInfo->pFile) == pWaveInfo->ulDataSize) - { - long lLoop = 0; - for (lLoop = 0; lLoop < MAX_NUM_WAVEID; lLoop++) - { - if (!m_WaveIDs[lLoop]) - { - m_WaveIDs[lLoop] = pWaveInfo; - *pWaveID = lLoop; - wr = WR_OK; - break; - } - } - - if (lLoop == MAX_NUM_WAVEID) - { - delete pWaveInfo->pData; - wr = WR_OUTOFMEMORY; - } - } - else - { - delete pWaveInfo->pData; - wr = WR_BADWAVEFILE; - } - } - else - { - wr = WR_OUTOFMEMORY; - } - - fclose(pWaveInfo->pFile); - pWaveInfo->pFile = 0; - } - - if (wr != WR_OK) - delete pWaveInfo; - } - - return wr; -} - - -WAVERESULT CWaves::OpenWaveFile(const char *szFilename, WAVEID *pWaveID) -{ - WAVERESULT wr = WR_OUTOFMEMORY; - LPWAVEFILEINFO pWaveInfo; - - pWaveInfo = new WAVEFILEINFO; - if (pWaveInfo) - { - if (SUCCEEDED(wr = ParseFile(szFilename, pWaveInfo))) - { - long lLoop = 0; - for (lLoop = 0; lLoop < MAX_NUM_WAVEID; lLoop++) - { - if (!m_WaveIDs[lLoop]) - { - m_WaveIDs[lLoop] = pWaveInfo; - *pWaveID = lLoop; - wr = WR_OK; - break; - } - } - - if (lLoop == MAX_NUM_WAVEID) - wr = WR_OUTOFMEMORY; - } - - if (wr != WR_OK) - delete pWaveInfo; - } - - return wr; -} - -WAVERESULT CWaves::ReadWaveData(WAVEID WaveID, void *pData, unsigned long ulDataSize, unsigned long *pulBytesWritten) -{ - LPWAVEFILEINFO pWaveInfo; - WAVERESULT wr = WR_BADWAVEFILE; - - if (!pData || !pulBytesWritten || ulDataSize == 0) - return WR_INVALIDPARAM; - - if (IsWaveID(WaveID)) - { - pWaveInfo = m_WaveIDs[WaveID]; - if (pWaveInfo->pFile) - { - unsigned long ulOffset = ftell(pWaveInfo->pFile); - - if ((ulOffset - pWaveInfo->ulDataOffset + ulDataSize) > pWaveInfo->ulDataSize) - ulDataSize = pWaveInfo->ulDataSize - (ulOffset - pWaveInfo->ulDataOffset); - - *pulBytesWritten = (unsigned long)fread(pData, 1, ulDataSize, pWaveInfo->pFile); - - wr = WR_OK; - } - } - else - { - wr = WR_INVALIDWAVEID; - } - - return wr; -} - -WAVERESULT CWaves::SetWaveDataOffset(WAVEID WaveID, unsigned long ulOffset) -{ - LPWAVEFILEINFO pWaveInfo; - WAVERESULT wr = WR_INVALIDPARAM; - - if (IsWaveID(WaveID)) - { - pWaveInfo = m_WaveIDs[WaveID]; - if (pWaveInfo->pFile) - { - // Seek into audio data - fseek(pWaveInfo->pFile, pWaveInfo->ulDataOffset + ulOffset, SEEK_SET); - wr = WR_OK; - } - } - else - { - wr = WR_INVALIDWAVEID; - } - - return wr; -} - -WAVERESULT CWaves::GetWaveDataOffset(WAVEID WaveID, unsigned long *pulOffset) -{ - LPWAVEFILEINFO pWaveInfo; - WAVERESULT wr = WR_INVALIDPARAM; - - if (IsWaveID(WaveID)) - { - pWaveInfo = m_WaveIDs[WaveID]; - if ((pWaveInfo->pFile) && (pulOffset)) - { - // Get current position - *pulOffset = ftell(pWaveInfo->pFile); - *pulOffset -= pWaveInfo->ulDataOffset; - wr = WR_OK; - } - } - else - { - wr = WR_INVALIDWAVEID; - } - - return wr; -} - -WAVERESULT CWaves::ParseFile(const char *szFilename, LPWAVEFILEINFO pWaveInfo) -{ - WAVEFILEHEADER waveFileHeader; - RIFFCHUNK riffChunk; - WAVEFMT waveFmt; - WAVERESULT wr = WR_BADWAVEFILE; - - if (!szFilename || !pWaveInfo) - return WR_INVALIDPARAM; - - memset(pWaveInfo, 0, sizeof(WAVEFILEINFO)); - - // Open the wave file for reading - fopen_s(&pWaveInfo->pFile, szFilename, "rb"); - if (pWaveInfo->pFile) - { - // Read Wave file header - fread(&waveFileHeader, 1, sizeof(WAVEFILEHEADER), pWaveInfo->pFile); - if (!_strnicmp(waveFileHeader.szRIFF, "RIFF", 4) && !_strnicmp(waveFileHeader.szWAVE, "WAVE", 4)) - { - while (fread(&riffChunk, 1, sizeof(RIFFCHUNK), pWaveInfo->pFile) == sizeof(RIFFCHUNK)) - { - if (!_strnicmp(riffChunk.szChunkName, "fmt ", 4)) - { - if (riffChunk.ulChunkSize <= sizeof(WAVEFMT)) - { - fread(&waveFmt, 1, riffChunk.ulChunkSize, pWaveInfo->pFile); - - // Determine if this is a WAVEFORMATEX or WAVEFORMATEXTENSIBLE wave file - if (waveFmt.usFormatTag == WAVE_FORMAT_PCM) - { - pWaveInfo->wfType = WF_EX; - memcpy(&pWaveInfo->wfEXT.Format, &waveFmt, sizeof(PCMWAVEFORMAT)); - } - else if (waveFmt.usFormatTag == WAVE_FORMAT_EXTENSIBLE) - { - pWaveInfo->wfType = WF_EXT; - memcpy(&pWaveInfo->wfEXT, &waveFmt, sizeof(WAVEFORMATEXTENSIBLE)); - } - } - else - { - fseek(pWaveInfo->pFile, riffChunk.ulChunkSize, SEEK_CUR); - } - } - else if (!_strnicmp(riffChunk.szChunkName, "data", 4)) - { - pWaveInfo->ulDataSize = riffChunk.ulChunkSize; - pWaveInfo->ulDataOffset = ftell(pWaveInfo->pFile); - fseek(pWaveInfo->pFile, riffChunk.ulChunkSize, SEEK_CUR); - } - else - { - fseek(pWaveInfo->pFile, riffChunk.ulChunkSize, SEEK_CUR); - } - - // Ensure that we are correctly aligned for next chunk - if (riffChunk.ulChunkSize & 1) - fseek(pWaveInfo->pFile, 1, SEEK_CUR); - } - - if (pWaveInfo->ulDataSize && pWaveInfo->ulDataOffset && ((pWaveInfo->wfType == WF_EX) || (pWaveInfo->wfType == WF_EXT))) - wr = WR_OK; - else - fclose(pWaveInfo->pFile); - } - } - else - { - wr = WR_INVALIDFILENAME; - } - - return wr; -} - - -WAVERESULT CWaves::DeleteWaveFile(WAVEID WaveID) -{ - WAVERESULT wr = WR_OK; - - if (IsWaveID(WaveID)) - { - if (m_WaveIDs[WaveID]->pData) - delete m_WaveIDs[WaveID]->pData; - - if (m_WaveIDs[WaveID]->pFile) - fclose(m_WaveIDs[WaveID]->pFile); - - delete m_WaveIDs[WaveID]; - m_WaveIDs[WaveID] = 0; - } - else - { - wr = WR_INVALIDWAVEID; - } - - return wr; -} - - -WAVERESULT CWaves::GetWaveType(WAVEID WaveID, WAVEFILETYPE *wfType) -{ - if (!IsWaveID(WaveID)) - return WR_INVALIDWAVEID; - - if (!wfType) - return WR_INVALIDPARAM; - - *wfType = m_WaveIDs[WaveID]->wfType; - - return WR_OK; -} - - -WAVERESULT CWaves::GetWaveFormatExHeader(WAVEID WaveID, WAVEFORMATEX *wfex) -{ - if (!IsWaveID(WaveID)) - return WR_INVALIDWAVEID; - - if (!wfex) - return WR_INVALIDPARAM; - - memcpy(wfex, &(m_WaveIDs[WaveID]->wfEXT.Format), sizeof(WAVEFORMATEX)); - - return WR_OK; -} - - -WAVERESULT CWaves::GetWaveFormatExtensibleHeader(WAVEID WaveID, WAVEFORMATEXTENSIBLE *wfext) -{ - if (!IsWaveID(WaveID)) - return WR_INVALIDWAVEID; - - if (m_WaveIDs[WaveID]->wfType != WF_EXT) - return WR_NOTWAVEFORMATEXTENSIBLEFORMAT; - - if (!wfext) - return WR_INVALIDPARAM; - - memcpy(wfext, &(m_WaveIDs[WaveID]->wfEXT), sizeof(WAVEFORMATEXTENSIBLE)); - - return WR_OK; -} - -WAVERESULT CWaves::GetWaveData(WAVEID WaveID, void **lplpAudioData) -{ - if (!IsWaveID(WaveID)) - return WR_INVALIDWAVEID; - - if (!lplpAudioData) - return WR_INVALIDPARAM; - - *lplpAudioData = m_WaveIDs[WaveID]->pData; - - return WR_OK; -} - -WAVERESULT CWaves::GetWaveSize(WAVEID WaveID, unsigned long *size) -{ - if (!IsWaveID(WaveID)) - return WR_INVALIDWAVEID; - - if (!size) - return WR_INVALIDPARAM; - - *size = m_WaveIDs[WaveID]->ulDataSize; - - return WR_OK; -} - - -WAVERESULT CWaves::GetWaveFrequency(WAVEID WaveID, unsigned long *pulFrequency) -{ - WAVERESULT wr = WR_OK; - - if (IsWaveID(WaveID)) - { - if (pulFrequency) - *pulFrequency = m_WaveIDs[WaveID]->wfEXT.Format.nSamplesPerSec; - else - wr = WR_INVALIDPARAM; - } - else - { - wr = WR_INVALIDWAVEID; - } - - return wr; -} - - -WAVERESULT CWaves::GetWaveALBufferFormat(WAVEID WaveID, PFNALGETENUMVALUE pfnGetEnumValue, unsigned long *pulFormat) -{ - WAVERESULT wr = WR_OK; - - if (IsWaveID(WaveID)) - { - if (pfnGetEnumValue && pulFormat) - { - *pulFormat = 0; - - if (m_WaveIDs[WaveID]->wfType == WF_EX) - { - if (m_WaveIDs[WaveID]->wfEXT.Format.nChannels == 1) - { - switch (m_WaveIDs[WaveID]->wfEXT.Format.wBitsPerSample) - { - case 4: - *pulFormat = pfnGetEnumValue("AL_FORMAT_MONO_IMA4"); - break; - case 8: - *pulFormat = pfnGetEnumValue("AL_FORMAT_MONO8"); - break; - case 16: - *pulFormat = pfnGetEnumValue("AL_FORMAT_MONO16"); - break; - } - } - else if (m_WaveIDs[WaveID]->wfEXT.Format.nChannels == 2) - { - switch (m_WaveIDs[WaveID]->wfEXT.Format.wBitsPerSample) - { - case 4: - *pulFormat = pfnGetEnumValue("AL_FORMAT_STEREO_IMA4"); - break; - case 8: - *pulFormat = pfnGetEnumValue("AL_FORMAT_STEREO8"); - break; - case 16: - *pulFormat = pfnGetEnumValue("AL_FORMAT_STEREO16"); - break; - } - } - else if ((m_WaveIDs[WaveID]->wfEXT.Format.nChannels == 4) && (m_WaveIDs[WaveID]->wfEXT.Format.wBitsPerSample == 16)) - *pulFormat = pfnGetEnumValue("AL_FORMAT_QUAD16"); - } - else if (m_WaveIDs[WaveID]->wfType == WF_EXT) - { - if ((m_WaveIDs[WaveID]->wfEXT.Format.nChannels == 1) && - ((m_WaveIDs[WaveID]->wfEXT.dwChannelMask == SPEAKER_FRONT_CENTER) || - (m_WaveIDs[WaveID]->wfEXT.dwChannelMask == (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT)) || - (m_WaveIDs[WaveID]->wfEXT.dwChannelMask == 0))) - { - switch (m_WaveIDs[WaveID]->wfEXT.Format.wBitsPerSample) - { - case 4: - *pulFormat = pfnGetEnumValue("AL_FORMAT_MONO_IMA4"); - break; - case 8: - *pulFormat = pfnGetEnumValue("AL_FORMAT_MONO8"); - break; - case 16: - *pulFormat = pfnGetEnumValue("AL_FORMAT_MONO16"); - break; - } - } - else if ((m_WaveIDs[WaveID]->wfEXT.Format.nChannels == 2) && (m_WaveIDs[WaveID]->wfEXT.dwChannelMask == (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT))) - { - switch (m_WaveIDs[WaveID]->wfEXT.Format.wBitsPerSample) - { - case 4: - *pulFormat = pfnGetEnumValue("AL_FORMAT_STEREO_IMA4"); - break; - case 8: - *pulFormat = pfnGetEnumValue("AL_FORMAT_STEREO8"); - break; - case 16: - *pulFormat = pfnGetEnumValue("AL_FORMAT_STEREO16"); - break; - } - } - else if ((m_WaveIDs[WaveID]->wfEXT.Format.nChannels == 2) && (m_WaveIDs[WaveID]->wfEXT.Format.wBitsPerSample == 16) && (m_WaveIDs[WaveID]->wfEXT.dwChannelMask == (SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT))) - *pulFormat = pfnGetEnumValue("AL_FORMAT_REAR16"); - else if ((m_WaveIDs[WaveID]->wfEXT.Format.nChannels == 4) && (m_WaveIDs[WaveID]->wfEXT.Format.wBitsPerSample == 16) && (m_WaveIDs[WaveID]->wfEXT.dwChannelMask == (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT))) - *pulFormat = pfnGetEnumValue("AL_FORMAT_QUAD16"); - else if ((m_WaveIDs[WaveID]->wfEXT.Format.nChannels == 6) && (m_WaveIDs[WaveID]->wfEXT.Format.wBitsPerSample == 16) && (m_WaveIDs[WaveID]->wfEXT.dwChannelMask == (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT))) - *pulFormat = pfnGetEnumValue("AL_FORMAT_51CHN16"); - else if ((m_WaveIDs[WaveID]->wfEXT.Format.nChannels == 7) && (m_WaveIDs[WaveID]->wfEXT.Format.wBitsPerSample == 16) && (m_WaveIDs[WaveID]->wfEXT.dwChannelMask == (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_BACK_CENTER))) - *pulFormat = pfnGetEnumValue("AL_FORMAT_61CHN16"); - else if ((m_WaveIDs[WaveID]->wfEXT.Format.nChannels == 8) && (m_WaveIDs[WaveID]->wfEXT.Format.wBitsPerSample == 16) && (m_WaveIDs[WaveID]->wfEXT.dwChannelMask == (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT))) - *pulFormat = pfnGetEnumValue("AL_FORMAT_71CHN16"); - } - - if (*pulFormat == 0) - wr = WR_INVALIDWAVEFILETYPE; - } - else - { - wr = WR_INVALIDPARAM; - } - } - else - { - wr = WR_INVALIDWAVEID; - } - - return wr; -} - - -bool CWaves::IsWaveID(WAVEID WaveID) -{ - bool bReturn = false; - - if ((WaveID >= 0) && (WaveID < MAX_NUM_WAVEID)) - { - if (m_WaveIDs[WaveID]) - bReturn = true; - } - - return bReturn; -} - - -char *CWaves::GetErrorString(WAVERESULT wr, char *szErrorString, unsigned long nSizeOfErrorString) -{ - switch (wr) - { - case WR_OK: - strncpy_s(szErrorString, nSizeOfErrorString, "Success\n", nSizeOfErrorString-1); - break; - - case WR_INVALIDFILENAME: - strncpy_s(szErrorString, nSizeOfErrorString, "Invalid file name or file does not exist\n", nSizeOfErrorString-1); - break; - - case WR_BADWAVEFILE: - strncpy_s(szErrorString, nSizeOfErrorString, "Invalid Wave file\n", nSizeOfErrorString-1); - break; - - case WR_INVALIDPARAM: - strncpy_s(szErrorString, nSizeOfErrorString, "Invalid parameter passed to function\n", nSizeOfErrorString-1); - break; - - case WR_FILEERROR: - strncpy_s(szErrorString, nSizeOfErrorString, "File I/O error\n", nSizeOfErrorString-1); - break; - - case WR_INVALIDWAVEID: - strncpy_s(szErrorString, nSizeOfErrorString, "Invalid WAVEID\n", nSizeOfErrorString-1); - break; - - case WR_NOTSUPPORTEDYET: - strncpy_s(szErrorString, nSizeOfErrorString, "Function not supported yet\n", nSizeOfErrorString-1); - break; - - case WR_WAVEMUSTBEMONO: - strncpy_s(szErrorString, nSizeOfErrorString, "Input wave files must be mono\n", nSizeOfErrorString-1); - break; - - case WR_WAVEMUSTBEWAVEFORMATPCM: - strncpy_s(szErrorString, nSizeOfErrorString, "Input wave files must be in Wave Format PCM\n", nSizeOfErrorString-1); - break; - - case WR_WAVESMUSTHAVESAMEBITRESOLUTION: - strncpy_s(szErrorString, nSizeOfErrorString, "Input wave files must have the same Bit Resolution\n", nSizeOfErrorString-1); - break; - - case WR_WAVESMUSTHAVESAMEFREQUENCY: - strncpy_s(szErrorString, nSizeOfErrorString, "Input wave files must have the same Frequency\n", nSizeOfErrorString-1); - break; - - case WR_WAVESMUSTHAVESAMEBITRATE: - strncpy_s(szErrorString, nSizeOfErrorString, "Input wave files must have the same Bit Rate\n", nSizeOfErrorString-1); - break; - - case WR_WAVESMUSTHAVESAMEBLOCKALIGNMENT: - strncpy_s(szErrorString, nSizeOfErrorString, "Input wave files must have the same Block Alignment\n", nSizeOfErrorString-1); - break; - - case WR_OFFSETOUTOFDATARANGE: - strncpy_s(szErrorString, nSizeOfErrorString, "Wave files Offset is not within audio data\n", nSizeOfErrorString-1); - break; - - case WR_INVALIDSPEAKERPOS: - strncpy_s(szErrorString, nSizeOfErrorString, "Invalid Speaker Destinations\n", nSizeOfErrorString-1); - break; - - case WR_OUTOFMEMORY: - strncpy_s(szErrorString, nSizeOfErrorString, "Out of memory\n", nSizeOfErrorString-1); - break; - - case WR_INVALIDWAVEFILETYPE: - strncpy_s(szErrorString, nSizeOfErrorString, "Invalid Wave File Type\n", nSizeOfErrorString-1); - break; - - case WR_NOTWAVEFORMATEXTENSIBLEFORMAT: - strncpy_s(szErrorString, nSizeOfErrorString, "Wave file is not in WAVEFORMATEXTENSIBLE format\n", nSizeOfErrorString-1); - break; - - default: - strncpy_s(szErrorString, nSizeOfErrorString, "Undefined error\n", nSizeOfErrorString-1); - } - szErrorString[nSizeOfErrorString-1] = '\0'; - return szErrorString; -} - -#endif // _WIN32 - -#endif // EDEN_HAVE_OPENAL - diff --git a/lib/SRC/Eden/CWaves.h b/lib/SRC/Eden/CWaves.h deleted file mode 100644 index c00c9ad..0000000 --- a/lib/SRC/Eden/CWaves.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2006, Creative Labs Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted provided - * that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of conditions and - * the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - * and the following disclaimer in the documentation and/or other materials provided with the distribution. - * * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or - * promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -// Waves.h: interface for the CWaves class. -// -////////////////////////////////////////////////////////////////////// - -#ifndef _CWAVES_H_ -#define _CWAVES_H_ - -#ifdef _WIN32 - -#include -#include - -#define MAX_NUM_WAVEID 1024 - -enum WAVEFILETYPE -{ - WF_EX = 1, - WF_EXT = 2 -}; - -enum WAVERESULT -{ - WR_OK = 0, - WR_INVALIDFILENAME = - 1, - WR_BADWAVEFILE = - 2, - WR_INVALIDPARAM = - 3, - WR_INVALIDWAVEID = - 4, - WR_NOTSUPPORTEDYET = - 5, - WR_WAVEMUSTBEMONO = - 6, - WR_WAVEMUSTBEWAVEFORMATPCM = - 7, - WR_WAVESMUSTHAVESAMEBITRESOLUTION = - 8, - WR_WAVESMUSTHAVESAMEFREQUENCY = - 9, - WR_WAVESMUSTHAVESAMEBITRATE = -10, - WR_WAVESMUSTHAVESAMEBLOCKALIGNMENT = -11, - WR_OFFSETOUTOFDATARANGE = -12, - WR_FILEERROR = -13, - WR_OUTOFMEMORY = -14, - WR_INVALIDSPEAKERPOS = -15, - WR_INVALIDWAVEFILETYPE = -16, - WR_NOTWAVEFORMATEXTENSIBLEFORMAT = -17 -}; - -#ifndef _WAVEFORMATEX_ -#define _WAVEFORMATEX_ -typedef struct tWAVEFORMATEX -{ - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; - WORD wBitsPerSample; - WORD cbSize; -} WAVEFORMATEX; -#endif /* _WAVEFORMATEX_ */ - -#ifndef _WAVEFORMATEXTENSIBLE_ -#define _WAVEFORMATEXTENSIBLE_ -typedef struct { - WAVEFORMATEX Format; - union { - WORD wValidBitsPerSample; /* bits of precision */ - WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */ - WORD wReserved; /* If neither applies, set to zero. */ - } Samples; - DWORD dwChannelMask; /* which channels are */ - /* present in stream */ - GUID SubFormat; -} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; -#endif // !_WAVEFORMATEXTENSIBLE_ - -typedef struct -{ - WAVEFILETYPE wfType; - WAVEFORMATEXTENSIBLE wfEXT; // For non-WAVEFORMATEXTENSIBLE wavefiles, the header is stored in the Format member of wfEXT - char *pData; - unsigned long ulDataSize; - FILE *pFile; - unsigned long ulDataOffset; -} WAVEFILEINFO, *LPWAVEFILEINFO; - -typedef int (__cdecl *PFNALGETENUMVALUE)( const char *szEnumName ); -typedef int WAVEID; - -class CWaves -{ -public: - CWaves(); - virtual ~CWaves(); - - WAVERESULT LoadWaveFile(const char *szFilename, WAVEID *WaveID); - WAVERESULT OpenWaveFile(const char *szFilename, WAVEID *WaveID); - WAVERESULT ReadWaveData(WAVEID WaveID, void *pData, unsigned long ulDataSize, unsigned long *pulBytesWritten); - WAVERESULT SetWaveDataOffset(WAVEID WaveID, unsigned long ulOffset); - WAVERESULT GetWaveDataOffset(WAVEID WaveID, unsigned long *pulOffset); - WAVERESULT GetWaveType(WAVEID WaveID, WAVEFILETYPE *pwfType); - WAVERESULT GetWaveFormatExHeader(WAVEID WaveID, WAVEFORMATEX *pWFEX); - WAVERESULT GetWaveFormatExtensibleHeader(WAVEID WaveID, WAVEFORMATEXTENSIBLE *pWFEXT); - WAVERESULT GetWaveData(WAVEID WaveID, void **ppAudioData); - WAVERESULT GetWaveSize(WAVEID WaveID, unsigned long *pulDataSize); - WAVERESULT GetWaveFrequency(WAVEID WaveID, unsigned long *pulFrequency); - WAVERESULT GetWaveALBufferFormat(WAVEID WaveID, PFNALGETENUMVALUE pfnGetEnumValue, unsigned long *pulFormat); - WAVERESULT DeleteWaveFile(WAVEID WaveID); - - char *GetErrorString(WAVERESULT wr, char *szErrorString, unsigned long nSizeOfErrorString); - bool IsWaveID(WAVEID WaveID); - -private: - WAVERESULT ParseFile(const char *szFilename, LPWAVEFILEINFO pWaveInfo); - WAVEID InsertWaveID(LPWAVEFILEINFO pWaveFileInfo); - - LPWAVEFILEINFO m_WaveIDs[MAX_NUM_WAVEID]; -}; - -#endif // _WIN32 - -#endif // _CWAVES_H_ diff --git a/lib/SRC/Eden/EdenError.c b/lib/SRC/Eden/EdenError.c deleted file mode 100644 index 556f060..0000000 --- a/lib/SRC/Eden/EdenError.c +++ /dev/null @@ -1,141 +0,0 @@ -// -// EdenError.c -// -// Copyright (c) 2004-2012 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0.0 2004-06-01 PRL Pulled together from other headers. -// -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// ============================================================================ -// Includes -// ============================================================================ - -#include -//#include // va_list, va_start(), va_end() -#include // EINVAL, ERANGE -#include - - -// ============================================================================ -// Private types and defines -// ============================================================================ - -typedef struct _ERROR_MESSAGE_t { - EDEN_E_t code; - char *message; -} ERROR_MESSAGE_t; - -// ============================================================================ -// Private globals. -// ============================================================================ -const ERROR_MESSAGE_t gErrorMessages[] = { - - { EDEN_E_NONE, "No error" }, - { EDEN_E_OUT_OF_MEMORY, "Out of memory" }, - { EDEN_E_OVERFLOW, "Overflow" }, - { EDEN_E_NODATA, "Data was requested but none was available" }, - { EDEN_E_IOERROR, "Error during input / output operation" }, - { EDEN_E_EOF, "End of file" }, - { EDEN_E_TIMEOUT, "Timed out" }, - { EDEN_E_INVALID_COMMAND, "Invalid command" }, - { EDEN_E_INVALID_ENUM, "Invalid enumeration" }, - { EDEN_E_THREADS, "An error occurred during a thread management operation" }, - { EDEN_E_FILE_NOT_FOUND, "File not found" }, - { EDEN_E_LENGTH_UNAVAILABLE, "Length not available" }, - { EDEN_E_GENERIC, "Error" }, - - { EDEN_E_LIBRARY_NOT_AVAILABLE, "A required library is not installed"}, - { EDEN_E_LIBRARY_TOO_OLD, "The minimum version requirement of a library was not met"}, - { EDEN_E_LIBRARY_TOO_NEW, "The maximum version requirement of a library was not met"}, - { EDEN_E_GENERIC_TOOLBOX, "System error" }, - - { EDEN_E_HARDWARE_NOT_AVAILABLE, "Required hardware is not available" }, - { EDEN_E_BIRD_CONFIGURATION, "The bird hardware is incorrectly configured" }, - { EDEN_E_BIRD_PHASEERROR, "Data from the bird arrived out-of-phase" }, - { EDEN_E_HARDWARE_GENERIC, "Hardware error" }, - - { EDEN_E_NET_NOT_AVAILABLE, "Network not available" }, - { EDEN_E_NET_NOT_CONNECTED, "Network not connected" }, - { EDEN_E_NET_GENERIC, "Network error" }, - -}; -const char gErrorMessageUnknown[] = "Unknown error"; -#define EDEN_ERROR_MESSAGES_SIZE (sizeof(gErrorMessages) / sizeof(gErrorMessages[0])) - -// ============================================================================ -// Public functions. -// ============================================================================ - -const char *EdenError_strerror(const EDEN_E_t code) -{ - int i; - - // Do a lame linear search. Is there a better way? - for (i = 0; i < EDEN_ERROR_MESSAGES_SIZE; i++) { - if (gErrorMessages[i].code == code) { - return (gErrorMessages[i].message); - } - } - return (gErrorMessageUnknown); -} - -int EdenError_strerror_r(const EDEN_E_t code, char *strerrbuf, const size_t buflen) -{ - int i; - - for (i = 0; i < EDEN_ERROR_MESSAGES_SIZE; i++) { - if (gErrorMessages[i].code == code) { - strncpy(strerrbuf, gErrorMessages[i].message, buflen); - if ((strlen(gErrorMessages[i].message) + 1) >= buflen) { - strerrbuf[buflen - 1] = '\0'; - return (ERANGE); - } else { - return (0); - } - } - } - strncpy(strerrbuf, gErrorMessageUnknown, buflen); - if ((strlen(gErrorMessageUnknown) + 1) >= buflen) { - strerrbuf[buflen - 1] = '\0'; - return (ERANGE); - } else { - return (EINVAL); - } -} - -void EdenError_perror(const EDEN_E_t code, const char *string) -{ - EDEN_LOGe((string ? "%s: %s" : "%s%s\n"), (string ? string : ""), EdenError_strerror(code)); -} diff --git a/lib/SRC/Eden/EdenGLFont.c b/lib/SRC/Eden/EdenGLFont.c deleted file mode 100644 index e912840..0000000 --- a/lib/SRC/Eden/EdenGLFont.c +++ /dev/null @@ -1,600 +0,0 @@ -// -// EdenGLFont.c -// The Eden Library -// -// Copyright (c) 2001-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// Some portions of font loading code based on code by Jeff Molofee, 1999, http://nehe.gamedev.net/ -// -// Rev Date Who Changes -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// ============================================================================ -// Private includes. -// ============================================================================ - -#include - -#include // calloc() -#include - -// EdenSurfaces also does OpenGL header inclusion. -#include // TEXTURE_INFO_t, TEXTURE_INDEX_t, SurfacesTextureLoad(), SurfacesTextureSet(), SurfacesTextureUnload() -#ifdef EDEN_OPENGLES -# include -#else -# ifdef __APPLE__ -# include -# else -# include "GL/glut.h" -# endif -# define DISABLE_GL_STATE_CACHE -#endif -#include "glStateCache.h" - - -// ============================================================================ -// Private types and definitions. -// ============================================================================ - -typedef enum { - EDEN_GL_FONT_TYPE_TEXTURE, - EDEN_GL_FONT_TYPE_GLUT_STROKE, -} EDEN_GL_FONT_TYPE; - -struct _EDEN_GL_FONT_INFO_t { - EDEN_GL_FONT_TYPE type; - char *fontName; - char *fontDataPathname; // Pointer to font resources. For texture fonts, pathname to a texure. For GLUT fonts, NULL. - float naturalHeight; - EDEN_BOOL monospaced; - float naturalWidthIfMonospaced; - void *tsi; // Type-specific info. For texture fonts, pointer to TEXTURE_INFO_t. For GLUT fonts, the GLUT font name. -}; - -// When EDEN_GL_FONT_INFO_t.type==EDEN_GL_FONT_TYPE_TEXTURE, tsi will be a pointer to this structure. -typedef struct _EDEN_GL_FONT_TEXTURE_INFO { - TEXTURE_INFO_t textureInfo; - TEXTURE_INDEX_t *textureIndexPerContext; // Dynamically allocated to size gContextsActiveCount. - int refCount; // Incremented each time loadTexture() is called, decremented each time unloadTexture() is called. When decremented to zero, this whole structure will be deallocated and parent ref set to NULL. -} EDEN_GL_FONT_TEXTURE_INFO; - -typedef struct _EDEN_GL_FONT_VIEW_SETTINGS { - float width; - float height; - float pixelsPerInch; -} EDEN_GL_FONT_VIEW_SETTINGS; - -typedef struct _EDEN_GL_FONT_FORMATTING_SETTINGS { - float characterSpacing; - float lineSpacing; - float wordExtraSpacing; -} EDEN_GL_FONT_FORMATTING_SETTINGS; - -typedef struct _EDEN_GL_FONT_FONT_SETTINGS { - EDEN_GL_FONT_INFO_t *font; - float size; -} EDEN_GL_FONT_FONT_SETTINGS; - -// ============================================================================ -// Globals -// ============================================================================ - -// Predefined fonts. -static EDEN_GL_FONT_INFO_t geneva = { - EDEN_GL_FONT_TYPE_TEXTURE, - "Geneva", - "Geneva_bitmap.sgi", - 32.0f, - TRUE, - 16.0f, - NULL -}; -EDEN_GL_FONT_INFO_t *const EDEN_GL_FONT_ID_Bitmap16_Geneva = &geneva; -static EDEN_GL_FONT_INFO_t ocrb10 = { - EDEN_GL_FONT_TYPE_TEXTURE, - "OCR-B-10", - "OCR-B-10_bitmap.sgi", - 26.25f, // Looks best at 26.25f. - TRUE, - 16.0f, // Looks best at 16.0f. - NULL -}; -EDEN_GL_FONT_INFO_t *const EDEN_GL_FONT_ID_Bitmap16_OCR_B_10 = &ocrb10; -static EDEN_GL_FONT_INFO_t roman = { - EDEN_GL_FONT_TYPE_GLUT_STROKE, - "Roman", - NULL, - 119.05f, - FALSE, - 0.0f, - GLUT_STROKE_ROMAN -}; -EDEN_GL_FONT_INFO_t *const EDEN_GL_FONT_ID_Stroke_Roman = &roman; -static EDEN_GL_FONT_INFO_t monoroman = { - EDEN_GL_FONT_TYPE_GLUT_STROKE, - "Mono Roman", - NULL, - 119.05f, - TRUE, - 104.76f, - GLUT_STROKE_MONO_ROMAN -}; -EDEN_GL_FONT_INFO_t *const EDEN_GL_FONT_ID_Stroke_MonoRoman = &monoroman; - -static int gContextsActiveCount = 0; -static EDEN_BOOL gInited = FALSE; // Set to TRUE once EdenGLFontInit() has succesfully completed. - -static EDEN_GL_FONT_VIEW_SETTINGS gViewSettings = { - 0.0f, - 0.0f, - 72.0f -}; -static EDEN_GL_FONT_FORMATTING_SETTINGS gFormattingSettings = { - 0.0625f, - 1.125f, - 1.0f -}; -static EDEN_GL_FONT_FONT_SETTINGS gFontSettings = { - &monoroman, - 16.0f -}; - -// ============================================================================ -// Private functions -// ============================================================================ - -// ============================================================================ -// Public functions -// ============================================================================ - -EDEN_BOOL EdenGLFontInit(const int contextsActiveCount) -{ - // Sanity check - if (gInited) return (FALSE); - - gContextsActiveCount = contextsActiveCount; - gInited = TRUE; - - return (TRUE); -} - -EDEN_BOOL EdenGLFontFinal(void) -{ - EDEN_BOOL ok = TRUE; - - // Sanity check - if (!gInited) return (FALSE); - - gContextsActiveCount = 0; - gInited = FALSE; - - return (ok); -} - -EDEN_GL_FONT_INFO_t *EdenGLFontNewTextureFont(const char *fontName, const char *pathname, const float naturalHeight, const float naturalWidth) -{ - EDEN_GL_FONT_INFO_t *fontInfo; - - if (!fontName || !pathname) return (NULL); - - fontInfo = (EDEN_GL_FONT_INFO_t *)calloc(1, sizeof(EDEN_GL_FONT_INFO_t)); - if (!fontInfo) { - EDEN_LOGe("Out of memory!"); - return (NULL); - } - fontInfo->type = EDEN_GL_FONT_TYPE_TEXTURE; - fontInfo->fontName = strdup(fontName); - fontInfo->fontDataPathname = strdup(pathname); - fontInfo->naturalHeight = naturalHeight; - fontInfo->monospaced = TRUE; - fontInfo->naturalWidthIfMonospaced = naturalWidth; - - return (fontInfo); -} - -void EdenGLFontDeleteTextureFont(EDEN_GL_FONT_INFO_t **fontInfo_p) -{ - if (!fontInfo_p || !*fontInfo_p) return; - - // Check that the user isn't trying to delete one of the static fonts. - if (*fontInfo_p == &geneva || - *fontInfo_p == &ocrb10 || - *fontInfo_p == &roman || - *fontInfo_p == &monoroman) return; - - free((*fontInfo_p)->fontName); - free((*fontInfo_p)->fontDataPathname); - free(*fontInfo_p); - *fontInfo_p = NULL; -} - -void EdenGLFontSetFont(EDEN_GL_FONT_INFO_t *font) -{ - gFontSettings.font = font; -} - -EDEN_GL_FONT_INFO_t * EdenGLFontGetFont(void) -{ - return (gFontSettings.font); -} - -void EdenGLFontSetSize(const float points) -{ - gFontSettings.size = points; -} - -float EdenGLFontGetSize(void) -{ - return (gFontSettings.size); -} - -void EdenGLFontSetCharacterSpacing(const float spacing) -{ - gFormattingSettings.characterSpacing = spacing; -} - -float EdenGLFontGetCharacterSpacing(void) -{ - return (gFormattingSettings.characterSpacing); -} - -void EdenGLFontSetLineSpacing(const float spacing) -{ - gFormattingSettings.lineSpacing = spacing; -} - -float EdenGLFontGetLineSpacing(void) -{ - return (gFormattingSettings.lineSpacing); -} - -void EdenGLFontSetWordSpacing(const float spacing) -{ - gFormattingSettings.wordExtraSpacing = spacing - 1.0f; -} - -float EdenGLFontGetWordSpacing(void) -{ - return (gFormattingSettings.wordExtraSpacing + 1.0f); -} - -void EdenGLFontSetDisplayResolution(const float pixelsPerInch) -{ - gViewSettings.pixelsPerInch = pixelsPerInch; -} - -float EdenGLFontGetDisplayResolution(void) -{ - return (gViewSettings.pixelsPerInch); -} - -void EdenGLFontSetViewSize(const float widthInPixels, const float heightInPixels) -{ - gViewSettings.width = widthInPixels; - gViewSettings.height = heightInPixels; -} - -float EdenGLFontGetHeight(void) -{ - return (gFontSettings.size/72.0f * gViewSettings.pixelsPerInch); -} - -float EdenGLFontGetCharacterWidth(const unsigned char c) -{ - float widthAtSizeOfOnePoint; - - if (c < ' ') return (0.0f); - - switch (gFontSettings.font->type) { - case EDEN_GL_FONT_TYPE_GLUT_STROKE: - if (gFontSettings.font->monospaced) { - widthAtSizeOfOnePoint = gFontSettings.font->naturalWidthIfMonospaced / gFontSettings.font->naturalHeight; - } else { - widthAtSizeOfOnePoint = glutStrokeWidth(gFontSettings.font->tsi, c); - if (c == ' ' && gFormattingSettings.wordExtraSpacing) widthAtSizeOfOnePoint *= (gFormattingSettings.wordExtraSpacing + 1.0f); - widthAtSizeOfOnePoint /= gFontSettings.font->naturalHeight; - } - break; - case EDEN_GL_FONT_TYPE_TEXTURE: - widthAtSizeOfOnePoint = gFontSettings.font->naturalWidthIfMonospaced / gFontSettings.font->naturalHeight; - break; - } - return (widthAtSizeOfOnePoint * gFontSettings.size/72.0f * gViewSettings.pixelsPerInch); -} - -float EdenGLFontGetLineWidth(const unsigned char *line) -{ - int i; - int charCount; - int spaceCount; - float widthAtSizeOfOnePoint; - - if (!line) return (0.0f); - - // Count non-control characters. - charCount = spaceCount = i = 0; - while (line[i]) { - if (line[i] >= ' ') charCount++; - if (line[i] == ' ') spaceCount++; - i++; - } - - switch (gFontSettings.font->type) { - case EDEN_GL_FONT_TYPE_GLUT_STROKE: - if (gFontSettings.font->monospaced) { - widthAtSizeOfOnePoint = gFontSettings.font->naturalWidthIfMonospaced * charCount / gFontSettings.font->naturalHeight; - } else { - widthAtSizeOfOnePoint = (glutStrokeLength(gFontSettings.font->tsi, line) + glutStrokeWidth(gFontSettings.font->tsi, ' ')*gFormattingSettings.wordExtraSpacing*spaceCount) / gFontSettings.font->naturalHeight; - } - break; - case EDEN_GL_FONT_TYPE_TEXTURE: - widthAtSizeOfOnePoint = gFontSettings.font->naturalWidthIfMonospaced * charCount / gFontSettings.font->naturalHeight; - break; - } - widthAtSizeOfOnePoint += (charCount - 1)*gFormattingSettings.characterSpacing; // Add spaces between characters. - return (widthAtSizeOfOnePoint * gFontSettings.size/72.0f * gViewSettings.pixelsPerInch); -} - -float EdenGLFontGetBlockWidth(const unsigned char **lines, const unsigned int lineCount) -{ - int i; - float width; - float maxWidth = 0.0f; - - if (!lineCount || !lines) return (0.0f); - - for (i = 0; i < lineCount; i++) { - width = EdenGLFontGetLineWidth(lines[i]); - if (width > maxWidth) maxWidth = width; - } - return (maxWidth); -} - -float EdenGLFontGetBlockHeight(const unsigned char **lines, const unsigned int lineCount) -{ - if (!lineCount || !lines) return (0.0f); - - return ((lineCount + (lineCount - 1)*(gFormattingSettings.lineSpacing - 1.0f)) * gFontSettings.size/72.0f * gViewSettings.pixelsPerInch); -} - -EDEN_BOOL EdenGLFontLoadTextureFontForContext(const int contextIndex, EDEN_GL_FONT_INFO_t *fontInfo) -{ - EDEN_GL_FONT_TEXTURE_INFO *fontTextureInfo; - char hasAlpha; - - // Sanity checks. - if (contextIndex < 0 || contextIndex >= gContextsActiveCount) return (FALSE); - if (!fontInfo) return (FALSE); - if (fontInfo->type != EDEN_GL_FONT_TYPE_TEXTURE) return (FALSE); - - // If first time called, set up the texture info. - if (!fontInfo->tsi) { - - fontInfo->tsi = calloc(1, sizeof(struct _EDEN_GL_FONT_TEXTURE_INFO)); - if (!fontInfo->tsi) return (FALSE); - fontTextureInfo = (EDEN_GL_FONT_TEXTURE_INFO *)fontInfo->tsi; // Type convenience. - - fontTextureInfo->textureInfo.pathname = fontInfo->fontDataPathname; - fontTextureInfo->textureInfo.mipmaps = GL_FALSE; - fontTextureInfo->textureInfo.internalformat = GL_LUMINANCE; - fontTextureInfo->textureInfo.min_filter = GL_LINEAR; - fontTextureInfo->textureInfo.mag_filter = GL_LINEAR; - fontTextureInfo->textureInfo.wrap_s = GL_REPEAT; - fontTextureInfo->textureInfo.wrap_t = GL_REPEAT; - fontTextureInfo->textureInfo.priority = 0.9; - fontTextureInfo->textureInfo.env_mode = GL_REPLACE; - - fontTextureInfo->textureIndexPerContext = calloc(gContextsActiveCount, sizeof(TEXTURE_INDEX_t)); - if (!fontTextureInfo->textureIndexPerContext) { - free(fontTextureInfo); - fontTextureInfo = NULL; - return (FALSE); - } - } - - fontTextureInfo = (EDEN_GL_FONT_TEXTURE_INFO *)fontInfo->tsi; // Type convenience. - - // Unload texture if previously loaded. - if (fontTextureInfo->textureIndexPerContext[contextIndex]) { - EdenSurfacesTextureUnload(contextIndex, 1, &(fontTextureInfo->textureIndexPerContext[contextIndex])); - } - - // Load texture. - if (!EdenSurfacesTextureLoad(contextIndex, 1, &(fontTextureInfo->textureInfo), &(fontTextureInfo->textureIndexPerContext[contextIndex]), &hasAlpha)) { - fprintf(stderr,"EdenGLFontLoad(): Unable to load font texture.\n"); - - // If this was first texture load and it didn't work out, don't keep the fontTextureInfo around. - if (fontTextureInfo->refCount == 0) { - free(fontTextureInfo->textureIndexPerContext); - free(fontTextureInfo); - fontTextureInfo = NULL; - } - return (FALSE); - } - fontTextureInfo->refCount++; - - return (TRUE); -} - -EDEN_BOOL EdenGLFontUnloadTextureFontForContext(const int contextIndex, EDEN_GL_FONT_INFO_t *fontInfo) -{ - EDEN_GL_FONT_TEXTURE_INFO *fontTextureInfo; - - if (contextIndex < 0 || contextIndex >= gContextsActiveCount) return (FALSE); // Sanity check. - if (!fontInfo) return (FALSE); - if (!(fontInfo->type == EDEN_GL_FONT_TYPE_TEXTURE)) return (FALSE); - - if (!fontInfo->tsi) return (FALSE); - - // Just for convenience of type. - fontTextureInfo = (EDEN_GL_FONT_TEXTURE_INFO *)fontInfo->tsi; - - EdenSurfacesTextureUnload(contextIndex, 1, &(fontTextureInfo->textureIndexPerContext[contextIndex])); - - fontTextureInfo->refCount--; - if (fontTextureInfo->refCount == 0) { - free(fontTextureInfo->textureIndexPerContext); - free(fontTextureInfo); - fontTextureInfo = NULL; - } - - return (TRUE); -} - -struct _VTs { - GLfloat vertices[4][2]; - GLfloat texcoords[4][2]; -}; - -static void drawSetup(const int contextIndex, struct _VTs *VTs) -{ - EDEN_GL_FONT_TEXTURE_INFO *fontTextureInfo; - - VTs->vertices[0][0] = 0.0f; VTs->vertices[0][1] = 0.0f; - VTs->vertices[1][0] = gFontSettings.font->naturalWidthIfMonospaced; VTs->vertices[1][1] = 0.0f; - VTs->vertices[2][0] = gFontSettings.font->naturalWidthIfMonospaced; VTs->vertices[2][1] = gFontSettings.font->naturalHeight; - VTs->vertices[3][0] = 0.0f; VTs->vertices[3][1] = gFontSettings.font->naturalHeight; - VTs->texcoords[0][0] = 0.0f; VTs->texcoords[0][1] = 0.0f; - VTs->texcoords[1][0] = 0.0625f; VTs->texcoords[1][1] = 0.0f; - VTs->texcoords[2][0] = 0.0625f; VTs->texcoords[2][1] = 0.0625f; - VTs->texcoords[3][0] = 0.0f; VTs->texcoords[3][1] = 0.0625f; - - fontTextureInfo = (EDEN_GL_FONT_TEXTURE_INFO *)gFontSettings.font->tsi; - - // Set up for texture drawing. - EdenSurfacesTextureSet(contextIndex, fontTextureInfo->textureIndexPerContext[contextIndex]); // Select font texture. - glStateCacheBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); // Blend by luminance. - glStateCacheEnableBlend(); - glVertexPointer(2, GL_FLOAT, 0, VTs->vertices); - glStateCacheEnableClientStateVertexArray(); - glStateCacheDisableClientStateNormalArray(); - glStateCacheClientActiveTexture(GL_TEXTURE0); - glTexCoordPointer(2, GL_FLOAT, 0, VTs->texcoords); - glStateCacheEnableClientStateTexCoordArray(); - glStateCacheEnableTex2D(); -} - -static void drawOneLine(const unsigned char *line) -{ - int i = 0; - unsigned char c; - - if (gFontSettings.font->type == EDEN_GL_FONT_TYPE_GLUT_STROKE) { - while ((c = line[i++])) { - if (c < ' ') continue; - glutStrokeCharacter(gFontSettings.font->tsi, c); - if (!gFontSettings.font->monospaced && c == ' ' && gFormattingSettings.wordExtraSpacing) glTranslatef(glutStrokeWidth(gFontSettings.font->tsi, ' ') * gFormattingSettings.wordExtraSpacing, 0.0f, 0.0f); - glTranslatef(gFontSettings.font->naturalHeight * gFormattingSettings.characterSpacing, 0.0f, 0.0f); - } - } else if (gFontSettings.font->type == EDEN_GL_FONT_TYPE_TEXTURE) { - while ((c = line[i++])) { - if (c < ' ') continue; - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef((float)(c%16)*0.0625f, 1.0f - (float)(c/16 + 1)*0.0625f, 0.0f); // Select the appropriate bit of font texture. - glMatrixMode(GL_MODELVIEW); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glTranslatef(gFontSettings.font->naturalWidthIfMonospaced + (gFontSettings.font->naturalHeight * gFormattingSettings.characterSpacing), 0.0f, 0.0f); // Move to the right. - } - } -} - -void EdenGLFontDrawLine(const int contextIndex, const unsigned char *line, const float hOffset, const float vOffset, H_OFFSET_TYPE hOffsetType, V_OFFSET_TYPE vOffsetType) -{ - GLfloat x, y; - GLfloat fontScalef; - struct _VTs VTs; - - if (!line) return; - - if (hOffsetType == H_OFFSET_VIEW_LEFT_EDGE_TO_TEXT_LEFT_EDGE) x = hOffset; - else { - float textWidth = EdenGLFontGetLineWidth(line); - if (hOffsetType == H_OFFSET_TEXT_RIGHT_EDGE_TO_VIEW_RIGHT_EDGE) x = gViewSettings.width - hOffset - textWidth; - else /* H_OFFSET_VIEW_CENTER_TO_TEXT_CENTER */ x = (gViewSettings.width - textWidth)/2.0f + hOffset; - } - if (vOffsetType == V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE) y = vOffset; - else { - float textHeight = EdenGLFontGetHeight(); - if (vOffsetType == V_OFFSET_VIEW_TEXT_TOP_TO_VIEW_TOP) y = gViewSettings.height - hOffset - textHeight; - else /* V_OFFSET_VIEW_CENTER_TO_TEXT_CENTER */ y = (gViewSettings.height - textHeight)/2.0f + hOffset; - } - - if (gFontSettings.font->type == EDEN_GL_FONT_TYPE_TEXTURE) drawSetup(contextIndex, &VTs); - fontScalef = gFontSettings.size/72.0f * gViewSettings.pixelsPerInch / gFontSettings.font->naturalHeight; - glPushMatrix(); - glTranslatef(x, y, 0.0f); - glScalef(fontScalef, fontScalef, fontScalef); - drawOneLine(line); - glPopMatrix(); -} - -void EdenGLFontDrawBlock(const int contextIndex, const unsigned char **lines, const unsigned int lineCount, const float hOffset, const float vOffset, H_OFFSET_TYPE hOffsetType, V_OFFSET_TYPE vOffsetType) -{ - int i; - GLfloat x, y; - GLfloat fontScalef; - struct _VTs VTs; - - if (!lines) return; - - - if (hOffsetType == H_OFFSET_VIEW_LEFT_EDGE_TO_TEXT_LEFT_EDGE) x = hOffset; - else { - float textWidth = EdenGLFontGetBlockWidth(lines, lineCount); - if (hOffsetType == H_OFFSET_TEXT_RIGHT_EDGE_TO_VIEW_RIGHT_EDGE) x = gViewSettings.width - hOffset - textWidth; - else /* H_OFFSET_VIEW_CENTER_TO_TEXT_CENTER */ x = (gViewSettings.width - textWidth)/2.0f + hOffset; - } - if (vOffsetType == V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE) y = vOffset; - else { - float textHeight = EdenGLFontGetBlockHeight(lines, lineCount); - if (vOffsetType == V_OFFSET_VIEW_TEXT_TOP_TO_VIEW_TOP) y = gViewSettings.height - hOffset - textHeight; - else /* V_OFFSET_VIEW_CENTER_TO_TEXT_CENTER */ y = (gViewSettings.height - textHeight)/2.0f + hOffset; - } - - if (gFontSettings.font->type == EDEN_GL_FONT_TYPE_TEXTURE) drawSetup(contextIndex, &VTs); - fontScalef = gFontSettings.size/72.0f * gViewSettings.pixelsPerInch / gFontSettings.font->naturalHeight; - glPushMatrix(); - for (i = 0; i < lineCount; i++) { - if (lines[i]) { - glPopMatrix(); - glPushMatrix(); - glTranslatef(x, y, 0.0f); - glScalef(fontScalef, fontScalef, fontScalef); - glTranslatef(0.0f, ((lineCount - 1) - i)*gFontSettings.font->naturalHeight*gFormattingSettings.lineSpacing, 0.0f); // Translate to baseline for this line. - drawOneLine(lines[i]); - } - } - glPopMatrix(); -} - diff --git a/lib/SRC/Eden/EdenMath.c b/lib/SRC/Eden/EdenMath.c deleted file mode 100644 index e6bb0f2..0000000 --- a/lib/SRC/Eden/EdenMath.c +++ /dev/null @@ -1,1001 +0,0 @@ -/* - * EdenMath.c - * The SRMS simulator - * - * Copyright (c) 2001-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. - * - * Rev Date Who Changes - * 1.0.0 2001-07-28 PRL Initial version. - * - */ - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// ============================================================================ -// Private includes -// ============================================================================ - -#include -#include - -// ============================================================================ -// Private types and defines -// ============================================================================ - - -// ============================================================================ -// Public functions -// ============================================================================ - -float EdenMathNormalise(float v[3]) -{ - float l; - - l = (float)LENGTH(v); - if (l) { - v[0] /= l; - v[1] /= l; - v[2] /= l; - } - return (l); -} - -double EdenMathNormalised(double v[3]) -{ - double l; - - l = (double)LENGTH(v); - if (l) { - v[0] /= l; - v[1] /= l; - v[2] /= l; - } - return (l); -} - -void EdenMathPointsToPlaneHessianNormal(float n[3], float *p, const float p1[3], const float p2[3], const float p3[3]) -{ - float l; - - if (!p1 || !p2 || !p3 || !n) return; // Sanity check. - EdenMathPointsToPlane(n, p, p1, p2, p3); - l = LENGTH(n); - if (l) { - n[0] /= l; - n[1] /= l; - n[2] /= l; - if (p) *p /= l; - } -} - -void EdenMathPointsToPlane(float abc[3], float *d, const float p1[3], const float p2[3], const float p3[3]) -{ - if (!p1 || !p2 || !p3) return; // Sanity check. - - if (abc) { - // Equivalent to SUB(pa,p2,p1); SUB(pb,p3,p1); CROSS(abc,pa,pb); - abc[0] = p1[1]*(p2[2] - p3[2]) + p2[1]*(p3[2] - p1[2]) + p3[1]*(p1[2] - p2[2]); - abc[1] = p1[2]*(p2[0] - p3[0]) + p2[2]*(p3[0] - p1[0]) + p3[2]*(p1[0] - p2[0]); - abc[2] = p1[0]*(p2[1] - p3[1]) + p2[0]*(p3[1] - p1[1]) + p3[0]*(p1[1] - p2[1]); - } - if (d) *d = -(p1[0]*(p2[1]*p3[2] - p3[1]*p2[2]) + p2[0]*(p3[1]*p1[2] - p1[1]*p3[2]) + p3[0]*(p1[1]*p2[2] - p2[1]*p1[2])); -} - -EDEN_BOOL EdenMathIntersectionLinePlane(float intersection[3], float *u_out, const float p1[3], const float p2[3], const float abc[3], const float d) -{ - float p2minusp1[3], u, ud; - - if (!abc || !p1 || !p2) return (FALSE); // Sanity check. - - SUB(p2minusp1, p2, p1); - ud = -(DOT(abc,p2minusp1)); - if (!ud) return (FALSE); // Normal to plane is perpendicular to line. - u = (DOT(abc, p1) + d) / ud; - intersection[0] = p1[0] + u * p2minusp1[0]; - intersection[1] = p1[1] + u * p2minusp1[1]; - intersection[2] = p1[2] + u * p2minusp1[2]; - if (u_out) *u_out = u; - return (TRUE); -} - -float EdenMathCalcDistanceToPlane(const float x0[3], const float abc[3], const float d) -{ - if (!x0 || !abc) return (0.0f); - return ((DOT(abc, x0) + d)/LENGTH(abc)); -} - -void EdenMathIdentityMatrix3by3(float mtx9[9]) -{ - mtx9[1] = mtx9[2] = mtx9[3] = mtx9[5] = mtx9[6] = mtx9[7] = 0.0f; - mtx9[0] = mtx9[4] = mtx9[8] = 1.0f; -} - -void EdenMathMultMatrix3by3(float C[9], const float B[9], const float A[9]) -{ - #define M(NAME,row,col) NAME[col*3+row] // M allows us to use row-major notation. - // 27 mults + 18 adds - M(C,0,0) = M(B,0,0)*M(A,0,0) + M(B,0,1)*M(A,1,0) + M(B,0,2)*M(A,2,0); - M(C,1,0) = M(B,1,0)*M(A,0,0) + M(B,1,1)*M(A,1,0) + M(B,1,2)*M(A,2,0); - M(C,2,0) = M(B,2,0)*M(A,0,0) + M(B,2,1)*M(A,1,0) + M(B,2,2)*M(A,2,0); - M(C,0,1) = M(B,0,0)*M(A,0,1) + M(B,0,1)*M(A,1,1) + M(B,0,2)*M(A,2,1); - M(C,1,1) = M(B,1,0)*M(A,0,1) + M(B,1,1)*M(A,1,1) + M(B,1,2)*M(A,2,1); - M(C,2,1) = M(B,2,0)*M(A,0,1) + M(B,2,1)*M(A,1,1) + M(B,2,2)*M(A,2,1); - M(C,0,2) = M(B,0,0)*M(A,0,2) + M(B,0,1)*M(A,1,2) + M(B,0,2)*M(A,2,2); - M(C,1,2) = M(B,1,0)*M(A,0,2) + M(B,1,1)*M(A,1,2) + M(B,1,2)*M(A,2,2); - M(C,2,2) = M(B,2,0)*M(A,0,2) + M(B,2,1)*M(A,1,2) + M(B,2,2)*M(A,2,2); - #undef M -} - -// -// Invert a 3x3 matrix A, placing result in Ainv. -// A and Ainv are in column-major form, which is standard for OpenGL -// (wheras the usual mathematical matrix notation is row-major.) -// -EDEN_BOOL EdenMathInvertMatrix3by3(float A[9], float Ainv[9]) -{ -#define M(NAME,row,col) NAME[col*3+row] // M allows us to use row-major notation. - float D; - - // 30 mults/divides, 12 adds/subtracts. - // Calculate adjoint matrix, by taking determinants of cofactors. - M(Ainv,0,0) = (M(A,1,1)*M(A,2,2) - M(A,2,1)*M(A,1,2)); - M(Ainv,1,0) = -(M(A,1,0)*M(A,2,2) - M(A,2,0)*M(A,1,2)); - M(Ainv,2,0) = (M(A,1,0)*M(A,2,1) - M(A,2,0)*M(A,1,1)); - - M(Ainv,0,1) = -(M(A,0,1)*M(A,2,2) - M(A,2,1)*M(A,0,2)); - M(Ainv,1,1) = (M(A,0,0)*M(A,2,2) - M(A,2,0)*M(A,0,2)); - M(Ainv,2,1) = -(M(A,0,0)*M(A,2,1) - M(A,2,0)*M(A,0,1)); - - M(Ainv,0,2) = (M(A,0,1)*M(A,1,2) - M(A,1,1)*M(A,0,2)); - M(Ainv,1,2) = -(M(A,0,0)*M(A,1,2) - M(A,1,0)*M(A,0,2)); - M(Ainv,2,2) = (M(A,0,0)*M(A,1,1) - M(A,1,0)*M(A,0,1)); - - // Determinant, reusing some determinants of cofactors from above. - D = M(A,0,0)*M(Ainv,0,0) + M(A,0,1)*M(Ainv,1,0) + M(A,0,2)*M(Ainv,2,0); - if(D == 0.0) // Not invertible if determinant is equal to zero. - { - return (FALSE); - } - - M(Ainv,0,0) /= D; - M(Ainv,1,0) /= D; - M(Ainv,2,0) /= D; - - M(Ainv,0,1) /= D; - M(Ainv,1,1) /= D; - M(Ainv,2,1) /= D; - - M(Ainv,0,2) /= D; - M(Ainv,1,2) /= D; - M(Ainv,2,2) /= D; - - return (TRUE); -#undef M -} - -void EdenMathIdentityMatrix(float mtx16[16]) -{ - mtx16[1] = mtx16[2] = mtx16[3] = mtx16[4] = mtx16[6] = mtx16[7] = mtx16[8] = mtx16[9] = mtx16[11] = mtx16[12] = mtx16[13] = mtx16[14] = 0.0f; - mtx16[0] = mtx16[5] = mtx16[10] = mtx16[15] = 1.0f; -} - -void EdenMathMultMatrix(float C[16], const float B[16], const float A[16]) -{ - #define M(NAME,row,col) NAME[col*4+row] // M allows us to use row-major notation. - // 64 mults + 48 adds - M(C,0,0) = M(B,0,0)*M(A,0,0) + M(B,0,1)*M(A,1,0) + M(B,0,2)*M(A,2,0) + M(B,0,3)*M(A,3,0); - M(C,1,0) = M(B,1,0)*M(A,0,0) + M(B,1,1)*M(A,1,0) + M(B,1,2)*M(A,2,0) + M(B,1,3)*M(A,3,0); - M(C,2,0) = M(B,2,0)*M(A,0,0) + M(B,2,1)*M(A,1,0) + M(B,2,2)*M(A,2,0) + M(B,2,3)*M(A,3,0); - M(C,3,0) = M(B,3,0)*M(A,0,0) + M(B,3,1)*M(A,1,0) + M(B,3,2)*M(A,2,0) + M(B,3,3)*M(A,3,0); - - M(C,0,1) = M(B,0,0)*M(A,0,1) + M(B,0,1)*M(A,1,1) + M(B,0,2)*M(A,2,1) + M(B,0,3)*M(A,3,1); - M(C,1,1) = M(B,1,0)*M(A,0,1) + M(B,1,1)*M(A,1,1) + M(B,1,2)*M(A,2,1) + M(B,1,3)*M(A,3,1); - M(C,2,1) = M(B,2,0)*M(A,0,1) + M(B,2,1)*M(A,1,1) + M(B,2,2)*M(A,2,1) + M(B,2,3)*M(A,3,1); - M(C,3,1) = M(B,3,0)*M(A,0,1) + M(B,3,1)*M(A,1,1) + M(B,3,2)*M(A,2,1) + M(B,3,3)*M(A,3,1); - - M(C,0,2) = M(B,0,0)*M(A,0,2) + M(B,0,1)*M(A,1,2) + M(B,0,2)*M(A,2,2) + M(B,0,3)*M(A,3,2); - M(C,1,2) = M(B,1,0)*M(A,0,2) + M(B,1,1)*M(A,1,2) + M(B,1,2)*M(A,2,2) + M(B,1,3)*M(A,3,2); - M(C,2,2) = M(B,2,0)*M(A,0,2) + M(B,2,1)*M(A,1,2) + M(B,2,2)*M(A,2,2) + M(B,2,3)*M(A,3,2); - M(C,3,2) = M(B,3,0)*M(A,0,2) + M(B,3,1)*M(A,1,2) + M(B,3,2)*M(A,2,2) + M(B,3,3)*M(A,3,2); - - M(C,0,3) = M(B,0,0)*M(A,0,3) + M(B,0,1)*M(A,1,3) + M(B,0,2)*M(A,2,3) + M(B,0,3)*M(A,3,3); - M(C,1,3) = M(B,1,0)*M(A,0,3) + M(B,1,1)*M(A,1,3) + M(B,1,2)*M(A,2,3) + M(B,1,3)*M(A,3,3); - M(C,2,3) = M(B,2,0)*M(A,0,3) + M(B,2,1)*M(A,1,3) + M(B,2,2)*M(A,2,3) + M(B,2,3)*M(A,3,3); - M(C,3,3) = M(B,3,0)*M(A,0,3) + M(B,3,1)*M(A,1,3) + M(B,3,2)*M(A,2,3) + M(B,3,3)*M(A,3,3); - #undef M -} - -// -// Multiplies 4x4 matrix B into 4x4 matrix A, placing result in C. -// A, B and C are in column-major form, which is standard for OpenGL -// (wheras the usual mathematical matrix notation is row-major.) -// -void EdenMathMultMatrixd(double C[16], const double B[16], const double A[16]) -{ -#define M(NAME,row,col) NAME[col*4+row] // M allows us to use row-major notation. - // 64 mults + 48 adds - M(C,0,0) = M(B,0,0)*M(A,0,0) + M(B,0,1)*M(A,1,0) + M(B,0,2)*M(A,2,0) + M(B,0,3)*M(A,3,0); - M(C,1,0) = M(B,1,0)*M(A,0,0) + M(B,1,1)*M(A,1,0) + M(B,1,2)*M(A,2,0) + M(B,1,3)*M(A,3,0); - M(C,2,0) = M(B,2,0)*M(A,0,0) + M(B,2,1)*M(A,1,0) + M(B,2,2)*M(A,2,0) + M(B,2,3)*M(A,3,0); - M(C,3,0) = M(B,3,0)*M(A,0,0) + M(B,3,1)*M(A,1,0) + M(B,3,2)*M(A,2,0) + M(B,3,3)*M(A,3,0); - - M(C,0,1) = M(B,0,0)*M(A,0,1) + M(B,0,1)*M(A,1,1) + M(B,0,2)*M(A,2,1) + M(B,0,3)*M(A,3,1); - M(C,1,1) = M(B,1,0)*M(A,0,1) + M(B,1,1)*M(A,1,1) + M(B,1,2)*M(A,2,1) + M(B,1,3)*M(A,3,1); - M(C,2,1) = M(B,2,0)*M(A,0,1) + M(B,2,1)*M(A,1,1) + M(B,2,2)*M(A,2,1) + M(B,2,3)*M(A,3,1); - M(C,3,1) = M(B,3,0)*M(A,0,1) + M(B,3,1)*M(A,1,1) + M(B,3,2)*M(A,2,1) + M(B,3,3)*M(A,3,1); - - M(C,0,2) = M(B,0,0)*M(A,0,2) + M(B,0,1)*M(A,1,2) + M(B,0,2)*M(A,2,2) + M(B,0,3)*M(A,3,2); - M(C,1,2) = M(B,1,0)*M(A,0,2) + M(B,1,1)*M(A,1,2) + M(B,1,2)*M(A,2,2) + M(B,1,3)*M(A,3,2); - M(C,2,2) = M(B,2,0)*M(A,0,2) + M(B,2,1)*M(A,1,2) + M(B,2,2)*M(A,2,2) + M(B,2,3)*M(A,3,2); - M(C,3,2) = M(B,3,0)*M(A,0,2) + M(B,3,1)*M(A,1,2) + M(B,3,2)*M(A,2,2) + M(B,3,3)*M(A,3,2); - - M(C,0,3) = M(B,0,0)*M(A,0,3) + M(B,0,1)*M(A,1,3) + M(B,0,2)*M(A,2,3) + M(B,0,3)*M(A,3,3); - M(C,1,3) = M(B,1,0)*M(A,0,3) + M(B,1,1)*M(A,1,3) + M(B,1,2)*M(A,2,3) + M(B,1,3)*M(A,3,3); - M(C,2,3) = M(B,2,0)*M(A,0,3) + M(B,2,1)*M(A,1,3) + M(B,2,2)*M(A,2,3) + M(B,2,3)*M(A,3,3); - M(C,3,3) = M(B,3,0)*M(A,0,3) + M(B,3,1)*M(A,1,3) + M(B,3,2)*M(A,2,3) + M(B,3,3)*M(A,3,3); -#undef M -} - -/* - * Compute inverse of 4x4 transformation matrix. - * Code contributed by Jacques Leroy jle@star.be - * Return GL_TRUE for success, GL_FALSE for failure (singular matrix) - */ -EDEN_BOOL EdenMathInvertMatrix(float out[16], const float m[16]) -{ - /* NB. OpenGL Matrices are COLUMN major. */ -#define SWAP_ROWS(a, b) { float *_tmp = a; (a)=(b); (b)=_tmp; } -#define MAT(m,r,c) (m)[(c)*4+(r)] - - float wtmp[4][8]; - float m0, m1, m2, m3, s; - float *r0, *r1, *r2, *r3; - - r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; - - r0[0] = MAT(m, 0, 0), r0[1] = MAT(m, 0, 1), - r0[2] = MAT(m, 0, 2), r0[3] = MAT(m, 0, 3), - r0[4] = 1.0f, r0[5] = r0[6] = r0[7] = 0.0f, - r1[0] = MAT(m, 1, 0), r1[1] = MAT(m, 1, 1), - r1[2] = MAT(m, 1, 2), r1[3] = MAT(m, 1, 3), - r1[5] = 1.0f, r1[4] = r1[6] = r1[7] = 0.0f, - r2[0] = MAT(m, 2, 0), r2[1] = MAT(m, 2, 1), - r2[2] = MAT(m, 2, 2), r2[3] = MAT(m, 2, 3), - r2[6] = 1.0f, r2[4] = r2[5] = r2[7] = 0.0f, - r3[0] = MAT(m, 3, 0), r3[1] = MAT(m, 3, 1), - r3[2] = MAT(m, 3, 2), r3[3] = MAT(m, 3, 3), - r3[7] = 1.0f, r3[4] = r3[5] = r3[6] = 0.0f; - - /* choose pivot - or die */ - if (fabsf(r3[0]) > fabsf(r2[0])) - SWAP_ROWS(r3, r2); - if (fabsf(r2[0]) > fabsf(r1[0])) - SWAP_ROWS(r2, r1); - if (fabsf(r1[0]) > fabsf(r0[0])) - SWAP_ROWS(r1, r0); - if (0.0f == r0[0]) - return FALSE; - - /* eliminate first variable */ - m1 = r1[0] / r0[0]; - m2 = r2[0] / r0[0]; - m3 = r3[0] / r0[0]; - s = r0[1]; - r1[1] -= m1 * s; - r2[1] -= m2 * s; - r3[1] -= m3 * s; - s = r0[2]; - r1[2] -= m1 * s; - r2[2] -= m2 * s; - r3[2] -= m3 * s; - s = r0[3]; - r1[3] -= m1 * s; - r2[3] -= m2 * s; - r3[3] -= m3 * s; - s = r0[4]; - if (s != 0.0f) { - r1[4] -= m1 * s; - r2[4] -= m2 * s; - r3[4] -= m3 * s; - } - s = r0[5]; - if (s != 0.0f) { - r1[5] -= m1 * s; - r2[5] -= m2 * s; - r3[5] -= m3 * s; - } - s = r0[6]; - if (s != 0.0f) { - r1[6] -= m1 * s; - r2[6] -= m2 * s; - r3[6] -= m3 * s; - } - s = r0[7]; - if (s != 0.0f) { - r1[7] -= m1 * s; - r2[7] -= m2 * s; - r3[7] -= m3 * s; - } - - /* choose pivot - or die */ - if (fabsf(r3[1]) > fabsf(r2[1])) - SWAP_ROWS(r3, r2); - if (fabsf(r2[1]) > fabsf(r1[1])) - SWAP_ROWS(r2, r1); - if (0.0f == r1[1]) - return FALSE; - - /* eliminate second variable */ - m2 = r2[1] / r1[1]; - m3 = r3[1] / r1[1]; - r2[2] -= m2 * r1[2]; - r3[2] -= m3 * r1[2]; - r2[3] -= m2 * r1[3]; - r3[3] -= m3 * r1[3]; - s = r1[4]; - if (0.0f != s) { - r2[4] -= m2 * s; - r3[4] -= m3 * s; - } - s = r1[5]; - if (0.0f != s) { - r2[5] -= m2 * s; - r3[5] -= m3 * s; - } - s = r1[6]; - if (0.0f != s) { - r2[6] -= m2 * s; - r3[6] -= m3 * s; - } - s = r1[7]; - if (0.0f != s) { - r2[7] -= m2 * s; - r3[7] -= m3 * s; - } - - /* choose pivot - or die */ - if (fabsf(r3[2]) > fabsf(r2[2])) - SWAP_ROWS(r3, r2); - if (0.0f == r2[2]) - return FALSE; - - /* eliminate third variable */ - m3 = r3[2] / r2[2]; - r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], - r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], r3[7] -= m3 * r2[7]; - - /* last check */ - if (0.0f == r3[3]) - return FALSE; - - s = 1.0f / r3[3]; /* now back substitute row 3 */ - r3[4] *= s; - r3[5] *= s; - r3[6] *= s; - r3[7] *= s; - - m2 = r2[3]; /* now back substitute row 2 */ - s = 1.0f / r2[2]; - r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), - r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); - m1 = r1[3]; - r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, - r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; - m0 = r0[3]; - r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, - r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; - - m1 = r1[2]; /* now back substitute row 1 */ - s = 1.0f / r1[1]; - r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), - r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); - m0 = r0[2]; - r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, - r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; - - m0 = r0[1]; /* now back substitute row 0 */ - s = 1.0f / r0[0]; - r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), - r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); - - MAT(out, 0, 0) = r0[4]; - MAT(out, 0, 1) = r0[5], MAT(out, 0, 2) = r0[6]; - MAT(out, 0, 3) = r0[7], MAT(out, 1, 0) = r1[4]; - MAT(out, 1, 1) = r1[5], MAT(out, 1, 2) = r1[6]; - MAT(out, 1, 3) = r1[7], MAT(out, 2, 0) = r2[4]; - MAT(out, 2, 1) = r2[5], MAT(out, 2, 2) = r2[6]; - MAT(out, 2, 3) = r2[7], MAT(out, 3, 0) = r3[4]; - MAT(out, 3, 1) = r3[5], MAT(out, 3, 2) = r3[6]; - MAT(out, 3, 3) = r3[7]; - - return TRUE; - -#undef MAT -#undef SWAP_ROWS -} - -/* - * Compute inverse of 4x4 transformation matrix. Double-precision version. - * Code contributed by Jacques Leroy jle@star.be - * Return GL_TRUE for success, GL_FALSE for failure (singular matrix) - */ -EDEN_BOOL EdenMathInvertMatrixd(double out[16], const double m[16]) -{ - /* NB. OpenGL Matrices are COLUMN major. */ -#define SWAP_ROWS(a, b) { double *_tmp = a; (a)=(b); (b)=_tmp; } -#define MAT(m,r,c) (m)[(c)*4+(r)] - - double wtmp[4][8]; - double m0, m1, m2, m3, s; - double *r0, *r1, *r2, *r3; - - r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; - - r0[0] = MAT(m, 0, 0), r0[1] = MAT(m, 0, 1), - r0[2] = MAT(m, 0, 2), r0[3] = MAT(m, 0, 3), - r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, - r1[0] = MAT(m, 1, 0), r1[1] = MAT(m, 1, 1), - r1[2] = MAT(m, 1, 2), r1[3] = MAT(m, 1, 3), - r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, - r2[0] = MAT(m, 2, 0), r2[1] = MAT(m, 2, 1), - r2[2] = MAT(m, 2, 2), r2[3] = MAT(m, 2, 3), - r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, - r3[0] = MAT(m, 3, 0), r3[1] = MAT(m, 3, 1), - r3[2] = MAT(m, 3, 2), r3[3] = MAT(m, 3, 3), - r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; - - /* choose pivot - or die */ - if (fabs(r3[0]) > fabs(r2[0])) - SWAP_ROWS(r3, r2); - if (fabs(r2[0]) > fabs(r1[0])) - SWAP_ROWS(r2, r1); - if (fabs(r1[0]) > fabs(r0[0])) - SWAP_ROWS(r1, r0); - if (0.0 == r0[0]) - return FALSE; - - /* eliminate first variable */ - m1 = r1[0] / r0[0]; - m2 = r2[0] / r0[0]; - m3 = r3[0] / r0[0]; - s = r0[1]; - r1[1] -= m1 * s; - r2[1] -= m2 * s; - r3[1] -= m3 * s; - s = r0[2]; - r1[2] -= m1 * s; - r2[2] -= m2 * s; - r3[2] -= m3 * s; - s = r0[3]; - r1[3] -= m1 * s; - r2[3] -= m2 * s; - r3[3] -= m3 * s; - s = r0[4]; - if (s != 0.0) { - r1[4] -= m1 * s; - r2[4] -= m2 * s; - r3[4] -= m3 * s; - } - s = r0[5]; - if (s != 0.0) { - r1[5] -= m1 * s; - r2[5] -= m2 * s; - r3[5] -= m3 * s; - } - s = r0[6]; - if (s != 0.0f) { - r1[6] -= m1 * s; - r2[6] -= m2 * s; - r3[6] -= m3 * s; - } - s = r0[7]; - if (s != 0.0) { - r1[7] -= m1 * s; - r2[7] -= m2 * s; - r3[7] -= m3 * s; - } - - /* choose pivot - or die */ - if (fabs(r3[1]) > fabs(r2[1])) - SWAP_ROWS(r3, r2); - if (fabs(r2[1]) > fabs(r1[1])) - SWAP_ROWS(r2, r1); - if (0.0 == r1[1]) - return FALSE; - - /* eliminate second variable */ - m2 = r2[1] / r1[1]; - m3 = r3[1] / r1[1]; - r2[2] -= m2 * r1[2]; - r3[2] -= m3 * r1[2]; - r2[3] -= m2 * r1[3]; - r3[3] -= m3 * r1[3]; - s = r1[4]; - if (0.0 != s) { - r2[4] -= m2 * s; - r3[4] -= m3 * s; - } - s = r1[5]; - if (0.0 != s) { - r2[5] -= m2 * s; - r3[5] -= m3 * s; - } - s = r1[6]; - if (0.0 != s) { - r2[6] -= m2 * s; - r3[6] -= m3 * s; - } - s = r1[7]; - if (0.0 != s) { - r2[7] -= m2 * s; - r3[7] -= m3 * s; - } - - /* choose pivot - or die */ - if (fabs(r3[2]) > fabs(r2[2])) - SWAP_ROWS(r3, r2); - if (0.0 == r2[2]) - return FALSE; - - /* eliminate third variable */ - m3 = r3[2] / r2[2]; - r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], - r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], r3[7] -= m3 * r2[7]; - - /* last check */ - if (0.0 == r3[3]) - return FALSE; - - s = 1.0 / r3[3]; /* now back substitute row 3 */ - r3[4] *= s; - r3[5] *= s; - r3[6] *= s; - r3[7] *= s; - - m2 = r2[3]; /* now back substitute row 2 */ - s = 1.0 / r2[2]; - r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), - r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); - m1 = r1[3]; - r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, - r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; - m0 = r0[3]; - r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, - r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; - - m1 = r1[2]; /* now back substitute row 1 */ - s = 1.0 / r1[1]; - r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), - r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); - m0 = r0[2]; - r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, - r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; - - m0 = r0[1]; /* now back substitute row 0 */ - s = 1.0 / r0[0]; - r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), - r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); - - MAT(out, 0, 0) = r0[4]; - MAT(out, 0, 1) = r0[5], MAT(out, 0, 2) = r0[6]; - MAT(out, 0, 3) = r0[7], MAT(out, 1, 0) = r1[4]; - MAT(out, 1, 1) = r1[5], MAT(out, 1, 2) = r1[6]; - MAT(out, 1, 3) = r1[7], MAT(out, 2, 0) = r2[4]; - MAT(out, 2, 1) = r2[5], MAT(out, 2, 2) = r2[6]; - MAT(out, 2, 3) = r2[7], MAT(out, 3, 0) = r3[4]; - MAT(out, 3, 1) = r3[5], MAT(out, 3, 2) = r3[6]; - MAT(out, 3, 3) = r3[7]; - - return TRUE; - -#undef MAT -#undef SWAP_ROWS -} - -void EdenMathMultMatrixByVector(float q[4], const float A[16], const float p[4]) -{ -#define M(NAME,row,col) NAME[col*4+row] // M allows us to use row-major notation. - q[0] = M(A,0,0)*p[0] + M(A,0,1)*p[1] + M(A,0,2)*p[2] + M(A,0,3)*p[3]; - q[1] = M(A,1,0)*p[0] + M(A,1,1)*p[1] + M(A,1,2)*p[2] + M(A,1,3)*p[3]; - q[2] = M(A,2,0)*p[0] + M(A,2,1)*p[1] + M(A,2,2)*p[2] + M(A,2,3)*p[3]; - q[3] = M(A,3,0)*p[0] + M(A,3,1)*p[1] + M(A,3,2)*p[2] + M(A,3,3)*p[3]; -#undef M -} - -void EdenMathMultMatrixByVectord(double q[4], const double A[16], const double p[4]) -{ -#define M(NAME,row,col) NAME[col*3+row] // M allows us to use row-major notation. - q[0] = M(A,0,0)*p[0] + M(A,0,1)*p[1] + M(A,0,2)*p[2] + M(A,0,3)*p[3]; - q[1] = M(A,1,0)*p[0] + M(A,1,1)*p[1] + M(A,1,2)*p[2] + M(A,1,3)*p[3]; - q[2] = M(A,2,0)*p[0] + M(A,2,1)*p[1] + M(A,2,2)*p[2] + M(A,2,3)*p[3]; - q[3] = M(A,3,0)*p[0] + M(A,3,1)*p[1] + M(A,3,2)*p[2] + M(A,3,3)*p[3]; -#undef M -} - -// -// Creates a matrix which represents translation by a vector. -// Input : x, y, z - components of the translation vector. -// Output: mtx16 - a 4x4 matrix in column major form. -// -void EdenMathTranslationMatrix(float mtx16[16], const float x, const float y, const float z) -{ -#define M(row,col) mtx16[col*4+row] // M allows us to use row-major notation. - M(0,0) = M(1,1) = M(2,2) = M(3,3) = 1.0f; - M(1,0) = M(2,0) = M(3,0) = M(0,1) = M(2,1) = M(3,1) = M(0,2) = M(1,2) = M(3,2) = 0.0f; - M(0,3) = x; M(1,3) = y; M(2,3) = z; -#undef M -} - -void EdenMathTranslateMatrix(float B[16], const float A[16], - const float x, const float y, const float z) -{ - float T[16]; - - EdenMathTranslationMatrix(T, x, y, z); - EdenMathMultMatrix(B, A, T); // Order is (result, current, transform) -} -// -// Creates a matrix which represents the general case of a -// rotation about an arbitrary axis. -// Input : q - the angle of rotation measured in a right-hand sense, in radians. -// x,y,z - the components of the *normalised* non-zero vector representing the axis of rotation. -// Output: mtx16 - a 4x4 matrix in column major form. -// -void EdenMathRotationMatrix(float mtx16[16], const float q, const float x, const float y, const float z) -{ - #define M(row,col) mtx16[col*4+row] // M allows us to use row-major notation. - - float ll, l, x0, y0, z0; - float C, S, V; - float xy, yz, xz; - float Sx, Sy, Sz; - float Vxy, Vyz, Vxz; - - if (q == 0.0f) return; - - ll = x*x + y*y + z*z; - if (ll != 1.0f) { - l = sqrtf(ll); - if (!l) return; - x0 = x / l; - y0 = y / l; - z0 = z / l; - } else { - x0 = x; - y0 = y; - z0 = z; - } - - C = cosf(q); - S = sinf(q); - V = 1.0f - C; - xy = x0*y0; - yz = y0*z0; - xz = x0*z0; - Sx = S*x0; - Sy = S*y0; - Sz = S*z0; - Vxy = V*xy; - Vyz = V*yz; - Vxz = V*xz; - - // Column 0. - M(0, 0) = V*x0*x0 + C; - M(1, 0) = Vxy + Sz; - M(2, 0) = Vxz - Sy; - M(3, 0) = 0.0f; - - // Column 1. - M(0, 1) = Vxy - Sz; - M(1, 1) = V*y0*y0 + C; - M(2, 1) = Vyz + Sx; - M(3, 1) = 0.0f; - - // Column 2. - M(0, 2) = Vxz + Sy; - M(1, 2) = Vyz - Sx; - M(2, 2) = V*z0*z0 + C; - M(3, 2) = 0.0f; - - // Column 3. - M(0, 3) = 0.0f; - M(1, 3) = 0.0f; - M(2, 3) = 0.0f; - M(3, 3) = 1.0f; - - #undef M -} - -void EdenMathRotateMatrix(float B[16], const float A[16], - const float q, const float x, const float y, const float z) -{ - float T[16]; - - EdenMathRotationMatrix(T, q, x, y, z); - EdenMathMultMatrix(B, A, T); // Order is (result, current, transform) -} - -void EdenMathScalingMatrix(float mtx16[16], const float x, const float y, const float z) -{ - mtx16[0] = x; mtx16[1] = mtx16[2] = mtx16[3] = 0.0f; - mtx16[4] = 0.0f; mtx16[5] = y; mtx16[6] = mtx16[7] = 0.0f; - mtx16[8] = mtx16[9] = 0.0f; mtx16[10] = z; mtx16[11] = 0.0f; - mtx16[12] = mtx16[13] = mtx16[14] = 0.0f; mtx16[15] = 1.0f; -} - -void EdenMathScaleMatrix(float B[16], const float A[16], const float x, const float y, const float z) -{ - float T[16]; - - EdenMathScalingMatrix(T, x, y, z); - EdenMathMultMatrix(B, A, T); // Order is (result, current, transform) -} - -// -// Creates a rotation matrix that rotates a vector called -// "from" into another vector called "to". -// Input : from[3], to[3] which both must be *normalized* non-zero vectors. -// Output: mtx[3][3] -- a 3x3 matrix in column-major form. -// Author: Tomas Moller, 1999 -// -void EdenMathRotationMatrixFromTo(const float from[3], const float to[3], float mtx9[9]) -{ - #define M(row,col) mtx9[col*3+row] // M allows us to use row-major notation. - #define EPSILON 0.001f - - float v[3]; - float e, h; - CROSS(v, from, to); - e = DOT(from, to); - if (e > 1.0f - EPSILON) { // "from" almost or equal to "to"-vector? - // Return identity. - M(0, 0) = 1.0f; M(0, 1) = 0.0f; M(0, 2) = 0.0f; - M(1, 0) = 0.0f; M(1, 1) = 1.0f; M(1, 2) = 0.0f; - M(2, 0) = 0.0f; M(2, 1) = 0.0f; M(2, 2) = 1.0f; - } else if (e < -1.0f + EPSILON) { // "from" almost or equal to negated "to"-vector? - float up[3],left[3]; - float invlen; - float fxx,fyy,fzz,fxy,fxz,fyz; - float uxx,uyy,uzz,uxy,uxz,uyz; - float lxx,lyy,lzz,lxy,lxz,lyz; - // left=CROSS(from, (1,0,0)). - left[0] = 0.0f; left[1] = from[2]; left[2] = -from[1]; - if (DOT(left, left) < EPSILON) { // was left=CROSS(from,(1,0,0)) a good choice? - // here we know that left = CROSS(from,(1,0,0)) will be a good choice. - left[0] = -from[2]; left[1] = 0.0f; left[2] = from[0]; - } - // Normalize "left". - invlen = 1.0f/sqrt(DOT(left,left)); - left[0] *= invlen; - left[1] *= invlen; - left[2] *= invlen; - CROSS(up,left,from); - // Now we have a coordinate system, i.e., a basis; - // M=(from, up, left), and we want to rotate to: - // N=(-from, up, -left). This is done with the matrix: - // N*M^T where M^T is the transpose of M. - fxx = -from[0]*from[0]; fyy = -from[1]*from[1]; fzz = -from[2]*from[2]; - fxy = -from[0]*from[1]; fxz = -from[0]*from[2]; fyz = -from[1]*from[2]; - - uxx = up[0]*up[0]; uyy = up[1]*up[1]; uzz = up[2]*up[2]; - uxy = up[0]*up[1]; uxz = up[0]*up[2]; uyz = up[1]*up[2]; - - lxx =-left[0]*left[0]; lyy = -left[1]*left[1]; lzz = -left[2]*left[2]; - lxy =-left[0]*left[1]; lxz = -left[0]*left[2]; lyz = -left[1]*left[2]; - // Symmetric matrix. - M(0, 0) = fxx+uxx+lxx; M(0, 1) = fxy+uxy+lxy; M(0, 2) = fxz+uxz+lxz; - M(1, 0) = M(0, 1); M(1, 1) = fyy+uyy+lyy; M(1, 2) = fyz+uyz+lyz; - M(2, 0) = M(0, 2); M(2, 1) = M(1, 2); M(2, 2) = fzz+uzz+lzz; - } else { // The most common case, unless "from"="to", or "from"=-"to". - #if 0 - // Unoptimized version - a good compiler will optimize this. - h = (1.0 - e)/DOT(v, v); - M(0, 0) = e+h*v[0]*v[0]; M(0, 1) = h*v[0]*v[1]-v[2]; M(0,2) = h*v[0]*v[2]+v[1]; - M(1, 0) = h*v[0]*v[1]+v[2]; M(1, 1) = e+h*v[1]*v[1]; M(1,2) = h*v[1]*v[2]-v[0]; - M(2, 0) = h*v[0]*v[2]-v[1]; M(2, 1) = h*v[1]*v[2]+v[0]; M(2,2) = e+h*v[2]*v[2]; - #else - // ...otherwise use this hand optimized version (9 mults less). - float hvx,hvz,hvxy,hvxz,hvyz; - h = (1.0f - e)/DOT(v, v); - hvx = h*v[0]; - hvz = h*v[2]; - hvxy = hvx*v[1]; - hvxz = hvx*v[2]; - hvyz = hvz*v[1]; - M(0, 0) = e + hvx*v[0]; M(0, 1) = hvxy - v[2]; M(0, 2) = hvxz + v[1]; - M(1, 0) = hvxy + v[2]; M(1, 1) = e + h*v[1]*v[1]; M(1, 2) = hvyz - v[0]; - M(2, 0) = hvxz - v[1]; M(2, 1) = hvyz + v[0]; M(2, 2) = e + hvz*v[2]; - #endif - } - #undef M -} - -void EdenMathRotatePointAboutAxis(float p2[3], const float p1[3], const float q, const float a[3]) -{ - float C, S, V; - float xy, yz, xz; - float Sx, Sy, Sz; - float Vxy, Vyz, Vxz; - - if (q) { - C = cosf(q); - S = sinf(q); - V = 1.0f - C; - xy = a[0] * a[1]; - yz = a[1] * a[2]; - xz = a[0] * a[2]; - Sx = S * a[0]; - Sy = S * a[1]; - Sz = S * a[2]; - Vxy = V * xy; - Vyz = V * yz; - Vxz = V * xz; - - p2[0] = (p1[0]*(C + V*a[0]*a[0]) + p1[1]*(Vxy - Sz) + p1[2]*(Vxz + Sy) ); - p2[1] = (p1[0]*(Vxy + Sz) + p1[1]*(C + V*a[1]*a[1]) + p1[2]*(-Sx + Vyz) ); - p2[2] = (p1[0]*(Vxz - Sy) + p1[1]*(Sx + Vyz) + p1[2]*(C + V*a[2]*a[2])); - } else { - p2[0] = p1[0]; - p2[1] = p1[1]; - p2[2] = p1[2]; - } -} - -void EdenMathRotatePointAboutAxisd(double p2[3], const double p1[3], const double q, const double a[3]) -{ - double C, S, V; - double xy, yz, xz; - double Sx, Sy, Sz; - double Vxy, Vyz, Vxz; - - if (q) { - C = cosf(q); - S = sinf(q); - V = 1.0 - C; - xy = a[0] * a[1]; - yz = a[1] * a[2]; - xz = a[0] * a[2]; - Sx = S * a[0]; - Sy = S * a[1]; - Sz = S * a[2]; - Vxy = V * xy; - Vyz = V * yz; - Vxz = V * xz; - - p2[0] = (p1[0]*(C + V*a[0]*a[0]) + p1[1]*(Vxy - Sz) + p1[2]*(Vxz + Sy) ); - p2[1] = (p1[0]*(Vxy + Sz) + p1[1]*(C + V*a[1]*a[1]) + p1[2]*(-Sx + Vyz) ); - p2[2] = (p1[0]*(Vxz - Sy) + p1[1]*(Sx + Vyz) + p1[2]*(C + V*a[2]*a[2])); - } else { - p2[0] = p1[0]; - p2[1] = p1[1]; - p2[2] = p1[2]; - } -} - -#ifdef __ppc__ -#if !defined(__MWERKS__) -// Define __frsqrte() (unless using the Metrowerks compiler, -// for which this is already available). This causes the frsqrte -// instruction to be used to calculate a 5 bit estimate of the -// reciprocal square root of the argument -inline double __frsqrte (double argument) -{ - double result; - asm ( "frsqrte %0, %1" : /*OUT*/ "=f" ( result ) : /*IN*/ "f" ( argument ) ); - return result; -} -#endif // !__MWERKS - -void fsqrt(double *arg) -{ - register double estimate; - register double halfOfArg; - int i; - - // Calculate a 5 bit starting estimate for the reciprocal sqrt - estimate = __frsqrte (*arg); - - halfOfArg = 0.5 * *arg; - - //if you require less precision, you may reduce the number of loop iterations - for (i = 0; i < 4; i++) { - estimate = estimate * (1.5 - halfOfArg * estimate * estimate); - } - - *arg = estimate * *arg; -} - -void fsqrt3(double *arg1, double *arg2, double *arg3) -{ - register double estimate1, estimate2, estimate3; - register double halfOfArg1, halfOfArg2, halfOfArg3; - int i; - - //Calculate a 5 bit starting estimate for the reciprocal sqrt of each - estimate1 = __frsqrte (*arg1); - estimate2 = __frsqrte (*arg2); - estimate3 = __frsqrte (*arg3); - - halfOfArg1 = 0.5 * *arg1; - halfOfArg2 = 0.5 * *arg2; - halfOfArg3 = 0.5 * *arg3; - - //if you require less precision, you may reduce the number of loop iterations - for (i = 0; i < 4; i++) { - estimate1 = estimate1 * (1.5 - halfOfArg1 * estimate1 * estimate1); - estimate2 = estimate2 * (1.5 - halfOfArg2 * estimate2 * estimate2); - estimate3 = estimate3 * (1.5 - halfOfArg3 * estimate3 * estimate3); - } - - *arg1 = estimate1 * *arg1; - *arg2 = estimate2 * *arg2; - *arg3 = estimate3 * *arg3; -} - -void frsqrt(double *arg) -{ - register double estimate; - int i; - - //Calculate a 5 bit starting estimate for the reciprocal sqrt - estimate = __frsqrte(*arg); - - //if you require less precision, you may reduce the number of loop iterations - for (i = 0; i < 4; i++) { - estimate = estimate + 0.5 * estimate * (1.0 - *arg * estimate * estimate); - } - - *arg = estimate; -} - -// Caculate three reciprocal square roots simultaneously: (*arg = (*arg)-0.5). -void frsqrt3(double *arg1, double *arg2, double *arg3) -{ - register double estimate1, estimate2, estimate3; - int i; - - //Calculate a 5 bit starting estimate for the reciprocal sqrt of each - estimate1 = __frsqrte(*arg1); - estimate2 = __frsqrte(*arg2); - estimate3 = __frsqrte(*arg3); - - //if you require less precision, you may reduce the number of loop iterations - for (i = 0; i < 4; i++) { - estimate1 = estimate1 + 0.5 * estimate1 * (1.0 - *arg1 * estimate1 * estimate1); - estimate2 = estimate2 + 0.5 * estimate2 * (1.0 - *arg2 * estimate2 * estimate2); - estimate3 = estimate3 + 0.5 * estimate3 * (1.0 - *arg3 * estimate3 * estimate3); - } - - *arg1 = estimate1; - *arg2 = estimate2; - *arg3 = estimate3; -} -#endif // __ppc__ diff --git a/lib/SRC/Eden/EdenMessage.c b/lib/SRC/Eden/EdenMessage.c deleted file mode 100644 index 45f2462..0000000 --- a/lib/SRC/Eden/EdenMessage.c +++ /dev/null @@ -1,642 +0,0 @@ -// -// EdenMessage.h -// -// Copyright (c) 2001-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// Font loading code based on code by Jeff Molofee, 1999, http://nehe.gamedev.net/ -// -// Rev Date Who Changes -// 1.0.0 2001-12-04 PRL Initial version for The SRMS simulator. -// 1.0.1 2005-09-28 PRL Added headerDoc. -// 1.1.0 2013-02-19 PRL Quick update for OpenGL ES. -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// ============================================================================ -// Includes -// ============================================================================ - -#include -#include // MIN() - -#include -#include -#include // malloc(), calloc(), free(), exit() -#ifndef _MSC_VER -# include -#else -typedef unsigned char bool; -# define false 0 -# define true 1 -# include // struct _timeb -#endif -#include -#include // ETIMEDOUT -#include // EdenTimeAbsolutePlusOffset(), struct timespec, EdenTime_sleep() -#include // TEXTURE_INFO_t, TEXTURE_INDEX_t, SurfacesTextureLoad(), SurfacesTextureSet(), SurfacesTextureUnload() -#include -#ifndef EDEN_OPENGLES -# define DISABLE_GL_STATE_CACHE -#endif -#include "glStateCache.h" - - -// ============================================================================ -// Types and constants -// ============================================================================ - -#define BOX_LINES_MAX 80 -#define BOX_LINE_LENGTH_MAX 1023 - -typedef struct _boxSettings { - pthread_mutex_t lock; - float boxWidth; // Pixel width of box. - float boxHeight; // Pixel height of box (calculated). - float boxPaddingH; // Pixels of padding between the left and right border and the text. - float boxPaddingV; // Pixels of padding between the top and bottom border and the text. - float boxCornerRadius; // Radius in pixels of the rounded corners. Typically set to MIN(boxPaddingH, boxPaddinV). - float softwrapRatio; // Percentage of the maximum text width at which to start soft-wrapping text. - unsigned char *text; - unsigned char *lines[BOX_LINES_MAX]; - int lineCount; -} boxSettings_t; - -#define EDEN_MESSAGE_INPUT_MAX_LENGTH_DEFAULT 1023 - -//#define DEBUG_MESSAGE // Uncomment to show extra debugging info. - -#pragma mark - -#pragma mark [GLOBAL VARIABLES] -// ============================================================================ -// Global variables -// ============================================================================ - -// Sanity checks. -static EDEN_BOOL gMessageInited = FALSE; // Set to TRUE once EdenMessageInit() has succesfully completed. - -static boxSettings_t *gBoxSettings = NULL; - -// Screen size. -static float gScreenWidth = 640.0f; -static float gScreenHeight = 480.0f; -static float gScreenScale = 1.0f; - -// Use of gDrawLock allows EdenMessageDraw() to be called in a separate thread -// by protecting the global static data (below) that it uses. -//static pthread_mutex_t gDrawLock; -EDEN_BOOL gEdenMessageDrawRequired = FALSE; // EdenMessageDraw() should be called if this is set to TRUE; - -static pthread_mutex_t gInputLock; // Protects gInput. -static unsigned char *gInput; // Pointer to buffer for input string, including prompt. -static unsigned char *gInputPtr; // Pointer into buffer to start of input string. -static unsigned int gInputLength; // Holds length of input string including prompt. -static unsigned int gInputPromptLength; // -static int gInputCursorState; -static pthread_cond_t gInputCompleteCond; -static EDEN_BOOL gInputComplete; // Set to TRUE once EdenMessageInputKeyboard() has captured a response. - -// Input constraints. -static unsigned int gInputLengthMin; // Minimum length of user input string. -static unsigned int gInputLengthMax; // Maximum length of user input string. -static int gInputIntOnly; -static int gInputFPOnly; -static int gInputAlphaOnly; - -EDEN_BOOL gEdenMessageKeyboardRequired = FALSE; // EdenMessageInputKeyboard should be called with keystrokes if this is set to TRUE; - -// -// Private functions. -// - -// Can pass NULL for parameter 'text' in which case previous text is reused. -// Depends on settings 'text', 'boxWidth', 'boxPaddingH'. -// Sets settings 'text', 'lines', 'lineCount', 'boxHeight'. -static void boxSetText(boxSettings_t *settings, const unsigned char *text) -{ - int i; - int textIndex; - bool done; - float boxTextWidth; - float boxTextWidthSoftwrap; - float hyphenWidth; - float interCharSpacingWidth; - - unsigned char c = '\0', c0, c1; // current, previous, next char. - int lineLength = 0; - unsigned char lineBuf[BOX_LINE_LENGTH_MAX + 1] = ""; // +1 for null terminator. - float lineWidth = 0; - - if (!settings) return; - - pthread_mutex_lock(&settings->lock); - - if (text) { - free(settings->text); - settings->text = (unsigned char *)strdup((char *)text); - } - - // Free old lines. - if (settings->lineCount) { - for (i = 0; i < settings->lineCount; i++) { - free(settings->lines[i]); - settings->lines[i] = NULL; - } - settings->lineCount = 0; - } - - boxTextWidth = settings->boxWidth - 2*settings->boxPaddingH; - boxTextWidthSoftwrap = boxTextWidth*settings->softwrapRatio; - hyphenWidth = EdenGLFontGetCharacterWidth('-'); - interCharSpacingWidth = EdenGLFontGetLineWidth((const unsigned char *)"--") - 2.0f*hyphenWidth; - - if (settings->text) { - // Split text into lines, softwrapping on whitespace if possible. - textIndex = 0; - done = false; - do { - - bool newline = false; - - c0 = c; - c = settings->text[textIndex]; - if (!c) { - if (lineLength) newline = true; - done = true; - } else if (c == '\n' || (c == ' ' && lineWidth >= boxTextWidthSoftwrap)) { - textIndex++; - newline = true; - } else if (c < ' ') { - textIndex++; - } else { - bool addChar = false; - // Is there still room for a hyphen after this character? - float predictedLineWidth = lineWidth + interCharSpacingWidth + EdenGLFontGetCharacterWidth(settings->text[textIndex]); - if (predictedLineWidth < (boxTextWidth - hyphenWidth)) { - addChar = true; - } else { - // No. But two exceptions: - // 1) this character is a space. - // 2) this character doesn't overflow and the next character is whitespace. - c1 = settings->text[textIndex + 1]; - if (c == ' ') { - textIndex++; - newline = true; - } else if (predictedLineWidth <= boxTextWidth && (!c1 || c1 == ' ' || c1 == '\n')) { - addChar = true; - } else { - // Exception didn't apply, so insert hyphen, then newline, then continue with same char on next line (unless previous char was space, in which case no hyphen). - if (c0 != ' ') { - lineBuf[lineLength++] = '-'; - lineBuf[lineLength] = '\0'; - } - newline = true; - } - } - if (addChar) { - lineBuf[lineLength++] = c; - lineBuf[lineLength] = '\0'; - lineWidth = EdenGLFontGetLineWidth(lineBuf); - if (lineLength == BOX_LINE_LENGTH_MAX) newline = true; // Next char would overflow buffer, so break now. - textIndex++; - } - } - - if (newline) { - // Start a new line. - settings->lines[settings->lineCount] = (unsigned char *)strdup((const char *)lineBuf); - settings->lineCount++; - if (settings->lineCount == BOX_LINES_MAX) done = true; - lineLength = 0; - lineBuf[0] = '\0'; - lineWidth = 0.0f; - } - } while (!done); - } - - settings->boxHeight = EdenGLFontGetBlockHeight((const unsigned char **)settings->lines, settings->lineCount) + 2.0f*settings->boxPaddingV; - - pthread_mutex_unlock(&settings->lock); -} - -static boxSettings_t *boxCreate(float width, float paddingH, float paddingV, float cornerRadius, float softwrapRatio) -{ - boxSettings_t *settings = (boxSettings_t *)calloc(1, sizeof(boxSettings_t)); - if (!settings) return (NULL); - - pthread_mutex_init(&settings->lock, NULL); - settings->boxWidth = (width > 0.0f ? width : 400.0f)*gScreenScale; - settings->boxPaddingH = (paddingH >= 0.0f ? paddingH : 20.0f)*gScreenScale; - settings->boxPaddingV = (paddingV >= 0.0f ? paddingV : 20.0f)*gScreenScale; - settings->boxCornerRadius = (cornerRadius >= 0.0f ? cornerRadius*gScreenScale : MIN(settings->boxPaddingH, settings->boxPaddingV)); - settings->softwrapRatio = (softwrapRatio > 0.0f ? softwrapRatio : 0.9f); - return (settings); -} - -static void boxDestroy(boxSettings_t **settings_p) -{ - int i; - - if (!settings_p || !*settings_p) return; - - pthread_mutex_destroy(&(*settings_p)->lock); - - // Free lines. - if ((*settings_p)->lineCount) { - for (i = 0; i < (*settings_p)->lineCount; i++) free((*settings_p)->lines[i]); - (*settings_p)->lineCount = 0; - } - free((*settings_p)->text); - free(*settings_p); - (*settings_p) = NULL; -} - -// ============================================================================ -// Public functions -// ============================================================================ - -EDEN_BOOL EdenMessageInit(const int contextsActiveCount) -{ - if (gMessageInited) return (FALSE); - - gBoxSettings = boxCreate(-1.0f, -1.0f, -1.0f, -1.0f, -1.0f); // Use defaults. - - pthread_mutex_init(&gInputLock, NULL); - gInput = gInputPtr = NULL; - gInputLength = 0; - gInputPromptLength = 0; - pthread_cond_init(&gInputCompleteCond, NULL); - gInputComplete = FALSE; - - gMessageInited = TRUE; - return (TRUE); -} - -EDEN_BOOL EdenMessageFinal(void) -{ - EDEN_BOOL ok = TRUE; - - if (!gMessageInited) return (FALSE); - - pthread_mutex_destroy(&gInputLock); - free(gInput); - gInput = gInputPtr = NULL; - gInputLength = 0; - gInputPromptLength = 0; - pthread_cond_destroy(&gInputCompleteCond); - gInputComplete = FALSE; - - boxDestroy(&gBoxSettings); - - gMessageInited = FALSE; - return (ok); -} - -unsigned char *EdenMessageInputGetInput(void) -{ - unsigned char *ret; - - pthread_mutex_lock(&gInputLock); - if (gInputPtr && gInputComplete) { - gInputPtr[gInputLength] = '\0'; // Overwrite any cursor character. - ret = (unsigned char *)strdup((char *)gInputPtr); - } else ret = NULL; - pthread_mutex_unlock(&gInputLock); - - return (ret); -} - - -#pragma mark - -// ---------------------------------------------------------------------------- -// These functions should only be called directly in single- threaded apps. -// In multi-threaded apps, they will be called indirectly. -// ---------------------------------------------------------------------------- - -EDEN_E_t EdenMessageShow(const unsigned char *msg) -{ - if (!gMessageInited) return (EDEN_E_INVALID_COMMAND); - - if (msg) { - boxSetText(gBoxSettings, msg); - } - - gEdenMessageDrawRequired = TRUE; - - return (EDEN_E_NONE); -} - -EDEN_E_t EdenMessageHide(void) -{ - if (!gMessageInited) return (EDEN_E_INVALID_COMMAND); - - gEdenMessageDrawRequired = FALSE; - - return (EDEN_E_NONE); -} - -EDEN_E_t EdenMessageInputShow(const unsigned char *prompt, const unsigned int minLength, const unsigned int maxLength, int intOnly, int fpOnly, int alphaOnly) -{ - EDEN_E_t messageErr = EDEN_E_NONE; - - if (!gMessageInited) return (EDEN_E_INVALID_COMMAND); - - pthread_mutex_lock(&gInputLock); - - if (maxLength == 0) gInputLengthMax = EDEN_MESSAGE_INPUT_MAX_LENGTH_DEFAULT; - else gInputLengthMax = maxLength; - - if (minLength > gInputLengthMax) { - messageErr = EDEN_E_OVERFLOW; - goto done; - } else gInputLengthMin = minLength; - - if (prompt) { - gInputPromptLength = (unsigned int)strlen((const char *)prompt); - } - - if (gInput) free(gInput); - gInput = (unsigned char *)malloc(gInputPromptLength + gInputLengthMax + 2); // +1 for cursor and +1 for nul-terminator. - if (!gInput) { - messageErr = EDEN_E_OUT_OF_MEMORY; - goto done; - } - if (prompt) { - strncpy((char *)gInput, (const char *)prompt, gInputPromptLength); - } - - gInputPtr = gInput + gInputPromptLength; - gInputPtr[0] = '\0'; - gInputLength = 0; - gInputCursorState = -1; - gInputComplete = FALSE; - - gInputIntOnly = intOnly; - gInputFPOnly = fpOnly; - gInputAlphaOnly = alphaOnly; - - if ((messageErr = EdenMessageShow(gInput)) != EDEN_E_NONE) { - goto done; - } - - // This signals that keys should start being sent to EdenMessageInputKeyboard() - gEdenMessageKeyboardRequired = TRUE; - -done: - pthread_mutex_unlock(&gInputLock); - return (messageErr); -} - -EDEN_E_t EdenMessageInputHide(void) -{ - if (!gMessageInited) return (EDEN_E_INVALID_COMMAND); - - gEdenMessageKeyboardRequired = FALSE; - - return (EdenMessageHide()); -} - -EDEN_BOOL EdenMessageInputIsComplete(void) -{ - int ret; - - if (!gMessageInited) return (FALSE); - - pthread_mutex_lock(&gInputLock); - ret = gInputComplete; - pthread_mutex_unlock(&gInputLock); - return (ret); -} - -#pragma mark - - -// ---------------------------------------------------------------------------- -// Functions for use in multi-threaded apps only. -// ---------------------------------------------------------------------------- -EDEN_E_t EdenMessage(unsigned char *msg, const unsigned int secs) -{ - EDEN_E_t err; - - err = EdenMessageShow(msg); - if (err != EDEN_E_NONE) return (err); - - EdenTime_sleep(secs); - - err = EdenMessageHide(); - if (err != EDEN_E_NONE) return (err); - - return (EDEN_E_NONE); -} - -EDEN_E_t EdenMessageInput(const unsigned char *prompt, const unsigned int minLength, const unsigned int maxLength, int intOnly, int fpOnly, int alphaOnly) -{ - EDEN_E_t messageErr = EDEN_E_NONE; - - if ((messageErr = EdenMessageInputShow(prompt, minLength, maxLength, intOnly, fpOnly, alphaOnly)) != EDEN_E_NONE) { - goto done; - } - - // Wait for signal from EdenMessageInputKeyboard that input is complete. - pthread_mutex_lock(&gInputLock); - if (!gInputComplete) { - pthread_cond_wait(&gInputCompleteCond, &gInputLock); - } - pthread_mutex_unlock(&gInputLock); - - messageErr = EdenMessageInputHide(); - -done: - return (messageErr); -} - -#pragma mark - -// ---------------------------------------------------------------------------- -// Functions for use in single- and double-threaded apps. -// ---------------------------------------------------------------------------- - -void EdenMessageSetViewSize(const float width, const float height) -{ - EDEN_BOOL changed = FALSE; - if (gScreenWidth != width) { - gScreenWidth = width; - changed = TRUE; - } - if (gScreenHeight != height) { - gScreenHeight = height; - changed = TRUE; - } - if (changed) boxSetText(gBoxSettings, NULL); -} - -void EdenMessageSetBoxParams(const float width, const float padding) -{ - EDEN_BOOL changed = FALSE; - if (gBoxSettings->boxWidth != width) { - gBoxSettings->boxWidth = width; - changed = TRUE; - } - if (gBoxSettings->boxPaddingH != padding || gBoxSettings->boxPaddingV != padding) { - gBoxSettings->boxPaddingH = padding; - gBoxSettings->boxPaddingV = padding; - changed = TRUE; - } - if (changed) boxSetText(gBoxSettings, NULL); -} - -void EdenMessageDraw(const int contextIndex) -{ - GLfloat boxcentrex, boxcentrey, boxwd2, boxhd2; - GLfloat boxVertices[4][2]; - const GLubyte quadIndices[4] = {0, 1, 2, 3}; -#ifdef _WIN32 - struct _timeb sys_time; -#else - struct timeval time; -#endif - int cursorState; - - if (!gBoxSettings) return; - - // Check if we need to show a blinking cursor, and if so, what state it is in. - pthread_mutex_lock(&gInputLock); - if (gInputPtr && !gInputComplete) { -#ifdef _WIN32 - _ftime(&sys_time); - if (sys_time.millitm < 500ul) cursorState = 1; - else cursorState = 0; -#else -# if defined(__linux) || defined(__APPLE__) - gettimeofday( &time, NULL ); -# else - gettimeofday( &time ); -# endif - if (time.tv_usec < 500000) cursorState = 1; - else cursorState = 0; -#endif - if (cursorState != gInputCursorState) { - gInputCursorState = cursorState; - if (cursorState == 1) { - gInputPtr[gInputLength] = '|'; - gInputPtr[gInputLength + 1] = '\0'; - } else { - gInputPtr[gInputLength] = ' '; - gInputPtr[gInputLength + 1] = '\0'; - } - EdenMessageShow(gInput); - } - } - pthread_mutex_unlock(&gInputLock); - - boxcentrex = gScreenWidth / 2.0f; - boxwd2 = gBoxSettings->boxWidth / 2; - boxcentrey = gScreenHeight / 2.0f; - boxhd2 = gBoxSettings->boxHeight / 2; - boxVertices[0][0] = boxcentrex - boxwd2; boxVertices[0][1] = boxcentrey - boxhd2; - boxVertices[1][0] = boxcentrex + boxwd2; boxVertices[1][1] = boxcentrey - boxhd2; - boxVertices[2][0] = boxcentrex + boxwd2; boxVertices[2][1] = boxcentrey + boxhd2; - boxVertices[3][0] = boxcentrex - boxwd2; boxVertices[3][1] = boxcentrey + boxhd2; - - // Draw box. - pthread_mutex_lock(&gBoxSettings->lock); - if (gBoxSettings->lineCount) { - // Draw the semi-transparent black shaded box and white outline. - glStateCacheBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glStateCacheEnableBlend(); - glVertexPointer(2, GL_FLOAT, 0, boxVertices); - glStateCacheEnableClientStateVertexArray(); - glStateCacheDisableClientStateNormalArray(); - glStateCacheClientActiveTexture(GL_TEXTURE0); - glStateCacheDisableClientStateTexCoordArray(); - glColor4f(0.0f, 0.0f, 0.0f, 0.5f); // 50% transparent black. - glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_BYTE, quadIndices); - glStateCacheDisableBlend(); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Opaque white. - glDrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_BYTE, quadIndices); - - EdenGLFontDrawBlock(contextIndex, (const unsigned char **)gBoxSettings->lines, gBoxSettings->lineCount, 0.0f, 0.0f, H_OFFSET_VIEW_CENTER_TO_TEXT_CENTER, V_OFFSET_VIEW_CENTER_TO_TEXT_CENTER); - } - pthread_mutex_unlock(&gBoxSettings->lock); - - return; -} - -EDEN_BOOL EdenMessageInputKeyboard(const unsigned char keyAsciiCode) -{ - EDEN_BOOL ret = TRUE; - - pthread_mutex_lock(&gInputLock); - if (gInputPtr && !gInputComplete) { - switch (keyAsciiCode) { - case EDEN_ASCII_ESC: - free(gInput); - gInput = gInputPtr = NULL; - gInputLength = 0; - gInputComplete = TRUE; - pthread_cond_signal(&gInputCompleteCond); - break; - case EDEN_ASCII_CR: - if (gInputLength >= gInputLengthMin) { - gInputComplete = TRUE; - pthread_cond_signal(&gInputCompleteCond); - } - break; - case EDEN_ASCII_BS: - case EDEN_ASCII_DEL: - if (gInputLength > 0) { - gInputLength--; - gInput[gInputLength] = '\0'; - if (EdenMessageShow(gInput) != EDEN_E_NONE) { - ret = FALSE; - goto done; - } - } - break; - default: - if (keyAsciiCode < ' ') break; // Throw away all other control characters. - if (gInputIntOnly && (keyAsciiCode < '0' || keyAsciiCode > '9')) break; - if (gInputFPOnly && (keyAsciiCode < '0' || keyAsciiCode > '9') && keyAsciiCode != '.') break; - if (gInputAlphaOnly && (keyAsciiCode < 'A' || keyAsciiCode > 'Z') && (keyAsciiCode < 'a' || keyAsciiCode > 'z')) break; - if (gInputLength < gInputLengthMax) { - gInput[gInputLength] = keyAsciiCode; - gInputLength++; - gInput[gInputLength] = '\0'; - if (EdenMessageShow(gInput) != EDEN_E_NONE) { - ret = FALSE; - goto done; - } - } - break; - } - } -done: - pthread_mutex_unlock(&gInputLock); - - return (ret); -} diff --git a/lib/SRC/Eden/EdenSound.c b/lib/SRC/Eden/EdenSound.c deleted file mode 100644 index e580b74..0000000 --- a/lib/SRC/Eden/EdenSound.c +++ /dev/null @@ -1,269 +0,0 @@ -// -// EdenSound.c -// -// Copyright (c) 2012-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0 2012-12-23 PRL Initial version -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -#include -#include - -#ifdef EDEN_HAVE_OPENAL -# include "ALFramework.h" -#endif // EDEN_HAVE_OPENAL - -static unsigned int refCount = 0; - -struct _EdenSound { -#ifdef EDEN_HAVE_OPENAL - ALuint uiBuffer; - ALuint uiSource; -#else - int dummy; -#endif // EDEN_HAVE_OPENAL -}; - -EdenSound_t *EdenSoundLoad(const char *pathname) -{ - EdenSound_t *sound = NULL; - -#ifdef EDEN_HAVE_OPENAL - // One-time initialisation. - if (refCount == 0) { -#ifdef EDEN_HAVE_OPENAL - ALFWInit(); - if (!ALFWInitOpenAL()) { - ALFWprintf("Failed to initialize OpenAL\n"); - ALFWShutdown(); - } -#endif // EDEN_HAVE_OPENAL - } - - if (!(sound = (EdenSound_t *)calloc(1, sizeof(EdenSound_t)))) { - EDEN_LOGe("Out of memory!\n"); - return (NULL); - } - -#ifdef EDEN_HAVE_OPENAL - alGenBuffers(1, &sound->uiBuffer); -#ifdef _WIN32 - if (!ALFWLoadWaveToBuffer(pathname, sound->uiBuffer)) { - EDEN_LOGe("Failed to load .wav file '%s'.\n", pathname); - } -#endif -#ifdef __APPLE__ - if (!ALFWLoadFileToBuffer(pathname, sound->uiBuffer)) { - EDEN_LOGe("Failed to load audio file '%s'.\n", pathname); - } -#endif - alGenSources(1, &sound->uiSource); - alSourcei(sound->uiSource, AL_BUFFER, sound->uiBuffer); -#endif // EDEN_HAVE_OPENAL - - refCount++; -#endif // EDEN_HAVE_OPENAL - - return (sound); -} - -void EdenSoundUnload(EdenSound_t **sound_p) -{ - if (!sound_p) return; - if (!(*sound_p)) return; - -#ifdef EDEN_HAVE_OPENAL - alSourceStop((*sound_p)->uiSource); - alDeleteSources(1, &(*sound_p)->uiSource); - alDeleteBuffers(1, &(*sound_p)->uiBuffer); -#endif // EDEN_HAVE_OPENAL - - free(*sound_p); - *sound_p = NULL; - - // One-time cleanup. - refCount--; - if (refCount == 0) { -#ifdef EDEN_HAVE_OPENAL - ALFWShutdownOpenAL(); - ALFWShutdown(); -#endif // EDEN_HAVE_OPENAL - } -} - -void EdenSoundPlay(EdenSound_t *sound) -{ - if (!sound) return; - -#ifdef EDEN_HAVE_OPENAL - alSourcePlay(sound->uiSource); -#endif // EDEN_HAVE_OPENAL -} - -void EdenSoundPause(EdenSound_t *sound) -{ - if (!sound) return; - -#ifdef EDEN_HAVE_OPENAL - alSourcePause(sound->uiSource); -#endif // EDEN_HAVE_OPENAL -} - -void EdenSoundRewind(EdenSound_t *sound) -{ - if (!sound) return; - -#ifdef EDEN_HAVE_OPENAL - alSourceRewind(sound->uiSource); -#endif // EDEN_HAVE_OPENAL -} - -void EdenSoundStop(EdenSound_t *sound) -{ - if (!sound) return; - -#ifdef EDEN_HAVE_OPENAL - alSourceStop(sound->uiSource); -#endif // EDEN_HAVE_OPENAL -} - -/* - Source State Query - The application can query the current state of any source using alGetSource with the parameter name AL_SOURCE_STATE. Each source can be in one of four possible execution states: AL_INITIAL, AL_PLAYING, AL_PAUSED, AL_STOPPED. Sources that are either AL_PLAYING or AL_PAUSED are considered active. Sources that are AL_STOPPED or AL_INITIAL are considered inactive. Only AL_PLAYING sources are included in the processing. The implementation is free to skip those processing stages for sources that have no effect on the output (e.g. mixing for a source muted by zero GAIN, but not sample offset increments). Depending on the current state of a source certain (e.g. repeated) state transition commands are legal NOPs: they will be ignored, no error is generated. - State Transition Commands - The default state of any source is INITIAL. From this state it can be propagated to any other state by appropriate use of the commands below. There are no irreversible state transitions. - - void alSourcePlay (ALuint sName); - void alSourcePause (ALuint sName); - void alSourceStop (ALuint sName); - void alSourceRewind (ALuint sName); - - The following state/command/state transitions are defined: - - alSourcePlay applied to an AL_INITIAL source will promote the source to AL_PLAYING, thus the data found in the buffer will be fed into the processing, starting at the beginning. alSourcePlay applied to a AL_PLAYING source will restart the source from the beginning. It will not affect the configuration, and will leave the source in AL_PLAYING state, but reset the sampling offset to the beginning. alSourcePlay applied to a AL_PAUSED source will resume processing using the source state as preserved at the alSourcePause operation. alSourcePlay applied to a AL_STOPPED source will propagate it to AL_INITIAL then to AL_PLAYING immediately. - alSourcePause applied to an AL_INITIAL source is a legal NOP. alSourcePause applied to a AL_PLAYING source will change its state to AL_PAUSED. The source is exempt from processing, its current state is preserved. alSourcePause applied to a AL_PAUSED source is a legal NOP. alSourcePause applied to a AL_STOPPED source is a legal NOP. - alSourceStop applied to an AL_INITIAL source is a legal NOP. alSourceStop applied to a AL_PLAYING source will change its state to AL_STOPPED. The source is exempt from processing, its current state is preserved. alSourceStop applied to a AL_PAUSED source will change its state to AL_STOPPED, with the same consequences as on a AL_PLAYING source. alSourceStop applied to a AL_STOPPED source is a legal NOP. - alSourceRewind applied to an AL_INITIAL source is a legal NOP. alSourceRewind applied to a AL_PLAYING source will change its state to AL_STOPPED then AL_INITIAL. The source is exempt from processing: its current state is preserved, with the exception of the sampling offset, which is reset to the beginning. alSourceRewind applied to a AL_PAUSED source will change its state to AL_INITIAL, with the same consequences as on a AL_PLAYING source. alSourceRewind applied to an AL_STOPPED source promotes the source to AL_INITIAL, resetting the sampling offset to the beginning. - Resetting Configuration - Promoting a source to the AL_INITIAL state using alSourceRewind will not reset the source's properties. AL_INITIAL merely indicates that the source can be executed using the alSourcePlay command. An AL_STOPPED or AL_INITIAL source can be reset into the default configuration by using a sequence of source commands as necessary. As the application has to specify all relevant state anyway to create a useful source configuration, no reset command is provided. - */ -EDEN_BOOL EdenSoundIsPlaying(EdenSound_t *sound) -{ -#ifdef EDEN_HAVE_OPENAL - ALint iState; -#endif // EDEN_HAVE_OPENAL - - if (!sound) return (FALSE); - -#ifdef EDEN_HAVE_OPENAL - alGetSourcei(sound->uiSource, AL_SOURCE_STATE, &iState); - return (iState == AL_PLAYING); -#else - return (FALSE); -#endif // EDEN_HAVE_OPENAL -} - -EDEN_BOOL EdenSoundIsPaused(EdenSound_t *sound) -{ -#ifdef EDEN_HAVE_OPENAL - ALint iState; -#endif // EDEN_HAVE_OPENAL - - if (!sound) return (FALSE); - -#ifdef EDEN_HAVE_OPENAL - alGetSourcei(sound->uiSource, AL_SOURCE_STATE, &iState); - return (iState == AL_PAUSED); -#else - return (FALSE); -#endif // EDEN_HAVE_OPENAL -} - -void EdenSoundSetLooping(EdenSound_t *sound, EDEN_BOOL looping) -{ - if (!sound) return; - -#ifdef EDEN_HAVE_OPENAL - alSourcei(sound->uiSource, AL_LOOPING, looping); -#endif // EDEN_HAVE_OPENAL -} - -EDEN_BOOL EdenSoundIsLooping(EdenSound_t *sound) -{ -#ifdef EDEN_HAVE_OPENAL - ALint looping; -#endif // EDEN_HAVE_OPENAL - - if (!sound) return (FALSE); - -#ifdef EDEN_HAVE_OPENAL - alGetSourcei(sound->uiSource, AL_LOOPING, &looping); - return (looping == AL_TRUE); -#else - return (FALSE); -#endif // EDEN_HAVE_OPENAL -} - -EDEN_BOOL EdenSoundIsStopped(EdenSound_t *sound) -{ -#ifdef EDEN_HAVE_OPENAL - ALint iState; -#endif // EDEN_HAVE_OPENAL - - if (!sound) return (FALSE); - -#ifdef EDEN_HAVE_OPENAL - alGetSourcei(sound->uiSource, AL_SOURCE_STATE, &iState); - return (iState == AL_STOPPED); -#else - return (FALSE); -#endif // EDEN_HAVE_OPENAL -} - -float EdenSoundGetPlaybackTimeInSecs(EdenSound_t *sound) -{ -#ifdef EDEN_HAVE_OPENAL - ALfloat time; -#endif // EDEN_HAVE_OPENAL - - if (!sound) return (0.0f); - -#ifdef EDEN_HAVE_OPENAL - alGetSourcef(sound->uiSource, AL_SEC_OFFSET, &time); - return (time); -#else - return (0.0f); -#endif // EDEN_HAVE_OPENAL -} - diff --git a/lib/SRC/Eden/EdenSurfaces.c b/lib/SRC/Eden/EdenSurfaces.c deleted file mode 100644 index f1f43f0..0000000 --- a/lib/SRC/Eden/EdenSurfaces.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * EdenSurfaces.c - * - * Copyright (c) 2001-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. - * - * Rev Date Who Changes - * 1.0.0 2001-11-11 PRL Initial version for The SRMS simulator. - * 1.1.0 2008-07-18 PRL Repurposed for OpenGL ES. - * 1.2.0 2010-09-22 PRL Remove redundant static material handling. - */ - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// ============================================================================ -// Private includes -// ============================================================================ -#include - -#include -#include // strcmp() -#include // malloc(), calloc(), free() -#include // ReadTex() -#include // MIN(), MAX() -#ifndef EDEN_OPENGLES -# define DISABLE_GL_STATE_CACHE -#endif -#include "glStateCache.h" -#ifndef GL_GENERATE_MIPMAP -# define GL_GENERATE_MIPMAP 0x8191 -#endif - -// ============================================================================ -// Private types -// ============================================================================ -//#define SURFACES_DEBUG // Uncomment to build version that outputs debug info to stderr. - -typedef struct { - GLuint name; - GLint env_mode; - //GLfloat env_color[4]; - GLfloat maxS; // maxS = (GLfloat)contentWidth / (GLfloat)width; - GLfloat maxT; // maxT = (GLfloat)contentHeight / (GLfloat)height; - GLuint contentWidth; - GLuint contentHeight; -} TEXTURE_t; - -// ============================================================================ -// Global variables -// ============================================================================ -static TEXTURE_t *gTextures = NULL; // For our texture heaps (one per context.) -static unsigned int *gTextureIndexPtr = NULL; // For pointer into each heap. -static unsigned int gTextureIndexMax = 0; -static int gSurfacesContextsActiveCount = 0; - - -// ============================================================================ -// Public functions -// ============================================================================ - -EDEN_BOOL EdenSurfacesInit(const int contextsActiveCount, const int textureIndexMax) -{ - if (gSurfacesContextsActiveCount) return (FALSE); - - gTextures = (TEXTURE_t *)calloc(textureIndexMax * contextsActiveCount, sizeof(TEXTURE_t)); - gTextureIndexPtr = (unsigned int *)calloc(contextsActiveCount, sizeof(unsigned int)); - gTextureIndexMax = textureIndexMax; - - gSurfacesContextsActiveCount = contextsActiveCount; - - return (TRUE); -} - -EDEN_BOOL EdenSurfacesFinal(void) -{ - if (!gSurfacesContextsActiveCount) return (FALSE); - - gTextureIndexMax = 0; - free(gTextureIndexPtr); gTextureIndexPtr = NULL; - free(gTextures); gTextures = NULL; - - gSurfacesContextsActiveCount = 0; - return (TRUE); -} - -EDEN_BOOL EdenSurfacesTextureLoad(const int contextIndex, const int numTextures, const TEXTURE_INFO_t *textureInfo, TEXTURE_INDEX_t *textureIndices, char *hasAlpha_out) -{ - return (EdenSurfacesTextureLoad2(contextIndex, numTextures, textureInfo, textureIndices, hasAlpha_out, FALSE, FALSE)); -} - -EDEN_BOOL EdenSurfacesTextureLoad2(const int contextIndex, const int numTextures, const TEXTURE_INFO_t *textureInfo, TEXTURE_INDEX_t *textureIndices, char *hasAlpha_out, const EDEN_BOOL flipH, const EDEN_BOOL flipV) -{ - GLint textureSizeMax; - GLboolean haveLimitedNPOT, haveNPOT; - int i; - unsigned int ptr; - unsigned int offset; - EDEN_BOOL ok = TRUE; - unsigned char *data = NULL; - int nc, sizeX, sizeY, textureSizeX, textureSizeY; - GLenum format; - - if (contextIndex < 0 || contextIndex >= gSurfacesContextsActiveCount) return (FALSE); // Sanity check. - - glStateCachePixelStoreUnpackAlignment(1); // ReadTex returns tightly packed texture data. - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &textureSizeMax); -#ifdef EDEN_OPENGLES - haveLimitedNPOT = EdenGLCapabilityCheck(0u, (const unsigned char *)"GL_APPLE_texture_2D_limited_npot"); - haveNPOT = EdenGLCapabilityCheck(0u, (const unsigned char *)"GL_OES_texture_npot"); -#else - haveLimitedNPOT = FALSE; - haveNPOT = EdenGLCapabilityCheck(0x200, (const unsigned char *)"GL_ARB_texture_non_power_of_two"); -#endif - if (hasAlpha_out) *hasAlpha_out = 0; // Will be set if any textures have alpha. - - for (i = 0; i < numTextures; i++) { - - // Assign no name to begin with. If all OK, we'll assign a valid name. - textureIndices[i] = 0; - - // Find a free slot in the texture array. - ptr = gTextureIndexPtr[contextIndex]; - while (gTextures[contextIndex * gTextureIndexMax + ptr].name != 0) { - ptr++; - if (ptr == gTextureIndexMax) ptr = 0; // Loop around. - if (ptr == gTextureIndexPtr[contextIndex]) break; // Quit if we're back where we started. - } - if (gTextures[contextIndex * gTextureIndexMax + ptr].name != 0) { - EDEN_LOGe("EdenSurfacesTextureLoad(): Error, maximum number of textures already loaded.\n"); - ok = FALSE; - continue; - } - gTextureIndexPtr[contextIndex] = ptr; // Speed up next search by saving index. - -#ifndef EDEN_OPENGLES - // OpenGL 1.4 is required for automatic mipmap generation. - if (textureInfo[i].mipmaps) { - if (!EdenGLCapabilityCheck(0x0140, NULL)) { - EDEN_LOGe("ReadTex(): Error: OpenGL implementation does not support automatic mipmap generation.\n"); - ok = FALSE; - continue; - } - } -#endif - - offset = contextIndex * gTextureIndexMax + ptr; - glGenTextures(1, &(gTextures[offset].name)); - gTextures[offset].env_mode = textureInfo[i].env_mode; - - // Bind the texture object and set its initial state. - glStateCacheActiveTexture(GL_TEXTURE0); - glStateCacheBindTexture2D(gTextures[offset].name); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, textureInfo[i].min_filter); // Subsampling when minifying. - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, textureInfo[i].mag_filter); // Interpolation when magnifying. - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textureInfo[i].wrap_s); // What to do with pixels outside [0,1]. - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textureInfo[i].wrap_t); // What to do with pixels outside [0,1]. -#ifndef EDEN_OPENGLES - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, textureInfo[i].priority); -#endif - - // Read and send the actual texture data to GL. -#ifdef SURFACES_DEBUG - EDEN_LOGe("EdenSurfacesTextureLoad(): loading file '%s'\n", textureInfo[i].pathname); -#endif - if (!(data = ReadTex(textureInfo[i].pathname, &sizeX, &sizeY, &nc))) { // Load image. - EDEN_LOGe("EdenSurfacesTextureLoad(): Unable to read file '%s'.\n", textureInfo[i].pathname); - ok = FALSE; - continue; - } else { - -#ifdef SURFACES_DEBUG - EDEN_LOGe("EdenSurfacesTextureLoad(): image is %dx%d (%d-channel)\n", sizeX, sizeY, nc); -#endif - // Do an in-place image flip if requested. - if (flipH || flipV) { - - unsigned char *p0, *p1; - int c, x, y; - - // Work out pointers. - p0 = p1 = data; - if (flipV) p1 += (sizeY - 1)*sizeX*nc; // Move to last row. - if (flipH) p1 += (sizeX - 1)*nc; // Move to last column. - - if (flipV && flipH) { - while (p0 < p1) { - for (c = 0; c < nc; c++) { - unsigned char t = p0[c]; - p0[c] = p1[c]; - p1[c] = t; - } - p0 += nc; - p1 -= nc; - } - } else if (flipV) { - while (p0 < p1) { - for (x = 0; x < sizeX; x++) { - for (c = 0; c < nc; c++) { - unsigned char t = p0[x*nc + c]; - p0[x*nc + c] = p1[x*nc + c]; - p1[x*nc + c] = t; - } - } - p0 += sizeX*nc; - p1 -= sizeX*nc; - } - } else /* flipH */ { - while (p0 < p1) { - for (y = 0; y < sizeY; y++) { - for (c = 0; c < nc; c++) { - unsigned char t = p0[y*sizeX*nc + c]; - p0[y*sizeX*nc + c] = p1[y*sizeX*nc + c]; - p1[y*sizeX*nc + c] = t; - } - } - p0 += nc; - p1 -= nc; - } - } - } - - if (nc == 3) { - format = GL_RGB; - } else if (nc == 4) { - format = GL_RGBA; - } else if (nc == 1) { - if (textureInfo[i].internalformat == GL_ALPHA) format = GL_ALPHA; - else format = GL_LUMINANCE; - } else { - /* not implemented */ - EDEN_LOGe("EdenSurfacesTextureLoad(): %d-component images not supported.\n", nc); - free(data); - ok = FALSE; - continue; - } - - // Check texturing capabilities can accomodate the image. - if (sizeX > textureSizeMax || sizeY > textureSizeMax) { - EDEN_LOGe("EdenSurfacesTextureLoad(): Image exceeds maximum texture size (%d).\n", (int)(textureSizeMax)); - free(data); - ok = FALSE; - continue; - } - - if (haveNPOT || (!textureInfo[i].mipmaps && haveLimitedNPOT)) { - textureSizeX = sizeX; - textureSizeY = sizeY; - } else { - // Work out how big power-of-two textures needs to be. - textureSizeX = textureSizeY = 1; - while (textureSizeX < sizeX) textureSizeX <<= 1; - while (textureSizeY < sizeY) textureSizeY <<= 1; - } - - // Upload data. - if (textureInfo[i].mipmaps) glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); - if (sizeX == textureSizeX && sizeY == textureSizeY) { - glTexImage2D(GL_TEXTURE_2D, 0, format, textureSizeX, textureSizeY, 0, format, GL_UNSIGNED_BYTE, data); - } else { - // Request OpenGL allocate memory internally for a power-of-two texture of the appropriate size. - glTexImage2D(GL_TEXTURE_2D, 0, format, textureSizeX, textureSizeY, 0, format, GL_UNSIGNED_BYTE, NULL); - // Then send the NPOT-data as a subimage. - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, sizeX, sizeY, format, GL_UNSIGNED_BYTE, data); - } - - free(data); - - // Stash info for later. - gTextures[offset].contentWidth = sizeX; - gTextures[offset].contentHeight = sizeY; - gTextures[offset].maxS = (GLfloat)sizeX / (GLfloat)textureSizeX; - gTextures[offset].maxT = (GLfloat)sizeY / (GLfloat)textureSizeY; - - // Info we need to return. - textureIndices[i] = ptr + 1; - if (hasAlpha_out) *hasAlpha_out = (format == GL_RGBA || format == GL_ALPHA); - } - } - - return (ok); -} - -void EdenSurfacesTextureSet(const int contextIndex, TEXTURE_INDEX_t textureIndex) -{ - unsigned int offset; - - if (textureIndex > 0 && textureIndex <= gTextureIndexMax) { - offset = contextIndex * gTextureIndexMax + textureIndex - 1; - glStateCacheActiveTexture(GL_TEXTURE0); - glStateCacheBindTexture2D(gTextures[offset].name); - glStateCacheTexEnvMode(gTextures[offset].env_mode); // Environment mode specific to this texture. - //glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, gTextures[offset].env_color); // Environment colour specific to this texture. - } -} - -EDEN_BOOL EdenSurfacesTextureUnload(const int contextIndex, const int numTextures, TEXTURE_INDEX_t *textureIndices) -{ - EDEN_BOOL ok = TRUE; - int i; - - if (contextIndex < 0 || contextIndex >= gSurfacesContextsActiveCount) return (FALSE); // Sanity check. - - glStateCacheActiveTexture(GL_TEXTURE0); - glStateCacheBindTexture2D(0); - for (i = 0; i < numTextures; i++) { - glDeleteTextures(1, &(gTextures[contextIndex * gTextureIndexMax + textureIndices[i] - 1].name)); - gTextures[contextIndex * gTextureIndexMax + textureIndices[i] - 1].name = 0; - textureIndices[i] = 0; - } - return (ok); -} - -EDEN_BOOL EdenSurfacesDraw(const int contextIndex, const TEXTURE_INDEX_t textureIndex, const int width, const int height, const EDEN_TEXTURE_SCALING_MODE scaleMode, const EDEN_TEXTURE_ALIGNMENT_MODE alignMode) -{ - unsigned int offset; - GLfloat vertices[4][2] = { {0.0f, 0.0f}, {width, 0.0f}, {width, height}, {0.0f, height} }; - GLfloat normals[4][3] = { {0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 1.0f} }; - GLfloat texcoords[4][2]; - float aspectRatio, contentAspectRatio, S, T, maxS, maxT, S0, S1, T0, T1; - - if (contextIndex < 0 || contextIndex >= gSurfacesContextsActiveCount) return (FALSE); // Sanity check. - if (textureIndex < 1 || textureIndex > gTextureIndexMax) return (FALSE); - - offset = contextIndex * gTextureIndexMax + textureIndex - 1; - - // Calculate S and T as proportion of valid texture to be used in S and T dimensions, e.g. 1.0f == use 100% of texture. - if (scaleMode == STRETCH) { - S = 1.0f; - T = 1.0f; - } else if (scaleMode == FILL || scaleMode == FIT) { - // For FILL mode: if aspectRatio > contentAspectRatio, content is too tall and will be cropped top and bottom. If aspectRatio < contentAspectRatio, content is too wide and will be cropped left and right. - // For FIT mode: if aspectRatio > contentAspectRatio, content is too narrow and will be placed inside black bars left and right. If aspectRatio < contentAspectRatio, content is too short and will be placed inside black bars top and bottom. - aspectRatio = (float)width / (float)height; - contentAspectRatio = (float)gTextures[offset].contentWidth / (float)gTextures[offset].contentHeight; - if (scaleMode == FILL) { - S = (aspectRatio > contentAspectRatio ? 1.0f : aspectRatio / contentAspectRatio); - T = (aspectRatio > contentAspectRatio ? contentAspectRatio / aspectRatio : 1.0f ); - } else /*if (scaleMode == FIT)*/ { - S = (aspectRatio > contentAspectRatio ? aspectRatio / contentAspectRatio : 1.0f ); // S >= 1. - T = (aspectRatio > contentAspectRatio ? 1.0f : contentAspectRatio / aspectRatio); // T >= 1. - } - } else { // UNITY - S = width / (float)gTextures[offset].contentWidth; // Could also be > 1. - T = height / (float)gTextures[offset].contentHeight; // Could also be > 1. - } - // Now convert into actual texture coordinate units. - maxS = gTextures[offset].maxS; - maxT = gTextures[offset].maxT; - S *= maxS; - T *= maxT; - - if (alignMode == TOP_LEFT || alignMode == LEFT || alignMode == BOTTOM_LEFT) {S0 = 0.0f ; S1 = S;} - else if (alignMode == TOP_RIGHT || alignMode == RIGHT || alignMode == BOTTOM_RIGHT) {S0 = maxS - S; S1 = maxS;} - else {S0 = maxS*0.5f - S*0.5f; S1 = maxS*0.5f + S*0.5f;} - - if (alignMode == BOTTOM_LEFT || alignMode == BOTTOM || alignMode == BOTTOM_RIGHT) {T0 = 0.0f ; T1 = T;} - else if (alignMode == TOP_LEFT || alignMode == TOP || alignMode == TOP_RIGHT) {T0 = maxT - T; T1 = maxT;} - else {T0 = maxT*0.5f - T*0.5f; T1 = maxT*0.5f + T*0.5f;} - - texcoords[0][0] = S0; texcoords[0][1] = T1; // Flip incoming image in Y axis. - texcoords[1][0] = S1; texcoords[1][1] = T1; - texcoords[2][0] = S1; texcoords[2][1] = T0; - texcoords[3][0] = S0; texcoords[3][1] = T0; - - glVertexPointer(2, GL_FLOAT, 0, vertices); - glStateCacheEnableClientStateVertexArray(); - glNormalPointer(GL_FLOAT, 0, normals); - glStateCacheEnableClientStateNormalArray(); - glStateCacheClientActiveTexture(GL_TEXTURE0); - glTexCoordPointer(2, GL_FLOAT, 0, texcoords); - glStateCacheEnableClientStateTexCoordArray(); - glStateCacheActiveTexture(GL_TEXTURE0); - glStateCacheBindTexture2D(gTextures[offset].name); - glStateCacheTexEnvMode(gTextures[offset].env_mode); // Environment mode specific to this texture. - glStateCacheEnableTex2D(); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - return (TRUE); -} - -GLboolean EdenGluCheckExtension(const GLubyte* extName, const GLubyte *extString) -{ - const GLubyte *start; - GLubyte *where, *terminator; - - // Extension names should not have spaces. - where = (GLubyte *)strchr((const char *)extName, ' '); - if (where || *extName == '\0') - return GL_FALSE; - // It takes a bit of care to be fool-proof about parsing the - // OpenGL extensions string. Don't be fooled by sub-strings, etc. - start = extString; - for (;;) { - where = (GLubyte *) strstr((const char *)start, (const char *)extName); - if (!where) - break; - terminator = where + strlen((const char *)extName); - if (where == start || *(where - 1) == ' ') - if (*terminator == ' ' || *terminator == '\0') - return GL_TRUE; - start = terminator; - } - return GL_FALSE; -} - -int EdenGLCapabilityCheck(const unsigned short minVersion, const unsigned char *extension) -{ - const GLubyte *strVersion; - const GLubyte *strExtensions; - short j, shiftVal; - unsigned short version = 0; // binary-coded decimal gl version (ie. 1.4 is 0x0140). - - if (minVersion > 0) { - strVersion = glGetString(GL_VERSION); -#ifdef EDEN_OPENGLES - j = 13; // Of the form "OpenGL ES-XX 1.1", where XX=CM for common, CL for common lite. -#else - j = 0; -#endif - shiftVal = 8; - // Construct BCD version. - while (((strVersion[j] <= '9') && (strVersion[j] >= '0')) || (strVersion[j] == '.')) { // Get only basic version info (until first non-digit or non-.) - if ((strVersion[j] <= '9') && (strVersion[j] >= '0')) { - version += (strVersion[j] - '0') << shiftVal; - shiftVal -= 4; - } - j++; - } - if (version >= minVersion) return (TRUE); - } - - if (extension) { - strExtensions = glGetString(GL_EXTENSIONS); - if (EdenGluCheckExtension(extension, strExtensions)) return (TRUE); - } - - return (FALSE); -} diff --git a/lib/SRC/Eden/EdenTime.c b/lib/SRC/Eden/EdenTime.c deleted file mode 100644 index 137461d..0000000 --- a/lib/SRC/Eden/EdenTime.c +++ /dev/null @@ -1,206 +0,0 @@ -// -// EdenTime.c -// -// Copyright (c) 2001-2012 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0.0 20011126 PRL Initial version for The SRMS simulator. -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// ============================================================================ -// Includes -// ============================================================================ -#include -#include // NULL, sprintf() -#include // ctime(), time_t -#include // strncpy() -#if defined(EDEN_UNIX) -# include // gettimeofday(), struct timeval -# include // sleep(), usleep() -#elif defined(_WIN32) -# include // FILETIME, GetSystemTimeAsFileTime(), Sleep() -#elif defined(EDEN_MACOS) -# include // Microseconds() -# include // Delay() -#else -# include -#endif - -// ============================================================================ -// Private defines -// ============================================================================ -#ifdef _WIN32 -# define FILETIME_TO_EPOCH_OFFSET (((LONGLONG)27111902 << 32) + (LONGLONG)3577643008) -#endif // _WIN32 - -// ============================================================================ -// Global variables -// ============================================================================ - -// ============================================================================ -// Private functions -// ============================================================================ - -// ============================================================================ -// Public functions -// ============================================================================ - - -// -// Get time in fractional seconds. -// Supported via system calls on Unix, WIN32, and MacOS. -// Other systems which support GLUT are also supported (with lesser accuracy.) -// -double EdenTimeInSeconds(void) -{ -#if defined(EDEN_UNIX) - struct timeval tv; // Seconds and microseconds since Jan 1, 1970. -#elif defined(_WIN32) - FILETIME ft; // Hundreds of nanoseconds since Jan 1, 1601. -#elif defined(EDEN_MACOS) - UnsignedWide _time; -#else - int ms; -#endif - - -#if defined(EDEN_UNIX) - gettimeofday(&tv, NULL); - return ((double)tv.tv_sec + (double)tv.tv_usec * 0.000001); -#elif defined(_WIN32) - GetSystemTimeAsFileTime(&ft); - return ((double)(*((LONGLONG *)&ft) - FILETIME_TO_EPOCH_OFFSET) * 0.0000001); -#elif defined(EDEN_MACOS) - Microseconds(&_time); - return (4294.967296 * (double)_time.hi + 0.000001 * (double)_time.lo); // 2^32 = 4294967296. -#else - ms = glutGet(GLUT_ELAPSED_TIME); - return ((double)ms / 1000.0); -#endif -} - -// -// Get an absolute time in seconds and nanoseconds elapsed since -// epoch (Jan 1, 1970), add parameter 'microseconds' microseconds -// and return in a timespec structure, suitable e.g. for passing to -// functions such as pthread_cond_timedwait(). -// Supported via system calls on Unix, and WIN32. -// -void EdenTimeAbsolutePlusOffset(struct timespec *result, const long microseconds) -{ - long overflow; -#if defined(EDEN_UNIX) - struct timeval tv; // Seconds and microseconds elapsed since Jan 1, 1970. -#elif defined(_WIN32) - FILETIME ft; // Number of hundred-nanosecond intervals elapsed since Jan 1, 1601. - LONGLONG epocht; // Number of hundred-nanosecond intervals elapsed since Jan 1, 1970. -#else -# error "Don't know how to get the time on this platform." -#endif - -#if defined(EDEN_UNIX) - gettimeofday(&tv, NULL); - result->tv_sec = (long)tv.tv_sec; - result->tv_nsec = ((long)tv.tv_usec + microseconds) * 1000l; -#elif defined(_WIN32) - GetSystemTimeAsFileTime(&ft); - epocht = *((LONGLONG *)&ft) - FILETIME_TO_EPOCH_OFFSET; - result->tv_sec = (long)(epocht / (LONGLONG)10000000l); // 10e6. - result->tv_nsec = (long)(epocht - ((LONGLONG)(result->tv_sec) * (LONGLONG)10000000l)) * 100l + microseconds * 1000l; -#endif - overflow = result->tv_nsec / 1000000000l; // 1e9. - if (overflow) { - result->tv_sec += overflow; - result->tv_nsec -= overflow * 1000000000l; // 1e9. - } -} - -// -// Put character string with a human-readable representation of the -// time passed in parameter 'seconds' into 's'. Returns 's'. -// -char *EdenTimeInSecondsToText(const double seconds, char s[25]) -{ - static char buf[64]; -#if defined(EDEN_UNIX) || defined(_WIN32) - time_t time; -#endif - -#if defined(EDEN_UNIX) || defined(_WIN32) - // Get 24-char-wide time & date string, plus \n and \0 for total of 26 bytes. - time = (time_t)seconds; // Truncate to integer. -#ifdef EDEN_HAVE_CTIME_R_IN_TIME_H - ctime_r(&time, buf); // Use reentrant ctime if it's available. -#else - strcpy(buf, ctime(&time)); -#endif // EDEN_HAVE_CTIME_R_IN_TIME_H - buf[24] = '\0'; // Nuke the newline. -#else - // No way of knowing what seconds is measured relative to. - // so just write seconds as number out to string to 3 decimal places. - sprintf(buf, "%.3f"); -#endif // EDEN_UNIX || _WIN32 - strncpy(s, buf, 24); - s[24] = '\0'; // Make sure that s is null-terminated even if buf was 24 or more characters long. - return (s); -} - -#ifndef _WINRT -void EdenTime_usleep(const unsigned int microseconds) -{ -#if defined(EDEN_UNIX) - usleep(microseconds); -#elif defined(_WIN32) - Sleep((DWORD)(microseconds/1000u)); -#elif defined(EDEN_MACOS) - UInt32 finalCount; - Delay((unsigned long)((float)microseconds*(60.0f/1000000.0f)), &finalCount); -#else -# error sleep not defined on this platform. -#endif -} -#endif // !_WINRT - -void EdenTime_sleep(const unsigned int seconds) -{ -#if defined(EDEN_UNIX) - sleep(seconds); -#elif defined(_WIN32) - Sleep((DWORD)(seconds*1000u)); -#elif defined(EDEN_MACOS) - UInt32 finalCount; - Delay((unsigned long)(seconds*60u), &finalCount); -#else -# error sleep not defined on this platform. -#endif -} diff --git a/lib/SRC/Eden/EdenUtil.c b/lib/SRC/Eden/EdenUtil.c deleted file mode 100644 index 371fffb..0000000 --- a/lib/SRC/Eden/EdenUtil.c +++ /dev/null @@ -1,411 +0,0 @@ -// -// EdenUtil.c -// -// Various OS-related bits and pieces. -// -// Copyright (c) 2004-2013 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0.0 2004-04-23 PRL Added functions for checking keyboard. -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -// ============================================================================ -// Private includes -// ============================================================================ -#include -#include // fprintf(), stderr, stdin, fileno(), perror() -#include // strdup(), strrchr() -#include // malloc() -#include // isalpha(), tolower(). -#if defined(EDEN_UNIX) -# include // struct termios, tcgetattr(), tcsetattr() -# include // bzero(), required for FD_ZERO(). -# define SELECT_IS_IN_SELECT_H 1 -# if SELECT_IS_IN_SELECT_H -# include // fd_set, FD_ZERO(), FD_SET(), select() -# else -# include -# include -# endif -# include // MAXPATHLEN -# ifdef __APPLE__ -# include // _NSGetExecutablePath() -# endif -# include // getcwd() -#elif defined(_WIN32) -# include -# define MAXPATHLEN MAX_PATH -# include // _getcwd() -# define getcwd _getcwd -# include // kbhit() -#endif // EDEN_UNIX - -// ============================================================================ -// Private defines and types -// ============================================================================ - -// ============================================================================ -// Global variables -// ============================================================================ -#ifdef EDEN_UNIX -static struct termios gEdenKeyboardHitTermiosSaved; -#endif - -// ============================================================================ -// Private functions -// ============================================================================ - - -// ============================================================================ -// Public functions -// ============================================================================ - -// -// Do any required setup so that we can check for single keypresses. -// -EDEN_BOOL EdenKeyboardHitSetup(void) -{ -#ifdef EDEN_UNIX - struct termios t; - - // Put the terminal into single character mode. - tcgetattr(fileno(stdin), &t); - gEdenKeyboardHitTermiosSaved = t; // Save current settings. - t.c_lflag &= (~ICANON); - t.c_cc[VTIME] = 0; - t.c_cc[VMIN] = 1; - if (tcsetattr(fileno(stdin), TCSANOW, &t) < 0) { - EDEN_LOGperror("EdenKeyboardHitSetup(): Unable to set terminal to single character mode"); - return (FALSE); - } -#endif - return (TRUE); -} - -// -// Check to see if the user has pressed a key on the keyboard. -// -EDEN_BOOL EdenKeyboardHit(void) -{ -#if defined(EDEN_UNIX) - fd_set fdset; - struct timeval tv; -#endif - -#if defined(EDEN_UNIX) - FD_ZERO(&fdset); - FD_SET(fileno(stdin), &fdset); - tv.tv_sec = tv.tv_usec = 0; - return (select(fileno(stdin) + 1, &fdset, NULL, NULL, &tv)); -#elif defined(_WIN32) - return (kbhit()); -#else - return (FALSE); -#endif -} - -// -// Do any required cleanup from our use of single keypress detection. -// -EDEN_BOOL EdenKeyboardHitCleanup(void) -{ -#ifdef EDEN_UNIX - if (tcsetattr(fileno(stdin), TCSANOW, &gEdenKeyboardHitTermiosSaved) < 0) { - EDEN_LOGperror("EdenKeyboardHitCleanup(): Unable to set terminal to default mode"); - return (FALSE); - } -#endif - return (TRUE); -} - -// -// Given a full or partial pathname passed in string path, -// returns a pointer to the first char of the filename -// portion of path. -// -char *EdenGetFileNameFromPath(const char *path) -{ - char *sep; -#ifdef _WIN32 - char *sep1; -#endif - - if (!path || !*path) return (NULL); - -#if defined(EDEN_MACOS) - sep = strrchr(path, ':'); -#else - sep = strrchr(path, '/'); -# ifdef _WIN32 - sep1 = strrchr(path, '\\'); - if (sep1 > sep) sep = sep1; -# endif -#endif - - if (!sep) return ((char *)path); - else return (sep + 1); -} - -// -// Given a full or partial pathname passed in string path, -// returns a string with the extension portion of path, -// i.e. the text after the rightmost '.' character, if any. -// If the filename contains no '.', NULL is returned. -// If convertToLowercase is TRUE, uppercase ASCII characters in -// the extension will be converted to lowercase. -// -char *EdenGetFileExtensionFromPath(const char *path, int convertToLowercase) -{ - char *sep; - size_t len; - char *ret; - int i; - - if (!path || !*path) return (NULL); - - sep = strrchr(EdenGetFileNameFromPath(path), '.'); - if (!sep) return (NULL); - - sep++; // Move past '.' - if (!*sep) return (NULL); - - len = strlen(sep); - ret = (char *)malloc(len + 1); - if (!ret) { - fprintf(stderr, "Out of memory.\n"); - return (NULL); - } - - if (convertToLowercase) { - for (i = 0; i < len; i++) ret[i] = tolower(sep[i]); - } else { - for (i = 0; i < len; i++) ret[i] = sep[i]; - } - ret[i] = '\0'; - - return (ret); -} - -// -// Given a full or partial pathname passed in string path, -// returns a string with the directory name portion of path. -// The string is not terminated by the directory separator. -// NB: The returned string must be freed by the caller. -// -char *EdenGetDirectoryNameFromPath(const char *path) -{ - char *dir; - char *sep; -#ifdef _WIN32 - char *sep1; -#endif - - dir = strdup(path); -#if defined(EDEN_MACOS) - sep = strrchr(dir, ':'); -#else - sep = strrchr(dir, '/'); -# ifdef _WIN32 - sep1 = strrchr(path, '\\'); - if (sep1 > sep) sep = sep1; -# endif -#endif - - if (!sep) *dir = '\0'; - else *sep = '\0'; - return dir; -} - -char *EdenGetExecutablePath(void) -{ -#if defined(_WIN32) - DWORD len; -#endif - -#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__linux) - return (NULL); // Not implemented for this OS. -#else - char *path = NULL; - if (!(path = (char *)malloc(MAXPATHLEN * sizeof(char)))) return (NULL); -# if defined(_WIN32) - len = GetModuleFileName(NULL, path, MAX_PATH); // NULL implies the current process. - if (len) return (path); - else { - free (path); - return (NULL); - } -# elif defined(__APPLE__) - uint32_t size = MAXPATHLEN; - if (_NSGetExecutablePath(path, &size) == 0) return (path); - else { - free (path); - return (NULL); - } -# elif defined(__linux) - ssize_t len = readlink("/proc/self/exe", path, MAXPATHLEN - 1); // -1 as it is not NULL terminated. - if (len >= 0) { - path[len] = '\0'; // NULL terminate. - return (path); - } else { - EDEN_LOGperror(NULL); - free (path); - return (NULL); - } -# endif -#endif -} - -char *EdenGetFileURI(const char *path) -{ - const char method[] = "file://"; - char *abspath = NULL; - char *uri = NULL; - size_t pathlen, abspathlen = 0, urilen; - EDEN_BOOL isAbsolute; -#ifdef _WIN32 - EDEN_BOOL isUNC; -#endif - int i; - - if (!path) return (NULL); - if (!*path) return (NULL); - - pathlen = strlen(path); - - // First check if we've been passed an absolute path. - isAbsolute = FALSE; -#ifdef _WIN32 - // Windows has two styles of absolute paths. The first (local Windows - // file path) begins with a drive letter e.g. C:, the second (UNC Windows) - // with a double backslash e.g. \\. - if (pathlen >= 2) { - if (isalpha(path[0]) && path[1] == ':') isAbsolute = TRUE; - else if (path[0] == '\\' && path[1] == '\\') isAbsolute = TRUE; - } -#else - if (path[0] == '/') isAbsolute = TRUE; -#endif - - // Ensure we have an absolute path. - if (isAbsolute) { - abspath = (char *)path; - abspathlen = pathlen; - } else { - // For relative paths, concatenate with the current working directory. - abspath = (char *)calloc(MAXPATHLEN, sizeof(char)); - if (!abspath) return (NULL); - if (!getcwd(abspath, MAXPATHLEN)) goto bail; - abspathlen = strlen(abspath); - if (abspathlen < 1) goto bail; - // Ensure current working directory path has a trailing slash. -#ifdef _WIN32 - if (abspath[abspathlen - 1] != '/' && abspath[abspathlen - 1] != '\\' ) -#else - if (abspath[abspathlen - 1] != '/') -#endif - { - abspath[abspathlen++] = '/'; abspath[abspathlen] = '\0'; - } - if (abspathlen + pathlen >= MAXPATHLEN) goto bail; - strncpy(abspath + abspathlen, path, MAXPATHLEN - abspathlen - 1); abspath[MAXPATHLEN - 1] = '\0'; - abspathlen += pathlen; - } - -#ifdef _WIN32 - // Windows UNC paths will be stripped of the leading two backslashes. - if (abspath[0] == '\\' && abspath[1] == '\\') isUNC = TRUE; - else isUNC = FALSE; -#endif - - // First pass. Work out how big everything needs to be. - urilen = sizeof(method) - 1; // Begin with "file://" -#ifdef _WIN32 - if (isUNC) i = 2; - else { - urilen++; // Prepend a slash. - i = 0; - } -#else - i = 0; -#endif - while (abspath[i]) { - // Characters not to URL encode. - if ((abspath[i] == '/') || (abspath[i] >= 'A' && abspath[i] <= 'Z') || (abspath[i] >= 'a' && abspath[i] <= 'z') || (abspath[i] >= '0' && abspath[i] <= '9') || (abspath[i] == '-') || (abspath[i] == '.') || (abspath[i] == '_') || (abspath[i] == '~')) { - urilen++; -#ifdef _WIN32 - // On Windows only, backslashes will be converted to forward slashes. - } else if (abspath[i] == '\\') { - urilen++; -#endif - } else { - urilen += 3; // URL encoded char is 3 chars. - } - i++; - } - urilen++; // nul termination. - uri = (char *)malloc(urilen * sizeof(char)); - - // Second pass. Construct the URI. - sprintf(uri, method); - urilen = sizeof(method) - 1; -#ifdef _WIN32 - if (isUNC) i = 2; - else { - uri[urilen++] = '/'; // Prepend a slash. - i = 0; - } -#else - i = 0; -#endif - while (abspath[i]) { - // Characters not to URL encode. - if ((abspath[i] == '/') || (abspath[i] >= 'A' && abspath[i] <= 'Z') || (abspath[i] >= 'a' && abspath[i] <= 'z') || (abspath[i] >= '0' && abspath[i] <= '9') || (abspath[i] == '-') || (abspath[i] == '.') || (abspath[i] == '_') || (abspath[i] == '~')) { - uri[urilen++] = abspath[i]; -#ifdef _WIN32 - } else if (abspath[i] == '\\') { - uri[urilen++] = '/'; -#endif - } else { - sprintf(uri + urilen, "%%%02x", abspath[i]); - urilen += 3; // URL encoded char is 3 chars. - } - i++; - } - uri[urilen] = '\0'; // nul termination. - -bail: - if (!isAbsolute) free(abspath); - - return (uri); -} - diff --git a/lib/SRC/Eden/Makefile.in b/lib/SRC/Eden/Makefile.in deleted file mode 100644 index 619fc24..0000000 --- a/lib/SRC/Eden/Makefile.in +++ /dev/null @@ -1,109 +0,0 @@ -# -# Makefile -# libEden -# -# This file is part of The Eden Library. -# -# The Eden Library is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# The Eden Library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with The Eden Library. If not, see . -# -# As a special exception, the copyright holders of this library give you -# permission to link this library with independent modules to produce an -# executable, regardless of the license terms of these independent modules, and to -# copy and distribute the resulting executable under terms of your choice, -# provided that you also meet, for each linked independent module, the terms and -# conditions of the license of that module. An independent module is a module -# which is neither derived from nor based on this library. If you modify this -# library, you may extend this exception to your version of the library, but you -# are not obligated to do so. If you do not wish to do so, delete this exception -# statement from your version. -# -# Copyright 2001-2015 Philip Lamb -# -# Author(s): Philip Lamb -# - -UNAME = $(shell uname) - -AR_HOME = ../../.. - -CC=@CC@ -CXX=@CXX@ -CPPFLAGS = -I$(AR_HOME)/include/@SYSTEM@ -I$(AR_HOME)/include -CFLAGS = @CFLAG@ -CXXFLAGS = @CFLAG@ -LDFLAGS = -L$(AR_HOME)/lib @LDFLAG@ -LIBS = @LIBS@ -AR=@AR@ -ARFLAGS=@ARFLAGS@ -RANLIB = @RANLIB@ - -TARGET = $(AR_HOME)/lib/libEden.a - -HEADERS = \ - $(AR_HOME)/include/Eden/Eden.h \ - $(AR_HOME)/include/Eden/EdenError.h \ - $(AR_HOME)/include/Eden/EdenGLFont.h \ - $(AR_HOME)/include/Eden/EdenMath.h \ - $(AR_HOME)/include/Eden/EdenMessage.h \ - $(AR_HOME)/include/Eden/EdenSound.h \ - $(AR_HOME)/include/Eden/EdenSurfaces.h \ - $(AR_HOME)/include/Eden/EdenTime.h \ - $(AR_HOME)/include/Eden/EdenUtil.h \ - $(AR_HOME)/include/Eden/EdenUtil.h \ - $(AR_HOME)/include/Eden/glm.h \ - $(AR_HOME)/include/Eden/readtex.h \ - ALFramework.h \ - CWaves.h \ - - -OBJS = \ - ALFramework.o \ - CWaves.o \ - EdenError.o \ - EdenGLFont.o \ - EdenMath.o \ - EdenMessage.o \ - EdenSound.o \ - EdenSurfaces.o \ - EdenTime.o \ - EdenUtil.o \ - glm.o \ - readtex.o \ - - -# Implicit rule, to compile Objective-C files with the .m suffix. -#%.o : %.m -# $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ - -default build all: $(TARGET) - -$(OBJS) : $(HEADERS) - -$(TARGET): $(OBJS) - $(AR) $(ARFLAGS) $@ $? - $(RANLIB) $@ - -clean: - -rm -f $(OBJS) - -rm -f $(TARGET) - -allclean: - -rm -f $(OBJS) - -rm -f $(TARGET) - -rm -f Makefile - -distclean: - rm -f $(OBJS) - rm -f Makefile - diff --git a/lib/SRC/Eden/glm.c b/lib/SRC/Eden/glm.c deleted file mode 100644 index e744cfa..0000000 --- a/lib/SRC/Eden/glm.c +++ /dev/null @@ -1,2716 +0,0 @@ -/* - glm.c - Nate Robins, 1997, 2000 - nate@pobox.com, http://www.pobox.com/~nate - - Wavefront OBJ model file format reader/writer/manipulator. - - Includes routines for generating smooth normals with - preservation of edges, welding redundant vertices & texture - coordinate generation (spheremap and planar projections) + more. -*/ - -// -// Updated by Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. -// -// Rev Date Who Changes -// 1.0.0 ????-??-?? NR Original version released as part of Nate Robin's OpenGL tutors package. -// 1.0.1 2001-11-14 PRL Fix linear texture coordinate generation. -// 1.0.2 2001-11-15 PRL Correct glmUnitize & glmDimensions for model with no -ve vertices, -// and correct glmUnitize to use unit cube, not cube with sides=2.0. -// 1.1.0 2002-01-28 PRL Add glmDrawArrays to use compiled vertex arrays. -// 1.2.0 2002-01-30 PRL glmDraw, glmDrawArrays and glmList are now OpenGL context-specific. -// 1.2.1 2002-02-03 PRL New glmVertexNormals() routine to handle models with polys with > 3 sides more -// consistently. -// 1.3.0 2003-08-06 PRL Now handles materials with dissolve factors for transparency and texture maps -// and dissolve factors. glmReadOBJ is now OpenGL context-specific. -// 1.4.0 2008-07-30 PRL Complete rewrite of glmDrawArrays to now correctly handle normals and texcoords. -// Implementation is now OpenGL|ES 1.1-compliant. -// Fixed a few small bugs in material handling in drawing routines. -// Made glmMax into a macro and added glmMin, & replaced glmAbs with fabsf. -// 1.4.1 2009-04-21 PRL Allow use of multiple materials within a group in the file, by forking off a -// new group. Should now handle models exported from Google Sketchup Pro OK. -// 1.4.2 2010-03-23 PRL Add glmRotate function. Minor changes for correct compilation. -// 1.5.0 2010-09-17 PRL Now supports transparency in materials, including textures. Because depth sorting -// is not yet implemented, overlay of multiple transparent surfaces may produce -// odd visual results. It is recommended that models be sorted back to front -// prior to drawing. -// 1.5.1 2011-03-01 PRL Better handle the case when some but not all faces have normals or texcoords. -// 1.6.0 2011-08-17 PRL Incorporate glStateCache to improve performance on TBDR OpenGL ES renderers. -// 1.7.0 2012-09-28 PRL Added lazy loading of model textures at render time, glmReadOBJ2 to request this. -// 1.7.1 2013-10-02 PRL Added flipping of textures in vertical dimension (some .obj models need it), -// and glmReadOBJ3 to request this. Also, better handles models with odd ordering -// of group and material commands. -// - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - -#include -#include -#include -#include -#include -#include // USHRT_MAX -#include // M_PI, sqrtf(), acosf(), asinf(), fabsf() -#ifndef EDEN_OPENGLES -# define DISABLE_GL_STATE_CACHE -#endif -#include "glStateCache.h" -#ifndef GL_GENERATE_MIPMAP -# define GL_GENERATE_MIPMAP 0x8191 -#endif - -#define glmDefaultGroupName "default" -#define T(x) (model->triangles[(x)]) - -/* _GLMnode: general purpose node, used by glmVertexNormals() to build a - linked list of triangles containing a particular vertex. */ -typedef struct _GLMnode { - GLuint index; // Which triangle this node is tracking. - GLuint indexindex; // Which of the points in this triangle this node is tracking. - GLboolean averaged; - struct _GLMnode* next; // The next node in the list, or NULL if this node is the tail. -} GLMnode; - -/* _GLMnode: general purpose node, used by glmDrawArrays() to build a - linked list of triangles containing a particular vertex. */ -typedef struct _GLMnode2 { - GLushort index; // Index into list of per-vertex data values. Each 3 defines a triangle. - struct _GLMnode2* next; // The next node in the list, or NULL if this node is the tail. -} GLMnode2; - -#define glmMax(a, b) ((a) > (b) ? (a) : (b)) -#define glmMin(a, b) ((a) < (b) ? (a) : (b)) - -/* glmDot: compute the dot product of two vectors - * - * u - array of 3 GLfloats (GLfloat u[3]) - * v - array of 3 GLfloats (GLfloat v[3]) - */ -static GLfloat -glmDot(GLfloat* u, GLfloat* v) -{ - assert(u); assert(v); - - return u[0]*v[0] + u[1]*v[1] + u[2]*v[2]; -} - -/* glmCross: compute the cross product of two vectors - * - * u - array of 3 GLfloats (GLfloat u[3]) - * v - array of 3 GLfloats (GLfloat v[3]) - * n - array of 3 GLfloats (GLfloat n[3]) to return the cross product in - */ -static GLvoid -glmCross(GLfloat* u, GLfloat* v, GLfloat* n) -{ - assert(u); assert(v); assert(n); - - n[0] = u[1]*v[2] - u[2]*v[1]; - n[1] = u[2]*v[0] - u[0]*v[2]; - n[2] = u[0]*v[1] - u[1]*v[0]; -} - -/* glmNormalize: normalize a vector - * - * v - array of 3 GLfloats (GLfloat v[3]) to be normalized - */ -static GLvoid -glmNormalize(GLfloat* v) -{ - GLfloat l; - - assert(v); - - l = (GLfloat)sqrtf(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); - v[0] /= l; - v[1] /= l; - v[2] /= l; -} - -/* glmEqual: compares two vectors and returns GL_TRUE if they are - * equal (within a certain threshold) or GL_FALSE if not. An epsilon - * that works fairly well is 0.000001. - * - * u - array of 3 GLfloats (GLfloat u[3]) - * v - array of 3 GLfloats (GLfloat v[3]) - */ -static GLboolean glmEqual(GLfloat* u, GLfloat* v, GLfloat epsilon) -{ - if (fabsf(u[0] - v[0]) < epsilon && - fabsf(u[1] - v[1]) < epsilon && - fabsf(u[2] - v[2]) < epsilon) - { - return GL_TRUE; - } - return GL_FALSE; -} - -/* glmWeldVectors: eliminate (weld) vectors that are within an - * epsilon of each other. - * - * vectors - array of GLfloat[3]'s to be welded - * numvectors - number of GLfloat[3]'s in vectors - * epsilon - maximum difference between vectors - * - */ -static GLfloat *glmWeldVectors(GLfloat* vectors, GLuint* numvectors, GLfloat epsilon) -{ - GLfloat* copies; - GLuint copied; - GLuint i, j; - - copies = (GLfloat*)malloc(sizeof(GLfloat) * 3 * (*numvectors + 1)); - memcpy(copies, vectors, (sizeof(GLfloat) * 3 * (*numvectors + 1))); - - copied = 1; - for (i = 1; i <= *numvectors; i++) { - for (j = 1; j <= copied; j++) { - if (glmEqual(&vectors[3 * i], &copies[3 * j], epsilon)) { - goto duplicate; - } - } - - /* must not be any duplicates -- add to the copies array */ - copies[3 * copied + 0] = vectors[3 * i + 0]; - copies[3 * copied + 1] = vectors[3 * i + 1]; - copies[3 * copied + 2] = vectors[3 * i + 2]; - j = copied; /* pass this along for below */ - copied++; - -duplicate: -/* set the first component of this vector to point at the correct - index into the new copies array */ - vectors[3 * i + 0] = (GLfloat)j; - } - - *numvectors = copied-1; - return copies; -} - -/* glmFindGroup: Find a group in the model */ -static GLMgroup *glmFindGroup(GLMmodel* model, char* name, const GLuint material) -{ - GLMgroup* group; - - assert(model); - - group = model->groups; - while (group) { - if (!strcmp(name, group->name) && group->material == material) break; // Both name and material must match. - group = group->next; - } - - return group; -} - -/* glmFindOrAddGroup: Add a group to the model */ -static GLMgroup *glmFindOrAddGroup(GLMmodel* model, char* name, const GLuint material) -{ - GLMgroup* group; - GLMgroup* tail = NULL; - - assert(model); - - group = model->groups; - while (group) { - if (!strcmp(name, group->name) && group->material == material) break; // Both name and material must match. - tail = group; - group = group->next; - } - - if (!group) { - group = (GLMgroup*)malloc(sizeof(GLMgroup)); - group->name = strdup(name); - group->material = material; - group->numtriangles = 0; - group->triangles = NULL; - group->next = NULL; - if (tail) tail->next = group; - else model->groups = group; - model->numgroups++; - } - - return group; -} - -/* glmFindMaterial: Find a material in the model */ -static GLuint glmFindMaterial(GLMmodel* model, char* name) -{ - GLuint i; - - /* XXX doing a linear search on a string key'd list is pretty lame, - but it works and is fast enough for now. */ - for (i = 0; i < model->nummaterials; i++) { - if (!strcmp(model->materials[i].name, name)) - goto found; - } - - /* didn't find the name, so print a warning and return the default - material (0). */ - EDEN_LOGe("glmFindMaterial(): can't find material \"%s\".\n", name); - i = 0; - -found: - return i; -} - -/* glmDirName: return the directory given a path - * - * path - filesystem path - * - * NOTE: the return value should be free'd. - */ -static char* -glmDirName(char* path) -{ - char* dir; - char* s; - - dir = strdup(path); - - s = strrchr(dir, '/'); - if (s) - s[1] = '\0'; // place end of string after last separator - else - dir[0] = '\0'; - - return dir; -} - -#ifdef GLM_MATERIAL_TEXTURES -static GLboolean readTextureAndSendToGL(const int contextIndex, char *texturefilename, TEXTURE_INDEX_t *texturemap_index, char *texturemap_hasAlpha, const GLboolean flipH, const GLboolean flipV) -{ - TEXTURE_INFO_t textureInfo = { // PRL 2003-08-06: Defaults for texturemaps. - NULL, // pointer to name will go here. - GL_TRUE, // generate mipmaps. - 0, // internal format (0 = don't attempt conversion). - GL_LINEAR_MIPMAP_LINEAR, // minification mode. - GL_LINEAR, // magnification mode. - GL_REPEAT, // wrap_s. - GL_REPEAT, // wrap_t. - 0.5, // priority. - GL_REPLACE, // env_mode. - //{0.0,0.0,0.0,0.0} // env_color. - }; - static char initedSurfaces = FALSE; - - textureInfo.pathname = texturefilename; - if (!initedSurfaces) { - EdenSurfacesInit(1, 256); // Up to 256 textures, into 1 OpenGL context. - initedSurfaces = TRUE; - } - if (!EdenSurfacesTextureLoad2(contextIndex, 1, &textureInfo, texturemap_index, texturemap_hasAlpha, flipH, flipV)) { - EDEN_LOGe("EdenSurfacesTextureLoad() couldn't read texture file \"%s\".\n", texturefilename); - return (FALSE); - } - return (TRUE); -} -#endif // GLM_MATERIAL_TEXTURES - -/* glmReadMTL: read a wavefront material library file - * - * model - properly initialized GLMmodel structure - * name - name of the material library - * contextIndex - PRL: index to the current OpenGL context (for texturing.) If you have only - * one OpenGL context (the most common case) set this parameter to 0. - */ -static GLboolean -glmReadMTL(GLMmodel* model, char* name, const int contextIndex, const GLboolean readTexturesNow) -{ - FILE* file; - char* dir; - char* filename; - char buf[128]; - GLuint nummaterials, i; - - dir = glmDirName(model->pathname); - filename = (char*)malloc(sizeof(char) * (strlen(dir) + strlen(name) + 1)); - strcpy(filename, dir); - strcat(filename, name); - free(dir); - - file = fopen(filename, "r"); - if (!file) { - EDEN_LOGe("glmReadMTL() failed: can't open material file \"%s\".\n", filename); - return (FALSE); - } - - /* count the number of materials in the file */ - nummaterials = 1; // default material 0 is always defined. - while(fscanf(file, "%s", buf) != EOF) { - switch(buf[0]) { - case '#': /* comment */ - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - break; - case 'n': /* newmtl */ - fgets(buf, sizeof(buf), file); - nummaterials++; - //sscanf(buf, "%s %s", buf, buf); - break; - default: - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - break; - } - } - - rewind(file); - - model->materials = (GLMmaterial*)malloc(sizeof(GLMmaterial) * nummaterials); - model->nummaterials = nummaterials; - - /* set the defaults for each material */ - for (i = 0; i < nummaterials; i++) { - model->materials[i].name = NULL; - model->materials[i].shininess = 65.0; - model->materials[i].diffuse[0] = 0.8; - model->materials[i].diffuse[1] = 0.8; - model->materials[i].diffuse[2] = 0.8; - model->materials[i].diffuse[3] = 1.0; // Opaque. - model->materials[i].ambient[0] = 0.2; - model->materials[i].ambient[1] = 0.2; - model->materials[i].ambient[2] = 0.2; - model->materials[i].ambient[3] = 1.0; - model->materials[i].specular[0] = 0.0; - model->materials[i].specular[1] = 0.0; - model->materials[i].specular[2] = 0.0; - model->materials[i].specular[3] = 1.0; -#ifdef GLM_MATERIAL_TEXTURES - model->materials[i].texturemap = NULL; // PRL 20030806: No texture by default. - model->materials[i].texturemappath = NULL; - model->materials[i].texturemap_index = (TEXTURE_INDEX_t)0; - model->materials[i].texturemap_hasAlpha = 0; -#endif // GLM_MATERIAL_TEXTURES - model->materials[i].illum = 2; // Is 2 the default? - } - model->materials[0].name = strdup("default"); - - /* now, read in the data */ - nummaterials = 0; - while(fscanf(file, "%s", buf) != EOF) { - switch(buf[0]) { - case '#': /* comment */ - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - break; - case 'n': /* newmtl */ - fgets(buf, sizeof(buf), file); - sscanf(buf, "%s %s", buf, buf); - nummaterials++; - model->materials[nummaterials].name = strdup(buf); - break; - case 'N': - switch (buf[1]) { - case 's': - fscanf(file, "%f", &model->materials[nummaterials].shininess); - /* wavefront shininess is from [0, 1000], so scale to [0, 127] for OpenGL */ - model->materials[nummaterials].shininess /= 1000.0; - model->materials[nummaterials].shininess *= 128.0; - break; - default: - // Unsupported options: - // Ni = Refraction index. Values range from 1 upwards. A value of 1 will cause no refraction. A higher value implies refraction. - fgets(buf, sizeof(buf), file); - break; - } - break; - case 'K': - switch(buf[1]) { - case 'd': - fscanf(file, "%f %f %f", - &model->materials[nummaterials].diffuse[0], - &model->materials[nummaterials].diffuse[1], - &model->materials[nummaterials].diffuse[2]); - break; - case 's': - fscanf(file, "%f %f %f", - &model->materials[nummaterials].specular[0], - &model->materials[nummaterials].specular[1], - &model->materials[nummaterials].specular[2]); - break; - case 'a': - fscanf(file, "%f %f %f", - &model->materials[nummaterials].ambient[0], - &model->materials[nummaterials].ambient[1], - &model->materials[nummaterials].ambient[2]); - break; - default: - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - break; - } - break; - case 'd': // PRL 20030806: dissolve factor, pseudo-transparency. - fscanf(file, "%f", &model->materials[nummaterials].diffuse[3]); - break; -#ifdef GLM_MATERIAL_TEXTURES - case 'm': // PRL 20030806: texturemap. - if (strstr(buf, "map_Kd")) { // Process diffuse colour map. - fgets(buf, sizeof(buf), file); // Read up to (and including) EOL from file into string. - buf[strlen(buf)-1] = '\0'; // nuke '\n'. - model->materials[nummaterials].texturemap = strdup(buf+1); // Save relative path from mtl file. +1 skips leading space. - // Handle relative paths from model and material. - dir = glmDirName(filename); - model->materials[nummaterials].texturemappath = (char*)malloc(sizeof(char) * (strlen(dir) + strlen(model->materials[nummaterials].texturemap) + 1)); - strcpy(model->materials[nummaterials].texturemappath, dir); - strcat(model->materials[nummaterials].texturemappath, model->materials[nummaterials].texturemap); - free(dir); - if (readTexturesNow) { - if (!readTextureAndSendToGL(contextIndex, model->materials[nummaterials].texturemappath, &(model->materials[nummaterials].texturemap_index), &(model->materials[nummaterials].texturemap_hasAlpha), FALSE, model->flipTextureV)) { - EDEN_LOGe("glmReadMTL(): Error loading texture.\n"); - } - } - } else { - // Unsupported options: - // map_Ka, ambient colour map. - // map_Ks, specular colour map. - fgets(buf, sizeof(buf), file); // eat up rest of line. - } - break; -#endif // GLM_MATERIAL_TEXTURES - case 'i': // Illumination model. - fscanf(file, "%d", &model->materials[nummaterials].illum); - break; - default: - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - break; - } - } - free(filename); - return (TRUE); -} - -/* glmWriteMTL: write a wavefront material library file - * - * model - properly initialized GLMmodel structure - * modelpath - pathname of the model being written - * mtllibname - name of the material library to be written - */ -static GLvoid -glmWriteMTL(GLMmodel* model, char* modelpath, char* mtllibname) -{ - FILE* file; - char* dir; - char* filename; - GLMmaterial* material; - GLuint i; - - dir = glmDirName(modelpath); - filename = (char*)malloc(sizeof(char) * (strlen(dir)+strlen(mtllibname))); - strcpy(filename, dir); - strcat(filename, mtllibname); - free(dir); - - /* open the file */ - file = fopen(filename, "w"); - if (!file) { - EDEN_LOGe("glmWriteMTL() failed: can't open file \"%s\".\n", - filename); - exit(1); - } - free(filename); - - /* spit out a header */ - fprintf(file, "# \n"); - fprintf(file, "# Wavefront MTL generated by GLM library\n"); - fprintf(file, "# \n"); - fprintf(file, "# GLM library\n"); - fprintf(file, "# Nate Robins\n"); - fprintf(file, "# ndr@pobox.com\n"); - fprintf(file, "# http://www.pobox.com/~ndr\n"); - fprintf(file, "# \n\n"); - - for (i = 0; i < model->nummaterials; i++) { - material = &model->materials[i]; - fprintf(file, "newmtl %s\n", material->name); - fprintf(file, "Ka %f %f %f\n", - material->ambient[0], material->ambient[1], material->ambient[2]); - fprintf(file, "Kd %f %f %f\n", - material->diffuse[0], material->diffuse[1], material->diffuse[2]); - fprintf(file, "Ks %f %f %f\n", - material->specular[0],material->specular[1],material->specular[2]); - fprintf(file, "Ns %f\n", material->shininess / 128.0 * 1000.0); - if (material->diffuse[3] != 1.0) fprintf(file, "d %f\n", material->diffuse[3]); // PRL 20030806: dissolve factor, pseudo-transparency. -#ifdef GLM_MATERIAL_TEXTURES - if (material->texturemap) fprintf(file, "map_Kd %s\n", material->texturemap); // PRL 20030806: texturemap. -#endif // GLM_MATERIAL_TEXTURES - fprintf(file, "illum %d\n", material->illum); - fprintf(file, "\n"); - } -} - -static void trim(char *buf) -{ - size_t index; - - if (!buf) return; - - index = strlen(buf); - if (!index) return; - index--; - - // Strip trailing CR and NL chars. - while (index && (buf[index] == '\r' || buf[index] == '\n')) { - buf[index] = '\0'; - index--; - } -} - -/* glmFirstPass: first pass at a Wavefront OBJ file that gets all the - * statistics of the model (such as #vertices, #normals, etc) - * Also allocates memory in each groups for triangle _indices_ (not the triangles themselves though.) - * - * model - properly initialized GLMmodel structure - * file - (fopen'd) file descriptor - * contextIndex - PRL: index to the current OpenGL context (for texturing.) If you have only - * one OpenGL context (the most common case) set this parameter to 0. - */ -static GLvoid -glmFirstPass(GLMmodel* model, FILE* file, const int contextIndex, const GLboolean readTexturesNow) -{ - GLuint numvertices = 0; /* number of vertices in model */ - GLuint numnormals = 0; /* number of normals in model */ - GLuint numtexcoords = 0; /* number of texcoords in model */ - GLuint numtriangles = 0; /* number of triangles in model */ - GLMgroup* group; /* current group */ - char* groupName; - char* groupNamePrev; - GLuint material; - GLuint materialPrev; - unsigned int v, n, t; - char buf[128]; - - - /* set the default group */ - material = 0; - materialPrev = 0; - groupName = strdup(glmDefaultGroupName); - groupNamePrev = strdup(""); - - while(fscanf(file, "%s", buf) != EOF) { - switch(buf[0]) { - case '#': /* comment */ - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - break; - case 'v': /* v, vn, vt */ - switch(buf[1]) { - case '\0': /* vertex */ - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - numvertices++; - break; - case 'n': /* normal */ - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - numnormals++; - break; - case 't': /* texcoord */ - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - numtexcoords++; - break; - default: - EDEN_LOGe("glmFirstPass(): Error: Unknown token \"%s\".\n", buf); - fgets(buf, sizeof(buf), file); - break; - } - break; - case 'm': /* material library */ - fgets(buf, sizeof(buf), file); - sscanf(buf, "%s %s", buf, buf); - if (model->mtllibname) { - if (strcmp(buf, model->mtllibname) != 0) EDEN_LOGe("glmFirstPass(): Warning: Multiple material library names found. Only the first will be used.\n"); - } else { - if (glmReadMTL(model, buf, contextIndex, readTexturesNow)) model->mtllibname = strdup(buf); - } - break; - case 'u': /* usemtl */ - fgets(buf, sizeof(buf), file); - sscanf(buf, "%s %s", buf, buf); - material = glmFindMaterial(model, buf); - break; - case 'g': /* group */ - fgets(buf, sizeof(buf), file); // Read up to (and including) EOL from file into string. - trim(buf); - if (groupName) free(groupName); - groupName = strdup(buf+1); - break; - case 'f': /* face */ - - // If group name or material has changed since last face, create a new group. - if (strcmp(groupName, groupNamePrev) != 0 || material != materialPrev) { - group = glmFindOrAddGroup(model, groupName, material); - if (groupNamePrev) free(groupNamePrev); - groupNamePrev = strdup(groupName); - materialPrev = material; - } - - v = n = t = 0; - fscanf(file, "%s", buf); - /* can be one of %d, %d//%d, %d/%d, %d/%d/%d %d//%d */ - /* Faces with > 3 vertices will be broken into triangles. */ - if (strstr(buf, "//")) { - /* v//n */ - sscanf(buf, "%d//%d", &v, &n); - fscanf(file, "%d//%d", &v, &n); - fscanf(file, "%d//%d", &v, &n); - numtriangles++; - group->numtriangles++; - while(fscanf(file, "%d//%d", &v, &n) > 0) { - numtriangles++; - group->numtriangles++; - } - } else if (sscanf(buf, "%d/%d/%d", &v, &t, &n) == 3) { - /* v/t/n */ - fscanf(file, "%d/%d/%d", &v, &t, &n); - fscanf(file, "%d/%d/%d", &v, &t, &n); - numtriangles++; - group->numtriangles++; - while(fscanf(file, "%d/%d/%d", &v, &t, &n) > 0) { - numtriangles++; - group->numtriangles++; - } - } else if (sscanf(buf, "%d/%d", &v, &t) == 2) { - /* v/t */ - fscanf(file, "%d/%d", &v, &t); - fscanf(file, "%d/%d", &v, &t); - numtriangles++; - group->numtriangles++; - while(fscanf(file, "%d/%d", &v, &t) > 0) { - numtriangles++; - group->numtriangles++; - } - } else { - /* v */ - fscanf(file, "%d", &v); - fscanf(file, "%d", &v); - numtriangles++; - group->numtriangles++; - while(fscanf(file, "%d", &v) > 0) { - numtriangles++; - group->numtriangles++; - } - } - break; - - default: - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - break; - } - } - - // Dispose of allocations. - if (groupName) free(groupName); - if (groupNamePrev) free(groupNamePrev); - - /* set the stats in the model structure */ - model->numvertices = numvertices; - model->numnormals = numnormals; - model->numtexcoords = numtexcoords; - model->numtriangles = numtriangles; - - /* allocate memory for the triangle _indices_ in each group */ - group = model->groups; - while (group) { - if (group->numtriangles) group->triangles = (GLuint*)malloc(sizeof(GLuint) * group->numtriangles); - group->numtriangles = 0; // Reset count in prep. for second pass. - group = group->next; - } -} - -/* glmSecondPass: second pass at a Wavefront OBJ file that gets all - * the data. - * - * model - properly initialized GLMmodel structure - * file - (fopen'd) file descriptor - */ -static GLvoid -glmSecondPass(GLMmodel* model, FILE* file) -{ - GLuint numvertices; /* number of vertices in model */ - GLuint numnormals; /* number of normals in model */ - GLuint numtexcoords; /* number of texcoords in model */ - GLuint numtriangles; /* number of triangles in model */ - GLfloat* vertices; /* array of vertices */ - GLfloat* normals; /* array of normals */ - GLfloat* texcoords; /* array of texture coordinates */ - GLMgroup* group; /* current group pointer */ - char* groupName; - char* groupNamePrev; - GLuint material; - GLuint materialPrev; - GLuint v, n, t; - char buf[128]; // Holds lines as they are read from the file. - - - /* set the default group */ - material = 0; - materialPrev = 0; - groupName = strdup(glmDefaultGroupName); - groupNamePrev = strdup(""); - - /* set the pointer shortcuts */ - vertices = model->vertices; - normals = model->normals; - texcoords = model->texcoords; - - /* on the second pass through the file, read all the data into the - allocated arrays */ - numvertices = numnormals = numtexcoords = 1; // Vertices, normals, texcoords are numbered from 1, not 0. - numtriangles = 0; - - while (fscanf(file, "%s", buf) != EOF) { - switch(buf[0]) { - case '#': /* comment */ - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - break; - case 'v': /* v, vn, vt */ - switch(buf[1]) { - case '\0': /* vertex */ - fscanf(file, "%f %f %f", - &vertices[3 * numvertices + 0], - &vertices[3 * numvertices + 1], - &vertices[3 * numvertices + 2]); - numvertices++; - break; - case 'n': /* normal */ - fscanf(file, "%f %f %f", - &normals[3 * numnormals + 0], - &normals[3 * numnormals + 1], - &normals[3 * numnormals + 2]); - numnormals++; - break; - case 't': /* texcoord */ - fscanf(file, "%f %f", - &texcoords[2 * numtexcoords + 0], - &texcoords[2 * numtexcoords + 1]); - numtexcoords++; - break; - } - break; - case 'u': /* use material */ - fgets(buf, sizeof(buf), file); // Read up to (and including) EOL from file into string. - sscanf(buf, "%s %s", buf, buf); - material = glmFindMaterial(model, buf); - break; - case 'g': /* group */ - fgets(buf, sizeof(buf), file); // Read up to (and including) EOL from file into string. - trim(buf); - if (groupName) free(groupName); - groupName = strdup(buf+1); - break; - case 'f': /* face */ - - // If group name or material has changed since last face, find the group. - if (strcmp(groupName, groupNamePrev) != 0 || material != materialPrev) { - group = glmFindGroup(model, groupName, material); - if (groupNamePrev) free(groupNamePrev); - groupNamePrev = strdup(groupName); - materialPrev = material; - } - - v = n = t = 0; - fscanf(file, "%s", buf); - /* can be one of %d, %d//%d, %d/%d, %d/%d/%d */ - /* Faces with > 3 vertices will be broken into triangle fans. */ - if (strstr(buf, "//")) { - /* v//n */ - sscanf(buf, "%d//%d", &v, &n); - T(numtriangles).vindices[0] = v; - T(numtriangles).tindices[0] = 0; - T(numtriangles).nindices[0] = n; - fscanf(file, "%d//%d", &v, &n); - T(numtriangles).vindices[1] = v; - T(numtriangles).tindices[1] = 0; - T(numtriangles).nindices[1] = n; - fscanf(file, "%d//%d", &v, &n); - T(numtriangles).vindices[2] = v; - T(numtriangles).tindices[2] = 0; - T(numtriangles).nindices[2] = n; - group->triangles[group->numtriangles++] = numtriangles; - numtriangles++; - while(fscanf(file, "%d//%d", &v, &n) > 0) { - T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0]; - T(numtriangles).tindices[0] = 0; - T(numtriangles).nindices[0] = T(numtriangles-1).nindices[0]; - T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2]; - T(numtriangles).tindices[1] = 0; - T(numtriangles).nindices[1] = T(numtriangles-1).nindices[2]; - T(numtriangles).vindices[2] = v; - T(numtriangles).tindices[2] = 0; - T(numtriangles).nindices[2] = n; - group->triangles[group->numtriangles++] = numtriangles; - numtriangles++; - } - } else if (sscanf(buf, "%d/%d/%d", &v, &t, &n) == 3) { - /* v/t/n */ - T(numtriangles).vindices[0] = v; - T(numtriangles).tindices[0] = t; - T(numtriangles).nindices[0] = n; - fscanf(file, "%d/%d/%d", &v, &t, &n); - T(numtriangles).vindices[1] = v; - T(numtriangles).tindices[1] = t; - T(numtriangles).nindices[1] = n; - fscanf(file, "%d/%d/%d", &v, &t, &n); - T(numtriangles).vindices[2] = v; - T(numtriangles).tindices[2] = t; - T(numtriangles).nindices[2] = n; - group->triangles[group->numtriangles++] = numtriangles; - numtriangles++; - while(fscanf(file, "%d/%d/%d", &v, &t, &n) > 0) { - T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0]; - T(numtriangles).tindices[0] = T(numtriangles-1).tindices[0]; - T(numtriangles).nindices[0] = T(numtriangles-1).nindices[0]; - T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2]; - T(numtriangles).tindices[1] = T(numtriangles-1).tindices[2]; - T(numtriangles).nindices[1] = T(numtriangles-1).nindices[2]; - T(numtriangles).vindices[2] = v; - T(numtriangles).tindices[2] = t; - T(numtriangles).nindices[2] = n; - group->triangles[group->numtriangles++] = numtriangles; - numtriangles++; - } - } else if (sscanf(buf, "%d/%d", &v, &t) == 2) { - /* v/t */ - T(numtriangles).vindices[0] = v; - T(numtriangles).tindices[0] = t; - T(numtriangles).nindices[0] = 0; - fscanf(file, "%d/%d", &v, &t); - T(numtriangles).vindices[1] = v; - T(numtriangles).tindices[1] = t; - T(numtriangles).nindices[1] = 0; - fscanf(file, "%d/%d", &v, &t); - T(numtriangles).vindices[2] = v; - T(numtriangles).tindices[2] = t; - T(numtriangles).nindices[2] = 0; - group->triangles[group->numtriangles++] = numtriangles; - numtriangles++; - while(fscanf(file, "%d/%d", &v, &t) > 0) { - T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0]; - T(numtriangles).tindices[0] = T(numtriangles-1).tindices[0]; - T(numtriangles).nindices[0] = 0; - T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2]; - T(numtriangles).tindices[1] = T(numtriangles-1).tindices[2]; - T(numtriangles).nindices[1] = 0; - T(numtriangles).vindices[2] = v; - T(numtriangles).tindices[2] = t; - T(numtriangles).nindices[2] = 0; - group->triangles[group->numtriangles++] = numtriangles; - numtriangles++; - } - } else { - /* v */ - sscanf(buf, "%d", &v); - T(numtriangles).vindices[0] = v; - T(numtriangles).tindices[0] = 0; - T(numtriangles).nindices[0] = 0; - fscanf(file, "%d", &v); - T(numtriangles).vindices[1] = v; - T(numtriangles).tindices[1] = 0; - T(numtriangles).nindices[1] = 0; - fscanf(file, "%d", &v); - T(numtriangles).vindices[2] = v; - T(numtriangles).tindices[2] = 0; - T(numtriangles).nindices[2] = 0; - group->triangles[group->numtriangles++] = numtriangles; - numtriangles++; - while(fscanf(file, "%d", &v) > 0) { - T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0]; - T(numtriangles).tindices[0] = 0; - T(numtriangles).nindices[0] = 0; - T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2]; - T(numtriangles).tindices[1] = 0; - T(numtriangles).nindices[1] = 0; - T(numtriangles).vindices[2] = v; - T(numtriangles).tindices[2] = 0; - T(numtriangles).nindices[2] = 0; - group->triangles[group->numtriangles++] = numtriangles; - numtriangles++; - } - } - break; - default: - /* eat up rest of line */ - fgets(buf, sizeof(buf), file); - break; - } /* switch(buf[0]); */ - } /* !EOF */ - - // Dispose of allocations. - if (groupName) free(groupName); - if (groupNamePrev) free(groupNamePrev); - -#if 0 - /* announce the memory requirements */ - EDEN_LOGe(" Memory: %d bytes\n", - numvertices * 3*sizeof(GLfloat) + - numnormals * 3*sizeof(GLfloat) * (numnormals ? 1 : 0) + - numtexcoords * 3*sizeof(GLfloat) * (numtexcoords ? 1 : 0) + - numtriangles * sizeof(GLMtriangle)); -#endif -} - -#pragma mark - - -/* Public functions */ - -/* glmUnitize: "unitize" a model by translating it to the origin and - * scaling it to fit in a unit cube around the origin. Returns the - * scalefactor used. - * - * model - properly initialized GLMmodel structure - */ -GLfloat -glmUnitize(GLMmodel* model) -{ - GLuint i; - GLfloat maxx, minx, maxy, miny, maxz, minz; - GLfloat cx, cy, cz, w, h, d; - GLfloat scale; - - assert(model); - assert(model->vertices); - - /* get the max/mins */ - maxx = minx = model->vertices[3 + 0]; - maxy = miny = model->vertices[3 + 1]; - maxz = minz = model->vertices[3 + 2]; - for (i = 1; i <= model->numvertices; i++) { - if (maxx < model->vertices[3 * i + 0]) - maxx = model->vertices[3 * i + 0]; - if (minx > model->vertices[3 * i + 0]) - minx = model->vertices[3 * i + 0]; - - if (maxy < model->vertices[3 * i + 1]) - maxy = model->vertices[3 * i + 1]; - if (miny > model->vertices[3 * i + 1]) - miny = model->vertices[3 * i + 1]; - - if (maxz < model->vertices[3 * i + 2]) - maxz = model->vertices[3 * i + 2]; - if (minz > model->vertices[3 * i + 2]) - minz = model->vertices[3 * i + 2]; - } - - /* calculate model width, height, and depth */ - w = maxx - minx; - h = maxy - miny; - d = maxz - minz; - - /* calculate center of the model */ - cx = (maxx + minx) / 2.0; - cy = (maxy + miny) / 2.0; - cz = (maxz + minz) / 2.0; - - /* calculate unitizing scale factor */ - scale = 1.0 / glmMax(glmMax(w, h), d); - - /* translate around center then scale */ - for (i = 1; i <= model->numvertices; i++) { - model->vertices[3 * i ] -= cx; - model->vertices[3 * i ] *= scale; - model->vertices[3 * i + 1] -= cy; - model->vertices[3 * i + 1] *= scale; - model->vertices[3 * i + 2] -= cz; - model->vertices[3 * i + 2] *= scale; - } - - return scale; -} - -/* glmDimensions: Calculates the dimensions (width, height, depth) of - * a model. - * - * model - initialized GLMmodel structure - * dimensions - array of 3 GLfloats (GLfloat dimensions[3]) - */ -GLvoid -glmDimensions(GLMmodel* model, GLfloat* dimensions) -{ - GLuint i; - GLfloat maxx, minx, maxy, miny, maxz, minz; - - assert(model); - assert(model->vertices); - assert(dimensions); - - /* get the max/mins */ - maxx = minx = model->vertices[3 + 0]; - maxy = miny = model->vertices[3 + 1]; - maxz = minz = model->vertices[3 + 2]; - for (i = 1; i <= model->numvertices; i++) { - if (maxx < model->vertices[3 * i + 0]) - maxx = model->vertices[3 * i + 0]; - if (minx > model->vertices[3 * i + 0]) - minx = model->vertices[3 * i + 0]; - - if (maxy < model->vertices[3 * i + 1]) - maxy = model->vertices[3 * i + 1]; - if (miny > model->vertices[3 * i + 1]) - miny = model->vertices[3 * i + 1]; - - if (maxz < model->vertices[3 * i + 2]) - maxz = model->vertices[3 * i + 2]; - if (minz > model->vertices[3 * i + 2]) - minz = model->vertices[3 * i + 2]; - } - - /* calculate model width, height, and depth */ - dimensions[0] = maxx - minx; - dimensions[1] = maxy - miny; - dimensions[2] = maxz - minz; -} - -/* glmScale: Scales a model by a given amount. - * - * model - properly initialized GLMmodel structure - * scale - scalefactor (0.5 = half as large, 2.0 = twice as large) - */ -GLvoid -glmScale(GLMmodel* model, GLfloat scale) -{ - GLuint i; - - for (i = 1; i <= model->numvertices; i++) { - model->vertices[3 * i + 0] *= scale; - model->vertices[3 * i + 1] *= scale; - model->vertices[3 * i + 2] *= scale; - } -} - -/* glmScaleTextures: Scales a model's textures by a given amount. - * - * model - properly initialized GLMmodel structure - * scale - scalefactor (0.5 = half as large, 2.0 = twice as large) - */ -GLvoid -glmScaleTextures(GLMmodel* model, GLfloat scale) -{ - GLuint i; - - for (i = 1; i <= model->numtexcoords; i++) { - model->texcoords[2 * i + 0] /= scale; - model->texcoords[2 * i + 1] /= scale; - } -} - -/* glmTranslate: Translates (moves) a model by a given amount in x, y, z. -* -* model - properly initialized GLMmodel structure -* offset- vector specifying amount to translate model by. -*/ -GLvoid -glmTranslate(GLMmodel* model, const GLfloat offset[3]) -{ - GLuint i; - - /* translate around center */ - for (i = 1; i <= model->numvertices; i++) { - model->vertices[3 * i ] += offset[0]; - model->vertices[3 * i + 1] += offset[1]; - model->vertices[3 * i + 2] += offset[2]; - } -} - -/* glmRotate: Rotates a model by a given amount angle (in radians) about axis in x, y, z. - * - * model - properly initialized GLMmodel structure - * angle - scalar specifying amount to rotate model by, in radians. - * x, y, z - scalar components of a normalized vector specifiying axis of rotation. - */ -GLvoid -glmRotate(GLMmodel* model, const GLfloat angle, const GLfloat x, const GLfloat y, const GLfloat z) -{ - GLfloat C, S, V; - GLfloat xy, yz, xz; - GLfloat Sx, Sy, Sz; - GLfloat Vxy, Vyz, Vxz; - GLfloat R1[3], R2[3], R3[3]; - GLuint i; - GLfloat vertex[3]; - - C = cosf(angle); - S = sinf(angle); - V = 1.0f - C; - xy = x*y; - yz = y*z; - xz = x*z; - Sx = S*x; - Sy = S*y; - Sz = S*z; - Vxy = V*xy; - Vyz = V*yz; - Vxz = V*xz; - R1[0] = V*x*x + C; R1[1] = Vxy - Sz; R1[2] = Vxz + Sy; - R2[0] = Vxy + Sz; R2[1] = V*y*y + C; R2[2] = Vyz - Sx; - R3[0] = Vxz - Sy; R3[1] = Vyz + Sx; R3[2] = V*z*z + C; - - for (i = 1; i <= model->numvertices; i++) { - vertex[0] = model->vertices[3 * i ]; - vertex[1] = model->vertices[3 * i + 1]; - vertex[2] = model->vertices[3 * i + 2]; - model->vertices[3 * i ] = glmDot(R1, vertex); - model->vertices[3 * i + 1] = glmDot(R2, vertex); - model->vertices[3 * i + 2] = glmDot(R3, vertex); - } -} - -/* glmReverseWinding: Reverse the polygon winding for all polygons in - * this model. Default winding is counter-clockwise. Also changes - * the direction of the normals. - * - * model - properly initialized GLMmodel structure - */ -GLvoid -glmReverseWinding(GLMmodel* model) -{ - GLuint i, swap; - - assert(model); - - for (i = 0; i < model->numtriangles; i++) { - swap = T(i).vindices[0]; - T(i).vindices[0] = T(i).vindices[2]; - T(i).vindices[2] = swap; - - if (model->numnormals) { - swap = T(i).nindices[0]; - T(i).nindices[0] = T(i).nindices[2]; - T(i).nindices[2] = swap; - } - - if (model->numtexcoords) { - swap = T(i).tindices[0]; - T(i).tindices[0] = T(i).tindices[2]; - T(i).tindices[2] = swap; - } - } - - /* reverse facet normals */ - for (i = 1; i <= model->numfacetnorms; i++) { - model->facetnorms[3 * i + 0] = -model->facetnorms[3 * i + 0]; - model->facetnorms[3 * i + 1] = -model->facetnorms[3 * i + 1]; - model->facetnorms[3 * i + 2] = -model->facetnorms[3 * i + 2]; - } - - /* reverse vertex normals */ - for (i = 1; i <= model->numnormals; i++) { - model->normals[3 * i + 0] = -model->normals[3 * i + 0]; - model->normals[3 * i + 1] = -model->normals[3 * i + 1]; - model->normals[3 * i + 2] = -model->normals[3 * i + 2]; - } -} - -/* glmFacetNormals: Generates facet normals for a model (by taking the - * cross product of the two vectors derived from the sides of each - * triangle). Assumes a counter-clockwise winding. - * - * model - initialized GLMmodel structure - */ -GLvoid -glmFacetNormals(GLMmodel* model) -{ - GLuint i; - GLfloat u[3]; - GLfloat v[3]; - - assert(model); - assert(model->vertices); - - /* clobber any old facetnormals */ - if (model->facetnorms) - free(model->facetnorms); - - /* allocate memory for the new facet normals */ - model->numfacetnorms = model->numtriangles; - model->facetnorms = (GLfloat*)malloc(sizeof(GLfloat) * - 3 * (model->numfacetnorms + 1)); - - for (i = 0; i < model->numtriangles; i++) { - model->triangles[i].findex = i+1; - - u[0] = model->vertices[3 * T(i).vindices[1] + 0] - model->vertices[3 * T(i).vindices[0] + 0]; - u[1] = model->vertices[3 * T(i).vindices[1] + 1] - model->vertices[3 * T(i).vindices[0] + 1]; - u[2] = model->vertices[3 * T(i).vindices[1] + 2] - model->vertices[3 * T(i).vindices[0] + 2]; - - v[0] = model->vertices[3 * T(i).vindices[2] + 0] - model->vertices[3 * T(i).vindices[0] + 0]; - v[1] = model->vertices[3 * T(i).vindices[2] + 1] - model->vertices[3 * T(i).vindices[0] + 1]; - v[2] = model->vertices[3 * T(i).vindices[2] + 2] - model->vertices[3 * T(i).vindices[0] + 2]; - - glmCross(u, v, &model->facetnorms[3 * (i+1)]); - glmNormalize(&model->facetnorms[3 * (i+1)]); - } -} - -/* glmVertexNormals: Generates smooth vertex normals for a model. - * First builds a list of all the triangles each vertex is in. Then - * loops through each vertex in the the list averaging all the facet - * normals of the triangles each vertex is in. Finally, sets the - * normal index in the triangle for the vertex to the generated smooth - * normal. If the dot product of a facet normal and the facet normal - * associated with the first triangle in the list of triangles the - * current vertex is in is greater than the cosine of the angle - * parameter to the function, that facet normal is not added into the - * average normal calculation and the corresponding vertex is given - * the facet normal. This tends to preserve hard edges. The angle to - * use depends on the model, but 90 degrees is usually a good start. - * - * model - initialized GLMmodel structure - * angle - maximum angle (in degrees) to smooth across - */ -GLvoid -glmVertexNormals(GLMmodel* model, GLfloat angle) -{ - GLMnode* node; - GLMnode* testnode; - GLMnode* tail; - GLMnode** members; - GLfloat* normals; - GLuint numnormals; - GLfloat sum[3]; - GLfloat dot, cos_angle; - GLuint i, avg; - - assert(model); - assert(model->facetnorms); - - /* calculate the cosine of the angle (in degrees) */ - cos_angle = cosf(angle * M_PI / 180.0f); - - /* nuke any previous normals */ - if (model->normals) - free(model->normals); - - /* allocate space for new normals */ - model->numnormals = model->numtriangles * 3; /* 3 normals per triangle */ - model->normals = (GLfloat*)malloc(sizeof(GLfloat) * 3 * (model->numnormals + 1)); - - /* allocate a structure that will hold a linked list of triangle - indices for each vertex */ - members = (GLMnode**)malloc(sizeof(GLMnode*) * (model->numvertices + 1)); - for (i = 1; i <= model->numvertices; i++) - members[i] = NULL; - - /* for every triangle, create a node for each vertex in it */ - for (i = 0; i < model->numtriangles; i++) { - node = (GLMnode*)malloc(sizeof(GLMnode)); - node->index = i; - node->indexindex = 0; - node->next = members[T(i).vindices[0]]; // Link to the current head of the list - members[T(i).vindices[0]] = node; // and make this node the new head. - - node = (GLMnode*)malloc(sizeof(GLMnode)); - node->index = i; - node->indexindex = 1; - node->next = members[T(i).vindices[1]]; // Link to the current head of the list - members[T(i).vindices[1]] = node; // and make this node the new head. - - node = (GLMnode*)malloc(sizeof(GLMnode)); - node->index = i; - node->indexindex = 2; - node->next = members[T(i).vindices[2]]; // Link to the current head of the list - members[T(i).vindices[2]] = node; // and make this node the new head. - } - - /* calculate the average normal for each vertex */ - numnormals = 1; - for (i = 1; i <= model->numvertices; i++) { -#if 0 - /* calculate an average normal for this vertex by averaging the - facet normal of every triangle this vertex is in */ - node = members[i]; - if (!node) - EDEN_LOGe("glmVertexNormals(): vertex w/o a triangle\n"); - sum[0] = 0.0; sum[1] = 0.0; sum[2] = 0.0; - avg = 0; - while (node) { - /* only average if the dot product of the angle between the two - facet normals is greater than the cosine of the threshold - angle -- or, said another way, the angle between the two - facet normals is less than (or equal to) the threshold angle */ - dot = glmDot(&model->facetnorms[3 * T(node->index).findex], &model->facetnorms[3 * T(members[i]->index).findex]); - if (dot > cos_angle) { - node->averaged = GL_TRUE; - sum[0] += model->facetnorms[3 * T(node->index).findex + 0]; - sum[1] += model->facetnorms[3 * T(node->index).findex + 1]; - sum[2] += model->facetnorms[3 * T(node->index).findex + 2]; - avg = 1; /* we averaged at least one normal! */ - } else { - node->averaged = GL_FALSE; - } - node = node->next; - } - - if (avg) { - /* normalize the averaged normal */ - glmNormalize(sum); - - /* add the normal to the vertex normals list */ - model->normals[3 * numnormals + 0] = sum[0]; - model->normals[3 * numnormals + 1] = sum[1]; - model->normals[3 * numnormals + 2] = sum[2]; - avg = numnormals; - numnormals++; - } - - /* set the normal of this vertex in each triangle it is in */ - node = members[i]; - while (node) { - if (node->averaged) { - /* if this node was averaged, use the average normal */ - if (T(node->index).vindices[0] == i) - T(node->index).nindices[0] = avg; - else if (T(node->index).vindices[1] == i) - T(node->index).nindices[1] = avg; - else if (T(node->index).vindices[2] == i) - T(node->index).nindices[2] = avg; - } else { - /* if this node wasn't averaged, use the facet normal */ - model->normals[3 * numnormals + 0] = model->facetnorms[3 * T(node->index).findex + 0]; - model->normals[3 * numnormals + 1] = model->facetnorms[3 * T(node->index).findex + 1]; - model->normals[3 * numnormals + 2] = model->facetnorms[3 * T(node->index).findex + 2]; - if (T(node->index).vindices[0] == i) - T(node->index).nindices[0] = numnormals; - else if (T(node->index).vindices[1] == i) - T(node->index).nindices[1] = numnormals; - else if (T(node->index).vindices[2] == i) - T(node->index).nindices[2] = numnormals; - numnormals++; - } - node = node->next; - } // while (node) -#else - // New routine: For the linked list of nodes containing this vertex, look at - // each node in the list and work out which other other nodes in the list should - // have their facetnorms averaged together with it to produce a vertex normal. - node = members[i]; - if (!node) - EDEN_LOGe("glmVertexNormals(): Model has vertex not contained in any triangle.\n"); - while (node) { - /* Average the facet normal of this node with the facet normals - of other nodes in the list. Test each other node against the current - node before adding it to the average and only add the tested node if - the dot product of the angle between the two facet normals is greater than the - cosine of the threshold angle -- or, said another way, the angle - between the two facet normals is less than (or equal to) the - threshold angle. */ - sum[0] = model->facetnorms[3 * T(node->index).findex + 0]; // Use the facet normal by default. - sum[1] = model->facetnorms[3 * T(node->index).findex + 1]; - sum[2] = model->facetnorms[3 * T(node->index).findex + 2]; - avg = GL_TRUE; // All nodes containing this vertex share the same vertex normal until proven otherwise. - testnode = members[i]; // Point to the head of the node list. - while (testnode) { - if (testnode != node) { - dot = glmDot(&model->facetnorms[3 * T(node->index).findex], &model->facetnorms[3 * T(testnode->index).findex]); - if (dot > cos_angle) { - sum[0] += model->facetnorms[3 * T(testnode->index).findex + 0]; - sum[1] += model->facetnorms[3 * T(testnode->index).findex + 1]; - sum[2] += model->facetnorms[3 * T(testnode->index).findex + 2]; - } else { - avg = GL_FALSE; // "One of these nodes is not like the other nodes." - } - } - testnode = testnode->next; - } // while (testnode) - glmNormalize(sum); // Normalize the summed facetnorms to get the average. - - // Store the normal in the vertex normals list. - model->normals[3 * numnormals + 0] = sum[0]; - model->normals[3 * numnormals + 1] = sum[1]; - model->normals[3 * numnormals + 2] = sum[2]; - // If all nodes containing the current vertex share the same average, assign just - // one normal to all of them. - if (avg) { - // Assign one normal to all nodes containing the current vertex. - node = members[i]; - while (node) { - T(node->index).nindices[node->indexindex] = numnormals; - node = node->next; - } - numnormals++; - node = NULL; - } else { - // Assign one normal to the point in the triangle pointed to by this node. - T(node->index).nindices[node->indexindex] = numnormals; - numnormals++; - node = node->next; - } - } // while (node) -#endif - } // for (i = 1; i <= model->numvertices; i++) - - model->numnormals = numnormals - 1; - - /* free the member information */ - for (i = 1; i <= model->numvertices; i++) { - node = members[i]; - while (node) { - tail = node; - node = node->next; - free(tail); - } - } - free(members); - - /* pack the normals array (we previously allocated the maximum - number of normals that could possibly be created (numtriangles * - 3), so get rid of some of them (usually a lot unless none of the - facet normals were averaged)) */ - normals = model->normals; - model->normals = (GLfloat*)malloc(sizeof(GLfloat)* 3* (model->numnormals+1)); - for (i = 1; i <= model->numnormals; i++) { - model->normals[3 * i + 0] = normals[3 * i + 0]; - model->normals[3 * i + 1] = normals[3 * i + 1]; - model->normals[3 * i + 2] = normals[3 * i + 2]; - } - free(normals); -} - - -/* glmLinearTexture: Generates texture coordinates according to a - * linear projection of the texture map. It generates these by - * linearly mapping the vertices onto a square. - * - * PRL, 20011114: The square lies in the x-z plane and is of the same - * dimension as the model in this plane. Note that this mapping will - * produce highly distored textures on polygons whose projections - * onto the x-z plane have areas approaching zero, i.e. whose facet - * normals have little or no y component. - * - * model - pointer to initialized GLMmodel structure - */ -GLvoid -glmLinearTexture(GLMmodel* model) -{ - GLMgroup *group; - GLfloat dimensions[3]; - GLfloat x, y, scalefactor; - GLuint i; - - assert(model); - - if (model->texcoords) - free(model->texcoords); - model->numtexcoords = model->numvertices; - model->texcoords=(GLfloat*)malloc(sizeof(GLfloat)*2*(model->numtexcoords+1)); - - glmDimensions(model, dimensions); - // PRL, 20011114: Corrected to scale ignoring the y dimension. - //scalefactor = 2.0 / fabsf(glmMax(glmMax(dimensions[0], dimensions[1]), dimensions[2])); - scalefactor = 2.0 / fabsf(glmMax(dimensions[0], dimensions[2])); - - /* do the calculations */ - for(i = 1; i <= model->numvertices; i++) { - x = model->vertices[3 * i + 0] * scalefactor; // - y = model->vertices[3 * i + 2] * scalefactor; - model->texcoords[2 * i + 0] = (x + 1.0) / 2.0; - model->texcoords[2 * i + 1] = (y + 1.0) / 2.0; - } - - /* go through and put texture coordinate indices in all the triangles */ - group = model->groups; - while(group) { - for(i = 0; i < group->numtriangles; i++) { - T(group->triangles[i]).tindices[0] = T(group->triangles[i]).vindices[0]; - T(group->triangles[i]).tindices[1] = T(group->triangles[i]).vindices[1]; - T(group->triangles[i]).tindices[2] = T(group->triangles[i]).vindices[2]; - } - group = group->next; - } - -#if 0 - EDEN_LOGe("glmLinearTexture(): generated %d linear texture coordinates\n", - model->numtexcoords); -#endif -} - -/* glmSpheremapTexture: Generates texture coordinates according to a - * spherical projection of the texture map. Sometimes referred to as - * spheremap, or reflection map texture coordinates. It generates - * these by using the normal to calculate where that vertex would map - * onto a sphere. Since it is impossible to map something flat - * perfectly onto something spherical, there is distortion at the - * poles. This particular implementation causes the poles along the X - * axis to be distorted. - * - * model - pointer to initialized GLMmodel structure - */ -GLvoid -glmSpheremapTexture(GLMmodel* model) -{ - GLMgroup* group; - GLfloat theta, phi, rho, x, y, z, r; - GLuint i; - - assert(model); - assert(model->normals); - - if (model->texcoords) - free(model->texcoords); - model->numtexcoords = model->numnormals; - model->texcoords=(GLfloat*)malloc(sizeof(GLfloat)*2*(model->numtexcoords+1)); - - for (i = 1; i <= model->numnormals; i++) { - z = model->normals[3 * i + 0]; /* re-arrange for pole distortion */ - y = model->normals[3 * i + 1]; - x = model->normals[3 * i + 2]; - r = sqrtf((x * x) + (y * y)); - rho = sqrt((r * r) + (z * z)); - - if (r == 0.0) { - theta = 0.0; - phi = 0.0; - } else { - if(z == 0.0) - phi = 3.14159265 / 2.0; - else - phi = acosf(z / rho); - - if(y == 0.0) - theta = 3.141592365 / 2.0; - else - theta = asinf(y / r) + (3.14159265 / 2.0); - } - - model->texcoords[2 * i + 0] = theta / 3.14159265; - model->texcoords[2 * i + 1] = phi / 3.14159265; - } - - /* go through and put texcoord indices in all the triangles */ - group = model->groups; - while(group) { - for (i = 0; i < group->numtriangles; i++) { - T(group->triangles[i]).tindices[0] = T(group->triangles[i]).nindices[0]; - T(group->triangles[i]).tindices[1] = T(group->triangles[i]).nindices[1]; - T(group->triangles[i]).tindices[2] = T(group->triangles[i]).nindices[2]; - } - group = group->next; - } -} - -/* glmDelete: Deletes a GLMmodel structure. - * - * model - initialized GLMmodel structure - * contextIndex - PRL: index to the current OpenGL context (for texturing.) If you have only - * one OpenGL context (the most common case) set this parameter to 0. - */ -GLvoid -glmDelete(GLMmodel* model, const int contextIndex) -{ - GLMgroup* group; - GLuint i; - - assert(model); - - if (model->arrays) glmDeleteArrays(model); - if (model->pathname) free(model->pathname); - if (model->mtllibname) free(model->mtllibname); - if (model->vertices) free(model->vertices); - if (model->normals) free(model->normals); - if (model->texcoords) free(model->texcoords); - if (model->facetnorms) free(model->facetnorms); - if (model->triangles) free(model->triangles); - if (model->materials) { - for (i = 0; i < model->nummaterials; i++) { -#ifdef GLM_MATERIAL_TEXTURES - if (model->materials[i].texturemap_index) // PRL 20030806: texturemap. - EdenSurfacesTextureUnload(contextIndex, 1, &model->materials[i].texturemap_index); - if (model->materials[i].texturemap) - free(model->materials[i].texturemap); - if (model->materials[i].texturemappath) - free(model->materials[i].texturemappath); -#endif // GLM_MATERIAL_TEXTURES - free(model->materials[i].name); - } - } - free (model->materials); - while (model->groups) { - group = model->groups; - model->groups = model->groups->next; - free(group->name); - if (group->triangles) free(group->triangles); - free(group); - } - - free(model); -} - -/* glmReadOBJ: Reads a model description from a Wavefront .OBJ file. - * Returns a pointer to the created object which should be free'd with - * glmDelete(). - * - * filename - name of the file containing the Wavefront .OBJ format data. - * contextIndex - PRL: index to the current OpenGL context (for texturing.) If you have only - * one OpenGL context (the most common case) set this parameter to 0. - */ -GLMmodel* -glmReadOBJ(const char *filename, const int contextIndex) -{ - return (glmReadOBJ3(filename, contextIndex, TRUE, FALSE)); -} - -GLMmodel* -glmReadOBJ2(const char *filename, const int contextIndex, const GLboolean readTexturesNow) -{ - return (glmReadOBJ3(filename, contextIndex, readTexturesNow, FALSE)); -} - -GLMmodel* -glmReadOBJ3(const char *filename, const int contextIndex, const GLboolean readTexturesNow, const GLboolean flipTextureV) -{ - GLMmodel* model; - FILE* file; - - /* open the file */ - file = fopen(filename, "r"); - if (!file) { - EDEN_LOGe("glmReadOBJ() failed: can't open data file \"%s\".\n", filename); - return (NULL); - } - - /* allocate a new model */ - model = (GLMmodel*)malloc(sizeof(GLMmodel)); - model->pathname = strdup(filename); - model->mtllibname = NULL; - model->numvertices = 0; - model->vertices = NULL; - model->numnormals = 0; - model->normals = NULL; - model->numtexcoords = 0; - model->texcoords = NULL; - model->numfacetnorms = 0; - model->facetnorms = NULL; - model->numtriangles = 0; - model->triangles = NULL; - model->nummaterials = 0; - model->materials = NULL; - model->numgroups = 0; - model->groups = NULL; - model->arrays = NULL; - model->arrayMode = 0; - model->readTextureRequired = !readTexturesNow; - model->flipTextureV = flipTextureV; - - /* make a first pass through the file to get a count of the number - of vertices, normals, texcoords & triangles */ - glmFirstPass(model, file, contextIndex, readTexturesNow); - - /* allocate memory */ - model->vertices = (GLfloat*)malloc(sizeof(GLfloat) * - 3 * (model->numvertices + 1)); // Uses + 1 because vertices, normals and texcoords are numbered from 1, not 0. - model->triangles = (GLMtriangle*)malloc(sizeof(GLMtriangle) * - model->numtriangles); - if (model->numnormals) { - model->normals = (GLfloat*)malloc(sizeof(GLfloat) * - 3 * (model->numnormals + 1)); // Uses + 1 because vertices, normals and texcoords are numbered from 1, not 0. - } - if (model->numtexcoords) { - model->texcoords = (GLfloat*)malloc(sizeof(GLfloat) * - 2 * (model->numtexcoords + 1)); // Uses + 1 because vertices, normals and texcoords are numbered from 1, not 0. - } - - /* rewind to beginning of file and read in the data this pass */ - rewind(file); - - glmSecondPass(model, file); - - /* close the file */ - fclose(file); - - return model; -} - -/* glmWriteOBJ: Writes a model description in Wavefront .OBJ format to - * a file. - * - * model - initialized GLMmodel structure - * filename - name of the file to write the Wavefront .OBJ format data to - * mode - a bitwise or of values describing what is written to the file - * GLM_NONE - render with only vertices - * GLM_FLAT - render with facet normals - * GLM_SMOOTH - render with vertex normals - * GLM_TEXTURE - render with texture coords - * GLM_COLOR - render with colors (color material) - * GLM_MATERIAL - render with materials - * GLM_COLOR and GLM_MATERIAL should not both be specified. - * GLM_FLAT and GLM_SMOOTH should not both be specified. - */ -GLvoid -glmWriteOBJ(GLMmodel* model, char* filename, GLuint mode) -{ - GLuint i; - FILE* file; - GLMgroup* group; - - assert(model); - - /* do a bit of warning */ - if (mode & GLM_FLAT && !model->facetnorms) { - EDEN_LOGe("glmWriteOBJ() warning: flat normal output requested " - "with no facet normals defined.\n"); - mode &= ~GLM_FLAT; - } - if (mode & GLM_SMOOTH && !model->normals) { - EDEN_LOGe("glmWriteOBJ() warning: smooth normal output requested " - "with no normals defined.\n"); - mode &= ~GLM_SMOOTH; - } - if (mode & GLM_TEXTURE && !model->texcoords) { - EDEN_LOGe("glmWriteOBJ() warning: texture coordinate output requested " - "with no texture coordinates defined.\n"); - mode &= ~GLM_TEXTURE; - } - if (mode & GLM_FLAT && mode & GLM_SMOOTH) { - EDEN_LOGe("glmWriteOBJ() warning: flat normal output requested " - "and smooth normal output requested (using smooth).\n"); - mode &= ~GLM_FLAT; - } - if (mode & GLM_COLOR && !model->materials) { - EDEN_LOGe("glmWriteOBJ() warning: color output requested " - "with no colors (materials) defined.\n"); - mode &= ~GLM_COLOR; - } - if (mode & GLM_MATERIAL && !model->materials) { - EDEN_LOGe("glmWriteOBJ() warning: material output requested " - "with no materials defined.\n"); - mode &= ~GLM_MATERIAL; - } - if (mode & GLM_COLOR && mode & GLM_MATERIAL) { - EDEN_LOGe("glmWriteOBJ() warning: color and material output requested " - "outputting only materials.\n"); - mode &= ~GLM_COLOR; - } - - - /* open the file */ - file = fopen(filename, "w"); - if (!file) { - EDEN_LOGe("glmWriteOBJ() failed: can't open file \"%s\" to write.\n", - filename); - exit(1); - } - - /* spit out a header */ - fprintf(file, "# \n"); - fprintf(file, "# Wavefront OBJ generated by GLM library\n"); - fprintf(file, "# \n"); - fprintf(file, "# GLM library\n"); - fprintf(file, "# Nate Robins\n"); - fprintf(file, "# ndr@pobox.com\n"); - fprintf(file, "# http://www.pobox.com/~ndr\n"); - fprintf(file, "# \n"); - - if (mode & GLM_MATERIAL && model->mtllibname) { - fprintf(file, "\nmtllib %s\n\n", model->mtllibname); - glmWriteMTL(model, filename, model->mtllibname); - } - - /* spit out the vertices */ - fprintf(file, "\n"); - fprintf(file, "# %d vertices\n", model->numvertices); - for (i = 1; i <= model->numvertices; i++) { - fprintf(file, "v %f %f %f\n", - model->vertices[3 * i + 0], - model->vertices[3 * i + 1], - model->vertices[3 * i + 2]); - } - - /* spit out the smooth/flat normals */ - if (mode & GLM_SMOOTH) { - fprintf(file, "\n"); - fprintf(file, "# %d normals\n", model->numnormals); - for (i = 1; i <= model->numnormals; i++) { - fprintf(file, "vn %f %f %f\n", - model->normals[3 * i + 0], - model->normals[3 * i + 1], - model->normals[3 * i + 2]); - } - } else if (mode & GLM_FLAT) { - fprintf(file, "\n"); - fprintf(file, "# %d normals\n", model->numfacetnorms); - for (i = 1; i <= model->numnormals; i++) { - fprintf(file, "vn %f %f %f\n", - model->facetnorms[3 * i + 0], - model->facetnorms[3 * i + 1], - model->facetnorms[3 * i + 2]); - } - } - - /* spit out the texture coordinates */ - if (mode & GLM_TEXTURE) { - fprintf(file, "\n"); - fprintf(file, "# %d texcoords\n", model->numtexcoords); - for (i = 1; i <= model->numtexcoords; i++) { - fprintf(file, "vt %f %f\n", - model->texcoords[2 * i + 0], - model->texcoords[2 * i + 1]); - } - } - - fprintf(file, "\n"); - fprintf(file, "# %d groups\n", model->numgroups); - fprintf(file, "# %d faces (triangles)\n", model->numtriangles); - fprintf(file, "\n"); - - group = model->groups; - while(group) { - fprintf(file, "g %s\n", group->name); - if (mode & GLM_MATERIAL) - fprintf(file, "usemtl %s\n", model->materials[group->material].name); - for (i = 0; i < group->numtriangles; i++) { - if (mode & GLM_SMOOTH && mode & GLM_TEXTURE) { - fprintf(file, "f %d/%d/%d %d/%d/%d %d/%d/%d\n", - T(group->triangles[i]).vindices[0], - T(group->triangles[i]).nindices[0], - T(group->triangles[i]).tindices[0], - T(group->triangles[i]).vindices[1], - T(group->triangles[i]).nindices[1], - T(group->triangles[i]).tindices[1], - T(group->triangles[i]).vindices[2], - T(group->triangles[i]).nindices[2], - T(group->triangles[i]).tindices[2]); - } else if (mode & GLM_FLAT && mode & GLM_TEXTURE) { - fprintf(file, "f %d/%d %d/%d %d/%d\n", - T(group->triangles[i]).vindices[0], - T(group->triangles[i]).findex, - T(group->triangles[i]).vindices[1], - T(group->triangles[i]).findex, - T(group->triangles[i]).vindices[2], - T(group->triangles[i]).findex); - } else if (mode & GLM_TEXTURE) { - fprintf(file, "f %d/%d %d/%d %d/%d\n", - T(group->triangles[i]).vindices[0], - T(group->triangles[i]).tindices[0], - T(group->triangles[i]).vindices[1], - T(group->triangles[i]).tindices[1], - T(group->triangles[i]).vindices[2], - T(group->triangles[i]).tindices[2]); - } else if (mode & GLM_SMOOTH) { - fprintf(file, "f %d//%d %d//%d %d//%d\n", - T(group->triangles[i]).vindices[0], - T(group->triangles[i]).nindices[0], - T(group->triangles[i]).vindices[1], - T(group->triangles[i]).nindices[1], - T(group->triangles[i]).vindices[2], - T(group->triangles[i]).nindices[2]); - } else if (mode & GLM_FLAT) { - fprintf(file, "f %d//%d %d//%d %d//%d\n", - T(group->triangles[i]).vindices[0], - T(group->triangles[i]).findex, - T(group->triangles[i]).vindices[1], - T(group->triangles[i]).findex, - T(group->triangles[i]).vindices[2], - T(group->triangles[i]).findex); - } else { - fprintf(file, "f %d %d %d\n", - T(group->triangles[i]).vindices[0], - T(group->triangles[i]).vindices[1], - T(group->triangles[i]).vindices[2]); - } - } - fprintf(file, "\n"); - group = group->next; - } - - fclose(file); -} - -#ifndef EDEN_OPENGLES -/* glmDraw: Renders the model to the current OpenGL context using the - * mode specified. - * - * model - initialized GLMmodel structure - * mode - a bitwise OR of values describing what is to be rendered. - * GLM_NONE - render with only vertices - * GLM_FLAT - render with facet normals - * GLM_SMOOTH - render with vertex normals - * GLM_TEXTURE - render with texture coords - * GLM_COLOR - render with colors (color material) - * GLM_MATERIAL - render with materials - * GLM_COLOR and GLM_MATERIAL should not both be specified. - * GLM_FLAT and GLM_SMOOTH should not both be specified. - * contextIndex - PRL: index to the current OpenGL context (for texturing.) If you have only - * one OpenGL context (the most common case) set this parameter to 0. - */ -GLvoid -glmDraw(GLMmodel* model, GLuint mode, const int contextIndex) -{ - GLuint i; - GLMgroup* group; - GLMtriangle* triangle; - GLMmaterial* material; - char transparencyPass, transparencyGLStateIsSet, hasTransparency; - - assert(model); - assert(model->vertices); - - /* do a bit of warning */ - if (mode & GLM_FLAT && !model->facetnorms) { - EDEN_LOGe("glmDraw() warning: flat render mode requested " - "with no facet normals defined.\n"); - mode &= ~GLM_FLAT; - } - if (mode & GLM_SMOOTH && !model->normals) { - EDEN_LOGe("glmDraw() warning: smooth render mode requested " - "with no normals defined.\n"); - mode &= ~GLM_SMOOTH; - } - if (mode & GLM_TEXTURE && !model->texcoords) { - EDEN_LOGe("glmDraw() warning: texture render mode requested " - "with no texture coordinates defined.\n"); - mode &= ~GLM_TEXTURE; - } - if (mode & GLM_FLAT && mode & GLM_SMOOTH) { - EDEN_LOGe("glmDraw() warning: flat render mode requested " - "and smooth render mode requested (using smooth).\n"); - mode &= ~GLM_FLAT; - } - if (mode & GLM_COLOR && !model->materials) { - EDEN_LOGe("glmDraw() warning: color render mode requested " - "with no materials defined.\n"); - mode &= ~GLM_COLOR; - } - if (mode & GLM_MATERIAL && !model->materials) { - EDEN_LOGe("glmDraw() warning: material render mode requested " - "with no materials defined.\n"); - mode &= ~GLM_MATERIAL; - } - if (mode & GLM_COLOR && mode & GLM_MATERIAL) { - EDEN_LOGe("glmDraw() warning: color and material render mode requested " - "using only material mode.\n"); - mode &= ~GLM_COLOR; - } - - if (mode & GLM_COLOR) glEnable(GL_COLOR_MATERIAL); - - if (mode & GLM_TEXTURE) { - // Reset texture matrix if texturing. - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - // Make sure all required textures are loaded. (Late loading) - if (model->readTextureRequired) { - for (i = 0; i < model->nummaterials; i++) { - if (model->materials[i].texturemappath && !model->materials[i].texturemap_index) { - if (!readTextureAndSendToGL(contextIndex, model->materials[i].texturemappath, &(model->materials[i].texturemap_index), &(model->materials[i].texturemap_hasAlpha), FALSE, model->flipTextureV)) { - EDEN_LOGe("glmDrawArrays(): Error loading texture.\n"); - } - } - } - model->readTextureRequired = FALSE; - } - } - - glStateCacheBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - // Pass through entire model twice. In first pass, draw all opaque groups. - // In second pass, draw non-opaque (transparent) groups. - for (transparencyPass = 0; transparencyPass <= 1; transparencyPass++) { - transparencyGLStateIsSet = FALSE; - - for (group = model->groups; group; group = group->next) { - - material = &model->materials[group->material]; - hasTransparency = material && ( -#ifdef GLM_MATERIAL_TEXTURES - (mode & GLM_TEXTURE && material->texturemap_hasAlpha) || -#endif - (mode & (GLM_MATERIAL | GLM_COLOR) && material->diffuse[3] < 1.0f) - ); - if ((!transparencyPass && hasTransparency) || (transparencyPass && !hasTransparency)) continue; // Skip if group is wrong sort. (XOR). - - // Enable or disable blend here rather than at the start of each pass so that - // it isn't called in the second pass unless the model actually has transparency. - // This avoids unecessary (and sometimes costly) flip-flopping of the OpenGL blend - // state when drawing opaque models consecutively. - if (!transparencyGLStateIsSet) { - if (!transparencyPass) glStateCacheDisableBlend(); - else glStateCacheEnableBlend(); - transparencyGLStateIsSet = TRUE; - } - - if (material) { - if (mode & GLM_MATERIAL) { - glStateCacheMaterialv(GL_AMBIENT, material->ambient); - glStateCacheMaterialv(GL_DIFFUSE, material->diffuse); - glStateCacheMaterialv(GL_SPECULAR, material->specular); - glStateCacheMaterial(GL_SHININESS, material->shininess); - } else if (mode & GLM_COLOR) { - glColor4fv(material->diffuse); - } -#ifdef GLM_MATERIAL_TEXTURES - glStateCacheActiveTexture(GL_TEXTURE0); - if (mode & GLM_TEXTURE) { - if (material->texturemap_index) { - EdenSurfacesTextureSet(contextIndex, material->texturemap_index); - glStateCacheEnableTex2D(); - } - else glStateCacheDisableTex2D(); - } else { - glStateCacheDisableTex2D(); - } -#endif // GLM_MATERIAL_TEXTURES - } - - // Draw the triangles. (Branches moved outside loop for speed.) - glBegin(GL_TRIANGLES); - if (mode & GLM_TEXTURE) { - if (mode & GLM_FLAT) { - for (i = 0; i < group->numtriangles; i++) { - triangle = &T(group->triangles[i]); - glNormal3fv(&model->facetnorms[3 * triangle->findex]); - glTexCoord2fv(&model->texcoords[2 * triangle->tindices[0]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[0]]); - glTexCoord2fv(&model->texcoords[2 * triangle->tindices[1]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[1]]); - glTexCoord2fv(&model->texcoords[2 * triangle->tindices[2]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[2]]); - } - } else if (mode & GLM_SMOOTH) { - for (i = 0; i < group->numtriangles; i++) { - triangle = &T(group->triangles[i]); - glNormal3fv(&model->normals[3 * triangle->nindices[0]]); - glTexCoord2fv(&model->texcoords[2 * triangle->tindices[0]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[0]]); - glNormal3fv(&model->normals[3 * triangle->nindices[1]]); - glTexCoord2fv(&model->texcoords[2 * triangle->tindices[1]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[1]]); - glNormal3fv(&model->normals[3 * triangle->nindices[2]]); - glTexCoord2fv(&model->texcoords[2 * triangle->tindices[2]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[2]]); - } - } else { - for (i = 0; i < group->numtriangles; i++) { - triangle = &T(group->triangles[i]); - glTexCoord2fv(&model->texcoords[2 * triangle->tindices[0]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[0]]); - glTexCoord2fv(&model->texcoords[2 * triangle->tindices[1]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[1]]); - glTexCoord2fv(&model->texcoords[2 * triangle->tindices[2]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[2]]); - } - } - } else { - if (mode & GLM_FLAT) { - for (i = 0; i < group->numtriangles; i++) { - triangle = &T(group->triangles[i]); - glNormal3fv(&model->facetnorms[3 * triangle->findex]); - glVertex3fv(&model->vertices[3 * triangle->vindices[0]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[1]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[2]]); - } - } else if (mode & GLM_SMOOTH) { - for (i = 0; i < group->numtriangles; i++) { - triangle = &T(group->triangles[i]); - glNormal3fv(&model->normals[3 * triangle->nindices[0]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[0]]); - glNormal3fv(&model->normals[3 * triangle->nindices[1]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[1]]); - glNormal3fv(&model->normals[3 * triangle->nindices[2]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[2]]); - } - } else { - for (i = 0; i < group->numtriangles; i++) { - triangle = &T(group->triangles[i]); - glVertex3fv(&model->vertices[3 * triangle->vindices[0]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[1]]); - glVertex3fv(&model->vertices[3 * triangle->vindices[2]]); - } - } - } - glEnd(); - } - } - - if (mode & GLM_COLOR) glDisable(GL_COLOR_MATERIAL); -} - -/* glmList: Generates and returns a display list for the model using - * the mode specified. - * - * model - initialized GLMmodel structure - * mode - a bitwise OR of values describing what is to be rendered. - * GLM_NONE - render with only vertices - * GLM_FLAT - render with facet normals - * GLM_SMOOTH - render with vertex normals - * GLM_TEXTURE - render with texture coords - * GLM_COLOR - render with colors (color material) - * GLM_MATERIAL - render with materials - * GLM_COLOR and GLM_MATERIAL should not both be specified. - * GLM_FLAT and GLM_SMOOTH should not both be specified. - * contextIndex - PRL: index to the current OpenGL context (for texturing.) If you have only - * one OpenGL context (the most common case) set this parameter to 0. - */ -GLuint -glmList(GLMmodel* model, GLuint mode, const int contextIndex) -{ - GLuint list; - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - glmDraw(model, mode, contextIndex); - glEndList(); - - return list; -} -#endif // !EDEN_OPENGLES - - -/* glmWeld: eliminate (weld) vectors that are within an epsilon of - * each other. - * - * model - initialized GLMmodel structure - * epsilon - maximum difference between vertices - * ( 0.00001 is a good start for a unitized model) - * - */ -GLvoid -glmWeld(GLMmodel* model, GLfloat epsilon) -{ - GLfloat* vectors; - GLfloat* copies; - GLuint numvectors; - GLuint i; - - /* vertices */ - numvectors = model->numvertices; - vectors = model->vertices; - copies = glmWeldVectors(vectors, &numvectors, epsilon); - -#if 0 - EDEN_LOGe("glmWeld(): %d redundant vertices.\n", - model->numvertices - numvectors - 1); -#endif - - for (i = 0; i < model->numtriangles; i++) { - T(i).vindices[0] = (GLuint)vectors[3 * T(i).vindices[0] + 0]; - T(i).vindices[1] = (GLuint)vectors[3 * T(i).vindices[1] + 0]; - T(i).vindices[2] = (GLuint)vectors[3 * T(i).vindices[2] + 0]; - } - - /* free space for old vertices */ - free(vectors); - - /* allocate space for the new vertices */ - model->numvertices = numvectors; - model->vertices = (GLfloat*)malloc(sizeof(GLfloat) * - 3 * (model->numvertices + 1)); - - /* copy the optimized vertices into the actual vertex list */ - for (i = 1; i <= model->numvertices; i++) { - model->vertices[3 * i + 0] = copies[3 * i + 0]; - model->vertices[3 * i + 1] = copies[3 * i + 1]; - model->vertices[3 * i + 2] = copies[3 * i + 2]; - } - - free(copies); -} - -/* glmReadPPM: read a PPM raw (type P6) file. The PPM file has a header - * that should look something like: - * - * P6 - * # comment - * width height max_value - * rgbrgbrgb... - * - * where "P6" is the magic cookie which identifies the file type and - * should be the only characters on the first line followed by a - * carriage return. Any line starting with a # mark will be treated - * as a comment and discarded. After the magic cookie, three integer - * values are expected: width, height of the image and the maximum - * value for a pixel (max_value must be < 256 for PPM raw files). The - * data section consists of width*height rgb triplets (one byte each) - * in binary format (i.e., such as that written with fwrite() or - * equivalent). - * - * The rgb data is returned as an array of unsigned chars (packed - * rgb). The malloc()'d memory should be free()'d by the caller. If - * an error occurs, an error message is sent to stderr and NULL is - * returned. - * - * filename - name of the .ppm file. - * width - will contain the width of the image on return. - * height - will contain the height of the image on return. - * - */ -GLubyte* -glmReadPPM(const char* filename, int* width, int* height) -{ - FILE* fp; - int i, w, h, d; - unsigned char* image; - char head[70]; /* max line <= 70 in PPM (per spec). */ - - fp = fopen(filename, "rb"); - if (!fp) { - EDEN_LOGe("glmReadPPM(): Unable to open file '%s'.\n", filename); - EDEN_LOGperror(NULL); - return NULL; - } - - /* grab first two chars of the file and make sure that it has the - correct magic cookie for a raw PPM file. */ - if (!fgets(head, 70, fp)) { - EDEN_LOGe("%s: Error reading file header\n", filename); - goto bail; - }; - if (strncmp(head, "P6", 2)) { - EDEN_LOGe("%s: Not a raw PPM file\n", filename); - goto bail; - } - - /* grab the three elements in the header (width, height, maxval). */ - i = 0; - while(i < 3) { - fgets(head, 70, fp); - if (head[0] == '#') /* skip comments. */ - continue; - if (i == 0) - i += sscanf(head, "%d %d %d", &w, &h, &d); - else if (i == 1) - i += sscanf(head, "%d %d", &h, &d); - else if (i == 2) - i += sscanf(head, "%d", &d); - } - - /* grab all the image data in one fell swoop. */ - image = (unsigned char*)malloc(sizeof(unsigned char)*w*h*3); - if (fread(image, sizeof(unsigned char), w*h*3, fp) < w*h*3) { - EDEN_LOGe("%s: PPM image data truncated\n", filename); - goto bail; - }; - fclose(fp); - - *width = w; - *height = h; - return image; -bail: - fclose(fp); - return (NULL); -} - -GLvoid glmCreateArrays(GLMmodel* model, GLuint mode) -{ - GLMgroup* group; - GLMtriangle* triangle; - GLMarray *array = NULL, *arrayTail; - GLMnode2 *node, **members, *tail; - GLfloat *vertices, *normals, *texcoords; - GLushort *indices; - GLushort indexCount, vntCount; - int i, j; - - assert(model); - assert(model->vertices); - - if (model->arrays) glmDeleteArrays(model); - - /* do a bit of warning */ - if (mode & GLM_FLAT && !model->facetnorms) { - EDEN_LOGe("glmCreateArrays() warning: flat render mode requested " - "with no facet normals defined.\n"); - mode &= ~GLM_FLAT; - } - if (mode & GLM_SMOOTH && !model->normals) { - EDEN_LOGe("glmCreateArrays() warning: smooth render mode requested " - "with no normals defined.\n"); - mode &= ~GLM_SMOOTH; - } - if (mode & GLM_TEXTURE && !model->texcoords) { - EDEN_LOGe("glmCreateArrays() warning: texture render mode requested " - "with no texture coordinates defined.\n"); - mode &= ~GLM_TEXTURE; - } - if (mode & GLM_COLOR && !model->materials) { - EDEN_LOGe("glmCreateArrays() warning: color render mode requested " - "with no materials defined.\n"); - mode &= ~GLM_COLOR; - } - if (mode & GLM_MATERIAL && !model->materials) { - EDEN_LOGe("glmCreateArrays() warning: material render mode requested " - "with no materials defined.\n"); - mode &= ~GLM_MATERIAL; - } - if (mode & GLM_COLOR && mode & GLM_MATERIAL) { - EDEN_LOGe("glmCreateArrays() warning: color and material render mode requested " - "using only material mode.\n"); - mode &= ~GLM_COLOR; - } - - group = model->groups; - while (group) { - - if (group->numtriangles) { - - int needNormals; - int needFacetnorms; - int needTexcoords; - - arrayTail = array; - array = (GLMarray *)calloc(1, sizeof(GLMarray)); // implicit array->next = NULL; - if (!arrayTail) { - model->arrays = array; - model->arrayMode = mode; - } else arrayTail->next = array; - - // For every point in every triangle in the group, look to see if another point in another - // triangle in the group already has the exact same vertex, normal and texcooord. - // If it does, stash the index for that data in our list of indices. - // If not, then copy the vertex, normal and texcoord from the model, stash the index - // AND record that this data exists by adding to the existing per-vertex - // linked-list (the members array) of GLMnodes. - - // Allocate a structure that will hold a linked list of triangle - // indices for each vertex. - members = (GLMnode2**)calloc(model->numvertices + 1, sizeof(GLMnode2 *)); // + 1 because indices in model are 1-based. - - needNormals = mode & GLM_SMOOTH; - needFacetnorms = mode & GLM_FLAT; - needTexcoords = mode & GLM_TEXTURE; - - // Allocate arrays to hold the new vertex, normal and texcoord data. - // The arrays will be the maximum theoretical size, and we will shrink them at the end. - vertices = (GLfloat *)malloc(sizeof(GLfloat) * 3 * group->numtriangles * 3); // 3 floats per vertex, 3 vertices per triangle. - if (needNormals || needFacetnorms) normals = (GLfloat *)malloc(sizeof(GLfloat) * 3 * group->numtriangles * 3); // 3 floats per normal, 3 normals per triangle. - else normals = NULL; - if (needTexcoords) texcoords = (GLfloat *)malloc(sizeof(GLfloat) * 2 * group->numtriangles * 3); // 2 floats per texcoord, 3 texcoords per triangle. - else texcoords = NULL; - vntCount = 0; - - indices = (GLushort *)malloc(sizeof(GLushort) * group->numtriangles * 3); // 1 index per v/n/t, 3 v/n/ts per triangle. - indexCount = 0; - - for (i = 0; i < glmMin(group->numtriangles, (USHRT_MAX + 1) / 3); i++) { // We are using GLushorts for indices, so limit to USHRT_MAX / 3 triangles per group. - triangle = &(T(group->triangles[i])); - for (j = 0; j < 3; j++) { - // We are now examining the linked list for vertex with index (1-based) T(i).vindices[j]. - node = members[triangle->vindices[j]]; // Get current head of linked-list. - while (node) { - if (!needNormals || ((model->normals[triangle->nindices[j] * 3 ] == normals[node->index * 3 ]) && - (model->normals[triangle->nindices[j] * 3 + 1] == normals[node->index * 3 + 1]) && - (model->normals[triangle->nindices[j] * 3 + 2] == normals[node->index * 3 + 2]))) { - if (!needFacetnorms || ((model->facetnorms[triangle->findex * 3 ] == normals[node->index * 3 ]) && - (model->facetnorms[triangle->findex * 3 + 1] == normals[node->index * 3 + 1]) && - (model->facetnorms[triangle->findex * 3 + 2] == normals[node->index * 3 + 2]))) { - if (!needTexcoords || ((model->texcoords[triangle->tindices[j] * 2 ] == texcoords[node->index * 2 ]) && - (model->texcoords[triangle->tindices[j] * 2 + 1] == texcoords[node->index * 2 + 1]))) { - break; // The data for "node" is a match, so reuse its index. - } - } - } - node = node->next; - } - if (!node) { - // No re-usable set of data (vertex, texcoord, normal) was found, make a new one. - // First make a node to point to it. - node = (GLMnode2 *)malloc(sizeof(GLMnode2)); - node->index = vntCount; - node->next = members[triangle->vindices[j]]; // Link to the current head of the list - members[triangle->vindices[j]] = node; // and make this node the new head. - // Now copy the data; (vx, vy, vz), (nx, ny, nz), (tu, tv). - vertices[vntCount * 3 ] = model->vertices[triangle->vindices[j] * 3 ]; - vertices[vntCount * 3 + 1] = model->vertices[triangle->vindices[j] * 3 + 1]; - vertices[vntCount * 3 + 2] = model->vertices[triangle->vindices[j] * 3 + 2]; - if (needNormals) { - normals[vntCount * 3 ] = model->normals[triangle->nindices[j] * 3 ]; - normals[vntCount * 3 + 1] = model->normals[triangle->nindices[j] * 3 + 1]; - normals[vntCount * 3 + 2] = model->normals[triangle->nindices[j] * 3 + 2]; - } else if (needFacetnorms) { - normals[vntCount * 3 ] = model->facetnorms[triangle->findex * 3 ]; - normals[vntCount * 3 + 1] = model->facetnorms[triangle->findex * 3 + 1]; - normals[vntCount * 3 + 2] = model->facetnorms[triangle->findex * 3 + 2]; - } - if (needTexcoords) { - texcoords[vntCount * 2 ] = model->texcoords[triangle->tindices[j] * 2 ]; - texcoords[vntCount * 2 + 1] = model->texcoords[triangle->tindices[j] * 2 + 1]; - } - indices[indexCount++] = vntCount++; - } else { - indices[indexCount++] = node->index; - } - } // for j - } // for i - - // Compress the v/n/t arrays by creating new allocation and copying the data. - array->vertices = (GLfloat *)malloc(sizeof(GLfloat) * 3 * vntCount); - for (i = 0; i < 3 * vntCount; i++) array->vertices[i] = vertices[i]; - free (vertices); - if (needNormals) { - array->normals = (GLfloat *)malloc(sizeof(GLfloat) * 3 * vntCount); - for (i = 0; i < 3 * vntCount; i++) array->normals[i] = normals[i]; - free (normals); - } - if (needTexcoords) { - array->texcoords = (GLfloat *)malloc(sizeof(GLfloat) * 2 * vntCount); - for (i = 0; i < 2 * vntCount; i++) array->texcoords[i] = texcoords[i]; - free (texcoords); - } - - // Clean up the members array. - for (i = 1; i <= model->numvertices; i++) { - node = members[i]; - while (node) { - tail = node; - node = node->next; - free(tail); - } - } - free(members); - - array->indices = indices; - array->indexCount = indexCount; - - // If this group has a material set, stash a pointer to it. - if (group->material) array->material = &(model->materials[group->material]); - - } // if group->numtriangles - - group = group->next; - } // while group - -} - -GLvoid glmDeleteArrays(GLMmodel *model) -{ - GLMarray *arrayHead, *arrayPrevHead; - - assert(model); - - arrayHead = model->arrays; - while (arrayHead) { - free(arrayHead->vertices); - if (arrayHead->normals) free(arrayHead->normals); - if (arrayHead->texcoords) free(arrayHead->texcoords); - free(arrayHead->indices); - - arrayPrevHead = arrayHead; - arrayHead = arrayHead->next; - free(arrayPrevHead); - } - model->arrays = NULL; - model->arrayMode = 0; -} - -GLvoid glmDrawArrays(GLMmodel* model, const int contextIndex) -{ - GLMarray* array; - char transparencyPass, transparencyGLStateIsSet, hasTransparency; - int i; - - assert(model); - - if (model->arrayMode & GLM_COLOR) glEnable(GL_COLOR_MATERIAL); - - if (model->arrayMode & GLM_TEXTURE) { - // Reset texture matrix if texturing. - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - // Make sure all required textures are loaded. (Late loading) - if (model->readTextureRequired) { - for (i = 0; i < model->nummaterials; i++) { - if (model->materials[i].texturemappath && !model->materials[i].texturemap_index) { - if (!readTextureAndSendToGL(contextIndex, model->materials[i].texturemappath, &(model->materials[i].texturemap_index), &(model->materials[i].texturemap_hasAlpha), FALSE, model->flipTextureV)) { - EDEN_LOGe("glmDrawArrays(): Error loading texture.\n"); - } - } - } - model->readTextureRequired = FALSE; - } - } - - // Pass through entire model twice. In first pass, draw all opaque groups. - // In second pass, draw non-opaque (transparent) groups. - for (transparencyPass = 0; transparencyPass <= 1; transparencyPass++) { - transparencyGLStateIsSet = FALSE; - - for (array = model->arrays; array != NULL; array = array->next) { // Loop through all arrays. - - hasTransparency = array->material && ( -#ifdef GLM_MATERIAL_TEXTURES - (model->arrayMode & GLM_TEXTURE && array->material->texturemap_hasAlpha) || -#endif - (model->arrayMode & (GLM_MATERIAL | GLM_COLOR) && array->material->diffuse[3] < 1.0f) - ); - if ((!transparencyPass && hasTransparency) || (transparencyPass && !hasTransparency)) continue; // Skip if array is wrong sort. (XOR). - - // Enable or disable blend here rather than at the start of each pass so that - // it isn't called in the second pass unless the model actually has transparency. - // This avoids unecessary (and sometimes costly) flip-flopping of the OpenGL blend - // state when drawing opaque models consecutively. - if (!transparencyGLStateIsSet) { - if (!transparencyPass) glStateCacheDisableBlend(); - else { - glStateCacheBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glStateCacheEnableBlend(); - } - transparencyGLStateIsSet = TRUE; - } - - // Set array state. - glVertexPointer(3, GL_FLOAT, 0, array->vertices); - glStateCacheEnableClientStateVertexArray(); - if (array->normals) { - glNormalPointer(GL_FLOAT, 0, array->normals); - glStateCacheEnableClientStateNormalArray(); - } else { - glStateCacheDisableClientStateNormalArray(); - } - glStateCacheClientActiveTexture(GL_TEXTURE0); - if (array->texcoords) { - glTexCoordPointer(2, GL_FLOAT, 0, array->texcoords); - glStateCacheEnableClientStateTexCoordArray(); - } else { - glStateCacheDisableClientStateTexCoordArray(); - } - - // Set material state. - if (array->material) { - if (model->arrayMode & GLM_MATERIAL) { - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, array->material->ambient); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, array->material->diffuse); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, array->material->specular); - glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, array->material->shininess); - } else if (model->arrayMode & GLM_COLOR) { - glColor4f(array->material->diffuse[0], array->material->diffuse[1], array->material->diffuse[2], array->material->diffuse[3]); - } -#ifdef GLM_MATERIAL_TEXTURES - glStateCacheActiveTexture(GL_TEXTURE0); - if (model->arrayMode & GLM_TEXTURE) { - if (array->material->texturemap_index) { - EdenSurfacesTextureSet(contextIndex, array->material->texturemap_index); - glStateCacheEnableTex2D(); - } - else glStateCacheDisableTex2D(); - } else { - glStateCacheDisableTex2D(); - } -#endif // GLM_MATERIAL_TEXTURES - } - - // Draw the group. - glDrawElements(GL_TRIANGLES, array->indexCount, GL_UNSIGNED_SHORT, array->indices); - } - } // transparency pass. - - if (model->arrayMode & GLM_COLOR) glDisable(GL_COLOR_MATERIAL); -} - -#pragma mark - - -#if 0 -/* normals */ -if (model->numnormals) { - numvectors = model->numnormals; - vectors = model->normals; - copies = glmOptimizeVectors(vectors, &numvectors); - - EDEN_LOGe("glmOptimize(): %d redundant normals.\n", - model->numnormals - numvectors); - - for (i = 0; i < model->numtriangles; i++) { - T(i).nindices[0] = (GLuint)vectors[3 * T(i).nindices[0] + 0]; - T(i).nindices[1] = (GLuint)vectors[3 * T(i).nindices[1] + 0]; - T(i).nindices[2] = (GLuint)vectors[3 * T(i).nindices[2] + 0]; - } - - /* free space for old normals */ - free(vectors); - - /* allocate space for the new normals */ - model->numnormals = numvectors; - model->normals = (GLfloat*)malloc(sizeof(GLfloat) * - 3 * (model->numnormals + 1)); - - /* copy the optimized vertices into the actual vertex list */ - for (i = 1; i <= model->numnormals; i++) { - model->normals[3 * i + 0] = copies[3 * i + 0]; - model->normals[3 * i + 1] = copies[3 * i + 1]; - model->normals[3 * i + 2] = copies[3 * i + 2]; - } - - free(copies); -} - -/* texcoords */ -if (model->numtexcoords) { - numvectors = model->numtexcoords; - vectors = model->texcoords; - copies = glmOptimizeVectors(vectors, &numvectors); - - EDEN_LOGe("glmOptimize(): %d redundant texcoords.\n", - model->numtexcoords - numvectors); - - for (i = 0; i < model->numtriangles; i++) { - for (j = 0; j < 3; j++) { - T(i).tindices[j] = (GLuint)vectors[3 * T(i).tindices[j] + 0]; - } - } - - /* free space for old texcoords */ - free(vectors); - - /* allocate space for the new texcoords */ - model->numtexcoords = numvectors; - model->texcoords = (GLfloat*)malloc(sizeof(GLfloat) * - 2 * (model->numtexcoords + 1)); - - /* copy the optimized vertices into the actual vertex list */ - for (i = 1; i <= model->numtexcoords; i++) { - model->texcoords[2 * i + 0] = copies[2 * i + 0]; - model->texcoords[2 * i + 1] = copies[2 * i + 1]; - } - - free(copies); -} -#endif - -#if 0 -/* look for unused vertices */ -/* look for unused normals */ -/* look for unused texcoords */ -for (i = 1; i <= model->numvertices; i++) { - for (j = 0; j < model->numtriangles; i++) { - if (T(j).vindices[0] == i || - T(j).vindices[1] == i || - T(j).vindices[1] == i) - break; - } -} -#endif -#undef T diff --git a/lib/SRC/Eden/gluttext/glut_8x13.c b/lib/SRC/Eden/gluttext/glut_8x13.c deleted file mode 100644 index 4547697..0000000 --- a/lib/SRC/Eden/gluttext/glut_8x13.c +++ /dev/null @@ -1,2041 +0,0 @@ -#include -#if GLUTTEXT_BITMAP_ENABLE - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmap8By13 XXX -#include "glutbitmap.h" -#undef glutBitmap8By13 - -static const BitmapCharRec ch0 = {0,0,0,0,8,0}; -static const BitmapCharRec ch32 = {0,0,0,0,8,0}; -static const BitmapCharRec ch127 = {0,0,0,0,8,0}; -static const BitmapCharRec ch160 = {0,0,0,0,8,0}; - -/* char: 0xff */ - -static const GLubyte ch255data[] = { - 0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x0,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch255 = {6,12,-1,2,8,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { - 0x80,0x80,0xb8,0xc4,0x84,0x84,0xc4,0xb8,0x80,0x80, -}; - -static const BitmapCharRec ch254 = {6,10,-1,2,8,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { - 0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch253 = {6,12,-1,2,8,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { - 0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch252 = {6,10,-1,0,8,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { - 0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch251 = {6,10,-1,0,8,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { - 0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch250 = {6,10,-1,0,8,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { - 0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch249 = {6,10,-1,0,8,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { - 0x80,0x78,0xc4,0xa4,0x94,0x8c,0x78,0x4, -}; - -static const BitmapCharRec ch248 = {6,8,-1,1,8,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { - 0x20,0x20,0x0,0xf8,0x0,0x20,0x20, -}; - -static const BitmapCharRec ch247 = {5,7,-1,-1,8,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { - 0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch246 = {6,10,-1,0,8,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { - 0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch245 = {6,10,-1,0,8,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { - 0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch244 = {6,10,-1,0,8,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { - 0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch243 = {6,10,-1,0,8,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { - 0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch242 = {6,10,-1,0,8,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { - 0x84,0x84,0x84,0x84,0xc4,0xb8,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch241 = {6,10,-1,0,8,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { - 0x78,0x84,0x84,0x84,0x84,0x78,0x8,0x50,0x30,0x48, -}; - -static const BitmapCharRec ch240 = {6,10,-1,0,8,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x50,0x50, -}; - -static const BitmapCharRec ch239 = {5,10,-1,0,8,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x90,0x60, -}; - -static const BitmapCharRec ch238 = {5,10,-1,0,8,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch237 = {5,10,-1,0,8,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch236 = {5,10,-1,0,8,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { - 0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch235 = {6,10,-1,0,8,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { - 0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch234 = {6,10,-1,0,8,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { - 0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch233 = {6,10,-1,0,8,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { - 0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch232 = {6,10,-1,0,8,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { - 0x20,0x10,0x78,0x84,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch231 = {6,8,-1,2,8,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { - 0x6c,0x92,0x90,0x7c,0x12,0x6c, -}; - -static const BitmapCharRec ch230 = {7,6,0,0,8,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { - 0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x30,0x48,0x30, -}; - -static const BitmapCharRec ch229 = {6,10,-1,0,8,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { - 0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch228 = {6,10,-1,0,8,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { - 0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch227 = {6,10,-1,0,8,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { - 0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch226 = {6,10,-1,0,8,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { - 0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch225 = {6,10,-1,0,8,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { - 0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch224 = {6,10,-1,0,8,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { - 0x80,0xb8,0xc4,0x84,0x84,0xf8,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch223 = {6,9,-1,1,8,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { - 0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8,0x80, -}; - -static const BitmapCharRec ch222 = {6,9,-1,0,8,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { - 0x20,0x20,0x20,0x20,0x50,0x88,0x88,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch221 = {5,10,-1,0,8,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch220 = {6,10,-1,0,8,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch219 = {6,10,-1,0,8,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch218 = {6,10,-1,0,8,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch217 = {6,10,-1,0,8,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { - 0x80,0x78,0xc4,0xa4,0xa4,0xa4,0x94,0x94,0x8c,0x78,0x4, -}; - -static const BitmapCharRec ch216 = {6,11,-1,1,8,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { - 0x84,0x48,0x30,0x30,0x48,0x84, -}; - -static const BitmapCharRec ch215 = {6,6,-1,-1,8,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch214 = {7,10,0,0,8,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch213 = {7,10,0,0,8,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x24,0x18, -}; - -static const BitmapCharRec ch212 = {7,10,0,0,8,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch211 = {7,10,0,0,8,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x8,0x10, -}; - -static const BitmapCharRec ch210 = {7,10,0,0,8,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { - 0x82,0x86,0x8a,0x92,0xa2,0xc2,0x82,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch209 = {7,10,0,0,8,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { - 0xfc,0x42,0x42,0x42,0xe2,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch208 = {7,9,0,0,8,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x50,0x50, -}; - -static const BitmapCharRec ch207 = {5,10,-1,0,8,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch206 = {5,10,-1,0,8,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch205 = {5,10,-1,0,8,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch204 = {5,10,-1,0,8,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { - 0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch203 = {6,10,-1,0,8,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { - 0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch202 = {6,10,-1,0,8,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { - 0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch201 = {6,10,-1,0,8,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { - 0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch200 = {6,10,-1,0,8,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { - 0x20,0x10,0x78,0x84,0x80,0x80,0x80,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch199 = {6,11,-1,2,8,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { - 0x9e,0x90,0x90,0xf0,0x9c,0x90,0x90,0x90,0x6e, -}; - -static const BitmapCharRec ch198 = {7,9,0,0,8,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { - 0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x30,0x48,0x30, -}; - -static const BitmapCharRec ch197 = {6,10,-1,0,8,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { - 0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch196 = {6,10,-1,0,8,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { - 0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch195 = {6,10,-1,0,8,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { - 0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch194 = {6,10,-1,0,8,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { - 0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch193 = {6,10,-1,0,8,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { - 0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch192 = {6,10,-1,0,8,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { - 0x78,0x84,0x84,0x80,0x40,0x20,0x20,0x0,0x20, -}; - -static const BitmapCharRec ch191 = {6,9,-1,0,8,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { - 0x6,0x1a,0x12,0xa,0x66,0x92,0x10,0x20,0x90,0x60, -}; - -static const BitmapCharRec ch190 = {7,10,0,0,8,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { - 0x1e,0x10,0xc,0x2,0xf2,0x4c,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch189 = {7,10,0,0,8,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { - 0x6,0x1a,0x12,0xa,0xe6,0x42,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch188 = {7,10,0,0,8,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { - 0x90,0x48,0x24,0x12,0x24,0x48,0x90, -}; - -static const BitmapCharRec ch187 = {7,7,0,-1,8,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { - 0xf0,0x0,0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch186 = {4,6,-1,-3,8,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { - 0xe0,0x40,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch185 = {3,6,-1,-4,8,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { - 0xc0,0x40, -}; - -static const BitmapCharRec ch184 = {2,2,-3,2,8,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { - 0xc0, -}; - -static const BitmapCharRec ch183 = {2,1,-3,-4,8,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { - 0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, -}; - -static const BitmapCharRec ch182 = {6,9,-1,0,8,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { - 0x80,0xb4,0xcc,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch181 = {6,7,-1,1,8,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { - 0x80,0x40, -}; - -static const BitmapCharRec ch180 = {2,2,-3,-8,8,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { - 0x60,0x90,0x10,0x20,0x90,0x60, -}; - -static const BitmapCharRec ch179 = {4,6,-1,-4,8,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { - 0xf0,0x80,0x60,0x10,0x90,0x60, -}; - -static const BitmapCharRec ch178 = {4,6,-1,-4,8,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { - 0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch177 = {5,7,-1,-1,8,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { - 0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch176 = {4,4,-2,-5,8,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { - 0xfc, -}; - -static const BitmapCharRec ch175 = {6,1,-1,-8,8,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { - 0x38,0x44,0xaa,0xb2,0xaa,0xaa,0x92,0x44,0x38, -}; - -static const BitmapCharRec ch174 = {7,9,0,-1,8,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { - 0xfc, -}; - -static const BitmapCharRec ch173 = {6,1,-1,-4,8,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { - 0x4,0x4,0x4,0xfc, -}; - -static const BitmapCharRec ch172 = {6,4,-1,-1,8,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { - 0x12,0x24,0x48,0x90,0x48,0x24,0x12, -}; - -static const BitmapCharRec ch171 = {7,7,0,-1,8,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { - 0xf8,0x0,0x78,0x88,0x78,0x8,0x70, -}; - -static const BitmapCharRec ch170 = {5,7,-1,-2,8,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { - 0x38,0x44,0x92,0xaa,0xa2,0xaa,0x92,0x44,0x38, -}; - -static const BitmapCharRec ch169 = {7,9,0,-1,8,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { - 0xd8, -}; - -static const BitmapCharRec ch168 = {5,1,-1,-8,8,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { - 0x60,0x90,0x10,0x60,0x90,0x90,0x60,0x80,0x90,0x60, -}; - -static const BitmapCharRec ch167 = {4,10,-2,0,8,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { - 0x80,0x80,0x80,0x80,0x0,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch166 = {1,9,-3,0,8,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { - 0x10,0x10,0x7c,0x10,0x7c,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch165 = {7,9,0,0,8,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { - 0x84,0x78,0x48,0x48,0x78,0x84, -}; - -static const BitmapCharRec ch164 = {6,6,-1,-1,8,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { - 0xdc,0x62,0x20,0x20,0x20,0x70,0x20,0x22,0x1c, -}; - -static const BitmapCharRec ch163 = {7,9,0,0,8,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { - 0x20,0x70,0xa8,0xa0,0xa0,0xa8,0x70,0x20, -}; - -static const BitmapCharRec ch162 = {5,8,-1,-1,8,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch161 = {1,9,-3,0,8,ch161data}; - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { - 0x90,0xa8,0x48, -}; - -static const BitmapCharRec ch126 = {5,3,-1,-6,8,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { - 0xe0,0x10,0x10,0x20,0x18,0x20,0x10,0x10,0xe0, -}; - -static const BitmapCharRec ch125 = {5,9,-1,0,8,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch124 = {1,9,-3,0,8,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { - 0x38,0x40,0x40,0x20,0xc0,0x20,0x40,0x40,0x38, -}; - -static const BitmapCharRec ch123 = {5,9,-2,0,8,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { - 0xfc,0x40,0x20,0x10,0x8,0xfc, -}; - -static const BitmapCharRec ch122 = {6,6,-1,0,8,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { - 0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch121 = {6,8,-1,2,8,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { - 0x84,0x48,0x30,0x30,0x48,0x84, -}; - -static const BitmapCharRec ch120 = {6,6,-1,0,8,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { - 0x44,0xaa,0x92,0x92,0x82,0x82, -}; - -static const BitmapCharRec ch119 = {7,6,0,0,8,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { - 0x20,0x50,0x50,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch118 = {5,6,-1,0,8,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { - 0x74,0x88,0x88,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch117 = {6,6,-1,0,8,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { - 0x38,0x44,0x40,0x40,0x40,0xf8,0x40,0x40, -}; - -static const BitmapCharRec ch116 = {6,8,-1,0,8,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { - 0x78,0x84,0x18,0x60,0x84,0x78, -}; - -static const BitmapCharRec ch115 = {6,6,-1,0,8,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { - 0x40,0x40,0x40,0x40,0x44,0xb8, -}; - -static const BitmapCharRec ch114 = {6,6,-1,0,8,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { - 0x4,0x4,0x4,0x74,0x8c,0x84,0x8c,0x74, -}; - -static const BitmapCharRec ch113 = {6,8,-1,2,8,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { - 0x80,0x80,0x80,0xb8,0xc4,0x84,0xc4,0xb8, -}; - -static const BitmapCharRec ch112 = {6,8,-1,2,8,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { - 0x78,0x84,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch111 = {6,6,-1,0,8,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { - 0x84,0x84,0x84,0x84,0xc4,0xb8, -}; - -static const BitmapCharRec ch110 = {6,6,-1,0,8,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { - 0x82,0x92,0x92,0x92,0x92,0xec, -}; - -static const BitmapCharRec ch109 = {7,6,0,0,8,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, -}; - -static const BitmapCharRec ch108 = {5,9,-1,0,8,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { - 0x84,0x88,0x90,0xe0,0x90,0x88,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch107 = {6,9,-1,0,8,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { - 0x70,0x88,0x88,0x8,0x8,0x8,0x8,0x18,0x0,0x8, -}; - -static const BitmapCharRec ch106 = {5,10,-1,2,8,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x20, -}; - -static const BitmapCharRec ch105 = {5,8,-1,0,8,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { - 0x84,0x84,0x84,0x84,0xc4,0xb8,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch104 = {6,9,-1,0,8,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { - 0x78,0x84,0x78,0x80,0x70,0x88,0x88,0x74, -}; - -static const BitmapCharRec ch103 = {6,8,-1,2,8,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { - 0x40,0x40,0x40,0x40,0xf8,0x40,0x40,0x44,0x38, -}; - -static const BitmapCharRec ch102 = {6,9,-1,0,8,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { - 0x78,0x84,0x80,0xfc,0x84,0x78, -}; - -static const BitmapCharRec ch101 = {6,6,-1,0,8,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { - 0x74,0x8c,0x84,0x84,0x8c,0x74,0x4,0x4,0x4, -}; - -static const BitmapCharRec ch100 = {6,9,-1,0,8,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { - 0x78,0x84,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch99 = {6,6,-1,0,8,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { - 0xb8,0xc4,0x84,0x84,0xc4,0xb8,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch98 = {6,9,-1,0,8,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { - 0x74,0x8c,0x84,0x7c,0x4,0x78, -}; - -static const BitmapCharRec ch97 = {6,6,-1,0,8,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { - 0x10,0x60,0xe0, -}; - -static const BitmapCharRec ch96 = {4,3,-2,-6,8,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { - 0xfe, -}; - -static const BitmapCharRec ch95 = {7,1,0,1,8,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { - 0x88,0x50,0x20, -}; - -static const BitmapCharRec ch94 = {5,3,-1,-6,8,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { - 0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xf0, -}; - -static const BitmapCharRec ch93 = {4,9,-1,0,8,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { - 0x2,0x2,0x4,0x8,0x10,0x20,0x40,0x80,0x80, -}; - -static const BitmapCharRec ch92 = {7,9,0,0,8,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { - 0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf0, -}; - -static const BitmapCharRec ch91 = {4,9,-2,0,8,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { - 0xfc,0x80,0x80,0x40,0x20,0x10,0x8,0x4,0xfc, -}; - -static const BitmapCharRec ch90 = {6,9,-1,0,8,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { - 0x10,0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch89 = {7,9,0,0,8,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { - 0x82,0x82,0x44,0x28,0x10,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch88 = {7,9,0,0,8,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { - 0x44,0xaa,0x92,0x92,0x92,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch87 = {7,9,0,0,8,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { - 0x10,0x28,0x28,0x28,0x44,0x44,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch86 = {7,9,0,0,8,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch85 = {6,9,-1,0,8,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { - 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, -}; - -static const BitmapCharRec ch84 = {7,9,0,0,8,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { - 0x78,0x84,0x4,0x4,0x78,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch83 = {6,9,-1,0,8,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { - 0x84,0x88,0x90,0xa0,0xf8,0x84,0x84,0x84,0xf8, -}; - -static const BitmapCharRec ch82 = {6,9,-1,0,8,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { - 0x4,0x78,0x94,0xa4,0x84,0x84,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch81 = {6,10,-1,1,8,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { - 0x80,0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8, -}; - -static const BitmapCharRec ch80 = {6,9,-1,0,8,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch79 = {6,9,-1,0,8,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { - 0x84,0x84,0x84,0x8c,0x94,0xa4,0xc4,0x84,0x84, -}; - -static const BitmapCharRec ch78 = {6,9,-1,0,8,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { - 0x82,0x82,0x82,0x92,0x92,0xaa,0xc6,0x82,0x82, -}; - -static const BitmapCharRec ch77 = {7,9,0,0,8,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { - 0xfc,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch76 = {6,9,-1,0,8,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { - 0x84,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x84, -}; - -static const BitmapCharRec ch75 = {6,9,-1,0,8,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { - 0x70,0x88,0x8,0x8,0x8,0x8,0x8,0x8,0x3c, -}; - -static const BitmapCharRec ch74 = {6,9,-1,0,8,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, -}; - -static const BitmapCharRec ch73 = {5,9,-1,0,8,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { - 0x84,0x84,0x84,0x84,0xfc,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch72 = {6,9,-1,0,8,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { - 0x74,0x8c,0x84,0x9c,0x80,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch71 = {6,9,-1,0,8,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { - 0x80,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xfc, -}; - -static const BitmapCharRec ch70 = {6,9,-1,0,8,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { - 0xfc,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xfc, -}; - -static const BitmapCharRec ch69 = {6,9,-1,0,8,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { - 0xfc,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch68 = {7,9,0,0,8,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { - 0x78,0x84,0x80,0x80,0x80,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch67 = {6,9,-1,0,8,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { - 0xfc,0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch66 = {7,9,0,0,8,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { - 0x84,0x84,0x84,0xfc,0x84,0x84,0x84,0x48,0x30, -}; - -static const BitmapCharRec ch65 = {6,9,-1,0,8,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { - 0x78,0x80,0x94,0xac,0xa4,0x9c,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch64 = {6,9,-1,0,8,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { - 0x10,0x0,0x10,0x10,0x8,0x4,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch63 = {6,9,-1,0,8,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { - 0x80,0x40,0x20,0x10,0x8,0x10,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch62 = {5,9,-1,0,8,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { - 0xfc,0x0,0x0,0xfc, -}; - -static const BitmapCharRec ch61 = {6,4,-1,-2,8,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { - 0x8,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x8, -}; - -static const BitmapCharRec ch60 = {5,9,-2,0,8,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { - 0x80,0x60,0x70,0x0,0x0,0x20,0x70,0x20, -}; - -static const BitmapCharRec ch59 = {4,8,-1,1,8,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { - 0x40,0xe0,0x40,0x0,0x0,0x40,0xe0,0x40, -}; - -static const BitmapCharRec ch58 = {3,8,-2,1,8,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { - 0x70,0x8,0x4,0x4,0x74,0x8c,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch57 = {6,9,-1,0,8,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { - 0x78,0x84,0x84,0x84,0x78,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch56 = {6,9,-1,0,8,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { - 0x40,0x40,0x20,0x20,0x10,0x10,0x8,0x4,0xfc, -}; - -static const BitmapCharRec ch55 = {6,9,-1,0,8,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { - 0x78,0x84,0x84,0xc4,0xb8,0x80,0x80,0x40,0x38, -}; - -static const BitmapCharRec ch54 = {6,9,-1,0,8,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { - 0x78,0x84,0x4,0x4,0xc4,0xb8,0x80,0x80,0xfc, -}; - -static const BitmapCharRec ch53 = {6,9,-1,0,8,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { - 0x8,0x8,0xfc,0x88,0x88,0x48,0x28,0x18,0x8, -}; - -static const BitmapCharRec ch52 = {6,9,-1,0,8,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { - 0x78,0x84,0x4,0x4,0x38,0x10,0x8,0x4,0xfc, -}; - -static const BitmapCharRec ch51 = {6,9,-1,0,8,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { - 0xfc,0x80,0x40,0x30,0x8,0x4,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch50 = {6,9,-1,0,8,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0xa0,0x60,0x20, -}; - -static const BitmapCharRec ch49 = {5,9,-1,0,8,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { - 0x30,0x48,0x84,0x84,0x84,0x84,0x84,0x48,0x30, -}; - -static const BitmapCharRec ch48 = {6,9,-1,0,8,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { - 0x80,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x2, -}; - -static const BitmapCharRec ch47 = {7,9,0,0,8,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { - 0x40,0xe0,0x40, -}; - -static const BitmapCharRec ch46 = {3,3,-2,1,8,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { - 0xfc, -}; - -static const BitmapCharRec ch45 = {6,1,-1,-4,8,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { - 0x80,0x60,0x70, -}; - -static const BitmapCharRec ch44 = {4,3,-1,1,8,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { - 0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch43 = {5,5,-1,-2,8,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { - 0x48,0x30,0xfc,0x30,0x48, -}; - -static const BitmapCharRec ch42 = {6,5,-1,-2,8,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { - 0x80,0x40,0x40,0x20,0x20,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {3,9,-2,0,8,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { - 0x20,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch40 = {3,9,-3,0,8,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { - 0x80,0x60,0x70, -}; - -static const BitmapCharRec ch39 = {4,3,-1,-6,8,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { - 0x74,0x88,0x94,0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch38 = {6,7,-1,0,8,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { - 0x88,0x54,0x48,0x20,0x10,0x10,0x48,0xa4,0x44, -}; - -static const BitmapCharRec ch37 = {6,9,-1,0,8,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { - 0x20,0xf0,0x28,0x70,0xa0,0x78,0x20, -}; - -static const BitmapCharRec ch36 = {5,7,-1,-1,8,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { - 0x48,0x48,0xfc,0x48,0xfc,0x48,0x48, -}; - -static const BitmapCharRec ch35 = {6,7,-1,-1,8,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { - 0x90,0x90,0x90, -}; - -static const BitmapCharRec ch34 = {4,3,-2,-6,8,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { - 0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch33 = {1,9,-3,0,8,ch33data}; - -/* char: 0x1f */ - -static const GLubyte ch31data[] = { - 0x80, -}; - -static const BitmapCharRec ch31 = {1,1,-3,-3,8,ch31data}; - -/* char: 0x1e */ - -static const GLubyte ch30data[] = { - 0xdc,0x62,0x20,0x20,0x20,0x70,0x20,0x22,0x1c, -}; - -static const BitmapCharRec ch30 = {7,9,0,0,8,ch30data}; - -/* char: 0x1d */ - -static const GLubyte ch29data[] = { - 0x80,0x40,0xfe,0x10,0xfe,0x4,0x2, -}; - -static const BitmapCharRec ch29 = {7,7,0,0,8,ch29data}; - -/* char: 0x1c */ - -static const GLubyte ch28data[] = { - 0x88,0x48,0x48,0x48,0x48,0xfc, -}; - -static const BitmapCharRec ch28 = {6,6,-1,0,8,ch28data}; - -/* char: 0x1b */ - -static const GLubyte ch27data[] = { - 0xfe,0x80,0x20,0x8,0x2,0x8,0x20,0x80, -}; - -static const BitmapCharRec ch27 = {7,8,0,0,8,ch27data}; - -/* char: 0x1a */ - -static const GLubyte ch26data[] = { - 0xfe,0x2,0x8,0x20,0x80,0x20,0x8,0x2, -}; - -static const BitmapCharRec ch26 = {7,8,0,0,8,ch26data}; - -/* char: 0x19 */ - -static const GLubyte ch25data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch25 = {1,13,-3,2,8,ch25data}; - -/* char: 0x18 */ - -static const GLubyte ch24data[] = { - 0x10,0x10,0x10,0x10,0x10,0xff, -}; - -static const BitmapCharRec ch24 = {8,6,0,2,8,ch24data}; - -/* char: 0x17 */ - -static const GLubyte ch23data[] = { - 0xff,0x10,0x10,0x10,0x10,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch23 = {8,8,0,-3,8,ch23data}; - -/* char: 0x16 */ - -static const GLubyte ch22data[] = { - 0x10,0x10,0x10,0x10,0x10,0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch22 = {4,13,0,2,8,ch22data}; - -/* char: 0x15 */ - -static const GLubyte ch21data[] = { - 0x80,0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch21 = {5,13,-3,2,8,ch21data}; - -/* char: 0x14 */ - -static const GLubyte ch20data[] = { - 0xff, -}; - -static const BitmapCharRec ch20 = {8,1,0,1,8,ch20data}; - -/* char: 0x13 */ - -static const GLubyte ch19data[] = { - 0xff, -}; - -static const BitmapCharRec ch19 = {8,1,0,-1,8,ch19data}; - -/* char: 0x12 */ - -static const GLubyte ch18data[] = { - 0xff, -}; - -static const BitmapCharRec ch18 = {8,1,0,-3,8,ch18data}; - -/* char: 0x11 */ - -static const GLubyte ch17data[] = { - 0xff, -}; - -static const BitmapCharRec ch17 = {8,1,0,-5,8,ch17data}; - -/* char: 0x10 */ - -static const GLubyte ch16data[] = { - 0xff, -}; - -static const BitmapCharRec ch16 = {8,1,0,-7,8,ch16data}; - -/* char: 0xf */ - -static const GLubyte ch15data[] = { - 0x10,0x10,0x10,0x10,0x10,0xff,0x10,0x10,0x10,0x10,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch15 = {8,13,0,2,8,ch15data}; - -/* char: 0xe */ - -static const GLubyte ch14data[] = { - 0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch14 = {5,8,-3,-3,8,ch14data}; - -/* char: 0xd */ - -static const GLubyte ch13data[] = { - 0x80,0x80,0x80,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch13 = {5,6,-3,2,8,ch13data}; - -/* char: 0xc */ - -static const GLubyte ch12data[] = { - 0x10,0x10,0x10,0x10,0x10,0xf0, -}; - -static const BitmapCharRec ch12 = {4,6,0,2,8,ch12data}; - -/* char: 0xb */ - -static const GLubyte ch11data[] = { - 0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch11 = {4,8,0,-3,8,ch11data}; - -/* char: 0xa */ - -static const GLubyte ch10data[] = { - 0x8,0x8,0x8,0x8,0x3e,0x20,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch10 = {7,9,0,2,8,ch10data}; - -/* char: 0x9 */ - -static const GLubyte ch9data[] = { - 0x3e,0x20,0x20,0x20,0x88,0x98,0xa8,0xc8,0x88, -}; - -static const BitmapCharRec ch9 = {7,9,0,2,8,ch9data}; - -/* char: 0x8 */ - -static const GLubyte ch8data[] = { - 0xfe,0x10,0x10,0xfe,0x10,0x10, -}; - -static const BitmapCharRec ch8 = {7,6,0,0,8,ch8data}; - -/* char: 0x7 */ - -static const GLubyte ch7data[] = { - 0x70,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch7 = {5,4,-1,-5,8,ch7data}; - -/* char: 0x6 */ - -static const GLubyte ch6data[] = { - 0x20,0x20,0x3c,0x20,0x3e,0xf8,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch6 = {7,9,0,2,8,ch6data}; - -/* char: 0x5 */ - -static const GLubyte ch5data[] = { - 0x22,0x22,0x3c,0x22,0x3c,0x78,0x80,0x80,0x78, -}; - -static const BitmapCharRec ch5 = {7,9,0,2,8,ch5data}; - -/* char: 0x4 */ - -static const GLubyte ch4data[] = { - 0x10,0x10,0x1c,0x10,0x9e,0x80,0xe0,0x80,0xf0, -}; - -static const BitmapCharRec ch4 = {7,9,0,2,8,ch4data}; - -/* char: 0x3 */ - -static const GLubyte ch3data[] = { - 0x8,0x8,0x8,0x3e,0x88,0x88,0xf8,0x88,0x88, -}; - -static const BitmapCharRec ch3 = {7,9,0,2,8,ch3data}; - -/* char: 0x2 */ - -static const GLubyte ch2data[] = { - 0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, -}; - -static const BitmapCharRec ch2 = {8,12,0,2,8,ch2data}; - -/* char: 0x1 */ - -static const GLubyte ch1data[] = { - 0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10, -}; - -static const BitmapCharRec ch1 = {7,7,0,-1,8,ch1data}; - -static const BitmapCharRec * const chars[] = { - &ch0, - &ch1, - &ch2, - &ch3, - &ch4, - &ch5, - &ch6, - &ch7, - &ch8, - &ch9, - &ch10, - &ch11, - &ch12, - &ch13, - &ch14, - &ch15, - &ch16, - &ch17, - &ch18, - &ch19, - &ch20, - &ch21, - &ch22, - &ch23, - &ch24, - &ch25, - &ch26, - &ch27, - &ch28, - &ch29, - &ch30, - &ch31, - &ch32, - &ch33, - &ch34, - &ch35, - &ch36, - &ch37, - &ch38, - &ch39, - &ch40, - &ch41, - &ch42, - &ch43, - &ch44, - &ch45, - &ch46, - &ch47, - &ch48, - &ch49, - &ch50, - &ch51, - &ch52, - &ch53, - &ch54, - &ch55, - &ch56, - &ch57, - &ch58, - &ch59, - &ch60, - &ch61, - &ch62, - &ch63, - &ch64, - &ch65, - &ch66, - &ch67, - &ch68, - &ch69, - &ch70, - &ch71, - &ch72, - &ch73, - &ch74, - &ch75, - &ch76, - &ch77, - &ch78, - &ch79, - &ch80, - &ch81, - &ch82, - &ch83, - &ch84, - &ch85, - &ch86, - &ch87, - &ch88, - &ch89, - &ch90, - &ch91, - &ch92, - &ch93, - &ch94, - &ch95, - &ch96, - &ch97, - &ch98, - &ch99, - &ch100, - &ch101, - &ch102, - &ch103, - &ch104, - &ch105, - &ch106, - &ch107, - &ch108, - &ch109, - &ch110, - &ch111, - &ch112, - &ch113, - &ch114, - &ch115, - &ch116, - &ch117, - &ch118, - &ch119, - &ch120, - &ch121, - &ch122, - &ch123, - &ch124, - &ch125, - &ch126, - &ch127, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &ch160, - &ch161, - &ch162, - &ch163, - &ch164, - &ch165, - &ch166, - &ch167, - &ch168, - &ch169, - &ch170, - &ch171, - &ch172, - &ch173, - &ch174, - &ch175, - &ch176, - &ch177, - &ch178, - &ch179, - &ch180, - &ch181, - &ch182, - &ch183, - &ch184, - &ch185, - &ch186, - &ch187, - &ch188, - &ch189, - &ch190, - &ch191, - &ch192, - &ch193, - &ch194, - &ch195, - &ch196, - &ch197, - &ch198, - &ch199, - &ch200, - &ch201, - &ch202, - &ch203, - &ch204, - &ch205, - &ch206, - &ch207, - &ch208, - &ch209, - &ch210, - &ch211, - &ch212, - &ch213, - &ch214, - &ch215, - &ch216, - &ch217, - &ch218, - &ch219, - &ch220, - &ch221, - &ch222, - &ch223, - &ch224, - &ch225, - &ch226, - &ch227, - &ch228, - &ch229, - &ch230, - &ch231, - &ch232, - &ch233, - &ch234, - &ch235, - &ch236, - &ch237, - &ch238, - &ch239, - &ch240, - &ch241, - &ch242, - &ch243, - &ch244, - &ch245, - &ch246, - &ch247, - &ch248, - &ch249, - &ch250, - &ch251, - &ch252, - &ch253, - &ch254, - &ch255, -}; - -const BitmapFontRec glutBitmap8By13 = { - "-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1", - 256, - 0, - chars -}; - -#endif diff --git a/lib/SRC/Eden/gluttext/glut_9x15.c b/lib/SRC/Eden/gluttext/glut_9x15.c deleted file mode 100644 index 05782d6..0000000 --- a/lib/SRC/Eden/gluttext/glut_9x15.c +++ /dev/null @@ -1,2044 +0,0 @@ -#include -#if GLUTTEXT_BITMAP_ENABLE - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmap9By15 XXX -#include "glutbitmap.h" -#undef glutBitmap9By15 - -static const BitmapCharRec ch0 = {0,0,0,0,9,0}; -static const BitmapCharRec ch32 = {0,0,0,0,9,0}; -static const BitmapCharRec ch127 = {0,0,0,0,9,0}; -static const BitmapCharRec ch160 = {0,0,0,0,9,0}; - -/* char: 0xff */ - -static const GLubyte ch255data[] = { - 0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch255 = {6,14,-1,3,9,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { - 0x80,0x80,0x80,0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80, -}; - -static const BitmapCharRec ch254 = {7,12,-1,3,9,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { - 0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch253 = {6,14,-1,3,9,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { - 0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch252 = {7,11,-1,0,9,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { - 0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch251 = {7,11,-1,0,9,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { - 0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch250 = {7,11,-1,0,9,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { - 0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch249 = {7,11,-1,0,9,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { - 0x80,0x7c,0xa2,0xa2,0x92,0x8a,0x8a,0x7c,0x2, -}; - -static const BitmapCharRec ch248 = {7,9,-1,1,9,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { - 0x10,0x38,0x10,0x0,0xfe,0x0,0x10,0x38,0x10, -}; - -static const BitmapCharRec ch247 = {7,9,-1,0,9,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch246 = {7,11,-1,0,9,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch245 = {7,11,-1,0,9,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch244 = {7,11,-1,0,9,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch243 = {7,11,-1,0,9,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch242 = {7,11,-1,0,9,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { - 0x82,0x82,0x82,0x82,0x82,0xc2,0xbc,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch241 = {7,11,-1,0,9,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x8,0x50,0x30,0x48, -}; - -static const BitmapCharRec ch240 = {7,11,-1,0,9,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x50,0x50, -}; - -static const BitmapCharRec ch239 = {5,11,-2,0,9,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x90,0x60, -}; - -static const BitmapCharRec ch238 = {5,11,-2,0,9,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x60,0x10, -}; - -static const BitmapCharRec ch237 = {5,11,-2,0,9,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x30,0x40, -}; - -static const BitmapCharRec ch236 = {5,11,-2,0,9,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { - 0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch235 = {7,11,-1,0,9,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { - 0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch234 = {7,11,-1,0,9,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { - 0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch233 = {7,11,-1,0,9,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { - 0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch232 = {7,11,-1,0,9,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { - 0x30,0x48,0x18,0x7c,0x82,0x80,0x80,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch231 = {7,10,-1,3,9,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { - 0x6e,0x92,0x90,0x7c,0x12,0x92,0x6c, -}; - -static const BitmapCharRec ch230 = {7,7,-1,0,9,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { - 0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x18,0x24,0x18, -}; - -static const BitmapCharRec ch229 = {7,11,-1,0,9,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { - 0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch228 = {7,11,-1,0,9,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { - 0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch227 = {7,11,-1,0,9,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { - 0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch226 = {7,11,-1,0,9,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { - 0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch225 = {7,11,-1,0,9,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { - 0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch224 = {7,11,-1,0,9,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { - 0x80,0xbc,0xc2,0x82,0x82,0xfc,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch223 = {7,9,-1,1,9,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { - 0x80,0x80,0x80,0xfc,0x82,0x82,0x82,0xfc,0x80,0x80, -}; - -static const BitmapCharRec ch222 = {7,10,-1,0,9,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { - 0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch221 = {7,11,-1,0,9,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch220 = {7,11,-1,0,9,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch219 = {7,11,-1,0,9,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch218 = {7,11,-1,0,9,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch217 = {7,11,-1,0,9,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { - 0x80,0x7c,0xc2,0xa2,0xa2,0x92,0x92,0x8a,0x8a,0x86,0x7c,0x2, -}; - -static const BitmapCharRec ch216 = {7,12,-1,1,9,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { - 0x82,0x44,0x28,0x10,0x28,0x44,0x82, -}; - -static const BitmapCharRec ch215 = {7,7,-1,-1,9,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch214 = {7,11,-1,0,9,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch213 = {7,11,-1,0,9,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch212 = {7,11,-1,0,9,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch211 = {7,11,-1,0,9,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch210 = {7,11,-1,0,9,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { - 0x82,0x86,0x8a,0x92,0x92,0xa2,0xc2,0x82,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch209 = {7,11,-1,0,9,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { - 0xfc,0x42,0x42,0x42,0x42,0xf2,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch208 = {7,10,-1,0,9,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x50,0x50, -}; - -static const BitmapCharRec ch207 = {5,11,-2,0,9,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x88,0x70, -}; - -static const BitmapCharRec ch206 = {5,11,-2,0,9,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x60,0x10, -}; - -static const BitmapCharRec ch205 = {5,11,-2,0,9,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x30,0x40, -}; - -static const BitmapCharRec ch204 = {5,11,-2,0,9,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { - 0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch203 = {7,11,-1,0,9,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { - 0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch202 = {7,11,-1,0,9,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { - 0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch201 = {7,11,-1,0,9,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { - 0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch200 = {7,11,-1,0,9,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { - 0x30,0x48,0x18,0x7c,0x82,0x80,0x80,0x80,0x80,0x80,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch199 = {7,13,-1,3,9,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { - 0x9e,0x90,0x90,0x90,0xfc,0x90,0x90,0x90,0x90,0x6e, -}; - -static const BitmapCharRec ch198 = {7,10,-1,0,9,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { - 0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x10,0x28,0x10, -}; - -static const BitmapCharRec ch197 = {7,11,-1,0,9,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { - 0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch196 = {7,11,-1,0,9,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { - 0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch195 = {7,11,-1,0,9,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { - 0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch194 = {7,11,-1,0,9,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { - 0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch193 = {7,11,-1,0,9,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { - 0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch192 = {7,11,-1,0,9,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { - 0x7c,0x82,0x82,0x80,0x40,0x20,0x10,0x10,0x0,0x10, -}; - -static const BitmapCharRec ch191 = {7,10,-1,0,9,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { - 0x6,0x1a,0x12,0xa,0x66,0x92,0x10,0x20,0x90,0x60, -}; - -static const BitmapCharRec ch190 = {7,10,-1,0,9,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { - 0x1e,0x10,0xc,0x2,0xf2,0x4c,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch189 = {7,10,-1,0,9,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { - 0x6,0x1a,0x12,0xa,0xe6,0x42,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch188 = {7,10,-1,0,9,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { - 0x90,0x48,0x24,0x12,0x12,0x24,0x48,0x90, -}; - -static const BitmapCharRec ch187 = {7,8,-1,-1,9,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { - 0xf8,0x0,0x70,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch186 = {5,6,-1,-5,9,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { - 0xe0,0x40,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch185 = {3,6,-1,-4,9,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { - 0x60,0x90,0x30, -}; - -static const BitmapCharRec ch184 = {4,3,-2,3,9,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { - 0xc0,0xc0, -}; - -static const BitmapCharRec ch183 = {2,2,-4,-4,9,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { - 0xa,0xa,0xa,0xa,0xa,0x7a,0x8a,0x8a,0x8a,0x7e, -}; - -static const BitmapCharRec ch182 = {7,10,-1,0,9,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { - 0x80,0x80,0xba,0xc6,0x82,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch181 = {7,9,-1,2,9,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { - 0xc0,0x20, -}; - -static const BitmapCharRec ch180 = {3,2,-3,-9,9,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { - 0x60,0x90,0x10,0x20,0x90,0x60, -}; - -static const BitmapCharRec ch179 = {4,6,-1,-4,9,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { - 0xf0,0x80,0x60,0x10,0x90,0x60, -}; - -static const BitmapCharRec ch178 = {4,6,-1,-4,9,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { - 0xfe,0x0,0x10,0x10,0x10,0xfe,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch177 = {7,9,-1,-1,9,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { - 0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch176 = {4,4,-3,-6,9,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { - 0xfc, -}; - -static const BitmapCharRec ch175 = {6,1,-1,-9,9,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { - 0x3c,0x42,0xa5,0xa9,0xbd,0xa5,0xb9,0x42,0x3c, -}; - -static const BitmapCharRec ch174 = {8,9,0,-1,9,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { - 0xfc, -}; - -static const BitmapCharRec ch173 = {6,1,-1,-4,9,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { - 0x4,0x4,0x4,0xfc, -}; - -static const BitmapCharRec ch172 = {6,4,-1,-2,9,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { - 0x12,0x24,0x48,0x90,0x90,0x48,0x24,0x12, -}; - -static const BitmapCharRec ch171 = {7,8,-1,-1,9,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { - 0xf8,0x0,0x78,0x90,0x70,0x90,0x60, -}; - -static const BitmapCharRec ch170 = {5,7,-3,-3,9,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { - 0x3c,0x42,0x99,0xa5,0xa1,0xa5,0x99,0x42,0x3c, -}; - -static const BitmapCharRec ch169 = {8,9,0,-1,9,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { - 0xa0,0xa0, -}; - -static const BitmapCharRec ch168 = {3,2,-3,-9,9,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { - 0x70,0x88,0x8,0x70,0x88,0x88,0x88,0x70,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch167 = {5,11,-2,1,9,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { - 0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch166 = {1,11,-4,1,9,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { - 0x10,0x10,0x10,0x7c,0x10,0x7c,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch165 = {7,10,-1,0,9,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { - 0x82,0x7c,0x44,0x44,0x7c,0x82, -}; - -static const BitmapCharRec ch164 = {7,6,-1,-3,9,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { - 0x5c,0xa2,0x60,0x20,0x20,0xf8,0x20,0x20,0x22,0x1c, -}; - -static const BitmapCharRec ch163 = {7,10,-1,0,9,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { - 0x40,0x78,0xa4,0xa0,0x90,0x94,0x78,0x8, -}; - -static const BitmapCharRec ch162 = {6,8,-1,0,9,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x0,0x80,0x80, -}; - -static const BitmapCharRec ch161 = {1,11,-4,0,9,ch161data}; - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { - 0x8c,0x92,0x62, -}; - -static const BitmapCharRec ch126 = {7,3,-1,-7,9,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { - 0xe0,0x10,0x10,0x10,0x20,0x18,0x18,0x20,0x10,0x10,0x10,0xe0, -}; - -static const BitmapCharRec ch125 = {5,12,-1,1,9,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch124 = {1,12,-4,1,9,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { - 0x38,0x40,0x40,0x40,0x20,0xc0,0xc0,0x20,0x40,0x40,0x40,0x38, -}; - -static const BitmapCharRec ch123 = {5,12,-3,1,9,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { - 0xfe,0x40,0x20,0x10,0x8,0x4,0xfe, -}; - -static const BitmapCharRec ch122 = {7,7,-1,0,9,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { - 0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch121 = {6,10,-1,3,9,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { - 0x82,0x44,0x28,0x10,0x28,0x44,0x82, -}; - -static const BitmapCharRec ch120 = {7,7,-1,0,9,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { - 0x44,0xaa,0x92,0x92,0x92,0x82,0x82, -}; - -static const BitmapCharRec ch119 = {7,7,-1,0,9,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { - 0x10,0x28,0x28,0x44,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch118 = {7,7,-1,0,9,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { - 0x7a,0x84,0x84,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch117 = {7,7,-1,0,9,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { - 0x1c,0x22,0x20,0x20,0x20,0x20,0xfc,0x20,0x20, -}; - -static const BitmapCharRec ch116 = {7,9,-1,0,9,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { - 0x7c,0x82,0x2,0x7c,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch115 = {7,7,-1,0,9,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { - 0x40,0x40,0x40,0x40,0x42,0x62,0x9c, -}; - -static const BitmapCharRec ch114 = {7,7,-1,0,9,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { - 0x2,0x2,0x2,0x7a,0x86,0x82,0x82,0x82,0x86,0x7a, -}; - -static const BitmapCharRec ch113 = {7,10,-1,3,9,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { - 0x80,0x80,0x80,0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc, -}; - -static const BitmapCharRec ch112 = {7,10,-1,3,9,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch111 = {7,7,-1,0,9,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { - 0x82,0x82,0x82,0x82,0x82,0xc2,0xbc, -}; - -static const BitmapCharRec ch110 = {7,7,-1,0,9,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { - 0x82,0x92,0x92,0x92,0x92,0x92,0xec, -}; - -static const BitmapCharRec ch109 = {7,7,-1,0,9,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xe0, -}; - -static const BitmapCharRec ch108 = {5,10,-2,0,9,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { - 0x82,0x8c,0xb0,0xc0,0xb0,0x8c,0x82,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch107 = {7,10,-1,0,9,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { - 0x78,0x84,0x84,0x84,0x4,0x4,0x4,0x4,0x4,0x1c,0x0,0x0,0xc, -}; - -static const BitmapCharRec ch106 = {6,13,-1,3,9,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x60, -}; - -static const BitmapCharRec ch105 = {5,10,-2,0,9,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { - 0x82,0x82,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch104 = {7,10,-1,0,9,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { - 0x7c,0x82,0x82,0x7c,0x80,0x78,0x84,0x84,0x84,0x7a, -}; - -static const BitmapCharRec ch103 = {7,10,-1,3,9,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { - 0x20,0x20,0x20,0x20,0xf8,0x20,0x20,0x22,0x22,0x1c, -}; - -static const BitmapCharRec ch102 = {7,10,-1,0,9,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { - 0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch101 = {7,7,-1,0,9,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { - 0x7a,0x86,0x82,0x82,0x82,0x86,0x7a,0x2,0x2,0x2, -}; - -static const BitmapCharRec ch100 = {7,10,-1,0,9,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { - 0x7c,0x82,0x80,0x80,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch99 = {7,7,-1,0,9,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { - 0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch98 = {7,10,-1,0,9,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { - 0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c, -}; - -static const BitmapCharRec ch97 = {7,7,-1,0,9,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { - 0x10,0x20,0x40,0xc0, -}; - -static const BitmapCharRec ch96 = {4,4,-3,-6,9,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { - 0xff, -}; - -static const BitmapCharRec ch95 = {8,1,0,1,9,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { - 0x82,0x44,0x28,0x10, -}; - -static const BitmapCharRec ch94 = {7,4,-1,-6,9,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { - 0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xf0, -}; - -static const BitmapCharRec ch93 = {4,12,-2,1,9,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { - 0x2,0x4,0x4,0x8,0x10,0x10,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch92 = {7,10,-1,0,9,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { - 0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf0, -}; - -static const BitmapCharRec ch91 = {4,12,-3,1,9,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { - 0xfe,0x80,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0xfe, -}; - -static const BitmapCharRec ch90 = {7,10,-1,0,9,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { - 0x10,0x10,0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch89 = {7,10,-1,0,9,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { - 0x82,0x82,0x44,0x28,0x10,0x10,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch88 = {7,10,-1,0,9,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { - 0x44,0xaa,0x92,0x92,0x92,0x92,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch87 = {7,10,-1,0,9,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { - 0x10,0x28,0x28,0x28,0x44,0x44,0x44,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch86 = {7,10,-1,0,9,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch85 = {7,10,-1,0,9,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { - 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, -}; - -static const BitmapCharRec ch84 = {7,10,-1,0,9,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { - 0x7c,0x82,0x82,0x2,0xc,0x70,0x80,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch83 = {7,10,-1,0,9,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { - 0x82,0x82,0x84,0x88,0x90,0xfc,0x82,0x82,0x82,0xfc, -}; - -static const BitmapCharRec ch82 = {7,10,-1,0,9,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { - 0x6,0x8,0x7c,0x92,0xa2,0x82,0x82,0x82,0x82,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch81 = {7,12,-1,2,9,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { - 0x80,0x80,0x80,0x80,0x80,0xfc,0x82,0x82,0x82,0xfc, -}; - -static const BitmapCharRec ch80 = {7,10,-1,0,9,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { - 0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch79 = {7,10,-1,0,9,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { - 0x82,0x82,0x82,0x86,0x8a,0x92,0xa2,0xc2,0x82,0x82, -}; - -static const BitmapCharRec ch78 = {7,10,-1,0,9,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { - 0x82,0x82,0x82,0x92,0x92,0xaa,0xaa,0xc6,0x82,0x82, -}; - -static const BitmapCharRec ch77 = {7,10,-1,0,9,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { - 0xfe,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch76 = {7,10,-1,0,9,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { - 0x82,0x84,0x88,0x90,0xa0,0xe0,0x90,0x88,0x84,0x82, -}; - -static const BitmapCharRec ch75 = {7,10,-1,0,9,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { - 0x78,0x84,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x1e, -}; - -static const BitmapCharRec ch74 = {7,10,-1,0,9,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, -}; - -static const BitmapCharRec ch73 = {5,10,-2,0,9,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { - 0x82,0x82,0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch72 = {7,10,-1,0,9,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { - 0x7c,0x82,0x82,0x82,0x8e,0x80,0x80,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch71 = {7,10,-1,0,9,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { - 0x40,0x40,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0xfe, -}; - -static const BitmapCharRec ch70 = {7,10,-1,0,9,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { - 0xfe,0x40,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0xfe, -}; - -static const BitmapCharRec ch69 = {7,10,-1,0,9,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { - 0xfc,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch68 = {7,10,-1,0,9,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { - 0x7c,0x82,0x80,0x80,0x80,0x80,0x80,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch67 = {7,10,-1,0,9,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { - 0xfc,0x42,0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch66 = {7,10,-1,0,9,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { - 0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x44,0x28,0x10, -}; - -static const BitmapCharRec ch65 = {7,10,-1,0,9,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { - 0x7c,0x80,0x80,0x9a,0xa6,0xa2,0x9e,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch64 = {7,10,-1,0,9,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { - 0x10,0x0,0x10,0x10,0x8,0x4,0x2,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch63 = {7,10,-1,0,9,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { - 0x80,0x40,0x20,0x10,0x8,0x8,0x10,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch62 = {5,10,-2,0,9,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { - 0xfe,0x0,0x0,0xfe, -}; - -static const BitmapCharRec ch61 = {7,4,-1,-2,9,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { - 0x8,0x10,0x20,0x40,0x80,0x80,0x40,0x20,0x10,0x8, -}; - -static const BitmapCharRec ch60 = {5,10,-2,0,9,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { - 0x80,0x40,0x40,0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch59 = {2,10,-4,3,9,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { - 0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch58 = {2,7,-4,0,9,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { - 0x78,0x4,0x2,0x2,0x7a,0x86,0x82,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch57 = {7,10,-1,0,9,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { - 0x38,0x44,0x82,0x82,0x44,0x38,0x44,0x82,0x44,0x38, -}; - -static const BitmapCharRec ch56 = {7,10,-1,0,9,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { - 0x40,0x40,0x20,0x20,0x10,0x8,0x4,0x2,0x2,0xfe, -}; - -static const BitmapCharRec ch55 = {7,10,-1,0,9,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { - 0x7c,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x40,0x3c, -}; - -static const BitmapCharRec ch54 = {7,10,-1,0,9,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { - 0x7c,0x82,0x2,0x2,0x2,0xc2,0xbc,0x80,0x80,0xfe, -}; - -static const BitmapCharRec ch53 = {7,10,-1,0,9,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { - 0x4,0x4,0x4,0xfe,0x84,0x44,0x24,0x14,0xc,0x4, -}; - -static const BitmapCharRec ch52 = {7,10,-1,0,9,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { - 0x7c,0x82,0x2,0x2,0x2,0x1c,0x8,0x4,0x2,0xfe, -}; - -static const BitmapCharRec ch51 = {7,10,-1,0,9,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { - 0xfe,0x80,0x40,0x30,0x8,0x4,0x2,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch50 = {7,10,-1,0,9,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { - 0xfe,0x10,0x10,0x10,0x10,0x10,0x90,0x50,0x30,0x10, -}; - -static const BitmapCharRec ch49 = {7,10,-1,0,9,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { - 0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38, -}; - -static const BitmapCharRec ch48 = {7,10,-1,0,9,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { - 0x80,0x40,0x40,0x20,0x10,0x10,0x8,0x4,0x4,0x2, -}; - -static const BitmapCharRec ch47 = {7,10,-1,0,9,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { - 0xc0,0xc0, -}; - -static const BitmapCharRec ch46 = {2,2,-4,0,9,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { - 0xfe, -}; - -static const BitmapCharRec ch45 = {7,1,-1,-4,9,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { - 0x80,0x40,0x40,0xc0,0xc0, -}; - -static const BitmapCharRec ch44 = {2,5,-4,3,9,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { - 0x10,0x10,0x10,0xfe,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch43 = {7,7,-1,-1,9,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { - 0x10,0x92,0x54,0x38,0x54,0x92,0x10, -}; - -static const BitmapCharRec ch42 = {7,7,-1,-1,9,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { - 0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {3,12,-3,1,9,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { - 0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch40 = {3,12,-3,1,9,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { - 0x80,0x40,0x20,0x30, -}; - -static const BitmapCharRec ch39 = {4,4,-3,-6,9,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { - 0x62,0x94,0x88,0x94,0x62,0x60,0x90,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch38 = {7,10,-1,0,9,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { - 0x84,0x4a,0x4a,0x24,0x10,0x10,0x48,0xa4,0xa4,0x42, -}; - -static const BitmapCharRec ch37 = {7,10,-1,0,9,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { - 0x10,0x7c,0x92,0x12,0x12,0x14,0x38,0x50,0x90,0x92,0x7c,0x10, -}; - -static const BitmapCharRec ch36 = {7,12,-1,1,9,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { - 0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48, -}; - -static const BitmapCharRec ch35 = {6,8,-1,-1,9,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { - 0x90,0x90,0x90, -}; - -static const BitmapCharRec ch34 = {4,3,-3,-7,9,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { - 0x80,0x80,0x0,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch33 = {1,11,-4,0,9,ch33data}; - -/* char: 0x1f */ - -static const GLubyte ch31data[] = { - 0xc0,0xc0, -}; - -static const BitmapCharRec ch31 = {2,2,-4,-2,9,ch31data}; - -/* char: 0x1e */ - -static const GLubyte ch30data[] = { - 0x5c,0xa2,0x60,0x20,0x20,0xf8,0x20,0x20,0x22,0x1c, -}; - -static const BitmapCharRec ch30 = {7,10,-1,0,9,ch30data}; - -/* char: 0x1d */ - -static const GLubyte ch29data[] = { - 0x80,0x40,0xfe,0x10,0xfe,0x4,0x2, -}; - -static const BitmapCharRec ch29 = {7,7,-1,0,9,ch29data}; - -/* char: 0x1c */ - -static const GLubyte ch28data[] = { - 0x44,0x24,0x24,0x24,0x24,0x24,0xfe, -}; - -static const BitmapCharRec ch28 = {7,7,-1,0,9,ch28data}; - -/* char: 0x1b */ - -static const GLubyte ch27data[] = { - 0xfe,0x0,0x80,0x40,0x20,0x10,0x8,0x8,0x10,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch27 = {7,12,-1,2,9,ch27data}; - -/* char: 0x1a */ - -static const GLubyte ch26data[] = { - 0xfc,0x0,0x4,0x8,0x10,0x20,0x40,0x40,0x20,0x10,0x8,0x4, -}; - -static const BitmapCharRec ch26 = {6,12,-2,2,9,ch26data}; - -/* char: 0x19 */ - -static const GLubyte ch25data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch25 = {1,15,-4,3,9,ch25data}; - -/* char: 0x18 */ - -static const GLubyte ch24data[] = { - 0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0xff,0x80, -}; - -static const BitmapCharRec ch24 = {9,7,0,3,9,ch24data}; - -/* char: 0x17 */ - -static const GLubyte ch23data[] = { - 0xff,0x80,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0, - 0x8,0x0, -}; - -static const BitmapCharRec ch23 = {9,9,0,-3,9,ch23data}; - -/* char: 0x16 */ - -static const GLubyte ch22data[] = { - 0x8,0x8,0x8,0x8,0x8,0x8,0xf8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, -}; - -static const BitmapCharRec ch22 = {5,15,0,3,9,ch22data}; - -/* char: 0x15 */ - -static const GLubyte ch21data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch21 = {5,15,-4,3,9,ch21data}; - -/* char: 0x14 */ - -static const GLubyte ch20data[] = { - 0xff,0x80, -}; - -static const BitmapCharRec ch20 = {9,1,0,1,9,ch20data}; - -/* char: 0x13 */ - -static const GLubyte ch19data[] = { - 0xff,0x80, -}; - -static const BitmapCharRec ch19 = {9,1,0,-1,9,ch19data}; - -/* char: 0x12 */ - -static const GLubyte ch18data[] = { - 0xff,0x80, -}; - -static const BitmapCharRec ch18 = {9,1,0,-3,9,ch18data}; - -/* char: 0x11 */ - -static const GLubyte ch17data[] = { - 0xff,0x80, -}; - -static const BitmapCharRec ch17 = {9,1,0,-5,9,ch17data}; - -/* char: 0x10 */ - -static const GLubyte ch16data[] = { - 0xff,0x80, -}; - -static const BitmapCharRec ch16 = {9,1,0,-7,9,ch16data}; - -/* char: 0xf */ - -static const GLubyte ch15data[] = { - 0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0xff,0x80,0x8,0x0, - 0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0, -}; - -static const BitmapCharRec ch15 = {9,15,0,3,9,ch15data}; - -/* char: 0xe */ - -static const GLubyte ch14data[] = { - 0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch14 = {5,9,-4,-3,9,ch14data}; - -/* char: 0xd */ - -static const GLubyte ch13data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch13 = {5,7,-4,3,9,ch13data}; - -/* char: 0xc */ - -static const GLubyte ch12data[] = { - 0x8,0x8,0x8,0x8,0x8,0x8,0xf8, -}; - -static const BitmapCharRec ch12 = {5,7,0,3,9,ch12data}; - -/* char: 0xb */ - -static const GLubyte ch11data[] = { - 0xf8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, -}; - -static const BitmapCharRec ch11 = {5,9,0,-3,9,ch11data}; - -/* char: 0xa */ - -static const GLubyte ch10data[] = { - 0x8,0x8,0x8,0x8,0x3e,0x0,0x20,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch10 = {7,10,-1,2,9,ch10data}; - -/* char: 0x9 */ - -static const GLubyte ch9data[] = { - 0x3e,0x20,0x20,0x20,0x20,0x88,0x98,0xa8,0xc8,0x88, -}; - -static const BitmapCharRec ch9 = {7,10,-1,2,9,ch9data}; - -/* char: 0x8 */ - -static const GLubyte ch8data[] = { - 0xfe,0x10,0x10,0xfe,0x10,0x10, -}; - -static const BitmapCharRec ch8 = {7,6,-1,0,9,ch8data}; - -/* char: 0x7 */ - -static const GLubyte ch7data[] = { - 0x70,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch7 = {5,4,-2,-6,9,ch7data}; - -/* char: 0x6 */ - -static const GLubyte ch6data[] = { - 0x20,0x20,0x3c,0x20,0x3e,0x0,0xf8,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch6 = {7,10,-1,2,9,ch6data}; - -/* char: 0x5 */ - -static const GLubyte ch5data[] = { - 0x22,0x22,0x3c,0x22,0x3c,0x0,0x78,0x80,0x80,0x78, -}; - -static const BitmapCharRec ch5 = {7,10,-1,2,9,ch5data}; - -/* char: 0x4 */ - -static const GLubyte ch4data[] = { - 0x10,0x10,0x1c,0x10,0x1e,0x80,0x80,0xe0,0x80,0xf0, -}; - -static const BitmapCharRec ch4 = {7,10,-1,2,9,ch4data}; - -/* char: 0x3 */ - -static const GLubyte ch3data[] = { - 0x8,0x8,0x8,0x3e,0x0,0x88,0x88,0xf8,0x88,0x88, -}; - -static const BitmapCharRec ch3 = {7,10,-1,2,9,ch3data}; - -/* char: 0x2 */ - -static const GLubyte ch2data[] = { - 0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, -}; - -static const BitmapCharRec ch2 = {8,14,0,3,9,ch2data}; - -/* char: 0x1 */ - -static const GLubyte ch1data[] = { - 0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10, -}; - -static const BitmapCharRec ch1 = {7,7,-1,0,9,ch1data}; - -static const BitmapCharRec * const chars[] = { - &ch0, - &ch1, - &ch2, - &ch3, - &ch4, - &ch5, - &ch6, - &ch7, - &ch8, - &ch9, - &ch10, - &ch11, - &ch12, - &ch13, - &ch14, - &ch15, - &ch16, - &ch17, - &ch18, - &ch19, - &ch20, - &ch21, - &ch22, - &ch23, - &ch24, - &ch25, - &ch26, - &ch27, - &ch28, - &ch29, - &ch30, - &ch31, - &ch32, - &ch33, - &ch34, - &ch35, - &ch36, - &ch37, - &ch38, - &ch39, - &ch40, - &ch41, - &ch42, - &ch43, - &ch44, - &ch45, - &ch46, - &ch47, - &ch48, - &ch49, - &ch50, - &ch51, - &ch52, - &ch53, - &ch54, - &ch55, - &ch56, - &ch57, - &ch58, - &ch59, - &ch60, - &ch61, - &ch62, - &ch63, - &ch64, - &ch65, - &ch66, - &ch67, - &ch68, - &ch69, - &ch70, - &ch71, - &ch72, - &ch73, - &ch74, - &ch75, - &ch76, - &ch77, - &ch78, - &ch79, - &ch80, - &ch81, - &ch82, - &ch83, - &ch84, - &ch85, - &ch86, - &ch87, - &ch88, - &ch89, - &ch90, - &ch91, - &ch92, - &ch93, - &ch94, - &ch95, - &ch96, - &ch97, - &ch98, - &ch99, - &ch100, - &ch101, - &ch102, - &ch103, - &ch104, - &ch105, - &ch106, - &ch107, - &ch108, - &ch109, - &ch110, - &ch111, - &ch112, - &ch113, - &ch114, - &ch115, - &ch116, - &ch117, - &ch118, - &ch119, - &ch120, - &ch121, - &ch122, - &ch123, - &ch124, - &ch125, - &ch126, - &ch127, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &ch160, - &ch161, - &ch162, - &ch163, - &ch164, - &ch165, - &ch166, - &ch167, - &ch168, - &ch169, - &ch170, - &ch171, - &ch172, - &ch173, - &ch174, - &ch175, - &ch176, - &ch177, - &ch178, - &ch179, - &ch180, - &ch181, - &ch182, - &ch183, - &ch184, - &ch185, - &ch186, - &ch187, - &ch188, - &ch189, - &ch190, - &ch191, - &ch192, - &ch193, - &ch194, - &ch195, - &ch196, - &ch197, - &ch198, - &ch199, - &ch200, - &ch201, - &ch202, - &ch203, - &ch204, - &ch205, - &ch206, - &ch207, - &ch208, - &ch209, - &ch210, - &ch211, - &ch212, - &ch213, - &ch214, - &ch215, - &ch216, - &ch217, - &ch218, - &ch219, - &ch220, - &ch221, - &ch222, - &ch223, - &ch224, - &ch225, - &ch226, - &ch227, - &ch228, - &ch229, - &ch230, - &ch231, - &ch232, - &ch233, - &ch234, - &ch235, - &ch236, - &ch237, - &ch238, - &ch239, - &ch240, - &ch241, - &ch242, - &ch243, - &ch244, - &ch245, - &ch246, - &ch247, - &ch248, - &ch249, - &ch250, - &ch251, - &ch252, - &ch253, - &ch254, - &ch255, -}; - -const BitmapFontRec glutBitmap9By15 = { - "-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1", - 256, - 0, - chars -}; - -#endif - diff --git a/lib/SRC/Eden/gluttext/glut_bitmap.c b/lib/SRC/Eden/gluttext/glut_bitmap.c deleted file mode 100644 index 54b8a75..0000000 --- a/lib/SRC/Eden/gluttext/glut_bitmap.c +++ /dev/null @@ -1,65 +0,0 @@ -#include -#if GLUTTEXT_BITMAP_ENABLE - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -//#include "glutint.h" -#include "glutbitmap.h" - -void glutBitmapCharacter(GLUTbitmapFont font, int c) -{ - const BitmapCharRec *ch; - BitmapFontPtr fontinfo; -#if 0 - GLint swapbytes, lsbfirst, rowlength; - GLint skiprows, skippixels; -#endif - GLint alignment; - - fontinfo = (BitmapFontPtr) font; - - if (c < fontinfo->first || - c >= fontinfo->first + fontinfo->num_chars) - return; - ch = fontinfo->ch[c - fontinfo->first]; - if (ch) { - /* Save current modes. */ -#if 0 - glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes); - glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst); - glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength); - glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows); - glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels); -#endif - glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); - /* Little endian machines (DEC Alpha for example) could - benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE - instead of GL_FALSE, but this would require changing the - generated bitmaps too. */ -#if 0 - glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); - glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); -#endif - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBitmap(ch->width, ch->height, ch->xorig, ch->yorig, - ch->advance, 0, ch->bitmap); - /* Restore saved modes. */ -#if 0 - glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes); - glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst); - glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength); - glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels); -#endif - glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); - } -} - -#endif \ No newline at end of file diff --git a/lib/SRC/Eden/gluttext/glut_bwidth.c b/lib/SRC/Eden/gluttext/glut_bwidth.c deleted file mode 100644 index 20c5abf..0000000 --- a/lib/SRC/Eden/gluttext/glut_bwidth.c +++ /dev/null @@ -1,53 +0,0 @@ -#include -#if GLUTTEXT_BITMAP_ENABLE - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include "glutbitmap.h" - -/* CENTRY */ -int -glutBitmapWidth(GLUTbitmapFont font, int c) -{ - BitmapFontPtr fontinfo; - const BitmapCharRec *ch; - - fontinfo = (BitmapFontPtr) font; - - if (c < fontinfo->first || c >= fontinfo->first + fontinfo->num_chars) - return 0; - ch = fontinfo->ch[c - fontinfo->first]; - if (ch) - return ch->advance; - else - return 0; -} - -int -glutBitmapLength(GLUTbitmapFont font, const unsigned char *string) -{ - int c, length; - BitmapFontPtr fontinfo; - const BitmapCharRec *ch; - - fontinfo = (BitmapFontPtr) font; - - length = 0; - for (; *string != '\0'; string++) { - c = *string; - if (c >= fontinfo->first && c < fontinfo->first + fontinfo->num_chars) { - ch = fontinfo->ch[c - fontinfo->first]; - if (ch) - length += ch->advance; - } - } - return length; -} - -/* ENDCENTRY */ - -#endif \ No newline at end of file diff --git a/lib/SRC/Eden/gluttext/glut_hel10.c b/lib/SRC/Eden/gluttext/glut_hel10.c deleted file mode 100644 index 680440b..0000000 --- a/lib/SRC/Eden/gluttext/glut_hel10.c +++ /dev/null @@ -1,1765 +0,0 @@ -#include -#if GLUTTEXT_BITMAP_ENABLE - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmapHelvetica10 XXX -#include "glutbitmap.h" -#undef glutBitmapHelvetica10 - -/* char: 0xff */ - -static const GLubyte ch255data[] = { - 0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90,0x0,0x50, -}; - -static const BitmapCharRec ch255 = {4,10,0,2,5,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { - 0x80,0x80,0xb0,0xc8,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch254 = {5,10,0,2,6,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { - 0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch253 = {4,11,0,2,5,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { - 0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x50, -}; - -static const BitmapCharRec ch252 = {4,8,0,0,5,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { - 0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch251 = {4,9,0,0,5,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { - 0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch250 = {4,9,0,0,5,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { - 0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch249 = {4,9,0,0,5,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { - 0x70,0x88,0xc8,0xa8,0x98,0x74, -}; - -static const BitmapCharRec ch248 = {6,6,0,0,6,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { - 0x20,0x0,0xf8,0x0,0x20, -}; - -static const BitmapCharRec ch247 = {5,5,0,-1,6,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { - 0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50, -}; - -static const BitmapCharRec ch246 = {5,8,0,0,6,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { - 0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch245 = {5,9,0,0,6,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { - 0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch244 = {5,9,0,0,6,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { - 0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch243 = {5,9,0,0,6,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { - 0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch242 = {5,9,0,0,6,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { - 0x90,0x90,0x90,0x90,0x90,0xe0,0x0,0xa0,0x50, -}; - -static const BitmapCharRec ch241 = {4,9,0,0,5,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { - 0x70,0x88,0x88,0x88,0x88,0x78,0x90,0x60,0x50, -}; - -static const BitmapCharRec ch240 = {5,9,0,0,6,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, -}; - -static const BitmapCharRec ch239 = {3,8,0,0,2,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch238 = {3,9,1,0,2,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, -}; - -static const BitmapCharRec ch237 = {2,9,0,0,2,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch236 = {2,9,1,0,2,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { - 0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x50, -}; - -static const BitmapCharRec ch235 = {4,8,0,0,5,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { - 0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch234 = {4,9,0,0,5,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { - 0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch233 = {4,9,0,0,5,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { - 0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch232 = {4,9,0,0,5,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { - 0x60,0x20,0x60,0x90,0x80,0x80,0x90,0x60, -}; - -static const BitmapCharRec ch231 = {4,8,0,2,5,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { - 0x6c,0x92,0x90,0x7e,0x12,0xec, -}; - -static const BitmapCharRec ch230 = {7,6,0,0,8,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { - 0x68,0x90,0x90,0x70,0x10,0xe0,0x20,0x50,0x20, -}; - -static const BitmapCharRec ch229 = {5,9,0,0,5,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { - 0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x50, -}; - -static const BitmapCharRec ch228 = {5,8,0,0,5,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { - 0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0xa0,0x50, -}; - -static const BitmapCharRec ch227 = {5,9,0,0,5,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { - 0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch226 = {5,9,0,0,5,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { - 0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch225 = {5,9,0,0,5,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { - 0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch224 = {5,9,0,0,5,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { - 0xa0,0x90,0x90,0x90,0xa0,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch223 = {4,8,0,0,5,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { - 0x80,0x80,0xf0,0x88,0x88,0xf0,0x80,0x80, -}; - -static const BitmapCharRec ch222 = {5,8,-1,0,7,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { - 0x10,0x10,0x10,0x28,0x28,0x44,0x44,0x82,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch221 = {7,11,0,0,7,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48, -}; - -static const BitmapCharRec ch220 = {6,10,-1,0,8,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch219 = {6,11,-1,0,8,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch218 = {6,11,-1,0,8,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch217 = {6,11,-1,0,8,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { - 0x80,0x78,0xc4,0xa4,0xa4,0x94,0x94,0x8c,0x78,0x4, -}; - -static const BitmapCharRec ch216 = {6,10,-1,1,8,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { - 0x88,0x50,0x20,0x50,0x88, -}; - -static const BitmapCharRec ch215 = {5,5,0,-1,6,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x48, -}; - -static const BitmapCharRec ch214 = {6,10,-1,0,8,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch213 = {6,11,-1,0,8,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch212 = {6,11,-1,0,8,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch211 = {6,11,-1,0,8,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch210 = {6,11,-1,0,8,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { - 0x8c,0x8c,0x94,0x94,0xa4,0xa4,0xc4,0xc4,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch209 = {6,11,-1,0,8,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { - 0x78,0x44,0x42,0x42,0xf2,0x42,0x44,0x78, -}; - -static const BitmapCharRec ch208 = {7,8,0,0,8,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, -}; - -static const BitmapCharRec ch207 = {3,10,0,0,3,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch206 = {3,11,0,0,3,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, -}; - -static const BitmapCharRec ch205 = {2,11,-1,0,3,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch204 = {2,11,0,0,3,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { - 0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x50, -}; - -static const BitmapCharRec ch203 = {5,10,-1,0,7,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { - 0xf8,0x80,0x80,0xf8,0x80,0x80,0x80,0xf8,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch202 = {5,11,-1,0,7,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { - 0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch201 = {5,11,-1,0,7,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { - 0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch200 = {5,11,-1,0,7,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { - 0x30,0x10,0x78,0x84,0x80,0x80,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch199 = {6,10,-1,2,8,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { - 0x8f,0x80,0x88,0x0,0x78,0x0,0x48,0x0,0x2f,0x80,0x28,0x0,0x18,0x0,0x1f,0x80, -}; - -static const BitmapCharRec ch198 = {9,8,0,0,10,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { - 0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x10,0x28,0x10, -}; - -static const BitmapCharRec ch197 = {7,11,0,0,7,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { - 0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28, -}; - -static const BitmapCharRec ch196 = {7,10,0,0,7,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { - 0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch195 = {7,11,0,0,7,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { - 0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch194 = {7,11,0,0,7,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { - 0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch193 = {7,11,0,0,7,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { - 0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch192 = {7,11,0,0,7,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { - 0x60,0x90,0x80,0x40,0x20,0x20,0x0,0x20, -}; - -static const BitmapCharRec ch191 = {4,8,-1,2,6,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { - 0x21,0x0,0x17,0x80,0x13,0x0,0x9,0x0,0xc8,0x0,0x24,0x0,0x44,0x0,0xe2,0x0, -}; - -static const BitmapCharRec ch190 = {9,8,0,0,9,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { - 0x27,0x12,0x15,0xb,0x48,0x44,0xc4,0x42, -}; - -static const BitmapCharRec ch189 = {8,8,0,0,9,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { - 0x21,0x0,0x17,0x80,0x13,0x0,0x9,0x0,0x48,0x0,0x44,0x0,0xc4,0x0,0x42,0x0, -}; - -static const BitmapCharRec ch188 = {9,8,0,0,9,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { - 0xa0,0x50,0x28,0x50,0xa0, -}; - -static const BitmapCharRec ch187 = {5,5,0,0,6,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { - 0xe0,0x0,0xe0,0xa0,0xe0, -}; - -static const BitmapCharRec ch186 = {3,5,0,-3,4,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { - 0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch185 = {2,4,0,-3,3,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { - 0xc0,0x40, -}; - -static const BitmapCharRec ch184 = {2,2,0,2,3,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { - 0xc0, -}; - -static const BitmapCharRec ch183 = {2,1,0,-3,3,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { - 0x28,0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, -}; - -static const BitmapCharRec ch182 = {6,10,0,2,6,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { - 0x80,0x80,0xf0,0x90,0x90,0x90,0x90,0x90, -}; - -static const BitmapCharRec ch181 = {4,8,0,2,5,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { - 0x80,0x40, -}; - -static const BitmapCharRec ch180 = {2,2,0,-6,3,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { - 0xc0,0x20,0x40,0xe0, -}; - -static const BitmapCharRec ch179 = {3,4,0,-3,3,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { - 0xe0,0x40,0xa0,0x60, -}; - -static const BitmapCharRec ch178 = {3,4,0,-3,3,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { - 0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch177 = {5,7,0,0,6,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { - 0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch176 = {4,4,0,-3,4,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { - 0xe0, -}; - -static const BitmapCharRec ch175 = {3,1,0,-7,3,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { - 0x38,0x44,0xaa,0xb2,0xba,0x44,0x38, -}; - -static const BitmapCharRec ch174 = {7,7,-1,0,9,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { - 0xe0, -}; - -static const BitmapCharRec ch173 = {3,1,0,-3,4,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { - 0x8,0x8,0xf8, -}; - -static const BitmapCharRec ch172 = {5,3,-1,-2,7,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { - 0x28,0x50,0xa0,0x50,0x28, -}; - -static const BitmapCharRec ch171 = {5,5,0,0,6,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { - 0xe0,0x0,0xa0,0x20,0xe0, -}; - -static const BitmapCharRec ch170 = {3,5,0,-3,4,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { - 0x38,0x44,0x9a,0xa2,0x9a,0x44,0x38, -}; - -static const BitmapCharRec ch169 = {7,7,-1,0,9,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { - 0xa0, -}; - -static const BitmapCharRec ch168 = {3,1,0,-7,3,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { - 0x70,0x88,0x18,0x70,0xc8,0x98,0x70,0xc0,0x88,0x70, -}; - -static const BitmapCharRec ch167 = {5,10,0,2,6,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { - 0x80,0x80,0x80,0x80,0x0,0x0,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch166 = {1,10,-1,2,3,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { - 0x20,0xf8,0x20,0xf8,0x50,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch165 = {5,8,0,0,6,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { - 0x90,0x60,0x90,0x90,0x60,0x90, -}; - -static const BitmapCharRec ch164 = {4,6,0,-1,5,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { - 0xb0,0x48,0x40,0x40,0xe0,0x40,0x48,0x30, -}; - -static const BitmapCharRec ch163 = {5,8,0,0,6,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { - 0x40,0x70,0xa8,0xa0,0xa0,0xa8,0x70,0x10, -}; - -static const BitmapCharRec ch162 = {5,8,0,1,6,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch161 = {1,8,-1,2,3,ch161data}; - -/* char: 0xa0 */ - -static const BitmapCharRec ch160 = {0,0,0,0,3,0}; - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { - 0x98,0x64, -}; - -static const BitmapCharRec ch126 = {6,2,0,-3,7,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { - 0x80,0x40,0x40,0x40,0x40,0x20,0x40,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch125 = {3,10,0,2,3,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch124 = {1,10,-1,2,3,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { - 0x20,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch123 = {3,10,0,2,3,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { - 0xf0,0x80,0x40,0x20,0x10,0xf0, -}; - -static const BitmapCharRec ch122 = {4,6,0,0,5,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { - 0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90, -}; - -static const BitmapCharRec ch121 = {4,8,0,2,5,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { - 0x88,0x88,0x50,0x20,0x50,0x88, -}; - -static const BitmapCharRec ch120 = {5,6,0,0,6,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { - 0x28,0x28,0x54,0x54,0x92,0x92, -}; - -static const BitmapCharRec ch119 = {7,6,0,0,8,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { - 0x20,0x20,0x50,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch118 = {5,6,0,0,6,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { - 0x70,0x90,0x90,0x90,0x90,0x90, -}; - -static const BitmapCharRec ch117 = {4,6,0,0,5,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { - 0x60,0x40,0x40,0x40,0x40,0xe0,0x40,0x40, -}; - -static const BitmapCharRec ch116 = {3,8,0,0,4,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { - 0x60,0x90,0x10,0x60,0x90,0x60, -}; - -static const BitmapCharRec ch115 = {4,6,0,0,5,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { - 0x80,0x80,0x80,0x80,0xc0,0xa0, -}; - -static const BitmapCharRec ch114 = {3,6,0,0,4,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { - 0x8,0x8,0x68,0x98,0x88,0x88,0x98,0x68, -}; - -static const BitmapCharRec ch113 = {5,8,0,2,6,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { - 0x80,0x80,0xb0,0xc8,0x88,0x88,0xc8,0xb0, -}; - -static const BitmapCharRec ch112 = {5,8,0,2,6,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { - 0x70,0x88,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch111 = {5,6,0,0,6,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { - 0x88,0x88,0x88,0x88,0xc8,0xb0, -}; - -static const BitmapCharRec ch110 = {5,6,0,0,6,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { - 0x92,0x92,0x92,0x92,0x92,0xec, -}; - -static const BitmapCharRec ch109 = {7,6,0,0,8,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch108 = {1,8,0,0,2,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { - 0x90,0x90,0xa0,0xc0,0xa0,0x90,0x80,0x80, -}; - -static const BitmapCharRec ch107 = {4,8,0,0,5,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch106 = {1,9,0,1,2,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch105 = {1,8,0,0,2,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { - 0x88,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch104 = {5,8,0,0,6,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { - 0x70,0x8,0x68,0x98,0x88,0x88,0x98,0x68, -}; - -static const BitmapCharRec ch103 = {5,8,0,2,6,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { - 0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x30, -}; - -static const BitmapCharRec ch102 = {4,8,0,0,4,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { - 0x60,0x90,0x80,0xf0,0x90,0x60, -}; - -static const BitmapCharRec ch101 = {4,6,0,0,5,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { - 0x68,0x98,0x88,0x88,0x98,0x68,0x8,0x8, -}; - -static const BitmapCharRec ch100 = {5,8,0,0,6,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { - 0x60,0x90,0x80,0x80,0x90,0x60, -}; - -static const BitmapCharRec ch99 = {4,6,0,0,5,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { - 0xb0,0xc8,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch98 = {5,8,0,0,6,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { - 0x68,0x90,0x90,0x70,0x10,0xe0, -}; - -static const BitmapCharRec ch97 = {5,6,0,0,5,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { - 0x80,0x80,0x40, -}; - -static const BitmapCharRec ch96 = {2,3,0,-5,3,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { - 0xfc, -}; - -static const BitmapCharRec ch95 = {6,1,0,2,6,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { - 0x88,0x50,0x50,0x20,0x20, -}; - -static const BitmapCharRec ch94 = {5,5,0,-3,6,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { - 0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, -}; - -static const BitmapCharRec ch93 = {2,10,0,2,3,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { - 0x20,0x20,0x40,0x40,0x40,0x40,0x80,0x80, -}; - -static const BitmapCharRec ch92 = {3,8,0,0,3,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { - 0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, -}; - -static const BitmapCharRec ch91 = {2,10,-1,2,3,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { - 0xf8,0x80,0x40,0x20,0x20,0x10,0x8,0xf8, -}; - -static const BitmapCharRec ch90 = {5,8,-1,0,7,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { - 0x10,0x10,0x10,0x28,0x28,0x44,0x44,0x82, -}; - -static const BitmapCharRec ch89 = {7,8,0,0,7,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { - 0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch88 = {5,8,-1,0,7,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { - 0x22,0x0,0x22,0x0,0x22,0x0,0x55,0x0,0x49,0x0,0x49,0x0,0x88,0x80,0x88,0x80, -}; - -static const BitmapCharRec ch87 = {9,8,0,0,9,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { - 0x10,0x28,0x28,0x44,0x44,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch86 = {7,8,0,0,7,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch85 = {6,8,-1,0,8,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, -}; - -static const BitmapCharRec ch84 = {5,8,0,0,5,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { - 0x70,0x88,0x88,0x8,0x70,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch83 = {5,8,-1,0,7,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { - 0x88,0x88,0x88,0x88,0xf0,0x88,0x88,0xf0, -}; - -static const BitmapCharRec ch82 = {5,8,-1,0,7,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { - 0x2,0x7c,0x8c,0x94,0x84,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch81 = {7,9,-1,1,8,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { - 0x80,0x80,0x80,0x80,0xf0,0x88,0x88,0xf0, -}; - -static const BitmapCharRec ch80 = {5,8,-1,0,7,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch79 = {6,8,-1,0,8,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { - 0x8c,0x8c,0x94,0x94,0xa4,0xa4,0xc4,0xc4, -}; - -static const BitmapCharRec ch78 = {6,8,-1,0,8,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { - 0x92,0x92,0x92,0xaa,0xaa,0xc6,0xc6,0x82, -}; - -static const BitmapCharRec ch77 = {7,8,-1,0,9,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { - 0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch76 = {4,8,-1,0,6,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { - 0x88,0x88,0x90,0x90,0xe0,0xa0,0x90,0x88, -}; - -static const BitmapCharRec ch75 = {5,8,-1,0,7,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { - 0x60,0x90,0x10,0x10,0x10,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch74 = {4,8,0,0,5,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch73 = {1,8,-1,0,3,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { - 0x84,0x84,0x84,0x84,0xfc,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch72 = {6,8,-1,0,8,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { - 0x74,0x8c,0x84,0x8c,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch71 = {6,8,-1,0,8,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { - 0x80,0x80,0x80,0x80,0xf0,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch70 = {5,8,-1,0,6,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { - 0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch69 = {5,8,-1,0,7,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { - 0xf0,0x88,0x84,0x84,0x84,0x84,0x88,0xf0, -}; - -static const BitmapCharRec ch68 = {6,8,-1,0,8,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { - 0x78,0x84,0x80,0x80,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch67 = {6,8,-1,0,8,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { - 0xf0,0x88,0x88,0x88,0xf0,0x88,0x88,0xf0, -}; - -static const BitmapCharRec ch66 = {5,8,-1,0,7,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { - 0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10, -}; - -static const BitmapCharRec ch65 = {7,8,0,0,7,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { - 0x3e,0x0,0x40,0x0,0x9b,0x0,0xa4,0x80,0xa4,0x80,0xa2,0x40,0x92,0x40,0x4d,0x40, - 0x20,0x80,0x1f,0x0, -}; - -static const BitmapCharRec ch64 = {10,10,0,2,11,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { - 0x40,0x0,0x40,0x40,0x20,0x10,0x90,0x60, -}; - -static const BitmapCharRec ch63 = {4,8,-1,0,6,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { - 0x80,0x40,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch62 = {3,5,-1,-1,6,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { - 0xf0,0x0,0xf0, -}; - -static const BitmapCharRec ch61 = {4,3,0,-2,5,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { - 0x20,0x40,0x80,0x40,0x20, -}; - -static const BitmapCharRec ch60 = {3,5,-1,-1,6,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { - 0x80,0x40,0x40,0x0,0x0,0x0,0x0,0x40, -}; - -static const BitmapCharRec ch59 = {2,8,0,2,3,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { - 0x80,0x0,0x0,0x0,0x0,0x80, -}; - -static const BitmapCharRec ch58 = {1,6,-1,0,3,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { - 0x70,0x88,0x8,0x68,0x98,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch57 = {5,8,0,0,6,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { - 0x70,0x88,0x88,0x88,0x70,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch56 = {5,8,0,0,6,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { - 0x40,0x40,0x20,0x20,0x10,0x10,0x8,0xf8, -}; - -static const BitmapCharRec ch55 = {5,8,0,0,6,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { - 0x70,0x88,0x88,0xc8,0xb0,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch54 = {5,8,0,0,6,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { - 0x70,0x88,0x8,0x8,0xf0,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch53 = {5,8,0,0,6,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { - 0x10,0x10,0xf8,0x90,0x50,0x50,0x30,0x10, -}; - -static const BitmapCharRec ch52 = {5,8,0,0,6,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { - 0x70,0x88,0x8,0x8,0x30,0x8,0x88,0x70, -}; - -static const BitmapCharRec ch51 = {5,8,0,0,6,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { - 0xf8,0x80,0x40,0x30,0x8,0x8,0x88,0x70, -}; - -static const BitmapCharRec ch50 = {5,8,0,0,6,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch49 = {2,8,-1,0,6,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { - 0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch48 = {5,8,0,0,6,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { - 0x80,0x80,0x40,0x40,0x40,0x40,0x20,0x20, -}; - -static const BitmapCharRec ch47 = {3,8,0,0,3,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { - 0x80, -}; - -static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { - 0xf8, -}; - -static const BitmapCharRec ch45 = {5,1,-1,-3,7,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { - 0x80,0x40,0x40, -}; - -static const BitmapCharRec ch44 = {2,3,0,2,3,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { - 0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch43 = {5,5,0,-1,6,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { - 0xa0,0x40,0xa0, -}; - -static const BitmapCharRec ch42 = {3,3,0,-5,4,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { - 0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {3,10,-1,2,4,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { - 0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch40 = {3,10,0,2,4,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { - 0x80,0x40,0x40, -}; - -static const BitmapCharRec ch39 = {2,3,-1,-5,3,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { - 0x64,0x98,0x98,0xa4,0x60,0x50,0x50,0x20, -}; - -static const BitmapCharRec ch38 = {6,8,-1,0,8,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { - 0x26,0x29,0x16,0x10,0x8,0x68,0x94,0x64, -}; - -static const BitmapCharRec ch37 = {8,8,0,0,9,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { - 0x20,0x70,0xa8,0x28,0x70,0xa0,0xa8,0x70,0x20, -}; - -static const BitmapCharRec ch36 = {5,9,0,1,6,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { - 0x50,0x50,0xf8,0x28,0x7c,0x28,0x28, -}; - -static const BitmapCharRec ch35 = {6,7,0,0,6,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { - 0xa0,0xa0, -}; - -static const BitmapCharRec ch34 = {3,2,-1,-6,4,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { - 0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch33 = {1,8,-1,0,3,ch33data}; - -/* char: 0x20 ' ' */ - -static const BitmapCharRec ch32 = {0,0,0,0,3,0}; - -static const BitmapCharRec * const chars[] = { - &ch32, - &ch33, - &ch34, - &ch35, - &ch36, - &ch37, - &ch38, - &ch39, - &ch40, - &ch41, - &ch42, - &ch43, - &ch44, - &ch45, - &ch46, - &ch47, - &ch48, - &ch49, - &ch50, - &ch51, - &ch52, - &ch53, - &ch54, - &ch55, - &ch56, - &ch57, - &ch58, - &ch59, - &ch60, - &ch61, - &ch62, - &ch63, - &ch64, - &ch65, - &ch66, - &ch67, - &ch68, - &ch69, - &ch70, - &ch71, - &ch72, - &ch73, - &ch74, - &ch75, - &ch76, - &ch77, - &ch78, - &ch79, - &ch80, - &ch81, - &ch82, - &ch83, - &ch84, - &ch85, - &ch86, - &ch87, - &ch88, - &ch89, - &ch90, - &ch91, - &ch92, - &ch93, - &ch94, - &ch95, - &ch96, - &ch97, - &ch98, - &ch99, - &ch100, - &ch101, - &ch102, - &ch103, - &ch104, - &ch105, - &ch106, - &ch107, - &ch108, - &ch109, - &ch110, - &ch111, - &ch112, - &ch113, - &ch114, - &ch115, - &ch116, - &ch117, - &ch118, - &ch119, - &ch120, - &ch121, - &ch122, - &ch123, - &ch124, - &ch125, - &ch126, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &ch160, - &ch161, - &ch162, - &ch163, - &ch164, - &ch165, - &ch166, - &ch167, - &ch168, - &ch169, - &ch170, - &ch171, - &ch172, - &ch173, - &ch174, - &ch175, - &ch176, - &ch177, - &ch178, - &ch179, - &ch180, - &ch181, - &ch182, - &ch183, - &ch184, - &ch185, - &ch186, - &ch187, - &ch188, - &ch189, - &ch190, - &ch191, - &ch192, - &ch193, - &ch194, - &ch195, - &ch196, - &ch197, - &ch198, - &ch199, - &ch200, - &ch201, - &ch202, - &ch203, - &ch204, - &ch205, - &ch206, - &ch207, - &ch208, - &ch209, - &ch210, - &ch211, - &ch212, - &ch213, - &ch214, - &ch215, - &ch216, - &ch217, - &ch218, - &ch219, - &ch220, - &ch221, - &ch222, - &ch223, - &ch224, - &ch225, - &ch226, - &ch227, - &ch228, - &ch229, - &ch230, - &ch231, - &ch232, - &ch233, - &ch234, - &ch235, - &ch236, - &ch237, - &ch238, - &ch239, - &ch240, - &ch241, - &ch242, - &ch243, - &ch244, - &ch245, - &ch246, - &ch247, - &ch248, - &ch249, - &ch250, - &ch251, - &ch252, - &ch253, - &ch254, - &ch255, -}; - -const BitmapFontRec glutBitmapHelvetica10 = { - "-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1", - 224, - 32, - chars -}; - -#endif diff --git a/lib/SRC/Eden/gluttext/glut_hel12.c b/lib/SRC/Eden/gluttext/glut_hel12.c deleted file mode 100644 index d4c7283..0000000 --- a/lib/SRC/Eden/gluttext/glut_hel12.c +++ /dev/null @@ -1,1775 +0,0 @@ -#include -#if GLUTTEXT_BITMAP_ENABLE - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmapHelvetica12 XXX -#include "glutbitmap.h" -#undef glutBitmapHelvetica12 - -/* char: 0xff */ - -static const GLubyte ch255data[] = { - 0xc0,0x20,0x20,0x20,0x30,0x50,0x50,0x48,0x88,0x88,0x0,0x50, -}; - -static const BitmapCharRec ch255 = {5,12,-1,3,7,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { - 0x80,0x80,0x80,0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch254 = {5,12,-1,3,7,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { - 0x80,0x40,0x20,0x20,0x50,0x50,0x90,0x88,0x88,0x88,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch253 = {5,13,-1,3,7,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { - 0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x50, -}; - -static const BitmapCharRec ch252 = {5,9,-1,0,7,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { - 0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch251 = {5,10,-1,0,7,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { - 0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch250 = {5,10,-1,0,7,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { - 0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch249 = {5,10,-1,0,7,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { - 0xb8,0x44,0x64,0x54,0x4c,0x44,0x3a, -}; - -static const BitmapCharRec ch248 = {7,7,0,0,7,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { - 0x20,0x0,0xf8,0x0,0x20, -}; - -static const BitmapCharRec ch247 = {5,5,-1,-1,7,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { - 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50, -}; - -static const BitmapCharRec ch246 = {5,9,-1,0,7,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { - 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch245 = {5,10,-1,0,7,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { - 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch244 = {5,10,-1,0,7,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { - 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch243 = {5,10,-1,0,7,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { - 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch242 = {5,10,-1,0,7,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { - 0x88,0x88,0x88,0x88,0x88,0xc8,0xb0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch241 = {5,10,-1,0,7,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { - 0x70,0x88,0x88,0x88,0x88,0x78,0x8,0x50,0x30,0x68, -}; - -static const BitmapCharRec ch240 = {5,10,-1,0,7,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, -}; - -static const BitmapCharRec ch239 = {3,9,0,0,3,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch238 = {3,10,0,0,3,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, -}; - -static const BitmapCharRec ch237 = {2,10,-1,0,3,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch236 = {2,10,0,0,3,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { - 0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x50, -}; - -static const BitmapCharRec ch235 = {5,9,-1,0,7,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { - 0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch234 = {5,10,-1,0,7,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { - 0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch233 = {5,10,-1,0,7,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { - 0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch232 = {5,10,-1,0,7,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { - 0x60,0x10,0x20,0x70,0x88,0x80,0x80,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch231 = {5,10,-1,3,7,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { - 0x77,0x0,0x88,0x80,0x88,0x0,0x7f,0x80,0x8,0x80,0x88,0x80,0x77,0x0, -}; - -static const BitmapCharRec ch230 = {9,7,-1,0,11,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { - 0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x30,0x48,0x30, -}; - -static const BitmapCharRec ch229 = {6,10,-1,0,7,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { - 0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50, -}; - -static const BitmapCharRec ch228 = {6,9,-1,0,7,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { - 0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch227 = {6,10,-1,0,7,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { - 0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch226 = {6,10,-1,0,7,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { - 0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch225 = {6,10,-1,0,7,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { - 0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch224 = {6,10,-1,0,7,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { - 0xb0,0x88,0x88,0x88,0xb0,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch223 = {5,9,-1,0,7,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { - 0x80,0x80,0xf8,0x84,0x84,0x84,0xf8,0x80,0x80, -}; - -static const BitmapCharRec ch222 = {6,9,-1,0,8,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { - 0x10,0x10,0x10,0x10,0x28,0x44,0x44,0x82,0x82,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch221 = {7,12,-1,0,9,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48, -}; - -static const BitmapCharRec ch220 = {6,11,-1,0,8,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch219 = {6,12,-1,0,8,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch218 = {6,12,-1,0,8,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch217 = {6,12,-1,0,8,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { - 0x80,0x0,0x5e,0x0,0x21,0x0,0x50,0x80,0x48,0x80,0x44,0x80,0x44,0x80,0x42,0x80, - 0x21,0x0,0x1e,0x80,0x0,0x40, -}; - -static const BitmapCharRec ch216 = {10,11,0,1,10,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { - 0x88,0x50,0x20,0x50,0x88, -}; - -static const BitmapCharRec ch215 = {5,5,-1,-1,7,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { - 0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x24, -}; - -static const BitmapCharRec ch214 = {8,11,-1,0,10,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { - 0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch213 = {8,12,-1,0,10,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { - 0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x14,0x8, -}; - -static const BitmapCharRec ch212 = {8,12,-1,0,10,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { - 0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x8,0x4, -}; - -static const BitmapCharRec ch211 = {8,12,-1,0,10,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { - 0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x8,0x10, -}; - -static const BitmapCharRec ch210 = {8,12,-1,0,10,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { - 0x82,0x86,0x8a,0x8a,0x92,0xa2,0xa2,0xc2,0x82,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch209 = {7,12,-1,0,9,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { - 0x7c,0x42,0x41,0x41,0xf1,0x41,0x41,0x42,0x7c, -}; - -static const BitmapCharRec ch208 = {8,9,0,0,9,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, -}; - -static const BitmapCharRec ch207 = {3,11,0,0,3,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch206 = {3,12,0,0,3,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, -}; - -static const BitmapCharRec ch205 = {2,12,-1,0,3,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch204 = {2,12,0,0,3,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { - 0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x28, -}; - -static const BitmapCharRec ch203 = {6,11,-1,0,8,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { - 0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch202 = {6,12,-1,0,8,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { - 0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch201 = {6,12,-1,0,8,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { - 0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch200 = {6,12,-1,0,8,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { - 0x30,0x8,0x8,0x3c,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x3c, -}; - -static const BitmapCharRec ch199 = {7,12,-1,3,9,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { - 0x8f,0x80,0x88,0x0,0x88,0x0,0x78,0x0,0x4f,0x80,0x48,0x0,0x28,0x0,0x28,0x0, - 0x1f,0x80, -}; - -static const BitmapCharRec ch198 = {9,9,-1,0,11,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { - 0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x10,0x28,0x10, -}; - -static const BitmapCharRec ch197 = {7,12,-1,0,9,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { - 0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28, -}; - -static const BitmapCharRec ch196 = {7,11,-1,0,9,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { - 0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch195 = {7,12,-1,0,9,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { - 0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch194 = {7,12,-1,0,9,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { - 0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch193 = {7,12,-1,0,9,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { - 0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch192 = {7,12,-1,0,9,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { - 0x70,0x88,0x88,0x40,0x40,0x20,0x20,0x0,0x20, -}; - -static const BitmapCharRec ch191 = {5,9,-1,3,7,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { - 0x21,0x0,0x17,0x80,0x15,0x0,0xb,0x0,0xc9,0x0,0x24,0x0,0x44,0x0,0x22,0x0, - 0xe1,0x0, -}; - -static const BitmapCharRec ch190 = {9,9,0,0,10,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { - 0x47,0x80,0x22,0x0,0x11,0x0,0x14,0x80,0x4b,0x0,0x48,0x0,0x44,0x0,0xc2,0x0, - 0x41,0x0, -}; - -static const BitmapCharRec ch189 = {9,9,0,0,10,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { - 0x41,0x0,0x27,0x80,0x15,0x0,0x13,0x0,0x49,0x0,0x44,0x0,0x44,0x0,0xc2,0x0, - 0x41,0x0, -}; - -static const BitmapCharRec ch188 = {9,9,0,0,10,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { - 0xa0,0x50,0x28,0x50,0xa0, -}; - -static const BitmapCharRec ch187 = {5,5,-1,-1,7,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { - 0xe0,0x0,0xe0,0xa0,0xe0, -}; - -static const BitmapCharRec ch186 = {3,5,-1,-4,5,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { - 0x40,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch185 = {2,5,-1,-3,4,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { - 0xc0,0x20,0x20,0x40, -}; - -static const BitmapCharRec ch184 = {3,4,0,3,3,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { - 0x80, -}; - -static const BitmapCharRec ch183 = {1,1,-1,-3,3,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { - 0x28,0x28,0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x68,0x3c, -}; - -static const BitmapCharRec ch182 = {6,12,0,3,7,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { - 0x80,0x80,0x80,0xe8,0x98,0x88,0x88,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch181 = {5,10,-1,3,7,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { - 0x80,0x40, -}; - -static const BitmapCharRec ch180 = {2,2,0,-8,2,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { - 0xc0,0x20,0x40,0x20,0xe0, -}; - -static const BitmapCharRec ch179 = {3,5,0,-3,4,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { - 0xf0,0x40,0x20,0x90,0x60, -}; - -static const BitmapCharRec ch178 = {4,5,0,-3,4,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { - 0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch177 = {5,7,-1,0,7,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { - 0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch176 = {4,4,0,-4,5,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { - 0xf0, -}; - -static const BitmapCharRec ch175 = {4,1,0,-8,4,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { - 0x3e,0x0,0x41,0x0,0x94,0x80,0x94,0x80,0x98,0x80,0x94,0x80,0x9c,0x80,0x41,0x0, - 0x3e,0x0, -}; - -static const BitmapCharRec ch174 = {9,9,-1,0,11,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { - 0xf0, -}; - -static const BitmapCharRec ch173 = {4,1,0,-3,5,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { - 0x4,0x4,0x4,0xfc, -}; - -static const BitmapCharRec ch172 = {6,4,-1,-2,8,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { - 0x28,0x50,0xa0,0x50,0x28, -}; - -static const BitmapCharRec ch171 = {5,5,-1,-1,7,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { - 0xe0,0x0,0xa0,0x20,0xe0, -}; - -static const BitmapCharRec ch170 = {3,5,-1,-4,5,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { - 0x3e,0x0,0x41,0x0,0x9c,0x80,0xa2,0x80,0xa0,0x80,0xa2,0x80,0x9c,0x80,0x41,0x0, - 0x3e,0x0, -}; - -static const BitmapCharRec ch169 = {9,9,-1,0,11,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { - 0xa0, -}; - -static const BitmapCharRec ch168 = {3,1,0,-8,3,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { - 0x70,0x88,0x8,0x30,0x48,0x88,0x88,0x90,0x60,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch167 = {5,12,0,3,6,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { - 0x80,0x80,0x80,0x80,0x0,0x0,0x0,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch166 = {1,11,-1,2,3,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { - 0x20,0x20,0xf8,0x20,0xf8,0x20,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch165 = {5,9,-1,0,7,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { - 0x84,0x78,0x48,0x48,0x78,0x84, -}; - -static const BitmapCharRec ch164 = {6,6,0,-1,7,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { - 0xb0,0x48,0x20,0x20,0xf0,0x40,0x40,0x48,0x30, -}; - -static const BitmapCharRec ch163 = {5,9,-1,0,7,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { - 0x40,0x70,0xc8,0xa0,0xa0,0xa0,0xa8,0x70,0x10, -}; - -static const BitmapCharRec ch162 = {5,9,-1,1,7,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch161 = {1,10,-1,3,3,ch161data}; - -/* char: 0xa0 */ - -static const BitmapCharRec ch160 = {0,0,0,0,4,0}; - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { - 0x98,0x64, -}; - -static const BitmapCharRec ch126 = {6,2,0,-3,7,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { - 0xc0,0x20,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xc0, -}; - -static const BitmapCharRec ch125 = {4,12,0,3,4,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch124 = {1,12,-1,3,3,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { - 0x30,0x40,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, -}; - -static const BitmapCharRec ch123 = {4,12,0,3,4,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { - 0xf0,0x80,0x40,0x40,0x20,0x10,0xf0, -}; - -static const BitmapCharRec ch122 = {4,7,-1,0,6,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { - 0x80,0x40,0x20,0x20,0x50,0x50,0x90,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch121 = {5,10,-1,3,7,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { - 0x84,0x84,0x48,0x30,0x30,0x48,0x84, -}; - -static const BitmapCharRec ch120 = {6,7,0,0,6,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { - 0x22,0x0,0x22,0x0,0x55,0x0,0x49,0x0,0x49,0x0,0x88,0x80,0x88,0x80, -}; - -static const BitmapCharRec ch119 = {9,7,0,0,9,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { - 0x20,0x20,0x50,0x50,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch118 = {5,7,-1,0,7,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { - 0x68,0x98,0x88,0x88,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch117 = {5,7,-1,0,7,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { - 0x60,0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x40, -}; - -static const BitmapCharRec ch116 = {3,9,0,0,3,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { - 0x60,0x90,0x10,0x60,0x80,0x90,0x60, -}; - -static const BitmapCharRec ch115 = {4,7,-1,0,6,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { - 0x80,0x80,0x80,0x80,0x80,0xc0,0xa0, -}; - -static const BitmapCharRec ch114 = {3,7,-1,0,4,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { - 0x8,0x8,0x8,0x68,0x98,0x88,0x88,0x88,0x98,0x68, -}; - -static const BitmapCharRec ch113 = {5,10,-1,3,7,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { - 0x80,0x80,0x80,0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0, -}; - -static const BitmapCharRec ch112 = {5,10,-1,3,7,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { - 0x70,0x88,0x88,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch111 = {5,7,-1,0,7,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { - 0x88,0x88,0x88,0x88,0x88,0xc8,0xb0, -}; - -static const BitmapCharRec ch110 = {5,7,-1,0,7,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { - 0x92,0x92,0x92,0x92,0x92,0xda,0xa4, -}; - -static const BitmapCharRec ch109 = {7,7,-1,0,9,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch108 = {1,9,-1,0,3,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { - 0x88,0x90,0xa0,0xc0,0xc0,0xa0,0x90,0x80,0x80, -}; - -static const BitmapCharRec ch107 = {5,9,-1,0,6,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { - 0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40, -}; - -static const BitmapCharRec ch106 = {2,12,0,3,3,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch105 = {1,9,-1,0,3,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { - 0x88,0x88,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch104 = {5,9,-1,0,7,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { - 0x70,0x88,0x8,0x68,0x98,0x88,0x88,0x88,0x98,0x68, -}; - -static const BitmapCharRec ch103 = {5,10,-1,3,7,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { - 0x40,0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x30, -}; - -static const BitmapCharRec ch102 = {4,9,0,0,3,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { - 0x70,0x88,0x80,0xf8,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch101 = {5,7,-1,0,7,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { - 0x68,0x98,0x88,0x88,0x88,0x98,0x68,0x8,0x8, -}; - -static const BitmapCharRec ch100 = {5,9,-1,0,7,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { - 0x70,0x88,0x80,0x80,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch99 = {5,7,-1,0,7,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { - 0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch98 = {5,9,-1,0,7,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { - 0x74,0x88,0x88,0x78,0x8,0x88,0x70, -}; - -static const BitmapCharRec ch97 = {6,7,-1,0,7,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { - 0xc0,0x80,0x40, -}; - -static const BitmapCharRec ch96 = {2,3,0,-6,3,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { - 0xfe, -}; - -static const BitmapCharRec ch95 = {7,1,0,2,7,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { - 0x88,0x50,0x20, -}; - -static const BitmapCharRec ch94 = {5,3,0,-5,6,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { - 0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, -}; - -static const BitmapCharRec ch93 = {2,12,0,3,3,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { - 0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x80, -}; - -static const BitmapCharRec ch92 = {4,9,0,0,4,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { - 0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, -}; - -static const BitmapCharRec ch91 = {2,12,-1,3,3,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { - 0xfe,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0xfe, -}; - -static const BitmapCharRec ch90 = {7,9,-1,0,9,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { - 0x10,0x10,0x10,0x10,0x28,0x44,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch89 = {7,9,-1,0,9,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { - 0x82,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x82, -}; - -static const BitmapCharRec ch88 = {7,9,-1,0,9,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { - 0x22,0x0,0x22,0x0,0x22,0x0,0x55,0x0,0x55,0x0,0x49,0x0,0x88,0x80,0x88,0x80, - 0x88,0x80, -}; - -static const BitmapCharRec ch87 = {9,9,-1,0,11,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { - 0x10,0x10,0x28,0x28,0x44,0x44,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch86 = {7,9,-1,0,9,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { - 0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch85 = {6,9,-1,0,8,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { - 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, -}; - -static const BitmapCharRec ch84 = {7,9,0,0,7,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { - 0x78,0x84,0x84,0x4,0x18,0x60,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch83 = {6,9,-1,0,8,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { - 0x84,0x84,0x84,0x88,0xf8,0x84,0x84,0x84,0xf8, -}; - -static const BitmapCharRec ch82 = {6,9,-1,0,8,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { - 0x3d,0x42,0x85,0x89,0x81,0x81,0x81,0x42,0x3c, -}; - -static const BitmapCharRec ch81 = {8,9,-1,0,10,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { - 0x80,0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8, -}; - -static const BitmapCharRec ch80 = {6,9,-1,0,8,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { - 0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c, -}; - -static const BitmapCharRec ch79 = {8,9,-1,0,10,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { - 0x82,0x86,0x8a,0x8a,0x92,0xa2,0xa2,0xc2,0x82, -}; - -static const BitmapCharRec ch78 = {7,9,-1,0,9,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { - 0x88,0x80,0x88,0x80,0x94,0x80,0x94,0x80,0xa2,0x80,0xa2,0x80,0xc1,0x80,0xc1,0x80, - 0x80,0x80, -}; - -static const BitmapCharRec ch77 = {9,9,-1,0,11,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { - 0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch76 = {5,9,-1,0,7,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { - 0x82,0x84,0x88,0x90,0xe0,0xa0,0x90,0x88,0x84, -}; - -static const BitmapCharRec ch75 = {7,9,-1,0,8,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { - 0x70,0x88,0x88,0x8,0x8,0x8,0x8,0x8,0x8, -}; - -static const BitmapCharRec ch74 = {5,9,-1,0,7,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch73 = {1,9,-1,0,3,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { - 0x82,0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch72 = {7,9,-1,0,9,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { - 0x3a,0x46,0x82,0x82,0x8e,0x80,0x80,0x42,0x3c, -}; - -static const BitmapCharRec ch71 = {7,9,-1,0,9,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { - 0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0xfc, -}; - -static const BitmapCharRec ch70 = {6,9,-1,0,8,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { - 0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc, -}; - -static const BitmapCharRec ch69 = {6,9,-1,0,8,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { - 0xf8,0x84,0x82,0x82,0x82,0x82,0x82,0x84,0xf8, -}; - -static const BitmapCharRec ch68 = {7,9,-1,0,9,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { - 0x3c,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x3c, -}; - -static const BitmapCharRec ch67 = {7,9,-1,0,9,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { - 0xf8,0x84,0x84,0x84,0xf8,0x84,0x84,0x84,0xf8, -}; - -static const BitmapCharRec ch66 = {6,9,-1,0,8,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { - 0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x28,0x10, -}; - -static const BitmapCharRec ch65 = {7,9,-1,0,9,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { - 0x3e,0x0,0x40,0x0,0x9b,0x0,0xa6,0x80,0xa2,0x40,0xa2,0x40,0x92,0x40,0x4d,0x40, - 0x60,0x80,0x1f,0x0, -}; - -static const BitmapCharRec ch64 = {10,10,-1,1,12,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { - 0x20,0x0,0x20,0x20,0x10,0x10,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch63 = {5,9,-1,0,7,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { - 0xc0,0x30,0xc,0x30,0xc0, -}; - -static const BitmapCharRec ch62 = {6,5,-1,-1,7,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { - 0xf8,0x0,0xf8, -}; - -static const BitmapCharRec ch61 = {5,3,-1,-2,7,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { - 0xc,0x30,0xc0,0x30,0xc, -}; - -static const BitmapCharRec ch60 = {6,5,0,-1,7,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { - 0x80,0x40,0x40,0x0,0x0,0x0,0x0,0x40, -}; - -static const BitmapCharRec ch59 = {2,8,0,2,3,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { - 0x80,0x0,0x0,0x0,0x0,0x80, -}; - -static const BitmapCharRec ch58 = {1,6,-1,0,3,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { - 0x70,0x88,0x8,0x8,0x78,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch57 = {5,9,-1,0,7,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { - 0x70,0x88,0x88,0x88,0x88,0x70,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch56 = {5,9,-1,0,7,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { - 0x40,0x40,0x20,0x20,0x20,0x10,0x10,0x8,0xf8, -}; - -static const BitmapCharRec ch55 = {5,9,-1,0,7,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { - 0x70,0x88,0x88,0x88,0xc8,0xb0,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch54 = {5,9,-1,0,7,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { - 0x70,0x88,0x88,0x8,0x8,0xf0,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch53 = {5,9,-1,0,7,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { - 0x8,0x8,0xfc,0x88,0x48,0x28,0x28,0x18,0x8, -}; - -static const BitmapCharRec ch52 = {6,9,0,0,7,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { - 0x70,0x88,0x88,0x8,0x8,0x30,0x8,0x88,0x70, -}; - -static const BitmapCharRec ch51 = {5,9,-1,0,7,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { - 0xf8,0x80,0x80,0x40,0x20,0x10,0x8,0x88,0x70, -}; - -static const BitmapCharRec ch50 = {5,9,-1,0,7,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xe0,0x20, -}; - -static const BitmapCharRec ch49 = {3,9,-1,0,7,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { - 0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch48 = {5,9,-1,0,7,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { - 0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10, -}; - -static const BitmapCharRec ch47 = {4,9,0,0,4,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { - 0x80, -}; - -static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { - 0xf8, -}; - -static const BitmapCharRec ch45 = {5,1,-1,-3,8,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { - 0x80,0x40,0x40, -}; - -static const BitmapCharRec ch44 = {2,3,-1,2,4,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { - 0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch43 = {5,5,-1,-1,7,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { - 0xa0,0x40,0xa0, -}; - -static const BitmapCharRec ch42 = {3,3,-1,-6,5,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { - 0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {3,12,0,3,4,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { - 0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch40 = {3,12,-1,3,4,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { - 0x80,0x40,0xc0, -}; - -static const BitmapCharRec ch39 = {2,3,-1,-6,3,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { - 0x72,0x8c,0x84,0x8a,0x50,0x30,0x48,0x48,0x30, -}; - -static const BitmapCharRec ch38 = {7,9,-1,0,9,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { - 0x23,0x0,0x14,0x80,0x14,0x80,0x13,0x0,0x8,0x0,0x68,0x0,0x94,0x0,0x94,0x0, - 0x62,0x0, -}; - -static const BitmapCharRec ch37 = {9,9,-1,0,11,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { - 0x20,0x70,0xa8,0xa8,0x28,0x70,0xa0,0xa8,0x70,0x20, -}; - -static const BitmapCharRec ch36 = {5,10,-1,1,7,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { - 0x50,0x50,0x50,0xfc,0x28,0xfc,0x28,0x28, -}; - -static const BitmapCharRec ch35 = {6,8,0,0,7,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { - 0xa0,0xa0,0xa0, -}; - -static const BitmapCharRec ch34 = {3,3,-1,-6,5,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { - 0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch33 = {1,9,-1,0,3,ch33data}; - -/* char: 0x20 ' ' */ - -static const BitmapCharRec ch32 = {0,0,0,0,4,0}; - -static const BitmapCharRec * const chars[] = { - &ch32, - &ch33, - &ch34, - &ch35, - &ch36, - &ch37, - &ch38, - &ch39, - &ch40, - &ch41, - &ch42, - &ch43, - &ch44, - &ch45, - &ch46, - &ch47, - &ch48, - &ch49, - &ch50, - &ch51, - &ch52, - &ch53, - &ch54, - &ch55, - &ch56, - &ch57, - &ch58, - &ch59, - &ch60, - &ch61, - &ch62, - &ch63, - &ch64, - &ch65, - &ch66, - &ch67, - &ch68, - &ch69, - &ch70, - &ch71, - &ch72, - &ch73, - &ch74, - &ch75, - &ch76, - &ch77, - &ch78, - &ch79, - &ch80, - &ch81, - &ch82, - &ch83, - &ch84, - &ch85, - &ch86, - &ch87, - &ch88, - &ch89, - &ch90, - &ch91, - &ch92, - &ch93, - &ch94, - &ch95, - &ch96, - &ch97, - &ch98, - &ch99, - &ch100, - &ch101, - &ch102, - &ch103, - &ch104, - &ch105, - &ch106, - &ch107, - &ch108, - &ch109, - &ch110, - &ch111, - &ch112, - &ch113, - &ch114, - &ch115, - &ch116, - &ch117, - &ch118, - &ch119, - &ch120, - &ch121, - &ch122, - &ch123, - &ch124, - &ch125, - &ch126, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &ch160, - &ch161, - &ch162, - &ch163, - &ch164, - &ch165, - &ch166, - &ch167, - &ch168, - &ch169, - &ch170, - &ch171, - &ch172, - &ch173, - &ch174, - &ch175, - &ch176, - &ch177, - &ch178, - &ch179, - &ch180, - &ch181, - &ch182, - &ch183, - &ch184, - &ch185, - &ch186, - &ch187, - &ch188, - &ch189, - &ch190, - &ch191, - &ch192, - &ch193, - &ch194, - &ch195, - &ch196, - &ch197, - &ch198, - &ch199, - &ch200, - &ch201, - &ch202, - &ch203, - &ch204, - &ch205, - &ch206, - &ch207, - &ch208, - &ch209, - &ch210, - &ch211, - &ch212, - &ch213, - &ch214, - &ch215, - &ch216, - &ch217, - &ch218, - &ch219, - &ch220, - &ch221, - &ch222, - &ch223, - &ch224, - &ch225, - &ch226, - &ch227, - &ch228, - &ch229, - &ch230, - &ch231, - &ch232, - &ch233, - &ch234, - &ch235, - &ch236, - &ch237, - &ch238, - &ch239, - &ch240, - &ch241, - &ch242, - &ch243, - &ch244, - &ch245, - &ch246, - &ch247, - &ch248, - &ch249, - &ch250, - &ch251, - &ch252, - &ch253, - &ch254, - &ch255, -}; - -const BitmapFontRec glutBitmapHelvetica12 = { - "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1", - 224, - 32, - chars -}; - -#endif \ No newline at end of file diff --git a/lib/SRC/Eden/gluttext/glut_hel18.c b/lib/SRC/Eden/gluttext/glut_hel18.c deleted file mode 100644 index 7adf7e1..0000000 --- a/lib/SRC/Eden/gluttext/glut_hel18.c +++ /dev/null @@ -1,1884 +0,0 @@ -#include -#if GLUTTEXT_BITMAP_ENABLE - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmapHelvetica18 XXX -#include "glutbitmap.h" -#undef glutBitmapHelvetica18 - -/* char: 0xff */ - -static const GLubyte ch255data[] = { - 0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3,0x0,0x66, - 0x66, -}; - -static const BitmapCharRec ch255 = {8,17,-1,4,10,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80, - 0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0,0xff,0x0,0xde,0x0,0xc0,0x0,0xc0,0x0, - 0xc0,0x0,0xc0,0x0, -}; - -static const BitmapCharRec ch254 = {9,18,-1,4,11,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { - 0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3,0x0,0x18, - 0xc,0x6, -}; - -static const BitmapCharRec ch253 = {8,18,-1,4,10,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { - 0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x66,0x66, -}; - -static const BitmapCharRec ch252 = {8,13,-1,0,10,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { - 0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x66,0x3c,0x18, -}; - -static const BitmapCharRec ch251 = {8,14,-1,0,10,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { - 0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x18,0xc,0x6, -}; - -static const BitmapCharRec ch250 = {8,14,-1,0,10,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { - 0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0xc,0x18,0x30, -}; - -static const BitmapCharRec ch249 = {8,14,-1,0,10,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { - 0xce,0x0,0x7f,0x80,0x31,0x80,0x78,0xc0,0x6c,0xc0,0x66,0xc0,0x63,0xc0,0x31,0x80, - 0x3f,0xc0,0xe,0x60, -}; - -static const BitmapCharRec ch248 = {11,10,0,0,11,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { - 0x18,0x18,0x0,0xff,0xff,0x0,0x18,0x18, -}; - -static const BitmapCharRec ch247 = {8,8,-1,-1,10,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { - 0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, - 0x7f,0x0,0x3e,0x0,0x0,0x0,0x36,0x0,0x36,0x0, -}; - -static const BitmapCharRec ch246 = {9,13,-1,0,11,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { - 0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, - 0x7f,0x0,0x3e,0x0,0x0,0x0,0x26,0x0,0x2d,0x0,0x19,0x0, -}; - -static const BitmapCharRec ch245 = {9,14,-1,0,11,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { - 0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, - 0x7f,0x0,0x3e,0x0,0x0,0x0,0x33,0x0,0x1e,0x0,0xc,0x0, -}; - -static const BitmapCharRec ch244 = {9,14,-1,0,11,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { - 0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, - 0x7f,0x0,0x3e,0x0,0x0,0x0,0x18,0x0,0xc,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch243 = {9,14,-1,0,11,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { - 0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, - 0x7f,0x0,0x3e,0x0,0x0,0x0,0xc,0x0,0x18,0x0,0x30,0x0, -}; - -static const BitmapCharRec ch242 = {9,14,-1,0,11,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { - 0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce,0x0,0x4c,0x5a,0x32, -}; - -static const BitmapCharRec ch241 = {8,14,-1,0,10,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { - 0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, - 0x7f,0x0,0x3e,0x0,0x4c,0x0,0x38,0x0,0x36,0x0,0x60,0x0, -}; - -static const BitmapCharRec ch240 = {9,14,-1,0,11,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0xd8,0xd8, -}; - -static const BitmapCharRec ch239 = {5,13,0,0,4,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { - 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc,0x78,0x30, -}; - -static const BitmapCharRec ch238 = {6,14,1,0,4,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0xc0,0x60,0x30, -}; - -static const BitmapCharRec ch237 = {4,14,0,0,4,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0x30,0x60,0xc0, -}; - -static const BitmapCharRec ch236 = {4,14,0,0,4,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { - 0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x36,0x36, -}; - -static const BitmapCharRec ch235 = {8,13,-1,0,10,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { - 0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x66,0x3c,0x18, -}; - -static const BitmapCharRec ch234 = {8,14,-1,0,10,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { - 0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x18,0xc,0x6, -}; - -static const BitmapCharRec ch233 = {8,14,-1,0,10,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { - 0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x18,0x30,0x60, -}; - -static const BitmapCharRec ch232 = {8,14,-1,0,10,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { - 0x78,0x6c,0xc,0x38,0x3e,0x7f,0x63,0xc0,0xc0,0xc0,0xc0,0x63,0x7f,0x3e, -}; - -static const BitmapCharRec ch231 = {8,14,-1,4,10,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { - 0x75,0xe0,0xef,0xf8,0xc7,0x18,0xc6,0x0,0xe6,0x0,0x7f,0xf8,0xe,0x18,0xc6,0x18, - 0xef,0xf0,0x7d,0xe0, -}; - -static const BitmapCharRec ch230 = {13,10,-1,0,15,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { - 0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x38,0x6c,0x6c,0x38, -}; - -static const BitmapCharRec ch229 = {7,14,-1,0,9,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { - 0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x6c,0x6c, -}; - -static const BitmapCharRec ch228 = {7,13,-1,0,9,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { - 0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x4c,0x5a,0x32, -}; - -static const BitmapCharRec ch227 = {7,14,-1,0,9,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { - 0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x66,0x3c,0x18, -}; - -static const BitmapCharRec ch226 = {7,14,-1,0,9,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { - 0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x30,0x18,0xc, -}; - -static const BitmapCharRec ch225 = {7,14,-1,0,9,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { - 0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x18,0x30,0x60, -}; - -static const BitmapCharRec ch224 = {7,14,-1,0,9,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { - 0xdc,0xde,0xc6,0xc6,0xc6,0xc6,0xdc,0xdc,0xc6,0xc6,0xc6,0xc6,0x7c,0x38, -}; - -static const BitmapCharRec ch223 = {7,14,-1,0,9,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x80,0xc1,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc1,0xc0,0xff,0x80,0xff,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, -}; - -static const BitmapCharRec ch222 = {10,14,-1,0,12,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { - 0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, - 0x30,0xc0,0x30,0xc0,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30,0x0,0x0,0x6,0x0, - 0x3,0x0,0x1,0x80, -}; - -static const BitmapCharRec ch221 = {12,18,-1,0,14,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { - 0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, - 0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x19,0x80, - 0x19,0x80, -}; - -static const BitmapCharRec ch220 = {11,17,-1,0,13,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { - 0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, - 0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x19,0x80, - 0xf,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch219 = {11,18,-1,0,13,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { - 0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, - 0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0xc,0x0, - 0x6,0x0,0x3,0x0, -}; - -static const BitmapCharRec ch218 = {11,18,-1,0,13,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { - 0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, - 0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x6,0x0, - 0xc,0x0,0x18,0x0, -}; - -static const BitmapCharRec ch217 = {11,18,-1,0,13,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { - 0xc7,0xc0,0xff,0xf0,0x78,0x38,0x38,0x18,0x6c,0x1c,0x6e,0xc,0x67,0xc,0x63,0x8c, - 0x61,0xcc,0x70,0xdc,0x30,0x78,0x38,0x38,0x1f,0xfc,0x7,0xcc, -}; - -static const BitmapCharRec ch216 = {14,14,0,0,15,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { - 0xc0,0xc0,0x61,0x80,0x33,0x0,0x1e,0x0,0xc,0x0,0x1e,0x0,0x33,0x0,0x61,0x80, - 0xc0,0xc0, -}; - -static const BitmapCharRec ch215 = {10,9,0,0,10,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { - 0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, - 0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0xd,0x80, - 0xd,0x80, -}; - -static const BitmapCharRec ch214 = {13,17,-1,0,15,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { - 0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, - 0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x9,0x80, - 0xb,0x40,0x6,0x40, -}; - -static const BitmapCharRec ch213 = {13,18,-1,0,15,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { - 0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, - 0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0xc,0xc0, - 0x7,0x80,0x3,0x0, -}; - -static const BitmapCharRec ch212 = {13,18,-1,0,15,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { - 0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, - 0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x3,0x0, - 0x1,0x80,0x0,0xc0, -}; - -static const BitmapCharRec ch211 = {13,18,-1,0,15,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { - 0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, - 0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x3,0x0, - 0x6,0x0,0xc,0x0, -}; - -static const BitmapCharRec ch210 = {13,18,-1,0,15,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { - 0xc0,0x60,0xc0,0xe0,0xc1,0xe0,0xc1,0xe0,0xc3,0x60,0xc6,0x60,0xc6,0x60,0xcc,0x60, - 0xcc,0x60,0xd8,0x60,0xd8,0x60,0xf0,0x60,0xe0,0x60,0xe0,0x60,0x0,0x0,0x13,0x0, - 0x16,0x80,0xc,0x80, -}; - -static const BitmapCharRec ch209 = {11,18,-1,0,13,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { - 0x7f,0x80,0x7f,0xc0,0x60,0xe0,0x60,0x60,0x60,0x30,0x60,0x30,0xfc,0x30,0xfc,0x30, - 0x60,0x30,0x60,0x30,0x60,0x60,0x60,0xe0,0x7f,0xc0,0x7f,0x80, -}; - -static const BitmapCharRec ch208 = {12,14,0,0,13,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { - 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc, - 0xcc, -}; - -static const BitmapCharRec ch207 = {6,17,0,0,6,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { - 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc, - 0x78,0x30, -}; - -static const BitmapCharRec ch206 = {6,18,0,0,6,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0xc0, - 0x60,0x30, -}; - -static const BitmapCharRec ch205 = {4,18,-2,0,6,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { - 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0x30, - 0x60,0xc0, -}; - -static const BitmapCharRec ch204 = {4,18,0,0,6,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { - 0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0x33,0x0, - 0x33,0x0, -}; - -static const BitmapCharRec ch203 = {9,17,-1,0,11,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { - 0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0x33,0x0, - 0x1e,0x0,0xc,0x0, -}; - -static const BitmapCharRec ch202 = {9,18,-1,0,11,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { - 0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0xc,0x0, - 0x6,0x0,0x3,0x0, -}; - -static const BitmapCharRec ch201 = {9,18,-1,0,11,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { - 0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0xc,0x0, - 0x18,0x0,0x30,0x0, -}; - -static const BitmapCharRec ch200 = {9,18,-1,0,11,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { - 0x1e,0x0,0x1b,0x0,0x3,0x0,0xe,0x0,0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30, - 0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xe0,0x0,0x60,0x30,0x70,0x70, - 0x3f,0xe0,0xf,0x80, -}; - -static const BitmapCharRec ch199 = {12,18,-1,4,14,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { - 0xc1,0xff,0xc1,0xff,0x61,0x80,0x61,0x80,0x7f,0x80,0x3f,0x80,0x31,0xfe,0x31,0xfe, - 0x19,0x80,0x19,0x80,0xd,0x80,0xd,0x80,0x7,0xff,0x7,0xff, -}; - -static const BitmapCharRec ch198 = {16,14,-1,0,18,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { - 0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, - 0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, - 0x19,0x80,0xf,0x0, -}; - -static const BitmapCharRec ch197 = {12,18,0,0,12,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { - 0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, - 0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x19,0x80, - 0x19,0x80, -}; - -static const BitmapCharRec ch196 = {12,17,0,0,12,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { - 0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, - 0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x13,0x0, - 0x16,0x80,0xc,0x80, -}; - -static const BitmapCharRec ch195 = {12,18,0,0,12,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { - 0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, - 0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x19,0x80, - 0xf,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch194 = {12,18,0,0,12,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { - 0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, - 0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x6,0x0, - 0x3,0x0,0x1,0x80, -}; - -static const BitmapCharRec ch193 = {12,18,0,0,12,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { - 0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, - 0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x6,0x0, - 0xc,0x0,0x18,0x0, -}; - -static const BitmapCharRec ch192 = {12,18,0,0,12,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { - 0x7c,0xfe,0xc6,0xc6,0xe0,0x70,0x38,0x18,0x18,0x18,0x0,0x0,0x18,0x18, -}; - -static const BitmapCharRec ch191 = {7,14,-1,4,10,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { - 0x18,0x18,0x18,0x18,0xc,0xfc,0x6,0xd8,0x6,0x78,0x73,0x38,0xf9,0x18,0x99,0x88, - 0x30,0xc0,0x30,0xc0,0x98,0x60,0xf8,0x30,0x70,0x30, -}; - -static const BitmapCharRec ch190 = {14,13,0,0,15,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { - 0x30,0xf8,0x30,0xf8,0x18,0x60,0xc,0x30,0xc,0x18,0x66,0x98,0x62,0xf8,0x63,0x70, - 0x61,0x80,0x61,0x80,0xe0,0xc0,0xe0,0x60,0x60,0x60, -}; - -static const BitmapCharRec ch189 = {13,13,-1,0,15,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { - 0x30,0x30,0x30,0x30,0x19,0xf8,0xd,0xb0,0xc,0xf0,0x66,0x70,0x62,0x30,0x63,0x10, - 0x61,0x80,0x61,0x80,0xe0,0xc0,0xe0,0x60,0x60,0x60, -}; - -static const BitmapCharRec ch188 = {13,13,-1,0,15,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { - 0x90,0xd8,0x6c,0x36,0x36,0x6c,0xd8,0x90, -}; - -static const BitmapCharRec ch187 = {7,8,-1,-1,9,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { - 0xf8,0x0,0x70,0xd8,0x88,0x88,0xd8,0x70, -}; - -static const BitmapCharRec ch186 = {5,8,-1,-6,7,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { - 0x60,0x60,0x60,0x60,0x60,0xe0,0xe0,0x60, -}; - -static const BitmapCharRec ch185 = {3,8,-1,-5,6,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { - 0xf0,0xd8,0x18,0x70,0x60, -}; - -static const BitmapCharRec ch184 = {5,5,0,4,5,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { - 0xc0,0xc0, -}; - -static const BitmapCharRec ch183 = {2,2,-1,-4,4,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { - 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x32,0x72,0xf2,0xf2,0xf2,0xf2, - 0x72,0x3f, -}; - -static const BitmapCharRec ch182 = {8,18,-1,4,10,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { - 0xc0,0xc0,0xc0,0xc0,0xdb,0xff,0xe7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, -}; - -static const BitmapCharRec ch181 = {8,14,-1,4,10,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { - 0xc0,0x60,0x30, -}; - -static const BitmapCharRec ch180 = {4,3,0,-11,4,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { - 0x70,0xf8,0x98,0x30,0x30,0x98,0xf8,0x70, -}; - -static const BitmapCharRec ch179 = {5,8,0,-5,6,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { - 0xf8,0xf8,0x60,0x30,0x18,0x98,0xf8,0x70, -}; - -static const BitmapCharRec ch178 = {5,8,0,-5,6,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { - 0xff,0xff,0x0,0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18, -}; - -static const BitmapCharRec ch177 = {8,11,-1,0,10,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { - 0x70,0xd8,0x88,0xd8,0x70, -}; - -static const BitmapCharRec ch176 = {5,5,-1,-8,7,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { - 0xf8, -}; - -static const BitmapCharRec ch175 = {5,1,0,-12,5,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { - 0xf,0x80,0x30,0x60,0x40,0x10,0x48,0x50,0x88,0x88,0x89,0x8,0x8f,0x88,0x88,0x48, - 0x88,0x48,0x4f,0x90,0x40,0x10,0x30,0x60,0xf,0x80, -}; - -static const BitmapCharRec ch174 = {13,13,-1,0,14,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { - 0xf8,0xf8, -}; - -static const BitmapCharRec ch173 = {5,2,-1,-4,7,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { - 0x1,0x80,0x1,0x80,0x1,0x80,0xff,0x80,0xff,0x80, -}; - -static const BitmapCharRec ch172 = {9,5,-1,-3,11,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { - 0x12,0x36,0x6c,0xd8,0xd8,0x6c,0x36,0x12, -}; - -static const BitmapCharRec ch171 = {7,8,-1,-1,9,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { - 0xf8,0x0,0x68,0xd8,0x48,0x38,0xc8,0x70, -}; - -static const BitmapCharRec ch170 = {5,8,-1,-6,7,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { - 0xf,0x80,0x30,0x60,0x40,0x10,0x47,0x10,0x88,0x88,0x90,0x8,0x90,0x8,0x90,0x8, - 0x88,0x88,0x47,0x10,0x40,0x10,0x30,0x60,0xf,0x80, -}; - -static const BitmapCharRec ch169 = {13,13,-1,0,15,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { - 0xd8,0xd8, -}; - -static const BitmapCharRec ch168 = {5,2,0,-11,6,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { - 0x3c,0x7e,0xc3,0xc3,0x7,0xe,0x3e,0x73,0xe3,0xc3,0xc7,0x6e,0x7c,0xf0,0xc3,0xc3, - 0x7e,0x3c, -}; - -static const BitmapCharRec ch167 = {8,18,-1,4,10,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0, -}; - -static const BitmapCharRec ch166 = {2,17,-1,3,4,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { - 0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x3c,0x66,0x66,0x66,0xc3,0xc3, -}; - -static const BitmapCharRec ch165 = {8,13,-1,0,10,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { - 0xc3,0xff,0x66,0x66,0x66,0xff,0xc3, -}; - -static const BitmapCharRec ch164 = {8,7,-1,-3,10,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { - 0xdf,0x0,0xff,0x80,0x60,0x80,0x30,0x0,0x18,0x0,0x18,0x0,0x7e,0x0,0x30,0x0, - 0x60,0x0,0x61,0x80,0x61,0x80,0x3f,0x0,0x1e,0x0, -}; - -static const BitmapCharRec ch163 = {9,13,0,0,10,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { - 0x10,0x10,0x3e,0x7f,0x6b,0xc8,0xc8,0xc8,0xc8,0x6b,0x7f,0x3e,0x4,0x4, -}; - -static const BitmapCharRec ch162 = {8,14,-1,2,10,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x40,0x40,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch161 = {2,14,-2,4,6,ch161data}; - -/* char: 0xa0 */ - -static const BitmapCharRec ch160 = {0,0,0,0,5,0}; - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { - 0xcc,0x7e,0x33, -}; - -static const BitmapCharRec ch126 = {8,3,-1,-4,10,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { - 0xc0,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0xc,0x18,0x30,0x30,0x30,0x30,0x30, - 0x60,0xc0, -}; - -static const BitmapCharRec ch125 = {6,18,0,4,6,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0,0xc0, -}; - -static const BitmapCharRec ch124 = {2,18,-1,4,4,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { - 0xc,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0xc0,0x60,0x30,0x30,0x30,0x30,0x30, - 0x18,0xc, -}; - -static const BitmapCharRec ch123 = {6,18,0,4,6,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { - 0xfe,0xfe,0xc0,0x60,0x30,0x18,0xc,0x6,0xfe,0xfe, -}; - -static const BitmapCharRec ch122 = {7,10,-1,0,9,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { - 0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3, -}; - -static const BitmapCharRec ch121 = {8,14,-1,4,10,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { - 0xc3,0xe7,0x66,0x3c,0x18,0x18,0x3c,0x66,0xe7,0xc3, -}; - -static const BitmapCharRec ch120 = {8,10,-1,0,10,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { - 0x19,0x80,0x19,0x80,0x39,0xc0,0x29,0x40,0x69,0x60,0x66,0x60,0x66,0x60,0xc6,0x30, - 0xc6,0x30,0xc6,0x30, -}; - -static const BitmapCharRec ch119 = {12,10,-1,0,14,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { - 0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3, -}; - -static const BitmapCharRec ch118 = {8,10,-1,0,10,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { - 0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, -}; - -static const BitmapCharRec ch117 = {8,10,-1,0,10,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { - 0x18,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0xfc,0xfc,0x30,0x30,0x30, -}; - -static const BitmapCharRec ch116 = {6,13,0,0,6,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { - 0x78,0xfc,0xc6,0x6,0x3e,0xfc,0xc0,0xc6,0x7e,0x3c, -}; - -static const BitmapCharRec ch115 = {7,10,-1,0,9,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xe0,0xd8,0xd8, -}; - -static const BitmapCharRec ch114 = {5,10,-1,0,6,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { - 0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80, - 0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x80,0x7f,0x80,0x3d,0x80, -}; - -static const BitmapCharRec ch113 = {9,14,-1,4,11,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80, - 0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0,0xff,0x0,0xde,0x0, -}; - -static const BitmapCharRec ch112 = {9,14,-1,4,11,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { - 0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, - 0x7f,0x0,0x3e,0x0, -}; - -static const BitmapCharRec ch111 = {9,10,-1,0,11,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { - 0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce, -}; - -static const BitmapCharRec ch110 = {8,10,-1,0,10,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { - 0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xe7,0x30, - 0xde,0xf0,0xcc,0x60, -}; - -static const BitmapCharRec ch109 = {12,10,-1,0,14,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch108 = {2,14,-1,0,4,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { - 0xc7,0xc6,0xce,0xcc,0xd8,0xf8,0xf0,0xd8,0xcc,0xc6,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch107 = {8,14,-1,0,9,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { - 0xe0,0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0x0, - 0x30,0x30, -}; - -static const BitmapCharRec ch106 = {4,18,1,4,4,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch105 = {2,14,-1,0,4,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { - 0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch104 = {8,14,-1,0,10,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { - 0x1c,0x0,0x7f,0x0,0x63,0x0,0x1,0x80,0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80, - 0xc1,0x80,0xc1,0x80,0xc1,0x80,0x61,0x80,0x7f,0x80,0x3d,0x80, -}; - -static const BitmapCharRec ch103 = {9,14,-1,4,11,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { - 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfc,0xfc,0x30,0x30,0x3c,0x1c, -}; - -static const BitmapCharRec ch102 = {6,14,0,0,6,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { - 0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c, -}; - -static const BitmapCharRec ch101 = {8,10,-1,0,10,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { - 0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x80, - 0x7f,0x80,0x3d,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80, -}; - -static const BitmapCharRec ch100 = {9,14,-1,0,11,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { - 0x3e,0x7f,0x63,0xc0,0xc0,0xc0,0xc0,0x63,0x7f,0x3e, -}; - -static const BitmapCharRec ch99 = {8,10,-1,0,10,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { - 0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0, - 0xff,0x0,0xde,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, -}; - -static const BitmapCharRec ch98 = {9,14,-1,0,11,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { - 0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c, -}; - -static const BitmapCharRec ch97 = {7,10,-1,0,9,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { - 0xc0,0xc0,0x80,0x80,0x40, -}; - -static const BitmapCharRec ch96 = {2,5,-1,-9,4,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { - 0xff,0xc0,0xff,0xc0, -}; - -static const BitmapCharRec ch95 = {10,2,0,4,10,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { - 0x82,0xc6,0x6c,0x38,0x10, -}; - -static const BitmapCharRec ch94 = {7,5,-1,-8,9,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { - 0xf0,0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, - 0xf0,0xf0, -}; - -static const BitmapCharRec ch93 = {4,18,0,4,5,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { - 0x18,0x18,0x10,0x10,0x30,0x30,0x20,0x20,0x60,0x60,0x40,0x40,0xc0,0xc0, -}; - -static const BitmapCharRec ch92 = {5,14,0,0,5,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { - 0xf0,0xf0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xf0,0xf0, -}; - -static const BitmapCharRec ch91 = {4,18,-1,4,5,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { - 0xff,0xc0,0xff,0xc0,0xc0,0x0,0x60,0x0,0x30,0x0,0x18,0x0,0x1c,0x0,0xc,0x0, - 0x6,0x0,0x3,0x0,0x1,0x80,0x0,0xc0,0xff,0xc0,0xff,0xc0, -}; - -static const BitmapCharRec ch90 = {10,14,-1,0,12,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { - 0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, - 0x30,0xc0,0x30,0xc0,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30, -}; - -static const BitmapCharRec ch89 = {12,14,-1,0,14,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { - 0xc0,0x60,0xe0,0xe0,0x60,0xc0,0x71,0xc0,0x31,0x80,0x1b,0x0,0xe,0x0,0xe,0x0, - 0x1b,0x0,0x31,0x80,0x71,0xc0,0x60,0xc0,0xe0,0xe0,0xc0,0x60, -}; - -static const BitmapCharRec ch88 = {11,14,-1,0,13,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { - 0x18,0x18,0x18,0x18,0x1c,0x38,0x34,0x2c,0x36,0x6c,0x36,0x6c,0x66,0x66,0x66,0x66, - 0x62,0x46,0x63,0xc6,0xc3,0xc3,0xc1,0x83,0xc1,0x83,0xc1,0x83, -}; - -static const BitmapCharRec ch87 = {16,14,-1,0,18,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { - 0x6,0x0,0xf,0x0,0xf,0x0,0x19,0x80,0x19,0x80,0x19,0x80,0x30,0xc0,0x30,0xc0, - 0x30,0xc0,0x60,0x60,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30, -}; - -static const BitmapCharRec ch86 = {12,14,-1,0,14,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { - 0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, - 0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, -}; - -static const BitmapCharRec ch85 = {11,14,-1,0,13,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { - 0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0, - 0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xff,0xc0,0xff,0xc0, -}; - -static const BitmapCharRec ch84 = {10,14,-1,0,12,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { - 0x3f,0x0,0x7f,0xc0,0xe0,0xe0,0xc0,0x60,0x0,0x60,0x0,0xe0,0x3,0xc0,0x1f,0x0, - 0x7c,0x0,0xe0,0x0,0xc0,0x60,0xe0,0xe0,0x7f,0xc0,0x1f,0x0, -}; - -static const BitmapCharRec ch83 = {11,14,-1,0,13,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0x80,0xc1,0x80,0xff,0x0,0xff,0x80, - 0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, -}; - -static const BitmapCharRec ch82 = {10,14,-1,0,12,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { - 0x0,0x30,0xf,0xb0,0x3f,0xe0,0x70,0xf0,0x61,0xb0,0xe1,0xb8,0xc0,0x18,0xc0,0x18, - 0xc0,0x18,0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, -}; - -static const BitmapCharRec ch81 = {13,15,-1,1,15,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x80, - 0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, -}; - -static const BitmapCharRec ch80 = {10,14,-1,0,12,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { - 0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, - 0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, -}; - -static const BitmapCharRec ch79 = {13,14,-1,0,15,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { - 0xc0,0x60,0xc0,0xe0,0xc1,0xe0,0xc1,0xe0,0xc3,0x60,0xc6,0x60,0xc6,0x60,0xcc,0x60, - 0xcc,0x60,0xd8,0x60,0xf0,0x60,0xf0,0x60,0xe0,0x60,0xc0,0x60, -}; - -static const BitmapCharRec ch78 = {11,14,-1,0,13,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { - 0xc3,0xc,0xc3,0xc,0xc7,0x8c,0xc4,0x8c,0xcc,0xcc,0xcc,0xcc,0xd8,0x6c,0xd8,0x6c, - 0xf0,0x3c,0xf0,0x3c,0xe0,0x1c,0xe0,0x1c,0xc0,0xc,0xc0,0xc, -}; - -static const BitmapCharRec ch77 = {14,14,-1,0,16,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { - 0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch76 = {8,14,-1,0,10,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { - 0xc0,0x70,0xc0,0xe0,0xc1,0xc0,0xc3,0x80,0xc7,0x0,0xce,0x0,0xfc,0x0,0xf8,0x0, - 0xdc,0x0,0xce,0x0,0xc7,0x0,0xc3,0x80,0xc1,0xc0,0xc0,0xe0, -}; - -static const BitmapCharRec ch75 = {12,14,-1,0,13,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { - 0x3c,0x7e,0xe7,0xc3,0xc3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3, -}; - -static const BitmapCharRec ch74 = {8,14,-1,0,10,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch73 = {2,14,-2,0,6,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { - 0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xff,0xe0,0xff,0xe0, - 0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, -}; - -static const BitmapCharRec ch72 = {11,14,-1,0,13,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { - 0xf,0xb0,0x3f,0xf0,0x70,0x70,0x60,0x30,0xe0,0x30,0xc1,0xf0,0xc1,0xf0,0xc0,0x0, - 0xc0,0x0,0xe0,0x30,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, -}; - -static const BitmapCharRec ch71 = {12,14,-1,0,14,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80, -}; - -static const BitmapCharRec ch70 = {9,14,-1,0,11,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { - 0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80, -}; - -static const BitmapCharRec ch69 = {9,14,-1,0,11,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { - 0xff,0x0,0xff,0x80,0xc1,0xc0,0xc0,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, - 0xc0,0x60,0xc0,0x60,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, -}; - -static const BitmapCharRec ch68 = {11,14,-1,0,13,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { - 0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, - 0xc0,0x0,0xe0,0x0,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, -}; - -static const BitmapCharRec ch67 = {12,14,-1,0,14,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { - 0xff,0x80,0xff,0xc0,0xc0,0xe0,0xc0,0x60,0xc0,0x60,0xc0,0xe0,0xff,0xc0,0xff,0x80, - 0xc1,0x80,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, -}; - -static const BitmapCharRec ch66 = {11,14,-1,0,13,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { - 0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, - 0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch65 = {12,14,0,0,12,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { - 0x7,0xe0,0x1f,0xf0,0x38,0x0,0x70,0x0,0x67,0x70,0xcf,0xf8,0xcc,0xcc,0xcc,0x66, - 0xcc,0x66,0xcc,0x63,0xc6,0x33,0x67,0x73,0x63,0xb3,0x30,0x6,0x1c,0xe,0xf,0xfc, - 0x3,0xf0, -}; - -static const BitmapCharRec ch64 = {16,17,-1,3,18,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { - 0x30,0x30,0x0,0x0,0x30,0x30,0x30,0x38,0x1c,0xe,0xc6,0xc6,0xfe,0x7c, -}; - -static const BitmapCharRec ch63 = {7,14,-1,0,10,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { - 0xc0,0xf0,0x3c,0xe,0x3,0xe,0x3c,0xf0,0xc0, -}; - -static const BitmapCharRec ch62 = {8,9,-1,0,10,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { - 0xfe,0xfe,0x0,0x0,0xfe,0xfe, -}; - -static const BitmapCharRec ch61 = {7,6,-2,-2,11,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { - 0x3,0xf,0x3c,0x70,0xc0,0x70,0x3c,0xf,0x3, -}; - -static const BitmapCharRec ch60 = {8,9,-1,0,10,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { - 0x80,0x40,0x40,0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch59 = {2,13,-1,3,5,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { - 0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch58 = {2,10,-1,0,5,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { - 0x7c,0xfe,0xc6,0x3,0x3,0x3b,0x7f,0xc3,0xc3,0xc3,0xc7,0x7e,0x3c, -}; - -static const BitmapCharRec ch57 = {8,13,-1,0,10,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { - 0x3c,0x7e,0xe7,0xc3,0xc3,0x66,0x7e,0x66,0xc3,0xc3,0xe7,0x7e,0x3c, -}; - -static const BitmapCharRec ch56 = {8,13,-1,0,10,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { - 0x60,0x60,0x30,0x30,0x30,0x18,0x18,0xc,0xc,0x6,0x3,0xff,0xff, -}; - -static const BitmapCharRec ch55 = {8,13,-1,0,10,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { - 0x3c,0x7e,0xe3,0xc3,0xc3,0xc3,0xfe,0xdc,0xc0,0xc0,0x63,0x7f,0x3c, -}; - -static const BitmapCharRec ch54 = {8,13,-1,0,10,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { - 0x7c,0xfe,0xc7,0xc3,0x3,0x3,0xc7,0xfe,0xfc,0xc0,0xc0,0xfe,0xfe, -}; - -static const BitmapCharRec ch53 = {8,13,-1,0,10,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { - 0x3,0x0,0x3,0x0,0x3,0x0,0xff,0x80,0xff,0x80,0xc3,0x0,0x63,0x0,0x33,0x0, - 0x33,0x0,0x1b,0x0,0xf,0x0,0x7,0x0,0x3,0x0, -}; - -static const BitmapCharRec ch52 = {9,13,-1,0,10,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { - 0x3c,0x7e,0xc7,0xc3,0x3,0x7,0x1e,0x1c,0x6,0xc3,0xc3,0x7e,0x3c, -}; - -static const BitmapCharRec ch51 = {8,13,-1,0,10,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { - 0xff,0xff,0xc0,0xe0,0x70,0x38,0x1c,0xe,0x7,0x3,0xc3,0xfe,0x3c, -}; - -static const BitmapCharRec ch50 = {8,13,-1,0,10,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { - 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0xf8,0x18, -}; - -static const BitmapCharRec ch49 = {5,13,-2,0,10,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { - 0x3c,0x7e,0x66,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x66,0x7e,0x3c, -}; - -static const BitmapCharRec ch48 = {8,13,-1,0,10,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { - 0xc0,0xc0,0x40,0x40,0x60,0x60,0x20,0x20,0x30,0x30,0x10,0x10,0x18,0x18, -}; - -static const BitmapCharRec ch47 = {5,14,0,0,5,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { - 0xc0,0xc0, -}; - -static const BitmapCharRec ch46 = {2,2,-1,0,5,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { - 0xff,0xff, -}; - -static const BitmapCharRec ch45 = {8,2,-1,-4,11,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { - 0x80,0x40,0x40,0xc0,0xc0, -}; - -static const BitmapCharRec ch44 = {2,5,-1,3,5,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { - 0x18,0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18,0x18, -}; - -static const BitmapCharRec ch43 = {8,10,-1,0,10,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { - 0x88,0x70,0x70,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch42 = {5,6,-1,-8,7,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { - 0x80,0xc0,0x60,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0x60, - 0xc0,0x80, -}; - -static const BitmapCharRec ch41 = {4,18,-1,4,6,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { - 0x10,0x30,0x60,0x60,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x60,0x60, - 0x30,0x10, -}; - -static const BitmapCharRec ch40 = {4,18,-1,4,6,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { - 0x80,0x40,0x40,0xc0,0xc0, -}; - -static const BitmapCharRec ch39 = {2,5,-1,-9,4,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { - 0x3c,0x70,0x7e,0xe0,0xe7,0xc0,0xc3,0x80,0xc3,0xc0,0xc6,0xc0,0xee,0xc0,0x7c,0x0, - 0x3c,0x0,0x66,0x0,0x66,0x0,0x7e,0x0,0x3c,0x0, -}; - -static const BitmapCharRec ch38 = {12,13,-1,0,13,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { - 0x18,0x78,0x18,0xfc,0xc,0xcc,0xc,0xcc,0x6,0xfc,0x6,0x78,0x3,0x0,0x7b,0x0, - 0xfd,0x80,0xcd,0x80,0xcc,0xc0,0xfc,0xc0,0x78,0x60, -}; - -static const BitmapCharRec ch37 = {14,13,-1,0,16,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { - 0x8,0x0,0x8,0x0,0x3e,0x0,0x7f,0x0,0xeb,0x80,0xc9,0x80,0x9,0x80,0xf,0x0, - 0x3e,0x0,0x78,0x0,0xe8,0x0,0xc8,0x0,0xcb,0x0,0x7f,0x0,0x3e,0x0,0x8,0x0, -}; - -static const BitmapCharRec ch36 = {9,16,-1,2,10,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { - 0x24,0x0,0x24,0x0,0x24,0x0,0xff,0x80,0xff,0x80,0x12,0x0,0x12,0x0,0x12,0x0, - 0x7f,0xc0,0x7f,0xc0,0x9,0x0,0x9,0x0,0x9,0x0, -}; - -static const BitmapCharRec ch35 = {10,13,0,0,10,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { - 0x90,0x90,0xd8,0xd8,0xd8, -}; - -static const BitmapCharRec ch34 = {5,5,0,-9,5,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { - 0xc0,0xc0,0x0,0x0,0x80,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch33 = {2,14,-2,0,6,ch33data}; - -/* char: 0x20 ' ' */ - -static const BitmapCharRec ch32 = {0,0,0,0,5,0}; - -static const BitmapCharRec * const chars[] = { - &ch32, - &ch33, - &ch34, - &ch35, - &ch36, - &ch37, - &ch38, - &ch39, - &ch40, - &ch41, - &ch42, - &ch43, - &ch44, - &ch45, - &ch46, - &ch47, - &ch48, - &ch49, - &ch50, - &ch51, - &ch52, - &ch53, - &ch54, - &ch55, - &ch56, - &ch57, - &ch58, - &ch59, - &ch60, - &ch61, - &ch62, - &ch63, - &ch64, - &ch65, - &ch66, - &ch67, - &ch68, - &ch69, - &ch70, - &ch71, - &ch72, - &ch73, - &ch74, - &ch75, - &ch76, - &ch77, - &ch78, - &ch79, - &ch80, - &ch81, - &ch82, - &ch83, - &ch84, - &ch85, - &ch86, - &ch87, - &ch88, - &ch89, - &ch90, - &ch91, - &ch92, - &ch93, - &ch94, - &ch95, - &ch96, - &ch97, - &ch98, - &ch99, - &ch100, - &ch101, - &ch102, - &ch103, - &ch104, - &ch105, - &ch106, - &ch107, - &ch108, - &ch109, - &ch110, - &ch111, - &ch112, - &ch113, - &ch114, - &ch115, - &ch116, - &ch117, - &ch118, - &ch119, - &ch120, - &ch121, - &ch122, - &ch123, - &ch124, - &ch125, - &ch126, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &ch160, - &ch161, - &ch162, - &ch163, - &ch164, - &ch165, - &ch166, - &ch167, - &ch168, - &ch169, - &ch170, - &ch171, - &ch172, - &ch173, - &ch174, - &ch175, - &ch176, - &ch177, - &ch178, - &ch179, - &ch180, - &ch181, - &ch182, - &ch183, - &ch184, - &ch185, - &ch186, - &ch187, - &ch188, - &ch189, - &ch190, - &ch191, - &ch192, - &ch193, - &ch194, - &ch195, - &ch196, - &ch197, - &ch198, - &ch199, - &ch200, - &ch201, - &ch202, - &ch203, - &ch204, - &ch205, - &ch206, - &ch207, - &ch208, - &ch209, - &ch210, - &ch211, - &ch212, - &ch213, - &ch214, - &ch215, - &ch216, - &ch217, - &ch218, - &ch219, - &ch220, - &ch221, - &ch222, - &ch223, - &ch224, - &ch225, - &ch226, - &ch227, - &ch228, - &ch229, - &ch230, - &ch231, - &ch232, - &ch233, - &ch234, - &ch235, - &ch236, - &ch237, - &ch238, - &ch239, - &ch240, - &ch241, - &ch242, - &ch243, - &ch244, - &ch245, - &ch246, - &ch247, - &ch248, - &ch249, - &ch250, - &ch251, - &ch252, - &ch253, - &ch254, - &ch255, -}; - -const BitmapFontRec glutBitmapHelvetica18 = { - "-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1", - 224, - 32, - chars -}; - -#endif \ No newline at end of file diff --git a/lib/SRC/Eden/gluttext/glut_mroman.c b/lib/SRC/Eden/gluttext/glut_mroman.c deleted file mode 100644 index 6687824..0000000 --- a/lib/SRC/Eden/gluttext/glut_mroman.c +++ /dev/null @@ -1,2454 +0,0 @@ -#include -#if GLUTTEXT_STROKE_ENABLE - -/* GENERATED FILE -- DO NOT MODIFY */ - -#include "glutstroke.h" - -/* char: 33 '!' */ - -static const CoordRec char33_stroke0[] = { - { 52.381, 100 }, - { 52.381, 33.3333 }, -}; - -static const CoordRec char33_stroke1[] = { - { 52.381, 9.5238 }, - { 47.6191, 4.7619 }, - { 52.381, 0 }, - { 57.1429, 4.7619 }, - { 52.381, 9.5238 }, -}; - -static const StrokeRec char33[] = { - { 2, char33_stroke0 }, - { 5, char33_stroke1 }, -}; - -/* char: 34 '"' */ - -static const CoordRec char34_stroke0[] = { - { 33.3334, 100 }, - { 33.3334, 66.6667 }, -}; - -static const CoordRec char34_stroke1[] = { - { 71.4286, 100 }, - { 71.4286, 66.6667 }, -}; - -static const StrokeRec char34[] = { - { 2, char34_stroke0 }, - { 2, char34_stroke1 }, -}; - -/* char: 35 '#' */ - -static const CoordRec char35_stroke0[] = { - { 54.7619, 119.048 }, - { 21.4286, -33.3333 }, -}; - -static const CoordRec char35_stroke1[] = { - { 83.3334, 119.048 }, - { 50, -33.3333 }, -}; - -static const CoordRec char35_stroke2[] = { - { 21.4286, 57.1429 }, - { 88.0952, 57.1429 }, -}; - -static const CoordRec char35_stroke3[] = { - { 16.6667, 28.5714 }, - { 83.3334, 28.5714 }, -}; - -static const StrokeRec char35[] = { - { 2, char35_stroke0 }, - { 2, char35_stroke1 }, - { 2, char35_stroke2 }, - { 2, char35_stroke3 }, -}; - -/* char: 36 '$' */ - -static const CoordRec char36_stroke0[] = { - { 42.8571, 119.048 }, - { 42.8571, -19.0476 }, -}; - -static const CoordRec char36_stroke1[] = { - { 61.9047, 119.048 }, - { 61.9047, -19.0476 }, -}; - -static const CoordRec char36_stroke2[] = { - { 85.7143, 85.7143 }, - { 76.1905, 95.2381 }, - { 61.9047, 100 }, - { 42.8571, 100 }, - { 28.5714, 95.2381 }, - { 19.0476, 85.7143 }, - { 19.0476, 76.1905 }, - { 23.8095, 66.6667 }, - { 28.5714, 61.9048 }, - { 38.0952, 57.1429 }, - { 66.6666, 47.619 }, - { 76.1905, 42.8571 }, - { 80.9524, 38.0952 }, - { 85.7143, 28.5714 }, - { 85.7143, 14.2857 }, - { 76.1905, 4.7619 }, - { 61.9047, 0 }, - { 42.8571, 0 }, - { 28.5714, 4.7619 }, - { 19.0476, 14.2857 }, -}; - -static const StrokeRec char36[] = { - { 2, char36_stroke0 }, - { 2, char36_stroke1 }, - { 20, char36_stroke2 }, -}; - -/* char: 37 '%' */ - -static const CoordRec char37_stroke0[] = { - { 95.2381, 100 }, - { 9.5238, 0 }, -}; - -static const CoordRec char37_stroke1[] = { - { 33.3333, 100 }, - { 42.8571, 90.4762 }, - { 42.8571, 80.9524 }, - { 38.0952, 71.4286 }, - { 28.5714, 66.6667 }, - { 19.0476, 66.6667 }, - { 9.5238, 76.1905 }, - { 9.5238, 85.7143 }, - { 14.2857, 95.2381 }, - { 23.8095, 100 }, - { 33.3333, 100 }, - { 42.8571, 95.2381 }, - { 57.1428, 90.4762 }, - { 71.4286, 90.4762 }, - { 85.7143, 95.2381 }, - { 95.2381, 100 }, -}; - -static const CoordRec char37_stroke2[] = { - { 76.1905, 33.3333 }, - { 66.6667, 28.5714 }, - { 61.9048, 19.0476 }, - { 61.9048, 9.5238 }, - { 71.4286, 0 }, - { 80.9524, 0 }, - { 90.4762, 4.7619 }, - { 95.2381, 14.2857 }, - { 95.2381, 23.8095 }, - { 85.7143, 33.3333 }, - { 76.1905, 33.3333 }, -}; - -static const StrokeRec char37[] = { - { 2, char37_stroke0 }, - { 16, char37_stroke1 }, - { 11, char37_stroke2 }, -}; - -/* char: 38 '&' */ - -static const CoordRec char38_stroke0[] = { - { 100, 57.1429 }, - { 100, 61.9048 }, - { 95.2381, 66.6667 }, - { 90.4762, 66.6667 }, - { 85.7143, 61.9048 }, - { 80.9524, 52.381 }, - { 71.4286, 28.5714 }, - { 61.9048, 14.2857 }, - { 52.3809, 4.7619 }, - { 42.8571, 0 }, - { 23.8095, 0 }, - { 14.2857, 4.7619 }, - { 9.5238, 9.5238 }, - { 4.7619, 19.0476 }, - { 4.7619, 28.5714 }, - { 9.5238, 38.0952 }, - { 14.2857, 42.8571 }, - { 47.619, 61.9048 }, - { 52.3809, 66.6667 }, - { 57.1429, 76.1905 }, - { 57.1429, 85.7143 }, - { 52.3809, 95.2381 }, - { 42.8571, 100 }, - { 33.3333, 95.2381 }, - { 28.5714, 85.7143 }, - { 28.5714, 76.1905 }, - { 33.3333, 61.9048 }, - { 42.8571, 47.619 }, - { 66.6667, 14.2857 }, - { 76.1905, 4.7619 }, - { 85.7143, 0 }, - { 95.2381, 0 }, - { 100, 4.7619 }, - { 100, 9.5238 }, -}; - -static const StrokeRec char38[] = { - { 34, char38_stroke0 }, -}; - -/* char: 39 ''' */ - -static const CoordRec char39_stroke0[] = { - { 52.381, 100 }, - { 52.381, 66.6667 }, -}; - -static const StrokeRec char39[] = { - { 2, char39_stroke0 }, -}; - -/* char: 40 '(' */ - -static const CoordRec char40_stroke0[] = { - { 69.0476, 119.048 }, - { 59.5238, 109.524 }, - { 50, 95.2381 }, - { 40.4762, 76.1905 }, - { 35.7143, 52.381 }, - { 35.7143, 33.3333 }, - { 40.4762, 9.5238 }, - { 50, -9.5238 }, - { 59.5238, -23.8095 }, - { 69.0476, -33.3333 }, -}; - -static const StrokeRec char40[] = { - { 10, char40_stroke0 }, -}; - -/* char: 41 ')' */ - -static const CoordRec char41_stroke0[] = { - { 35.7143, 119.048 }, - { 45.2381, 109.524 }, - { 54.7619, 95.2381 }, - { 64.2857, 76.1905 }, - { 69.0476, 52.381 }, - { 69.0476, 33.3333 }, - { 64.2857, 9.5238 }, - { 54.7619, -9.5238 }, - { 45.2381, -23.8095 }, - { 35.7143, -33.3333 }, -}; - -static const StrokeRec char41[] = { - { 10, char41_stroke0 }, -}; - -/* char: 42 '*' */ - -static const CoordRec char42_stroke0[] = { - { 52.381, 71.4286 }, - { 52.381, 14.2857 }, -}; - -static const CoordRec char42_stroke1[] = { - { 28.5715, 57.1429 }, - { 76.1905, 28.5714 }, -}; - -static const CoordRec char42_stroke2[] = { - { 76.1905, 57.1429 }, - { 28.5715, 28.5714 }, -}; - -static const StrokeRec char42[] = { - { 2, char42_stroke0 }, - { 2, char42_stroke1 }, - { 2, char42_stroke2 }, -}; - -/* char: 43 '+' */ - -static const CoordRec char43_stroke0[] = { - { 52.3809, 85.7143 }, - { 52.3809, 0 }, -}; - -static const CoordRec char43_stroke1[] = { - { 9.5238, 42.8571 }, - { 95.2381, 42.8571 }, -}; - -static const StrokeRec char43[] = { - { 2, char43_stroke0 }, - { 2, char43_stroke1 }, -}; - -/* char: 44 ',' */ - -static const CoordRec char44_stroke0[] = { - { 57.1429, 4.7619 }, - { 52.381, 0 }, - { 47.6191, 4.7619 }, - { 52.381, 9.5238 }, - { 57.1429, 4.7619 }, - { 57.1429, -4.7619 }, - { 52.381, -14.2857 }, - { 47.6191, -19.0476 }, -}; - -static const StrokeRec char44[] = { - { 8, char44_stroke0 }, -}; - -/* char: 45 '-' */ - -static const CoordRec char45_stroke0[] = { - { 9.5238, 42.8571 }, - { 95.2381, 42.8571 }, -}; - -static const StrokeRec char45[] = { - { 2, char45_stroke0 }, -}; - -/* char: 46 '.' */ - -static const CoordRec char46_stroke0[] = { - { 52.381, 9.5238 }, - { 47.6191, 4.7619 }, - { 52.381, 0 }, - { 57.1429, 4.7619 }, - { 52.381, 9.5238 }, -}; - -static const StrokeRec char46[] = { - { 5, char46_stroke0 }, -}; - -/* char: 47 '/' */ - -static const CoordRec char47_stroke0[] = { - { 19.0476, -14.2857 }, - { 85.7143, 100 }, -}; - -static const StrokeRec char47[] = { - { 2, char47_stroke0 }, -}; - -/* char: 48 '0' */ - -static const CoordRec char48_stroke0[] = { - { 47.619, 100 }, - { 33.3333, 95.2381 }, - { 23.8095, 80.9524 }, - { 19.0476, 57.1429 }, - { 19.0476, 42.8571 }, - { 23.8095, 19.0476 }, - { 33.3333, 4.7619 }, - { 47.619, 0 }, - { 57.1428, 0 }, - { 71.4286, 4.7619 }, - { 80.9524, 19.0476 }, - { 85.7143, 42.8571 }, - { 85.7143, 57.1429 }, - { 80.9524, 80.9524 }, - { 71.4286, 95.2381 }, - { 57.1428, 100 }, - { 47.619, 100 }, -}; - -static const StrokeRec char48[] = { - { 17, char48_stroke0 }, -}; - -/* char: 49 '1' */ - -static const CoordRec char49_stroke0[] = { - { 40.4762, 80.9524 }, - { 50, 85.7143 }, - { 64.2857, 100 }, - { 64.2857, 0 }, -}; - -static const StrokeRec char49[] = { - { 4, char49_stroke0 }, -}; - -/* char: 50 '2' */ - -static const CoordRec char50_stroke0[] = { - { 23.8095, 76.1905 }, - { 23.8095, 80.9524 }, - { 28.5714, 90.4762 }, - { 33.3333, 95.2381 }, - { 42.8571, 100 }, - { 61.9047, 100 }, - { 71.4286, 95.2381 }, - { 76.1905, 90.4762 }, - { 80.9524, 80.9524 }, - { 80.9524, 71.4286 }, - { 76.1905, 61.9048 }, - { 66.6666, 47.619 }, - { 19.0476, 0 }, - { 85.7143, 0 }, -}; - -static const StrokeRec char50[] = { - { 14, char50_stroke0 }, -}; - -/* char: 51 '3' */ - -static const CoordRec char51_stroke0[] = { - { 28.5714, 100 }, - { 80.9524, 100 }, - { 52.3809, 61.9048 }, - { 66.6666, 61.9048 }, - { 76.1905, 57.1429 }, - { 80.9524, 52.381 }, - { 85.7143, 38.0952 }, - { 85.7143, 28.5714 }, - { 80.9524, 14.2857 }, - { 71.4286, 4.7619 }, - { 57.1428, 0 }, - { 42.8571, 0 }, - { 28.5714, 4.7619 }, - { 23.8095, 9.5238 }, - { 19.0476, 19.0476 }, -}; - -static const StrokeRec char51[] = { - { 15, char51_stroke0 }, -}; - -/* char: 52 '4' */ - -static const CoordRec char52_stroke0[] = { - { 64.2857, 100 }, - { 16.6667, 33.3333 }, - { 88.0952, 33.3333 }, -}; - -static const CoordRec char52_stroke1[] = { - { 64.2857, 100 }, - { 64.2857, 0 }, -}; - -static const StrokeRec char52[] = { - { 3, char52_stroke0 }, - { 2, char52_stroke1 }, -}; - -/* char: 53 '5' */ - -static const CoordRec char53_stroke0[] = { - { 76.1905, 100 }, - { 28.5714, 100 }, - { 23.8095, 57.1429 }, - { 28.5714, 61.9048 }, - { 42.8571, 66.6667 }, - { 57.1428, 66.6667 }, - { 71.4286, 61.9048 }, - { 80.9524, 52.381 }, - { 85.7143, 38.0952 }, - { 85.7143, 28.5714 }, - { 80.9524, 14.2857 }, - { 71.4286, 4.7619 }, - { 57.1428, 0 }, - { 42.8571, 0 }, - { 28.5714, 4.7619 }, - { 23.8095, 9.5238 }, - { 19.0476, 19.0476 }, -}; - -static const StrokeRec char53[] = { - { 17, char53_stroke0 }, -}; - -/* char: 54 '6' */ - -static const CoordRec char54_stroke0[] = { - { 78.5714, 85.7143 }, - { 73.8096, 95.2381 }, - { 59.5238, 100 }, - { 50, 100 }, - { 35.7143, 95.2381 }, - { 26.1905, 80.9524 }, - { 21.4286, 57.1429 }, - { 21.4286, 33.3333 }, - { 26.1905, 14.2857 }, - { 35.7143, 4.7619 }, - { 50, 0 }, - { 54.7619, 0 }, - { 69.0476, 4.7619 }, - { 78.5714, 14.2857 }, - { 83.3334, 28.5714 }, - { 83.3334, 33.3333 }, - { 78.5714, 47.619 }, - { 69.0476, 57.1429 }, - { 54.7619, 61.9048 }, - { 50, 61.9048 }, - { 35.7143, 57.1429 }, - { 26.1905, 47.619 }, - { 21.4286, 33.3333 }, -}; - -static const StrokeRec char54[] = { - { 23, char54_stroke0 }, -}; - -/* char: 55 '7' */ - -static const CoordRec char55_stroke0[] = { - { 85.7143, 100 }, - { 38.0952, 0 }, -}; - -static const CoordRec char55_stroke1[] = { - { 19.0476, 100 }, - { 85.7143, 100 }, -}; - -static const StrokeRec char55[] = { - { 2, char55_stroke0 }, - { 2, char55_stroke1 }, -}; - -/* char: 56 '8' */ - -static const CoordRec char56_stroke0[] = { - { 42.8571, 100 }, - { 28.5714, 95.2381 }, - { 23.8095, 85.7143 }, - { 23.8095, 76.1905 }, - { 28.5714, 66.6667 }, - { 38.0952, 61.9048 }, - { 57.1428, 57.1429 }, - { 71.4286, 52.381 }, - { 80.9524, 42.8571 }, - { 85.7143, 33.3333 }, - { 85.7143, 19.0476 }, - { 80.9524, 9.5238 }, - { 76.1905, 4.7619 }, - { 61.9047, 0 }, - { 42.8571, 0 }, - { 28.5714, 4.7619 }, - { 23.8095, 9.5238 }, - { 19.0476, 19.0476 }, - { 19.0476, 33.3333 }, - { 23.8095, 42.8571 }, - { 33.3333, 52.381 }, - { 47.619, 57.1429 }, - { 66.6666, 61.9048 }, - { 76.1905, 66.6667 }, - { 80.9524, 76.1905 }, - { 80.9524, 85.7143 }, - { 76.1905, 95.2381 }, - { 61.9047, 100 }, - { 42.8571, 100 }, -}; - -static const StrokeRec char56[] = { - { 29, char56_stroke0 }, -}; - -/* char: 57 '9' */ - -static const CoordRec char57_stroke0[] = { - { 83.3334, 66.6667 }, - { 78.5714, 52.381 }, - { 69.0476, 42.8571 }, - { 54.7619, 38.0952 }, - { 50, 38.0952 }, - { 35.7143, 42.8571 }, - { 26.1905, 52.381 }, - { 21.4286, 66.6667 }, - { 21.4286, 71.4286 }, - { 26.1905, 85.7143 }, - { 35.7143, 95.2381 }, - { 50, 100 }, - { 54.7619, 100 }, - { 69.0476, 95.2381 }, - { 78.5714, 85.7143 }, - { 83.3334, 66.6667 }, - { 83.3334, 42.8571 }, - { 78.5714, 19.0476 }, - { 69.0476, 4.7619 }, - { 54.7619, 0 }, - { 45.2381, 0 }, - { 30.9524, 4.7619 }, - { 26.1905, 14.2857 }, -}; - -static const StrokeRec char57[] = { - { 23, char57_stroke0 }, -}; - -/* char: 58 ':' */ - -static const CoordRec char58_stroke0[] = { - { 52.381, 66.6667 }, - { 47.6191, 61.9048 }, - { 52.381, 57.1429 }, - { 57.1429, 61.9048 }, - { 52.381, 66.6667 }, -}; - -static const CoordRec char58_stroke1[] = { - { 52.381, 9.5238 }, - { 47.6191, 4.7619 }, - { 52.381, 0 }, - { 57.1429, 4.7619 }, - { 52.381, 9.5238 }, -}; - -static const StrokeRec char58[] = { - { 5, char58_stroke0 }, - { 5, char58_stroke1 }, -}; - -/* char: 59 ';' */ - -static const CoordRec char59_stroke0[] = { - { 52.381, 66.6667 }, - { 47.6191, 61.9048 }, - { 52.381, 57.1429 }, - { 57.1429, 61.9048 }, - { 52.381, 66.6667 }, -}; - -static const CoordRec char59_stroke1[] = { - { 57.1429, 4.7619 }, - { 52.381, 0 }, - { 47.6191, 4.7619 }, - { 52.381, 9.5238 }, - { 57.1429, 4.7619 }, - { 57.1429, -4.7619 }, - { 52.381, -14.2857 }, - { 47.6191, -19.0476 }, -}; - -static const StrokeRec char59[] = { - { 5, char59_stroke0 }, - { 8, char59_stroke1 }, -}; - -/* char: 60 '<' */ - -static const CoordRec char60_stroke0[] = { - { 90.4762, 85.7143 }, - { 14.2857, 42.8571 }, - { 90.4762, 0 }, -}; - -static const StrokeRec char60[] = { - { 3, char60_stroke0 }, -}; - -/* char: 61 '=' */ - -static const CoordRec char61_stroke0[] = { - { 9.5238, 57.1429 }, - { 95.2381, 57.1429 }, -}; - -static const CoordRec char61_stroke1[] = { - { 9.5238, 28.5714 }, - { 95.2381, 28.5714 }, -}; - -static const StrokeRec char61[] = { - { 2, char61_stroke0 }, - { 2, char61_stroke1 }, -}; - -/* char: 62 '>' */ - -static const CoordRec char62_stroke0[] = { - { 14.2857, 85.7143 }, - { 90.4762, 42.8571 }, - { 14.2857, 0 }, -}; - -static const StrokeRec char62[] = { - { 3, char62_stroke0 }, -}; - -/* char: 63 '?' */ - -static const CoordRec char63_stroke0[] = { - { 23.8095, 76.1905 }, - { 23.8095, 80.9524 }, - { 28.5714, 90.4762 }, - { 33.3333, 95.2381 }, - { 42.8571, 100 }, - { 61.9047, 100 }, - { 71.4285, 95.2381 }, - { 76.1905, 90.4762 }, - { 80.9524, 80.9524 }, - { 80.9524, 71.4286 }, - { 76.1905, 61.9048 }, - { 71.4285, 57.1429 }, - { 52.3809, 47.619 }, - { 52.3809, 33.3333 }, -}; - -static const CoordRec char63_stroke1[] = { - { 52.3809, 9.5238 }, - { 47.619, 4.7619 }, - { 52.3809, 0 }, - { 57.1428, 4.7619 }, - { 52.3809, 9.5238 }, -}; - -static const StrokeRec char63[] = { - { 14, char63_stroke0 }, - { 5, char63_stroke1 }, -}; - -/* char: 64 '@' */ - -static const CoordRec char64_stroke0[] = { - { 64.2857, 52.381 }, - { 54.7619, 57.1429 }, - { 45.2381, 57.1429 }, - { 40.4762, 47.619 }, - { 40.4762, 42.8571 }, - { 45.2381, 33.3333 }, - { 54.7619, 33.3333 }, - { 64.2857, 38.0952 }, -}; - -static const CoordRec char64_stroke1[] = { - { 64.2857, 57.1429 }, - { 64.2857, 38.0952 }, - { 69.0476, 33.3333 }, - { 78.5714, 33.3333 }, - { 83.3334, 42.8571 }, - { 83.3334, 47.619 }, - { 78.5714, 61.9048 }, - { 69.0476, 71.4286 }, - { 54.7619, 76.1905 }, - { 50, 76.1905 }, - { 35.7143, 71.4286 }, - { 26.1905, 61.9048 }, - { 21.4286, 47.619 }, - { 21.4286, 42.8571 }, - { 26.1905, 28.5714 }, - { 35.7143, 19.0476 }, - { 50, 14.2857 }, - { 54.7619, 14.2857 }, - { 69.0476, 19.0476 }, -}; - -static const StrokeRec char64[] = { - { 8, char64_stroke0 }, - { 19, char64_stroke1 }, -}; - -/* char: 65 'A' */ - -static const CoordRec char65_stroke0[] = { - { 52.3809, 100 }, - { 14.2857, 0 }, -}; - -static const CoordRec char65_stroke1[] = { - { 52.3809, 100 }, - { 90.4762, 0 }, -}; - -static const CoordRec char65_stroke2[] = { - { 28.5714, 33.3333 }, - { 76.1905, 33.3333 }, -}; - -static const StrokeRec char65[] = { - { 2, char65_stroke0 }, - { 2, char65_stroke1 }, - { 2, char65_stroke2 }, -}; - -/* char: 66 'B' */ - -static const CoordRec char66_stroke0[] = { - { 19.0476, 100 }, - { 19.0476, 0 }, -}; - -static const CoordRec char66_stroke1[] = { - { 19.0476, 100 }, - { 61.9047, 100 }, - { 76.1905, 95.2381 }, - { 80.9524, 90.4762 }, - { 85.7143, 80.9524 }, - { 85.7143, 71.4286 }, - { 80.9524, 61.9048 }, - { 76.1905, 57.1429 }, - { 61.9047, 52.381 }, -}; - -static const CoordRec char66_stroke2[] = { - { 19.0476, 52.381 }, - { 61.9047, 52.381 }, - { 76.1905, 47.619 }, - { 80.9524, 42.8571 }, - { 85.7143, 33.3333 }, - { 85.7143, 19.0476 }, - { 80.9524, 9.5238 }, - { 76.1905, 4.7619 }, - { 61.9047, 0 }, - { 19.0476, 0 }, -}; - -static const StrokeRec char66[] = { - { 2, char66_stroke0 }, - { 9, char66_stroke1 }, - { 10, char66_stroke2 }, -}; - -/* char: 67 'C' */ - -static const CoordRec char67_stroke0[] = { - { 88.0952, 76.1905 }, - { 83.3334, 85.7143 }, - { 73.8096, 95.2381 }, - { 64.2857, 100 }, - { 45.2381, 100 }, - { 35.7143, 95.2381 }, - { 26.1905, 85.7143 }, - { 21.4286, 76.1905 }, - { 16.6667, 61.9048 }, - { 16.6667, 38.0952 }, - { 21.4286, 23.8095 }, - { 26.1905, 14.2857 }, - { 35.7143, 4.7619 }, - { 45.2381, 0 }, - { 64.2857, 0 }, - { 73.8096, 4.7619 }, - { 83.3334, 14.2857 }, - { 88.0952, 23.8095 }, -}; - -static const StrokeRec char67[] = { - { 18, char67_stroke0 }, -}; - -/* char: 68 'D' */ - -static const CoordRec char68_stroke0[] = { - { 19.0476, 100 }, - { 19.0476, 0 }, -}; - -static const CoordRec char68_stroke1[] = { - { 19.0476, 100 }, - { 52.3809, 100 }, - { 66.6666, 95.2381 }, - { 76.1905, 85.7143 }, - { 80.9524, 76.1905 }, - { 85.7143, 61.9048 }, - { 85.7143, 38.0952 }, - { 80.9524, 23.8095 }, - { 76.1905, 14.2857 }, - { 66.6666, 4.7619 }, - { 52.3809, 0 }, - { 19.0476, 0 }, -}; - -static const StrokeRec char68[] = { - { 2, char68_stroke0 }, - { 12, char68_stroke1 }, -}; - -/* char: 69 'E' */ - -static const CoordRec char69_stroke0[] = { - { 21.4286, 100 }, - { 21.4286, 0 }, -}; - -static const CoordRec char69_stroke1[] = { - { 21.4286, 100 }, - { 83.3334, 100 }, -}; - -static const CoordRec char69_stroke2[] = { - { 21.4286, 52.381 }, - { 59.5238, 52.381 }, -}; - -static const CoordRec char69_stroke3[] = { - { 21.4286, 0 }, - { 83.3334, 0 }, -}; - -static const StrokeRec char69[] = { - { 2, char69_stroke0 }, - { 2, char69_stroke1 }, - { 2, char69_stroke2 }, - { 2, char69_stroke3 }, -}; - -/* char: 70 'F' */ - -static const CoordRec char70_stroke0[] = { - { 21.4286, 100 }, - { 21.4286, 0 }, -}; - -static const CoordRec char70_stroke1[] = { - { 21.4286, 100 }, - { 83.3334, 100 }, -}; - -static const CoordRec char70_stroke2[] = { - { 21.4286, 52.381 }, - { 59.5238, 52.381 }, -}; - -static const StrokeRec char70[] = { - { 2, char70_stroke0 }, - { 2, char70_stroke1 }, - { 2, char70_stroke2 }, -}; - -/* char: 71 'G' */ - -static const CoordRec char71_stroke0[] = { - { 88.0952, 76.1905 }, - { 83.3334, 85.7143 }, - { 73.8096, 95.2381 }, - { 64.2857, 100 }, - { 45.2381, 100 }, - { 35.7143, 95.2381 }, - { 26.1905, 85.7143 }, - { 21.4286, 76.1905 }, - { 16.6667, 61.9048 }, - { 16.6667, 38.0952 }, - { 21.4286, 23.8095 }, - { 26.1905, 14.2857 }, - { 35.7143, 4.7619 }, - { 45.2381, 0 }, - { 64.2857, 0 }, - { 73.8096, 4.7619 }, - { 83.3334, 14.2857 }, - { 88.0952, 23.8095 }, - { 88.0952, 38.0952 }, -}; - -static const CoordRec char71_stroke1[] = { - { 64.2857, 38.0952 }, - { 88.0952, 38.0952 }, -}; - -static const StrokeRec char71[] = { - { 19, char71_stroke0 }, - { 2, char71_stroke1 }, -}; - -/* char: 72 'H' */ - -static const CoordRec char72_stroke0[] = { - { 19.0476, 100 }, - { 19.0476, 0 }, -}; - -static const CoordRec char72_stroke1[] = { - { 85.7143, 100 }, - { 85.7143, 0 }, -}; - -static const CoordRec char72_stroke2[] = { - { 19.0476, 52.381 }, - { 85.7143, 52.381 }, -}; - -static const StrokeRec char72[] = { - { 2, char72_stroke0 }, - { 2, char72_stroke1 }, - { 2, char72_stroke2 }, -}; - -/* char: 73 'I' */ - -static const CoordRec char73_stroke0[] = { - { 52.381, 100 }, - { 52.381, 0 }, -}; - -static const StrokeRec char73[] = { - { 2, char73_stroke0 }, -}; - -/* char: 74 'J' */ - -static const CoordRec char74_stroke0[] = { - { 76.1905, 100 }, - { 76.1905, 23.8095 }, - { 71.4286, 9.5238 }, - { 66.6667, 4.7619 }, - { 57.1429, 0 }, - { 47.6191, 0 }, - { 38.0953, 4.7619 }, - { 33.3334, 9.5238 }, - { 28.5715, 23.8095 }, - { 28.5715, 33.3333 }, -}; - -static const StrokeRec char74[] = { - { 10, char74_stroke0 }, -}; - -/* char: 75 'K' */ - -static const CoordRec char75_stroke0[] = { - { 19.0476, 100 }, - { 19.0476, 0 }, -}; - -static const CoordRec char75_stroke1[] = { - { 85.7143, 100 }, - { 19.0476, 33.3333 }, -}; - -static const CoordRec char75_stroke2[] = { - { 42.8571, 57.1429 }, - { 85.7143, 0 }, -}; - -static const StrokeRec char75[] = { - { 2, char75_stroke0 }, - { 2, char75_stroke1 }, - { 2, char75_stroke2 }, -}; - -/* char: 76 'L' */ - -static const CoordRec char76_stroke0[] = { - { 23.8095, 100 }, - { 23.8095, 0 }, -}; - -static const CoordRec char76_stroke1[] = { - { 23.8095, 0 }, - { 80.9524, 0 }, -}; - -static const StrokeRec char76[] = { - { 2, char76_stroke0 }, - { 2, char76_stroke1 }, -}; - -/* char: 77 'M' */ - -static const CoordRec char77_stroke0[] = { - { 14.2857, 100 }, - { 14.2857, 0 }, -}; - -static const CoordRec char77_stroke1[] = { - { 14.2857, 100 }, - { 52.3809, 0 }, -}; - -static const CoordRec char77_stroke2[] = { - { 90.4762, 100 }, - { 52.3809, 0 }, -}; - -static const CoordRec char77_stroke3[] = { - { 90.4762, 100 }, - { 90.4762, 0 }, -}; - -static const StrokeRec char77[] = { - { 2, char77_stroke0 }, - { 2, char77_stroke1 }, - { 2, char77_stroke2 }, - { 2, char77_stroke3 }, -}; - -/* char: 78 'N' */ - -static const CoordRec char78_stroke0[] = { - { 19.0476, 100 }, - { 19.0476, 0 }, -}; - -static const CoordRec char78_stroke1[] = { - { 19.0476, 100 }, - { 85.7143, 0 }, -}; - -static const CoordRec char78_stroke2[] = { - { 85.7143, 100 }, - { 85.7143, 0 }, -}; - -static const StrokeRec char78[] = { - { 2, char78_stroke0 }, - { 2, char78_stroke1 }, - { 2, char78_stroke2 }, -}; - -/* char: 79 'O' */ - -static const CoordRec char79_stroke0[] = { - { 42.8571, 100 }, - { 33.3333, 95.2381 }, - { 23.8095, 85.7143 }, - { 19.0476, 76.1905 }, - { 14.2857, 61.9048 }, - { 14.2857, 38.0952 }, - { 19.0476, 23.8095 }, - { 23.8095, 14.2857 }, - { 33.3333, 4.7619 }, - { 42.8571, 0 }, - { 61.9047, 0 }, - { 71.4286, 4.7619 }, - { 80.9524, 14.2857 }, - { 85.7143, 23.8095 }, - { 90.4762, 38.0952 }, - { 90.4762, 61.9048 }, - { 85.7143, 76.1905 }, - { 80.9524, 85.7143 }, - { 71.4286, 95.2381 }, - { 61.9047, 100 }, - { 42.8571, 100 }, -}; - -static const StrokeRec char79[] = { - { 21, char79_stroke0 }, -}; - -/* char: 80 'P' */ - -static const CoordRec char80_stroke0[] = { - { 19.0476, 100 }, - { 19.0476, 0 }, -}; - -static const CoordRec char80_stroke1[] = { - { 19.0476, 100 }, - { 61.9047, 100 }, - { 76.1905, 95.2381 }, - { 80.9524, 90.4762 }, - { 85.7143, 80.9524 }, - { 85.7143, 66.6667 }, - { 80.9524, 57.1429 }, - { 76.1905, 52.381 }, - { 61.9047, 47.619 }, - { 19.0476, 47.619 }, -}; - -static const StrokeRec char80[] = { - { 2, char80_stroke0 }, - { 10, char80_stroke1 }, -}; - -/* char: 81 'Q' */ - -static const CoordRec char81_stroke0[] = { - { 42.8571, 100 }, - { 33.3333, 95.2381 }, - { 23.8095, 85.7143 }, - { 19.0476, 76.1905 }, - { 14.2857, 61.9048 }, - { 14.2857, 38.0952 }, - { 19.0476, 23.8095 }, - { 23.8095, 14.2857 }, - { 33.3333, 4.7619 }, - { 42.8571, 0 }, - { 61.9047, 0 }, - { 71.4286, 4.7619 }, - { 80.9524, 14.2857 }, - { 85.7143, 23.8095 }, - { 90.4762, 38.0952 }, - { 90.4762, 61.9048 }, - { 85.7143, 76.1905 }, - { 80.9524, 85.7143 }, - { 71.4286, 95.2381 }, - { 61.9047, 100 }, - { 42.8571, 100 }, -}; - -static const CoordRec char81_stroke1[] = { - { 57.1428, 19.0476 }, - { 85.7143, -9.5238 }, -}; - -static const StrokeRec char81[] = { - { 21, char81_stroke0 }, - { 2, char81_stroke1 }, -}; - -/* char: 82 'R' */ - -static const CoordRec char82_stroke0[] = { - { 19.0476, 100 }, - { 19.0476, 0 }, -}; - -static const CoordRec char82_stroke1[] = { - { 19.0476, 100 }, - { 61.9047, 100 }, - { 76.1905, 95.2381 }, - { 80.9524, 90.4762 }, - { 85.7143, 80.9524 }, - { 85.7143, 71.4286 }, - { 80.9524, 61.9048 }, - { 76.1905, 57.1429 }, - { 61.9047, 52.381 }, - { 19.0476, 52.381 }, -}; - -static const CoordRec char82_stroke2[] = { - { 52.3809, 52.381 }, - { 85.7143, 0 }, -}; - -static const StrokeRec char82[] = { - { 2, char82_stroke0 }, - { 10, char82_stroke1 }, - { 2, char82_stroke2 }, -}; - -/* char: 83 'S' */ - -static const CoordRec char83_stroke0[] = { - { 85.7143, 85.7143 }, - { 76.1905, 95.2381 }, - { 61.9047, 100 }, - { 42.8571, 100 }, - { 28.5714, 95.2381 }, - { 19.0476, 85.7143 }, - { 19.0476, 76.1905 }, - { 23.8095, 66.6667 }, - { 28.5714, 61.9048 }, - { 38.0952, 57.1429 }, - { 66.6666, 47.619 }, - { 76.1905, 42.8571 }, - { 80.9524, 38.0952 }, - { 85.7143, 28.5714 }, - { 85.7143, 14.2857 }, - { 76.1905, 4.7619 }, - { 61.9047, 0 }, - { 42.8571, 0 }, - { 28.5714, 4.7619 }, - { 19.0476, 14.2857 }, -}; - -static const StrokeRec char83[] = { - { 20, char83_stroke0 }, -}; - -/* char: 84 'T' */ - -static const CoordRec char84_stroke0[] = { - { 52.3809, 100 }, - { 52.3809, 0 }, -}; - -static const CoordRec char84_stroke1[] = { - { 19.0476, 100 }, - { 85.7143, 100 }, -}; - -static const StrokeRec char84[] = { - { 2, char84_stroke0 }, - { 2, char84_stroke1 }, -}; - -/* char: 85 'U' */ - -static const CoordRec char85_stroke0[] = { - { 19.0476, 100 }, - { 19.0476, 28.5714 }, - { 23.8095, 14.2857 }, - { 33.3333, 4.7619 }, - { 47.619, 0 }, - { 57.1428, 0 }, - { 71.4286, 4.7619 }, - { 80.9524, 14.2857 }, - { 85.7143, 28.5714 }, - { 85.7143, 100 }, -}; - -static const StrokeRec char85[] = { - { 10, char85_stroke0 }, -}; - -/* char: 86 'V' */ - -static const CoordRec char86_stroke0[] = { - { 14.2857, 100 }, - { 52.3809, 0 }, -}; - -static const CoordRec char86_stroke1[] = { - { 90.4762, 100 }, - { 52.3809, 0 }, -}; - -static const StrokeRec char86[] = { - { 2, char86_stroke0 }, - { 2, char86_stroke1 }, -}; - -/* char: 87 'W' */ - -static const CoordRec char87_stroke0[] = { - { 4.7619, 100 }, - { 28.5714, 0 }, -}; - -static const CoordRec char87_stroke1[] = { - { 52.3809, 100 }, - { 28.5714, 0 }, -}; - -static const CoordRec char87_stroke2[] = { - { 52.3809, 100 }, - { 76.1905, 0 }, -}; - -static const CoordRec char87_stroke3[] = { - { 100, 100 }, - { 76.1905, 0 }, -}; - -static const StrokeRec char87[] = { - { 2, char87_stroke0 }, - { 2, char87_stroke1 }, - { 2, char87_stroke2 }, - { 2, char87_stroke3 }, -}; - -/* char: 88 'X' */ - -static const CoordRec char88_stroke0[] = { - { 19.0476, 100 }, - { 85.7143, 0 }, -}; - -static const CoordRec char88_stroke1[] = { - { 85.7143, 100 }, - { 19.0476, 0 }, -}; - -static const StrokeRec char88[] = { - { 2, char88_stroke0 }, - { 2, char88_stroke1 }, -}; - -/* char: 89 'Y' */ - -static const CoordRec char89_stroke0[] = { - { 14.2857, 100 }, - { 52.3809, 52.381 }, - { 52.3809, 0 }, -}; - -static const CoordRec char89_stroke1[] = { - { 90.4762, 100 }, - { 52.3809, 52.381 }, -}; - -static const StrokeRec char89[] = { - { 3, char89_stroke0 }, - { 2, char89_stroke1 }, -}; - -/* char: 90 'Z' */ - -static const CoordRec char90_stroke0[] = { - { 85.7143, 100 }, - { 19.0476, 0 }, -}; - -static const CoordRec char90_stroke1[] = { - { 19.0476, 100 }, - { 85.7143, 100 }, -}; - -static const CoordRec char90_stroke2[] = { - { 19.0476, 0 }, - { 85.7143, 0 }, -}; - -static const StrokeRec char90[] = { - { 2, char90_stroke0 }, - { 2, char90_stroke1 }, - { 2, char90_stroke2 }, -}; - -/* char: 91 '[' */ - -static const CoordRec char91_stroke0[] = { - { 35.7143, 119.048 }, - { 35.7143, -33.3333 }, -}; - -static const CoordRec char91_stroke1[] = { - { 40.4762, 119.048 }, - { 40.4762, -33.3333 }, -}; - -static const CoordRec char91_stroke2[] = { - { 35.7143, 119.048 }, - { 69.0476, 119.048 }, -}; - -static const CoordRec char91_stroke3[] = { - { 35.7143, -33.3333 }, - { 69.0476, -33.3333 }, -}; - -static const StrokeRec char91[] = { - { 2, char91_stroke0 }, - { 2, char91_stroke1 }, - { 2, char91_stroke2 }, - { 2, char91_stroke3 }, -}; - -/* char: 92 '\' */ - -static const CoordRec char92_stroke0[] = { - { 19.0476, 100 }, - { 85.7143, -14.2857 }, -}; - -static const StrokeRec char92[] = { - { 2, char92_stroke0 }, -}; - -/* char: 93 ']' */ - -static const CoordRec char93_stroke0[] = { - { 64.2857, 119.048 }, - { 64.2857, -33.3333 }, -}; - -static const CoordRec char93_stroke1[] = { - { 69.0476, 119.048 }, - { 69.0476, -33.3333 }, -}; - -static const CoordRec char93_stroke2[] = { - { 35.7143, 119.048 }, - { 69.0476, 119.048 }, -}; - -static const CoordRec char93_stroke3[] = { - { 35.7143, -33.3333 }, - { 69.0476, -33.3333 }, -}; - -static const StrokeRec char93[] = { - { 2, char93_stroke0 }, - { 2, char93_stroke1 }, - { 2, char93_stroke2 }, - { 2, char93_stroke3 }, -}; - -/* char: 94 '^' */ - -static const CoordRec char94_stroke0[] = { - { 52.3809, 109.524 }, - { 14.2857, 42.8571 }, -}; - -static const CoordRec char94_stroke1[] = { - { 52.3809, 109.524 }, - { 90.4762, 42.8571 }, -}; - -static const StrokeRec char94[] = { - { 2, char94_stroke0 }, - { 2, char94_stroke1 }, -}; - -/* char: 95 '_' */ - -static const CoordRec char95_stroke0[] = { - { 0, -33.3333 }, - { 104.762, -33.3333 }, - { 104.762, -28.5714 }, - { 0, -28.5714 }, - { 0, -33.3333 }, -}; - -static const StrokeRec char95[] = { - { 5, char95_stroke0 }, -}; - -/* char: 96 '`' */ - -static const CoordRec char96_stroke0[] = { - { 42.8572, 100 }, - { 66.6667, 71.4286 }, -}; - -static const CoordRec char96_stroke1[] = { - { 42.8572, 100 }, - { 38.0953, 95.2381 }, - { 66.6667, 71.4286 }, -}; - -static const StrokeRec char96[] = { - { 2, char96_stroke0 }, - { 3, char96_stroke1 }, -}; - -/* char: 97 'a' */ - -static const CoordRec char97_stroke0[] = { - { 80.9524, 66.6667 }, - { 80.9524, 0 }, -}; - -static const CoordRec char97_stroke1[] = { - { 80.9524, 52.381 }, - { 71.4285, 61.9048 }, - { 61.9047, 66.6667 }, - { 47.619, 66.6667 }, - { 38.0952, 61.9048 }, - { 28.5714, 52.381 }, - { 23.8095, 38.0952 }, - { 23.8095, 28.5714 }, - { 28.5714, 14.2857 }, - { 38.0952, 4.7619 }, - { 47.619, 0 }, - { 61.9047, 0 }, - { 71.4285, 4.7619 }, - { 80.9524, 14.2857 }, -}; - -static const StrokeRec char97[] = { - { 2, char97_stroke0 }, - { 14, char97_stroke1 }, -}; - -/* char: 98 'b' */ - -static const CoordRec char98_stroke0[] = { - { 23.8095, 100 }, - { 23.8095, 0 }, -}; - -static const CoordRec char98_stroke1[] = { - { 23.8095, 52.381 }, - { 33.3333, 61.9048 }, - { 42.8571, 66.6667 }, - { 57.1428, 66.6667 }, - { 66.6666, 61.9048 }, - { 76.1905, 52.381 }, - { 80.9524, 38.0952 }, - { 80.9524, 28.5714 }, - { 76.1905, 14.2857 }, - { 66.6666, 4.7619 }, - { 57.1428, 0 }, - { 42.8571, 0 }, - { 33.3333, 4.7619 }, - { 23.8095, 14.2857 }, -}; - -static const StrokeRec char98[] = { - { 2, char98_stroke0 }, - { 14, char98_stroke1 }, -}; - -/* char: 99 'c' */ - -static const CoordRec char99_stroke0[] = { - { 80.9524, 52.381 }, - { 71.4285, 61.9048 }, - { 61.9047, 66.6667 }, - { 47.619, 66.6667 }, - { 38.0952, 61.9048 }, - { 28.5714, 52.381 }, - { 23.8095, 38.0952 }, - { 23.8095, 28.5714 }, - { 28.5714, 14.2857 }, - { 38.0952, 4.7619 }, - { 47.619, 0 }, - { 61.9047, 0 }, - { 71.4285, 4.7619 }, - { 80.9524, 14.2857 }, -}; - -static const StrokeRec char99[] = { - { 14, char99_stroke0 }, -}; - -/* char: 100 'd' */ - -static const CoordRec char100_stroke0[] = { - { 80.9524, 100 }, - { 80.9524, 0 }, -}; - -static const CoordRec char100_stroke1[] = { - { 80.9524, 52.381 }, - { 71.4285, 61.9048 }, - { 61.9047, 66.6667 }, - { 47.619, 66.6667 }, - { 38.0952, 61.9048 }, - { 28.5714, 52.381 }, - { 23.8095, 38.0952 }, - { 23.8095, 28.5714 }, - { 28.5714, 14.2857 }, - { 38.0952, 4.7619 }, - { 47.619, 0 }, - { 61.9047, 0 }, - { 71.4285, 4.7619 }, - { 80.9524, 14.2857 }, -}; - -static const StrokeRec char100[] = { - { 2, char100_stroke0 }, - { 14, char100_stroke1 }, -}; - -/* char: 101 'e' */ - -static const CoordRec char101_stroke0[] = { - { 23.8095, 38.0952 }, - { 80.9524, 38.0952 }, - { 80.9524, 47.619 }, - { 76.1905, 57.1429 }, - { 71.4285, 61.9048 }, - { 61.9047, 66.6667 }, - { 47.619, 66.6667 }, - { 38.0952, 61.9048 }, - { 28.5714, 52.381 }, - { 23.8095, 38.0952 }, - { 23.8095, 28.5714 }, - { 28.5714, 14.2857 }, - { 38.0952, 4.7619 }, - { 47.619, 0 }, - { 61.9047, 0 }, - { 71.4285, 4.7619 }, - { 80.9524, 14.2857 }, -}; - -static const StrokeRec char101[] = { - { 17, char101_stroke0 }, -}; - -/* char: 102 'f' */ - -static const CoordRec char102_stroke0[] = { - { 71.4286, 100 }, - { 61.9048, 100 }, - { 52.381, 95.2381 }, - { 47.6191, 80.9524 }, - { 47.6191, 0 }, -}; - -static const CoordRec char102_stroke1[] = { - { 33.3334, 66.6667 }, - { 66.6667, 66.6667 }, -}; - -static const StrokeRec char102[] = { - { 5, char102_stroke0 }, - { 2, char102_stroke1 }, -}; - -/* char: 103 'g' */ - -static const CoordRec char103_stroke0[] = { - { 80.9524, 66.6667 }, - { 80.9524, -9.5238 }, - { 76.1905, -23.8095 }, - { 71.4285, -28.5714 }, - { 61.9047, -33.3333 }, - { 47.619, -33.3333 }, - { 38.0952, -28.5714 }, -}; - -static const CoordRec char103_stroke1[] = { - { 80.9524, 52.381 }, - { 71.4285, 61.9048 }, - { 61.9047, 66.6667 }, - { 47.619, 66.6667 }, - { 38.0952, 61.9048 }, - { 28.5714, 52.381 }, - { 23.8095, 38.0952 }, - { 23.8095, 28.5714 }, - { 28.5714, 14.2857 }, - { 38.0952, 4.7619 }, - { 47.619, 0 }, - { 61.9047, 0 }, - { 71.4285, 4.7619 }, - { 80.9524, 14.2857 }, -}; - -static const StrokeRec char103[] = { - { 7, char103_stroke0 }, - { 14, char103_stroke1 }, -}; - -/* char: 104 'h' */ - -static const CoordRec char104_stroke0[] = { - { 26.1905, 100 }, - { 26.1905, 0 }, -}; - -static const CoordRec char104_stroke1[] = { - { 26.1905, 47.619 }, - { 40.4762, 61.9048 }, - { 50, 66.6667 }, - { 64.2857, 66.6667 }, - { 73.8095, 61.9048 }, - { 78.5715, 47.619 }, - { 78.5715, 0 }, -}; - -static const StrokeRec char104[] = { - { 2, char104_stroke0 }, - { 7, char104_stroke1 }, -}; - -/* char: 105 'i' */ - -static const CoordRec char105_stroke0[] = { - { 47.6191, 100 }, - { 52.381, 95.2381 }, - { 57.1429, 100 }, - { 52.381, 104.762 }, - { 47.6191, 100 }, -}; - -static const CoordRec char105_stroke1[] = { - { 52.381, 66.6667 }, - { 52.381, 0 }, -}; - -static const StrokeRec char105[] = { - { 5, char105_stroke0 }, - { 2, char105_stroke1 }, -}; - -/* char: 106 'j' */ - -static const CoordRec char106_stroke0[] = { - { 57.1429, 100 }, - { 61.9048, 95.2381 }, - { 66.6667, 100 }, - { 61.9048, 104.762 }, - { 57.1429, 100 }, -}; - -static const CoordRec char106_stroke1[] = { - { 61.9048, 66.6667 }, - { 61.9048, -14.2857 }, - { 57.1429, -28.5714 }, - { 47.6191, -33.3333 }, - { 38.0953, -33.3333 }, -}; - -static const StrokeRec char106[] = { - { 5, char106_stroke0 }, - { 5, char106_stroke1 }, -}; - -/* char: 107 'k' */ - -static const CoordRec char107_stroke0[] = { - { 26.1905, 100 }, - { 26.1905, 0 }, -}; - -static const CoordRec char107_stroke1[] = { - { 73.8095, 66.6667 }, - { 26.1905, 19.0476 }, -}; - -static const CoordRec char107_stroke2[] = { - { 45.2381, 38.0952 }, - { 78.5715, 0 }, -}; - -static const StrokeRec char107[] = { - { 2, char107_stroke0 }, - { 2, char107_stroke1 }, - { 2, char107_stroke2 }, -}; - -/* char: 108 'l' */ - -static const CoordRec char108_stroke0[] = { - { 52.381, 100 }, - { 52.381, 0 }, -}; - -static const StrokeRec char108[] = { - { 2, char108_stroke0 }, -}; - -/* char: 109 'm' */ - -static const CoordRec char109_stroke0[] = { - { 0, 66.6667 }, - { 0, 0 }, -}; - -static const CoordRec char109_stroke1[] = { - { 0, 47.619 }, - { 14.2857, 61.9048 }, - { 23.8095, 66.6667 }, - { 38.0952, 66.6667 }, - { 47.619, 61.9048 }, - { 52.381, 47.619 }, - { 52.381, 0 }, -}; - -static const CoordRec char109_stroke2[] = { - { 52.381, 47.619 }, - { 66.6667, 61.9048 }, - { 76.1905, 66.6667 }, - { 90.4762, 66.6667 }, - { 100, 61.9048 }, - { 104.762, 47.619 }, - { 104.762, 0 }, -}; - -static const StrokeRec char109[] = { - { 2, char109_stroke0 }, - { 7, char109_stroke1 }, - { 7, char109_stroke2 }, -}; - -/* char: 110 'n' */ - -static const CoordRec char110_stroke0[] = { - { 26.1905, 66.6667 }, - { 26.1905, 0 }, -}; - -static const CoordRec char110_stroke1[] = { - { 26.1905, 47.619 }, - { 40.4762, 61.9048 }, - { 50, 66.6667 }, - { 64.2857, 66.6667 }, - { 73.8095, 61.9048 }, - { 78.5715, 47.619 }, - { 78.5715, 0 }, -}; - -static const StrokeRec char110[] = { - { 2, char110_stroke0 }, - { 7, char110_stroke1 }, -}; - -/* char: 111 'o' */ - -static const CoordRec char111_stroke0[] = { - { 45.2381, 66.6667 }, - { 35.7143, 61.9048 }, - { 26.1905, 52.381 }, - { 21.4286, 38.0952 }, - { 21.4286, 28.5714 }, - { 26.1905, 14.2857 }, - { 35.7143, 4.7619 }, - { 45.2381, 0 }, - { 59.5238, 0 }, - { 69.0476, 4.7619 }, - { 78.5714, 14.2857 }, - { 83.3334, 28.5714 }, - { 83.3334, 38.0952 }, - { 78.5714, 52.381 }, - { 69.0476, 61.9048 }, - { 59.5238, 66.6667 }, - { 45.2381, 66.6667 }, -}; - -static const StrokeRec char111[] = { - { 17, char111_stroke0 }, -}; - -/* char: 112 'p' */ - -static const CoordRec char112_stroke0[] = { - { 23.8095, 66.6667 }, - { 23.8095, -33.3333 }, -}; - -static const CoordRec char112_stroke1[] = { - { 23.8095, 52.381 }, - { 33.3333, 61.9048 }, - { 42.8571, 66.6667 }, - { 57.1428, 66.6667 }, - { 66.6666, 61.9048 }, - { 76.1905, 52.381 }, - { 80.9524, 38.0952 }, - { 80.9524, 28.5714 }, - { 76.1905, 14.2857 }, - { 66.6666, 4.7619 }, - { 57.1428, 0 }, - { 42.8571, 0 }, - { 33.3333, 4.7619 }, - { 23.8095, 14.2857 }, -}; - -static const StrokeRec char112[] = { - { 2, char112_stroke0 }, - { 14, char112_stroke1 }, -}; - -/* char: 113 'q' */ - -static const CoordRec char113_stroke0[] = { - { 80.9524, 66.6667 }, - { 80.9524, -33.3333 }, -}; - -static const CoordRec char113_stroke1[] = { - { 80.9524, 52.381 }, - { 71.4285, 61.9048 }, - { 61.9047, 66.6667 }, - { 47.619, 66.6667 }, - { 38.0952, 61.9048 }, - { 28.5714, 52.381 }, - { 23.8095, 38.0952 }, - { 23.8095, 28.5714 }, - { 28.5714, 14.2857 }, - { 38.0952, 4.7619 }, - { 47.619, 0 }, - { 61.9047, 0 }, - { 71.4285, 4.7619 }, - { 80.9524, 14.2857 }, -}; - -static const StrokeRec char113[] = { - { 2, char113_stroke0 }, - { 14, char113_stroke1 }, -}; - -/* char: 114 'r' */ - -static const CoordRec char114_stroke0[] = { - { 33.3334, 66.6667 }, - { 33.3334, 0 }, -}; - -static const CoordRec char114_stroke1[] = { - { 33.3334, 38.0952 }, - { 38.0953, 52.381 }, - { 47.6191, 61.9048 }, - { 57.1429, 66.6667 }, - { 71.4286, 66.6667 }, -}; - -static const StrokeRec char114[] = { - { 2, char114_stroke0 }, - { 5, char114_stroke1 }, -}; - -/* char: 115 's' */ - -static const CoordRec char115_stroke0[] = { - { 78.5715, 52.381 }, - { 73.8095, 61.9048 }, - { 59.5238, 66.6667 }, - { 45.2381, 66.6667 }, - { 30.9524, 61.9048 }, - { 26.1905, 52.381 }, - { 30.9524, 42.8571 }, - { 40.4762, 38.0952 }, - { 64.2857, 33.3333 }, - { 73.8095, 28.5714 }, - { 78.5715, 19.0476 }, - { 78.5715, 14.2857 }, - { 73.8095, 4.7619 }, - { 59.5238, 0 }, - { 45.2381, 0 }, - { 30.9524, 4.7619 }, - { 26.1905, 14.2857 }, -}; - -static const StrokeRec char115[] = { - { 17, char115_stroke0 }, -}; - -/* char: 116 't' */ - -static const CoordRec char116_stroke0[] = { - { 47.6191, 100 }, - { 47.6191, 19.0476 }, - { 52.381, 4.7619 }, - { 61.9048, 0 }, - { 71.4286, 0 }, -}; - -static const CoordRec char116_stroke1[] = { - { 33.3334, 66.6667 }, - { 66.6667, 66.6667 }, -}; - -static const StrokeRec char116[] = { - { 5, char116_stroke0 }, - { 2, char116_stroke1 }, -}; - -/* char: 117 'u' */ - -static const CoordRec char117_stroke0[] = { - { 26.1905, 66.6667 }, - { 26.1905, 19.0476 }, - { 30.9524, 4.7619 }, - { 40.4762, 0 }, - { 54.7619, 0 }, - { 64.2857, 4.7619 }, - { 78.5715, 19.0476 }, -}; - -static const CoordRec char117_stroke1[] = { - { 78.5715, 66.6667 }, - { 78.5715, 0 }, -}; - -static const StrokeRec char117[] = { - { 7, char117_stroke0 }, - { 2, char117_stroke1 }, -}; - -/* char: 118 'v' */ - -static const CoordRec char118_stroke0[] = { - { 23.8095, 66.6667 }, - { 52.3809, 0 }, -}; - -static const CoordRec char118_stroke1[] = { - { 80.9524, 66.6667 }, - { 52.3809, 0 }, -}; - -static const StrokeRec char118[] = { - { 2, char118_stroke0 }, - { 2, char118_stroke1 }, -}; - -/* char: 119 'w' */ - -static const CoordRec char119_stroke0[] = { - { 14.2857, 66.6667 }, - { 33.3333, 0 }, -}; - -static const CoordRec char119_stroke1[] = { - { 52.3809, 66.6667 }, - { 33.3333, 0 }, -}; - -static const CoordRec char119_stroke2[] = { - { 52.3809, 66.6667 }, - { 71.4286, 0 }, -}; - -static const CoordRec char119_stroke3[] = { - { 90.4762, 66.6667 }, - { 71.4286, 0 }, -}; - -static const StrokeRec char119[] = { - { 2, char119_stroke0 }, - { 2, char119_stroke1 }, - { 2, char119_stroke2 }, - { 2, char119_stroke3 }, -}; - -/* char: 120 'x' */ - -static const CoordRec char120_stroke0[] = { - { 26.1905, 66.6667 }, - { 78.5715, 0 }, -}; - -static const CoordRec char120_stroke1[] = { - { 78.5715, 66.6667 }, - { 26.1905, 0 }, -}; - -static const StrokeRec char120[] = { - { 2, char120_stroke0 }, - { 2, char120_stroke1 }, -}; - -/* char: 121 'y' */ - -static const CoordRec char121_stroke0[] = { - { 26.1905, 66.6667 }, - { 54.7619, 0 }, -}; - -static const CoordRec char121_stroke1[] = { - { 83.3334, 66.6667 }, - { 54.7619, 0 }, - { 45.2381, -19.0476 }, - { 35.7143, -28.5714 }, - { 26.1905, -33.3333 }, - { 21.4286, -33.3333 }, -}; - -static const StrokeRec char121[] = { - { 2, char121_stroke0 }, - { 6, char121_stroke1 }, -}; - -/* char: 122 'z' */ - -static const CoordRec char122_stroke0[] = { - { 78.5715, 66.6667 }, - { 26.1905, 0 }, -}; - -static const CoordRec char122_stroke1[] = { - { 26.1905, 66.6667 }, - { 78.5715, 66.6667 }, -}; - -static const CoordRec char122_stroke2[] = { - { 26.1905, 0 }, - { 78.5715, 0 }, -}; - -static const StrokeRec char122[] = { - { 2, char122_stroke0 }, - { 2, char122_stroke1 }, - { 2, char122_stroke2 }, -}; - -/* char: 123 '{' */ - -static const CoordRec char123_stroke0[] = { - { 64.2857, 119.048 }, - { 54.7619, 114.286 }, - { 50, 109.524 }, - { 45.2381, 100 }, - { 45.2381, 90.4762 }, - { 50, 80.9524 }, - { 54.7619, 76.1905 }, - { 59.5238, 66.6667 }, - { 59.5238, 57.1429 }, - { 50, 47.619 }, -}; - -static const CoordRec char123_stroke1[] = { - { 54.7619, 114.286 }, - { 50, 104.762 }, - { 50, 95.2381 }, - { 54.7619, 85.7143 }, - { 59.5238, 80.9524 }, - { 64.2857, 71.4286 }, - { 64.2857, 61.9048 }, - { 59.5238, 52.381 }, - { 40.4762, 42.8571 }, - { 59.5238, 33.3333 }, - { 64.2857, 23.8095 }, - { 64.2857, 14.2857 }, - { 59.5238, 4.7619 }, - { 54.7619, 0 }, - { 50, -9.5238 }, - { 50, -19.0476 }, - { 54.7619, -28.5714 }, -}; - -static const CoordRec char123_stroke2[] = { - { 50, 38.0952 }, - { 59.5238, 28.5714 }, - { 59.5238, 19.0476 }, - { 54.7619, 9.5238 }, - { 50, 4.7619 }, - { 45.2381, -4.7619 }, - { 45.2381, -14.2857 }, - { 50, -23.8095 }, - { 54.7619, -28.5714 }, - { 64.2857, -33.3333 }, -}; - -static const StrokeRec char123[] = { - { 10, char123_stroke0 }, - { 17, char123_stroke1 }, - { 10, char123_stroke2 }, -}; - -/* char: 124 '|' */ - -static const CoordRec char124_stroke0[] = { - { 52.381, 119.048 }, - { 52.381, -33.3333 }, -}; - -static const StrokeRec char124[] = { - { 2, char124_stroke0 }, -}; - -/* char: 125 '}' */ - -static const CoordRec char125_stroke0[] = { - { 40.4762, 119.048 }, - { 50, 114.286 }, - { 54.7619, 109.524 }, - { 59.5238, 100 }, - { 59.5238, 90.4762 }, - { 54.7619, 80.9524 }, - { 50, 76.1905 }, - { 45.2381, 66.6667 }, - { 45.2381, 57.1429 }, - { 54.7619, 47.619 }, -}; - -static const CoordRec char125_stroke1[] = { - { 50, 114.286 }, - { 54.7619, 104.762 }, - { 54.7619, 95.2381 }, - { 50, 85.7143 }, - { 45.2381, 80.9524 }, - { 40.4762, 71.4286 }, - { 40.4762, 61.9048 }, - { 45.2381, 52.381 }, - { 64.2857, 42.8571 }, - { 45.2381, 33.3333 }, - { 40.4762, 23.8095 }, - { 40.4762, 14.2857 }, - { 45.2381, 4.7619 }, - { 50, 0 }, - { 54.7619, -9.5238 }, - { 54.7619, -19.0476 }, - { 50, -28.5714 }, -}; - -static const CoordRec char125_stroke2[] = { - { 54.7619, 38.0952 }, - { 45.2381, 28.5714 }, - { 45.2381, 19.0476 }, - { 50, 9.5238 }, - { 54.7619, 4.7619 }, - { 59.5238, -4.7619 }, - { 59.5238, -14.2857 }, - { 54.7619, -23.8095 }, - { 50, -28.5714 }, - { 40.4762, -33.3333 }, -}; - -static const StrokeRec char125[] = { - { 10, char125_stroke0 }, - { 17, char125_stroke1 }, - { 10, char125_stroke2 }, -}; - -/* char: 126 '~' */ - -static const CoordRec char126_stroke0[] = { - { 9.5238, 28.5714 }, - { 9.5238, 38.0952 }, - { 14.2857, 52.381 }, - { 23.8095, 57.1429 }, - { 33.3333, 57.1429 }, - { 42.8571, 52.381 }, - { 61.9048, 38.0952 }, - { 71.4286, 33.3333 }, - { 80.9524, 33.3333 }, - { 90.4762, 38.0952 }, - { 95.2381, 47.619 }, -}; - -static const CoordRec char126_stroke1[] = { - { 9.5238, 38.0952 }, - { 14.2857, 47.619 }, - { 23.8095, 52.381 }, - { 33.3333, 52.381 }, - { 42.8571, 47.619 }, - { 61.9048, 33.3333 }, - { 71.4286, 28.5714 }, - { 80.9524, 28.5714 }, - { 90.4762, 33.3333 }, - { 95.2381, 47.619 }, - { 95.2381, 57.1429 }, -}; - -static const StrokeRec char126[] = { - { 11, char126_stroke0 }, - { 11, char126_stroke1 }, -}; - -/* char: 127 */ - -static const CoordRec char127_stroke0[] = { - { 71.4286, 100 }, - { 33.3333, -33.3333 }, -}; - -static const CoordRec char127_stroke1[] = { - { 47.619, 66.6667 }, - { 33.3333, 61.9048 }, - { 23.8095, 52.381 }, - { 19.0476, 38.0952 }, - { 19.0476, 23.8095 }, - { 23.8095, 14.2857 }, - { 33.3333, 4.7619 }, - { 47.619, 0 }, - { 57.1428, 0 }, - { 71.4286, 4.7619 }, - { 80.9524, 14.2857 }, - { 85.7143, 28.5714 }, - { 85.7143, 42.8571 }, - { 80.9524, 52.381 }, - { 71.4286, 61.9048 }, - { 57.1428, 66.6667 }, - { 47.619, 66.6667 }, -}; - -static const StrokeRec char127[] = { - { 2, char127_stroke0 }, - { 17, char127_stroke1 }, -}; - -static const StrokeCharRec chars[] = { - { 0, /* char0 */ 0, 0, 0 }, - { 0, /* char1 */ 0, 0, 0 }, - { 0, /* char2 */ 0, 0, 0 }, - { 0, /* char3 */ 0, 0, 0 }, - { 0, /* char4 */ 0, 0, 0 }, - { 0, /* char5 */ 0, 0, 0 }, - { 0, /* char6 */ 0, 0, 0 }, - { 0, /* char7 */ 0, 0, 0 }, - { 0, /* char8 */ 0, 0, 0 }, - { 0, /* char9 */ 0, 0, 0 }, - { 0, /* char10 */ 0, 0, 0 }, - { 0, /* char11 */ 0, 0, 0 }, - { 0, /* char12 */ 0, 0, 0 }, - { 0, /* char13 */ 0, 0, 0 }, - { 0, /* char14 */ 0, 0, 0 }, - { 0, /* char15 */ 0, 0, 0 }, - { 0, /* char16 */ 0, 0, 0 }, - { 0, /* char17 */ 0, 0, 0 }, - { 0, /* char18 */ 0, 0, 0 }, - { 0, /* char19 */ 0, 0, 0 }, - { 0, /* char20 */ 0, 0, 0 }, - { 0, /* char21 */ 0, 0, 0 }, - { 0, /* char22 */ 0, 0, 0 }, - { 0, /* char23 */ 0, 0, 0 }, - { 0, /* char24 */ 0, 0, 0 }, - { 0, /* char25 */ 0, 0, 0 }, - { 0, /* char26 */ 0, 0, 0 }, - { 0, /* char27 */ 0, 0, 0 }, - { 0, /* char28 */ 0, 0, 0 }, - { 0, /* char29 */ 0, 0, 0 }, - { 0, /* char30 */ 0, 0, 0 }, - { 0, /* char31 */ 0, 0, 0 }, - { 0, /* char32 */ 0, 52.381, 104.762 }, - { 2, char33, 52.381, 104.762 }, - { 2, char34, 52.381, 104.762 }, - { 4, char35, 52.381, 104.762 }, - { 3, char36, 52.381, 104.762 }, - { 3, char37, 52.381, 104.762 }, - { 1, char38, 52.381, 104.762 }, - { 1, char39, 52.381, 104.762 }, - { 1, char40, 52.381, 104.762 }, - { 1, char41, 52.381, 104.762 }, - { 3, char42, 52.381, 104.762 }, - { 2, char43, 52.381, 104.762 }, - { 1, char44, 52.381, 104.762 }, - { 1, char45, 52.381, 104.762 }, - { 1, char46, 52.381, 104.762 }, - { 1, char47, 52.381, 104.762 }, - { 1, char48, 52.381, 104.762 }, - { 1, char49, 52.381, 104.762 }, - { 1, char50, 52.381, 104.762 }, - { 1, char51, 52.381, 104.762 }, - { 2, char52, 52.381, 104.762 }, - { 1, char53, 52.381, 104.762 }, - { 1, char54, 52.381, 104.762 }, - { 2, char55, 52.381, 104.762 }, - { 1, char56, 52.381, 104.762 }, - { 1, char57, 52.381, 104.762 }, - { 2, char58, 52.381, 104.762 }, - { 2, char59, 52.381, 104.762 }, - { 1, char60, 52.381, 104.762 }, - { 2, char61, 52.381, 104.762 }, - { 1, char62, 52.381, 104.762 }, - { 2, char63, 52.381, 104.762 }, - { 2, char64, 52.381, 104.762 }, - { 3, char65, 52.381, 104.762 }, - { 3, char66, 52.381, 104.762 }, - { 1, char67, 52.381, 104.762 }, - { 2, char68, 52.381, 104.762 }, - { 4, char69, 52.381, 104.762 }, - { 3, char70, 52.381, 104.762 }, - { 2, char71, 52.381, 104.762 }, - { 3, char72, 52.381, 104.762 }, - { 1, char73, 52.381, 104.762 }, - { 1, char74, 52.381, 104.762 }, - { 3, char75, 52.381, 104.762 }, - { 2, char76, 52.381, 104.762 }, - { 4, char77, 52.381, 104.762 }, - { 3, char78, 52.381, 104.762 }, - { 1, char79, 52.381, 104.762 }, - { 2, char80, 52.381, 104.762 }, - { 2, char81, 52.381, 104.762 }, - { 3, char82, 52.381, 104.762 }, - { 1, char83, 52.381, 104.762 }, - { 2, char84, 52.381, 104.762 }, - { 1, char85, 52.381, 104.762 }, - { 2, char86, 52.381, 104.762 }, - { 4, char87, 52.381, 104.762 }, - { 2, char88, 52.381, 104.762 }, - { 2, char89, 52.381, 104.762 }, - { 3, char90, 52.381, 104.762 }, - { 4, char91, 52.381, 104.762 }, - { 1, char92, 52.381, 104.762 }, - { 4, char93, 52.381, 104.762 }, - { 2, char94, 52.381, 104.762 }, - { 1, char95, 52.381, 104.762 }, - { 2, char96, 52.381, 104.762 }, - { 2, char97, 52.381, 104.762 }, - { 2, char98, 52.381, 104.762 }, - { 1, char99, 52.381, 104.762 }, - { 2, char100, 52.381, 104.762 }, - { 1, char101, 52.381, 104.762 }, - { 2, char102, 52.381, 104.762 }, - { 2, char103, 52.381, 104.762 }, - { 2, char104, 52.381, 104.762 }, - { 2, char105, 52.381, 104.762 }, - { 2, char106, 52.381, 104.762 }, - { 3, char107, 52.381, 104.762 }, - { 1, char108, 52.381, 104.762 }, - { 3, char109, 52.381, 104.762 }, - { 2, char110, 52.381, 104.762 }, - { 1, char111, 52.381, 104.762 }, - { 2, char112, 52.381, 104.762 }, - { 2, char113, 52.381, 104.762 }, - { 2, char114, 52.381, 104.762 }, - { 1, char115, 52.381, 104.762 }, - { 2, char116, 52.381, 104.762 }, - { 2, char117, 52.381, 104.762 }, - { 2, char118, 52.381, 104.762 }, - { 4, char119, 52.381, 104.762 }, - { 2, char120, 52.381, 104.762 }, - { 2, char121, 52.381, 104.762 }, - { 3, char122, 52.381, 104.762 }, - { 3, char123, 52.381, 104.762 }, - { 1, char124, 52.381, 104.762 }, - { 3, char125, 52.381, 104.762 }, - { 2, char126, 52.381, 104.762 }, - { 2, char127, 52.381, 104.762 }, -}; - -const StrokeFontRec glutStrokeMonoRoman = { "Roman", 128, chars, 119.048, -33.3333 }; - -#endif diff --git a/lib/SRC/Eden/gluttext/glut_roman.c b/lib/SRC/Eden/gluttext/glut_roman.c deleted file mode 100644 index 0f95a65..0000000 --- a/lib/SRC/Eden/gluttext/glut_roman.c +++ /dev/null @@ -1,2455 +0,0 @@ -#include -#if GLUTTEXT_STROKE_ENABLE - -/* GENERATED FILE -- DO NOT MODIFY */ - -#include "glutstroke.h" - -/* char: 33 '!' */ - -static const CoordRec char33_stroke0[] = { - { 13.3819, 100 }, - { 13.3819, 33.3333 }, -}; - -static const CoordRec char33_stroke1[] = { - { 13.3819, 9.5238 }, - { 8.62, 4.7619 }, - { 13.3819, 0 }, - { 18.1438, 4.7619 }, - { 13.3819, 9.5238 }, -}; - -static const StrokeRec char33[] = { - { 2, char33_stroke0 }, - { 5, char33_stroke1 }, -}; - -/* char: 34 '"' */ - -static const CoordRec char34_stroke0[] = { - { 4.02, 100 }, - { 4.02, 66.6667 }, -}; - -static const CoordRec char34_stroke1[] = { - { 42.1152, 100 }, - { 42.1152, 66.6667 }, -}; - -static const StrokeRec char34[] = { - { 2, char34_stroke0 }, - { 2, char34_stroke1 }, -}; - -/* char: 35 '#' */ - -static const CoordRec char35_stroke0[] = { - { 41.2952, 119.048 }, - { 7.9619, -33.3333 }, -}; - -static const CoordRec char35_stroke1[] = { - { 69.8667, 119.048 }, - { 36.5333, -33.3333 }, -}; - -static const CoordRec char35_stroke2[] = { - { 7.9619, 57.1429 }, - { 74.6286, 57.1429 }, -}; - -static const CoordRec char35_stroke3[] = { - { 3.2, 28.5714 }, - { 69.8667, 28.5714 }, -}; - -static const StrokeRec char35[] = { - { 2, char35_stroke0 }, - { 2, char35_stroke1 }, - { 2, char35_stroke2 }, - { 2, char35_stroke3 }, -}; - -/* char: 36 '$' */ - -static const CoordRec char36_stroke0[] = { - { 28.6295, 119.048 }, - { 28.6295, -19.0476 }, -}; - -static const CoordRec char36_stroke1[] = { - { 47.6771, 119.048 }, - { 47.6771, -19.0476 }, -}; - -static const CoordRec char36_stroke2[] = { - { 71.4867, 85.7143 }, - { 61.9629, 95.2381 }, - { 47.6771, 100 }, - { 28.6295, 100 }, - { 14.3438, 95.2381 }, - { 4.82, 85.7143 }, - { 4.82, 76.1905 }, - { 9.5819, 66.6667 }, - { 14.3438, 61.9048 }, - { 23.8676, 57.1429 }, - { 52.439, 47.619 }, - { 61.9629, 42.8571 }, - { 66.7248, 38.0952 }, - { 71.4867, 28.5714 }, - { 71.4867, 14.2857 }, - { 61.9629, 4.7619 }, - { 47.6771, 0 }, - { 28.6295, 0 }, - { 14.3438, 4.7619 }, - { 4.82, 14.2857 }, -}; - -static const StrokeRec char36[] = { - { 2, char36_stroke0 }, - { 2, char36_stroke1 }, - { 20, char36_stroke2 }, -}; - -/* char: 37 '%' */ - -static const CoordRec char37_stroke0[] = { - { 92.0743, 100 }, - { 6.36, 0 }, -}; - -static const CoordRec char37_stroke1[] = { - { 30.1695, 100 }, - { 39.6933, 90.4762 }, - { 39.6933, 80.9524 }, - { 34.9314, 71.4286 }, - { 25.4076, 66.6667 }, - { 15.8838, 66.6667 }, - { 6.36, 76.1905 }, - { 6.36, 85.7143 }, - { 11.1219, 95.2381 }, - { 20.6457, 100 }, - { 30.1695, 100 }, - { 39.6933, 95.2381 }, - { 53.979, 90.4762 }, - { 68.2648, 90.4762 }, - { 82.5505, 95.2381 }, - { 92.0743, 100 }, -}; - -static const CoordRec char37_stroke2[] = { - { 73.0267, 33.3333 }, - { 63.5029, 28.5714 }, - { 58.741, 19.0476 }, - { 58.741, 9.5238 }, - { 68.2648, 0 }, - { 77.7886, 0 }, - { 87.3124, 4.7619 }, - { 92.0743, 14.2857 }, - { 92.0743, 23.8095 }, - { 82.5505, 33.3333 }, - { 73.0267, 33.3333 }, -}; - -static const StrokeRec char37[] = { - { 2, char37_stroke0 }, - { 16, char37_stroke1 }, - { 11, char37_stroke2 }, -}; - -/* char: 38 '&' */ - -static const CoordRec char38_stroke0[] = { - { 101.218, 57.1429 }, - { 101.218, 61.9048 }, - { 96.4562, 66.6667 }, - { 91.6943, 66.6667 }, - { 86.9324, 61.9048 }, - { 82.1705, 52.381 }, - { 72.6467, 28.5714 }, - { 63.1229, 14.2857 }, - { 53.599, 4.7619 }, - { 44.0752, 0 }, - { 25.0276, 0 }, - { 15.5038, 4.7619 }, - { 10.7419, 9.5238 }, - { 5.98, 19.0476 }, - { 5.98, 28.5714 }, - { 10.7419, 38.0952 }, - { 15.5038, 42.8571 }, - { 48.8371, 61.9048 }, - { 53.599, 66.6667 }, - { 58.361, 76.1905 }, - { 58.361, 85.7143 }, - { 53.599, 95.2381 }, - { 44.0752, 100 }, - { 34.5514, 95.2381 }, - { 29.7895, 85.7143 }, - { 29.7895, 76.1905 }, - { 34.5514, 61.9048 }, - { 44.0752, 47.619 }, - { 67.8848, 14.2857 }, - { 77.4086, 4.7619 }, - { 86.9324, 0 }, - { 96.4562, 0 }, - { 101.218, 4.7619 }, - { 101.218, 9.5238 }, -}; - -static const StrokeRec char38[] = { - { 34, char38_stroke0 }, -}; - -/* char: 39 ''' */ - -static const CoordRec char39_stroke0[] = { - { 4.44, 100 }, - { 4.44, 66.6667 }, -}; - -static const StrokeRec char39[] = { - { 2, char39_stroke0 }, -}; - -/* char: 40 '(' */ - -static const CoordRec char40_stroke0[] = { - { 40.9133, 119.048 }, - { 31.3895, 109.524 }, - { 21.8657, 95.2381 }, - { 12.3419, 76.1905 }, - { 7.58, 52.381 }, - { 7.58, 33.3333 }, - { 12.3419, 9.5238 }, - { 21.8657, -9.5238 }, - { 31.3895, -23.8095 }, - { 40.9133, -33.3333 }, -}; - -static const StrokeRec char40[] = { - { 10, char40_stroke0 }, -}; - -/* char: 41 ')' */ - -static const CoordRec char41_stroke0[] = { - { 5.28, 119.048 }, - { 14.8038, 109.524 }, - { 24.3276, 95.2381 }, - { 33.8514, 76.1905 }, - { 38.6133, 52.381 }, - { 38.6133, 33.3333 }, - { 33.8514, 9.5238 }, - { 24.3276, -9.5238 }, - { 14.8038, -23.8095 }, - { 5.28, -33.3333 }, -}; - -static const StrokeRec char41[] = { - { 10, char41_stroke0 }, -}; - -/* char: 42 '*' */ - -static const CoordRec char42_stroke0[] = { - { 30.7695, 71.4286 }, - { 30.7695, 14.2857 }, -}; - -static const CoordRec char42_stroke1[] = { - { 6.96, 57.1429 }, - { 54.579, 28.5714 }, -}; - -static const CoordRec char42_stroke2[] = { - { 54.579, 57.1429 }, - { 6.96, 28.5714 }, -}; - -static const StrokeRec char42[] = { - { 2, char42_stroke0 }, - { 2, char42_stroke1 }, - { 2, char42_stroke2 }, -}; - -/* char: 43 '+' */ - -static const CoordRec char43_stroke0[] = { - { 48.8371, 85.7143 }, - { 48.8371, 0 }, -}; - -static const CoordRec char43_stroke1[] = { - { 5.98, 42.8571 }, - { 91.6943, 42.8571 }, -}; - -static const StrokeRec char43[] = { - { 2, char43_stroke0 }, - { 2, char43_stroke1 }, -}; - -/* char: 44 ',' */ - -static const CoordRec char44_stroke0[] = { - { 18.2838, 4.7619 }, - { 13.5219, 0 }, - { 8.76, 4.7619 }, - { 13.5219, 9.5238 }, - { 18.2838, 4.7619 }, - { 18.2838, -4.7619 }, - { 13.5219, -14.2857 }, - { 8.76, -19.0476 }, -}; - -static const StrokeRec char44[] = { - { 8, char44_stroke0 }, -}; - -/* char: 45 '-' */ - -static const CoordRec char45_stroke0[] = { - { 7.38, 42.8571 }, - { 93.0943, 42.8571 }, -}; - -static const StrokeRec char45[] = { - { 2, char45_stroke0 }, -}; - -/* char: 46 '.' */ - -static const CoordRec char46_stroke0[] = { - { 13.1019, 9.5238 }, - { 8.34, 4.7619 }, - { 13.1019, 0 }, - { 17.8638, 4.7619 }, - { 13.1019, 9.5238 }, -}; - -static const StrokeRec char46[] = { - { 5, char46_stroke0 }, -}; - -/* char: 47 '/' */ - -static const CoordRec char47_stroke0[] = { - { 7.24, -14.2857 }, - { 73.9067, 100 }, -}; - -static const StrokeRec char47[] = { - { 2, char47_stroke0 }, -}; - -/* char: 48 '0' */ - -static const CoordRec char48_stroke0[] = { - { 33.5514, 100 }, - { 19.2657, 95.2381 }, - { 9.7419, 80.9524 }, - { 4.98, 57.1429 }, - { 4.98, 42.8571 }, - { 9.7419, 19.0476 }, - { 19.2657, 4.7619 }, - { 33.5514, 0 }, - { 43.0752, 0 }, - { 57.361, 4.7619 }, - { 66.8848, 19.0476 }, - { 71.6467, 42.8571 }, - { 71.6467, 57.1429 }, - { 66.8848, 80.9524 }, - { 57.361, 95.2381 }, - { 43.0752, 100 }, - { 33.5514, 100 }, -}; - -static const StrokeRec char48[] = { - { 17, char48_stroke0 }, -}; - -/* char: 49 '1' */ - -static const CoordRec char49_stroke0[] = { - { 11.82, 80.9524 }, - { 21.3438, 85.7143 }, - { 35.6295, 100 }, - { 35.6295, 0 }, -}; - -static const StrokeRec char49[] = { - { 4, char49_stroke0 }, -}; - -/* char: 50 '2' */ - -static const CoordRec char50_stroke0[] = { - { 10.1819, 76.1905 }, - { 10.1819, 80.9524 }, - { 14.9438, 90.4762 }, - { 19.7057, 95.2381 }, - { 29.2295, 100 }, - { 48.2771, 100 }, - { 57.801, 95.2381 }, - { 62.5629, 90.4762 }, - { 67.3248, 80.9524 }, - { 67.3248, 71.4286 }, - { 62.5629, 61.9048 }, - { 53.039, 47.619 }, - { 5.42, 0 }, - { 72.0867, 0 }, -}; - -static const StrokeRec char50[] = { - { 14, char50_stroke0 }, -}; - -/* char: 51 '3' */ - -static const CoordRec char51_stroke0[] = { - { 14.5238, 100 }, - { 66.9048, 100 }, - { 38.3333, 61.9048 }, - { 52.619, 61.9048 }, - { 62.1429, 57.1429 }, - { 66.9048, 52.381 }, - { 71.6667, 38.0952 }, - { 71.6667, 28.5714 }, - { 66.9048, 14.2857 }, - { 57.381, 4.7619 }, - { 43.0952, 0 }, - { 28.8095, 0 }, - { 14.5238, 4.7619 }, - { 9.7619, 9.5238 }, - { 5, 19.0476 }, -}; - -static const StrokeRec char51[] = { - { 15, char51_stroke0 }, -}; - -/* char: 52 '4' */ - -static const CoordRec char52_stroke0[] = { - { 51.499, 100 }, - { 3.88, 33.3333 }, - { 75.3086, 33.3333 }, -}; - -static const CoordRec char52_stroke1[] = { - { 51.499, 100 }, - { 51.499, 0 }, -}; - -static const StrokeRec char52[] = { - { 3, char52_stroke0 }, - { 2, char52_stroke1 }, -}; - -/* char: 53 '5' */ - -static const CoordRec char53_stroke0[] = { - { 62.0029, 100 }, - { 14.3838, 100 }, - { 9.6219, 57.1429 }, - { 14.3838, 61.9048 }, - { 28.6695, 66.6667 }, - { 42.9552, 66.6667 }, - { 57.241, 61.9048 }, - { 66.7648, 52.381 }, - { 71.5267, 38.0952 }, - { 71.5267, 28.5714 }, - { 66.7648, 14.2857 }, - { 57.241, 4.7619 }, - { 42.9552, 0 }, - { 28.6695, 0 }, - { 14.3838, 4.7619 }, - { 9.6219, 9.5238 }, - { 4.86, 19.0476 }, -}; - -static const StrokeRec char53[] = { - { 17, char53_stroke0 }, -}; - -/* char: 54 '6' */ - -static const CoordRec char54_stroke0[] = { - { 62.7229, 85.7143 }, - { 57.961, 95.2381 }, - { 43.6752, 100 }, - { 34.1514, 100 }, - { 19.8657, 95.2381 }, - { 10.3419, 80.9524 }, - { 5.58, 57.1429 }, - { 5.58, 33.3333 }, - { 10.3419, 14.2857 }, - { 19.8657, 4.7619 }, - { 34.1514, 0 }, - { 38.9133, 0 }, - { 53.199, 4.7619 }, - { 62.7229, 14.2857 }, - { 67.4848, 28.5714 }, - { 67.4848, 33.3333 }, - { 62.7229, 47.619 }, - { 53.199, 57.1429 }, - { 38.9133, 61.9048 }, - { 34.1514, 61.9048 }, - { 19.8657, 57.1429 }, - { 10.3419, 47.619 }, - { 5.58, 33.3333 }, -}; - -static const StrokeRec char54[] = { - { 23, char54_stroke0 }, -}; - -/* char: 55 '7' */ - -static const CoordRec char55_stroke0[] = { - { 72.2267, 100 }, - { 24.6076, 0 }, -}; - -static const CoordRec char55_stroke1[] = { - { 5.56, 100 }, - { 72.2267, 100 }, -}; - -static const StrokeRec char55[] = { - { 2, char55_stroke0 }, - { 2, char55_stroke1 }, -}; - -/* char: 56 '8' */ - -static const CoordRec char56_stroke0[] = { - { 29.4095, 100 }, - { 15.1238, 95.2381 }, - { 10.3619, 85.7143 }, - { 10.3619, 76.1905 }, - { 15.1238, 66.6667 }, - { 24.6476, 61.9048 }, - { 43.6952, 57.1429 }, - { 57.981, 52.381 }, - { 67.5048, 42.8571 }, - { 72.2667, 33.3333 }, - { 72.2667, 19.0476 }, - { 67.5048, 9.5238 }, - { 62.7429, 4.7619 }, - { 48.4571, 0 }, - { 29.4095, 0 }, - { 15.1238, 4.7619 }, - { 10.3619, 9.5238 }, - { 5.6, 19.0476 }, - { 5.6, 33.3333 }, - { 10.3619, 42.8571 }, - { 19.8857, 52.381 }, - { 34.1714, 57.1429 }, - { 53.219, 61.9048 }, - { 62.7429, 66.6667 }, - { 67.5048, 76.1905 }, - { 67.5048, 85.7143 }, - { 62.7429, 95.2381 }, - { 48.4571, 100 }, - { 29.4095, 100 }, -}; - -static const StrokeRec char56[] = { - { 29, char56_stroke0 }, -}; - -/* char: 57 '9' */ - -static const CoordRec char57_stroke0[] = { - { 68.5048, 66.6667 }, - { 63.7429, 52.381 }, - { 54.219, 42.8571 }, - { 39.9333, 38.0952 }, - { 35.1714, 38.0952 }, - { 20.8857, 42.8571 }, - { 11.3619, 52.381 }, - { 6.6, 66.6667 }, - { 6.6, 71.4286 }, - { 11.3619, 85.7143 }, - { 20.8857, 95.2381 }, - { 35.1714, 100 }, - { 39.9333, 100 }, - { 54.219, 95.2381 }, - { 63.7429, 85.7143 }, - { 68.5048, 66.6667 }, - { 68.5048, 42.8571 }, - { 63.7429, 19.0476 }, - { 54.219, 4.7619 }, - { 39.9333, 0 }, - { 30.4095, 0 }, - { 16.1238, 4.7619 }, - { 11.3619, 14.2857 }, -}; - -static const StrokeRec char57[] = { - { 23, char57_stroke0 }, -}; - -/* char: 58 ':' */ - -static const CoordRec char58_stroke0[] = { - { 14.0819, 66.6667 }, - { 9.32, 61.9048 }, - { 14.0819, 57.1429 }, - { 18.8438, 61.9048 }, - { 14.0819, 66.6667 }, -}; - -static const CoordRec char58_stroke1[] = { - { 14.0819, 9.5238 }, - { 9.32, 4.7619 }, - { 14.0819, 0 }, - { 18.8438, 4.7619 }, - { 14.0819, 9.5238 }, -}; - -static const StrokeRec char58[] = { - { 5, char58_stroke0 }, - { 5, char58_stroke1 }, -}; - -/* char: 59 ';' */ - -static const CoordRec char59_stroke0[] = { - { 12.9619, 66.6667 }, - { 8.2, 61.9048 }, - { 12.9619, 57.1429 }, - { 17.7238, 61.9048 }, - { 12.9619, 66.6667 }, -}; - -static const CoordRec char59_stroke1[] = { - { 17.7238, 4.7619 }, - { 12.9619, 0 }, - { 8.2, 4.7619 }, - { 12.9619, 9.5238 }, - { 17.7238, 4.7619 }, - { 17.7238, -4.7619 }, - { 12.9619, -14.2857 }, - { 8.2, -19.0476 }, -}; - -static const StrokeRec char59[] = { - { 5, char59_stroke0 }, - { 8, char59_stroke1 }, -}; - -/* char: 60 '<' */ - -static const CoordRec char60_stroke0[] = { - { 79.2505, 85.7143 }, - { 3.06, 42.8571 }, - { 79.2505, 0 }, -}; - -static const StrokeRec char60[] = { - { 3, char60_stroke0 }, -}; - -/* char: 61 '=' */ - -static const CoordRec char61_stroke0[] = { - { 5.7, 57.1429 }, - { 91.4143, 57.1429 }, -}; - -static const CoordRec char61_stroke1[] = { - { 5.7, 28.5714 }, - { 91.4143, 28.5714 }, -}; - -static const StrokeRec char61[] = { - { 2, char61_stroke0 }, - { 2, char61_stroke1 }, -}; - -/* char: 62 '>' */ - -static const CoordRec char62_stroke0[] = { - { 2.78, 85.7143 }, - { 78.9705, 42.8571 }, - { 2.78, 0 }, -}; - -static const StrokeRec char62[] = { - { 3, char62_stroke0 }, -}; - -/* char: 63 '?' */ - -static const CoordRec char63_stroke0[] = { - { 8.42, 76.1905 }, - { 8.42, 80.9524 }, - { 13.1819, 90.4762 }, - { 17.9438, 95.2381 }, - { 27.4676, 100 }, - { 46.5152, 100 }, - { 56.039, 95.2381 }, - { 60.801, 90.4762 }, - { 65.5629, 80.9524 }, - { 65.5629, 71.4286 }, - { 60.801, 61.9048 }, - { 56.039, 57.1429 }, - { 36.9914, 47.619 }, - { 36.9914, 33.3333 }, -}; - -static const CoordRec char63_stroke1[] = { - { 36.9914, 9.5238 }, - { 32.2295, 4.7619 }, - { 36.9914, 0 }, - { 41.7533, 4.7619 }, - { 36.9914, 9.5238 }, -}; - -static const StrokeRec char63[] = { - { 14, char63_stroke0 }, - { 5, char63_stroke1 }, -}; - -/* char: 64 '@' */ - -static const CoordRec char64_stroke0[] = { - { 49.2171, 52.381 }, - { 39.6933, 57.1429 }, - { 30.1695, 57.1429 }, - { 25.4076, 47.619 }, - { 25.4076, 42.8571 }, - { 30.1695, 33.3333 }, - { 39.6933, 33.3333 }, - { 49.2171, 38.0952 }, -}; - -static const CoordRec char64_stroke1[] = { - { 49.2171, 57.1429 }, - { 49.2171, 38.0952 }, - { 53.979, 33.3333 }, - { 63.5029, 33.3333 }, - { 68.2648, 42.8571 }, - { 68.2648, 47.619 }, - { 63.5029, 61.9048 }, - { 53.979, 71.4286 }, - { 39.6933, 76.1905 }, - { 34.9314, 76.1905 }, - { 20.6457, 71.4286 }, - { 11.1219, 61.9048 }, - { 6.36, 47.619 }, - { 6.36, 42.8571 }, - { 11.1219, 28.5714 }, - { 20.6457, 19.0476 }, - { 34.9314, 14.2857 }, - { 39.6933, 14.2857 }, - { 53.979, 19.0476 }, -}; - -static const StrokeRec char64[] = { - { 8, char64_stroke0 }, - { 19, char64_stroke1 }, -}; - -/* char: 65 'A' */ - -static const CoordRec char65_stroke0[] = { - { 40.5952, 100 }, - { 2.5, 0 }, -}; - -static const CoordRec char65_stroke1[] = { - { 40.5952, 100 }, - { 78.6905, 0 }, -}; - -static const CoordRec char65_stroke2[] = { - { 16.7857, 33.3333 }, - { 64.4048, 33.3333 }, -}; - -static const StrokeRec char65[] = { - { 2, char65_stroke0 }, - { 2, char65_stroke1 }, - { 2, char65_stroke2 }, -}; - -/* char: 66 'B' */ - -static const CoordRec char66_stroke0[] = { - { 11.42, 100 }, - { 11.42, 0 }, -}; - -static const CoordRec char66_stroke1[] = { - { 11.42, 100 }, - { 54.2771, 100 }, - { 68.5629, 95.2381 }, - { 73.3248, 90.4762 }, - { 78.0867, 80.9524 }, - { 78.0867, 71.4286 }, - { 73.3248, 61.9048 }, - { 68.5629, 57.1429 }, - { 54.2771, 52.381 }, -}; - -static const CoordRec char66_stroke2[] = { - { 11.42, 52.381 }, - { 54.2771, 52.381 }, - { 68.5629, 47.619 }, - { 73.3248, 42.8571 }, - { 78.0867, 33.3333 }, - { 78.0867, 19.0476 }, - { 73.3248, 9.5238 }, - { 68.5629, 4.7619 }, - { 54.2771, 0 }, - { 11.42, 0 }, -}; - -static const StrokeRec char66[] = { - { 2, char66_stroke0 }, - { 9, char66_stroke1 }, - { 10, char66_stroke2 }, -}; - -/* char: 67 'C' */ - -static const CoordRec char67_stroke0[] = { - { 78.0886, 76.1905 }, - { 73.3267, 85.7143 }, - { 63.8029, 95.2381 }, - { 54.279, 100 }, - { 35.2314, 100 }, - { 25.7076, 95.2381 }, - { 16.1838, 85.7143 }, - { 11.4219, 76.1905 }, - { 6.66, 61.9048 }, - { 6.66, 38.0952 }, - { 11.4219, 23.8095 }, - { 16.1838, 14.2857 }, - { 25.7076, 4.7619 }, - { 35.2314, 0 }, - { 54.279, 0 }, - { 63.8029, 4.7619 }, - { 73.3267, 14.2857 }, - { 78.0886, 23.8095 }, -}; - -static const StrokeRec char67[] = { - { 18, char67_stroke0 }, -}; - -/* char: 68 'D' */ - -static const CoordRec char68_stroke0[] = { - { 11.96, 100 }, - { 11.96, 0 }, -}; - -static const CoordRec char68_stroke1[] = { - { 11.96, 100 }, - { 45.2933, 100 }, - { 59.579, 95.2381 }, - { 69.1029, 85.7143 }, - { 73.8648, 76.1905 }, - { 78.6267, 61.9048 }, - { 78.6267, 38.0952 }, - { 73.8648, 23.8095 }, - { 69.1029, 14.2857 }, - { 59.579, 4.7619 }, - { 45.2933, 0 }, - { 11.96, 0 }, -}; - -static const StrokeRec char68[] = { - { 2, char68_stroke0 }, - { 12, char68_stroke1 }, -}; - -/* char: 69 'E' */ - -static const CoordRec char69_stroke0[] = { - { 11.42, 100 }, - { 11.42, 0 }, -}; - -static const CoordRec char69_stroke1[] = { - { 11.42, 100 }, - { 73.3248, 100 }, -}; - -static const CoordRec char69_stroke2[] = { - { 11.42, 52.381 }, - { 49.5152, 52.381 }, -}; - -static const CoordRec char69_stroke3[] = { - { 11.42, 0 }, - { 73.3248, 0 }, -}; - -static const StrokeRec char69[] = { - { 2, char69_stroke0 }, - { 2, char69_stroke1 }, - { 2, char69_stroke2 }, - { 2, char69_stroke3 }, -}; - -/* char: 70 'F' */ - -static const CoordRec char70_stroke0[] = { - { 11.42, 100 }, - { 11.42, 0 }, -}; - -static const CoordRec char70_stroke1[] = { - { 11.42, 100 }, - { 73.3248, 100 }, -}; - -static const CoordRec char70_stroke2[] = { - { 11.42, 52.381 }, - { 49.5152, 52.381 }, -}; - -static const StrokeRec char70[] = { - { 2, char70_stroke0 }, - { 2, char70_stroke1 }, - { 2, char70_stroke2 }, -}; - -/* char: 71 'G' */ - -static const CoordRec char71_stroke0[] = { - { 78.4886, 76.1905 }, - { 73.7267, 85.7143 }, - { 64.2029, 95.2381 }, - { 54.679, 100 }, - { 35.6314, 100 }, - { 26.1076, 95.2381 }, - { 16.5838, 85.7143 }, - { 11.8219, 76.1905 }, - { 7.06, 61.9048 }, - { 7.06, 38.0952 }, - { 11.8219, 23.8095 }, - { 16.5838, 14.2857 }, - { 26.1076, 4.7619 }, - { 35.6314, 0 }, - { 54.679, 0 }, - { 64.2029, 4.7619 }, - { 73.7267, 14.2857 }, - { 78.4886, 23.8095 }, - { 78.4886, 38.0952 }, -}; - -static const CoordRec char71_stroke1[] = { - { 54.679, 38.0952 }, - { 78.4886, 38.0952 }, -}; - -static const StrokeRec char71[] = { - { 19, char71_stroke0 }, - { 2, char71_stroke1 }, -}; - -/* char: 72 'H' */ - -static const CoordRec char72_stroke0[] = { - { 11.42, 100 }, - { 11.42, 0 }, -}; - -static const CoordRec char72_stroke1[] = { - { 78.0867, 100 }, - { 78.0867, 0 }, -}; - -static const CoordRec char72_stroke2[] = { - { 11.42, 52.381 }, - { 78.0867, 52.381 }, -}; - -static const StrokeRec char72[] = { - { 2, char72_stroke0 }, - { 2, char72_stroke1 }, - { 2, char72_stroke2 }, -}; - -/* char: 73 'I' */ - -static const CoordRec char73_stroke0[] = { - { 10.86, 100 }, - { 10.86, 0 }, -}; - -static const StrokeRec char73[] = { - { 2, char73_stroke0 }, -}; - -/* char: 74 'J' */ - -static const CoordRec char74_stroke0[] = { - { 50.119, 100 }, - { 50.119, 23.8095 }, - { 45.3571, 9.5238 }, - { 40.5952, 4.7619 }, - { 31.0714, 0 }, - { 21.5476, 0 }, - { 12.0238, 4.7619 }, - { 7.2619, 9.5238 }, - { 2.5, 23.8095 }, - { 2.5, 33.3333 }, -}; - -static const StrokeRec char74[] = { - { 10, char74_stroke0 }, -}; - -/* char: 75 'K' */ - -static const CoordRec char75_stroke0[] = { - { 11.28, 100 }, - { 11.28, 0 }, -}; - -static const CoordRec char75_stroke1[] = { - { 77.9467, 100 }, - { 11.28, 33.3333 }, -}; - -static const CoordRec char75_stroke2[] = { - { 35.0895, 57.1429 }, - { 77.9467, 0 }, -}; - -static const StrokeRec char75[] = { - { 2, char75_stroke0 }, - { 2, char75_stroke1 }, - { 2, char75_stroke2 }, -}; - -/* char: 76 'L' */ - -static const CoordRec char76_stroke0[] = { - { 11.68, 100 }, - { 11.68, 0 }, -}; - -static const CoordRec char76_stroke1[] = { - { 11.68, 0 }, - { 68.8229, 0 }, -}; - -static const StrokeRec char76[] = { - { 2, char76_stroke0 }, - { 2, char76_stroke1 }, -}; - -/* char: 77 'M' */ - -static const CoordRec char77_stroke0[] = { - { 10.86, 100 }, - { 10.86, 0 }, -}; - -static const CoordRec char77_stroke1[] = { - { 10.86, 100 }, - { 48.9552, 0 }, -}; - -static const CoordRec char77_stroke2[] = { - { 87.0505, 100 }, - { 48.9552, 0 }, -}; - -static const CoordRec char77_stroke3[] = { - { 87.0505, 100 }, - { 87.0505, 0 }, -}; - -static const StrokeRec char77[] = { - { 2, char77_stroke0 }, - { 2, char77_stroke1 }, - { 2, char77_stroke2 }, - { 2, char77_stroke3 }, -}; - -/* char: 78 'N' */ - -static const CoordRec char78_stroke0[] = { - { 11.14, 100 }, - { 11.14, 0 }, -}; - -static const CoordRec char78_stroke1[] = { - { 11.14, 100 }, - { 77.8067, 0 }, -}; - -static const CoordRec char78_stroke2[] = { - { 77.8067, 100 }, - { 77.8067, 0 }, -}; - -static const StrokeRec char78[] = { - { 2, char78_stroke0 }, - { 2, char78_stroke1 }, - { 2, char78_stroke2 }, -}; - -/* char: 79 'O' */ - -static const CoordRec char79_stroke0[] = { - { 34.8114, 100 }, - { 25.2876, 95.2381 }, - { 15.7638, 85.7143 }, - { 11.0019, 76.1905 }, - { 6.24, 61.9048 }, - { 6.24, 38.0952 }, - { 11.0019, 23.8095 }, - { 15.7638, 14.2857 }, - { 25.2876, 4.7619 }, - { 34.8114, 0 }, - { 53.859, 0 }, - { 63.3829, 4.7619 }, - { 72.9067, 14.2857 }, - { 77.6686, 23.8095 }, - { 82.4305, 38.0952 }, - { 82.4305, 61.9048 }, - { 77.6686, 76.1905 }, - { 72.9067, 85.7143 }, - { 63.3829, 95.2381 }, - { 53.859, 100 }, - { 34.8114, 100 }, -}; - -static const StrokeRec char79[] = { - { 21, char79_stroke0 }, -}; - -/* char: 80 'P' */ - -static const CoordRec char80_stroke0[] = { - { 12.1, 100 }, - { 12.1, 0 }, -}; - -static const CoordRec char80_stroke1[] = { - { 12.1, 100 }, - { 54.9571, 100 }, - { 69.2429, 95.2381 }, - { 74.0048, 90.4762 }, - { 78.7667, 80.9524 }, - { 78.7667, 66.6667 }, - { 74.0048, 57.1429 }, - { 69.2429, 52.381 }, - { 54.9571, 47.619 }, - { 12.1, 47.619 }, -}; - -static const StrokeRec char80[] = { - { 2, char80_stroke0 }, - { 10, char80_stroke1 }, -}; - -/* char: 81 'Q' */ - -static const CoordRec char81_stroke0[] = { - { 33.8714, 100 }, - { 24.3476, 95.2381 }, - { 14.8238, 85.7143 }, - { 10.0619, 76.1905 }, - { 5.3, 61.9048 }, - { 5.3, 38.0952 }, - { 10.0619, 23.8095 }, - { 14.8238, 14.2857 }, - { 24.3476, 4.7619 }, - { 33.8714, 0 }, - { 52.919, 0 }, - { 62.4429, 4.7619 }, - { 71.9667, 14.2857 }, - { 76.7286, 23.8095 }, - { 81.4905, 38.0952 }, - { 81.4905, 61.9048 }, - { 76.7286, 76.1905 }, - { 71.9667, 85.7143 }, - { 62.4429, 95.2381 }, - { 52.919, 100 }, - { 33.8714, 100 }, -}; - -static const CoordRec char81_stroke1[] = { - { 48.1571, 19.0476 }, - { 76.7286, -9.5238 }, -}; - -static const StrokeRec char81[] = { - { 21, char81_stroke0 }, - { 2, char81_stroke1 }, -}; - -/* char: 82 'R' */ - -static const CoordRec char82_stroke0[] = { - { 11.68, 100 }, - { 11.68, 0 }, -}; - -static const CoordRec char82_stroke1[] = { - { 11.68, 100 }, - { 54.5371, 100 }, - { 68.8229, 95.2381 }, - { 73.5848, 90.4762 }, - { 78.3467, 80.9524 }, - { 78.3467, 71.4286 }, - { 73.5848, 61.9048 }, - { 68.8229, 57.1429 }, - { 54.5371, 52.381 }, - { 11.68, 52.381 }, -}; - -static const CoordRec char82_stroke2[] = { - { 45.0133, 52.381 }, - { 78.3467, 0 }, -}; - -static const StrokeRec char82[] = { - { 2, char82_stroke0 }, - { 10, char82_stroke1 }, - { 2, char82_stroke2 }, -}; - -/* char: 83 'S' */ - -static const CoordRec char83_stroke0[] = { - { 74.6667, 85.7143 }, - { 65.1429, 95.2381 }, - { 50.8571, 100 }, - { 31.8095, 100 }, - { 17.5238, 95.2381 }, - { 8, 85.7143 }, - { 8, 76.1905 }, - { 12.7619, 66.6667 }, - { 17.5238, 61.9048 }, - { 27.0476, 57.1429 }, - { 55.619, 47.619 }, - { 65.1429, 42.8571 }, - { 69.9048, 38.0952 }, - { 74.6667, 28.5714 }, - { 74.6667, 14.2857 }, - { 65.1429, 4.7619 }, - { 50.8571, 0 }, - { 31.8095, 0 }, - { 17.5238, 4.7619 }, - { 8, 14.2857 }, -}; - -static const StrokeRec char83[] = { - { 20, char83_stroke0 }, -}; - -/* char: 84 'T' */ - -static const CoordRec char84_stroke0[] = { - { 35.6933, 100 }, - { 35.6933, 0 }, -}; - -static const CoordRec char84_stroke1[] = { - { 2.36, 100 }, - { 69.0267, 100 }, -}; - -static const StrokeRec char84[] = { - { 2, char84_stroke0 }, - { 2, char84_stroke1 }, -}; - -/* char: 85 'U' */ - -static const CoordRec char85_stroke0[] = { - { 11.54, 100 }, - { 11.54, 28.5714 }, - { 16.3019, 14.2857 }, - { 25.8257, 4.7619 }, - { 40.1114, 0 }, - { 49.6352, 0 }, - { 63.921, 4.7619 }, - { 73.4448, 14.2857 }, - { 78.2067, 28.5714 }, - { 78.2067, 100 }, -}; - -static const StrokeRec char85[] = { - { 10, char85_stroke0 }, -}; - -/* char: 86 'V' */ - -static const CoordRec char86_stroke0[] = { - { 2.36, 100 }, - { 40.4552, 0 }, -}; - -static const CoordRec char86_stroke1[] = { - { 78.5505, 100 }, - { 40.4552, 0 }, -}; - -static const StrokeRec char86[] = { - { 2, char86_stroke0 }, - { 2, char86_stroke1 }, -}; - -/* char: 87 'W' */ - -static const CoordRec char87_stroke0[] = { - { 2.22, 100 }, - { 26.0295, 0 }, -}; - -static const CoordRec char87_stroke1[] = { - { 49.839, 100 }, - { 26.0295, 0 }, -}; - -static const CoordRec char87_stroke2[] = { - { 49.839, 100 }, - { 73.6486, 0 }, -}; - -static const CoordRec char87_stroke3[] = { - { 97.4581, 100 }, - { 73.6486, 0 }, -}; - -static const StrokeRec char87[] = { - { 2, char87_stroke0 }, - { 2, char87_stroke1 }, - { 2, char87_stroke2 }, - { 2, char87_stroke3 }, -}; - -/* char: 88 'X' */ - -static const CoordRec char88_stroke0[] = { - { 2.5, 100 }, - { 69.1667, 0 }, -}; - -static const CoordRec char88_stroke1[] = { - { 69.1667, 100 }, - { 2.5, 0 }, -}; - -static const StrokeRec char88[] = { - { 2, char88_stroke0 }, - { 2, char88_stroke1 }, -}; - -/* char: 89 'Y' */ - -static const CoordRec char89_stroke0[] = { - { 1.52, 100 }, - { 39.6152, 52.381 }, - { 39.6152, 0 }, -}; - -static const CoordRec char89_stroke1[] = { - { 77.7105, 100 }, - { 39.6152, 52.381 }, -}; - -static const StrokeRec char89[] = { - { 3, char89_stroke0 }, - { 2, char89_stroke1 }, -}; - -/* char: 90 'Z' */ - -static const CoordRec char90_stroke0[] = { - { 69.1667, 100 }, - { 2.5, 0 }, -}; - -static const CoordRec char90_stroke1[] = { - { 2.5, 100 }, - { 69.1667, 100 }, -}; - -static const CoordRec char90_stroke2[] = { - { 2.5, 0 }, - { 69.1667, 0 }, -}; - -static const StrokeRec char90[] = { - { 2, char90_stroke0 }, - { 2, char90_stroke1 }, - { 2, char90_stroke2 }, -}; - -/* char: 91 '[' */ - -static const CoordRec char91_stroke0[] = { - { 7.78, 119.048 }, - { 7.78, -33.3333 }, -}; - -static const CoordRec char91_stroke1[] = { - { 12.5419, 119.048 }, - { 12.5419, -33.3333 }, -}; - -static const CoordRec char91_stroke2[] = { - { 7.78, 119.048 }, - { 41.1133, 119.048 }, -}; - -static const CoordRec char91_stroke3[] = { - { 7.78, -33.3333 }, - { 41.1133, -33.3333 }, -}; - -static const StrokeRec char91[] = { - { 2, char91_stroke0 }, - { 2, char91_stroke1 }, - { 2, char91_stroke2 }, - { 2, char91_stroke3 }, -}; - -/* char: 92 '\' */ - -static const CoordRec char92_stroke0[] = { - { 5.84, 100 }, - { 72.5067, -14.2857 }, -}; - -static const StrokeRec char92[] = { - { 2, char92_stroke0 }, -}; - -/* char: 93 ']' */ - -static const CoordRec char93_stroke0[] = { - { 33.0114, 119.048 }, - { 33.0114, -33.3333 }, -}; - -static const CoordRec char93_stroke1[] = { - { 37.7733, 119.048 }, - { 37.7733, -33.3333 }, -}; - -static const CoordRec char93_stroke2[] = { - { 4.44, 119.048 }, - { 37.7733, 119.048 }, -}; - -static const CoordRec char93_stroke3[] = { - { 4.44, -33.3333 }, - { 37.7733, -33.3333 }, -}; - -static const StrokeRec char93[] = { - { 2, char93_stroke0 }, - { 2, char93_stroke1 }, - { 2, char93_stroke2 }, - { 2, char93_stroke3 }, -}; - -/* char: 94 '^' */ - -static const CoordRec char94_stroke0[] = { - { 44.0752, 109.524 }, - { 5.98, 42.8571 }, -}; - -static const CoordRec char94_stroke1[] = { - { 44.0752, 109.524 }, - { 82.1705, 42.8571 }, -}; - -static const StrokeRec char94[] = { - { 2, char94_stroke0 }, - { 2, char94_stroke1 }, -}; - -/* char: 95 '_' */ - -static const CoordRec char95_stroke0[] = { - { -1.1, -33.3333 }, - { 103.662, -33.3333 }, - { 103.662, -28.5714 }, - { -1.1, -28.5714 }, - { -1.1, -33.3333 }, -}; - -static const StrokeRec char95[] = { - { 5, char95_stroke0 }, -}; - -/* char: 96 '`' */ - -static const CoordRec char96_stroke0[] = { - { 33.0219, 100 }, - { 56.8314, 71.4286 }, -}; - -static const CoordRec char96_stroke1[] = { - { 33.0219, 100 }, - { 28.26, 95.2381 }, - { 56.8314, 71.4286 }, -}; - -static const StrokeRec char96[] = { - { 2, char96_stroke0 }, - { 3, char96_stroke1 }, -}; - -/* char: 97 'a' */ - -static const CoordRec char97_stroke0[] = { - { 63.8229, 66.6667 }, - { 63.8229, 0 }, -}; - -static const CoordRec char97_stroke1[] = { - { 63.8229, 52.381 }, - { 54.299, 61.9048 }, - { 44.7752, 66.6667 }, - { 30.4895, 66.6667 }, - { 20.9657, 61.9048 }, - { 11.4419, 52.381 }, - { 6.68, 38.0952 }, - { 6.68, 28.5714 }, - { 11.4419, 14.2857 }, - { 20.9657, 4.7619 }, - { 30.4895, 0 }, - { 44.7752, 0 }, - { 54.299, 4.7619 }, - { 63.8229, 14.2857 }, -}; - -static const StrokeRec char97[] = { - { 2, char97_stroke0 }, - { 14, char97_stroke1 }, -}; - -/* char: 98 'b' */ - -static const CoordRec char98_stroke0[] = { - { 8.76, 100 }, - { 8.76, 0 }, -}; - -static const CoordRec char98_stroke1[] = { - { 8.76, 52.381 }, - { 18.2838, 61.9048 }, - { 27.8076, 66.6667 }, - { 42.0933, 66.6667 }, - { 51.6171, 61.9048 }, - { 61.141, 52.381 }, - { 65.9029, 38.0952 }, - { 65.9029, 28.5714 }, - { 61.141, 14.2857 }, - { 51.6171, 4.7619 }, - { 42.0933, 0 }, - { 27.8076, 0 }, - { 18.2838, 4.7619 }, - { 8.76, 14.2857 }, -}; - -static const StrokeRec char98[] = { - { 2, char98_stroke0 }, - { 14, char98_stroke1 }, -}; - -/* char: 99 'c' */ - -static const CoordRec char99_stroke0[] = { - { 62.6629, 52.381 }, - { 53.139, 61.9048 }, - { 43.6152, 66.6667 }, - { 29.3295, 66.6667 }, - { 19.8057, 61.9048 }, - { 10.2819, 52.381 }, - { 5.52, 38.0952 }, - { 5.52, 28.5714 }, - { 10.2819, 14.2857 }, - { 19.8057, 4.7619 }, - { 29.3295, 0 }, - { 43.6152, 0 }, - { 53.139, 4.7619 }, - { 62.6629, 14.2857 }, -}; - -static const StrokeRec char99[] = { - { 14, char99_stroke0 }, -}; - -/* char: 100 'd' */ - -static const CoordRec char100_stroke0[] = { - { 61.7829, 100 }, - { 61.7829, 0 }, -}; - -static const CoordRec char100_stroke1[] = { - { 61.7829, 52.381 }, - { 52.259, 61.9048 }, - { 42.7352, 66.6667 }, - { 28.4495, 66.6667 }, - { 18.9257, 61.9048 }, - { 9.4019, 52.381 }, - { 4.64, 38.0952 }, - { 4.64, 28.5714 }, - { 9.4019, 14.2857 }, - { 18.9257, 4.7619 }, - { 28.4495, 0 }, - { 42.7352, 0 }, - { 52.259, 4.7619 }, - { 61.7829, 14.2857 }, -}; - -static const StrokeRec char100[] = { - { 2, char100_stroke0 }, - { 14, char100_stroke1 }, -}; - -/* char: 101 'e' */ - -static const CoordRec char101_stroke0[] = { - { 5.72, 38.0952 }, - { 62.8629, 38.0952 }, - { 62.8629, 47.619 }, - { 58.101, 57.1429 }, - { 53.339, 61.9048 }, - { 43.8152, 66.6667 }, - { 29.5295, 66.6667 }, - { 20.0057, 61.9048 }, - { 10.4819, 52.381 }, - { 5.72, 38.0952 }, - { 5.72, 28.5714 }, - { 10.4819, 14.2857 }, - { 20.0057, 4.7619 }, - { 29.5295, 0 }, - { 43.8152, 0 }, - { 53.339, 4.7619 }, - { 62.8629, 14.2857 }, -}; - -static const StrokeRec char101[] = { - { 17, char101_stroke0 }, -}; - -/* char: 102 'f' */ - -static const CoordRec char102_stroke0[] = { - { 38.7752, 100 }, - { 29.2514, 100 }, - { 19.7276, 95.2381 }, - { 14.9657, 80.9524 }, - { 14.9657, 0 }, -}; - -static const CoordRec char102_stroke1[] = { - { 0.68, 66.6667 }, - { 34.0133, 66.6667 }, -}; - -static const StrokeRec char102[] = { - { 5, char102_stroke0 }, - { 2, char102_stroke1 }, -}; - -/* char: 103 'g' */ - -static const CoordRec char103_stroke0[] = { - { 62.5029, 66.6667 }, - { 62.5029, -9.5238 }, - { 57.741, -23.8095 }, - { 52.979, -28.5714 }, - { 43.4552, -33.3333 }, - { 29.1695, -33.3333 }, - { 19.6457, -28.5714 }, -}; - -static const CoordRec char103_stroke1[] = { - { 62.5029, 52.381 }, - { 52.979, 61.9048 }, - { 43.4552, 66.6667 }, - { 29.1695, 66.6667 }, - { 19.6457, 61.9048 }, - { 10.1219, 52.381 }, - { 5.36, 38.0952 }, - { 5.36, 28.5714 }, - { 10.1219, 14.2857 }, - { 19.6457, 4.7619 }, - { 29.1695, 0 }, - { 43.4552, 0 }, - { 52.979, 4.7619 }, - { 62.5029, 14.2857 }, -}; - -static const StrokeRec char103[] = { - { 7, char103_stroke0 }, - { 14, char103_stroke1 }, -}; - -/* char: 104 'h' */ - -static const CoordRec char104_stroke0[] = { - { 9.6, 100 }, - { 9.6, 0 }, -}; - -static const CoordRec char104_stroke1[] = { - { 9.6, 47.619 }, - { 23.8857, 61.9048 }, - { 33.4095, 66.6667 }, - { 47.6952, 66.6667 }, - { 57.219, 61.9048 }, - { 61.981, 47.619 }, - { 61.981, 0 }, -}; - -static const StrokeRec char104[] = { - { 2, char104_stroke0 }, - { 7, char104_stroke1 }, -}; - -/* char: 105 'i' */ - -static const CoordRec char105_stroke0[] = { - { 10.02, 100 }, - { 14.7819, 95.2381 }, - { 19.5438, 100 }, - { 14.7819, 104.762 }, - { 10.02, 100 }, -}; - -static const CoordRec char105_stroke1[] = { - { 14.7819, 66.6667 }, - { 14.7819, 0 }, -}; - -static const StrokeRec char105[] = { - { 5, char105_stroke0 }, - { 2, char105_stroke1 }, -}; - -/* char: 106 'j' */ - -static const CoordRec char106_stroke0[] = { - { 17.3876, 100 }, - { 22.1495, 95.2381 }, - { 26.9114, 100 }, - { 22.1495, 104.762 }, - { 17.3876, 100 }, -}; - -static const CoordRec char106_stroke1[] = { - { 22.1495, 66.6667 }, - { 22.1495, -14.2857 }, - { 17.3876, -28.5714 }, - { 7.8638, -33.3333 }, - { -1.66, -33.3333 }, -}; - -static const StrokeRec char106[] = { - { 5, char106_stroke0 }, - { 5, char106_stroke1 }, -}; - -/* char: 107 'k' */ - -static const CoordRec char107_stroke0[] = { - { 9.6, 100 }, - { 9.6, 0 }, -}; - -static const CoordRec char107_stroke1[] = { - { 57.219, 66.6667 }, - { 9.6, 19.0476 }, -}; - -static const CoordRec char107_stroke2[] = { - { 28.6476, 38.0952 }, - { 61.981, 0 }, -}; - -static const StrokeRec char107[] = { - { 2, char107_stroke0 }, - { 2, char107_stroke1 }, - { 2, char107_stroke2 }, -}; - -/* char: 108 'l' */ - -static const CoordRec char108_stroke0[] = { - { 10.02, 100 }, - { 10.02, 0 }, -}; - -static const StrokeRec char108[] = { - { 2, char108_stroke0 }, -}; - -/* char: 109 'm' */ - -static const CoordRec char109_stroke0[] = { - { 9.6, 66.6667 }, - { 9.6, 0 }, -}; - -static const CoordRec char109_stroke1[] = { - { 9.6, 47.619 }, - { 23.8857, 61.9048 }, - { 33.4095, 66.6667 }, - { 47.6952, 66.6667 }, - { 57.219, 61.9048 }, - { 61.981, 47.619 }, - { 61.981, 0 }, -}; - -static const CoordRec char109_stroke2[] = { - { 61.981, 47.619 }, - { 76.2667, 61.9048 }, - { 85.7905, 66.6667 }, - { 100.076, 66.6667 }, - { 109.6, 61.9048 }, - { 114.362, 47.619 }, - { 114.362, 0 }, -}; - -static const StrokeRec char109[] = { - { 2, char109_stroke0 }, - { 7, char109_stroke1 }, - { 7, char109_stroke2 }, -}; - -/* char: 110 'n' */ - -static const CoordRec char110_stroke0[] = { - { 9.18, 66.6667 }, - { 9.18, 0 }, -}; - -static const CoordRec char110_stroke1[] = { - { 9.18, 47.619 }, - { 23.4657, 61.9048 }, - { 32.9895, 66.6667 }, - { 47.2752, 66.6667 }, - { 56.799, 61.9048 }, - { 61.561, 47.619 }, - { 61.561, 0 }, -}; - -static const StrokeRec char110[] = { - { 2, char110_stroke0 }, - { 7, char110_stroke1 }, -}; - -/* char: 111 'o' */ - -static const CoordRec char111_stroke0[] = { - { 28.7895, 66.6667 }, - { 19.2657, 61.9048 }, - { 9.7419, 52.381 }, - { 4.98, 38.0952 }, - { 4.98, 28.5714 }, - { 9.7419, 14.2857 }, - { 19.2657, 4.7619 }, - { 28.7895, 0 }, - { 43.0752, 0 }, - { 52.599, 4.7619 }, - { 62.1229, 14.2857 }, - { 66.8848, 28.5714 }, - { 66.8848, 38.0952 }, - { 62.1229, 52.381 }, - { 52.599, 61.9048 }, - { 43.0752, 66.6667 }, - { 28.7895, 66.6667 }, -}; - -static const StrokeRec char111[] = { - { 17, char111_stroke0 }, -}; - -/* char: 112 'p' */ - -static const CoordRec char112_stroke0[] = { - { 9.46, 66.6667 }, - { 9.46, -33.3333 }, -}; - -static const CoordRec char112_stroke1[] = { - { 9.46, 52.381 }, - { 18.9838, 61.9048 }, - { 28.5076, 66.6667 }, - { 42.7933, 66.6667 }, - { 52.3171, 61.9048 }, - { 61.841, 52.381 }, - { 66.6029, 38.0952 }, - { 66.6029, 28.5714 }, - { 61.841, 14.2857 }, - { 52.3171, 4.7619 }, - { 42.7933, 0 }, - { 28.5076, 0 }, - { 18.9838, 4.7619 }, - { 9.46, 14.2857 }, -}; - -static const StrokeRec char112[] = { - { 2, char112_stroke0 }, - { 14, char112_stroke1 }, -}; - -/* char: 113 'q' */ - -static const CoordRec char113_stroke0[] = { - { 61.9829, 66.6667 }, - { 61.9829, -33.3333 }, -}; - -static const CoordRec char113_stroke1[] = { - { 61.9829, 52.381 }, - { 52.459, 61.9048 }, - { 42.9352, 66.6667 }, - { 28.6495, 66.6667 }, - { 19.1257, 61.9048 }, - { 9.6019, 52.381 }, - { 4.84, 38.0952 }, - { 4.84, 28.5714 }, - { 9.6019, 14.2857 }, - { 19.1257, 4.7619 }, - { 28.6495, 0 }, - { 42.9352, 0 }, - { 52.459, 4.7619 }, - { 61.9829, 14.2857 }, -}; - -static const StrokeRec char113[] = { - { 2, char113_stroke0 }, - { 14, char113_stroke1 }, -}; - -/* char: 114 'r' */ - -static const CoordRec char114_stroke0[] = { - { 9.46, 66.6667 }, - { 9.46, 0 }, -}; - -static const CoordRec char114_stroke1[] = { - { 9.46, 38.0952 }, - { 14.2219, 52.381 }, - { 23.7457, 61.9048 }, - { 33.2695, 66.6667 }, - { 47.5552, 66.6667 }, -}; - -static const StrokeRec char114[] = { - { 2, char114_stroke0 }, - { 5, char114_stroke1 }, -}; - -/* char: 115 's' */ - -static const CoordRec char115_stroke0[] = { - { 57.081, 52.381 }, - { 52.319, 61.9048 }, - { 38.0333, 66.6667 }, - { 23.7476, 66.6667 }, - { 9.4619, 61.9048 }, - { 4.7, 52.381 }, - { 9.4619, 42.8571 }, - { 18.9857, 38.0952 }, - { 42.7952, 33.3333 }, - { 52.319, 28.5714 }, - { 57.081, 19.0476 }, - { 57.081, 14.2857 }, - { 52.319, 4.7619 }, - { 38.0333, 0 }, - { 23.7476, 0 }, - { 9.4619, 4.7619 }, - { 4.7, 14.2857 }, -}; - -static const StrokeRec char115[] = { - { 17, char115_stroke0 }, -}; - -/* char: 116 't' */ - -static const CoordRec char116_stroke0[] = { - { 14.8257, 100 }, - { 14.8257, 19.0476 }, - { 19.5876, 4.7619 }, - { 29.1114, 0 }, - { 38.6352, 0 }, -}; - -static const CoordRec char116_stroke1[] = { - { 0.54, 66.6667 }, - { 33.8733, 66.6667 }, -}; - -static const StrokeRec char116[] = { - { 5, char116_stroke0 }, - { 2, char116_stroke1 }, -}; - -/* char: 117 'u' */ - -static const CoordRec char117_stroke0[] = { - { 9.46, 66.6667 }, - { 9.46, 19.0476 }, - { 14.2219, 4.7619 }, - { 23.7457, 0 }, - { 38.0314, 0 }, - { 47.5552, 4.7619 }, - { 61.841, 19.0476 }, -}; - -static const CoordRec char117_stroke1[] = { - { 61.841, 66.6667 }, - { 61.841, 0 }, -}; - -static const StrokeRec char117[] = { - { 7, char117_stroke0 }, - { 2, char117_stroke1 }, -}; - -/* char: 118 'v' */ - -static const CoordRec char118_stroke0[] = { - { 1.8, 66.6667 }, - { 30.3714, 0 }, -}; - -static const CoordRec char118_stroke1[] = { - { 58.9429, 66.6667 }, - { 30.3714, 0 }, -}; - -static const StrokeRec char118[] = { - { 2, char118_stroke0 }, - { 2, char118_stroke1 }, -}; - -/* char: 119 'w' */ - -static const CoordRec char119_stroke0[] = { - { 2.5, 66.6667 }, - { 21.5476, 0 }, -}; - -static const CoordRec char119_stroke1[] = { - { 40.5952, 66.6667 }, - { 21.5476, 0 }, -}; - -static const CoordRec char119_stroke2[] = { - { 40.5952, 66.6667 }, - { 59.6429, 0 }, -}; - -static const CoordRec char119_stroke3[] = { - { 78.6905, 66.6667 }, - { 59.6429, 0 }, -}; - -static const StrokeRec char119[] = { - { 2, char119_stroke0 }, - { 2, char119_stroke1 }, - { 2, char119_stroke2 }, - { 2, char119_stroke3 }, -}; - -/* char: 120 'x' */ - -static const CoordRec char120_stroke0[] = { - { 1.66, 66.6667 }, - { 54.041, 0 }, -}; - -static const CoordRec char120_stroke1[] = { - { 54.041, 66.6667 }, - { 1.66, 0 }, -}; - -static const StrokeRec char120[] = { - { 2, char120_stroke0 }, - { 2, char120_stroke1 }, -}; - -/* char: 121 'y' */ - -static const CoordRec char121_stroke0[] = { - { 6.5619, 66.6667 }, - { 35.1333, 0 }, -}; - -static const CoordRec char121_stroke1[] = { - { 63.7048, 66.6667 }, - { 35.1333, 0 }, - { 25.6095, -19.0476 }, - { 16.0857, -28.5714 }, - { 6.5619, -33.3333 }, - { 1.8, -33.3333 }, -}; - -static const StrokeRec char121[] = { - { 2, char121_stroke0 }, - { 6, char121_stroke1 }, -}; - -/* char: 122 'z' */ - -static const CoordRec char122_stroke0[] = { - { 56.821, 66.6667 }, - { 4.44, 0 }, -}; - -static const CoordRec char122_stroke1[] = { - { 4.44, 66.6667 }, - { 56.821, 66.6667 }, -}; - -static const CoordRec char122_stroke2[] = { - { 4.44, 0 }, - { 56.821, 0 }, -}; - -static const StrokeRec char122[] = { - { 2, char122_stroke0 }, - { 2, char122_stroke1 }, - { 2, char122_stroke2 }, -}; - -/* char: 123 '{' */ - -static const CoordRec char123_stroke0[] = { - { 31.1895, 119.048 }, - { 21.6657, 114.286 }, - { 16.9038, 109.524 }, - { 12.1419, 100 }, - { 12.1419, 90.4762 }, - { 16.9038, 80.9524 }, - { 21.6657, 76.1905 }, - { 26.4276, 66.6667 }, - { 26.4276, 57.1429 }, - { 16.9038, 47.619 }, -}; - -static const CoordRec char123_stroke1[] = { - { 21.6657, 114.286 }, - { 16.9038, 104.762 }, - { 16.9038, 95.2381 }, - { 21.6657, 85.7143 }, - { 26.4276, 80.9524 }, - { 31.1895, 71.4286 }, - { 31.1895, 61.9048 }, - { 26.4276, 52.381 }, - { 7.38, 42.8571 }, - { 26.4276, 33.3333 }, - { 31.1895, 23.8095 }, - { 31.1895, 14.2857 }, - { 26.4276, 4.7619 }, - { 21.6657, 0 }, - { 16.9038, -9.5238 }, - { 16.9038, -19.0476 }, - { 21.6657, -28.5714 }, -}; - -static const CoordRec char123_stroke2[] = { - { 16.9038, 38.0952 }, - { 26.4276, 28.5714 }, - { 26.4276, 19.0476 }, - { 21.6657, 9.5238 }, - { 16.9038, 4.7619 }, - { 12.1419, -4.7619 }, - { 12.1419, -14.2857 }, - { 16.9038, -23.8095 }, - { 21.6657, -28.5714 }, - { 31.1895, -33.3333 }, -}; - -static const StrokeRec char123[] = { - { 10, char123_stroke0 }, - { 17, char123_stroke1 }, - { 10, char123_stroke2 }, -}; - -/* char: 124 '|' */ - -static const CoordRec char124_stroke0[] = { - { 11.54, 119.048 }, - { 11.54, -33.3333 }, -}; - -static const StrokeRec char124[] = { - { 2, char124_stroke0 }, -}; - -/* char: 125 '}' */ - -static const CoordRec char125_stroke0[] = { - { 9.18, 119.048 }, - { 18.7038, 114.286 }, - { 23.4657, 109.524 }, - { 28.2276, 100 }, - { 28.2276, 90.4762 }, - { 23.4657, 80.9524 }, - { 18.7038, 76.1905 }, - { 13.9419, 66.6667 }, - { 13.9419, 57.1429 }, - { 23.4657, 47.619 }, -}; - -static const CoordRec char125_stroke1[] = { - { 18.7038, 114.286 }, - { 23.4657, 104.762 }, - { 23.4657, 95.2381 }, - { 18.7038, 85.7143 }, - { 13.9419, 80.9524 }, - { 9.18, 71.4286 }, - { 9.18, 61.9048 }, - { 13.9419, 52.381 }, - { 32.9895, 42.8571 }, - { 13.9419, 33.3333 }, - { 9.18, 23.8095 }, - { 9.18, 14.2857 }, - { 13.9419, 4.7619 }, - { 18.7038, 0 }, - { 23.4657, -9.5238 }, - { 23.4657, -19.0476 }, - { 18.7038, -28.5714 }, -}; - -static const CoordRec char125_stroke2[] = { - { 23.4657, 38.0952 }, - { 13.9419, 28.5714 }, - { 13.9419, 19.0476 }, - { 18.7038, 9.5238 }, - { 23.4657, 4.7619 }, - { 28.2276, -4.7619 }, - { 28.2276, -14.2857 }, - { 23.4657, -23.8095 }, - { 18.7038, -28.5714 }, - { 9.18, -33.3333 }, -}; - -static const StrokeRec char125[] = { - { 10, char125_stroke0 }, - { 17, char125_stroke1 }, - { 10, char125_stroke2 }, -}; - -/* char: 126 '~' */ - -static const CoordRec char126_stroke0[] = { - { 2.92, 28.5714 }, - { 2.92, 38.0952 }, - { 7.6819, 52.381 }, - { 17.2057, 57.1429 }, - { 26.7295, 57.1429 }, - { 36.2533, 52.381 }, - { 55.301, 38.0952 }, - { 64.8248, 33.3333 }, - { 74.3486, 33.3333 }, - { 83.8724, 38.0952 }, - { 88.6343, 47.619 }, -}; - -static const CoordRec char126_stroke1[] = { - { 2.92, 38.0952 }, - { 7.6819, 47.619 }, - { 17.2057, 52.381 }, - { 26.7295, 52.381 }, - { 36.2533, 47.619 }, - { 55.301, 33.3333 }, - { 64.8248, 28.5714 }, - { 74.3486, 28.5714 }, - { 83.8724, 33.3333 }, - { 88.6343, 47.619 }, - { 88.6343, 57.1429 }, -}; - -static const StrokeRec char126[] = { - { 11, char126_stroke0 }, - { 11, char126_stroke1 }, -}; - -/* char: 127 */ - -static const CoordRec char127_stroke0[] = { - { 52.381, 100 }, - { 14.2857, -33.3333 }, -}; - -static const CoordRec char127_stroke1[] = { - { 28.5714, 66.6667 }, - { 14.2857, 61.9048 }, - { 4.7619, 52.381 }, - { 0, 38.0952 }, - { 0, 23.8095 }, - { 4.7619, 14.2857 }, - { 14.2857, 4.7619 }, - { 28.5714, 0 }, - { 38.0952, 0 }, - { 52.381, 4.7619 }, - { 61.9048, 14.2857 }, - { 66.6667, 28.5714 }, - { 66.6667, 42.8571 }, - { 61.9048, 52.381 }, - { 52.381, 61.9048 }, - { 38.0952, 66.6667 }, - { 28.5714, 66.6667 }, -}; - -static const StrokeRec char127[] = { - { 2, char127_stroke0 }, - { 17, char127_stroke1 }, -}; - -static const StrokeCharRec chars[] = { - { 0, /* char0 */ 0, 0, 0 }, - { 0, /* char1 */ 0, 0, 0 }, - { 0, /* char2 */ 0, 0, 0 }, - { 0, /* char3 */ 0, 0, 0 }, - { 0, /* char4 */ 0, 0, 0 }, - { 0, /* char5 */ 0, 0, 0 }, - { 0, /* char6 */ 0, 0, 0 }, - { 0, /* char7 */ 0, 0, 0 }, - { 0, /* char8 */ 0, 0, 0 }, - { 0, /* char9 */ 0, 0, 0 }, - { 0, /* char10 */ 0, 0, 0 }, - { 0, /* char11 */ 0, 0, 0 }, - { 0, /* char12 */ 0, 0, 0 }, - { 0, /* char13 */ 0, 0, 0 }, - { 0, /* char14 */ 0, 0, 0 }, - { 0, /* char15 */ 0, 0, 0 }, - { 0, /* char16 */ 0, 0, 0 }, - { 0, /* char17 */ 0, 0, 0 }, - { 0, /* char18 */ 0, 0, 0 }, - { 0, /* char19 */ 0, 0, 0 }, - { 0, /* char20 */ 0, 0, 0 }, - { 0, /* char21 */ 0, 0, 0 }, - { 0, /* char22 */ 0, 0, 0 }, - { 0, /* char23 */ 0, 0, 0 }, - { 0, /* char24 */ 0, 0, 0 }, - { 0, /* char25 */ 0, 0, 0 }, - { 0, /* char26 */ 0, 0, 0 }, - { 0, /* char27 */ 0, 0, 0 }, - { 0, /* char28 */ 0, 0, 0 }, - { 0, /* char29 */ 0, 0, 0 }, - { 0, /* char30 */ 0, 0, 0 }, - { 0, /* char31 */ 0, 0, 0 }, - { 0, /* char32 */ 0, 52.381, 104.762 }, - { 2, char33, 13.3819, 26.6238 }, - { 2, char34, 23.0676, 51.4352 }, - { 4, char35, 36.5333, 79.4886 }, - { 3, char36, 38.1533, 76.2067 }, - { 3, char37, 49.2171, 96.5743 }, - { 1, char38, 53.599, 101.758 }, - { 1, char39, 4.44, 13.62 }, - { 1, char40, 21.8657, 47.1733 }, - { 1, char41, 24.3276, 47.5333 }, - { 3, char42, 30.7695, 59.439 }, - { 2, char43, 48.8371, 97.2543 }, - { 1, char44, 13.5219, 26.0638 }, - { 1, char45, 50.2371, 100.754 }, - { 1, char46, 13.1019, 26.4838 }, - { 1, char47, 40.5733, 82.1067 }, - { 1, char48, 38.3133, 77.0667 }, - { 1, char49, 30.8676, 66.5295 }, - { 1, char50, 38.7533, 77.6467 }, - { 1, char51, 38.3333, 77.0467 }, - { 2, char52, 37.2133, 80.1686 }, - { 1, char53, 38.1933, 77.6867 }, - { 1, char54, 34.1514, 73.8048 }, - { 2, char55, 38.8933, 77.2267 }, - { 1, char56, 38.9333, 77.6667 }, - { 1, char57, 39.9333, 74.0648 }, - { 2, char58, 14.0819, 26.2238 }, - { 2, char59, 12.9619, 26.3038 }, - { 1, char60, 41.1552, 81.6105 }, - { 2, char61, 48.5571, 97.2543 }, - { 1, char62, 40.8752, 81.6105 }, - { 2, char63, 36.9914, 73.9029 }, - { 2, char64, 34.9314, 74.3648 }, - { 3, char65, 40.5952, 80.4905 }, - { 3, char66, 44.7533, 83.6267 }, - { 1, char67, 39.9933, 84.4886 }, - { 2, char68, 45.2933, 85.2867 }, - { 4, char69, 39.9914, 78.1848 }, - { 3, char70, 39.9914, 78.7448 }, - { 2, char71, 40.3933, 89.7686 }, - { 3, char72, 44.7533, 89.0867 }, - { 1, char73, 10.86, 21.3 }, - { 1, char74, 31.0714, 59.999 }, - { 3, char75, 44.6133, 79.3267 }, - { 2, char76, 40.2514, 71.3229 }, - { 4, char77, 48.9552, 97.2105 }, - { 3, char78, 44.4733, 88.8067 }, - { 1, char79, 44.3352, 88.8305 }, - { 2, char80, 45.4333, 85.6667 }, - { 2, char81, 43.3952, 88.0905 }, - { 3, char82, 45.0133, 82.3667 }, - { 1, char83, 41.3333, 80.8267 }, - { 2, char84, 35.6933, 71.9467 }, - { 1, char85, 44.8733, 89.4867 }, - { 2, char86, 40.4552, 81.6105 }, - { 4, char87, 49.839, 100.518 }, - { 2, char88, 35.8333, 72.3667 }, - { 2, char89, 39.6152, 79.6505 }, - { 3, char90, 35.8333, 73.7467 }, - { 4, char91, 22.0657, 46.1133 }, - { 1, char92, 39.1733, 78.2067 }, - { 4, char93, 23.4876, 46.3933 }, - { 2, char94, 44.0752, 90.2305 }, - { 1, char95, 51.281, 104.062 }, - { 2, char96, 42.5457, 83.5714 }, - { 2, char97, 35.2514, 66.6029 }, - { 2, char98, 37.3314, 70.4629 }, - { 1, char99, 34.0914, 68.9229 }, - { 2, char100, 33.2114, 70.2629 }, - { 1, char101, 34.2914, 68.5229 }, - { 2, char102, 14.9657, 38.6552 }, - { 2, char103, 33.9314, 70.9829 }, - { 2, char104, 33.4095, 71.021 }, - { 2, char105, 14.7819, 28.8638 }, - { 2, char106, 17.3876, 36.2314 }, - { 3, char107, 33.4095, 62.521 }, - { 1, char108, 10.02, 19.34 }, - { 3, char109, 61.981, 123.962 }, - { 2, char110, 32.9895, 70.881 }, - { 1, char111, 33.5514, 71.7448 }, - { 2, char112, 38.0314, 70.8029 }, - { 2, char113, 33.4114, 70.7429 }, - { 2, char114, 23.7457, 49.4952 }, - { 1, char115, 28.5095, 62.321 }, - { 2, char116, 14.8257, 39.3152 }, - { 2, char117, 33.2695, 71.161 }, - { 2, char118, 30.3714, 60.6029 }, - { 4, char119, 40.5952, 80.4905 }, - { 2, char120, 25.4695, 56.401 }, - { 2, char121, 35.1333, 66.0648 }, - { 3, char122, 28.2495, 61.821 }, - { 3, char123, 21.6657, 41.6295 }, - { 1, char124, 11.54, 23.78 }, - { 3, char125, 18.7038, 41.4695 }, - { 2, char126, 45.7771, 91.2743 }, - { 2, char127, 33.3333, 66.6667 }, -}; - -const StrokeFontRec glutStrokeRoman = { "Roman", 128, chars, 119.048, -33.3333 }; - -#endif - diff --git a/lib/SRC/Eden/gluttext/glut_stroke.c b/lib/SRC/Eden/gluttext/glut_stroke.c deleted file mode 100644 index 7f3afa3..0000000 --- a/lib/SRC/Eden/gluttext/glut_stroke.c +++ /dev/null @@ -1,57 +0,0 @@ -#include -#if GLUTTEXT_STROKE_ENABLE -#include "glStateCache.h" - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -//#include "glutint.h" -#include "glutstroke.h" - -void -glutStrokeCharacter(GLUTstrokeFont font, int c) -{ - const StrokeCharRec *ch; - const StrokeRec *stroke; - StrokeFontPtr fontinfo; - int i; -#if 0 - const CoordRec *coord; - int j; -#endif - - - fontinfo = (StrokeFontPtr) font; - - if (c < 0 || c >= fontinfo->num_chars) - return; - ch = &(fontinfo->ch[c]); - if (ch) { - for (i = ch->num_strokes, stroke = ch->stroke; - i > 0; i--, stroke++) { -#if 1 - // Essential setup for glDrawArrays(); - glVertexPointer(2, GL_FLOAT, 0, stroke->coord); - glStateCacheEnableClientStateVertexArray(); - glStateCacheClientActiveTexture(GL_TEXTURE0); - glStateCacheDisableClientStateTexCoordArray(); - glStateCacheDisableClientStateNormalArray(); - - glDrawArrays(GL_LINE_STRIP, 0, stroke->num_coords); -#else - glBegin(GL_LINE_STRIP); - for (j = stroke->num_coords, coord = stroke->coord; - j > 0; j--, coord++) { - glVertex2f(coord->x, coord->y); - } - glEnd(); -#endif - } - glTranslatef(ch->right, 0.0, 0.0); - } -} - -#endif diff --git a/lib/SRC/Eden/gluttext/glut_swidth.c b/lib/SRC/Eden/gluttext/glut_swidth.c deleted file mode 100644 index 854500d..0000000 --- a/lib/SRC/Eden/gluttext/glut_swidth.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#if GLUTTEXT_STROKE_ENABLE - - -/* Copyright (c) Mark J. Kilgard, 1995. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -//#include "glutint.h" -#include "glutstroke.h" - -/* CENTRY */ -int -glutStrokeWidth(GLUTstrokeFont font, int c) -{ - StrokeFontPtr fontinfo; - const StrokeCharRec *ch; - - fontinfo = (StrokeFontPtr) font; - - if (c < 0 || c >= fontinfo->num_chars) - return 0; - ch = &(fontinfo->ch[c]); - if (ch) - return ch->right; - else - return 0; -} - -int -glutStrokeLength(GLUTstrokeFont font, const unsigned char *string) -{ - int c, length; - StrokeFontPtr fontinfo; - const StrokeCharRec *ch; - - fontinfo = (StrokeFontPtr) font; - - length = 0; - for (; *string != '\0'; string++) { - c = *string; - if (c >= 0 && c < fontinfo->num_chars) { - ch = &(fontinfo->ch[c]); - if (ch) - length += ch->right; - } - } - return length; -} - -/* ENDCENTRY */ - -#endif diff --git a/lib/SRC/Eden/gluttext/glut_tr10.c b/lib/SRC/Eden/gluttext/glut_tr10.c deleted file mode 100644 index 3b6981d..0000000 --- a/lib/SRC/Eden/gluttext/glut_tr10.c +++ /dev/null @@ -1,1764 +0,0 @@ -#include -#if GLUTTEXT_STROKE_ENABLE - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmapTimesRoman10 XXX -#include "glutbitmap.h" -#undef glutBitmapTimesRoman10 - -/* char: 0xff */ - -static const GLubyte ch255data[] = { - 0x80,0xc0,0x40,0x60,0xa0,0x90,0xb8,0x0,0xa0, -}; - -static const BitmapCharRec ch255 = {5,9,0,2,5,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { - 0xc0,0x80,0xe0,0x90,0x90,0x90,0xe0,0x80,0x80, -}; - -static const BitmapCharRec ch254 = {4,9,0,2,5,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { - 0x80,0xc0,0x40,0x60,0xa0,0x90,0xb8,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch253 = {5,10,0,2,5,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { - 0x68,0x90,0x90,0x90,0x90,0x0,0x50, -}; - -static const BitmapCharRec ch252 = {5,7,0,0,5,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { - 0x68,0x90,0x90,0x90,0x90,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch251 = {5,8,0,0,5,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { - 0x68,0x90,0x90,0x90,0x90,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch250 = {5,8,0,0,5,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { - 0x68,0x90,0x90,0x90,0x90,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch249 = {5,8,0,0,5,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { - 0x80,0x70,0x48,0x48,0x48,0x38,0x4, -}; - -static const BitmapCharRec ch248 = {6,7,1,1,5,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { - 0x20,0x0,0xf8,0x0,0x20, -}; - -static const BitmapCharRec ch247 = {5,5,0,0,6,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { - 0x60,0x90,0x90,0x90,0x60,0x0,0xa0, -}; - -static const BitmapCharRec ch246 = {4,7,0,0,5,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { - 0x60,0x90,0x90,0x90,0x60,0x0,0xa0,0x50, -}; - -static const BitmapCharRec ch245 = {4,8,0,0,5,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { - 0x60,0x90,0x90,0x90,0x60,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch244 = {4,8,0,0,5,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { - 0x60,0x90,0x90,0x90,0x60,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch243 = {4,8,0,0,5,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { - 0x60,0x90,0x90,0x90,0x60,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch242 = {4,8,0,0,5,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { - 0xd8,0x90,0x90,0x90,0xe0,0x0,0xa0,0x50, -}; - -static const BitmapCharRec ch241 = {5,8,0,0,5,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { - 0x60,0x90,0x90,0x90,0x70,0xa0,0x70,0x40, -}; - -static const BitmapCharRec ch240 = {4,8,0,0,5,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { - 0xe0,0x40,0x40,0x40,0xc0,0x0,0xa0, -}; - -static const BitmapCharRec ch239 = {3,7,0,0,4,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { - 0xe0,0x40,0x40,0x40,0xc0,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch238 = {3,8,0,0,4,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { - 0xe0,0x40,0x40,0x40,0xc0,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch237 = {3,8,0,0,4,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { - 0xe0,0x40,0x40,0x40,0xc0,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch236 = {3,8,0,0,4,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { - 0x60,0x80,0xc0,0xa0,0x60,0x0,0xa0, -}; - -static const BitmapCharRec ch235 = {3,7,0,0,4,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { - 0x60,0x80,0xc0,0xa0,0x60,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch234 = {3,8,0,0,4,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { - 0x60,0x80,0xc0,0xa0,0x60,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch233 = {3,8,0,0,4,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { - 0x60,0x80,0xc0,0xa0,0x60,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch232 = {3,8,0,0,4,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { - 0xc0,0x20,0x40,0x60,0x80,0x80,0x80,0x60, -}; - -static const BitmapCharRec ch231 = {3,8,0,3,4,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { - 0xd8,0xa0,0x70,0x28,0xd8, -}; - -static const BitmapCharRec ch230 = {5,5,0,0,6,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { - 0xe0,0xa0,0x60,0x20,0xc0,0x40,0xa0,0x40, -}; - -static const BitmapCharRec ch229 = {3,8,0,0,4,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { - 0xe0,0xa0,0x60,0x20,0xc0,0x0,0xa0, -}; - -static const BitmapCharRec ch228 = {3,7,0,0,4,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { - 0xe0,0xa0,0x60,0x20,0xc0,0x0,0xa0,0x50, -}; - -static const BitmapCharRec ch227 = {4,8,0,0,4,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { - 0xe0,0xa0,0x60,0x20,0xc0,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch226 = {3,8,0,0,4,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { - 0xe0,0xa0,0x60,0x20,0xc0,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch225 = {3,8,0,0,4,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { - 0xe0,0xa0,0x60,0x20,0xc0,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch224 = {3,8,0,0,4,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { - 0xe0,0x50,0x50,0x60,0x50,0x50,0x20, -}; - -static const BitmapCharRec ch223 = {4,7,0,0,5,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { - 0xe0,0x40,0x70,0x48,0x70,0x40,0xe0, -}; - -static const BitmapCharRec ch222 = {5,7,0,0,6,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { - 0x38,0x10,0x10,0x28,0x28,0x44,0xee,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch221 = {7,10,0,0,8,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { - 0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x28, -}; - -static const BitmapCharRec ch220 = {7,9,0,0,8,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { - 0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch219 = {7,10,0,0,8,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { - 0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch218 = {7,10,0,0,8,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { - 0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch217 = {7,10,0,0,8,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { - 0x80,0x7c,0x66,0x52,0x52,0x4a,0x66,0x3e,0x1, -}; - -static const BitmapCharRec ch216 = {8,9,0,1,8,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { - 0x88,0x50,0x20,0x50,0x88, -}; - -static const BitmapCharRec ch215 = {5,5,0,0,6,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { - 0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x50, -}; - -static const BitmapCharRec ch214 = {6,9,0,0,7,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { - 0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch213 = {6,10,0,0,7,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { - 0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch212 = {6,10,0,0,7,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { - 0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch211 = {6,10,0,0,7,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { - 0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch210 = {6,10,0,0,7,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { - 0xe4,0x4c,0x4c,0x54,0x54,0x64,0xee,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch209 = {7,10,0,0,8,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { - 0xf8,0x4c,0x44,0xe4,0x44,0x4c,0xf8, -}; - -static const BitmapCharRec ch208 = {6,7,0,0,7,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { - 0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0xa0, -}; - -static const BitmapCharRec ch207 = {3,9,0,0,4,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { - 0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch206 = {3,10,0,0,4,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { - 0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch205 = {3,10,0,0,4,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { - 0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch204 = {3,10,0,0,4,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { - 0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x50, -}; - -static const BitmapCharRec ch203 = {5,9,0,0,6,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { - 0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch202 = {5,10,0,0,6,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { - 0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch201 = {5,10,0,0,6,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { - 0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch200 = {5,10,0,0,6,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { - 0x60,0x10,0x20,0x78,0xc4,0x80,0x80,0x80,0xc4,0x7c, -}; - -static const BitmapCharRec ch199 = {6,10,0,3,7,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { - 0xef,0x49,0x78,0x2e,0x28,0x39,0x1f, -}; - -static const BitmapCharRec ch198 = {8,7,0,0,9,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { - 0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x10,0x28,0x10, -}; - -static const BitmapCharRec ch197 = {7,10,0,0,8,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { - 0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x28, -}; - -static const BitmapCharRec ch196 = {7,9,0,0,8,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { - 0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch195 = {7,10,0,0,8,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { - 0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch194 = {7,10,0,0,8,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { - 0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch193 = {7,10,0,0,8,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { - 0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch192 = {7,10,0,0,8,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { - 0xe0,0xa0,0x80,0x40,0x40,0x0,0x40, -}; - -static const BitmapCharRec ch191 = {3,7,0,2,4,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { - 0x44,0x3e,0x2c,0xd4,0x28,0x48,0xe4, -}; - -static const BitmapCharRec ch190 = {7,7,0,0,8,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { - 0x4e,0x24,0x2a,0xf6,0x48,0xc8,0x44, -}; - -static const BitmapCharRec ch189 = {7,7,0,0,8,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { - 0x44,0x3e,0x2c,0xf4,0x48,0xc8,0x44, -}; - -static const BitmapCharRec ch188 = {7,7,0,0,8,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { - 0xa0,0x50,0x50,0xa0, -}; - -static const BitmapCharRec ch187 = {4,4,0,-1,5,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { - 0xe0,0x0,0x40,0xa0,0x40, -}; - -static const BitmapCharRec ch186 = {3,5,0,-2,4,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { - 0xe0,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch185 = {3,4,0,-3,3,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { - 0xc0,0x20,0x40, -}; - -static const BitmapCharRec ch184 = {3,3,0,3,4,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { - 0x80, -}; - -static const BitmapCharRec ch183 = {1,1,0,-2,2,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { - 0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, -}; - -static const BitmapCharRec ch182 = {6,9,0,2,6,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { - 0x80,0x80,0xe8,0x90,0x90,0x90,0x90, -}; - -static const BitmapCharRec ch181 = {5,7,0,2,5,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { - 0x80,0x40, -}; - -static const BitmapCharRec ch180 = {2,2,0,-5,3,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { - 0xc0,0x20,0x40,0xe0, -}; - -static const BitmapCharRec ch179 = {3,4,0,-3,3,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { - 0xe0,0x40,0xa0,0x60, -}; - -static const BitmapCharRec ch178 = {3,4,0,-3,3,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { - 0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch177 = {5,7,0,0,6,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { - 0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch176 = {4,4,0,-3,4,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { - 0xe0, -}; - -static const BitmapCharRec ch175 = {3,1,0,-6,4,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { - 0x38,0x44,0xaa,0xb2,0xba,0x44,0x38, -}; - -static const BitmapCharRec ch174 = {7,7,-1,0,9,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { - 0xe0, -}; - -static const BitmapCharRec ch173 = {3,1,0,-2,4,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { - 0x8,0x8,0xf8, -}; - -static const BitmapCharRec ch172 = {5,3,-1,-1,7,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { - 0x50,0xa0,0xa0,0x50, -}; - -static const BitmapCharRec ch171 = {4,4,0,-1,5,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { - 0xe0,0x0,0xa0,0x20,0xc0, -}; - -static const BitmapCharRec ch170 = {3,5,0,-2,4,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { - 0x38,0x44,0x9a,0xa2,0x9a,0x44,0x38, -}; - -static const BitmapCharRec ch169 = {7,7,-1,0,9,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { - 0xa0, -}; - -static const BitmapCharRec ch168 = {3,1,-1,-6,5,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { - 0xe0,0x90,0x20,0x50,0x90,0xa0,0x40,0x90,0x70, -}; - -static const BitmapCharRec ch167 = {4,9,0,1,5,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { - 0x80,0x80,0x80,0x0,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch166 = {1,7,0,0,2,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { - 0x70,0x20,0xf8,0x20,0xd8,0x50,0x88, -}; - -static const BitmapCharRec ch165 = {5,7,0,0,5,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { - 0x88,0x70,0x50,0x50,0x70,0x88, -}; - -static const BitmapCharRec ch164 = {5,6,0,-1,5,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { - 0xf0,0xc8,0x40,0xe0,0x40,0x50,0x30, -}; - -static const BitmapCharRec ch163 = {5,7,0,0,5,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { - 0x80,0xe0,0x90,0x80,0x90,0x70,0x10, -}; - -static const BitmapCharRec ch162 = {4,7,0,1,5,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { - 0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch161 = {1,7,-1,2,3,ch161data}; - -/* char: 0xa0 */ - -static const BitmapCharRec ch160 = {0,0,0,0,2,0}; - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { - 0x98,0x64, -}; - -static const BitmapCharRec ch126 = {6,2,0,-2,7,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { - 0x80,0x40,0x40,0x40,0x20,0x40,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch125 = {3,9,0,2,4,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch124 = {1,9,0,2,2,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { - 0x20,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch123 = {3,9,0,2,4,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { - 0xf0,0x90,0x40,0x20,0xf0, -}; - -static const BitmapCharRec ch122 = {4,5,0,0,5,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { - 0x40,0x40,0x20,0x30,0x50,0x48,0xdc, -}; - -static const BitmapCharRec ch121 = {6,7,1,2,5,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { - 0xd8,0x50,0x20,0x50,0xd8, -}; - -static const BitmapCharRec ch120 = {5,5,0,0,6,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { - 0x28,0x6c,0x54,0x92,0xdb, -}; - -static const BitmapCharRec ch119 = {8,5,0,0,8,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { - 0x20,0x60,0x50,0x90,0xd8, -}; - -static const BitmapCharRec ch118 = {5,5,0,0,5,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { - 0x68,0x90,0x90,0x90,0x90, -}; - -static const BitmapCharRec ch117 = {5,5,0,0,5,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { - 0x30,0x40,0x40,0x40,0xe0,0x40, -}; - -static const BitmapCharRec ch116 = {4,6,0,0,4,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { - 0xe0,0x20,0x60,0x80,0xe0, -}; - -static const BitmapCharRec ch115 = {3,5,0,0,4,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { - 0xe0,0x40,0x40,0x60,0xa0, -}; - -static const BitmapCharRec ch114 = {3,5,0,0,4,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { - 0x38,0x10,0x70,0x90,0x90,0x90,0x70, -}; - -static const BitmapCharRec ch113 = {5,7,0,2,5,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { - 0xc0,0x80,0xe0,0x90,0x90,0x90,0xe0, -}; - -static const BitmapCharRec ch112 = {4,7,0,2,5,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { - 0x60,0x90,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch111 = {4,5,0,0,5,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { - 0xd8,0x90,0x90,0x90,0xe0, -}; - -static const BitmapCharRec ch110 = {5,5,0,0,5,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { - 0xdb,0x92,0x92,0x92,0xec, -}; - -static const BitmapCharRec ch109 = {8,5,0,0,8,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { - 0xe0,0x40,0x40,0x40,0x40,0x40,0xc0, -}; - -static const BitmapCharRec ch108 = {3,7,0,0,4,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { - 0x98,0x90,0xe0,0xa0,0x90,0x80,0x80, -}; - -static const BitmapCharRec ch107 = {5,7,0,0,5,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { - 0x80,0x40,0x40,0x40,0x40,0x40,0xc0,0x0,0x40, -}; - -static const BitmapCharRec ch106 = {2,9,0,2,3,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { - 0x40,0x40,0x40,0x40,0xc0,0x0,0x40, -}; - -static const BitmapCharRec ch105 = {2,7,0,0,3,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { - 0xd8,0x90,0x90,0x90,0xe0,0x80,0x80, -}; - -static const BitmapCharRec ch104 = {5,7,0,0,5,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { - 0xe0,0x90,0x60,0x40,0xa0,0xa0,0x70, -}; - -static const BitmapCharRec ch103 = {4,7,0,2,5,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { - 0xe0,0x40,0x40,0x40,0xe0,0x40,0x30, -}; - -static const BitmapCharRec ch102 = {4,7,0,0,4,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { - 0x60,0x80,0xc0,0xa0,0x60, -}; - -static const BitmapCharRec ch101 = {3,5,0,0,4,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { - 0x68,0x90,0x90,0x90,0x70,0x10,0x30, -}; - -static const BitmapCharRec ch100 = {5,7,0,0,5,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { - 0x60,0x80,0x80,0x80,0x60, -}; - -static const BitmapCharRec ch99 = {3,5,0,0,4,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { - 0xe0,0x90,0x90,0x90,0xe0,0x80,0x80, -}; - -static const BitmapCharRec ch98 = {4,7,0,0,5,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { - 0xe0,0xa0,0x60,0x20,0xc0, -}; - -static const BitmapCharRec ch97 = {3,5,0,0,4,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { - 0xc0,0x80, -}; - -static const BitmapCharRec ch96 = {2,2,0,-5,3,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { - 0xf8, -}; - -static const BitmapCharRec ch95 = {5,1,0,3,5,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { - 0xa0,0xa0,0x40, -}; - -static const BitmapCharRec ch94 = {3,3,-1,-4,5,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { - 0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, -}; - -static const BitmapCharRec ch93 = {2,9,0,2,3,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { - 0x20,0x20,0x40,0x40,0x40,0x80,0x80, -}; - -static const BitmapCharRec ch92 = {3,7,0,0,3,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { - 0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, -}; - -static const BitmapCharRec ch91 = {2,9,0,2,3,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { - 0xf8,0x88,0x40,0x20,0x10,0x88,0xf8, -}; - -static const BitmapCharRec ch90 = {5,7,0,0,6,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { - 0x38,0x10,0x10,0x28,0x28,0x44,0xee, -}; - -static const BitmapCharRec ch89 = {7,7,0,0,8,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { - 0xee,0x44,0x28,0x10,0x28,0x44,0xee, -}; - -static const BitmapCharRec ch88 = {7,7,0,0,8,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { - 0x22,0x0,0x22,0x0,0x55,0x0,0x55,0x0,0xc9,0x80,0x88,0x80,0xdd,0xc0, -}; - -static const BitmapCharRec ch87 = {10,7,0,0,10,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { - 0x10,0x10,0x28,0x28,0x6c,0x44,0xee, -}; - -static const BitmapCharRec ch86 = {7,7,0,0,8,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { - 0x38,0x6c,0x44,0x44,0x44,0x44,0xee, -}; - -static const BitmapCharRec ch85 = {7,7,0,0,8,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { - 0x70,0x20,0x20,0x20,0x20,0xa8,0xf8, -}; - -static const BitmapCharRec ch84 = {5,7,0,0,6,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { - 0xe0,0x90,0x10,0x60,0xc0,0x90,0x70, -}; - -static const BitmapCharRec ch83 = {4,7,0,0,5,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { - 0xec,0x48,0x50,0x70,0x48,0x48,0xf0, -}; - -static const BitmapCharRec ch82 = {6,7,0,0,7,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { - 0xc,0x18,0x70,0xcc,0x84,0x84,0x84,0xcc,0x78, -}; - -static const BitmapCharRec ch81 = {6,9,0,2,7,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { - 0xe0,0x40,0x40,0x70,0x48,0x48,0xf0, -}; - -static const BitmapCharRec ch80 = {5,7,0,0,6,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { - 0x78,0xcc,0x84,0x84,0x84,0xcc,0x78, -}; - -static const BitmapCharRec ch79 = {6,7,0,0,7,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { - 0xe4,0x4c,0x4c,0x54,0x54,0x64,0xee, -}; - -static const BitmapCharRec ch78 = {7,7,0,0,8,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { - 0xeb,0x80,0x49,0x0,0x55,0x0,0x55,0x0,0x63,0x0,0x63,0x0,0xe3,0x80, -}; - -static const BitmapCharRec ch77 = {9,7,0,0,10,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { - 0xf8,0x48,0x40,0x40,0x40,0x40,0xe0, -}; - -static const BitmapCharRec ch76 = {5,7,0,0,6,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { - 0xec,0x48,0x50,0x60,0x50,0x48,0xec, -}; - -static const BitmapCharRec ch75 = {6,7,0,0,7,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { - 0xc0,0xa0,0x20,0x20,0x20,0x20,0x70, -}; - -static const BitmapCharRec ch74 = {4,7,0,0,4,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { - 0xe0,0x40,0x40,0x40,0x40,0x40,0xe0, -}; - -static const BitmapCharRec ch73 = {3,7,0,0,4,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { - 0xee,0x44,0x44,0x7c,0x44,0x44,0xee, -}; - -static const BitmapCharRec ch72 = {7,7,0,0,8,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { - 0x78,0xc4,0x84,0x9c,0x80,0xc4,0x7c, -}; - -static const BitmapCharRec ch71 = {6,7,0,0,7,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { - 0xe0,0x40,0x40,0x70,0x40,0x48,0xf8, -}; - -static const BitmapCharRec ch70 = {5,7,0,0,6,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { - 0xf8,0x48,0x40,0x70,0x40,0x48,0xf8, -}; - -static const BitmapCharRec ch69 = {5,7,0,0,6,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { - 0xf8,0x4c,0x44,0x44,0x44,0x4c,0xf8, -}; - -static const BitmapCharRec ch68 = {6,7,0,0,7,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { - 0x78,0xc4,0x80,0x80,0x80,0xc4,0x7c, -}; - -static const BitmapCharRec ch67 = {6,7,0,0,7,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { - 0xf0,0x48,0x48,0x70,0x48,0x48,0xf0, -}; - -static const BitmapCharRec ch66 = {5,7,0,0,6,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { - 0xee,0x44,0x7c,0x28,0x28,0x38,0x10, -}; - -static const BitmapCharRec ch65 = {7,7,0,0,8,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { - 0x3e,0x40,0x92,0xad,0xa5,0xa5,0x9d,0x42,0x3c, -}; - -static const BitmapCharRec ch64 = {8,9,0,2,9,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { - 0x40,0x0,0x40,0x40,0x20,0xa0,0xe0, -}; - -static const BitmapCharRec ch63 = {3,7,0,0,4,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { - 0x80,0x40,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch62 = {3,5,0,0,5,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { - 0xf8,0x0,0xf8, -}; - -static const BitmapCharRec ch61 = {5,3,0,-1,6,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { - 0x20,0x40,0x80,0x40,0x20, -}; - -static const BitmapCharRec ch60 = {3,5,-1,0,5,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { - 0x80,0x80,0x80,0x0,0x0,0x0,0x80, -}; - -static const BitmapCharRec ch59 = {1,7,-1,2,3,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { - 0x80,0x0,0x0,0x0,0x80, -}; - -static const BitmapCharRec ch58 = {1,5,-1,0,3,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { - 0xc0,0x20,0x70,0x90,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch57 = {4,7,0,0,5,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { - 0x60,0x90,0x90,0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch56 = {4,7,0,0,5,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { - 0x40,0x40,0x40,0x20,0x20,0x90,0xf0, -}; - -static const BitmapCharRec ch55 = {4,7,0,0,5,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { - 0x60,0x90,0x90,0x90,0xe0,0x40,0x30, -}; - -static const BitmapCharRec ch54 = {4,7,0,0,5,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { - 0xe0,0x90,0x10,0x10,0xe0,0x40,0x70, -}; - -static const BitmapCharRec ch53 = {4,7,0,0,5,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { - 0x10,0x10,0xf8,0x90,0x50,0x30,0x10, -}; - -static const BitmapCharRec ch52 = {5,7,0,0,5,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { - 0xe0,0x10,0x10,0x60,0x10,0x90,0x60, -}; - -static const BitmapCharRec ch51 = {4,7,0,0,5,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { - 0xf0,0x40,0x20,0x20,0x10,0x90,0x60, -}; - -static const BitmapCharRec ch50 = {4,7,0,0,5,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { - 0xe0,0x40,0x40,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch49 = {3,7,-1,0,5,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { - 0x60,0x90,0x90,0x90,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch48 = {4,7,0,0,5,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { - 0x80,0x80,0x40,0x40,0x40,0x20,0x20, -}; - -static const BitmapCharRec ch47 = {3,7,0,0,3,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { - 0x80, -}; - -static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { - 0xf0, -}; - -static const BitmapCharRec ch45 = {4,1,-1,-2,7,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { - 0x80,0x80,0x80, -}; - -static const BitmapCharRec ch44 = {1,3,-1,2,3,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { - 0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch43 = {5,5,0,0,6,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { - 0xa0,0x40,0xa0, -}; - -static const BitmapCharRec ch42 = {3,3,0,-4,5,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { - 0x80,0x40,0x40,0x20,0x20,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {3,9,0,2,4,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { - 0x20,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch40 = {3,9,0,2,4,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { - 0x40,0xc0, -}; - -static const BitmapCharRec ch39 = {2,2,0,-5,3,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { - 0x76,0x8d,0x98,0x74,0x6e,0x50,0x30, -}; - -static const BitmapCharRec ch38 = {8,7,0,0,8,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { - 0x44,0x2a,0x2a,0x56,0xa8,0xa4,0x7e, -}; - -static const BitmapCharRec ch37 = {7,7,0,0,8,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { - 0x20,0xe0,0x90,0x10,0x60,0x80,0x90,0x70,0x20, -}; - -static const BitmapCharRec ch36 = {4,9,0,1,5,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { - 0x50,0x50,0xf8,0x50,0xf8,0x50,0x50, -}; - -static const BitmapCharRec ch35 = {5,7,0,0,5,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { - 0xa0,0xa0, -}; - -static const BitmapCharRec ch34 = {3,2,0,-5,4,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { - 0x80,0x0,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch33 = {1,7,-1,0,3,ch33data}; - -/* char: 0x20 ' ' */ - -static const BitmapCharRec ch32 = {0,0,0,0,2,0}; - -static const BitmapCharRec * const chars[] = { - &ch32, - &ch33, - &ch34, - &ch35, - &ch36, - &ch37, - &ch38, - &ch39, - &ch40, - &ch41, - &ch42, - &ch43, - &ch44, - &ch45, - &ch46, - &ch47, - &ch48, - &ch49, - &ch50, - &ch51, - &ch52, - &ch53, - &ch54, - &ch55, - &ch56, - &ch57, - &ch58, - &ch59, - &ch60, - &ch61, - &ch62, - &ch63, - &ch64, - &ch65, - &ch66, - &ch67, - &ch68, - &ch69, - &ch70, - &ch71, - &ch72, - &ch73, - &ch74, - &ch75, - &ch76, - &ch77, - &ch78, - &ch79, - &ch80, - &ch81, - &ch82, - &ch83, - &ch84, - &ch85, - &ch86, - &ch87, - &ch88, - &ch89, - &ch90, - &ch91, - &ch92, - &ch93, - &ch94, - &ch95, - &ch96, - &ch97, - &ch98, - &ch99, - &ch100, - &ch101, - &ch102, - &ch103, - &ch104, - &ch105, - &ch106, - &ch107, - &ch108, - &ch109, - &ch110, - &ch111, - &ch112, - &ch113, - &ch114, - &ch115, - &ch116, - &ch117, - &ch118, - &ch119, - &ch120, - &ch121, - &ch122, - &ch123, - &ch124, - &ch125, - &ch126, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &ch160, - &ch161, - &ch162, - &ch163, - &ch164, - &ch165, - &ch166, - &ch167, - &ch168, - &ch169, - &ch170, - &ch171, - &ch172, - &ch173, - &ch174, - &ch175, - &ch176, - &ch177, - &ch178, - &ch179, - &ch180, - &ch181, - &ch182, - &ch183, - &ch184, - &ch185, - &ch186, - &ch187, - &ch188, - &ch189, - &ch190, - &ch191, - &ch192, - &ch193, - &ch194, - &ch195, - &ch196, - &ch197, - &ch198, - &ch199, - &ch200, - &ch201, - &ch202, - &ch203, - &ch204, - &ch205, - &ch206, - &ch207, - &ch208, - &ch209, - &ch210, - &ch211, - &ch212, - &ch213, - &ch214, - &ch215, - &ch216, - &ch217, - &ch218, - &ch219, - &ch220, - &ch221, - &ch222, - &ch223, - &ch224, - &ch225, - &ch226, - &ch227, - &ch228, - &ch229, - &ch230, - &ch231, - &ch232, - &ch233, - &ch234, - &ch235, - &ch236, - &ch237, - &ch238, - &ch239, - &ch240, - &ch241, - &ch242, - &ch243, - &ch244, - &ch245, - &ch246, - &ch247, - &ch248, - &ch249, - &ch250, - &ch251, - &ch252, - &ch253, - &ch254, - &ch255, -}; - -const BitmapFontRec glutBitmapTimesRoman10 = { - "-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1", - 224, - 32, - chars -}; - -#endif diff --git a/lib/SRC/Eden/gluttext/glut_tr24.c b/lib/SRC/Eden/gluttext/glut_tr24.c deleted file mode 100644 index 6ac2815..0000000 --- a/lib/SRC/Eden/gluttext/glut_tr24.c +++ /dev/null @@ -1,2048 +0,0 @@ -#include -#if GLUTTEXT_STROKE_ENABLE - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmapTimesRoman24 XXX -#include "glutbitmap.h" -#undef glutBitmapTimesRoman24 - -/* char: 0xff */ - -static const GLubyte ch255data[] = { - 0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, - 0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, - 0xf1,0xe0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, -}; - -static const BitmapCharRec ch255 = {11,21,0,5,11,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { - 0xf0,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x6e,0x0,0x73,0x80,0x61,0x80, - 0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x61,0x80,0x73,0x80, - 0x6e,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0xe0,0x0, -}; - -static const BitmapCharRec ch254 = {10,22,-1,5,12,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { - 0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, - 0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, - 0xf1,0xe0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80,0x1,0x80, -}; - -static const BitmapCharRec ch253 = {11,22,0,5,11,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { - 0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, -}; - -static const BitmapCharRec ch252 = {11,16,-1,0,13,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { - 0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, - 0xc,0x0, -}; - -static const BitmapCharRec ch251 = {11,17,-1,0,13,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { - 0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80, - 0x1,0x80, -}; - -static const BitmapCharRec ch250 = {11,17,-1,0,13,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { - 0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x2,0x0,0xc,0x0,0x38,0x0, - 0x30,0x0, -}; - -static const BitmapCharRec ch249 = {11,17,-1,0,13,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { - 0xc0,0x0,0xde,0x0,0x73,0x80,0x71,0x80,0xd0,0xc0,0xd8,0xc0,0xc8,0xc0,0xcc,0xc0, - 0xc4,0xc0,0xc6,0xc0,0x63,0x80,0x73,0x80,0x1e,0xc0,0x0,0xc0, -}; - -static const BitmapCharRec ch248 = {10,14,-1,1,12,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { - 0x6,0x0,0x6,0x0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0, - 0x6,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch247 = {12,10,-1,-2,14,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { - 0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, -}; - -static const BitmapCharRec ch246 = {10,16,-1,0,12,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { - 0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x0,0x0,0x27,0x0,0x1c,0x80, -}; - -static const BitmapCharRec ch245 = {10,16,-1,0,12,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { - 0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, - 0xc,0x0, -}; - -static const BitmapCharRec ch244 = {10,17,-1,0,12,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { - 0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80, - 0x1,0x80, -}; - -static const BitmapCharRec ch243 = {10,17,-1,0,12,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { - 0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x2,0x0,0xc,0x0,0x38,0x0, - 0x30,0x0, -}; - -static const BitmapCharRec ch242 = {10,17,-1,0,12,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { - 0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0x60,0xc0,0x71,0xc0,0x6f,0x80,0xe7,0x0,0x0,0x0,0x0,0x0,0x27,0x0,0x1c,0x80, -}; - -static const BitmapCharRec ch241 = {11,16,-1,0,13,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { - 0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0,0xc0,0x61,0x80,0x73,0x80,0x1f,0x0,0xc6,0x0,0x3c,0x0,0x1e,0x0,0x71,0x80, - 0xc0,0x0, -}; - -static const BitmapCharRec ch240 = {10,17,-1,0,12,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { - 0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x0,0xcc,0xcc, -}; - -static const BitmapCharRec ch239 = {6,16,0,0,6,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { - 0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x84,0x48,0x78, - 0x30, -}; - -static const BitmapCharRec ch238 = {6,17,0,0,6,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { - 0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0x0,0x80,0x60,0x38, - 0x18, -}; - -static const BitmapCharRec ch237 = {5,17,-1,0,6,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { - 0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x8,0x30,0xe0, - 0xc0, -}; - -static const BitmapCharRec ch236 = {5,17,0,0,6,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { - 0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, - 0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, -}; - -static const BitmapCharRec ch235 = {9,16,-1,0,11,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { - 0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, - 0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, - 0xc,0x0, -}; - -static const BitmapCharRec ch234 = {9,17,-1,0,11,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { - 0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, - 0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x10,0x0,0xc,0x0,0x7,0x0, - 0x3,0x0, -}; - -static const BitmapCharRec ch233 = {9,17,-1,0,11,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { - 0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, - 0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x4,0x0,0x18,0x0,0x70,0x0, - 0x60,0x0, -}; - -static const BitmapCharRec ch232 = {9,17,-1,0,11,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { - 0x3c,0x0,0x66,0x0,0x6,0x0,0x1e,0x0,0x18,0x0,0x8,0x0,0x1e,0x0,0x7f,0x0, - 0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x41,0x80, - 0x63,0x80,0x1f,0x0, -}; - -static const BitmapCharRec ch231 = {9,18,-1,6,11,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { - 0x70,0xf0,0xfb,0xf8,0xc7,0x84,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0xfc, - 0x3,0xc,0x63,0xc,0x67,0x98,0x3c,0xf0, -}; - -static const BitmapCharRec ch230 = {14,12,-1,0,16,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { - 0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, - 0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x1c,0x0,0x22,0x0,0x22,0x0, - 0x1c,0x0, -}; - -static const BitmapCharRec ch229 = {9,17,-1,0,11,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { - 0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, - 0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x66,0x0,0x66,0x0, -}; - -static const BitmapCharRec ch228 = {9,16,-1,0,11,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { - 0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, - 0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x5c,0x0,0x3a,0x0, -}; - -static const BitmapCharRec ch227 = {9,16,-1,0,11,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { - 0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, - 0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x42,0x0,0x24,0x0,0x3c,0x0, - 0x18,0x0, -}; - -static const BitmapCharRec ch226 = {9,17,-1,0,11,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { - 0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, - 0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x10,0x0,0xc,0x0,0x7,0x0, - 0x3,0x0, -}; - -static const BitmapCharRec ch225 = {9,17,-1,0,11,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { - 0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, - 0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x4,0x0,0x18,0x0,0x70,0x0, - 0x60,0x0, -}; - -static const BitmapCharRec ch224 = {9,17,-1,0,11,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { - 0xe7,0x0,0x6c,0x80,0x6c,0xc0,0x60,0xc0,0x60,0xc0,0x61,0xc0,0x61,0x80,0x63,0x80, - 0x67,0x0,0x6c,0x0,0x63,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, - 0x1e,0x0, -}; - -static const BitmapCharRec ch223 = {10,17,-1,0,12,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { - 0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x18, - 0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70,0x3f,0xc0,0x30,0x0,0x30,0x0,0x30,0x0, - 0xfc,0x0, -}; - -static const BitmapCharRec ch222 = {13,17,-1,0,15,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { - 0x7,0xe0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0xc0, - 0x3,0x40,0x6,0x60,0x6,0x20,0xc,0x30,0x1c,0x10,0x18,0x18,0x38,0x8,0x30,0xc, - 0xfc,0x3f,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, -}; - -static const BitmapCharRec ch221 = {16,22,0,0,16,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { - 0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, - 0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, - 0xfc,0x1f,0x0,0x0,0x0,0x0,0x6,0x30,0x6,0x30, -}; - -static const BitmapCharRec ch220 = {16,21,-1,0,18,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { - 0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, - 0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, - 0xfc,0x1f,0x0,0x0,0x8,0x10,0x6,0x60,0x3,0xc0,0x1,0x80, -}; - -static const BitmapCharRec ch219 = {16,22,-1,0,18,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { - 0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, - 0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, - 0xfc,0x1f,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, -}; - -static const BitmapCharRec ch218 = {16,22,-1,0,18,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { - 0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, - 0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, - 0xfc,0x1f,0x0,0x0,0x0,0x40,0x1,0x80,0x7,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch217 = {16,22,-1,0,18,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { - 0x20,0x0,0x27,0xe0,0x1c,0x38,0x38,0x1c,0x68,0x6,0x64,0x6,0xc2,0x3,0xc2,0x3, - 0xc1,0x3,0xc1,0x3,0xc0,0x83,0xc0,0x83,0xc0,0x43,0x60,0x46,0x60,0x26,0x38,0x1c, - 0x1c,0x38,0x7,0xe4,0x0,0x4, -}; - -static const BitmapCharRec ch216 = {16,19,-1,1,18,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { - 0x80,0x40,0xc0,0xc0,0x61,0x80,0x33,0x0,0x1e,0x0,0xc,0x0,0x1e,0x0,0x33,0x0, - 0x61,0x80,0xc0,0xc0,0x80,0x40, -}; - -static const BitmapCharRec ch215 = {10,11,-2,-1,14,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { - 0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, - 0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, - 0x7,0xe0,0x0,0x0,0x0,0x0,0x6,0x60,0x6,0x60, -}; - -static const BitmapCharRec ch214 = {16,21,-1,0,18,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { - 0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, - 0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, - 0x7,0xe0,0x0,0x0,0x0,0x0,0x4,0xe0,0x3,0x90, -}; - -static const BitmapCharRec ch213 = {16,21,-1,0,18,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { - 0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, - 0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, - 0x7,0xe0,0x0,0x0,0x8,0x10,0x6,0x60,0x3,0xc0,0x1,0x80, -}; - -static const BitmapCharRec ch212 = {16,22,-1,0,18,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { - 0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, - 0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, - 0x7,0xe0,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, -}; - -static const BitmapCharRec ch211 = {16,22,-1,0,18,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { - 0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, - 0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, - 0x7,0xe0,0x0,0x0,0x0,0x40,0x1,0x80,0x7,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch210 = {16,22,-1,0,18,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { - 0xf8,0xc,0x20,0x1c,0x20,0x1c,0x20,0x34,0x20,0x64,0x20,0x64,0x20,0xc4,0x21,0x84, - 0x21,0x84,0x23,0x4,0x26,0x4,0x26,0x4,0x2c,0x4,0x38,0x4,0x38,0x4,0x30,0x4, - 0xf0,0x1f,0x0,0x0,0x0,0x0,0x4,0xe0,0x3,0x90, -}; - -static const BitmapCharRec ch209 = {16,21,-1,0,18,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { - 0x7f,0xe0,0x18,0x38,0x18,0x1c,0x18,0x6,0x18,0x6,0x18,0x3,0x18,0x3,0x18,0x3, - 0xff,0x3,0x18,0x3,0x18,0x3,0x18,0x3,0x18,0x6,0x18,0x6,0x18,0x1c,0x18,0x38, - 0x7f,0xe0, -}; - -static const BitmapCharRec ch208 = {16,17,0,0,17,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { - 0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, - 0xfc,0x0,0x0,0xcc,0xcc, -}; - -static const BitmapCharRec ch207 = {6,21,-1,0,8,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { - 0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 0x7e,0x0,0x81,0x66,0x3c,0x18, -}; - -static const BitmapCharRec ch206 = {8,22,-1,0,8,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { - 0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, - 0xfc,0x0,0x40,0x30,0x1c,0xc, -}; - -static const BitmapCharRec ch205 = {6,22,-1,0,8,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { - 0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, - 0xfc,0x0,0x8,0x30,0xe0,0xc0, -}; - -static const BitmapCharRec ch204 = {6,22,-1,0,8,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { - 0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, - 0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, - 0xff,0xf0,0x0,0x0,0x0,0x0,0x19,0x80,0x19,0x80, -}; - -static const BitmapCharRec ch203 = {13,21,-1,0,15,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { - 0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, - 0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, - 0xff,0xf0,0x0,0x0,0x10,0x20,0xc,0xc0,0x7,0x80,0x3,0x0, -}; - -static const BitmapCharRec ch202 = {13,22,-1,0,15,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { - 0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, - 0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, - 0xff,0xf0,0x0,0x0,0x4,0x0,0x3,0x0,0x1,0xc0,0x0,0xc0, -}; - -static const BitmapCharRec ch201 = {13,22,-1,0,15,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { - 0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, - 0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, - 0xff,0xf0,0x0,0x0,0x1,0x0,0x6,0x0,0x1c,0x0,0x18,0x0, -}; - -static const BitmapCharRec ch200 = {13,22,-1,0,15,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { - 0x7,0x80,0xc,0xc0,0x0,0xc0,0x3,0xc0,0x3,0x0,0x1,0x0,0x7,0xe0,0x1e,0x38, - 0x38,0x8,0x60,0x4,0x60,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, - 0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c,0x7,0xe4, -}; - -static const BitmapCharRec ch199 = {14,23,-1,6,16,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { - 0xf9,0xff,0xf0,0x30,0x60,0x30,0x10,0x60,0x10,0x10,0x60,0x10,0x18,0x60,0x0,0x8, - 0x60,0x0,0xf,0xe0,0x80,0xc,0x60,0x80,0x4,0x7f,0x80,0x4,0x60,0x80,0x6,0x60, - 0x80,0x2,0x60,0x0,0x2,0x60,0x0,0x1,0x60,0x20,0x1,0x60,0x20,0x1,0xe0,0x60, - 0x3,0xff,0xe0, -}; - -static const BitmapCharRec ch198 = {20,17,0,0,21,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { - 0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, - 0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, - 0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, - 0x0,0x80,0x0,0x1,0xc0,0x0,0x2,0x20,0x0,0x2,0x20,0x0,0x1,0xc0,0x0, -}; - -static const BitmapCharRec ch197 = {17,21,0,0,17,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { - 0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, - 0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, - 0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, - 0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x30,0x0,0x6,0x30,0x0, -}; - -static const BitmapCharRec ch196 = {17,21,0,0,17,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { - 0xfc,0x1f,0x80,0x30,0x7,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, - 0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, - 0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, - 0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0xe0,0x0,0x3,0x90,0x0, -}; - -static const BitmapCharRec ch195 = {17,21,0,0,17,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { - 0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, - 0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, - 0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, - 0x0,0x80,0x0,0x0,0x0,0x0,0x8,0x10,0x0,0x6,0x60,0x0,0x3,0xc0,0x0,0x1, - 0x80,0x0, -}; - -static const BitmapCharRec ch194 = {17,22,0,0,17,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { - 0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, - 0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, - 0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, - 0x0,0x80,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0xc0,0x0,0x0,0x70,0x0,0x0, - 0x30,0x0, -}; - -static const BitmapCharRec ch193 = {17,22,0,0,17,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { - 0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, - 0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, - 0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, - 0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0xc0,0x0,0x3,0x80,0x0,0x3, - 0x0,0x0, -}; - -static const BitmapCharRec ch192 = {17,22,0,0,17,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { - 0x3e,0x63,0xc1,0xc3,0xc3,0xe0,0x70,0x30,0x38,0x18,0x18,0x8,0x8,0x0,0x0,0xc, - 0xc, -}; - -static const BitmapCharRec ch191 = {8,17,-1,5,11,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { - 0x18,0x2,0x0,0x8,0x2,0x0,0xc,0x7f,0x80,0x4,0x22,0x0,0x6,0x32,0x0,0x3, - 0x12,0x0,0x1,0xa,0x0,0x71,0x8e,0x0,0x88,0x86,0x0,0x8c,0xc2,0x0,0xc,0x60, - 0x0,0x8,0x20,0x0,0x30,0x30,0x0,0x8,0x10,0x0,0x8c,0x18,0x0,0x4c,0xc,0x0, - 0x38,0x4,0x0, -}; - -static const BitmapCharRec ch190 = {17,17,0,0,18,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { - 0x30,0x7e,0x10,0x22,0x18,0x10,0x8,0x18,0xc,0x8,0x6,0x4,0x2,0x6,0xfb,0x46, - 0x21,0x26,0x21,0x9c,0x20,0xc0,0x20,0x40,0x20,0x60,0x20,0x20,0xa0,0x30,0x60,0x18, - 0x20,0x8, -}; - -static const BitmapCharRec ch189 = {15,17,-1,0,18,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { - 0x30,0x4,0x10,0x4,0x18,0xff,0x8,0x44,0xc,0x64,0x6,0x24,0x2,0x14,0xfb,0x1c, - 0x21,0xc,0x21,0x84,0x20,0xc0,0x20,0x40,0x20,0x60,0x20,0x20,0xa0,0x30,0x60,0x18, - 0x20,0x8, -}; - -static const BitmapCharRec ch188 = {16,17,-1,0,18,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { - 0x88,0x0,0xcc,0x0,0x66,0x0,0x33,0x0,0x19,0x80,0x19,0x80,0x33,0x0,0x66,0x0, - 0xcc,0x0,0x88,0x0, -}; - -static const BitmapCharRec ch187 = {9,10,-2,-1,12,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { - 0xfc,0x0,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0x78, -}; - -static const BitmapCharRec ch186 = {6,9,-1,-8,8,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xa0,0x60,0x20, -}; - -static const BitmapCharRec ch185 = {5,10,-1,-7,7,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { - 0x78,0xcc,0xc,0x3c,0x30,0x10, -}; - -static const BitmapCharRec ch184 = {6,6,-1,6,8,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { - 0xc0,0xc0, -}; - -static const BitmapCharRec ch183 = {2,2,-2,-6,6,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { - 0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0, - 0x9,0x0,0x9,0x0,0x9,0x0,0x19,0x0,0x39,0x0,0x79,0x0,0x79,0x0,0xf9,0x0, - 0xf9,0x0,0xf9,0x0,0x79,0x0,0x79,0x0,0x39,0x0,0x1f,0x80, -}; - -static const BitmapCharRec ch182 = {9,22,-1,5,11,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { - 0x40,0x0,0xe0,0x0,0xc0,0x0,0x40,0x0,0x40,0x0,0x5c,0xe0,0x7e,0xc0,0x71,0xc0, - 0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0xe1,0xc0, -}; - -static const BitmapCharRec ch181 = {11,17,-1,5,13,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { - 0x80,0x60,0x38,0x18, -}; - -static const BitmapCharRec ch180 = {5,4,-2,-13,8,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { - 0x70,0x88,0x8c,0xc,0x8,0x30,0x8,0x8c,0x4c,0x38, -}; - -static const BitmapCharRec ch179 = {6,10,0,-7,7,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { - 0xfc,0x44,0x20,0x30,0x10,0x8,0xc,0x8c,0x4c,0x38, -}; - -static const BitmapCharRec ch178 = {6,10,0,-7,7,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { - 0xff,0xf0,0xff,0xf0,0x0,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, - 0xff,0xf0,0xff,0xf0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch177 = {12,15,-1,0,14,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { - 0x38,0x44,0x82,0x82,0x82,0x44,0x38, -}; - -static const BitmapCharRec ch176 = {7,7,-1,-10,9,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { - 0xfc,0xfc, -}; - -static const BitmapCharRec ch175 = {6,2,-1,-14,8,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { - 0x7,0xf0,0x0,0x1c,0x1c,0x0,0x30,0x6,0x0,0x60,0x3,0x0,0x47,0x19,0x0,0xc2, - 0x31,0x80,0x82,0x20,0x80,0x82,0x40,0x80,0x83,0xe0,0x80,0x82,0x30,0x80,0x82,0x10, - 0x80,0xc2,0x11,0x80,0x42,0x31,0x0,0x67,0xe3,0x0,0x30,0x6,0x0,0x1c,0x1c,0x0, - 0x7,0xf0,0x0, -}; - -static const BitmapCharRec ch174 = {17,17,-1,0,19,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { - 0xfe,0xfe, -}; - -static const BitmapCharRec ch173 = {7,2,-1,-5,9,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { - 0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0xff,0xf0,0xff,0xf0, -}; - -static const BitmapCharRec ch172 = {12,7,-1,-3,14,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { - 0x8,0x80,0x19,0x80,0x33,0x0,0x66,0x0,0xcc,0x0,0xcc,0x0,0x66,0x0,0x33,0x0, - 0x19,0x80,0x8,0x80, -}; - -static const BitmapCharRec ch171 = {9,10,-2,-1,13,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { - 0x7e,0x0,0x76,0xcc,0xcc,0x7c,0xc,0xcc,0x78, -}; - -static const BitmapCharRec ch170 = {7,9,0,-8,8,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { - 0x7,0xf0,0x0,0x1c,0x1c,0x0,0x30,0x6,0x0,0x61,0xc3,0x0,0x47,0x71,0x0,0xc4, - 0x19,0x80,0x8c,0x0,0x80,0x88,0x0,0x80,0x88,0x0,0x80,0x88,0x0,0x80,0x8c,0x0, - 0x80,0xc4,0x19,0x80,0x47,0x31,0x0,0x61,0xe3,0x0,0x30,0x6,0x0,0x1c,0x1c,0x0, - 0x7,0xf0,0x0, -}; - -static const BitmapCharRec ch169 = {17,17,-1,0,19,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { - 0xcc,0xcc, -}; - -static const BitmapCharRec ch168 = {6,2,-1,-14,8,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { - 0x38,0x64,0x62,0x6,0xe,0x1c,0x38,0x74,0xe2,0xc3,0x83,0x87,0x4e,0x3c,0x38,0x70, - 0x60,0x46,0x26,0x1c, -}; - -static const BitmapCharRec ch167 = {8,20,-2,2,12,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0, -}; - -static const BitmapCharRec ch166 = {2,17,-2,0,6,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { - 0xf,0xc0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x1f,0xe0,0x3,0x0,0x1f,0xe0, - 0x3,0x0,0x7,0x80,0xc,0x80,0xc,0xc0,0x18,0x40,0x18,0x60,0x30,0x20,0x70,0x30, - 0xf8,0x7c, -}; - -static const BitmapCharRec ch165 = {14,17,0,0,14,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { - 0xc0,0x60,0xee,0xe0,0x7f,0xc0,0x31,0x80,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0x31,0x80,0x7f,0xc0,0xee,0xe0,0xc0,0x60, -}; - -static const BitmapCharRec ch164 = {11,12,-1,-3,13,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { - 0xe7,0x80,0xbe,0xc0,0x78,0x40,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, - 0x30,0x0,0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x31,0x80,0x19,0x80, - 0xf,0x0, -}; - -static const BitmapCharRec ch163 = {10,17,-1,0,12,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { - 0x40,0x0,0x40,0x0,0x3e,0x0,0x7f,0x0,0x70,0x80,0xd0,0x0,0xc8,0x0,0xc8,0x0, - 0xc8,0x0,0xc4,0x0,0xc4,0x0,0x43,0x80,0x63,0x80,0x1f,0x0,0x1,0x0,0x1,0x0, -}; - -static const BitmapCharRec ch162 = {9,16,-1,2,12,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0xc0, - 0xc0, -}; - -static const BitmapCharRec ch161 = {2,17,-4,5,8,ch161data}; - -/* char: 0xa0 */ - -static const BitmapCharRec ch160 = {0,0,0,0,6,0}; - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { - 0x83,0x80,0xc7,0xc0,0x7c,0x60,0x38,0x20, -}; - -static const BitmapCharRec ch126 = {11,4,-1,-5,13,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { - 0xe0,0x30,0x18,0x18,0x18,0x18,0x18,0x18,0x8,0xc,0x4,0x3,0x4,0xc,0x8,0x18, - 0x18,0x18,0x18,0x18,0x30,0xe0, -}; - -static const BitmapCharRec ch125 = {8,22,-1,5,10,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0, -}; - -static const BitmapCharRec ch124 = {2,17,-2,0,6,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { - 0x7,0xc,0x18,0x18,0x18,0x18,0x18,0x18,0x10,0x30,0x20,0xc0,0x20,0x30,0x10,0x18, - 0x18,0x18,0x18,0x18,0xc,0x7, -}; - -static const BitmapCharRec ch123 = {8,22,-1,5,10,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { - 0xff,0xc3,0x61,0x70,0x30,0x38,0x18,0x1c,0xe,0x86,0xc3,0xff, -}; - -static const BitmapCharRec ch122 = {8,12,-1,0,10,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { - 0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, - 0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, - 0xf1,0xe0, -}; - -static const BitmapCharRec ch121 = {11,17,0,5,11,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { - 0xf1,0xe0,0x60,0xc0,0x21,0x80,0x33,0x80,0x1b,0x0,0xe,0x0,0xc,0x0,0x1a,0x0, - 0x39,0x0,0x31,0x80,0x60,0xc0,0xf1,0xe0, -}; - -static const BitmapCharRec ch120 = {11,12,-1,0,13,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { - 0x4,0x10,0x0,0xe,0x38,0x0,0xe,0x38,0x0,0x1a,0x28,0x0,0x1a,0x64,0x0,0x19, - 0x64,0x0,0x31,0x64,0x0,0x30,0xc2,0x0,0x30,0xc2,0x0,0x60,0xc2,0x0,0x60,0xc3, - 0x0,0xf1,0xe7,0x80, -}; - -static const BitmapCharRec ch119 = {17,12,0,0,17,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { - 0x4,0x0,0xe,0x0,0xe,0x0,0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80, - 0x30,0x80,0x60,0x80,0x60,0xc0,0xf1,0xe0, -}; - -static const BitmapCharRec ch118 = {11,12,0,0,11,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { - 0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0, -}; - -static const BitmapCharRec ch117 = {11,12,-1,0,13,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { - 0x1c,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfe,0x70,0x30,0x10, -}; - -static const BitmapCharRec ch116 = {7,15,0,0,7,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { - 0xf8,0xc6,0x83,0x3,0x7,0x1e,0x7c,0x70,0xe0,0xc2,0x66,0x3e, -}; - -static const BitmapCharRec ch115 = {8,12,-1,0,10,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { - 0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x76,0x6e,0xe6, -}; - -static const BitmapCharRec ch114 = {7,12,-1,0,8,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { - 0x3,0xc0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1d,0x80,0x73,0x80,0x61,0x80, - 0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x61,0x80,0x73,0x80, - 0x1d,0x80, -}; - -static const BitmapCharRec ch113 = {10,17,-1,5,12,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { - 0xf0,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x6e,0x0,0x73,0x80,0x61,0x80, - 0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x61,0x80,0x73,0x80, - 0xee,0x0, -}; - -static const BitmapCharRec ch112 = {10,17,-1,5,12,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { - 0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0, -}; - -static const BitmapCharRec ch111 = {10,12,-1,0,12,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { - 0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0x60,0xc0,0x71,0xc0,0x6f,0x80,0xe7,0x0, -}; - -static const BitmapCharRec ch110 = {11,12,-1,0,13,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { - 0xf1,0xe3,0xc0,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60, - 0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x71,0xe3,0x80,0x6f,0x9f, - 0x0,0xe7,0xe,0x0, -}; - -static const BitmapCharRec ch109 = {18,12,-1,0,20,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { - 0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0xe0, -}; - -static const BitmapCharRec ch108 = {4,17,-1,0,6,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { - 0xf3,0xe0,0x61,0xc0,0x63,0x80,0x67,0x0,0x6e,0x0,0x6c,0x0,0x78,0x0,0x68,0x0, - 0x64,0x0,0x66,0x0,0x63,0x0,0x67,0xc0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, - 0xe0,0x0, -}; - -static const BitmapCharRec ch107 = {11,17,-1,0,12,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { - 0xc0,0xe0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, - 0x70,0x0,0x0,0x0,0x30,0x30, -}; - -static const BitmapCharRec ch106 = {4,22,0,5,6,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { - 0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0x0,0x0,0x0,0x60, - 0x60, -}; - -static const BitmapCharRec ch105 = {4,17,-1,0,6,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { - 0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0x60,0xc0,0x71,0xc0,0x6f,0x80,0x67,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, - 0xe0,0x0, -}; - -static const BitmapCharRec ch104 = {11,17,-1,0,13,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { - 0x3f,0x0,0xf1,0xc0,0xc0,0x60,0xc0,0x20,0x60,0x60,0x3f,0xc0,0x7f,0x0,0x60,0x0, - 0x30,0x0,0x3e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, - 0x1f,0xc0, -}; - -static const BitmapCharRec ch103 = {11,17,-1,5,12,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { - 0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfe,0x30,0x30,0x30,0x16, - 0xe, -}; - -static const BitmapCharRec ch102 = {7,17,0,0,7,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { - 0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, - 0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0, -}; - -static const BitmapCharRec ch101 = {9,12,-1,0,11,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { - 0x1e,0xc0,0x73,0x80,0x61,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80, - 0xc1,0x80,0x61,0x80,0x73,0x80,0x1d,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80, - 0x3,0x80, -}; - -static const BitmapCharRec ch100 = {10,17,-1,0,12,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { - 0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, - 0xc0,0x0,0x41,0x80,0x63,0x80,0x1f,0x0, -}; - -static const BitmapCharRec ch99 = {9,12,-1,0,11,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { - 0x5e,0x0,0x73,0x80,0x61,0x80,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, - 0x60,0xc0,0x61,0x80,0x73,0x80,0x6e,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, - 0xe0,0x0, -}; - -static const BitmapCharRec ch98 = {10,17,-1,0,12,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { - 0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, - 0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0, -}; - -static const BitmapCharRec ch97 = {9,12,-1,0,11,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { - 0x60,0xe0,0x80,0xc0,0x60, -}; - -static const BitmapCharRec ch96 = {3,5,-2,-12,7,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { - 0xff,0xf8,0xff,0xf8, -}; - -static const BitmapCharRec ch95 = {13,2,0,5,13,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { - 0x80,0x80,0xc1,0x80,0x41,0x0,0x63,0x0,0x22,0x0,0x36,0x0,0x14,0x0,0x1c,0x0, - 0x8,0x0, -}; - -static const BitmapCharRec ch94 = {9,9,-1,-8,11,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { - 0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 0x18,0x18,0x18,0x18,0xf8, -}; - -static const BitmapCharRec ch93 = {5,21,-1,4,8,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { - 0x6,0x6,0x4,0xc,0xc,0x8,0x18,0x18,0x10,0x30,0x30,0x20,0x60,0x60,0x40,0xc0, - 0xc0, -}; - -static const BitmapCharRec ch92 = {7,17,0,0,7,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { - 0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0,0xc0,0xc0,0xc0,0xf8, -}; - -static const BitmapCharRec ch91 = {5,21,-2,4,8,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { - 0xff,0xf8,0xe0,0x18,0x70,0x8,0x30,0x8,0x38,0x0,0x18,0x0,0x1c,0x0,0xe,0x0, - 0x6,0x0,0x7,0x0,0x3,0x0,0x3,0x80,0x1,0xc0,0x80,0xc0,0x80,0xe0,0xc0,0x70, - 0xff,0xf0, -}; - -static const BitmapCharRec ch90 = {13,17,-1,0,15,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { - 0x7,0xe0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0xc0, - 0x3,0x40,0x6,0x60,0x6,0x20,0xc,0x30,0x1c,0x10,0x18,0x18,0x38,0x8,0x30,0xc, - 0xfc,0x3f, -}; - -static const BitmapCharRec ch89 = {16,17,0,0,16,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { - 0xfc,0xf,0xc0,0x30,0x3,0x80,0x18,0x7,0x0,0x8,0xe,0x0,0x4,0xc,0x0,0x6, - 0x18,0x0,0x2,0x38,0x0,0x1,0x70,0x0,0x0,0xe0,0x0,0x0,0xc0,0x0,0x1,0xc0, - 0x0,0x3,0xa0,0x0,0x3,0x10,0x0,0x6,0x8,0x0,0xe,0xc,0x0,0x1c,0x6,0x0, - 0x7e,0xf,0x80, -}; - -static const BitmapCharRec ch88 = {18,17,0,0,18,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { - 0x1,0x83,0x0,0x1,0x83,0x0,0x1,0x83,0x80,0x3,0x87,0x80,0x3,0x46,0x80,0x3, - 0x46,0xc0,0x6,0x46,0x40,0x6,0x4c,0x40,0x6,0x4c,0x60,0xc,0x2c,0x60,0xc,0x2c, - 0x20,0x18,0x2c,0x20,0x18,0x18,0x30,0x18,0x18,0x10,0x30,0x18,0x10,0x30,0x18,0x18, - 0xfc,0x7e,0x7e, -}; - -static const BitmapCharRec ch87 = {23,17,0,0,23,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { - 0x1,0x80,0x0,0x1,0x80,0x0,0x1,0x80,0x0,0x3,0xc0,0x0,0x3,0x40,0x0,0x3, - 0x60,0x0,0x6,0x20,0x0,0x6,0x20,0x0,0x6,0x30,0x0,0xc,0x10,0x0,0xc,0x18, - 0x0,0x18,0x8,0x0,0x18,0x8,0x0,0x18,0xc,0x0,0x30,0x4,0x0,0x30,0x6,0x0, - 0xfc,0x1f,0x80, -}; - -static const BitmapCharRec ch86 = {17,17,0,0,17,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { - 0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, - 0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, - 0xfc,0x1f, -}; - -static const BitmapCharRec ch85 = {16,17,-1,0,18,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { - 0xf,0xc0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0, - 0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x83,0x4,0x83,0x4,0xc3,0xc, - 0xff,0xfc, -}; - -static const BitmapCharRec ch84 = {14,17,-1,0,16,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { - 0x9e,0x0,0xf1,0x80,0xc0,0xc0,0x80,0x60,0x80,0x60,0x0,0x60,0x0,0xe0,0x3,0xc0, - 0xf,0x80,0x1e,0x0,0x78,0x0,0xe0,0x0,0xc0,0x40,0xc0,0x40,0xc0,0xc0,0x63,0xc0, - 0x1e,0x40, -}; - -static const BitmapCharRec ch83 = {11,17,-1,0,13,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { - 0xfc,0x1e,0x30,0x1c,0x30,0x38,0x30,0x70,0x30,0x60,0x30,0xc0,0x31,0xc0,0x33,0x80, - 0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x38,0x30,0x18,0x30,0x38,0x30,0x30,0x30,0x70, - 0xff,0xc0, -}; - -static const BitmapCharRec ch82 = {15,17,-1,0,16,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { - 0x0,0xf,0x0,0x38,0x0,0x70,0x0,0xe0,0x1,0xc0,0x7,0xe0,0x1c,0x38,0x38,0x1c, - 0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3, - 0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38,0x7,0xe0, -}; - -static const BitmapCharRec ch81 = {16,22,-1,5,18,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { - 0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, - 0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70, - 0xff,0xc0, -}; - -static const BitmapCharRec ch80 = {13,17,-1,0,15,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { - 0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, - 0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, - 0x7,0xe0, -}; - -static const BitmapCharRec ch79 = {16,17,-1,0,18,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { - 0xf8,0xc,0x20,0x1c,0x20,0x1c,0x20,0x34,0x20,0x64,0x20,0x64,0x20,0xc4,0x21,0x84, - 0x21,0x84,0x23,0x4,0x26,0x4,0x26,0x4,0x2c,0x4,0x38,0x4,0x38,0x4,0x30,0x4, - 0xf0,0x1f, -}; - -static const BitmapCharRec ch78 = {16,17,-1,0,18,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { - 0xf8,0x21,0xf8,0x20,0x60,0x60,0x20,0x60,0x60,0x20,0xd0,0x60,0x20,0xd0,0x60,0x21, - 0x88,0x60,0x21,0x88,0x60,0x23,0x8,0x60,0x23,0x4,0x60,0x26,0x4,0x60,0x26,0x2, - 0x60,0x2c,0x2,0x60,0x2c,0x2,0x60,0x38,0x1,0x60,0x38,0x1,0x60,0x30,0x0,0xe0, - 0xf0,0x0,0xf8, -}; - -static const BitmapCharRec ch77 = {21,17,-1,0,22,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { - 0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, - 0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, - 0xfc,0x0, -}; - -static const BitmapCharRec ch76 = {13,17,-1,0,14,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { - 0xfc,0x1f,0x30,0xe,0x30,0x1c,0x30,0x38,0x30,0x70,0x30,0xe0,0x31,0xc0,0x33,0x80, - 0x3f,0x0,0x3e,0x0,0x33,0x0,0x31,0x80,0x30,0xc0,0x30,0x60,0x30,0x30,0x30,0x18, - 0xfc,0x7e, -}; - -static const BitmapCharRec ch75 = {16,17,-1,0,17,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { - 0x78,0x0,0xcc,0x0,0xc6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, - 0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, - 0x1f,0x80, -}; - -static const BitmapCharRec ch74 = {9,17,-1,0,11,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { - 0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, - 0xfc, -}; - -static const BitmapCharRec ch73 = {6,17,-1,0,8,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { - 0xfc,0x1f,0x80,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30, - 0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x3f,0xfe,0x0,0x30,0x6,0x0,0x30,0x6, - 0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0, - 0xfc,0x1f,0x80, -}; - -static const BitmapCharRec ch72 = {17,17,-1,0,19,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { - 0x7,0xe0,0x1e,0x38,0x38,0x1c,0x60,0xc,0x60,0xc,0xc0,0xc,0xc0,0xc,0xc0,0x3f, - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c, - 0x7,0xe4, -}; - -static const BitmapCharRec ch71 = {16,17,-1,0,18,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { - 0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x20,0x30,0x20, - 0x3f,0xe0,0x30,0x20,0x30,0x20,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, - 0xff,0xf0, -}; - -static const BitmapCharRec ch70 = {12,17,-1,0,14,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { - 0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, - 0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, - 0xff,0xf0, -}; - -static const BitmapCharRec ch69 = {13,17,-1,0,15,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { - 0xff,0xc0,0x30,0x70,0x30,0x38,0x30,0xc,0x30,0xc,0x30,0x6,0x30,0x6,0x30,0x6, - 0x30,0x6,0x30,0x6,0x30,0x6,0x30,0x6,0x30,0xc,0x30,0xc,0x30,0x38,0x30,0x70, - 0xff,0xc0, -}; - -static const BitmapCharRec ch68 = {15,17,-1,0,17,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { - 0x7,0xe0,0x1e,0x38,0x38,0x8,0x60,0x4,0x60,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, - 0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c, - 0x7,0xe4, -}; - -static const BitmapCharRec ch67 = {14,17,-1,0,16,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { - 0xff,0xe0,0x30,0x78,0x30,0x18,0x30,0xc,0x30,0xc,0x30,0xc,0x30,0x18,0x30,0x38, - 0x3f,0xe0,0x30,0x40,0x30,0x30,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70, - 0xff,0xc0, -}; - -static const BitmapCharRec ch66 = {14,17,-1,0,16,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { - 0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, - 0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, - 0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, - 0x0,0x80,0x0, -}; - -static const BitmapCharRec ch65 = {17,17,0,0,17,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { - 0x3,0xf0,0x0,0xe,0xc,0x0,0x18,0x0,0x0,0x30,0x0,0x0,0x61,0xde,0x0,0x63, - 0x7b,0x0,0xc6,0x39,0x80,0xc6,0x18,0x80,0xc6,0x18,0xc0,0xc6,0x18,0x40,0xc6,0xc, - 0x40,0xc3,0xc,0x40,0xc3,0x8c,0x40,0xe1,0xfc,0x40,0x60,0xec,0xc0,0x70,0x0,0x80, - 0x38,0x1,0x80,0x1c,0x3,0x0,0xf,0xe,0x0,0x3,0xf8,0x0, -}; - -static const BitmapCharRec ch64 = {18,20,-2,3,22,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { - 0x30,0x30,0x0,0x0,0x10,0x10,0x10,0x18,0x18,0xc,0xe,0x7,0xc3,0xc3,0x83,0xc6, - 0x7c, -}; - -static const BitmapCharRec ch63 = {8,17,-2,0,11,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { - 0xc0,0x0,0x70,0x0,0x1c,0x0,0x7,0x0,0x1,0xc0,0x0,0x60,0x1,0xc0,0x7,0x0, - 0x1c,0x0,0x70,0x0,0xc0,0x0, -}; - -static const BitmapCharRec ch62 = {11,11,-1,-1,13,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { - 0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xf0, -}; - -static const BitmapCharRec ch61 = {12,6,-1,-4,14,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { - 0x0,0x60,0x1,0xc0,0x7,0x0,0x1c,0x0,0x70,0x0,0xc0,0x0,0x70,0x0,0x1c,0x0, - 0x7,0x0,0x1,0xc0,0x0,0x60, -}; - -static const BitmapCharRec ch60 = {11,11,-1,-1,13,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { - 0xc0,0x60,0x20,0xe0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch59 = {3,14,-2,3,7,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { - 0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch58 = {2,11,-2,0,6,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { - 0xf0,0x0,0x1c,0x0,0x6,0x0,0x3,0x0,0x3,0x80,0x1,0x80,0x1d,0x80,0x73,0xc0, - 0x61,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0x61,0x80,0x77,0x80, - 0x1e,0x0, -}; - -static const BitmapCharRec ch57 = {10,17,-1,0,12,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { - 0x1e,0x0,0x73,0x80,0xe1,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x41,0xc0,0x61,0x80, - 0x37,0x0,0x1e,0x0,0x1e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, - 0x1e,0x0, -}; - -static const BitmapCharRec ch56 = {10,17,-1,0,12,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { - 0x18,0x0,0x18,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0x4,0x0,0x6,0x0,0x6,0x0, - 0x2,0x0,0x3,0x0,0x3,0x0,0x1,0x0,0x1,0x80,0x81,0x80,0xc0,0xc0,0xff,0xc0, - 0x7f,0xc0, -}; - -static const BitmapCharRec ch55 = {10,17,-1,0,12,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { - 0x1e,0x0,0x7b,0x80,0x61,0x80,0xe0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc1,0x80,0xf3,0x80,0xee,0x0,0x60,0x0,0x70,0x0,0x30,0x0,0x18,0x0,0xe,0x0, - 0x3,0xc0, -}; - -static const BitmapCharRec ch54 = {10,17,-1,0,12,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { - 0x7e,0x0,0xe3,0x80,0xc1,0x80,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x1,0xc0, - 0x3,0x80,0xf,0x80,0x7e,0x0,0x78,0x0,0x60,0x0,0x20,0x0,0x20,0x0,0x1f,0x80, - 0x1f,0xc0, -}; - -static const BitmapCharRec ch53 = {10,17,-1,0,12,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { - 0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0xff,0xc0,0xff,0xc0,0xc3,0x0,0x43,0x0, - 0x63,0x0,0x23,0x0,0x33,0x0,0x13,0x0,0x1b,0x0,0xb,0x0,0x7,0x0,0x7,0x0, - 0x3,0x0, -}; - -static const BitmapCharRec ch52 = {10,17,-1,0,12,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { - 0x78,0x0,0xe6,0x0,0xc3,0x0,0x1,0x0,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0x80, - 0x7,0x0,0x1e,0x0,0xc,0x0,0x6,0x0,0x83,0x0,0x83,0x0,0x47,0x0,0x7e,0x0, - 0x1c,0x0, -}; - -static const BitmapCharRec ch51 = {9,17,-1,0,12,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { - 0xff,0x80,0xff,0xc0,0x60,0x40,0x30,0x0,0x18,0x0,0xc,0x0,0x4,0x0,0x6,0x0, - 0x3,0x0,0x3,0x0,0x1,0x80,0x1,0x80,0x81,0x80,0x81,0x80,0x43,0x80,0x7f,0x0, - 0x1c,0x0, -}; - -static const BitmapCharRec ch50 = {10,17,-1,0,12,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { - 0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x18, - 0x8, -}; - -static const BitmapCharRec ch49 = {8,17,-2,0,12,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { - 0x1e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0xe1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x61,0x80,0x61,0x80,0x33,0x0, - 0x1e,0x0, -}; - -static const BitmapCharRec ch48 = {10,17,-1,0,12,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { - 0xc0,0xc0,0xc0,0x60,0x60,0x20,0x30,0x30,0x10,0x18,0x18,0x8,0xc,0xc,0x4,0x6, - 0x6,0x3,0x3,0x3, -}; - -static const BitmapCharRec ch47 = {8,20,1,3,7,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { - 0xc0,0xc0, -}; - -static const BitmapCharRec ch46 = {2,2,-2,0,6,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { - 0xff,0xf0,0xff,0xf0, -}; - -static const BitmapCharRec ch45 = {12,2,-1,-6,14,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { - 0xc0,0x60,0x20,0xe0,0xc0, -}; - -static const BitmapCharRec ch44 = {3,5,-2,3,7,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { - 0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xff,0xf0,0xff,0xf0,0x6,0x0, - 0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch43 = {12,12,-1,-1,14,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { - 0x8,0x0,0x1c,0x0,0xc9,0x80,0xeb,0x80,0x1c,0x0,0xeb,0x80,0xc9,0x80,0x1c,0x0, - 0x8,0x0, -}; - -static const BitmapCharRec ch42 = {9,9,-2,-8,12,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { - 0x80,0x40,0x20,0x30,0x10,0x18,0x18,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0x18, - 0x18,0x10,0x30,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {6,22,-1,5,8,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { - 0x4,0x8,0x10,0x30,0x20,0x60,0x60,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x60, - 0x60,0x20,0x30,0x10,0x8,0x4, -}; - -static const BitmapCharRec ch40 = {6,22,-1,5,8,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { - 0xc0,0x60,0x20,0xe0,0xc0, -}; - -static const BitmapCharRec ch39 = {3,5,-3,-12,8,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { - 0x3c,0x3c,0x7f,0x7e,0xe1,0xe1,0xc0,0xc0,0xc1,0xc0,0xc1,0xa0,0x63,0x20,0x37,0x10, - 0x1e,0x18,0xe,0x3e,0xf,0x0,0x1d,0x80,0x18,0xc0,0x18,0x40,0x18,0x40,0xc,0xc0, - 0x7,0x80, -}; - -static const BitmapCharRec ch38 = {16,17,-1,0,18,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { - 0x30,0x3c,0x0,0x18,0x72,0x0,0xc,0x61,0x0,0x4,0x60,0x80,0x6,0x60,0x80,0x3, - 0x30,0x80,0x1,0x19,0x80,0x1,0x8f,0x0,0x78,0xc0,0x0,0xe4,0x40,0x0,0xc2,0x60, - 0x0,0xc1,0x30,0x0,0xc1,0x10,0x0,0x61,0x18,0x0,0x33,0xfc,0x0,0x1e,0xc,0x0, -}; - -static const BitmapCharRec ch37 = {17,16,-1,0,19,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { - 0x4,0x0,0x4,0x0,0x3f,0x0,0xe5,0xc0,0xc4,0xc0,0x84,0x60,0x84,0x60,0x4,0x60, - 0x4,0xe0,0x7,0xc0,0x7,0x80,0x1e,0x0,0x3c,0x0,0x74,0x0,0x64,0x0,0x64,0x20, - 0x64,0x60,0x34,0xe0,0x1f,0x80,0x4,0x0,0x4,0x0, -}; - -static const BitmapCharRec ch36 = {11,21,0,2,12,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { - 0x22,0x0,0x22,0x0,0x22,0x0,0x22,0x0,0x22,0x0,0xff,0xc0,0xff,0xc0,0x11,0x0, - 0x11,0x0,0x11,0x0,0x7f,0xe0,0x7f,0xe0,0x8,0x80,0x8,0x80,0x8,0x80,0x8,0x80, - 0x8,0x80, -}; - -static const BitmapCharRec ch35 = {11,17,-1,0,13,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { - 0x88,0xcc,0xcc,0xcc,0xcc, -}; - -static const BitmapCharRec ch34 = {6,5,-1,-12,10,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { - 0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0xc0, -}; - -static const BitmapCharRec ch33 = {2,17,-3,0,8,ch33data}; - -/* char: 0x20 ' ' */ - -static const BitmapCharRec ch32 = {0,0,0,0,6,0}; - -static const BitmapCharRec * const chars[] = { - &ch32, - &ch33, - &ch34, - &ch35, - &ch36, - &ch37, - &ch38, - &ch39, - &ch40, - &ch41, - &ch42, - &ch43, - &ch44, - &ch45, - &ch46, - &ch47, - &ch48, - &ch49, - &ch50, - &ch51, - &ch52, - &ch53, - &ch54, - &ch55, - &ch56, - &ch57, - &ch58, - &ch59, - &ch60, - &ch61, - &ch62, - &ch63, - &ch64, - &ch65, - &ch66, - &ch67, - &ch68, - &ch69, - &ch70, - &ch71, - &ch72, - &ch73, - &ch74, - &ch75, - &ch76, - &ch77, - &ch78, - &ch79, - &ch80, - &ch81, - &ch82, - &ch83, - &ch84, - &ch85, - &ch86, - &ch87, - &ch88, - &ch89, - &ch90, - &ch91, - &ch92, - &ch93, - &ch94, - &ch95, - &ch96, - &ch97, - &ch98, - &ch99, - &ch100, - &ch101, - &ch102, - &ch103, - &ch104, - &ch105, - &ch106, - &ch107, - &ch108, - &ch109, - &ch110, - &ch111, - &ch112, - &ch113, - &ch114, - &ch115, - &ch116, - &ch117, - &ch118, - &ch119, - &ch120, - &ch121, - &ch122, - &ch123, - &ch124, - &ch125, - &ch126, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &ch160, - &ch161, - &ch162, - &ch163, - &ch164, - &ch165, - &ch166, - &ch167, - &ch168, - &ch169, - &ch170, - &ch171, - &ch172, - &ch173, - &ch174, - &ch175, - &ch176, - &ch177, - &ch178, - &ch179, - &ch180, - &ch181, - &ch182, - &ch183, - &ch184, - &ch185, - &ch186, - &ch187, - &ch188, - &ch189, - &ch190, - &ch191, - &ch192, - &ch193, - &ch194, - &ch195, - &ch196, - &ch197, - &ch198, - &ch199, - &ch200, - &ch201, - &ch202, - &ch203, - &ch204, - &ch205, - &ch206, - &ch207, - &ch208, - &ch209, - &ch210, - &ch211, - &ch212, - &ch213, - &ch214, - &ch215, - &ch216, - &ch217, - &ch218, - &ch219, - &ch220, - &ch221, - &ch222, - &ch223, - &ch224, - &ch225, - &ch226, - &ch227, - &ch228, - &ch229, - &ch230, - &ch231, - &ch232, - &ch233, - &ch234, - &ch235, - &ch236, - &ch237, - &ch238, - &ch239, - &ch240, - &ch241, - &ch242, - &ch243, - &ch244, - &ch245, - &ch246, - &ch247, - &ch248, - &ch249, - &ch250, - &ch251, - &ch252, - &ch253, - &ch254, - &ch255, -}; - -const BitmapFontRec glutBitmapTimesRoman24 = { - "-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1", - 224, - 32, - chars -}; - -#endif - diff --git a/lib/SRC/Eden/gluttext/glutbitmap.h b/lib/SRC/Eden/gluttext/glutbitmap.h deleted file mode 100644 index f075efb..0000000 --- a/lib/SRC/Eden/gluttext/glutbitmap.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#ifndef __glutbitmap_h__ -#define __glutbitmap_h__ - -#if defined(EDEN_OPENGL3) -# ifdef EDEN_MACOSX -# include -# else -# include -# endif -#elif defined(EDEN_OPENGLES) -# if defined ANDROID -# include -# include -# else -# include -# include -# endif -#else -# ifdef EDEN_MACOSX -# include -# else -# include -# endif -#endif - -typedef struct { - const GLsizei width; - const GLsizei height; - const GLfloat xorig; - const GLfloat yorig; - const GLfloat advance; - const GLubyte *bitmap; -} BitmapCharRec, *BitmapCharPtr; - -typedef struct _BitmapFontRec { - const char *name; - const int num_chars; - const int first; - const BitmapCharRec * const *ch; -} BitmapFontRec, *BitmapFontPtr; - -typedef void *GLUTbitmapFont; - -#endif /* __glutbitmap_h__ */ diff --git a/lib/SRC/Eden/gluttext/glutstroke.h b/lib/SRC/Eden/gluttext/glutstroke.h deleted file mode 100644 index bf6ae74..0000000 --- a/lib/SRC/Eden/gluttext/glutstroke.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#ifndef __glutstroke_h__ -#define __glutstroke_h__ - -#if defined(EDEN_OPENGL3) -# ifdef EDEN_MACOSX -# include -# else -# include -# endif -#elif defined(EDEN_OPENGLES) -# if defined ANDROID -# include -# include -# else -# include -# include -# endif -#else -# ifdef EDEN_MACOSX -# include -# else -# include -# endif -#endif - -typedef struct { - float x; - float y; -} CoordRec, *CoordPtr; - -typedef struct { - int num_coords; - const CoordRec *coord; -} StrokeRec, *StrokePtr; - -typedef struct { - int num_strokes; - const StrokeRec *stroke; - float center; - float right; -} StrokeCharRec, *StrokeCharPtr; - -typedef struct _StrokeFontRec { - const char *name; - int num_chars; - const StrokeCharRec *ch; - float top; - float bottom; -} StrokeFontRec, *StrokeFontPtr; - -typedef void *GLUTstrokeFont; - -#endif /* __glutstroke_h__ */ diff --git a/lib/SRC/Eden/readtex.c b/lib/SRC/Eden/readtex.c deleted file mode 100644 index fca08bc..0000000 --- a/lib/SRC/Eden/readtex.c +++ /dev/null @@ -1,405 +0,0 @@ -/* readtex.c */ - -/* - * Read an SGI .rgb image file and generate a mipmap texture set. - * Much of this code was borrowed from SGI's tk OpenGL toolkit. - * - * By Mark Kilgard (MK) mkilgard@nvidia.com - * Revised by Geoff Stahl (GGS) gstahl@apple.com - * Revised by Philip Lamb (PRL) phil@eden.net.nz - * - * Rev Date Who Changes - * 1.0.1 19990420 GGS Fixed memory leaks. - * 1.0.2 20011111 PRL Improved commenting. - * 1.0.3 20011219 PRL Fixed more memory leaks. - * 1.0.4 20020103 PRL Fixed more memory leaks in case of error and improved error handling. - */ - -// @@BEGIN_EDEN_LICENSE_HEADER@@ -// -// This file is part of The Eden Library. -// -// The Eden Library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Eden Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with The Eden Library. If not, see . -// -// As a special exception, the copyright holders of this library give you -// permission to link this library with independent modules to produce an -// executable, regardless of the license terms of these independent modules, and to -// copy and distribute the resulting executable under terms of your choice, -// provided that you also meet, for each linked independent module, the terms and -// conditions of the license of that module. An independent module is a module -// which is neither derived from nor based on this library. If you modify this -// library, you may extend this exception to your version of the library, but you -// are not obligated to do so. If you do not wish to do so, delete this exception -// statement from your version. -// -// @@END_EDEN_LICENSE_HEADER@@ - - -#include - -#ifdef EDEN_MACOSX -# include -#elif defined(EDEN_OPENGLES) -#else -# ifdef _WIN32 -# include -# endif -# include -#endif - -#include -#include -#include -#include - -#include // EdenGetFileExtensionFromPath() - -#ifdef EDEN_HAVE_LIBJPEG -# include "jpeglib.h" -#endif - -// Core in OpenGL 1.4. -#ifndef GL_SGIS_generate_mipmap -#define GENERATE_MIPMAP_SGIS 0x8191 -#endif - -/******************************************************************************/ - -/* RGB Image Structure */ -// 108 byte header. -typedef struct { - uint16_t imagic; // Filled in with bytes 0-1 of file. IRIS image file magic number. - uint8_t storage; // Filled in with byte 2 of file. Storage format. - uint8_t bpc; // Filled in with byte 3 of file. Number of bytes per pixel channel. - uint16_t dim; // Filled in with bytes 4-5 of file. Number of dimensions - uint16_t sizeX, sizeY, sizeZ; // Filled in with bytes 6-11 of file. X, Y, size in pixels, number of channels. - uint32_t min, max; // Filled in with bytes 12-19 of file. Minimum, maximum pixel values. - uint32_t wasteBytes; // Filled in with bytes 20-23 of file. Ignored. - char name[80]; // Filled in with bytes 24-103 of file. Image name. - uint32_t colorMap; // Filled in with bytes 104-107 of file. Colormap ID. -} rawImageHeader; - -/******************************************************************************/ - -static void ConvertShort(uint16_t *array, size_t length) -{ - uint16_t b1, b2; - unsigned char *ptr; - - ptr = (unsigned char *) array; - while (length--) { - b1 = *ptr++; - b2 = *ptr++; - *array++ = (b1 << 8) | (b2); - } -} - -static void ConvertInt(uint32_t *array, size_t length) -{ - uint32_t b1, b2, b3, b4; - unsigned char *ptr; - - ptr = (unsigned char *) array; - while (length--) { - b1 = *ptr++; - b2 = *ptr++; - b3 = *ptr++; - b4 = *ptr++; - *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4); - } -} - -// Load an SGI .rgb file. -// Supports arbitrary number of channels. -static unsigned char *RawImageRead(const char *imageFile, int *w, int *h, int *nc) -{ - int i, j, k, count; - FILE *fp; - long fileLen; - unsigned char *fileContents; - rawImageHeader *header; - uint32_t tableLength; - uint32_t *rowOffsetsTable; - uint32_t *rowLengthsTable; - unsigned char **rows; - unsigned char *data; - unsigned char *dataPtr; - unsigned char *oPtr; - unsigned char *iPtr; - unsigned char pixel; - int outCount; - - if ((fp = fopen(imageFile, "rb")) == NULL) { - EDEN_LOGe("RawImageRead(): Can't open file '%s' for reading.\n", imageFile); - EDEN_LOGperror(NULL); - return (NULL); - } - - // Determine length of file. - if (fseek(fp, 0L, SEEK_END) != 0) { - EDEN_LOGe("RawImageRead(): Error finding length of file '%s'.\n", imageFile); - EDEN_LOGperror(NULL); - fclose(fp); - return (NULL); - } - fileLen = ftell(fp); - rewind(fp); - - // Read in entire file in one go. - fileContents = (unsigned char *)malloc(fileLen); - if (!fileContents) { - EDEN_LOGe("Unable to allocate memory to read %ld byte image file.\n", fileLen); - fclose(fp); - return (NULL); - } - - if (fread(fileContents, fileLen, 1, fp) < 1) { - if (ferror(fp)) { - EDEN_LOGperror("Error reading file"); - fclose(fp); - goto bail; - } - } - fclose(fp); - - // Interpret file header. - header = (rawImageHeader *)fileContents; // First 108 bytes of file are header. -#ifndef EDEN_BIGENDIAN - ConvertShort(&(header->imagic), 1); -#endif - - if (header->imagic != 474) { // Convert imagic to native endianness. - EDEN_LOGe("File does not appear to be a raw (SGI) format image.\n"); - goto bail; - } -#ifndef EDEN_BIGENDIAN - ConvertShort(&(header->dim), 4); // Convert dim, sizeX, sizeY, sizeZ to native endianness. - ConvertInt(&(header->min), 2); // Convert min, max to native endianness. -#endif - if (header->bpc > 1) { - EDEN_LOGe("Request to open %d bytes-per-component image, but max. 1 supported.\n", header->bpc); - goto bail; - } - - if (header->storage == 1) { - // For RLE-encoded, we'll need to read the table of row start - // positions, and row sizes. There are sizeY * sizeZ entries, - // each an unsigned 32-bit int. - tableLength = header->sizeY * header->sizeZ * sizeof(uint32_t); - rowOffsetsTable = (uint32_t *)(fileContents + 512); - rowLengthsTable = (uint32_t *)(fileContents + 512 + tableLength); -#ifndef EDEN_BIGENDIAN - ConvertInt(rowOffsetsTable, header->sizeY*header->sizeZ); - ConvertInt(rowLengthsTable, header->sizeY*header->sizeZ); -#endif - } - - if (w) *w = header->sizeX; - if (h) *h = header->sizeY; - if (nc) *nc = header->sizeZ; - - data = (unsigned char *)malloc(header->sizeX * header->sizeY * header->sizeZ); - if (!data) { - EDEN_LOGe("Unable to allocate memory to for image.\n"); - goto bail; - } - - // Set up structures used to unpack the data. - rows = (unsigned char **)calloc(header->sizeZ, sizeof(unsigned char *)); - for (j = 0; j < header->sizeZ; j++) { - if (!(rows[j] = (unsigned char *)malloc(header->sizeX))) { - EDEN_LOGe("Out of memory!\n"); - goto bailRows; - } - } - - // Now unpack. - dataPtr = data; - for (i = 0; i < header->sizeY; i++) { - // Unpack all planes for a row. - for (j = 0; j < header->sizeZ; j++) { - if (header->storage == 1) { - // Unpack RLE-encoded pixels. - iPtr = fileContents + rowOffsetsTable[i + j*header->sizeY]; - oPtr = rows[j]; - outCount = 0; - for (;;) { - if (outCount == header->sizeX) break; - pixel = *(iPtr++); - count = (int)(pixel & 0x7F); - if (!count) break; // End of line. - if (pixel & 0x80) { - while (outCount < header->sizeX && count--) { - *(oPtr++) = *(iPtr++); - outCount++; - } - } else { - pixel = *(iPtr++); - while (outCount < header->sizeX && count--) { - *(oPtr++) = pixel; - outCount++; - } - } - } - } else { - // Read pixels directly. - memcpy(rows[j], fileContents + 512 + header->sizeX * (i + j*header->sizeY), header->sizeX); - } - } - // Copy the row, interleaving. - for (k = 0; k < header->sizeX; k++) { - for (j = 0; j < header->sizeZ; j++) { - *(dataPtr++) = rows[j][k]; - } - } - } - - // Clean up work structures. - for (j = 0; j < header->sizeZ; j++) if (rows[j]) free(rows[j]); - free(rows); - free(fileContents); - - return (data); - - // When bailing out, do the correct free()s. -bailRows: - for (j = 0; j < header->sizeZ; j++) if (rows[j]) free(rows[j]); - free(rows); - free(data); -bail: - free(fileContents); - return (NULL); -} - -#ifdef EDEN_HAVE_LIBJPEG -#define BUFFER_HEIGHT 5 - -unsigned char *jpgread (FILE *fp, int *w, int *h, int *nc, float *dpi) -{ - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; - unsigned char *pixels; - unsigned char *buffer[BUFFER_HEIGHT]; - int bytes_per_line; - int row; - int i; - - /* Initialize the JPEG decompression object with default error handling. */ - memset(&cinfo, 0, sizeof(cinfo)); - - /* We set up the normal JPEG error routines, then override error_exit. */ - cinfo.err = jpeg_std_error(&jerr); - /* jerr.pub.error_exit = my_error_exit; */ - - jpeg_create_decompress(&cinfo); - - /* Specify data source for decompression */ - jpeg_stdio_src(&cinfo, fp); - - /* Read file header, set default decompression parameters */ - (void) jpeg_read_header(&cinfo, TRUE); - - /* Start decompressor */ - (void) jpeg_start_decompress(&cinfo); - - /* Allocate image buffer */ - bytes_per_line = cinfo.num_components * cinfo.image_width; - pixels = (unsigned char *)malloc(bytes_per_line * cinfo.image_height); - if (!pixels) return 0; - - row = 0; - - /* Process data */ - while (cinfo.output_scanline < cinfo.output_height) { - for (i=0; i Date: Fri, 15 May 2020 16:11:20 +0200 Subject: [PATCH 07/34] removing gsub.h and gsubConfig.h --- include/AR/gsub.h | 197 ---------------------------------------- include/AR/gsubConfig.h | 82 ----------------- 2 files changed, 279 deletions(-) delete mode 100644 include/AR/gsub.h delete mode 100644 include/AR/gsubConfig.h diff --git a/include/AR/gsub.h b/include/AR/gsub.h deleted file mode 100644 index 5886226..0000000 --- a/include/AR/gsub.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * gsub.h - * ARToolKit5 - * - * This file is part of ARToolKit. - * - * ARToolKit is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ARToolKit is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with ARToolKit. If not, see . - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce an - * executable, regardless of the license terms of these independent modules, and to - * copy and distribute the resulting executable under terms of your choice, - * provided that you also meet, for each linked independent module, the terms and - * conditions of the license of that module. An independent module is a module - * which is neither derived from nor based on this library. If you modify this - * library, you may extend this exception to your version of the library, but you - * are not obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * - * Copyright 2015 Daqri, LLC. - * Copyright 2003-2015 ARToolworks, Inc. - * - * Author(s): Hirokazu Kato - * - */ - -#ifndef AR_GSUB_H -#define AR_GSUB_H - -#ifndef __APPLE__ -# ifdef _WIN32 -# include -# endif -# include "GL/glut.h" -# ifdef GL_VERSION_1_2 -# include -# endif -#else -# include -# include -#endif -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int sx; - int sy; - int xsize; - int ysize; -} ARGViewport; - -typedef struct { - int clipSx; - int clipSy; - int clipWidth; - int clipHeight; -} ARGImageClip; - -typedef struct { - ARdouble nearClip; - ARdouble farClip; -} ARGClipPlane; - -typedef struct { -#ifdef AR_IOS - int imageVBOFlag; - GLuint imageVBO; - GLuint imageTBO; - GLuint imageIBO; - int texIdFlag; - GLuint texId; - int texIdYUVFlag; - GLuint texIdYUV1; - GLuint texIdYUV2; - GLuint texIdYUV3; - ARUint8 *imageUV1; - ARUint8 *imageUV2; -#else - int texId; - int listIndex; -#endif -} ARGDisplayList; - -typedef struct { - ARGViewport viewport; - ARParam *cparam; - ARGClipPlane clipPlane; - int dispMethod; - int dispMode; -#ifndef AR_IOS - int flipMode; -#endif - int distortionMode; - int pixFormat; - ARdouble scale; - ARGImageClip imageClip; - ARGDisplayList dispList; - ARGDisplayList dispListHalf; -} ARGViewportHandle; - - -#ifndef AR_IOS -typedef struct { - int winID; - int xsize; - int ysize; - int possibleTextureRectangle; - GLint maxTextureRectangleSize; -} ARGWindowHandle; -#endif - - -#ifndef AR_IOS -int argSetWindow ( ARGWindowHandle *w ); -int argInitWindowPos ( int xpos, int ypos ); -ARGWindowHandle *argCreateWindow ( int xsize, int ysize ); -ARGWindowHandle *argCreateFullWindow ( void ); -int argGetScreenSize ( int *xsize, int *ysize ); -int argSetWindowSize ( int xsize, int ysize ); -#endif -int argGetWindowSize ( int *xsize, int *ysize ); - -ARGViewportHandle *argCreateViewport ( ARGViewport *pos ); -int argDeleteViewport ( ARGViewportHandle **argVPhandle ); -int argViewportSetViewport ( ARGViewportHandle *argVPhandle, ARGViewport *viewport ); -int argViewportSetCparam ( ARGViewportHandle *argVPhandle, ARParam *cparam ); -int argViewportSetImageSize ( ARGViewportHandle *argVPhandle, int xsize, int ysize ); -int argViewportSetClipPlane ( ARGViewportHandle *argVPhandle, ARGClipPlane *clipPlane ); -int argViewportSetDispMethod ( ARGViewportHandle *argVPhandle, int dispMethod ); -int argViewportSetDispMode ( ARGViewportHandle *argVPhandle, int dispMode ); -int argViewportSetFlipMode ( ARGViewportHandle *argVPhandle, int flipMode ); -int argViewportSetDistortionMode ( ARGViewportHandle *argVPhandle, int distortionMode ); -int argViewportSetPixFormat ( ARGViewportHandle *argVPhandle, int pixFormat ); -int argViewportSetDispScale ( ARGViewportHandle *argVPhandle, ARdouble scale ); -int argViewportSetImageClip ( ARGViewportHandle *argVPhandle, ARGImageClip *imageClip ); -int argViewportSetImageClip2 ( ARGViewportHandle *argVPhandle, int *centerX, int *centerY, ARdouble *scale ); - -#ifndef AR_IOS -int argCleanup ( void ); -int argSwapBuffers ( void ); - -int argSetDispFunc ( void (*mainFunc)(void), int idleFlag ); -int argSetKeyFunc ( void (*keyFunc)(unsigned char key, int x, int y) ); -int argSetMouseFunc ( void (*mouseFunc)(int button, int state, int x, int y) ); -int argSetMotionFunc ( void (*motionFunc)(int x, int y) ); -void argMainLoop ( void ); -void argDefaultKeyFunc ( unsigned char key, int x, int y ); -#endif - -void argConvGlpara ( ARdouble para[3][4], ARdouble gl_para[16] ); -int argDrawMode2D ( ARGViewportHandle *argVPhandle ); -int argDrawMode3D ( ARGViewportHandle *argVPhandle ); -int argDrawModeHomography ( ARGViewportHandle *vp, ARdouble z ); - - -int argDrawSquareByIdealPos ( ARdouble vertIdeal[4][2] ); -int argDrawSquareByObservedPos ( ARdouble vertObserved[4][2] ); -int argDrawSquare2ByIdealPos ( ARdouble vertIdeal[4][2] ); -int argDrawSquare2ByObservedPos ( ARdouble vertObserved[4][2] ); -int argDrawLineByIdealPos ( ARdouble x1, ARdouble y1, ARdouble x2, ARdouble y2 ); -int argDrawLineByObservedPos ( ARdouble x1, ARdouble y1, ARdouble x2, ARdouble y2 ); -int argDrawPointByIdealPos ( ARdouble x, ARdouble y ); -int argDrawPointByObservedPos ( ARdouble x, ARdouble y ); -int argDrawStringsByIdealPos ( char *string, ARdouble sx, ARdouble sy ); -int argDrawStringsByObservedPos( char *string, ARdouble sx, ARdouble sy ); - -int argDrawImage ( ARUint8 *image ); -int argDrawImageHalf ( ARUint8 *image ); -int argDrawImageYUV ( ARUint8 *image, ARUint8 *imageUV); - -#ifdef AR_IOS -ARGViewportHandle *argGetCurrentVPHandle ( void ); -int argSetCurrentVPHandle ( ARGViewportHandle *vp ); -int argClearDisplayList ( ARGDisplayList *dispList ); -int argGetCurrentScale ( ARGViewportHandle *vp, ARdouble *sx, ARdouble *sy, ARdouble *offx, ARdouble *offy ); -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/include/AR/gsubConfig.h b/include/AR/gsubConfig.h deleted file mode 100644 index e5cbbbe..0000000 --- a/include/AR/gsubConfig.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * gsubConfig.h - * ARToolKit5 - * - * This file is part of ARToolKit. - * - * ARToolKit is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ARToolKit is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with ARToolKit. If not, see . - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce an - * executable, regardless of the license terms of these independent modules, and to - * copy and distribute the resulting executable under terms of your choice, - * provided that you also meet, for each linked independent module, the terms and - * conditions of the license of that module. An independent module is a module - * which is neither derived from nor based on this library. If you modify this - * library, you may extend this exception to your version of the library, but you - * are not obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * - * Copyright 2015 Daqri, LLC. - * Copyright 2003-2015 ARToolworks, Inc. - * - * Author(s): Hirokazu Kato - * - */ - -#ifndef AR_GSUB_CONFIG_H -#define AR_GSUB_CONFIG_H - -/* NUM of TEXTURE MESH */ -#define AR_GL_TEXTURE_MESH_NUM 40 - -/* MIN_LINE_SEGMENT */ -#define AR_GL_MIN_LINE_SEGMENT 10 - -/* dispMethod */ -#define AR_GL_DISP_METHOD_GL_DRAW_PIXELS 0 -#define AR_GL_DISP_METHOD_TEXTURE_MAPPING_FRAME 1 -#define AR_GL_DISP_METHOD_TEXTURE_MAPPING_FIELD 2 -#define AR_GL_DEFAULT_DISP_METHOD AR_GL_DISP_METHOD_TEXTURE_MAPPING_FRAME - -/* dispMode */ -#define AR_GL_DISP_MODE_FIT_TO_VIEWPORT 0 -#define AR_GL_DISP_MODE_FIT_TO_VIEWPORT_KEEP_ASPECT_RATIO 1 -#define AR_GL_DISP_MODE_FIT_TO_VIEWPORT_HEIGHT_KEEP_ASPECT_RATIO 2 -#define AR_GL_DISP_MODE_FIT_TO_VIEWPORT_WIDTH_KEEP_ASPECT_RATIO 3 -#define AR_GL_DISP_MODE_USE_SPECIFIED_SCALE 4 -#define AR_GL_DEFAULT_DISP_MODE AR_GL_DISP_MODE_FIT_TO_VIEWPORT - -#ifndef AR_IOS -/* flipMode */ -#define AR_GL_FLIP_H 1 -#define AR_GL_FLIP_V 2 -#define AR_GL_FLIP_DISABLE 0 -#define AR_GL_DEFAULT_FLIP_MODE AR_GL_FLIP_DISABLE -#endif - -/* distortionMode */ -#define AR_GL_DISTORTION_COMPENSATE_DISABLE 0 -#define AR_GL_DISTORTION_COMPENSATE_ENABLE 1 -#define AR_GL_DEFAULT_DISTORTION_MODE AR_GL_DISTORTION_COMPENSATE_ENABLE - -/* clipPlane */ -#define AR_GL_DEFAULT_CLIP_NEAR 50.0 -#define AR_GL_DEFAULT_CLIP_FAR 5000.0 - -/* scaleLimit */ -#define AR_GL_DISP_SCALE_MAX 5.0 -#define AR_GL_DISP_SCALE_MIN 0.3 - -#endif From 0f4a70428c916d48e701a65b229654c172fdc691 Mon Sep 17 00:00:00 2001 From: Walter Perdan Date: Mon, 28 Nov 2022 22:55:12 +0100 Subject: [PATCH 08/34] removing dynamic throw's see #11 --- .../FreakMatcher/matchers/visual_database-inline.h | 12 ++++++------ lib/SRC/KPM/FreakMatcher/matchers/visual_database.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/SRC/KPM/FreakMatcher/matchers/visual_database-inline.h b/lib/SRC/KPM/FreakMatcher/matchers/visual_database-inline.h index 7cc4a3f..9429a17 100644 --- a/lib/SRC/KPM/FreakMatcher/matchers/visual_database-inline.h +++ b/lib/SRC/KPM/FreakMatcher/matchers/visual_database-inline.h @@ -76,7 +76,7 @@ namespace vision { VisualDatabase::~VisualDatabase() {} template - void VisualDatabase::addImage(const vision::Image& image, id_t id) throw(Exception) { + void VisualDatabase::addImage(const vision::Image& image, id_t id) { if(mKeyframeMap.find(id) != mKeyframeMap.end()) { throw EXCEPTION("ID already exists"); } @@ -99,7 +99,7 @@ namespace vision { } template - void VisualDatabase::addImage(const GaussianScaleSpacePyramid* pyramid, id_t id) throw(Exception) { + void VisualDatabase::addImage(const GaussianScaleSpacePyramid* pyramid, id_t id) { if(mKeyframeMap.find(id) != mKeyframeMap.end()) { throw EXCEPTION("ID already exists"); } @@ -129,7 +129,7 @@ namespace vision { } template - void VisualDatabase::addKeyframe(keyframe_ptr_t keyframe , id_t id) throw(Exception) { + void VisualDatabase::addKeyframe(keyframe_ptr_t keyframe , id_t id) { typename keyframe_map_t::iterator it = mKeyframeMap.find(id); if(it != mKeyframeMap.end()) { throw EXCEPTION("ID already exists"); @@ -139,7 +139,7 @@ namespace vision { } template - bool VisualDatabase::query(const vision::Image& image) throw(Exception) { + bool VisualDatabase::query(const vision::Image& image) { // Allocate pyramid if(mPyramid.images().size() == 0 || mPyramid.images()[0].width() != image.width() || @@ -157,7 +157,7 @@ namespace vision { } template - bool VisualDatabase::query(const GaussianScaleSpacePyramid* pyramid) throw(Exception) { + bool VisualDatabase::query(const GaussianScaleSpacePyramid* pyramid) { // Allocate detector if(mDetector.width() != pyramid->images()[0].width() || mDetector.height() != pyramid->images()[0].height()) { @@ -177,7 +177,7 @@ namespace vision { } template - bool VisualDatabase::query(const keyframe_t* query_keyframe) throw(Exception) { + bool VisualDatabase::query(const keyframe_t* query_keyframe) { mMatchedInliers.clear(); mMatchedId = -1; diff --git a/lib/SRC/KPM/FreakMatcher/matchers/visual_database.h b/lib/SRC/KPM/FreakMatcher/matchers/visual_database.h index 82620d2..889f1b0 100644 --- a/lib/SRC/KPM/FreakMatcher/matchers/visual_database.h +++ b/lib/SRC/KPM/FreakMatcher/matchers/visual_database.h @@ -80,28 +80,28 @@ namespace vision { /** * Add an image to the database with a specific ID. */ - void addImage(const Image& image, id_t id) throw(Exception); + void addImage(const Image& image, id_t id); /** * Add an image to the database with a specific ID. */ - void addImage(const GaussianScaleSpacePyramid* pyramid, id_t id) throw(Exception); + void addImage(const GaussianScaleSpacePyramid* pyramid, id_t id); /** * Add a keyframe to the database. */ - void addKeyframe(keyframe_ptr_t keyframe , id_t id) throw(Exception); + void addKeyframe(keyframe_ptr_t keyframe , id_t id); /** * Query the visual database. */ - bool query(const Image& image) throw(Exception); + bool query(const Image& image); /** * Query the visual database. */ - bool query(const GaussianScaleSpacePyramid* pyramid) throw(Exception); - bool query(const keyframe_t* query_keyframe) throw(Exception); + bool query(const GaussianScaleSpacePyramid* pyramid); + bool query(const keyframe_t* query_keyframe); /** * Erase an ID. From 6074362fc78a12d274776753f89f7b196f26bf72 Mon Sep 17 00:00:00 2001 From: Walter Perdan Date: Mon, 28 Nov 2022 23:50:51 +0100 Subject: [PATCH 09/34] adding try catch to avoid dynamic throw #11 --- .../matchers/visual_database-inline.h | 98 +++++++++++-------- 1 file changed, 55 insertions(+), 43 deletions(-) diff --git a/lib/SRC/KPM/FreakMatcher/matchers/visual_database-inline.h b/lib/SRC/KPM/FreakMatcher/matchers/visual_database-inline.h index 9429a17..1ee1435 100644 --- a/lib/SRC/KPM/FreakMatcher/matchers/visual_database-inline.h +++ b/lib/SRC/KPM/FreakMatcher/matchers/visual_database-inline.h @@ -77,65 +77,77 @@ namespace vision { template void VisualDatabase::addImage(const vision::Image& image, id_t id) { - if(mKeyframeMap.find(id) != mKeyframeMap.end()) { - throw EXCEPTION("ID already exists"); - } + try{ + if(mKeyframeMap.find(id) != mKeyframeMap.end()) { + throw EXCEPTION("ID already exists"); + } - // Allocate pyramid - if(mPyramid.images().size() == 0 || - mPyramid.images()[0].width() != image.width() || - mPyramid.images()[0].height() != image.height()) { - int num_octaves = numOctaves((int)image.width(), (int)image.height(), kMinCoarseSize); - mPyramid.alloc(image.width(), image.height(), num_octaves); - } + // Allocate pyramid + if(mPyramid.images().size() == 0 || + mPyramid.images()[0].width() != image.width() || + mPyramid.images()[0].height() != image.height()) { + int num_octaves = numOctaves((int)image.width(), (int)image.height(), kMinCoarseSize); + mPyramid.alloc(image.width(), image.height(), num_octaves); + } - // Build the pyramid - TIMED("Build Pyramid") { - mPyramid.build(image); - } + // Build the pyramid + TIMED("Build Pyramid") { + mPyramid.build(image); + } - // Add the image with a pyramid - addImage(&mPyramid, id); + // Add the image with a pyramid + addImage(&mPyramid, id); + } catch (...){ + //log error... + } } template void VisualDatabase::addImage(const GaussianScaleSpacePyramid* pyramid, id_t id) { - if(mKeyframeMap.find(id) != mKeyframeMap.end()) { - throw EXCEPTION("ID already exists"); - } + try{ + if(mKeyframeMap.find(id) != mKeyframeMap.end()) { + throw EXCEPTION("ID already exists"); + } - // Allocate detector - if(mDetector.width() != pyramid->images()[0].width() || - mDetector.height() != pyramid->images()[0].height()) { - mDetector.alloc(pyramid); - } + // Allocate detector + if(mDetector.width() != pyramid->images()[0].width() || + mDetector.height() != pyramid->images()[0].height()) { + mDetector.alloc(pyramid); + } - // Find the features on the image - keyframe_ptr_t keyframe(new keyframe_t()); - keyframe->setWidth((int)pyramid->images()[0].width()); - keyframe->setHeight((int)pyramid->images()[0].height()); - TIMED("Extract Features") { - FindFeatures(keyframe.get(), pyramid, &mDetector, &mFeatureExtractor); - } - LOG_INFO("Found %d features", keyframe->store().size()); + // Find the features on the image + keyframe_ptr_t keyframe(new keyframe_t()); + keyframe->setWidth((int)pyramid->images()[0].width()); + keyframe->setHeight((int)pyramid->images()[0].height()); + TIMED("Extract Features") { + FindFeatures(keyframe.get(), pyramid, &mDetector, &mFeatureExtractor); + } + LOG_INFO("Found %d features", keyframe->store().size()); - // Build the feature index - TIMED("Build Index") { - keyframe->buildIndex(); - } + // Build the feature index + TIMED("Build Index") { + keyframe->buildIndex(); + } - // Store the keyframe - mKeyframeMap[id] = keyframe; + // Store the keyframe + mKeyframeMap[id] = keyframe; + } catch (...) { + // log error... + } } template void VisualDatabase::addKeyframe(keyframe_ptr_t keyframe , id_t id) { - typename keyframe_map_t::iterator it = mKeyframeMap.find(id); - if(it != mKeyframeMap.end()) { - throw EXCEPTION("ID already exists"); - } + try{ + typename keyframe_map_t::iterator it = mKeyframeMap.find(id); + if(it != mKeyframeMap.end()) { + throw EXCEPTION("ID already exists"); + } - mKeyframeMap[id] = keyframe; + mKeyframeMap[id] = keyframe; + } catch (...) { + // log error... + } } template From 8f42e14cf18798300da231364d4cdc000827bdb1 Mon Sep 17 00:00:00 2001 From: Walter Perdan Date: Tue, 29 Nov 2022 18:00:56 +0100 Subject: [PATCH 10/34] removing dymanic throw from image.h & .cpp see #11 --- lib/SRC/KPM/FreakMatcher/framework/image.cpp | 62 +++++++++++--------- lib/SRC/KPM/FreakMatcher/framework/image.h | 2 +- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/lib/SRC/KPM/FreakMatcher/framework/image.cpp b/lib/SRC/KPM/FreakMatcher/framework/image.cpp index dfc0495..73bfd1c 100644 --- a/lib/SRC/KPM/FreakMatcher/framework/image.cpp +++ b/lib/SRC/KPM/FreakMatcher/framework/image.cpp @@ -121,44 +121,48 @@ void Image::alloc(ImageType type, size_t width, size_t height, int step, - size_t channels) throw(Exception) { + size_t channels) { size_t size; - + ASSERT(width > 0, "Width cannot be zero"); ASSERT(height > 0, "Height cannot be zero"); ASSERT(step >= width, "Step must be greater than or equal the width"); ASSERT(channels > 0, "Number of channels cannot be zero"); - - // Find the step size - if(step < 0) { - switch(step) { + + try { + // Find the step size + if (step < 0) { + switch (step) { case AUTO_STEP: default: - mStep = calculate_unit_size(type)*channels*width; - break; - }; - } else { - mStep = step; - } - - size = mStep*height; - - // Allocate image data - if(mSize != size) { - mData.reset(new unsigned char[size]); - ASSERT(mData.get(), "Data pointer is NULL"); - - if(mData.get() == NULL) { - throw EXCEPTION("Unable to allocate image data"); + mStep = calculate_unit_size(type) * channels * width; + break; + }; + } else { + mStep = step; } + + size = mStep * height; + + // Allocate image data + if (mSize != size) { + mData.reset(new unsigned char[size]); + ASSERT(mData.get(), "Data pointer is NULL"); + + if (mData.get() == NULL) { + throw EXCEPTION("Unable to allocate image data"); + } + } + + // Set variables + mType = type; + mWidth = width; + mHeight = height; + mChannels = channels; + mSize = size; + } catch (...) { + // log error... } - - // Set variables - mType = type; - mWidth = width; - mHeight = height; - mChannels = channels; - mSize = size; } void Image::release() { diff --git a/lib/SRC/KPM/FreakMatcher/framework/image.h b/lib/SRC/KPM/FreakMatcher/framework/image.h index 6af8729..b31a9e2 100644 --- a/lib/SRC/KPM/FreakMatcher/framework/image.h +++ b/lib/SRC/KPM/FreakMatcher/framework/image.h @@ -86,7 +86,7 @@ namespace vision { size_t width, size_t height, int step, - size_t channels) throw(Exception); + size_t channels); /** * Release the memory associated with the image. From 20c369f0739c8a0b4e47394fb1bfbcc569aaf115 Mon Sep 17 00:00:00 2001 From: kalwalt Date: Thu, 30 Jun 2022 12:42:22 +0200 Subject: [PATCH 11/34] Eigen 3.4.0 version --- include/AR/config.h | 553 + .../KPM/FreakMatcher/Eigen/AccelerateSupport | 53 + lib/SRC/KPM/FreakMatcher/Eigen/Array | 11 - lib/SRC/KPM/FreakMatcher/Eigen/CMakeLists.txt | 19 - lib/SRC/KPM/FreakMatcher/Eigen/Cholesky | 24 +- lib/SRC/KPM/FreakMatcher/Eigen/CholmodSupport | 48 + lib/SRC/KPM/FreakMatcher/Eigen/Core | 430 +- lib/SRC/KPM/FreakMatcher/Eigen/Eigen | 2 +- lib/SRC/KPM/FreakMatcher/Eigen/Eigen2Support | 82 - lib/SRC/KPM/FreakMatcher/Eigen/Eigenvalues | 28 +- lib/SRC/KPM/FreakMatcher/Eigen/Geometry | 68 +- lib/SRC/KPM/FreakMatcher/Eigen/Householder | 12 +- .../FreakMatcher/Eigen/IterativeLinearSolvers | 48 + lib/SRC/KPM/FreakMatcher/Eigen/Jacobi | 12 +- lib/SRC/KPM/FreakMatcher/Eigen/KLUSupport | 41 + lib/SRC/KPM/FreakMatcher/Eigen/LU | 27 +- lib/SRC/KPM/FreakMatcher/Eigen/LeastSquares | 36 - lib/SRC/KPM/FreakMatcher/Eigen/MetisSupport | 35 + .../KPM/FreakMatcher/Eigen/OrderingMethods | 70 + lib/SRC/KPM/FreakMatcher/Eigen/PaStiXSupport | 49 + lib/SRC/KPM/FreakMatcher/Eigen/PardisoSupport | 35 + lib/SRC/KPM/FreakMatcher/Eigen/QR | 31 +- .../KPM/FreakMatcher/Eigen/QtAlignedMalloc | 13 +- lib/SRC/KPM/FreakMatcher/Eigen/SPQRSupport | 34 + lib/SRC/KPM/FreakMatcher/Eigen/SVD | 34 +- lib/SRC/KPM/FreakMatcher/Eigen/Sparse | 83 +- lib/SRC/KPM/FreakMatcher/Eigen/SparseCholesky | 37 + lib/SRC/KPM/FreakMatcher/Eigen/SparseCore | 68 + lib/SRC/KPM/FreakMatcher/Eigen/SparseLU | 50 + lib/SRC/KPM/FreakMatcher/Eigen/SparseQR | 36 + lib/SRC/KPM/FreakMatcher/Eigen/StdDeque | 23 +- lib/SRC/KPM/FreakMatcher/Eigen/StdList | 23 +- lib/SRC/KPM/FreakMatcher/Eigen/StdVector | 23 +- lib/SRC/KPM/FreakMatcher/Eigen/SuperLUSupport | 64 + lib/SRC/KPM/FreakMatcher/Eigen/UmfPackSupport | 40 + .../src/AccelerateSupport/AccelerateSupport.h | 421 + .../AccelerateSupport/InternalHeaderCheck.h | 3 + .../KPM/FreakMatcher/Eigen/src/CMakeLists.txt | 7 - .../Eigen/src/Cholesky/CMakeLists.txt | 6 - .../Eigen/src/Cholesky/InternalHeaderCheck.h | 3 + .../FreakMatcher/Eigen/src/Cholesky/LDLT.h | 521 +- .../KPM/FreakMatcher/Eigen/src/Cholesky/LLT.h | 389 +- .../Eigen/src/Cholesky/LLT_LAPACKE.h | 121 + .../Eigen/src/CholmodSupport/CholmodSupport.h | 684 + .../src/CholmodSupport/InternalHeaderCheck.h | 3 + .../Eigen/src/Core/ArithmeticSequence.h | 258 + .../KPM/FreakMatcher/Eigen/src/Core/Array.h | 314 +- .../FreakMatcher/Eigen/src/Core/ArrayBase.h | 119 +- .../Eigen/src/Core/ArrayWrapper.h | 230 +- .../KPM/FreakMatcher/Eigen/src/Core/Assign.h | 553 +- .../Eigen/src/Core/AssignEvaluator.h | 1011 + .../FreakMatcher/Eigen/src/Core/Assign_MKL.h | 180 + .../FreakMatcher/Eigen/src/Core/BandMatrix.h | 191 +- .../KPM/FreakMatcher/Eigen/src/Core/Block.h | 425 +- .../Eigen/src/Core/BooleanRedux.h | 139 +- .../Eigen/src/Core/CMakeLists.txt | 10 - .../Eigen/src/Core/CommaInitializer.h | 88 +- .../Eigen/src/Core/ConditionEstimator.h | 177 + .../Eigen/src/Core/CoreEvaluators.h | 1744 ++ .../Eigen/src/Core/CoreIterators.h | 134 + .../Eigen/src/Core/CwiseBinaryOp.h | 243 +- .../Eigen/src/Core/CwiseNullaryOp.h | 474 +- .../Eigen/src/Core/CwiseTernaryOp.h | 199 + .../Eigen/src/Core/CwiseUnaryOp.h | 138 +- .../Eigen/src/Core/CwiseUnaryView.h | 165 +- .../FreakMatcher/Eigen/src/Core/DenseBase.h | 567 +- .../Eigen/src/Core/DenseCoeffsBase.h | 346 +- .../Eigen/src/Core/DenseStorage.h | 643 +- .../FreakMatcher/Eigen/src/Core/Diagonal.h | 176 +- .../Eigen/src/Core/DiagonalMatrix.h | 329 +- .../Eigen/src/Core/DiagonalProduct.h | 123 +- lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Dot.h | 231 +- .../FreakMatcher/Eigen/src/Core/EigenBase.h | 110 +- .../KPM/FreakMatcher/Eigen/src/Core/Flagged.h | 151 - .../Eigen/src/Core/ForceAlignedAccess.h | 59 +- .../FreakMatcher/Eigen/src/Core/Functors.h | 942 - .../KPM/FreakMatcher/Eigen/src/Core/Fuzzy.h | 68 +- .../Eigen/src/Core/GeneralProduct.h | 467 + .../Eigen/src/Core/GenericPacketMath.h | 1125 +- .../Eigen/src/Core/GlobalFunctions.h | 205 +- lib/SRC/KPM/FreakMatcher/Eigen/src/Core/IO.h | 132 +- .../FreakMatcher/Eigen/src/Core/IndexedView.h | 239 + .../Eigen/src/Core/InternalHeaderCheck.h | 3 + .../KPM/FreakMatcher/Eigen/src/Core/Inverse.h | 119 + lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Map.h | 145 +- .../KPM/FreakMatcher/Eigen/src/Core/MapBase.h | 193 +- .../Eigen/src/Core/MathFunctions.h | 1809 +- .../Eigen/src/Core/MathFunctionsImpl.h | 335 + .../KPM/FreakMatcher/Eigen/src/Core/Matrix.h | 435 +- .../FreakMatcher/Eigen/src/Core/MatrixBase.h | 485 +- .../FreakMatcher/Eigen/src/Core/NestByValue.h | 123 +- .../KPM/FreakMatcher/Eigen/src/Core/NoAlias.h | 95 +- .../FreakMatcher/Eigen/src/Core/NumTraits.h | 279 +- .../Eigen/src/Core/PartialReduxEvaluator.h | 239 + .../Eigen/src/Core/PermutationMatrix.h | 469 +- .../Eigen/src/Core/PlainObjectBase.h | 718 +- .../KPM/FreakMatcher/Eigen/src/Core/Product.h | 668 +- .../FreakMatcher/Eigen/src/Core/ProductBase.h | 290 - .../Eigen/src/Core/ProductEvaluators.h | 1181 ++ .../KPM/FreakMatcher/Eigen/src/Core/Random.h | 122 +- .../KPM/FreakMatcher/Eigen/src/Core/Redux.h | 441 +- lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Ref.h | 383 + .../FreakMatcher/Eigen/src/Core/Replicate.h | 128 +- .../FreakMatcher/Eigen/src/Core/Reshaped.h | 455 + .../Eigen/src/Core/ReturnByValue.h | 76 +- .../KPM/FreakMatcher/Eigen/src/Core/Reverse.h | 247 +- .../KPM/FreakMatcher/Eigen/src/Core/Select.h | 92 +- .../Eigen/src/Core/SelfAdjointView.h | 356 +- .../Eigen/src/Core/SelfCwiseBinaryOp.h | 192 +- .../KPM/FreakMatcher/Eigen/src/Core/Solve.h | 190 + .../Eigen/src/Core/SolveTriangular.h | 158 +- .../FreakMatcher/Eigen/src/Core/SolverBase.h | 169 + .../FreakMatcher/Eigen/src/Core/StableNorm.h | 305 +- .../Eigen/src/Core/StlIterators.h | 465 + .../KPM/FreakMatcher/Eigen/src/Core/Stride.h | 69 +- .../KPM/FreakMatcher/Eigen/src/Core/Swap.h | 164 +- .../FreakMatcher/Eigen/src/Core/Transpose.h | 329 +- .../Eigen/src/Core/Transpositions.h | 339 +- .../Eigen/src/Core/TriangularMatrix.h | 1187 +- .../FreakMatcher/Eigen/src/Core/VectorBlock.h | 257 +- .../Eigen/src/Core/VectorwiseOp.h | 622 +- .../KPM/FreakMatcher/Eigen/src/Core/Visitor.h | 399 +- .../Eigen/src/Core/arch/AVX/Complex.h | 370 + .../Eigen/src/Core/arch/AVX/MathFunctions.h | 181 + .../Eigen/src/Core/arch/AVX/PacketMath.h | 1971 ++ .../Eigen/src/Core/arch/AVX/TypeCasting.h | 117 + .../Eigen/src/Core/arch/AVX512/Complex.h | 382 + .../Eigen/src/Core/arch/AVX512/GemmKernel.h | 1225 ++ .../src/Core/arch/AVX512/MathFunctions.h | 278 + .../Eigen/src/Core/arch/AVX512/PacketMath.h | 2756 +++ .../Eigen/src/Core/arch/AVX512/TrsmKernel.h | 1187 ++ .../src/Core/arch/AVX512/TrsmUnrolls.inc | 1212 ++ .../Eigen/src/Core/arch/AVX512/TypeCasting.h | 139 + .../src/Core/arch/AltiVec/CMakeLists.txt | 6 - .../Eigen/src/Core/arch/AltiVec/Complex.h | 491 +- .../src/Core/arch/AltiVec/MathFunctions.h | 92 + .../src/Core/arch/AltiVec/MatrixProduct.h | 2721 +++ .../Core/arch/AltiVec/MatrixProductCommon.h | 179 + .../src/Core/arch/AltiVec/MatrixProductMMA.h | 717 + .../Core/arch/AltiVec/MatrixVectorProduct.h | 2400 +++ .../Eigen/src/Core/arch/AltiVec/PacketMath.h | 3315 +++- .../Eigen/src/Core/arch/CMakeLists.txt | 4 - .../Eigen/src/Core/arch/Default/BFloat16.h | 862 + .../src/Core/arch/Default/CMakeLists.txt | 6 - .../Eigen/src/Core/arch/Default/ConjHelper.h | 119 + .../arch/Default/GenericPacketMathFunctions.h | 1629 ++ .../Default/GenericPacketMathFunctionsFwd.h | 108 + .../Eigen/src/Core/arch/Default/Half.h | 1009 + .../Eigen/src/Core/arch/Default/Settings.h | 23 +- .../Eigen/src/Core/arch/Default/TypeCasting.h | 116 + .../Eigen/src/Core/arch/GPU/Complex.h | 271 + .../Eigen/src/Core/arch/GPU/MathFunctions.h | 105 + .../Eigen/src/Core/arch/GPU/PacketMath.h | 1648 ++ .../Eigen/src/Core/arch/GPU/Tuple.h | 302 + .../Eigen/src/Core/arch/GPU/TypeCasting.h | 81 + .../src/Core/arch/HIP/hcc/math_constants.h | 23 + .../Eigen/src/Core/arch/MSA/Complex.h | 647 + .../Eigen/src/Core/arch/MSA/MathFunctions.h | 389 + .../Eigen/src/Core/arch/MSA/PacketMath.h | 1235 ++ .../Eigen/src/Core/arch/NEON/CMakeLists.txt | 6 - .../Eigen/src/Core/arch/NEON/Complex.h | 579 +- .../Core/arch/NEON/GeneralBlockPanelKernel.h | 185 + .../Eigen/src/Core/arch/NEON/MathFunctions.h | 96 + .../Eigen/src/Core/arch/NEON/PacketMath.h | 4818 ++++- .../Eigen/src/Core/arch/NEON/TypeCasting.h | 1421 ++ .../Eigen/src/Core/arch/NEON/UnaryFunctors.h | 63 + .../Eigen/src/Core/arch/SSE/CMakeLists.txt | 6 - .../Eigen/src/Core/arch/SSE/Complex.h | 359 +- .../Eigen/src/Core/arch/SSE/MathFunctions.h | 439 +- .../Eigen/src/Core/arch/SSE/PacketMath.h | 1667 +- .../Eigen/src/Core/arch/SSE/TypeCasting.h | 152 + .../Eigen/src/Core/arch/SVE/MathFunctions.h | 46 + .../Eigen/src/Core/arch/SVE/PacketMath.h | 754 + .../Eigen/src/Core/arch/SVE/TypeCasting.h | 51 + .../Eigen/src/Core/arch/SYCL/InteropHeaders.h | 234 + .../Eigen/src/Core/arch/SYCL/MathFunctions.h | 303 + .../Eigen/src/Core/arch/SYCL/PacketMath.h | 672 + .../src/Core/arch/SYCL/SyclMemoryModel.h | 696 + .../Eigen/src/Core/arch/SYCL/TypeCasting.h | 87 + .../Eigen/src/Core/arch/ZVector/Complex.h | 428 + .../src/Core/arch/ZVector/MathFunctions.h | 235 + .../Eigen/src/Core/arch/ZVector/PacketMath.h | 1062 + .../src/Core/functors/AssignmentFunctors.h | 173 + .../Eigen/src/Core/functors/BinaryFunctors.h | 541 + .../Eigen/src/Core/functors/NullaryFunctors.h | 190 + .../Eigen/src/Core/functors/StlFunctors.h | 157 + .../Eigen/src/Core/functors/TernaryFunctors.h | 27 + .../Eigen/src/Core/functors/UnaryFunctors.h | 1102 ++ .../Eigen/src/Core/products/CMakeLists.txt | 6 - .../src/Core/products/CoeffBasedProduct.h | 452 - .../Core/products/GeneralBlockPanelKernel.h | 3012 ++- .../src/Core/products/GeneralMatrixMatrix.h | 469 +- .../products/GeneralMatrixMatrixTriangular.h | 286 +- .../GeneralMatrixMatrixTriangular_BLAS.h | 147 + .../Core/products/GeneralMatrixMatrix_BLAS.h | 126 + .../src/Core/products/GeneralMatrixVector.h | 885 +- .../Core/products/GeneralMatrixVector_BLAS.h | 138 + .../Eigen/src/Core/products/Parallelizer.h | 135 +- .../Core/products/SelfadjointMatrixMatrix.h | 461 +- .../products/SelfadjointMatrixMatrix_BLAS.h | 297 + .../Core/products/SelfadjointMatrixVector.h | 206 +- .../products/SelfadjointMatrixVector_BLAS.h | 120 + .../src/Core/products/SelfadjointProduct.h | 91 +- .../Core/products/SelfadjointRank2Update.h | 69 +- .../Core/products/TriangularMatrixMatrix.h | 309 +- .../products/TriangularMatrixMatrix_BLAS.h | 319 + .../Core/products/TriangularMatrixVector.h | 292 +- .../products/TriangularMatrixVector_BLAS.h | 257 + .../Core/products/TriangularSolverMatrix.h | 400 +- .../products/TriangularSolverMatrix_BLAS.h | 169 + .../Core/products/TriangularSolverVector.h | 87 +- .../Eigen/src/Core/util/BlasUtil.h | 607 +- .../Eigen/src/Core/util/CMakeLists.txt | 6 - .../src/Core/util/ConfigureVectorization.h | 496 + .../Eigen/src/Core/util/Constants.h | 304 +- .../src/Core/util/DisableStupidWarnings.h | 112 +- .../Eigen/src/Core/util/ForwardDeclarations.h | 241 +- .../Eigen/src/Core/util/IndexedViewHelper.h | 195 + .../Eigen/src/Core/util/IntegralConstant.h | 252 + .../Eigen/src/Core/util/MKL_support.h | 139 + .../FreakMatcher/Eigen/src/Core/util/Macros.h | 1292 +- .../FreakMatcher/Eigen/src/Core/util/Memory.h | 904 +- .../FreakMatcher/Eigen/src/Core/util/Meta.h | 527 +- .../Eigen/src/Core/util/NonMPL2.h | 3 + .../src/Core/util/ReenableStupidWarnings.h | 27 +- .../Eigen/src/Core/util/ReshapedHelper.h | 52 + .../Eigen/src/Core/util/Serializer.h | 220 + .../Eigen/src/Core/util/StaticAssert.h | 139 +- .../Eigen/src/Core/util/SymbolicIndex.h | 262 + .../Eigen/src/Core/util/XprHelper.h | 753 +- .../Eigen/src/Eigen2Support/Block.h | 137 - .../Eigen/src/Eigen2Support/CMakeLists.txt | 8 - .../Eigen/src/Eigen2Support/Cwise.h | 203 - .../Eigen/src/Eigen2Support/CwiseOperators.h | 309 - .../src/Eigen2Support/Geometry/AlignedBox.h | 170 - .../Eigen/src/Eigen2Support/Geometry/All.h | 115 - .../src/Eigen2Support/Geometry/AngleAxis.h | 226 - .../src/Eigen2Support/Geometry/CMakeLists.txt | 6 - .../src/Eigen2Support/Geometry/Hyperplane.h | 265 - .../Eigen2Support/Geometry/ParametrizedLine.h | 153 - .../src/Eigen2Support/Geometry/Quaternion.h | 506 - .../src/Eigen2Support/Geometry/Rotation2D.h | 157 - .../src/Eigen2Support/Geometry/RotationBase.h | 134 - .../src/Eigen2Support/Geometry/Scaling.h | 179 - .../src/Eigen2Support/Geometry/Transform.h | 798 - .../src/Eigen2Support/Geometry/Translation.h | 196 - .../FreakMatcher/Eigen/src/Eigen2Support/LU.h | 133 - .../Eigen/src/Eigen2Support/Lazy.h | 82 - .../Eigen/src/Eigen2Support/LeastSquares.h | 182 - .../Eigen/src/Eigen2Support/Macros.h | 35 - .../Eigen/src/Eigen2Support/MathFunctions.h | 68 - .../Eigen/src/Eigen2Support/Memory.h | 58 - .../Eigen/src/Eigen2Support/Meta.h | 86 - .../Eigen/src/Eigen2Support/Minor.h | 128 - .../FreakMatcher/Eigen/src/Eigen2Support/QR.h | 79 - .../Eigen/src/Eigen2Support/SVD.h | 649 - .../src/Eigen2Support/TriangularSolver.h | 53 - .../Eigen/src/Eigen2Support/VectorBlock.h | 105 - .../Eigen/src/Eigenvalues/CMakeLists.txt | 6 - .../src/Eigenvalues/ComplexEigenSolver.h | 81 +- .../Eigen/src/Eigenvalues/ComplexSchur.h | 214 +- .../src/Eigenvalues/ComplexSchur_LAPACKE.h | 93 + .../Eigen/src/Eigenvalues/EigenSolver.h | 217 +- .../Eigen/src/Eigenvalues/EigenvaluesCommon.h | 31 - .../src/Eigenvalues/GeneralizedEigenSolver.h | 415 + .../GeneralizedSelfAdjointEigenSolver.h | 45 +- .../src/Eigenvalues/HessenbergDecomposition.h | 60 +- .../src/Eigenvalues/InternalHeaderCheck.h | 3 + .../src/Eigenvalues/MatrixBaseEigenvalues.h | 36 +- .../Eigen/src/Eigenvalues/RealQZ.h | 659 + .../Eigen/src/Eigenvalues/RealSchur.h | 233 +- .../Eigen/src/Eigenvalues/RealSchur_LAPACKE.h | 79 + .../src/Eigenvalues/SelfAdjointEigenSolver.h | 614 +- .../SelfAdjointEigenSolver_LAPACKE.h | 89 + .../src/Eigenvalues/Tridiagonalization.h | 136 +- .../Eigen/src/Geometry/AlignedBox.h | 332 +- .../Eigen/src/Geometry/AngleAxis.h | 136 +- .../Eigen/src/Geometry/CMakeLists.txt | 8 - .../Eigen/src/Geometry/EulerAngles.h | 98 +- .../Eigen/src/Geometry/Homogeneous.h | 349 +- .../Eigen/src/Geometry/Hyperplane.h | 116 +- .../Eigen/src/Geometry/InternalHeaderCheck.h | 3 + .../Eigen/src/Geometry/OrthoMethods.h | 128 +- .../Eigen/src/Geometry/ParametrizedLine.h | 168 +- .../Eigen/src/Geometry/Quaternion.h | 500 +- .../Eigen/src/Geometry/Rotation2D.h | 128 +- .../Eigen/src/Geometry/RotationBase.h | 85 +- .../FreakMatcher/Eigen/src/Geometry/Scaling.h | 107 +- .../Eigen/src/Geometry/Transform.h | 589 +- .../Eigen/src/Geometry/Translation.h | 117 +- .../FreakMatcher/Eigen/src/Geometry/Umeyama.h | 85 +- .../Eigen/src/Geometry/arch/CMakeLists.txt | 6 - .../Eigen/src/Geometry/arch/Geometry_SIMD.h | 170 + .../Eigen/src/Geometry/arch/Geometry_SSE.h | 126 - .../Eigen/src/Householder/BlockHouseholder.h | 113 +- .../Eigen/src/Householder/CMakeLists.txt | 6 - .../Eigen/src/Householder/Householder.h | 101 +- .../src/Householder/HouseholderSequence.h | 295 +- .../src/Householder/InternalHeaderCheck.h | 3 + .../BasicPreconditioners.h | 228 + .../src/IterativeLinearSolvers/BiCGSTAB.h | 214 + .../ConjugateGradient.h | 231 + .../IncompleteCholesky.h | 396 + .../IterativeLinearSolvers/IncompleteLUT.h | 455 + .../InternalHeaderCheck.h | 3 + .../IterativeSolverBase.h | 449 + .../LeastSquareConjugateGradient.h | 200 + .../IterativeLinearSolvers/SolveWithGuess.h | 119 + .../Eigen/src/Jacobi/CMakeLists.txt | 6 - .../Eigen/src/Jacobi/InternalHeaderCheck.h | 3 + .../FreakMatcher/Eigen/src/Jacobi/Jacobi.h | 395 +- .../src/KLUSupport/InternalHeaderCheck.h | 3 + .../Eigen/src/KLUSupport/KLUSupport.h | 360 + .../FreakMatcher/Eigen/src/LU/CMakeLists.txt | 8 - .../FreakMatcher/Eigen/src/LU/Determinant.h | 87 +- .../KPM/FreakMatcher/Eigen/src/LU/FullPivLU.h | 400 +- .../Eigen/src/LU/InternalHeaderCheck.h | 3 + .../Eigen/src/LU/{Inverse.h => InverseImpl.h} | 147 +- .../FreakMatcher/Eigen/src/LU/PartialPivLU.h | 360 +- .../Eigen/src/LU/PartialPivLU_LAPACKE.h | 96 + .../Eigen/src/LU/arch/CMakeLists.txt | 6 - .../Eigen/src/LU/arch/InverseSize4.h | 353 + .../Eigen/src/LU/arch/Inverse_SSE.h | 340 - .../src/MetisSupport/InternalHeaderCheck.h | 3 + .../Eigen/src/MetisSupport/MetisSupport.h | 139 + .../src/OrderingMethods}/Amd.h | 177 +- .../Eigen/src/OrderingMethods/Eigen_Colamd.h | 1863 ++ .../src/OrderingMethods/InternalHeaderCheck.h | 3 + .../Eigen/src/OrderingMethods/Ordering.h | 155 + .../src/PaStiXSupport/InternalHeaderCheck.h | 3 + .../Eigen/src/PaStiXSupport/PaStiXSupport.h | 680 + .../src/PardisoSupport/InternalHeaderCheck.h | 3 + .../Eigen/src/PardisoSupport/PardisoSupport.h | 547 + .../FreakMatcher/Eigen/src/QR/CMakeLists.txt | 6 - .../Eigen/src/QR/ColPivHouseholderQR.h | 413 +- .../src/QR/ColPivHouseholderQR_LAPACKE.h | 99 + .../src/QR/CompleteOrthogonalDecomposition.h | 633 + .../Eigen/src/QR/FullPivHouseholderQR.h | 450 +- .../FreakMatcher/Eigen/src/QR/HouseholderQR.h | 343 +- .../Eigen/src/QR/HouseholderQR_LAPACKE.h | 77 + .../Eigen/src/QR/InternalHeaderCheck.h | 3 + .../src/SPQRSupport/InternalHeaderCheck.h | 3 + .../src/SPQRSupport/SuiteSparseQRSupport.h | 337 + .../KPM/FreakMatcher/Eigen/src/SVD/BDCSVD.h | 1489 ++ .../FreakMatcher/Eigen/src/SVD/CMakeLists.txt | 6 - .../Eigen/src/SVD/InternalHeaderCheck.h | 3 + .../FreakMatcher/Eigen/src/SVD/JacobiSVD.h | 1099 +- .../Eigen/src/SVD/JacobiSVD_LAPACKE.h | 105 + .../KPM/FreakMatcher/Eigen/src/SVD/SVDBase.h | 442 + .../Eigen/src/SVD/UpperBidiagonalization.h | 373 +- .../Eigen/src/Sparse/CMakeLists.txt | 6 - .../Eigen/src/Sparse/CompressedStorage.h | 239 - .../Eigen/src/Sparse/CoreIterators.h | 71 - .../Eigen/src/Sparse/DynamicSparseMatrix.h | 346 - .../Eigen/src/Sparse/MappedSparseMatrix.h | 165 - .../Eigen/src/Sparse/SparseAssign.h | 0 .../Eigen/src/Sparse/SparseBlock.h | 465 - .../Eigen/src/Sparse/SparseCwiseBinaryOp.h | 375 - .../Eigen/src/Sparse/SparseCwiseUnaryOp.h | 146 - .../Eigen/src/Sparse/SparseDenseProduct.h | 231 - .../Eigen/src/Sparse/SparseDiagonalProduct.h | 195 - .../Eigen/src/Sparse/SparseFuzzy.h | 41 - .../Eigen/src/Sparse/SparseMatrix.h | 651 - .../Eigen/src/Sparse/SparseMatrixBase.h | 706 - .../Eigen/src/Sparse/SparseProduct.h | 141 - .../Eigen/src/Sparse/SparseRedux.h | 56 - .../Eigen/src/Sparse/SparseSelfAdjointView.h | 454 - .../Eigen/src/Sparse/SparseSparseProduct.h | 401 - .../Eigen/src/Sparse/SparseTranspose.h | 68 - .../Eigen/src/Sparse/SparseTriangularView.h | 100 - .../Eigen/src/Sparse/SparseUtil.h | 130 - .../Eigen/src/Sparse/SparseVector.h | 431 - .../Eigen/src/Sparse/SparseView.h | 109 - .../src/SparseCholesky/InternalHeaderCheck.h | 3 + .../src/SparseCholesky/SimplicialCholesky.h | 699 + .../SparseCholesky/SimplicialCholesky_impl.h | 176 + .../src/{Sparse => SparseCore}/AmbiVector.h | 147 +- .../Eigen/src/SparseCore/CompressedStorage.h | 260 + .../ConservativeSparseSparseProduct.h | 359 + .../src/SparseCore/InternalHeaderCheck.h | 3 + .../Eigen/src/SparseCore/SparseAssign.h | 272 + .../Eigen/src/SparseCore/SparseBlock.h | 568 + .../Eigen/src/SparseCore/SparseColEtree.h | 208 + .../src/SparseCore/SparseCompressedBase.h | 372 + .../src/SparseCore/SparseCwiseBinaryOp.h | 721 + .../Eigen/src/SparseCore/SparseCwiseUnaryOp.h | 152 + .../Eigen/src/SparseCore/SparseDenseProduct.h | 352 + .../src/SparseCore/SparseDiagonalProduct.h | 140 + .../src/{Sparse => SparseCore}/SparseDot.h | 57 +- .../Eigen/src/SparseCore/SparseFuzzy.h | 31 + .../Eigen/src/SparseCore/SparseMap.h | 307 + .../Eigen/src/SparseCore/SparseMatrix.h | 1508 ++ .../Eigen/src/SparseCore/SparseMatrixBase.h | 398 + .../Eigen/src/SparseCore/SparsePermutation.h | 180 + .../Eigen/src/SparseCore/SparseProduct.h | 183 + .../Eigen/src/SparseCore/SparseRedux.h | 51 + .../Eigen/src/SparseCore/SparseRef.h | 394 + .../src/SparseCore/SparseSelfAdjointView.h | 652 + .../Eigen/src/SparseCore/SparseSolverBase.h | 128 + .../SparseSparseProductWithPruning.h | 200 + .../Eigen/src/SparseCore/SparseTranspose.h | 94 + .../src/SparseCore/SparseTriangularView.h | 191 + .../Eigen/src/SparseCore/SparseUtil.h | 186 + .../Eigen/src/SparseCore/SparseVector.h | 498 + .../Eigen/src/SparseCore/SparseView.h | 256 + .../{Sparse => SparseCore}/TriangularSolver.h | 190 +- .../Eigen/src/SparseLU/InternalHeaderCheck.h | 3 + .../Eigen/src/SparseLU/SparseLU.h | 925 + .../Eigen/src/SparseLU/SparseLUImpl.h | 68 + .../Eigen/src/SparseLU/SparseLU_Memory.h | 228 + .../Eigen/src/SparseLU/SparseLU_Structs.h | 112 + .../src/SparseLU/SparseLU_SupernodalMatrix.h | 377 + .../Eigen/src/SparseLU/SparseLU_Utils.h | 82 + .../Eigen/src/SparseLU/SparseLU_column_bmod.h | 183 + .../Eigen/src/SparseLU/SparseLU_column_dfs.h | 181 + .../src/SparseLU/SparseLU_copy_to_ucol.h | 109 + .../Eigen/src/SparseLU/SparseLU_gemm_kernel.h | 282 + .../src/SparseLU/SparseLU_heap_relax_snode.h | 128 + .../Eigen/src/SparseLU/SparseLU_kernel_bmod.h | 132 + .../Eigen/src/SparseLU/SparseLU_panel_bmod.h | 225 + .../Eigen/src/SparseLU/SparseLU_panel_dfs.h | 260 + .../Eigen/src/SparseLU/SparseLU_pivotL.h | 139 + .../Eigen/src/SparseLU/SparseLU_pruneL.h | 138 + .../Eigen/src/SparseLU/SparseLU_relax_snode.h | 85 + .../Eigen/src/SparseQR/InternalHeaderCheck.h | 3 + .../Eigen/src/SparseQR/SparseQR.h | 760 + .../Eigen/src/StlSupport/CMakeLists.txt | 6 - .../Eigen/src/StlSupport/StdDeque.h | 124 +- .../Eigen/src/StlSupport/StdList.h | 105 +- .../Eigen/src/StlSupport/StdVector.h | 108 +- .../Eigen/src/StlSupport/details.h | 43 +- .../src/SuperLUSupport/InternalHeaderCheck.h | 3 + .../Eigen/src/SuperLUSupport/SuperLUSupport.h | 1027 + .../src/UmfPackSupport/InternalHeaderCheck.h | 3 + .../Eigen/src/UmfPackSupport/UmfPackSupport.h | 644 + .../Eigen/src/misc/CMakeLists.txt | 6 - .../KPM/FreakMatcher/Eigen/src/misc/Image.h | 35 +- .../Eigen/src/misc/InternalHeaderCheck.h | 3 + .../KPM/FreakMatcher/Eigen/src/misc/Kernel.h | 37 +- .../FreakMatcher/Eigen/src/misc/RealSvd2x2.h | 57 + .../KPM/FreakMatcher/Eigen/src/misc/Solve.h | 87 - .../KPM/FreakMatcher/Eigen/src/misc/blas.h | 440 + .../KPM/FreakMatcher/Eigen/src/misc/lapack.h | 152 + .../KPM/FreakMatcher/Eigen/src/misc/lapacke.h | 16292 ++++++++++++++++ .../Eigen/src/misc/lapacke_helpers.h | 159 + .../Eigen/src/misc/lapacke_mangling.h | 17 + .../Eigen/src/plugins/ArrayCwiseBinaryOps.h | 301 +- .../Eigen/src/plugins/ArrayCwiseUnaryOps.h | 618 +- .../Eigen/src/plugins/BlockMethods.h | 1601 +- .../Eigen/src/plugins/CMakeLists.txt | 6 - .../Eigen/src/plugins/CommonCwiseBinaryOps.h | 98 +- .../Eigen/src/plugins/CommonCwiseUnaryOps.h | 264 +- .../Eigen/src/plugins/IndexedViewMethods.h | 255 + .../Eigen/src/plugins/InternalHeaderCheck.h | 3 + .../Eigen/src/plugins/MatrixCwiseBinaryOps.h | 94 +- .../Eigen/src/plugins/MatrixCwiseUnaryOps.h | 153 +- .../Eigen/src/plugins/ReshapedMethods.h | 149 + .../FreakMatcher/unsupported/CMakeLists.txt | 14 +- .../unsupported/Eigen/AdolcForward | 63 +- .../unsupported/Eigen/AlignedVector3 | 98 +- .../unsupported/Eigen/ArpackSupport | 30 + .../FreakMatcher/unsupported/Eigen/AutoDiff | 35 +- .../KPM/FreakMatcher/unsupported/Eigen/BVH | 34 +- .../unsupported/Eigen/CMakeLists.txt | 32 +- .../unsupported/Eigen/CXX11/CMakeLists.txt | 8 + .../unsupported/Eigen/CXX11/Tensor | 138 + .../unsupported/Eigen/CXX11/TensorSymmetry | 38 + .../unsupported/Eigen/CXX11/ThreadPool | 71 + .../CXX11/src/Tensor/InternalHeaderCheck.h | 3 + .../Eigen/CXX11/src/Tensor/README.md | 1864 ++ .../Eigen/CXX11/src/Tensor/Tensor.h | 465 + .../Eigen/CXX11/src/Tensor/TensorArgMax.h | 330 + .../Eigen/CXX11/src/Tensor/TensorAssign.h | 249 + .../Eigen/CXX11/src/Tensor/TensorBase.h | 1195 ++ .../Eigen/CXX11/src/Tensor/TensorBlock.h | 1561 ++ .../CXX11/src/Tensor/TensorBroadcasting.h | 1087 ++ .../Eigen/CXX11/src/Tensor/TensorChipping.h | 517 + .../CXX11/src/Tensor/TensorConcatenation.h | 379 + .../CXX11/src/Tensor/TensorContraction.h | 1021 + .../src/Tensor/TensorContractionBlocking.h | 75 + .../CXX11/src/Tensor/TensorContractionCuda.h | 6 + .../CXX11/src/Tensor/TensorContractionGpu.h | 1411 ++ .../src/Tensor/TensorContractionMapper.h | 590 + .../CXX11/src/Tensor/TensorContractionSycl.h | 1651 ++ .../src/Tensor/TensorContractionThreadPool.h | 1679 ++ .../Eigen/CXX11/src/Tensor/TensorConversion.h | 458 + .../CXX11/src/Tensor/TensorConvolution.h | 1134 ++ .../CXX11/src/Tensor/TensorConvolutionSycl.h | 546 + .../Eigen/CXX11/src/Tensor/TensorCostModel.h | 216 + .../Eigen/CXX11/src/Tensor/TensorCustomOp.h | 349 + .../Eigen/CXX11/src/Tensor/TensorDevice.h | 139 + .../Eigen/CXX11/src/Tensor/TensorDeviceCuda.h | 6 + .../CXX11/src/Tensor/TensorDeviceDefault.h | 117 + .../Eigen/CXX11/src/Tensor/TensorDeviceGpu.h | 430 + .../Eigen/CXX11/src/Tensor/TensorDeviceSycl.h | 1114 ++ .../CXX11/src/Tensor/TensorDeviceThreadPool.h | 416 + .../CXX11/src/Tensor/TensorDimensionList.h | 143 + .../Eigen/CXX11/src/Tensor/TensorDimensions.h | 447 + .../Eigen/CXX11/src/Tensor/TensorEvalTo.h | 238 + .../Eigen/CXX11/src/Tensor/TensorEvaluator.h | 984 + .../Eigen/CXX11/src/Tensor/TensorExecutor.h | 760 + .../Eigen/CXX11/src/Tensor/TensorExpr.h | 390 + .../Eigen/CXX11/src/Tensor/TensorFFT.h | 671 + .../Eigen/CXX11/src/Tensor/TensorFixedSize.h | 280 + .../Eigen/CXX11/src/Tensor/TensorForcedEval.h | 239 + .../src/Tensor/TensorForwardDeclarations.h | 193 + .../Eigen/CXX11/src/Tensor/TensorFunctors.h | 488 + .../Eigen/CXX11/src/Tensor/TensorGenerator.h | 303 + .../CXX11/src/Tensor/TensorGlobalFunctions.h | 35 + .../src/Tensor/TensorGpuHipCudaDefines.h | 101 + .../src/Tensor/TensorGpuHipCudaUndefines.h | 45 + .../Eigen/CXX11/src/Tensor/TensorIO.h | 374 + .../Eigen/CXX11/src/Tensor/TensorImagePatch.h | 604 + .../Eigen/CXX11/src/Tensor/TensorIndexList.h | 665 + .../Eigen/CXX11/src/Tensor/TensorInflation.h | 249 + .../CXX11/src/Tensor/TensorInitializer.h | 80 + .../Eigen/CXX11/src/Tensor/TensorIntDiv.h | 261 + .../Eigen/CXX11/src/Tensor/TensorLayoutSwap.h | 218 + .../Eigen/CXX11/src/Tensor/TensorMacros.h | 84 + .../Eigen/CXX11/src/Tensor/TensorMap.h | 211 + .../Eigen/CXX11/src/Tensor/TensorMeta.h | 313 + .../Eigen/CXX11/src/Tensor/TensorMorphing.h | 1101 ++ .../Eigen/CXX11/src/Tensor/TensorPadding.h | 693 + .../Eigen/CXX11/src/Tensor/TensorPatch.h | 291 + .../Eigen/CXX11/src/Tensor/TensorRandom.h | 319 + .../Eigen/CXX11/src/Tensor/TensorReduction.h | 1039 + .../CXX11/src/Tensor/TensorReductionGpu.h | 975 + .../CXX11/src/Tensor/TensorReductionSycl.h | 583 + .../Eigen/CXX11/src/Tensor/TensorRef.h | 376 + .../Eigen/CXX11/src/Tensor/TensorReverse.h | 465 + .../Eigen/CXX11/src/Tensor/TensorScan.h | 530 + .../Eigen/CXX11/src/Tensor/TensorScanSycl.h | 515 + .../Eigen/CXX11/src/Tensor/TensorShuffling.h | 470 + .../Eigen/CXX11/src/Tensor/TensorStorage.h | 156 + .../Eigen/CXX11/src/Tensor/TensorStriding.h | 348 + .../Eigen/CXX11/src/Tensor/TensorTrace.h | 304 + .../Eigen/CXX11/src/Tensor/TensorTraits.h | 266 + .../Eigen/CXX11/src/Tensor/TensorUInt128.h | 251 + .../CXX11/src/Tensor/TensorVolumePatch.h | 630 + .../src/TensorSymmetry/DynamicSymmetry.h | 295 + .../src/TensorSymmetry/InternalHeaderCheck.h | 3 + .../CXX11/src/TensorSymmetry/StaticSymmetry.h | 238 + .../Eigen/CXX11/src/TensorSymmetry/Symmetry.h | 340 + .../TensorSymmetry/util/TemplateGroupTheory.h | 671 + .../Eigen/CXX11/src/ThreadPool/Barrier.h | 69 + .../Eigen/CXX11/src/ThreadPool/EventCount.h | 251 + .../src/ThreadPool/InternalHeaderCheck.h | 3 + .../src/ThreadPool/NonBlockingThreadPool.h | 488 + .../Eigen/CXX11/src/ThreadPool/RunQueue.h | 238 + .../Eigen/CXX11/src/ThreadPool/ThreadCancel.h | 23 + .../CXX11/src/ThreadPool/ThreadEnvironment.h | 42 + .../Eigen/CXX11/src/ThreadPool/ThreadLocal.h | 300 + .../src/ThreadPool/ThreadPoolInterface.h | 50 + .../Eigen/CXX11/src/ThreadPool/ThreadYield.h | 16 + .../Eigen/CXX11/src/util/CXX11Meta.h | 539 + .../Eigen/CXX11/src/util/CXX11Workarounds.h | 76 + .../Eigen/CXX11/src/util/EmulateArray.h | 286 + .../Eigen/CXX11/src/util/MaxSizeVector.h | 158 + .../unsupported/Eigen/CholmodSupport | 33 - .../unsupported/Eigen/EulerAngles | 43 + .../KPM/FreakMatcher/unsupported/Eigen/FFT | 101 +- .../unsupported/Eigen/IterativeSolvers | 97 +- .../unsupported/Eigen/KroneckerProduct | 33 + .../unsupported/Eigen/LevenbergMarquardt | 49 + .../unsupported/Eigen/MPRealSupport | 216 +- .../unsupported/Eigen/MatrixFunctions | 318 +- .../unsupported/Eigen/MoreVectorization | 16 +- .../KPM/FreakMatcher/unsupported/Eigen/NNLS | 388 + .../unsupported/Eigen/NonLinearOptimization | 80 +- .../unsupported/Eigen/NumericalDiff | 34 +- .../unsupported/Eigen/OpenGLSupport | 94 +- .../unsupported/Eigen/Polynomials | 26 +- .../FreakMatcher/unsupported/Eigen/Skyline | 32 +- .../unsupported/Eigen/SparseExtra | 60 +- .../unsupported/Eigen/SpecialFunctions | 103 + .../FreakMatcher/unsupported/Eigen/Splines | 35 + .../unsupported/Eigen/SuperLUSupport | 35 - .../unsupported/Eigen/UmfPackSupport | 33 - .../Eigen/src/AutoDiff/AutoDiffJacobian.h | 69 +- .../Eigen/src/AutoDiff/AutoDiffScalar.h | 487 +- .../Eigen/src/AutoDiff/AutoDiffVector.h | 27 +- .../Eigen/src/AutoDiff/CMakeLists.txt | 6 - .../Eigen/src/AutoDiff/InternalHeaderCheck.h | 3 + .../unsupported/Eigen/src/BVH/BVAlgorithms.h | 29 +- .../unsupported/Eigen/src/BVH/CMakeLists.txt | 6 - .../Eigen/src/BVH/InternalHeaderCheck.h | 3 + .../unsupported/Eigen/src/BVH/KdBVH.h | 42 +- .../unsupported/Eigen/src/CMakeLists.txt | 11 - .../ArpackSelfAdjointEigenSolver.h | 792 + .../src/Eigenvalues/InternalHeaderCheck.h | 3 + .../Eigen/src/EulerAngles/CMakeLists.txt | 6 + .../Eigen/src/EulerAngles/EulerAngles.h | 357 + .../Eigen/src/EulerAngles/EulerSystem.h | 307 + .../src/EulerAngles/InternalHeaderCheck.h | 3 + .../unsupported/Eigen/src/FFT/CMakeLists.txt | 6 - .../Eigen/src/FFT/InternalHeaderCheck.h | 3 + .../unsupported/Eigen/src/FFT/ei_fftw_impl.h | 33 +- .../Eigen/src/FFT/ei_imklfft_impl.h | 288 + .../Eigen/src/FFT/ei_kissfft_impl.h | 91 +- .../Eigen/src/FFT/ei_pocketfft_impl.h | 69 + .../Eigen/src/IterativeSolvers/BiCGSTABL.h | 339 + .../Eigen/src/IterativeSolvers/CMakeLists.txt | 6 - .../IterativeSolvers/ConstrainedConjGrad.h | 49 +- .../Eigen/src/IterativeSolvers/DGMRES.h | 513 + .../Eigen/src/IterativeSolvers/GMRES.h | 337 + .../Eigen/src/IterativeSolvers/IDRS.h | 397 + .../Eigen/src/IterativeSolvers/IDRSTABL.h | 476 + .../Eigen/src/IterativeSolvers/IncompleteLU.h | 92 + .../IterativeSolvers/InternalHeaderCheck.h | 3 + .../IterativeSolvers/IterationController.h | 32 +- .../Eigen/src/IterativeSolvers/MINRES.h | 269 + .../Eigen/src/IterativeSolvers/Scaling.h | 195 + .../KroneckerProduct/InternalHeaderCheck.h | 3 + .../KroneckerProduct/KroneckerTensorProduct.h | 307 + .../LevenbergMarquardt/CopyrightMINPACK.txt | 52 + .../LevenbergMarquardt/InternalHeaderCheck.h | 3 + .../Eigen/src/LevenbergMarquardt/LMcovar.h | 86 + .../Eigen/src/LevenbergMarquardt/LMonestep.h | 204 + .../Eigen/src/LevenbergMarquardt/LMpar.h | 162 + .../Eigen/src/LevenbergMarquardt/LMqrsolv.h | 190 + .../LevenbergMarquardt/LevenbergMarquardt.h | 398 + .../Eigen/src/MatrixFunctions/CMakeLists.txt | 6 - .../src/MatrixFunctions/InternalHeaderCheck.h | 3 + .../src/MatrixFunctions/MatrixExponential.h | 609 +- .../src/MatrixFunctions/MatrixFunction.h | 724 +- .../MatrixFunctions/MatrixFunctionAtomic.h | 142 - .../src/MatrixFunctions/MatrixLogarithm.h | 375 + .../Eigen/src/MatrixFunctions/MatrixPower.h | 707 + .../src/MatrixFunctions/MatrixSquareRoot.h | 370 + .../Eigen/src/MatrixFunctions/StemFunction.h | 199 +- .../src/MoreVectorization/CMakeLists.txt | 6 - .../MoreVectorization/InternalHeaderCheck.h | 3 + .../src/MoreVectorization/MathFunctions.h | 51 +- .../src/NonLinearOptimization/CMakeLists.txt | 6 - .../HybridNonLinearSolver.h | 58 +- .../InternalHeaderCheck.h | 3 + .../LevenbergMarquardt.h | 89 +- .../Eigen/src/NonLinearOptimization/chkder.h | 10 +- .../Eigen/src/NonLinearOptimization/covar.h | 11 +- .../Eigen/src/NonLinearOptimization/dogleg.h | 19 +- .../Eigen/src/NonLinearOptimization/fdjac1.h | 11 +- .../Eigen/src/NonLinearOptimization/lmpar.h | 24 +- .../Eigen/src/NonLinearOptimization/qrsolv.h | 8 +- .../Eigen/src/NonLinearOptimization/r1mpyq.h | 6 + .../Eigen/src/NonLinearOptimization/r1updt.h | 16 +- .../Eigen/src/NonLinearOptimization/rwupdt.h | 7 +- .../Eigen/src/NumericalDiff/CMakeLists.txt | 6 - .../src/NumericalDiff/InternalHeaderCheck.h | 3 + .../Eigen/src/NumericalDiff/NumericalDiff.h | 43 +- .../Eigen/src/Polynomials/CMakeLists.txt | 6 - .../Eigen/src/Polynomials/Companion.h | 144 +- .../src/Polynomials/InternalHeaderCheck.h | 3 + .../Eigen/src/Polynomials/PolynomialSolver.h | 163 +- .../Eigen/src/Polynomials/PolynomialUtils.h | 46 +- .../Eigen/src/Skyline/CMakeLists.txt | 6 - .../Eigen/src/Skyline/InternalHeaderCheck.h | 3 + .../Eigen/src/Skyline/SkylineInplaceLU.h | 33 +- .../Eigen/src/Skyline/SkylineMatrix.h | 93 +- .../Eigen/src/Skyline/SkylineMatrixBase.h | 46 +- .../Eigen/src/Skyline/SkylineProduct.h | 125 +- .../Eigen/src/Skyline/SkylineStorage.h | 39 +- .../Eigen/src/Skyline/SkylineUtil.h | 44 +- .../Eigen/src/SparseExtra/BlockSparseMatrix.h | 1081 + .../Eigen/src/SparseExtra/CMakeLists.txt | 6 - .../Eigen/src/SparseExtra/CholmodSupport.h | 399 - .../src/SparseExtra/CholmodSupportLegacy.h | 517 - .../src/SparseExtra/InternalHeaderCheck.h | 3 + .../Eigen/src/SparseExtra/MarketIO.h | 384 + .../src/SparseExtra/MatrixMarketIterator.h | 249 + .../Eigen/src/SparseExtra/RandomSetter.h | 137 +- .../src/SparseExtra/SimplicialCholesky.h | 477 - .../unsupported/Eigen/src/SparseExtra/Solve.h | 82 - .../Eigen/src/SparseExtra/SparseLDLTLegacy.h | 414 - .../Eigen/src/SparseExtra/SparseLLT.h | 245 - .../Eigen/src/SparseExtra/SparseLU.h | 163 - .../Eigen/src/SparseExtra/SuperLUSupport.h | 667 - .../Eigen/src/SparseExtra/UmfPackSupport.h | 350 - .../BesselFunctionsArrayAPI.h | 288 + .../BesselFunctionsBFloat16.h | 70 + .../BesselFunctionsFunctors.h | 347 + .../SpecialFunctions/BesselFunctionsHalf.h | 68 + .../SpecialFunctions/BesselFunctionsImpl.h | 1961 ++ .../BesselFunctionsPacketMath.h | 120 + .../SpecialFunctions/HipVectorCompatibility.h | 69 + .../SpecialFunctions/InternalHeaderCheck.h | 3 + .../SpecialFunctionsArrayAPI.h | 169 + .../SpecialFunctionsBFloat16.h | 60 + .../SpecialFunctionsFunctors.h | 320 + .../SpecialFunctions/SpecialFunctionsHalf.h | 60 + .../SpecialFunctions/SpecialFunctionsImpl.h | 2053 ++ .../SpecialFunctionsPacketMath.h | 81 + .../arch/AVX/BesselFunctions.h | 46 + .../arch/AVX/SpecialFunctions.h | 16 + .../arch/AVX512/BesselFunctions.h | 51 + .../arch/AVX512/SpecialFunctions.h | 16 + .../arch/GPU/SpecialFunctions.h | 369 + .../arch/NEON/BesselFunctions.h | 54 + .../arch/NEON/SpecialFunctions.h | 34 + .../Eigen/src/Splines/InternalHeaderCheck.h | 3 + .../unsupported/Eigen/src/Splines/Spline.h | 509 + .../Eigen/src/Splines/SplineFitting.h | 434 + .../unsupported/Eigen/src/Splines/SplineFwd.h | 94 + .../KPM/FreakMatcher/unsupported/README.txt | 2 +- .../unsupported/bench/bench_svd.cpp | 123 + .../FreakMatcher/unsupported/doc/Doxyfile.in | 1459 -- .../FreakMatcher/unsupported/doc/Overview.dox | 17 +- .../KPM/FreakMatcher/unsupported/doc/SYCL.dox | 9 + .../unsupported/doc/eigendoxy_layout.xml.in | 177 + .../unsupported/doc/examples/BVH_Example.cpp | 4 +- .../unsupported/doc/examples/CMakeLists.txt | 26 +- .../unsupported/doc/examples/EulerAngles.cpp | 46 + .../unsupported/doc/examples/FFT.cpp | 6 +- .../doc/examples/MatrixLogarithm.cpp | 15 + .../unsupported/doc/examples/MatrixPower.cpp | 16 + .../doc/examples/MatrixPower_optimal.cpp | 17 + .../doc/examples/MatrixSquareRoot.cpp | 16 + .../doc/examples/PolynomialSolver1.cpp | 2 +- .../doc/examples/SYCL/CMakeLists.txt | 32 + .../doc/examples/SYCL/CwiseMul.cpp | 63 + .../unsupported/doc/snippets/CMakeLists.txt | 28 +- .../KPM/FreakMatcher/unsupported/test/BVH.cpp | 23 +- .../unsupported/test/CMakeLists.txt | 428 +- .../unsupported/test/EulerAngles.cpp | 296 + .../KPM/FreakMatcher/unsupported/test/FFT.cpp | 4 +- .../FreakMatcher/unsupported/test/FFTW.cpp | 282 +- .../FreakMatcher/unsupported/test/NNLS.cpp | 472 + .../test/NonLinearOptimization.cpp | 286 +- .../unsupported/test/NumericalDiff.cpp | 8 +- .../unsupported/test/alignedvector3.cpp | 57 +- .../unsupported/test/autodiff.cpp | 293 +- .../unsupported/test/autodiff_scalar.cpp | 99 + .../unsupported/test/bessel_functions.cpp | 370 + .../unsupported/test/bicgstabl.cpp | 31 + .../unsupported/test/cxx11_eventcount.cpp | 142 + .../unsupported/test/cxx11_maxsizevector.cpp | 77 + .../unsupported/test/cxx11_meta.cpp | 357 + .../test/cxx11_non_blocking_thread_pool.cpp | 180 + .../unsupported/test/cxx11_runqueue.cpp | 235 + .../unsupported/test/cxx11_tensor_argmax.cpp | 294 + .../test/cxx11_tensor_argmax_gpu.cu | 253 + .../test/cxx11_tensor_argmax_sycl.cpp | 257 + .../unsupported/test/cxx11_tensor_assign.cpp | 362 + .../test/cxx11_tensor_block_access.cpp | 576 + .../test/cxx11_tensor_block_eval.cpp | 858 + .../test/cxx11_tensor_block_io.cpp | 445 + .../test/cxx11_tensor_broadcast_sycl.cpp | 144 + .../test/cxx11_tensor_broadcasting.cpp | 325 + .../test/cxx11_tensor_builtins_sycl.cpp | 354 + .../test/cxx11_tensor_cast_float16_gpu.cu | 79 + .../unsupported/test/cxx11_tensor_casts.cpp | 186 + .../test/cxx11_tensor_chipping.cpp | 425 + .../test/cxx11_tensor_chipping_sycl.cpp | 623 + .../test/cxx11_tensor_comparisons.cpp | 84 + .../cxx11_tensor_complex_cwise_ops_gpu.cu | 102 + .../test/cxx11_tensor_complex_gpu.cu | 186 + .../test/cxx11_tensor_concatenation.cpp | 143 + .../test/cxx11_tensor_concatenation_sycl.cpp | 180 + .../unsupported/test/cxx11_tensor_const.cpp | 62 + .../test/cxx11_tensor_contract_gpu.cu | 234 + .../test/cxx11_tensor_contract_sycl.cpp | 1026 + .../test/cxx11_tensor_contraction.cpp | 601 + .../test/cxx11_tensor_convolution.cpp | 150 + .../test/cxx11_tensor_convolution_sycl.cpp | 469 + .../test/cxx11_tensor_custom_index.cpp | 92 + .../test/cxx11_tensor_custom_op.cpp | 111 + .../test/cxx11_tensor_custom_op_sycl.cpp | 170 + .../unsupported/test/cxx11_tensor_device.cu | 440 + .../test/cxx11_tensor_device_sycl.cpp | 114 + .../test/cxx11_tensor_dimension.cpp | 88 + .../unsupported/test/cxx11_tensor_empty.cpp | 40 + .../test/cxx11_tensor_executor.cpp | 730 + .../unsupported/test/cxx11_tensor_expr.cpp | 464 + .../unsupported/test/cxx11_tensor_fft.cpp | 304 + .../test/cxx11_tensor_fixed_size.cpp | 261 + .../test/cxx11_tensor_forced_eval.cpp | 79 + .../test/cxx11_tensor_forced_eval_sycl.cpp | 77 + .../test/cxx11_tensor_generator.cpp | 91 + .../test/cxx11_tensor_generator_sycl.cpp | 147 + .../unsupported/test/cxx11_tensor_gpu.cu | 1663 ++ .../unsupported/test/cxx11_tensor_ifft.cpp | 154 + .../test/cxx11_tensor_image_op_sycl.cpp | 103 + .../test/cxx11_tensor_image_patch.cpp | 809 + .../test/cxx11_tensor_image_patch_sycl.cpp | 1092 ++ .../test/cxx11_tensor_index_list.cpp | 381 + .../test/cxx11_tensor_inflation.cpp | 81 + .../test/cxx11_tensor_inflation_sycl.cpp | 136 + .../unsupported/test/cxx11_tensor_intdiv.cpp | 147 + .../unsupported/test/cxx11_tensor_io.cpp | 142 + .../test/cxx11_tensor_layout_swap.cpp | 61 + .../test/cxx11_tensor_layout_swap_sycl.cpp | 126 + .../unsupported/test/cxx11_tensor_lvalue.cpp | 42 + .../unsupported/test/cxx11_tensor_map.cpp | 327 + .../unsupported/test/cxx11_tensor_math.cpp | 46 + .../test/cxx11_tensor_math_sycl.cpp | 109 + .../test/cxx11_tensor_mixed_indices.cpp | 53 + .../test/cxx11_tensor_morphing.cpp | 563 + .../test/cxx11_tensor_morphing_sycl.cpp | 386 + .../unsupported/test/cxx11_tensor_move.cpp | 76 + .../test/cxx11_tensor_notification.cpp | 64 + .../test/cxx11_tensor_of_bfloat16_gpu.cu | 487 + .../test/cxx11_tensor_of_complex.cpp | 118 + .../test/cxx11_tensor_of_const_values.cpp | 105 + .../test/cxx11_tensor_of_float16_gpu.cu | 488 + .../test/cxx11_tensor_of_strings.cpp | 152 + .../unsupported/test/cxx11_tensor_padding.cpp | 93 + .../test/cxx11_tensor_padding_sycl.cpp | 157 + .../unsupported/test/cxx11_tensor_patch.cpp | 172 + .../test/cxx11_tensor_patch_sycl.cpp | 249 + .../unsupported/test/cxx11_tensor_random.cpp | 86 + .../test/cxx11_tensor_random_gpu.cu | 86 + .../test/cxx11_tensor_random_sycl.cpp | 100 + .../test/cxx11_tensor_reduction.cpp | 523 + .../test/cxx11_tensor_reduction_gpu.cu | 154 + .../test/cxx11_tensor_reduction_sycl.cpp | 1013 + .../unsupported/test/cxx11_tensor_ref.cpp | 248 + .../unsupported/test/cxx11_tensor_reverse.cpp | 190 + .../test/cxx11_tensor_reverse_sycl.cpp | 253 + .../test/cxx11_tensor_roundings.cpp | 62 + .../unsupported/test/cxx11_tensor_scan.cpp | 110 + .../unsupported/test/cxx11_tensor_scan_gpu.cu | 78 + .../test/cxx11_tensor_scan_sycl.cpp | 141 + .../test/cxx11_tensor_shuffling.cpp | 283 + .../test/cxx11_tensor_shuffling_sycl.cpp | 117 + .../unsupported/test/cxx11_tensor_simple.cpp | 327 + .../test/cxx11_tensor_striding.cpp | 119 + .../test/cxx11_tensor_striding_sycl.cpp | 203 + .../unsupported/test/cxx11_tensor_sugar.cpp | 81 + .../unsupported/test/cxx11_tensor_sycl.cpp | 361 + .../test/cxx11_tensor_symmetry.cpp | 818 + .../test/cxx11_tensor_thread_local.cpp | 149 + .../test/cxx11_tensor_thread_pool.cpp | 721 + .../unsupported/test/cxx11_tensor_trace.cpp | 172 + .../unsupported/test/cxx11_tensor_uint128.cpp | 160 + .../test/cxx11_tensor_volume_patch.cpp | 112 + .../test/cxx11_tensor_volume_patch_sycl.cpp | 222 + .../FreakMatcher/unsupported/test/dgmres.cpp | 31 + .../unsupported/test/fft_test_shared.h | 277 + .../unsupported/test/forward_adolc.cpp | 48 +- .../FreakMatcher/unsupported/test/gmres.cpp | 31 + .../FreakMatcher/unsupported/test/idrs.cpp | 27 + .../unsupported/test/idrstabl.cpp | 28 + .../unsupported/test/kronecker_product.cpp | 252 + .../unsupported/test/levenberg_marquardt.cpp | 1508 ++ .../unsupported/test/matrix_exponential.cpp | 40 +- .../unsupported/test/matrix_function.cpp | 95 +- .../unsupported/test/matrix_functions.h | 67 + .../unsupported/test/matrix_power.cpp | 204 + .../unsupported/test/matrix_square_root.cpp | 31 + .../FreakMatcher/unsupported/test/minres.cpp | 44 + .../FreakMatcher/unsupported/test/mklfft.cpp | 2 + .../unsupported/test/mpreal/dlmalloc.c | 5703 ------ .../unsupported/test/mpreal/dlmalloc.h | 562 - .../unsupported/test/mpreal/mpreal.cpp | 507 - .../unsupported/test/mpreal/mpreal.h | 3215 --- .../unsupported/test/mpreal_support.cpp | 37 +- .../unsupported/test/openglsupport.cpp | 660 +- .../unsupported/test/pocketfft.cpp | 2 + .../unsupported/test/polynomialsolver.cpp | 142 +- .../unsupported/test/polynomialutils.cpp | 89 +- .../unsupported/test/sparse_extra.cpp | 143 +- .../unsupported/test/sparse_ldlt.cpp | 175 - .../unsupported/test/sparse_llt.cpp | 140 - .../unsupported/test/sparse_lu.cpp | 113 - .../unsupported/test/special_functions.cpp | 497 + .../unsupported/test/special_packetmath.cpp | 149 + .../FreakMatcher/unsupported/test/splines.cpp | 281 + 866 files changed, 224713 insertions(+), 50894 deletions(-) create mode 100644 include/AR/config.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/AccelerateSupport delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/Array delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/CholmodSupport delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/Eigen2Support create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/IterativeLinearSolvers create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/KLUSupport delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/LeastSquares create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/MetisSupport create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/OrderingMethods create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/PaStiXSupport create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/PardisoSupport create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/SPQRSupport create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/SparseCholesky create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/SparseCore create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/SparseLU create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/SparseQR create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/SuperLUSupport create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/UmfPackSupport create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/AccelerateSupport/AccelerateSupport.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/AccelerateSupport/InternalHeaderCheck.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/CMakeLists.txt delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LLT_LAPACKE.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/CholmodSupport/CholmodSupport.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/CholmodSupport/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArithmeticSequence.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/AssignEvaluator.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Assign_MKL.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ConditionEstimator.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CoreEvaluators.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CoreIterators.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseTernaryOp.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Flagged.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Functors.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GeneralProduct.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/IndexedView.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Inverse.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MathFunctionsImpl.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PartialReduxEvaluator.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ProductBase.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ProductEvaluators.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Ref.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Reshaped.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Solve.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/SolverBase.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/StlIterators.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX/Complex.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX/MathFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX/PacketMath.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX/TypeCasting.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX512/Complex.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX512/GemmKernel.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX512/MathFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX512/PacketMath.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX512/TrsmKernel.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX512/TrsmUnrolls.inc create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AVX512/TypeCasting.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AltiVec/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AltiVec/MathFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AltiVec/MatrixProduct.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/Default/BFloat16.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/Default/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/Default/ConjHelper.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/Default/Half.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/Default/TypeCasting.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/GPU/Complex.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/GPU/MathFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/GPU/PacketMath.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/GPU/Tuple.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/GPU/TypeCasting.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/HIP/hcc/math_constants.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/MSA/Complex.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/MSA/MathFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/MSA/PacketMath.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/NEON/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/NEON/MathFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/NEON/TypeCasting.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/NEON/UnaryFunctors.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/SSE/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/SSE/TypeCasting.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/SVE/MathFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/SVE/PacketMath.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/SVE/TypeCasting.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/SYCL/InteropHeaders.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/SYCL/MathFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/SYCL/PacketMath.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/SYCL/TypeCasting.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/ZVector/Complex.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/ZVector/MathFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/arch/ZVector/PacketMath.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/functors/AssignmentFunctors.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/functors/BinaryFunctors.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/functors/NullaryFunctors.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/functors/StlFunctors.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/functors/TernaryFunctors.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/functors/UnaryFunctors.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/products/CMakeLists.txt delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/products/CoeffBasedProduct.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/util/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/util/ConfigureVectorization.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/util/IndexedViewHelper.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/util/IntegralConstant.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/util/MKL_support.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/util/NonMPL2.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/util/ReshapedHelper.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/util/Serializer.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Core/util/SymbolicIndex.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Block.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/CMakeLists.txt delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Cwise.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/CwiseOperators.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/AlignedBox.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/All.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/AngleAxis.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/CMakeLists.txt delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/Hyperplane.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/Quaternion.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/Rotation2D.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/RotationBase.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/Scaling.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/Transform.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Geometry/Translation.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/LU.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Lazy.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/LeastSquares.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Macros.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/MathFunctions.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Memory.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Meta.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/Minor.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/QR.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/SVD.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/TriangularSolver.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigen2Support/VectorBlock.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigenvalues/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigenvalues/EigenvaluesCommon.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigenvalues/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigenvalues/RealQZ.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Geometry/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Geometry/InternalHeaderCheck.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Geometry/arch/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Geometry/arch/Geometry_SIMD.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Geometry/arch/Geometry_SSE.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Householder/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Householder/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Jacobi/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Jacobi/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/KLUSupport/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/KLUSupport/KLUSupport.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/LU/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/LU/InternalHeaderCheck.h rename lib/SRC/KPM/FreakMatcher/Eigen/src/LU/{Inverse.h => InverseImpl.h} (77%) create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/LU/PartialPivLU_LAPACKE.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/LU/arch/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/LU/arch/InverseSize4.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/LU/arch/Inverse_SSE.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/MetisSupport/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/MetisSupport/MetisSupport.h rename lib/SRC/KPM/FreakMatcher/{unsupported/Eigen/src/SparseExtra => Eigen/src/OrderingMethods}/Amd.h (71%) create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/OrderingMethods/Eigen_Colamd.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/OrderingMethods/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/OrderingMethods/Ordering.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/PaStiXSupport/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/PaStiXSupport/PaStiXSupport.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/PardisoSupport/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/PardisoSupport/PardisoSupport.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/QR/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/QR/CompleteOrthogonalDecomposition.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/QR/HouseholderQR_LAPACKE.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/QR/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SPQRSupport/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SVD/BDCSVD.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SVD/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SVD/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SVD/JacobiSVD_LAPACKE.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SVD/SVDBase.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/CMakeLists.txt delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/CompressedStorage.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/CoreIterators.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/DynamicSparseMatrix.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/MappedSparseMatrix.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseAssign.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseBlock.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseCwiseBinaryOp.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseCwiseUnaryOp.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseDenseProduct.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseDiagonalProduct.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseFuzzy.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseMatrix.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseMatrixBase.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseProduct.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseRedux.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseSelfAdjointView.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseSparseProduct.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseTranspose.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseTriangularView.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseUtil.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseVector.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/Sparse/SparseView.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCholesky/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCholesky/SimplicialCholesky.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h rename lib/SRC/KPM/FreakMatcher/Eigen/src/{Sparse => SparseCore}/AmbiVector.h (67%) create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/CompressedStorage.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseAssign.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseBlock.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseColEtree.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseCompressedBase.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseCwiseBinaryOp.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseCwiseUnaryOp.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseDenseProduct.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseDiagonalProduct.h rename lib/SRC/KPM/FreakMatcher/Eigen/src/{Sparse => SparseCore}/SparseDot.h (59%) create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseFuzzy.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseMap.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseMatrix.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseMatrixBase.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparsePermutation.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseProduct.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseRedux.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseRef.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseSelfAdjointView.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseSolverBase.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseSparseProductWithPruning.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseTranspose.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseTriangularView.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseUtil.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseVector.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseCore/SparseView.h rename lib/SRC/KPM/FreakMatcher/Eigen/src/{Sparse => SparseCore}/TriangularSolver.h (55%) create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLUImpl.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_Memory.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_Structs.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_Utils.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_column_bmod.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_column_dfs.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_gemm_kernel.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_kernel_bmod.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_panel_bmod.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_panel_dfs.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_pivotL.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_pruneL.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseLU/SparseLU_relax_snode.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseQR/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SparseQR/SparseQR.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/StlSupport/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SuperLUSupport/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/SuperLUSupport/SuperLUSupport.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/UmfPackSupport/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/UmfPackSupport/UmfPackSupport.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/misc/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/misc/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/misc/RealSvd2x2.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/misc/Solve.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/misc/blas.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/misc/lapack.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/misc/lapacke.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/misc/lapacke_helpers.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/misc/lapacke_mangling.h delete mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/plugins/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/plugins/IndexedViewMethods.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/plugins/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/Eigen/src/plugins/ReshapedMethods.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/ArpackSupport create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/Tensor create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/TensorSymmetry create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/ThreadPool create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/README.md create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/Tensor.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaDefines.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaUndefines.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorScanSycl.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/TensorSymmetry/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/TensorSymmetry/Symmetry.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/ThreadPool/Barrier.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/ThreadPool/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/ThreadPool/ThreadCancel.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/ThreadPool/ThreadLocal.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/util/CXX11Meta.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/util/EmulateArray.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CXX11/src/util/MaxSizeVector.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/CholmodSupport create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/EulerAngles create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/KroneckerProduct create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/LevenbergMarquardt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/NNLS create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/SpecialFunctions create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/Splines delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/SuperLUSupport delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/UmfPackSupport delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/AutoDiff/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/AutoDiff/InternalHeaderCheck.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/BVH/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/BVH/InternalHeaderCheck.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/Eigenvalues/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/EulerAngles/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/EulerAngles/EulerAngles.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/EulerAngles/EulerSystem.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/EulerAngles/InternalHeaderCheck.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/FFT/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/FFT/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/FFT/ei_imklfft_impl.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/FFT/ei_pocketfft_impl.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/IterativeSolvers/BiCGSTABL.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/IterativeSolvers/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/IterativeSolvers/DGMRES.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/IterativeSolvers/GMRES.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/IterativeSolvers/IDRS.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/IterativeSolvers/IDRSTABL.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/IterativeSolvers/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/IterativeSolvers/MINRES.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/IterativeSolvers/Scaling.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/KroneckerProduct/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/LevenbergMarquardt/CopyrightMINPACK.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/LevenbergMarquardt/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/LevenbergMarquardt/LMcovar.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/LevenbergMarquardt/LMonestep.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/LevenbergMarquardt/LMqrsolv.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/MatrixFunctions/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/MatrixFunctions/InternalHeaderCheck.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/MoreVectorization/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/MoreVectorization/InternalHeaderCheck.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/NonLinearOptimization/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/NonLinearOptimization/InternalHeaderCheck.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/NumericalDiff/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/NumericalDiff/InternalHeaderCheck.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/Polynomials/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/Polynomials/InternalHeaderCheck.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/Skyline/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/Skyline/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/CMakeLists.txt delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/CholmodSupport.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/CholmodSupportLegacy.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/MarketIO.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/SimplicialCholesky.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/Solve.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/SparseLLT.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/SparseLU.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SparseExtra/UmfPackSupport.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsArrayAPI.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsBFloat16.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsFunctors.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsHalf.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsPacketMath.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/HipVectorCompatibility.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsArrayAPI.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsBFloat16.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsFunctors.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsHalf.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsPacketMath.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/arch/AVX/BesselFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/arch/AVX/SpecialFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/BesselFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/SpecialFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/arch/GPU/SpecialFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/arch/NEON/BesselFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/SpecialFunctions/arch/NEON/SpecialFunctions.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/Splines/InternalHeaderCheck.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/Splines/Spline.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/Splines/SplineFitting.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/Eigen/src/Splines/SplineFwd.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/bench/bench_svd.cpp delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/doc/Doxyfile.in create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/doc/SYCL.dox create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/doc/eigendoxy_layout.xml.in create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/doc/examples/EulerAngles.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/doc/examples/MatrixLogarithm.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/doc/examples/MatrixPower.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/doc/examples/MatrixPower_optimal.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/doc/examples/MatrixSquareRoot.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/doc/examples/SYCL/CMakeLists.txt create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/doc/examples/SYCL/CwiseMul.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/EulerAngles.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/NNLS.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/autodiff_scalar.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/bessel_functions.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/bicgstabl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_eventcount.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_maxsizevector.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_meta.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_non_blocking_thread_pool.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_runqueue.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_argmax.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_argmax_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_argmax_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_assign.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_block_access.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_block_eval.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_block_io.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_broadcast_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_broadcasting.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_builtins_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_cast_float16_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_casts.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_chipping.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_chipping_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_comparisons.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_complex_cwise_ops_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_complex_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_concatenation.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_concatenation_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_const.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_contract_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_contract_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_contraction.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_convolution.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_convolution_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_custom_index.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_custom_op.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_custom_op_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_device.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_device_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_dimension.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_empty.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_executor.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_expr.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_fft.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_fixed_size.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_forced_eval.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_forced_eval_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_generator.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_generator_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_ifft.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_image_op_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_image_patch.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_image_patch_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_index_list.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_inflation.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_inflation_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_intdiv.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_io.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_layout_swap.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_layout_swap_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_lvalue.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_map.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_math.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_math_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_mixed_indices.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_morphing.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_morphing_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_move.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_notification.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_of_bfloat16_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_of_complex.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_of_const_values.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_of_float16_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_of_strings.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_padding.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_padding_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_patch.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_patch_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_random.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_random_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_random_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_reduction.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_reduction_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_reduction_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_ref.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_reverse.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_reverse_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_roundings.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_scan.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_scan_gpu.cu create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_scan_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_shuffling.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_shuffling_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_simple.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_striding.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_striding_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_sugar.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_symmetry.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_thread_local.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_thread_pool.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_trace.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_uint128.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_volume_patch.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/cxx11_tensor_volume_patch_sycl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/dgmres.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/fft_test_shared.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/gmres.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/idrs.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/idrstabl.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/kronecker_product.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/levenberg_marquardt.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/matrix_functions.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/matrix_power.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/matrix_square_root.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/minres.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/mklfft.cpp delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/mpreal/dlmalloc.c delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/mpreal/dlmalloc.h delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/mpreal/mpreal.cpp delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/mpreal/mpreal.h create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/pocketfft.cpp delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/sparse_ldlt.cpp delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/sparse_llt.cpp delete mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/sparse_lu.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/special_functions.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/special_packetmath.cpp create mode 100644 lib/SRC/KPM/FreakMatcher/unsupported/test/splines.cpp diff --git a/include/AR/config.h b/include/AR/config.h new file mode 100644 index 0000000..c762675 --- /dev/null +++ b/include/AR/config.h @@ -0,0 +1,553 @@ +/* + * config.h + * ARToolKit5 + * + * This file is part of ARToolKit. + * + * ARToolKit is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ARToolKit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with ARToolKit. If not, see . + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce an + * executable, regardless of the license terms of these independent modules, and to + * copy and distribute the resulting executable under terms of your choice, + * provided that you also meet, for each linked independent module, the terms and + * conditions of the license of that module. An independent module is a module + * which is neither derived from nor based on this library. If you modify this + * library, you may extend this exception to your version of the library, but you + * are not obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * + * Copyright 2015-2016 Daqri, LLC. + * Copyright 2002-2015 ARToolworks, Inc. + * + * Author(s): Hirokazu Kato, Philip Lamb + * + */ +/*! + @file config.h + @brief ARToolKit core configuration. + @version 5.3.2 + @details + @copyright 2015-2016 Daqri, LLC. + */ + + +#ifndef AR_CONFIG0_H +#define AR_CONFIG0_H + +// +// As of version 2.72 and 4.1, ARToolKit supports an OpenGL-like +// versioning system, with both header versions (for the version +// of the ARToolKit SDK installed) and runtime version reporting +// via arGetVersion(). +// + +/*@ + The MAJOR version number defines non-backwards compatible + changes in the ARToolKit API. Range: [0-99]. + */ +#define AR_HEADER_VERSION_MAJOR 5 + +/*@ + The MINOR version number defines additions to the ARToolKit + API, or (occsasionally) other significant backwards-compatible + changes in runtime functionality. Range: [0-99]. + */ +#define AR_HEADER_VERSION_MINOR 4 + +/*@ + The TINY version number defines bug-fixes to existing + functionality. Range: [0-99]. + */ +#define AR_HEADER_VERSION_TINY 0 + +/*@ + The BUILD version number will always be zero in releases, + but may be non-zero in post-release development builds, + version-control repository-sourced code, or other. Range: [0-99]. + */ +#define AR_HEADER_VERSION_DEV 0 + +/*@ + The string representation below must match the major, minor + and tiny release numbers. + */ +#define AR_HEADER_VERSION_STRING "5.4.0" + +/*@ + Convenience macros to enable use of certain ARToolKit header + functionality by the release version in which it appeared. + Each time the major version number is incremented, all + existing macros must be removed, and just one new one + added for the new major version. + Each time the minor version number is incremented, a new + AR_HAVE_HEADER_VERSION_ macro definition must be added. + Tiny version numbers (being bug-fix releases, by definition) + are NOT included in the AR_HAVE_HEADER_VERSION_ system. + */ +#define AR_HAVE_HEADER_VERSION_5 +#define AR_HAVE_HEADER_VERSION_5_1 +#define AR_HAVE_HEADER_VERSION_5_2 +#define AR_HAVE_HEADER_VERSION_5_3 +#define AR_HAVE_HEADER_VERSION_5_4 + +// +// End version definitions. +// + +/* +#undef AR_BIG_ENDIAN +#undef AR_LITTLE_ENDIAN +*/ + +/*! + @typedef AR_PIXEL_FORMAT + @brief ARToolKit pixel-format specifiers. + @details + ARToolKit functions can accept pixel data in a variety of formats. + This enumerations provides a set of constants you can use to request + data in a particular pixel format from an ARToolKit function that + returns data to you, or to specify that data you are providing to an + ARToolKit function is in a particular pixel format. + */ +typedef enum { + /*@ + Value indicating pixel format is invalid or unset. + */ + AR_PIXEL_FORMAT_INVALID = -1, + /*@ + Each pixel is represented by 24 bits. Eight bits per each Red, Green, + and Blue component. This is the native 24 bit format for the Mac platform. + */ + AR_PIXEL_FORMAT_RGB = 0, + /*@ + Each pixel is represented by 24 bits. Eight bits per each Blue, Red, and + Green component. This is the native 24 bit format for the Win32 platform. + */ + AR_PIXEL_FORMAT_BGR, + /*@ + Each pixel is represented by 32 bits. Eight bits per each Red, Green, + Blue, and Alpha component. + */ + AR_PIXEL_FORMAT_RGBA, + /*@ + Each pixel is represented by 32 bits. Eight bits per each Blue, Green, + Red, and Alpha component. This is the native 32 bit format for the Win32 + and Mac Intel platforms. + */ + AR_PIXEL_FORMAT_BGRA, + /*@ + Each pixel is represented by 32 bits. Eight bits per each Alpha, Blue, + Green, and Red component. This is the native 32 bit format for the SGI + platform. + */ + AR_PIXEL_FORMAT_ABGR, + /*@ + Each pixel is represented by 8 bits of luminance information. + */ + AR_PIXEL_FORMAT_MONO, + /*@ + Each pixel is represented by 32 bits. Eight bits per each Alpha, Red, + Green, and Blue component. This is the native 32 bit format for the Mac + PowerPC platform. + */ + AR_PIXEL_FORMAT_ARGB, + /*@ + 8-bit 4:2:2 Component Y'CbCr format. Each 16 bit pixel is represented + by an unsigned eight bit luminance component and two unsigned eight bit + chroma components. Each pair of pixels shares a common set of chroma + values. The components are ordered in memory; Cb, Y0, Cr, Y1. The + luminance components have a range of [16, 235], while the chroma value + has a range of [16, 240]. This is consistent with the CCIR601 spec. + This format is fairly prevalent on both Mac and Win32 platforms. + '2vuy' is the Apple QuickTime four-character code for this pixel format. + The equivalent Microsoft fourCC is 'UYVY'. + */ + AR_PIXEL_FORMAT_2vuy, + /*@ + 8-bit 4:2:2 Component Y'CbCr format. Identical to the AR_PIXEL_FORMAT_2vuy except + each 16 bit word has been byte swapped. This results in a component + ordering of; Y0, Cb, Y1, Cr. + This is most prevalent yuv 4:2:2 format on both Mac and Win32 platforms. + 'yuvs' is the Apple QuickTime four-character code for this pixel format. + The equivalent Microsoft fourCC is 'YUY2'. + */ + AR_PIXEL_FORMAT_yuvs, + /*@ + A packed-pixel format. Each 16 bit pixel consists of 5 bits of red color + information in bits 15-11, 6 bits of green color information in bits 10-5, + and 5 bits of blue color information in bits 4-0. Byte ordering is big-endian. + */ + AR_PIXEL_FORMAT_RGB_565, + /*@ + A packed-pixel format. Each 16 bit pixel consists of 5 bits of red color + information in bits 15-11, 5 bits of green color information in bits 10-6, + 5 bits of blue color information in bits 5-1, and a single alpha bit in bit 0. + Byte ordering is big-endian. + */ + AR_PIXEL_FORMAT_RGBA_5551, + /*@ + A packed-pixel format. Each 16 bit pixel consists of 4 bits of red color + information in bits 15-12, 6 bits of green color information in bits 11-8, + 4 bits of blue color information in bits 7-4, and 4 bits of alpha information + in bits 3-0. Byte ordering is big-endian. + */ + AR_PIXEL_FORMAT_RGBA_4444, + /*@ + 8-bit 4:2:0 Component Y'CbCr format. Each 2x2 pixel block is represented + by 4 unsigned eight bit luminance values and two unsigned eight bit + chroma values. The chroma plane and luma plane are separated in memory. The + luminance components have a range of [16, 235], while the chroma value + has a range of [16, 240]. This is consistent with the CCIR601 spec. + '420v' is the Apple Core Video four-character code for this pixel format. + */ + AR_PIXEL_FORMAT_420v, + /*@ + 8-bit 4:2:0 Component Y'CbCr format. Each 2x2 pixel block is represented + by 4 unsigned eight bit luminance components and two unsigned eight bit + chroma components. The chroma plane and luma plane are separated in memory. The + luminance components have a range of [0, 255], while the chroma value + has a range of [1, 255]. + '420f' is the Apple Core Video four-character code for this pixel format. + The equivalent Microsoft fourCC is 'NV12'. + */ + AR_PIXEL_FORMAT_420f, + /*@ + 8-bit 4:2:0 Component Y'CbCr format. Each 2x2 pixel block is represented + by 4 unsigned eight bit luminance components and two unsigned eight bit + chroma components. The chroma plane and luma plane are separated in memory. The + luminance components have a range of [0, 255], while the chroma value + has a range of [1, 255]. + */ + AR_PIXEL_FORMAT_NV21 +} AR_PIXEL_FORMAT; +#define AR_PIXEL_FORMAT_UYVY AR_PIXEL_FORMAT_2vuy +#define AR_PIXEL_FORMAT_YUY2 AR_PIXEL_FORMAT_yuvs + +// Note if making changes to the above table: +// If the number of pixel formats supported changes, AR_PIXEL_FORMAT_MAX must too. +// The functions arVideoUtilGetPixelSize(), arVideoUtilGetPixelFormatName() +// and arUtilGetPixelSize() arUtilGetPixelFormatName() must also be edited. +#define AR_PIXEL_FORMAT_MAX AR_PIXEL_FORMAT_NV21 + +// +// For Linux +// + +#ifdef EMSCRIPTEN +# define __linux +#endif + +#if defined(__linux) && !defined(ANDROID) + +#define AR_CALLBACK + +// Determine architecture endianess using gcc's macro, or assume little-endian by default. +# if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || defined(__BIG_ENDIAN__) +# define AR_BIG_ENDIAN // Most Significant Byte has greatest address in memory (ppc). +# undef AR_LITTLE_ENDIAN +# elif (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || defined (__LITTLE_ENDIAN__) +# undef AR_BIG_ENDIAN // Least significant Byte has greatest address in memory (x86). +# define AR_LITTLE_ENDIAN +# else +# define AR_LITTLE_ENDIAN +# endif + +// Input modules. This is edited by the configure script. +#undef ARVIDEO_INPUT_V4L2 +#undef ARVIDEO_INPUT_1394CAM +#undef ARVIDEO_INPUT_GSTREAMER +#undef ARVIDEO_INPUT_IMAGE +#define ARVIDEO_INPUT_DUMMY + +// Default input module. This is edited by the configure script. +#undef ARVIDEO_INPUT_DEFAULT_V4L2 +#undef ARVIDEO_INPUT_DEFAULT_1394 +#undef ARVIDEO_INPUT_DEFAULT_GSTREAMER +#undef ARVIDEO_INPUT_DEFAULT_IMAGE +#undef ARVIDEO_INPUT_DEFAULT_DUMMY + +// Other Linux-only configuration. +#define HAVE_LIBJPEG 1 +#define HAVE_INTEL_SIMD 1 + +#endif // __linux + +// Default pixel formats. + +#ifdef ARVIDEO_INPUT_V4L2 +/* #define ARVIDEO_INPUT_V4L2_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_BGR */ +/* #define ARVIDEO_INPUT_V4L2_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_BGRA */ +#define ARVIDEO_INPUT_V4L2_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_BGR +#endif + +#ifdef ARVIDEO_INPUT_1394CAM +/* #define ARVIDEO_INPUT_1394CAM_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_MONO */ +/* #define ARVIDEO_INPUT_1394CAM_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_RGB */ +#define ARVIDEO_INPUT_1394CAM_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_MONO +#undef ARVIDEO_INPUT_1394CAM_USE_DRAGONFLY +#undef ARVIDEO_INPUT_1394CAM_USE_DF_EXPRESS +#undef ARVIDEO_INPUT_1394CAM_USE_FLEA +#undef ARVIDEO_INPUT_1394CAM_USE_FLEA_XGA +#undef ARVIDEO_INPUT_1394CAM_USE_DFK21AF04 +#endif + +#ifdef ARVIDEO_INPUT_GSTREAMER +#define ARVIDEO_INPUT_GSTREAMER_PIXEL_FORMAT AR_PIXEL_FORMAT_RGB +#endif + + + +// +// For Windows +// +#ifdef _WIN32 + +// Include Windows API. +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif +#include // Minimum supported version. See http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745.aspx +#include + +#define AR_CALLBACK __stdcall +#define strdup _strdup +#define LIBARVIDEO_DYNAMIC + +// Define _WINRT for support Windows Runtime platforms. +#if defined(WINAPI_FAMILY) +# if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) // Windows Phone 8.1 and later. +# if (_WIN32_WINNT >= 0x0603) // (_WIN32_WINNT_WINBLUE) +# define _WINRT +# undef LIBARVIDEO_DYNAMIC +# define ARDOUBLE_IS_FLOAT +# else +# error ARToolKit for Windows Phone requires Windows Phone 8.1 or later. Please compile with Visual Studio 2013 or later with Windows Phone 8.1 SDK installed and with _WIN32_WINNT=0x0603 in your project compiler settings (setting /D_WIN32_WINNT=0x0603). +# endif +# elif (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) // Windows Store 8.1 and later. +# if (_WIN32_WINNT >= 0x0603) // (_WIN32_WINNT_WINBLUE) +# define _WINRT +# undef LIBARVIDEO_DYNAMIC +# define ARDOUBLE_IS_FLOAT +# else +# error ARToolKit for Windows Store requires Windows 8.1 or later. Please compile with Visual Studio 2013 or later with Windows 8.1 SDK installed and with _WIN32_WINNT=0x0603 in your project compiler settings (setting /D_WIN32_WINNT=0x0603). +# endif +# endif +#endif + +// Endianness. +// Windows on x86, x86-64 and ARM all run little-endian. +#undef AR_BIG_ENDIAN +#define AR_LITTLE_ENDIAN + +// Input modules. This is edited by the configure script. +#define ARVIDEO_INPUT_DUMMY +#undef ARVIDEO_INPUT_IMAGE +#undef ARVIDEO_INPUT_WINDOWS_MEDIA_FOUNDATION +#undef ARVIDEO_INPUT_WINDOWS_MEDIA_CAPTURE + +// Default input module. This is edited by the configure script. +#undef ARVIDEO_INPUT_DEFAULT_DUMMY +#undef ARVIDEO_INPUT_DEFAULT_IMAGE +#undef ARVIDEO_INPUT_DEFAULT_WINDOWS_MEDIA_FOUNDATION +#undef ARVIDEO_INPUT_DEFAULT_WINDOWS_MEDIA_CAPTURE + +// Other Windows-only configuration. +#define HAVE_LIBJPEG 1 + +#if defined(_M_IX86) || defined(_M_X64) +# define HAVE_INTEL_SIMD 1 +#elif defined(_M_ARM) +# undef HAVE_ARM_NEON // MSVC doesn't support inline assembly on ARM platform. +#endif + +#endif // _WIN32 + +// Default pixel formats. + +#ifdef ARVIDEO_INPUT_WINDOWS_MEDIA_FOUNDATION +#define ARVIDEO_INPUT_WINDOWS_MEDIA_FOUNDATION_PIXEL_FORMAT AR_PIXEL_FORMAT_BGRA +#endif + +#ifdef ARVIDEO_INPUT_WINDOWS_MEDIA_CAPTURE +#define ARVIDEO_INPUT_WINDOWS_MEDIA_CAPTURE_PIXEL_FORMAT AR_PIXEL_FORMAT_BGRA +#endif + +// +// For Android +// Note that Android NDK also defines __linux +// + +#if defined ANDROID + +// Determine architecture endianess using gcc's macro, or assume little-endian by default. +# if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || defined(__BIG_ENDIAN__) +# define AR_BIG_ENDIAN // Most Significant Byte has greatest address in memory (ppc). +# undef AR_LITTLE_ENDIAN +# elif (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || defined (__LITTLE_ENDIAN__) +# undef AR_BIG_ENDIAN // Least significant Byte has greatest address in memory (x86). +# define AR_LITTLE_ENDIAN +# else +# define AR_LITTLE_ENDIAN +# endif + +#define AR_CALLBACK +#define ARDOUBLE_IS_FLOAT + +#undef ARVIDEO_INPUT_DUMMY +#define ARVIDEO_INPUT_ANDROID +#undef ARVIDEO_INPUT_IMAGE +#undef ARVIDEO_INPUT_DEFAULT_DUMMY +#define ARVIDEO_INPUT_DEFAULT_ANDROID +#undef ARVIDEO_INPUT_DEFAULT_IMAGE + +#define HAVE_LIBJPEG 1 +#define USE_OPENGL_ES 1 +#define USE_CPARAM_SEARCH 1 + +#endif // _ANDROID + +// Default pixel formats. + +#ifdef ARVIDEO_INPUT_ANDROID +#define ARVIDEO_INPUT_ANDROID_PIXEL_FORMAT AR_PIXEL_FORMAT_NV21 +#endif + +// +// For macOS +// +#if __APPLE__ + +# include +# include + +# define AR_CALLBACK + +// Endianness. +# if TARGET_RT_BIG_ENDIAN +# define AR_BIG_ENDIAN // Most Significant Byte has greatest address in memory (ppc). +# undef AR_LITTLE_ENDIAN +# elif TARGET_RT_LITTLE_ENDIAN +# undef AR_BIG_ENDIAN +# define AR_LITTLE_ENDIAN +# else +# error +# endif + +#if TARGET_IPHONE_SIMULATOR + +#error This release does not support the simulator. Please target an iOS device. +#define ARDOUBLE_IS_FLOAT +#define ARVIDEO_INPUT_DUMMY +#define ARVIDEO_INPUT_DEFAULT_DUMMY + +#elif TARGET_OS_IPHONE + +#define ARDOUBLE_IS_FLOAT +#define ARVIDEO_INPUT_AVFOUNDATION +#undef ARVIDEO_INPUT_DUMMY +#define ARVIDEO_INPUT_IMAGE +#define ARVIDEO_INPUT_DEFAULT_AVFOUNDATION +#undef ARVIDEO_INPUT_DEFAULT_DUMMY +#undef ARVIDEO_INPUT_DEFAULT_IMAGE +#define HAVE_LIBJPEG 1 +#define USE_OPENGL_ES 1 +#ifdef __LP64__ +# define HAVE_ARM64_NEON 1 +#else +# define HAVE_ARM_NEON 1 +#endif +#define USE_CPARAM_SEARCH 1 + +#elif TARGET_OS_MAC + +#define ARVIDEO_INPUT_AVFOUNDATION +#define ARVIDEO_INPUT_DUMMY +#define ARVIDEO_INPUT_IMAGE +#define ARVIDEO_INPUT_DEFAULT_AVFOUNDATION +#undef ARVIDEO_INPUT_DEFAULT_DUMMY +#undef ARVIDEO_INPUT_DEFAULT_IMAGE +#define HAVE_LIBJPEG 1 +#define HAVE_INTEL_SIMD 1 + +#endif + +#endif // __APPLE__ + +// Default pixel formats. + +#ifdef ARVIDEO_INPUT_AVFOUNDATION +#define ARVIDEO_INPUT_AVFOUNDATION_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_BGRA +#endif + +// +// Emscripten input +// + +#ifdef EMSCRIPTEN +#define ARVIDEO_INPUT_DEFAULT_EMSCRIPTEN +#define ARVIDEO_INPUT_EMSCRIPTEN_PIXEL_FORMAT AR_PIXEL_FORMAT_RGBA +#endif + +// +// Multi-platform inputs +// + +#ifdef ARVIDEO_INPUT_DUMMY +#define ARVIDEO_INPUT_DUMMY_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_RGB +#endif + +#ifdef ARVIDEO_INPUT_IMAGE +#define ARVIDEO_INPUT_IMAGE_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_RGB +#endif + +// +// Setup AR_DEFAULT_PIXEL_FORMAT. +// + +#if defined(ARVIDEO_INPUT_DEFAULT_DUMMY) +# define AR_DEFAULT_PIXEL_FORMAT ARVIDEO_INPUT_DUMMY_DEFAULT_PIXEL_FORMAT +#elif defined(ARVIDEO_INPUT_DEFAULT_V4L2) +# define AR_DEFAULT_PIXEL_FORMAT ARVIDEO_INPUT_V4L2_DEFAULT_PIXEL_FORMAT +#elif defined(ARVIDEO_INPUT_DEFAULT_1394) +# define AR_DEFAULT_PIXEL_FORMAT ARVIDEO_INPUT_1394CAM_DEFAULT_PIXEL_FORMAT +#elif defined(ARVIDEO_INPUT_DEFAULT_GSTREAMER) +# define AR_DEFAULT_PIXEL_FORMAT ARVIDEO_INPUT_GSTREAMER_PIXEL_FORMAT +#elif defined(ARVIDEO_INPUT_DEFAULT_AVFOUNDATION) +# define AR_DEFAULT_PIXEL_FORMAT ARVIDEO_INPUT_AVFOUNDATION_DEFAULT_PIXEL_FORMAT +#elif defined(ARVIDEO_INPUT_DEFAULT_ANDROID) +# define AR_DEFAULT_PIXEL_FORMAT ARVIDEO_INPUT_ANDROID_PIXEL_FORMAT +#elif defined(ARVIDEO_INPUT_DEFAULT_IMAGE) +# define AR_DEFAULT_PIXEL_FORMAT ARVIDEO_INPUT_IMAGE_DEFAULT_PIXEL_FORMAT +#elif defined(ARVIDEO_INPUT_DEFAULT_WINDOWS_MEDIA_FOUNDATION) +# define AR_DEFAULT_PIXEL_FORMAT ARVIDEO_INPUT_WINDOWS_MEDIA_FOUNDATION_PIXEL_FORMAT +#elif defined(ARVIDEO_INPUT_DEFAULT_WINDOWS_MEDIA_CAPTURE) +# define AR_DEFAULT_PIXEL_FORMAT ARVIDEO_INPUT_WINDOWS_MEDIA_CAPTURE_PIXEL_FORMAT +#elif defined(ARVIDEO_INPUT_DEFAULT_EMSCRIPTEN) +# define AR_DEFAULT_PIXEL_FORMAT ARVIDEO_INPUT_EMSCRIPTEN_PIXEL_FORMAT +#else +# error +#endif + +// +// If trying to minimize memory footprint, disable a few things. +// + +#if AR_ENABLE_MINIMIZE_MEMORY_FOOTPRINT +#define AR_DISABLE_THRESH_MODE_AUTO_ADAPTIVE 1 +#define AR_DISABLE_NON_CORE_FNS 1 +#define AR_DISABLE_LABELING_DEBUG_MODE 1 +#endif + +#endif // !AR_CONFIG0_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/AccelerateSupport b/lib/SRC/KPM/FreakMatcher/Eigen/AccelerateSupport new file mode 100644 index 0000000..0929501 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/AccelerateSupport @@ -0,0 +1,53 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ACCELERATESUPPORT_MODULE_H +#define EIGEN_ACCELERATESUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \ingroup Support_modules + * \defgroup AccelerateSupport_Module AccelerateSupport module + * + * This module provides an interface to the Apple Accelerate library. + * It provides the seven following main factorization classes: + * - class AccelerateLLT: a Cholesky (LL^T) factorization. + * - class AccelerateLDLT: the default LDL^T factorization. + * - class AccelerateLDLTUnpivoted: a Cholesky-like LDL^T factorization with only 1x1 pivots and no pivoting + * - class AccelerateLDLTSBK: an LDL^T factorization with Supernode Bunch-Kaufman and static pivoting + * - class AccelerateLDLTTPP: an LDL^T factorization with full threshold partial pivoting + * - class AccelerateQR: a QR factorization + * - class AccelerateCholeskyAtA: a QR factorization without storing Q (equivalent to A^TA = R^T R) + * + * \code + * #include + * \endcode + * + * In order to use this module, the Accelerate headers must be accessible from + * the include paths, and your binary must be linked to the Accelerate framework. + * The Accelerate library is only available on Apple hardware. + * + * Note that many of the algorithms require additional information about your + * matrices. This can be provided by setting the UpLo template argument when + * defining the factorization class. For example, the following creates an + * LDLT factorization where your matrix is symmetric and uses the lower + * triangle: + * + * \code + * AccelerateLDLT, Lower | Symmetric> ldlt; + * \endcode + * + * Failure to do so may result in your application crashing. + */ + +#include "src/AccelerateSupport/AccelerateSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_ACCELERATESUPPORT_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/Array b/lib/SRC/KPM/FreakMatcher/Eigen/Array deleted file mode 100644 index 3d004fb..0000000 --- a/lib/SRC/KPM/FreakMatcher/Eigen/Array +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EIGEN_ARRAY_MODULE_H -#define EIGEN_ARRAY_MODULE_H - -// include Core first to handle Eigen2 support macros -#include "Core" - -#ifndef EIGEN2_SUPPORT - #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core. -#endif - -#endif // EIGEN_ARRAY_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/CMakeLists.txt b/lib/SRC/KPM/FreakMatcher/Eigen/CMakeLists.txt deleted file mode 100644 index a92dd6f..0000000 --- a/lib/SRC/KPM/FreakMatcher/Eigen/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -include(RegexUtils) -test_escape_string_as_regex() - -file(GLOB Eigen_directory_files "*") - -escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - -foreach(f ${Eigen_directory_files}) - if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") - list(APPEND Eigen_directory_files_to_install ${f}) - endif() -endforeach(f ${Eigen_directory_files}) - -install(FILES - ${Eigen_directory_files_to_install} - DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel - ) - -add_subdirectory(src) diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/Cholesky b/lib/SRC/KPM/FreakMatcher/Eigen/Cholesky index 53f7bf9..2c686f1 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/Cholesky +++ b/lib/SRC/KPM/FreakMatcher/Eigen/Cholesky @@ -1,33 +1,41 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_CHOLESKY_MODULE_H #define EIGEN_CHOLESKY_MODULE_H #include "Core" +#include "Jacobi" #include "src/Core/util/DisableStupidWarnings.h" -namespace Eigen { - /** \defgroup Cholesky_Module Cholesky module * * * * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. - * Those decompositions are accessible via the following MatrixBase methods: - * - MatrixBase::llt(), + * Those decompositions are also accessible via the following methods: + * - MatrixBase::llt() * - MatrixBase::ldlt() + * - SelfAdjointView::llt() + * - SelfAdjointView::ldlt() * * \code * #include * \endcode */ -#include "src/misc/Solve.h" #include "src/Cholesky/LLT.h" #include "src/Cholesky/LDLT.h" - -} // namespace Eigen +#ifdef EIGEN_USE_LAPACKE +#include "src/misc/lapacke_helpers.h" +#include "src/Cholesky/LLT_LAPACKE.h" +#endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_CHOLESKY_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/CholmodSupport b/lib/SRC/KPM/FreakMatcher/Eigen/CholmodSupport new file mode 100644 index 0000000..bed8924 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/CholmodSupport @@ -0,0 +1,48 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CHOLMODSUPPORT_MODULE_H +#define EIGEN_CHOLMODSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { + #include +} + +/** \ingroup Support_modules + * \defgroup CholmodSupport_Module CholmodSupport module + * + * This module provides an interface to the Cholmod library which is part of the suitesparse package. + * It provides the two following main factorization classes: + * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. + * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). + * + * For the sake of completeness, this module also propose the two following classes: + * - class CholmodSimplicialLLT + * - class CholmodSimplicialLDLT + * Note that these classes does not bring any particular advantage compared to the built-in + * SimplicialLLT and SimplicialLDLT factorization classes. + * + * \code + * #include + * \endcode + * + * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. + * The dependencies depend on how cholmod has been compiled. + * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. + * + */ + +#include "src/CholmodSupport/CholmodSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_CHOLMODSUPPORT_MODULE_H + diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/Core b/lib/SRC/KPM/FreakMatcher/Eigen/Core index 136c1bb..63b9850 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/Core +++ b/lib/SRC/KPM/FreakMatcher/Eigen/Core @@ -4,127 +4,62 @@ // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2007-2011 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#ifndef EIGEN_CORE_H -#define EIGEN_CORE_H +#ifndef EIGEN_CORE_MODULE_H +#define EIGEN_CORE_MODULE_H -// first thing Eigen does: stop the compiler from committing suicide +// first thing Eigen does: stop the compiler from reporting useless warnings. #include "src/Core/util/DisableStupidWarnings.h" // then include this file where all our macros are defined. It's really important to do it first because -// it's where we do all the alignment settings (platform detection and honoring the user's will if he -// defined e.g. EIGEN_DONT_ALIGN) so it needs to be done before we do anything with vectorization. +// it's where we do all the compiler/OS/arch detections and define most defaults. #include "src/Core/util/Macros.h" -// if alignment is disabled, then disable vectorization. Note: EIGEN_ALIGN is the proper check, it takes into -// account both the user's will (EIGEN_DONT_ALIGN) and our own platform checks -#if !EIGEN_ALIGN - #ifndef EIGEN_DONT_VECTORIZE - #define EIGEN_DONT_VECTORIZE - #endif +// This detects SSE/AVX/NEON/etc. and configure alignment settings +#include "src/Core/util/ConfigureVectorization.h" + +// We need cuda_runtime.h/hip_runtime.h to ensure that +// the EIGEN_USING_STD macro works properly on the device side +#if defined(EIGEN_CUDACC) + #include +#elif defined(EIGEN_HIPCC) + #include #endif -#ifdef _MSC_VER - #include // for _aligned_malloc -- need it regardless of whether vectorization is enabled - #if (_MSC_VER >= 1500) // 2008 or later - // Remember that usage of defined() in a #define is undefined by the standard. - // a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP. - #if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(_M_X64) - #define EIGEN_SSE2_ON_MSVC_2008_OR_LATER - #endif - #endif -#else - // Remember that usage of defined() in a #define is undefined by the standard - #if (defined __SSE2__) && ( (!defined __GNUC__) || EIGEN_GNUC_AT_LEAST(4,2) ) - #define EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC - #endif + +#ifdef EIGEN_EXCEPTIONS + #include #endif -#ifndef EIGEN_DONT_VECTORIZE - - #if defined (EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER) - - // Defines symbols for compile-time detection of which instructions are - // used. - // EIGEN_VECTORIZE_YY is defined if and only if the instruction set YY is used - #define EIGEN_VECTORIZE - #define EIGEN_VECTORIZE_SSE - #define EIGEN_VECTORIZE_SSE2 - - // Detect sse3/ssse3/sse4: - // gcc and icc defines __SSE3__, ... - // there is no way to know about this on msvc. You can define EIGEN_VECTORIZE_SSE* if you - // want to force the use of those instructions with msvc. - #ifdef __SSE3__ - #define EIGEN_VECTORIZE_SSE3 - #endif - #ifdef __SSSE3__ - #define EIGEN_VECTORIZE_SSSE3 - #endif - #ifdef __SSE4_1__ - #define EIGEN_VECTORIZE_SSE4_1 - #endif - #ifdef __SSE4_2__ - #define EIGEN_VECTORIZE_SSE4_2 - #endif - - // include files - - // This extern "C" works around a MINGW-w64 compilation issue - // https://sourceforge.net/tracker/index.php?func=detail&aid=3018394&group_id=202880&atid=983354 - // In essence, intrin.h is included by windows.h and also declares intrinsics (just as emmintrin.h etc. below do). - // However, intrin.h uses an extern "C" declaration, and g++ thus complains of duplicate declarations - // with conflicting linkage. The linkage for intrinsics doesn't matter, but at that stage the compiler doesn't know; - // so, to avoid compile errors when windows.h is included after Eigen/Core, ensure intrinsics are extern "C" here too. - // notice that since these are C headers, the extern "C" is theoretically needed anyways. - extern "C" { - #include - #include - #ifdef EIGEN_VECTORIZE_SSE3 - #include - #endif - #ifdef EIGEN_VECTORIZE_SSSE3 - #include - #endif - #ifdef EIGEN_VECTORIZE_SSE4_1 - #include - #endif - #ifdef EIGEN_VECTORIZE_SSE4_2 - #include - #endif - } // end extern "C" - #elif defined __ALTIVEC__ - #define EIGEN_VECTORIZE - #define EIGEN_VECTORIZE_ALTIVEC - #include - // We need to #undef all these ugly tokens defined in - // => use __vector instead of vector - #undef bool - #undef vector - #undef pixel - #elif defined __ARM_NEON__ - #define EIGEN_VECTORIZE - #define EIGEN_VECTORIZE_NEON - #include - #endif +// Disable the ipa-cp-clone optimization flag with MinGW 6.x or newer (enabled by default with -O3) +// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details. +#if EIGEN_COMP_MINGW && EIGEN_GNUC_AT_MOST(5,5) + #pragma GCC optimize ("-fno-ipa-cp-clone") +#endif + +// Prevent ICC from specializing std::complex operators that silently fail +// on device. This allows us to use our own device-compatible specializations +// instead. +#if defined(EIGEN_COMP_ICC) && defined(EIGEN_GPU_COMPILE_PHASE) \ + && !defined(_OVERRIDE_COMPLEX_SPECIALIZATION_) +#define _OVERRIDE_COMPLEX_SPECIALIZATION_ 1 +#endif +#include + +// this include file manages BLAS and MKL related macros +// and inclusion of their respective header files +#include "src/Core/util/MKL_support.h" + + +#if defined(EIGEN_HAS_CUDA_FP16) || defined(EIGEN_HAS_HIP_FP16) + #define EIGEN_HAS_GPU_FP16 +#endif + +#if defined(EIGEN_HAS_CUDA_BF16) || defined(EIGEN_HAS_HIP_BF16) + #define EIGEN_HAS_GPU_BF16 #endif #if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE) @@ -132,11 +67,12 @@ #endif #ifdef EIGEN_HAS_OPENMP +#include #include #endif // MSVC for windows mobile does not have the errno.h file -#if !(defined(_MSC_VER) && defined(_WIN32_WCE)) && !defined(__ARMCC_VERSION) +#if !(EIGEN_COMP_MSVC && EIGEN_OS_WINCE) && !EIGEN_COMP_ARM #define EIGEN_HAS_ERRNO #endif @@ -146,10 +82,12 @@ #include #include #include -#include #include #include -#include +#include +#ifndef EIGEN_NO_IO + #include +#endif #include #include #include @@ -157,86 +95,57 @@ // for min/max: #include +#include + +// for std::is_nothrow_move_assignable +#include + // for outputting debug info #ifdef EIGEN_DEBUG_ASSIGN #include #endif // required for __cpuid, needs to be included after cmath -#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64)) +// also required for _BitScanReverse on Windows on ARM +#if EIGEN_COMP_MSVC && (EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM64) && !EIGEN_OS_WINCE #include #endif -#if defined(_CPPUNWIND) || defined(__EXCEPTIONS) - #define EIGEN_EXCEPTIONS -#endif - -#ifdef EIGEN_EXCEPTIONS - #include +#if defined(EIGEN_USE_SYCL) + #undef min + #undef max + #undef isnan + #undef isinf + #undef isfinite + #include + #include + #include + #include + #include + #ifndef EIGEN_SYCL_LOCAL_THREAD_DIM0 + #define EIGEN_SYCL_LOCAL_THREAD_DIM0 16 + #endif + #ifndef EIGEN_SYCL_LOCAL_THREAD_DIM1 + #define EIGEN_SYCL_LOCAL_THREAD_DIM1 16 + #endif #endif -// defined in bits/termios.h -#undef B0 -/** \brief Namespace containing all symbols from the %Eigen library. */ -namespace Eigen { - -inline static const char *SimdInstructionSetsInUse(void) { -#if defined(EIGEN_VECTORIZE_SSE4_2) - return "SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2"; -#elif defined(EIGEN_VECTORIZE_SSE4_1) - return "SSE, SSE2, SSE3, SSSE3, SSE4.1"; -#elif defined(EIGEN_VECTORIZE_SSSE3) - return "SSE, SSE2, SSE3, SSSE3"; -#elif defined(EIGEN_VECTORIZE_SSE3) - return "SSE, SSE2, SSE3"; -#elif defined(EIGEN_VECTORIZE_SSE2) - return "SSE, SSE2"; -#elif defined(EIGEN_VECTORIZE_ALTIVEC) - return "AltiVec"; -#elif defined(EIGEN_VECTORIZE_NEON) - return "ARM NEON"; -#else - return "None"; +#if defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS || defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API || defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS || defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API || defined EIGEN2_SUPPORT +// This will generate an error message: +#error Eigen2-support is only available up to version 3.2. Please go to "http://eigen.tuxfamily.org/index.php?title=Eigen2" for further information #endif -} -#define STAGE10_FULL_EIGEN2_API 10 -#define STAGE20_RESOLVE_API_CONFLICTS 20 -#define STAGE30_FULL_EIGEN3_API 30 -#define STAGE40_FULL_EIGEN3_STRICTNESS 40 -#define STAGE99_NO_EIGEN2_SUPPORT 99 - -#if defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS - #define EIGEN2_SUPPORT - #define EIGEN2_SUPPORT_STAGE STAGE40_FULL_EIGEN3_STRICTNESS -#elif defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API - #define EIGEN2_SUPPORT - #define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API -#elif defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS - #define EIGEN2_SUPPORT - #define EIGEN2_SUPPORT_STAGE STAGE20_RESOLVE_API_CONFLICTS -#elif defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API - #define EIGEN2_SUPPORT - #define EIGEN2_SUPPORT_STAGE STAGE10_FULL_EIGEN2_API -#elif defined EIGEN2_SUPPORT - // default to stage 3, that's what it's always meant - #define EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API - #define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API -#else - #define EIGEN2_SUPPORT_STAGE STAGE99_NO_EIGEN2_SUPPORT -#endif - -#ifdef EIGEN2_SUPPORT -#undef minor -#endif +namespace Eigen { -// we use size_t frequently and we'll never remember to prepend it with std:: everytime just to +// we use size_t frequently and we'll never remember to prepend it with std:: every time just to // ensure QNX/QCC support using std::size_t; -// gcc 4.6.0 wants std:: for ptrdiff_t +// gcc 4.6.0 wants std:: for ptrdiff_t using std::ptrdiff_t; +} + /** \defgroup Core_Module Core module * This is the main module of Eigen providing dense matrix and vector support * (both fixed and dynamic size) with all the features corresponding to a BLAS library @@ -248,50 +157,148 @@ using std::ptrdiff_t; */ #include "src/Core/util/Constants.h" -#include "src/Core/util/ForwardDeclarations.h" #include "src/Core/util/Meta.h" -#include "src/Core/util/XprHelper.h" +#include "src/Core/util/ForwardDeclarations.h" #include "src/Core/util/StaticAssert.h" +#include "src/Core/util/XprHelper.h" #include "src/Core/util/Memory.h" +#include "src/Core/util/IntegralConstant.h" +#include "src/Core/util/Serializer.h" +#include "src/Core/util/SymbolicIndex.h" #include "src/Core/NumTraits.h" #include "src/Core/MathFunctions.h" #include "src/Core/GenericPacketMath.h" - -#if defined EIGEN_VECTORIZE_SSE +#include "src/Core/MathFunctionsImpl.h" +#include "src/Core/arch/Default/ConjHelper.h" +// Generic half float support +#include "src/Core/arch/Default/Half.h" +#include "src/Core/arch/Default/BFloat16.h" +#include "src/Core/arch/Default/TypeCasting.h" +#include "src/Core/arch/Default/GenericPacketMathFunctionsFwd.h" + +#if defined EIGEN_VECTORIZE_AVX512 #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/TypeCasting.h" + #include "src/Core/arch/SSE/Complex.h" + #include "src/Core/arch/AVX/PacketMath.h" + #include "src/Core/arch/AVX/TypeCasting.h" + #include "src/Core/arch/AVX/Complex.h" + #include "src/Core/arch/AVX512/PacketMath.h" + #include "src/Core/arch/AVX512/TypeCasting.h" + #include "src/Core/arch/AVX512/Complex.h" #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/AVX/MathFunctions.h" + #include "src/Core/arch/AVX512/MathFunctions.h" + #include "src/Core/arch/AVX512/TrsmKernel.h" +#elif defined EIGEN_VECTORIZE_AVX + // Use AVX for floats and doubles, SSE for integers + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/TypeCasting.h" #include "src/Core/arch/SSE/Complex.h" -#elif defined EIGEN_VECTORIZE_ALTIVEC + #include "src/Core/arch/AVX/PacketMath.h" + #include "src/Core/arch/AVX/TypeCasting.h" + #include "src/Core/arch/AVX/Complex.h" + #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/AVX/MathFunctions.h" +#elif defined EIGEN_VECTORIZE_SSE + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/TypeCasting.h" + #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/SSE/Complex.h" +#elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) #include "src/Core/arch/AltiVec/PacketMath.h" + #include "src/Core/arch/AltiVec/MathFunctions.h" #include "src/Core/arch/AltiVec/Complex.h" #elif defined EIGEN_VECTORIZE_NEON #include "src/Core/arch/NEON/PacketMath.h" + #include "src/Core/arch/NEON/TypeCasting.h" + #include "src/Core/arch/NEON/MathFunctions.h" #include "src/Core/arch/NEON/Complex.h" +#elif defined EIGEN_VECTORIZE_SVE + #include "src/Core/arch/SVE/PacketMath.h" + #include "src/Core/arch/SVE/TypeCasting.h" + #include "src/Core/arch/SVE/MathFunctions.h" +#elif defined EIGEN_VECTORIZE_ZVECTOR + #include "src/Core/arch/ZVector/PacketMath.h" + #include "src/Core/arch/ZVector/MathFunctions.h" + #include "src/Core/arch/ZVector/Complex.h" +#elif defined EIGEN_VECTORIZE_MSA + #include "src/Core/arch/MSA/PacketMath.h" + #include "src/Core/arch/MSA/MathFunctions.h" + #include "src/Core/arch/MSA/Complex.h" +#endif + +#if defined EIGEN_VECTORIZE_GPU + #include "src/Core/arch/GPU/PacketMath.h" + #include "src/Core/arch/GPU/MathFunctions.h" + #include "src/Core/arch/GPU/TypeCasting.h" +#endif + +#if defined(EIGEN_USE_SYCL) + #include "src/Core/arch/SYCL/SyclMemoryModel.h" + #include "src/Core/arch/SYCL/InteropHeaders.h" +#if !defined(EIGEN_DONT_VECTORIZE_SYCL) + #include "src/Core/arch/SYCL/PacketMath.h" + #include "src/Core/arch/SYCL/MathFunctions.h" + #include "src/Core/arch/SYCL/TypeCasting.h" +#endif #endif #include "src/Core/arch/Default/Settings.h" +// This file provides generic implementations valid for scalar as well +#include "src/Core/arch/Default/GenericPacketMathFunctions.h" + +#include "src/Core/functors/TernaryFunctors.h" +#include "src/Core/functors/BinaryFunctors.h" +#include "src/Core/functors/UnaryFunctors.h" +#include "src/Core/functors/NullaryFunctors.h" +#include "src/Core/functors/StlFunctors.h" +#include "src/Core/functors/AssignmentFunctors.h" + +// Specialized functors for GPU. +#ifdef EIGEN_GPUCC +#include "src/Core/arch/GPU/Complex.h" +#endif -#include "src/Core/Functors.h" +// Specializations of vectorized activation functions for NEON. +#ifdef EIGEN_VECTORIZE_NEON +#include "src/Core/arch/NEON/UnaryFunctors.h" +#endif + +#include "src/Core/util/IndexedViewHelper.h" +#include "src/Core/util/ReshapedHelper.h" +#include "src/Core/ArithmeticSequence.h" +#ifndef EIGEN_NO_IO + #include "src/Core/IO.h" +#endif #include "src/Core/DenseCoeffsBase.h" #include "src/Core/DenseBase.h" #include "src/Core/MatrixBase.h" #include "src/Core/EigenBase.h" +#include "src/Core/Product.h" +#include "src/Core/CoreEvaluators.h" +#include "src/Core/AssignEvaluator.h" + #ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874 // at least confirmed with Doxygen 1.5.5 and 1.5.6 #include "src/Core/Assign.h" #endif +#include "src/Core/ArrayBase.h" #include "src/Core/util/BlasUtil.h" #include "src/Core/DenseStorage.h" #include "src/Core/NestByValue.h" -#include "src/Core/ForceAlignedAccess.h" + +// #include "src/Core/ForceAlignedAccess.h" + #include "src/Core/ReturnByValue.h" #include "src/Core/NoAlias.h" #include "src/Core/PlainObjectBase.h" #include "src/Core/Matrix.h" #include "src/Core/Array.h" +#include "src/Core/CwiseTernaryOp.h" #include "src/Core/CwiseBinaryOp.h" #include "src/Core/CwiseUnaryOp.h" #include "src/Core/CwiseNullaryOp.h" @@ -299,34 +306,37 @@ using std::ptrdiff_t; #include "src/Core/SelfCwiseBinaryOp.h" #include "src/Core/Dot.h" #include "src/Core/StableNorm.h" -#include "src/Core/MapBase.h" #include "src/Core/Stride.h" +#include "src/Core/MapBase.h" #include "src/Core/Map.h" +#include "src/Core/Ref.h" #include "src/Core/Block.h" #include "src/Core/VectorBlock.h" +#include "src/Core/IndexedView.h" +#include "src/Core/Reshaped.h" #include "src/Core/Transpose.h" #include "src/Core/DiagonalMatrix.h" #include "src/Core/Diagonal.h" #include "src/Core/DiagonalProduct.h" -#include "src/Core/PermutationMatrix.h" -#include "src/Core/Transpositions.h" #include "src/Core/Redux.h" #include "src/Core/Visitor.h" #include "src/Core/Fuzzy.h" -#include "src/Core/IO.h" #include "src/Core/Swap.h" #include "src/Core/CommaInitializer.h" -#include "src/Core/Flagged.h" -#include "src/Core/ProductBase.h" -#include "src/Core/Product.h" +#include "src/Core/GeneralProduct.h" +#include "src/Core/Solve.h" +#include "src/Core/Inverse.h" +#include "src/Core/SolverBase.h" +#include "src/Core/PermutationMatrix.h" +#include "src/Core/Transpositions.h" #include "src/Core/TriangularMatrix.h" #include "src/Core/SelfAdjointView.h" -#include "src/Core/SolveTriangular.h" -#include "src/Core/products/Parallelizer.h" -#include "src/Core/products/CoeffBasedProduct.h" #include "src/Core/products/GeneralBlockPanelKernel.h" +#include "src/Core/products/Parallelizer.h" +#include "src/Core/ProductEvaluators.h" #include "src/Core/products/GeneralMatrixVector.h" #include "src/Core/products/GeneralMatrixMatrix.h" +#include "src/Core/SolveTriangular.h" #include "src/Core/products/GeneralMatrixMatrixTriangular.h" #include "src/Core/products/SelfadjointMatrixVector.h" #include "src/Core/products/SelfadjointMatrixMatrix.h" @@ -337,24 +347,46 @@ using std::ptrdiff_t; #include "src/Core/products/TriangularSolverMatrix.h" #include "src/Core/products/TriangularSolverVector.h" #include "src/Core/BandMatrix.h" +#include "src/Core/CoreIterators.h" +#include "src/Core/ConditionEstimator.h" + +#if defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) + #include "src/Core/arch/AltiVec/MatrixProduct.h" +#elif defined EIGEN_VECTORIZE_NEON + #include "src/Core/arch/NEON/GeneralBlockPanelKernel.h" +#endif + +#if defined(EIGEN_VECTORIZE_AVX512) + #include "src/Core/arch/AVX512/GemmKernel.h" +#endif #include "src/Core/BooleanRedux.h" #include "src/Core/Select.h" #include "src/Core/VectorwiseOp.h" +#include "src/Core/PartialReduxEvaluator.h" #include "src/Core/Random.h" #include "src/Core/Replicate.h" #include "src/Core/Reverse.h" -#include "src/Core/ArrayBase.h" #include "src/Core/ArrayWrapper.h" - -} // namespace Eigen +#include "src/Core/StlIterators.h" + +#ifdef EIGEN_USE_BLAS +#include "src/Core/products/GeneralMatrixMatrix_BLAS.h" +#include "src/Core/products/GeneralMatrixVector_BLAS.h" +#include "src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h" +#include "src/Core/products/SelfadjointMatrixMatrix_BLAS.h" +#include "src/Core/products/SelfadjointMatrixVector_BLAS.h" +#include "src/Core/products/TriangularMatrixMatrix_BLAS.h" +#include "src/Core/products/TriangularMatrixVector_BLAS.h" +#include "src/Core/products/TriangularSolverMatrix_BLAS.h" +#endif // EIGEN_USE_BLAS + +#ifdef EIGEN_USE_MKL_VML +#include "src/Core/Assign_MKL.h" +#endif #include "src/Core/GlobalFunctions.h" #include "src/Core/util/ReenableStupidWarnings.h" -#ifdef EIGEN2_SUPPORT -#include "Eigen2Support" -#endif - -#endif // EIGEN_CORE_H +#endif // EIGEN_CORE_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/Eigen b/lib/SRC/KPM/FreakMatcher/Eigen/Eigen index 19b40ea..654c8dc 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/Eigen +++ b/lib/SRC/KPM/FreakMatcher/Eigen/Eigen @@ -1,2 +1,2 @@ #include "Dense" -//#include "Sparse" +#include "Sparse" diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/Eigen2Support b/lib/SRC/KPM/FreakMatcher/Eigen/Eigen2Support deleted file mode 100644 index d96592a..0000000 --- a/lib/SRC/KPM/FreakMatcher/Eigen/Eigen2Support +++ /dev/null @@ -1,82 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2009 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN2SUPPORT_H -#define EIGEN2SUPPORT_H - -#if (!defined(EIGEN2_SUPPORT)) || (!defined(EIGEN_CORE_H)) -#error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header -#endif - -#include "src/Core/util/DisableStupidWarnings.h" - -namespace Eigen { - -/** \defgroup Eigen2Support_Module Eigen2 support module - * This module provides a couple of deprecated functions improving the compatibility with Eigen2. - * - * To use it, define EIGEN2_SUPPORT before including any Eigen header - * \code - * #define EIGEN2_SUPPORT - * \endcode - * - */ - -#include "src/Eigen2Support/Macros.h" -#include "src/Eigen2Support/Memory.h" -#include "src/Eigen2Support/Meta.h" -#include "src/Eigen2Support/Lazy.h" -#include "src/Eigen2Support/Cwise.h" -#include "src/Eigen2Support/CwiseOperators.h" -#include "src/Eigen2Support/TriangularSolver.h" -#include "src/Eigen2Support/Block.h" -#include "src/Eigen2Support/VectorBlock.h" -#include "src/Eigen2Support/Minor.h" -#include "src/Eigen2Support/MathFunctions.h" - - -} // namespace Eigen - -#include "src/Core/util/ReenableStupidWarnings.h" - -// Eigen2 used to include iostream -#include - -#define USING_PART_OF_NAMESPACE_EIGEN \ -EIGEN_USING_MATRIX_TYPEDEFS \ -using Eigen::Matrix; \ -using Eigen::MatrixBase; \ -using Eigen::ei_random; \ -using Eigen::ei_real; \ -using Eigen::ei_imag; \ -using Eigen::ei_conj; \ -using Eigen::ei_abs; \ -using Eigen::ei_abs2; \ -using Eigen::ei_sqrt; \ -using Eigen::ei_exp; \ -using Eigen::ei_log; \ -using Eigen::ei_sin; \ -using Eigen::ei_cos; - -#endif // EIGEN2SUPPORT_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/Eigenvalues b/lib/SRC/KPM/FreakMatcher/Eigen/Eigenvalues index 250c0f4..5467a2e 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/Eigenvalues +++ b/lib/SRC/KPM/FreakMatcher/Eigen/Eigenvalues @@ -1,16 +1,22 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_EIGENVALUES_MODULE_H #define EIGEN_EIGENVALUES_MODULE_H #include "Core" -#include "src/Core/util/DisableStupidWarnings.h" - #include "Cholesky" #include "Jacobi" #include "Householder" #include "LU" +#include "Geometry" -namespace Eigen { +#include "src/Core/util/DisableStupidWarnings.h" /** \defgroup Eigenvalues_Module Eigenvalues module * @@ -26,6 +32,7 @@ namespace Eigen { * \endcode */ +#include "src/misc/RealSvd2x2.h" #include "src/Eigenvalues/Tridiagonalization.h" #include "src/Eigenvalues/RealSchur.h" #include "src/Eigenvalues/EigenSolver.h" @@ -34,11 +41,20 @@ namespace Eigen { #include "src/Eigenvalues/HessenbergDecomposition.h" #include "src/Eigenvalues/ComplexSchur.h" #include "src/Eigenvalues/ComplexEigenSolver.h" +#include "src/Eigenvalues/RealQZ.h" +#include "src/Eigenvalues/GeneralizedEigenSolver.h" #include "src/Eigenvalues/MatrixBaseEigenvalues.h" - -} // namespace Eigen +#ifdef EIGEN_USE_LAPACKE +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" +#endif +#include "src/Eigenvalues/RealSchur_LAPACKE.h" +#include "src/Eigenvalues/ComplexSchur_LAPACKE.h" +#include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" +#endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_EIGENVALUES_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/Geometry b/lib/SRC/KPM/FreakMatcher/Eigen/Geometry index 78277c0..bc78110 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/Geometry +++ b/lib/SRC/KPM/FreakMatcher/Eigen/Geometry @@ -1,31 +1,32 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_GEOMETRY_MODULE_H #define EIGEN_GEOMETRY_MODULE_H #include "Core" -#include "src/Core/util/DisableStupidWarnings.h" - #include "SVD" #include "LU" #include -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -namespace Eigen { +#include "src/Core/util/DisableStupidWarnings.h" /** \defgroup Geometry_Module Geometry module - * - * * * This module provides support for: * - fixed-size homogeneous transformations * - translation, scaling, 2D and 3D rotations - * - quaternions - * - \ref MatrixBase::cross() "cross product" - * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation" - * - some linear components: parametrized-lines and hyperplanes + * - \link Quaternion quaternions \endlink + * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) + * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) + * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink + * - \link AlignedBox axis aligned bounding boxes \endlink + * - \link umeyama least-square transformation fitting \endlink * * \code * #include @@ -35,33 +36,24 @@ namespace Eigen { #include "src/Geometry/OrthoMethods.h" #include "src/Geometry/EulerAngles.h" -#if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS - #include "src/Geometry/Homogeneous.h" - #include "src/Geometry/RotationBase.h" - #include "src/Geometry/Rotation2D.h" - #include "src/Geometry/Quaternion.h" - #include "src/Geometry/AngleAxis.h" - #include "src/Geometry/Transform.h" - #include "src/Geometry/Translation.h" - #include "src/Geometry/Scaling.h" - #include "src/Geometry/Hyperplane.h" - #include "src/Geometry/ParametrizedLine.h" - #include "src/Geometry/AlignedBox.h" - #include "src/Geometry/Umeyama.h" - - #if defined EIGEN_VECTORIZE_SSE - #include "src/Geometry/arch/Geometry_SSE.h" - #endif -#endif - -#ifdef EIGEN2_SUPPORT -#include "src/Eigen2Support/Geometry/All.h" +#include "src/Geometry/Homogeneous.h" +#include "src/Geometry/RotationBase.h" +#include "src/Geometry/Rotation2D.h" +#include "src/Geometry/Quaternion.h" +#include "src/Geometry/AngleAxis.h" +#include "src/Geometry/Transform.h" +#include "src/Geometry/Translation.h" +#include "src/Geometry/Scaling.h" +#include "src/Geometry/Hyperplane.h" +#include "src/Geometry/ParametrizedLine.h" +#include "src/Geometry/AlignedBox.h" +#include "src/Geometry/Umeyama.h" + +// Use the SSE optimized version whenever possible. +#if (defined EIGEN_VECTORIZE_SSE) || (defined EIGEN_VECTORIZE_NEON) +#include "src/Geometry/arch/Geometry_SIMD.h" #endif -} // namespace Eigen - #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_GEOMETRY_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ - diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/Householder b/lib/SRC/KPM/FreakMatcher/Eigen/Householder index 6b86cf6..f2fa799 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/Householder +++ b/lib/SRC/KPM/FreakMatcher/Eigen/Householder @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_HOUSEHOLDER_MODULE_H #define EIGEN_HOUSEHOLDER_MODULE_H @@ -5,8 +12,6 @@ #include "src/Core/util/DisableStupidWarnings.h" -namespace Eigen { - /** \defgroup Householder_Module Householder module * This module provides Householder transformations. * @@ -19,9 +24,6 @@ namespace Eigen { #include "src/Householder/HouseholderSequence.h" #include "src/Householder/BlockHouseholder.h" -} // namespace Eigen - #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_HOUSEHOLDER_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/IterativeLinearSolvers b/lib/SRC/KPM/FreakMatcher/Eigen/IterativeLinearSolvers new file mode 100644 index 0000000..26a0560 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/IterativeLinearSolvers @@ -0,0 +1,48 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H +#define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H + +#include "SparseCore" +#include "OrderingMethods" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** + * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module + * + * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. + * Those solvers are accessible via the following classes: + * - ConjugateGradient for selfadjoint (hermitian) matrices, + * - LeastSquaresConjugateGradient for rectangular least-square problems, + * - BiCGSTAB for general square matrices. + * + * These iterative solvers are associated with some preconditioners: + * - IdentityPreconditioner - not really useful + * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. + * - IncompleteLUT - incomplete LU factorization with dual thresholding + * + * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport, AccelerateSupport. + * + \code + #include + \endcode + */ + +#include "src/IterativeLinearSolvers/SolveWithGuess.h" +#include "src/IterativeLinearSolvers/IterativeSolverBase.h" +#include "src/IterativeLinearSolvers/BasicPreconditioners.h" +#include "src/IterativeLinearSolvers/ConjugateGradient.h" +#include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" +#include "src/IterativeLinearSolvers/BiCGSTAB.h" +#include "src/IterativeLinearSolvers/IncompleteLUT.h" +#include "src/IterativeLinearSolvers/IncompleteCholesky.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/Jacobi b/lib/SRC/KPM/FreakMatcher/Eigen/Jacobi index afa6768..43edc7a 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/Jacobi +++ b/lib/SRC/KPM/FreakMatcher/Eigen/Jacobi @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_JACOBI_MODULE_H #define EIGEN_JACOBI_MODULE_H @@ -5,8 +12,6 @@ #include "src/Core/util/DisableStupidWarnings.h" -namespace Eigen { - /** \defgroup Jacobi_Module Jacobi module * This module provides Jacobi and Givens rotations. * @@ -21,10 +26,7 @@ namespace Eigen { #include "src/Jacobi/Jacobi.h" -} // namespace Eigen - #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_JACOBI_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/KLUSupport b/lib/SRC/KPM/FreakMatcher/Eigen/KLUSupport new file mode 100644 index 0000000..b23d905 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/KLUSupport @@ -0,0 +1,41 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_KLUSUPPORT_MODULE_H +#define EIGEN_KLUSUPPORT_MODULE_H + +#include + +#include + +extern "C" { +#include +#include + } + +/** \ingroup Support_modules + * \defgroup KLUSupport_Module KLUSupport module + * + * This module provides an interface to the KLU library which is part of the suitesparse package. + * It provides the following factorization class: + * - class KLU: a sparse LU factorization, well-suited for circuit simulation. + * + * \code + * #include + * \endcode + * + * In order to use this module, the klu and btf headers must be accessible from the include paths, and your binary must be linked to the klu library and its dependencies. + * The dependencies depend on how umfpack has been compiled. + * For a cmake based project, you can use our FindKLU.cmake module to help you in this task. + * + */ + +#include "src/KLUSupport/KLUSupport.h" + +#include + +#endif // EIGEN_KLUSUPPORT_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/LU b/lib/SRC/KPM/FreakMatcher/Eigen/LU index 226f88c..b7f9a8a 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/LU +++ b/lib/SRC/KPM/FreakMatcher/Eigen/LU @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_LU_MODULE_H #define EIGEN_LU_MODULE_H @@ -5,8 +12,6 @@ #include "src/Core/util/DisableStupidWarnings.h" -namespace Eigen { - /** \defgroup LU_Module LU module * This module includes %LU decomposition and related notions such as matrix inversion and determinant. * This module defines the following MatrixBase methods: @@ -18,25 +23,21 @@ namespace Eigen { * \endcode */ -#include "src/misc/Solve.h" #include "src/misc/Kernel.h" #include "src/misc/Image.h" #include "src/LU/FullPivLU.h" #include "src/LU/PartialPivLU.h" -#include "src/LU/Determinant.h" -#include "src/LU/Inverse.h" - -#if defined EIGEN_VECTORIZE_SSE - #include "src/LU/arch/Inverse_SSE.h" +#ifdef EIGEN_USE_LAPACKE +#include "src/misc/lapacke_helpers.h" +#include "src/LU/PartialPivLU_LAPACKE.h" #endif +#include "src/LU/Determinant.h" +#include "src/LU/InverseImpl.h" -#ifdef EIGEN2_SUPPORT - #include "src/Eigen2Support/LU.h" +#if defined EIGEN_VECTORIZE_SSE || defined EIGEN_VECTORIZE_NEON + #include "src/LU/arch/InverseSize4.h" #endif -} // namespace Eigen - #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_LU_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/LeastSquares b/lib/SRC/KPM/FreakMatcher/Eigen/LeastSquares deleted file mode 100644 index 93a6302..0000000 --- a/lib/SRC/KPM/FreakMatcher/Eigen/LeastSquares +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef EIGEN_REGRESSION_MODULE_H -#define EIGEN_REGRESSION_MODULE_H - -#ifndef EIGEN2_SUPPORT -#error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT) -#endif - -// exclude from normal eigen3-only documentation -#ifdef EIGEN2_SUPPORT - -#include "Core" - -#include "src/Core/util/DisableStupidWarnings.h" - -#include "Eigenvalues" -#include "Geometry" - -namespace Eigen { - -/** \defgroup LeastSquares_Module LeastSquares module - * This module provides linear regression and related features. - * - * \code - * #include - * \endcode - */ - -#include "src/Eigen2Support/LeastSquares.h" - -} // namespace Eigen - -#include "src/Core/util/ReenableStupidWarnings.h" - -#endif // EIGEN2_SUPPORT - -#endif // EIGEN_REGRESSION_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/MetisSupport b/lib/SRC/KPM/FreakMatcher/Eigen/MetisSupport new file mode 100644 index 0000000..85c41bf --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/MetisSupport @@ -0,0 +1,35 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_METISSUPPORT_MODULE_H +#define EIGEN_METISSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { +#include +} + + +/** \ingroup Support_modules + * \defgroup MetisSupport_Module MetisSupport module + * + * \code + * #include + * \endcode + * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). + * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink + */ + + +#include "src/MetisSupport/MetisSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_METISSUPPORT_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/OrderingMethods b/lib/SRC/KPM/FreakMatcher/Eigen/OrderingMethods new file mode 100644 index 0000000..29691a6 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/OrderingMethods @@ -0,0 +1,70 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ORDERINGMETHODS_MODULE_H +#define EIGEN_ORDERINGMETHODS_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** + * \defgroup OrderingMethods_Module OrderingMethods module + * + * This module is currently for internal use only + * + * It defines various built-in and external ordering methods for sparse matrices. + * They are typically used to reduce the number of elements during + * the sparse matrix decomposition (LLT, LU, QR). + * Precisely, in a preprocessing step, a permutation matrix P is computed using + * those ordering methods and applied to the columns of the matrix. + * Using for instance the sparse Cholesky decomposition, it is expected that + * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). + * + * + * Usage : + * \code + * #include + * \endcode + * + * A simple usage is as a template parameter in the sparse decomposition classes : + * + * \code + * SparseLU > solver; + * \endcode + * + * \code + * SparseQR > solver; + * \endcode + * + * It is possible as well to call directly a particular ordering method for your own purpose, + * \code + * AMDOrdering ordering; + * PermutationMatrix perm; + * SparseMatrix A; + * //Fill the matrix ... + * + * ordering(A, perm); // Call AMD + * \endcode + * + * \note Some of these methods (like AMD or METIS), need the sparsity pattern + * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, + * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. + * If your matrix is already symmetric (at leat in structure), you can avoid that + * by calling the method with a SelfAdjointView type. + * + * \code + * // Call the ordering on the pattern of the lower triangular matrix A + * ordering(A.selfadjointView(), perm); + * \endcode + */ + +#include "src/OrderingMethods/Amd.h" +#include "src/OrderingMethods/Ordering.h" +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_ORDERINGMETHODS_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/PaStiXSupport b/lib/SRC/KPM/FreakMatcher/Eigen/PaStiXSupport new file mode 100644 index 0000000..234619a --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/PaStiXSupport @@ -0,0 +1,49 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PASTIXSUPPORT_MODULE_H +#define EIGEN_PASTIXSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { +#include +#include +} + +#ifdef complex +#undef complex +#endif + +/** \ingroup Support_modules + * \defgroup PaStiXSupport_Module PaStiXSupport module + * + * This module provides an interface to the PaSTiX library. + * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. + * It provides the two following main factorization classes: + * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. + * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. + * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). + * + * \code + * #include + * \endcode + * + * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. + * This wrapper resuires PaStiX version 5.x compiled without MPI support. + * The dependencies depend on how PaSTiX has been compiled. + * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. + * + */ + +#include "src/PaStiXSupport/PaStiXSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_PASTIXSUPPORT_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/PardisoSupport b/lib/SRC/KPM/FreakMatcher/Eigen/PardisoSupport new file mode 100644 index 0000000..340edf5 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/PardisoSupport @@ -0,0 +1,35 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PARDISOSUPPORT_MODULE_H +#define EIGEN_PARDISOSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include + +/** \ingroup Support_modules + * \defgroup PardisoSupport_Module PardisoSupport module + * + * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. + * + * \code + * #include + * \endcode + * + * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. + * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. + * + */ + +#include "src/PardisoSupport/PardisoSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_PARDISOSUPPORT_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/QR b/lib/SRC/KPM/FreakMatcher/Eigen/QR index 97c1788..1f6c22e 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/QR +++ b/lib/SRC/KPM/FreakMatcher/Eigen/QR @@ -1,15 +1,20 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_QR_MODULE_H #define EIGEN_QR_MODULE_H #include "Core" -#include "src/Core/util/DisableStupidWarnings.h" - #include "Cholesky" #include "Jacobi" #include "Householder" -namespace Eigen { +#include "src/Core/util/DisableStupidWarnings.h" /** \defgroup QR_Module QR module * @@ -17,29 +22,25 @@ namespace Eigen { * * This module provides various QR decompositions * This module also provides some MatrixBase methods, including: - * - MatrixBase::qr(), + * - MatrixBase::householderQr() + * - MatrixBase::colPivHouseholderQr() + * - MatrixBase::fullPivHouseholderQr() * * \code * #include * \endcode */ -#include "src/misc/Solve.h" #include "src/QR/HouseholderQR.h" #include "src/QR/FullPivHouseholderQR.h" #include "src/QR/ColPivHouseholderQR.h" - -#ifdef EIGEN2_SUPPORT -#include "src/Eigen2Support/QR.h" +#include "src/QR/CompleteOrthogonalDecomposition.h" +#ifdef EIGEN_USE_LAPACKE +#include "src/misc/lapacke_helpers.h" +#include "src/QR/HouseholderQR_LAPACKE.h" +#include "src/QR/ColPivHouseholderQR_LAPACKE.h" #endif -} // namespace Eigen - #include "src/Core/util/ReenableStupidWarnings.h" -#ifdef EIGEN2_SUPPORT -#include "Eigenvalues" -#endif - #endif // EIGEN_QR_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/QtAlignedMalloc b/lib/SRC/KPM/FreakMatcher/Eigen/QtAlignedMalloc index 46f7d83..6fe8237 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/QtAlignedMalloc +++ b/lib/SRC/KPM/FreakMatcher/Eigen/QtAlignedMalloc @@ -1,3 +1,9 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_QTMALLOC_MODULE_H #define EIGEN_QTMALLOC_MODULE_H @@ -8,7 +14,7 @@ #include "src/Core/util/DisableStupidWarnings.h" -void *qMalloc(size_t size) +void *qMalloc(std::size_t size) { return Eigen::internal::aligned_malloc(size); } @@ -18,10 +24,10 @@ void qFree(void *ptr) Eigen::internal::aligned_free(ptr); } -void *qRealloc(void *ptr, size_t size) +void *qRealloc(void *ptr, std::size_t size) { void* newPtr = Eigen::internal::aligned_malloc(size); - memcpy(newPtr, ptr, size); + std::memcpy(newPtr, ptr, size); Eigen::internal::aligned_free(ptr); return newPtr; } @@ -31,4 +37,3 @@ void *qRealloc(void *ptr, size_t size) #endif #endif // EIGEN_QTMALLOC_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/SPQRSupport b/lib/SRC/KPM/FreakMatcher/Eigen/SPQRSupport new file mode 100644 index 0000000..33c3370 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/SPQRSupport @@ -0,0 +1,34 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPQRSUPPORT_MODULE_H +#define EIGEN_SPQRSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "SuiteSparseQR.hpp" + +/** \ingroup Support_modules + * \defgroup SPQRSupport_Module SuiteSparseQR module + * + * This module provides an interface to the SPQR library, which is part of the suitesparse package. + * + * \code + * #include + * \endcode + * + * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). + * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules + * + */ + +#include "Eigen/CholmodSupport" +#include "src/SPQRSupport/SuiteSparseQRSupport.h" + +#endif diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/SVD b/lib/SRC/KPM/FreakMatcher/Eigen/SVD index 7c987a9..3451794 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/SVD +++ b/lib/SRC/KPM/FreakMatcher/Eigen/SVD @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_SVD_MODULE_H #define EIGEN_SVD_MODULE_H @@ -7,32 +14,37 @@ #include "src/Core/util/DisableStupidWarnings.h" -namespace Eigen { - /** \defgroup SVD_Module SVD module * * * * This module provides SVD decomposition for matrices (both real and complex). - * This decomposition is accessible via the following MatrixBase method: + * Two decomposition algorithms are provided: + * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. + * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. + * These decompositions are accessible via the respective classes and following MatrixBase methods: * - MatrixBase::jacobiSvd() + * - MatrixBase::bdcSvd() * * \code * #include * \endcode */ -#include "src/misc/Solve.h" -#include "src/SVD/JacobiSVD.h" +#include "src/misc/RealSvd2x2.h" #include "src/SVD/UpperBidiagonalization.h" - -#ifdef EIGEN2_SUPPORT -#include "src/Eigen2Support/SVD.h" +#include "src/SVD/SVDBase.h" +#include "src/SVD/JacobiSVD.h" +#include "src/SVD/BDCSVD.h" +#if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" +#endif +#include "src/SVD/JacobiSVD_LAPACKE.h" #endif - -} // namespace Eigen #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_SVD_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/Sparse b/lib/SRC/KPM/FreakMatcher/Eigen/Sparse index 7425b3a..a2ef7a6 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/Sparse +++ b/lib/SRC/KPM/FreakMatcher/Eigen/Sparse @@ -1,69 +1,34 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_SPARSE_MODULE_H #define EIGEN_SPARSE_MODULE_H -#include "Core" - -#include "src/Core/util/DisableStupidWarnings.h" - -#include -#include -#include -#include -#include - -#ifdef EIGEN2_SUPPORT -#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET -#endif - -#ifndef EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET -#error The sparse module API is not stable yet. To use it anyway, please define the EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET preprocessor token. -#endif - -namespace Eigen { - -/** \defgroup Sparse_Module Sparse module - * - * +/** \defgroup Sparse_Module Sparse meta-module * - * See the \ref TutorialSparse "Sparse tutorial" + * Meta-module including all related modules: + * - \ref SparseCore_Module + * - \ref OrderingMethods_Module + * - \ref SparseCholesky_Module + * - \ref SparseLU_Module + * - \ref SparseQR_Module + * - \ref IterativeLinearSolvers_Module * - * \code - * #include - * \endcode + \code + #include + \endcode */ -/** The type used to identify a general sparse storage. */ -struct Sparse {}; - -#include "src/Sparse/SparseUtil.h" -#include "src/Sparse/SparseMatrixBase.h" -#include "src/Sparse/CompressedStorage.h" -#include "src/Sparse/AmbiVector.h" -#include "src/Sparse/SparseMatrix.h" -#include "src/Sparse/DynamicSparseMatrix.h" -#include "src/Sparse/MappedSparseMatrix.h" -#include "src/Sparse/SparseVector.h" -#include "src/Sparse/CoreIterators.h" -#include "src/Sparse/SparseBlock.h" -#include "src/Sparse/SparseTranspose.h" -#include "src/Sparse/SparseCwiseUnaryOp.h" -#include "src/Sparse/SparseCwiseBinaryOp.h" -#include "src/Sparse/SparseDot.h" -#include "src/Sparse/SparseAssign.h" -#include "src/Sparse/SparseRedux.h" -#include "src/Sparse/SparseFuzzy.h" -#include "src/Sparse/SparseProduct.h" -#include "src/Sparse/SparseSparseProduct.h" -#include "src/Sparse/SparseDenseProduct.h" -#include "src/Sparse/SparseDiagonalProduct.h" -#include "src/Sparse/SparseTriangularView.h" -#include "src/Sparse/SparseSelfAdjointView.h" -#include "src/Sparse/TriangularSolver.h" -#include "src/Sparse/SparseView.h" - -} // namespace Eigen - -#include "src/Core/util/ReenableStupidWarnings.h" +#include "SparseCore" +#include "OrderingMethods" +#include "SparseCholesky" +#include "SparseLU" +#include "SparseQR" +#include "IterativeLinearSolvers" #endif // EIGEN_SPARSE_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/SparseCholesky b/lib/SRC/KPM/FreakMatcher/Eigen/SparseCholesky new file mode 100644 index 0000000..d2b1f12 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/SparseCholesky @@ -0,0 +1,37 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2013 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSECHOLESKY_MODULE_H +#define EIGEN_SPARSECHOLESKY_MODULE_H + +#include "SparseCore" +#include "OrderingMethods" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** + * \defgroup SparseCholesky_Module SparseCholesky module + * + * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. + * Those decompositions are accessible via the following classes: + * - SimplicialLLt, + * - SimplicialLDLt + * + * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. + * + * \code + * #include + * \endcode + */ + +#include "src/SparseCholesky/SimplicialCholesky.h" +#include "src/SparseCholesky/SimplicialCholesky_impl.h" +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SPARSECHOLESKY_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/SparseCore b/lib/SRC/KPM/FreakMatcher/Eigen/SparseCore new file mode 100644 index 0000000..b2db46b --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/SparseCore @@ -0,0 +1,68 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSECORE_MODULE_H +#define EIGEN_SPARSECORE_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include +#include +#include +#include +#include + +/** + * \defgroup SparseCore_Module SparseCore module + * + * This module provides a sparse matrix representation, and basic associated matrix manipulations + * and operations. + * + * See the \ref TutorialSparse "Sparse tutorial" + * + * \code + * #include + * \endcode + * + * This module depends on: Core. + */ + +#include "src/SparseCore/SparseUtil.h" +#include "src/SparseCore/SparseMatrixBase.h" +#include "src/SparseCore/SparseAssign.h" +#include "src/SparseCore/CompressedStorage.h" +#include "src/SparseCore/AmbiVector.h" +#include "src/SparseCore/SparseCompressedBase.h" +#include "src/SparseCore/SparseMatrix.h" +#include "src/SparseCore/SparseMap.h" +#include "src/SparseCore/SparseVector.h" +#include "src/SparseCore/SparseRef.h" +#include "src/SparseCore/SparseCwiseUnaryOp.h" +#include "src/SparseCore/SparseCwiseBinaryOp.h" +#include "src/SparseCore/SparseTranspose.h" +#include "src/SparseCore/SparseBlock.h" +#include "src/SparseCore/SparseDot.h" +#include "src/SparseCore/SparseRedux.h" +#include "src/SparseCore/SparseView.h" +#include "src/SparseCore/SparseDiagonalProduct.h" +#include "src/SparseCore/ConservativeSparseSparseProduct.h" +#include "src/SparseCore/SparseSparseProductWithPruning.h" +#include "src/SparseCore/SparseProduct.h" +#include "src/SparseCore/SparseDenseProduct.h" +#include "src/SparseCore/SparseSelfAdjointView.h" +#include "src/SparseCore/SparseTriangularView.h" +#include "src/SparseCore/TriangularSolver.h" +#include "src/SparseCore/SparsePermutation.h" +#include "src/SparseCore/SparseFuzzy.h" +#include "src/SparseCore/SparseSolverBase.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SPARSECORE_MODULE_H + diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/SparseLU b/lib/SRC/KPM/FreakMatcher/Eigen/SparseLU new file mode 100644 index 0000000..37c4a5c --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/SparseLU @@ -0,0 +1,50 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Désiré Nuentsa-Wakam +// Copyright (C) 2012 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSELU_MODULE_H +#define EIGEN_SPARSELU_MODULE_H + +#include "SparseCore" + +/** + * \defgroup SparseLU_Module SparseLU module + * This module defines a supernodal factorization of general sparse matrices. + * The code is fully optimized for supernode-panel updates with specialized kernels. + * Please, see the documentation of the SparseLU class for more details. + */ + +// Ordering interface +#include "OrderingMethods" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "src/SparseLU/SparseLU_gemm_kernel.h" + +#include "src/SparseLU/SparseLU_Structs.h" +#include "src/SparseLU/SparseLU_SupernodalMatrix.h" +#include "src/SparseLU/SparseLUImpl.h" +#include "src/SparseCore/SparseColEtree.h" +#include "src/SparseLU/SparseLU_Memory.h" +#include "src/SparseLU/SparseLU_heap_relax_snode.h" +#include "src/SparseLU/SparseLU_relax_snode.h" +#include "src/SparseLU/SparseLU_pivotL.h" +#include "src/SparseLU/SparseLU_panel_dfs.h" +#include "src/SparseLU/SparseLU_kernel_bmod.h" +#include "src/SparseLU/SparseLU_panel_bmod.h" +#include "src/SparseLU/SparseLU_column_dfs.h" +#include "src/SparseLU/SparseLU_column_bmod.h" +#include "src/SparseLU/SparseLU_copy_to_ucol.h" +#include "src/SparseLU/SparseLU_pruneL.h" +#include "src/SparseLU/SparseLU_Utils.h" +#include "src/SparseLU/SparseLU.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SPARSELU_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/SparseQR b/lib/SRC/KPM/FreakMatcher/Eigen/SparseQR new file mode 100644 index 0000000..f5fc5fa --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/SparseQR @@ -0,0 +1,36 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSEQR_MODULE_H +#define EIGEN_SPARSEQR_MODULE_H + +#include "SparseCore" +#include "OrderingMethods" +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup SparseQR_Module SparseQR module + * \brief Provides QR decomposition for sparse matrices + * + * This module provides a simplicial version of the left-looking Sparse QR decomposition. + * The columns of the input matrix should be reordered to limit the fill-in during the + * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. + * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list + * of built-in and external ordering methods. + * + * \code + * #include + * \endcode + * + * + */ + +#include "src/SparseCore/SparseColEtree.h" +#include "src/SparseQR/SparseQR.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/StdDeque b/lib/SRC/KPM/FreakMatcher/Eigen/StdDeque index a4f9623..bc68397 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/StdDeque +++ b/lib/SRC/KPM/FreakMatcher/Eigen/StdDeque @@ -4,24 +4,9 @@ // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2009 Hauke Heibel // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_STDDEQUE_MODULE_H #define EIGEN_STDDEQUE_MODULE_H @@ -29,7 +14,7 @@ #include "Core" #include -#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/StdList b/lib/SRC/KPM/FreakMatcher/Eigen/StdList index d914ded..4c6262c 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/StdList +++ b/lib/SRC/KPM/FreakMatcher/Eigen/StdList @@ -3,24 +3,9 @@ // // Copyright (C) 2009 Hauke Heibel // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_STDLIST_MODULE_H #define EIGEN_STDLIST_MODULE_H @@ -28,7 +13,7 @@ #include "Core" #include -#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/StdVector b/lib/SRC/KPM/FreakMatcher/Eigen/StdVector index 3d8995e..0c4697a 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/StdVector +++ b/lib/SRC/KPM/FreakMatcher/Eigen/StdVector @@ -4,24 +4,9 @@ // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2009 Hauke Heibel // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_STDVECTOR_MODULE_H #define EIGEN_STDVECTOR_MODULE_H @@ -29,7 +14,7 @@ #include "Core" #include -#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/SuperLUSupport b/lib/SRC/KPM/FreakMatcher/Eigen/SuperLUSupport new file mode 100644 index 0000000..59312a8 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/SuperLUSupport @@ -0,0 +1,64 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SUPERLUSUPPORT_MODULE_H +#define EIGEN_SUPERLUSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +#ifdef EMPTY +#define EIGEN_EMPTY_WAS_ALREADY_DEFINED +#endif + +typedef int int_t; +#include +#include +#include + +// slu_util.h defines a preprocessor token named EMPTY which is really polluting, +// so we remove it in favor of a SUPERLU_EMPTY token. +// If EMPTY was already defined then we don't undef it. + +#if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) +# undef EIGEN_EMPTY_WAS_ALREADY_DEFINED +#elif defined(EMPTY) +# undef EMPTY +#endif + +#define SUPERLU_EMPTY (-1) + +namespace Eigen { struct SluMatrix; } + +/** \ingroup Support_modules + * \defgroup SuperLUSupport_Module SuperLUSupport module + * + * This module provides an interface to the SuperLU library. + * It provides the following factorization class: + * - class SuperLU: a supernodal sequential LU factorization. + * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). + * + * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. + * + * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. + * + * \code + * #include + * \endcode + * + * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. + * The dependencies depend on how superlu has been compiled. + * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. + * + */ + +#include "src/SuperLUSupport/SuperLUSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SUPERLUSUPPORT_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/UmfPackSupport b/lib/SRC/KPM/FreakMatcher/Eigen/UmfPackSupport new file mode 100644 index 0000000..00eec80 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/UmfPackSupport @@ -0,0 +1,40 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_UMFPACKSUPPORT_MODULE_H +#define EIGEN_UMFPACKSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { +#include +} + +/** \ingroup Support_modules + * \defgroup UmfPackSupport_Module UmfPackSupport module + * + * This module provides an interface to the UmfPack library which is part of the suitesparse package. + * It provides the following factorization class: + * - class UmfPackLU: a multifrontal sequential LU factorization. + * + * \code + * #include + * \endcode + * + * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. + * The dependencies depend on how umfpack has been compiled. + * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. + * + */ + +#include "src/UmfPackSupport/UmfPackSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_UMFPACKSUPPORT_MODULE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/AccelerateSupport/AccelerateSupport.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/AccelerateSupport/AccelerateSupport.h new file mode 100644 index 0000000..0417688 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/AccelerateSupport/AccelerateSupport.h @@ -0,0 +1,421 @@ +#ifndef EIGEN_ACCELERATESUPPORT_H +#define EIGEN_ACCELERATESUPPORT_H + +#include + +#include + +namespace Eigen { + +template +class AccelerateImpl; + +/** \ingroup AccelerateSupport_Module + * \class AccelerateLLT + * \brief A direct Cholesky (LLT) factorization and solver based on Accelerate + * + * \warning Only single and double precision real scalar types are supported by Accelerate + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam UpLo_ additional information about the matrix structure. Default is Lower. + * + * \sa \ref TutorialSparseSolverConcept, class AccelerateLLT + */ +template +using AccelerateLLT = AccelerateImpl; + +/** \ingroup AccelerateSupport_Module + * \class AccelerateLDLT + * \brief The default Cholesky (LDLT) factorization and solver based on Accelerate + * + * \warning Only single and double precision real scalar types are supported by Accelerate + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam UpLo_ additional information about the matrix structure. Default is Lower. + * + * \sa \ref TutorialSparseSolverConcept, class AccelerateLDLT + */ +template +using AccelerateLDLT = AccelerateImpl; + +/** \ingroup AccelerateSupport_Module + * \class AccelerateLDLTUnpivoted + * \brief A direct Cholesky-like LDL^T factorization and solver based on Accelerate with only 1x1 pivots and no pivoting + * + * \warning Only single and double precision real scalar types are supported by Accelerate + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam UpLo_ additional information about the matrix structure. Default is Lower. + * + * \sa \ref TutorialSparseSolverConcept, class AccelerateLDLTUnpivoted + */ +template +using AccelerateLDLTUnpivoted = AccelerateImpl; + +/** \ingroup AccelerateSupport_Module + * \class AccelerateLDLTSBK + * \brief A direct Cholesky (LDLT) factorization and solver based on Accelerate with Supernode Bunch-Kaufman and static pivoting + * + * \warning Only single and double precision real scalar types are supported by Accelerate + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam UpLo_ additional information about the matrix structure. Default is Lower. + * + * \sa \ref TutorialSparseSolverConcept, class AccelerateLDLTSBK + */ +template +using AccelerateLDLTSBK = AccelerateImpl; + +/** \ingroup AccelerateSupport_Module + * \class AccelerateLDLTTPP + * \brief A direct Cholesky (LDLT) factorization and solver based on Accelerate with full threshold partial pivoting + * + * \warning Only single and double precision real scalar types are supported by Accelerate + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam UpLo_ additional information about the matrix structure. Default is Lower. + * + * \sa \ref TutorialSparseSolverConcept, class AccelerateLDLTTPP + */ +template +using AccelerateLDLTTPP = AccelerateImpl; + +/** \ingroup AccelerateSupport_Module + * \class AccelerateQR + * \brief A QR factorization and solver based on Accelerate + * + * \warning Only single and double precision real scalar types are supported by Accelerate + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * + * \sa \ref TutorialSparseSolverConcept, class AccelerateQR + */ +template +using AccelerateQR = AccelerateImpl; + +/** \ingroup AccelerateSupport_Module + * \class AccelerateCholeskyAtA + * \brief A QR factorization and solver based on Accelerate without storing Q (equivalent to A^TA = R^T R) + * + * \warning Only single and double precision real scalar types are supported by Accelerate + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * + * \sa \ref TutorialSparseSolverConcept, class AccelerateCholeskyAtA + */ +template +using AccelerateCholeskyAtA = AccelerateImpl; + +namespace internal { +template +struct AccelFactorizationDeleter { + void operator()(T* sym) { + if (sym) { + SparseCleanup(*sym); + delete sym; + sym = nullptr; + } + } +}; + +template +struct SparseTypesTraitBase { + typedef DenseVecT AccelDenseVector; + typedef DenseMatT AccelDenseMatrix; + typedef SparseMatT AccelSparseMatrix; + + typedef SparseOpaqueSymbolicFactorization SymbolicFactorization; + typedef NumFactT NumericFactorization; + + typedef AccelFactorizationDeleter SymbolicFactorizationDeleter; + typedef AccelFactorizationDeleter NumericFactorizationDeleter; +}; + +template +struct SparseTypesTrait {}; + +template <> +struct SparseTypesTrait : SparseTypesTraitBase {}; + +template <> +struct SparseTypesTrait + : SparseTypesTraitBase { +}; + +} // end namespace internal + +template +class AccelerateImpl : public SparseSolverBase > { + protected: + using Base = SparseSolverBase; + using Base::derived; + using Base::m_isInitialized; + + public: + using Base::_solve_impl; + + typedef MatrixType_ MatrixType; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::StorageIndex StorageIndex; + enum { ColsAtCompileTime = Dynamic, MaxColsAtCompileTime = Dynamic }; + enum { UpLo = UpLo_ }; + + using AccelDenseVector = typename internal::SparseTypesTrait::AccelDenseVector; + using AccelDenseMatrix = typename internal::SparseTypesTrait::AccelDenseMatrix; + using AccelSparseMatrix = typename internal::SparseTypesTrait::AccelSparseMatrix; + using SymbolicFactorization = typename internal::SparseTypesTrait::SymbolicFactorization; + using NumericFactorization = typename internal::SparseTypesTrait::NumericFactorization; + using SymbolicFactorizationDeleter = typename internal::SparseTypesTrait::SymbolicFactorizationDeleter; + using NumericFactorizationDeleter = typename internal::SparseTypesTrait::NumericFactorizationDeleter; + + AccelerateImpl() { + m_isInitialized = false; + + auto check_flag_set = [](int value, int flag) { return ((value & flag) == flag); }; + + if (check_flag_set(UpLo_, Symmetric)) { + m_sparseKind = SparseSymmetric; + m_triType = (UpLo_ & Lower) ? SparseLowerTriangle : SparseUpperTriangle; + } else if (check_flag_set(UpLo_, UnitLower)) { + m_sparseKind = SparseUnitTriangular; + m_triType = SparseLowerTriangle; + } else if (check_flag_set(UpLo_, UnitUpper)) { + m_sparseKind = SparseUnitTriangular; + m_triType = SparseUpperTriangle; + } else if (check_flag_set(UpLo_, StrictlyLower)) { + m_sparseKind = SparseTriangular; + m_triType = SparseLowerTriangle; + } else if (check_flag_set(UpLo_, StrictlyUpper)) { + m_sparseKind = SparseTriangular; + m_triType = SparseUpperTriangle; + } else if (check_flag_set(UpLo_, Lower)) { + m_sparseKind = SparseTriangular; + m_triType = SparseLowerTriangle; + } else if (check_flag_set(UpLo_, Upper)) { + m_sparseKind = SparseTriangular; + m_triType = SparseUpperTriangle; + } else { + m_sparseKind = SparseOrdinary; + m_triType = (UpLo_ & Lower) ? SparseLowerTriangle : SparseUpperTriangle; + } + + m_order = SparseOrderDefault; + } + + explicit AccelerateImpl(const MatrixType& matrix) : AccelerateImpl() { compute(matrix); } + + ~AccelerateImpl() {} + + inline Index cols() const { return m_nCols; } + inline Index rows() const { return m_nRows; } + + ComputationInfo info() const { + eigen_assert(m_isInitialized && "Decomposition is not initialized."); + return m_info; + } + + void analyzePattern(const MatrixType& matrix); + + void factorize(const MatrixType& matrix); + + void compute(const MatrixType& matrix); + + template + void _solve_impl(const MatrixBase& b, MatrixBase& dest) const; + + /** Sets the ordering algorithm to use. */ + void setOrder(SparseOrder_t order) { m_order = order; } + + private: + template + void buildAccelSparseMatrix(const SparseMatrix& a, AccelSparseMatrix& A, std::vector& columnStarts) { + const Index nColumnsStarts = a.cols() + 1; + + columnStarts.resize(nColumnsStarts); + + for (Index i = 0; i < nColumnsStarts; i++) columnStarts[i] = a.outerIndexPtr()[i]; + + SparseAttributes_t attributes{}; + attributes.transpose = false; + attributes.triangle = m_triType; + attributes.kind = m_sparseKind; + + SparseMatrixStructure structure{}; + structure.attributes = attributes; + structure.rowCount = static_cast(a.rows()); + structure.columnCount = static_cast(a.cols()); + structure.blockSize = 1; + structure.columnStarts = columnStarts.data(); + structure.rowIndices = const_cast(a.innerIndexPtr()); + + A.structure = structure; + A.data = const_cast(a.valuePtr()); + } + + void doAnalysis(AccelSparseMatrix& A) { + m_numericFactorization.reset(nullptr); + + SparseSymbolicFactorOptions opts{}; + opts.control = SparseDefaultControl; + opts.orderMethod = m_order; + opts.order = nullptr; + opts.ignoreRowsAndColumns = nullptr; + opts.malloc = malloc; + opts.free = free; + opts.reportError = nullptr; + + m_symbolicFactorization.reset(new SymbolicFactorization(SparseFactor(Solver_, A.structure, opts))); + + SparseStatus_t status = m_symbolicFactorization->status; + + updateInfoStatus(status); + + if (status != SparseStatusOK) m_symbolicFactorization.reset(nullptr); + } + + void doFactorization(AccelSparseMatrix& A) { + SparseStatus_t status = SparseStatusReleased; + + if (m_symbolicFactorization) { + m_numericFactorization.reset(new NumericFactorization(SparseFactor(*m_symbolicFactorization, A))); + + status = m_numericFactorization->status; + + if (status != SparseStatusOK) m_numericFactorization.reset(nullptr); + } + + updateInfoStatus(status); + } + + protected: + void updateInfoStatus(SparseStatus_t status) const { + switch (status) { + case SparseStatusOK: + m_info = Success; + break; + case SparseFactorizationFailed: + case SparseMatrixIsSingular: + m_info = NumericalIssue; + break; + case SparseInternalError: + case SparseParameterError: + case SparseStatusReleased: + default: + m_info = InvalidInput; + break; + } + } + + mutable ComputationInfo m_info; + Index m_nRows, m_nCols; + std::unique_ptr m_symbolicFactorization; + std::unique_ptr m_numericFactorization; + SparseKind_t m_sparseKind; + SparseTriangle_t m_triType; + SparseOrder_t m_order; +}; + +/** Computes the symbolic and numeric decomposition of matrix \a a */ +template +void AccelerateImpl::compute(const MatrixType& a) { + if (EnforceSquare_) eigen_assert(a.rows() == a.cols()); + + m_nRows = a.rows(); + m_nCols = a.cols(); + + AccelSparseMatrix A{}; + std::vector columnStarts; + + buildAccelSparseMatrix(a, A, columnStarts); + + doAnalysis(A); + + if (m_symbolicFactorization) doFactorization(A); + + m_isInitialized = true; +} + +/** Performs a symbolic decomposition on the sparsity pattern of matrix \a a. + * + * This function is particularly useful when solving for several problems having the same structure. + * + * \sa factorize() + */ +template +void AccelerateImpl::analyzePattern(const MatrixType& a) { + if (EnforceSquare_) eigen_assert(a.rows() == a.cols()); + + m_nRows = a.rows(); + m_nCols = a.cols(); + + AccelSparseMatrix A{}; + std::vector columnStarts; + + buildAccelSparseMatrix(a, A, columnStarts); + + doAnalysis(A); + + m_isInitialized = true; +} + +/** Performs a numeric decomposition of matrix \a a. + * + * The given matrix must have the same sparsity pattern as the matrix on which the symbolic decomposition has been performed. + * + * \sa analyzePattern() + */ +template +void AccelerateImpl::factorize(const MatrixType& a) { + eigen_assert(m_symbolicFactorization && "You must first call analyzePattern()"); + eigen_assert(m_nRows == a.rows() && m_nCols == a.cols()); + + if (EnforceSquare_) eigen_assert(a.rows() == a.cols()); + + AccelSparseMatrix A{}; + std::vector columnStarts; + + buildAccelSparseMatrix(a, A, columnStarts); + + doFactorization(A); +} + +template +template +void AccelerateImpl::_solve_impl(const MatrixBase& b, + MatrixBase& x) const { + if (!m_numericFactorization) { + m_info = InvalidInput; + return; + } + + eigen_assert(m_nRows == b.rows()); + eigen_assert(((b.cols() == 1) || b.outerStride() == b.rows())); + + SparseStatus_t status = SparseStatusOK; + + Scalar* b_ptr = const_cast(b.derived().data()); + Scalar* x_ptr = const_cast(x.derived().data()); + + AccelDenseMatrix xmat{}; + xmat.attributes = SparseAttributes_t(); + xmat.columnCount = static_cast(x.cols()); + xmat.rowCount = static_cast(x.rows()); + xmat.columnStride = xmat.rowCount; + xmat.data = x_ptr; + + AccelDenseMatrix bmat{}; + bmat.attributes = SparseAttributes_t(); + bmat.columnCount = static_cast(b.cols()); + bmat.rowCount = static_cast(b.rows()); + bmat.columnStride = bmat.rowCount; + bmat.data = b_ptr; + + SparseSolve(*m_numericFactorization, bmat, xmat); + + updateInfoStatus(status); +} + +} // end namespace Eigen + +#endif // EIGEN_ACCELERATESUPPORT_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/AccelerateSupport/InternalHeaderCheck.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/AccelerateSupport/InternalHeaderCheck.h new file mode 100644 index 0000000..69bcff5 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/AccelerateSupport/InternalHeaderCheck.h @@ -0,0 +1,3 @@ +#ifndef EIGEN_ACCELERATESUPPORT_MODULE_H +#error "Please include Eigen/AccelerateSupport instead of including headers inside the src directory directly." +#endif diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/CMakeLists.txt b/lib/SRC/KPM/FreakMatcher/Eigen/src/CMakeLists.txt deleted file mode 100644 index c326f37..0000000 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -file(GLOB Eigen_src_subdirectories "*") -escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") -foreach(f ${Eigen_src_subdirectories}) - if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) - add_subdirectory(${f}) - endif() -endforeach() diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/CMakeLists.txt b/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/CMakeLists.txt deleted file mode 100644 index d01488b..0000000 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -FILE(GLOB Eigen_Cholesky_SRCS "*.h") - -INSTALL(FILES - ${Eigen_Cholesky_SRCS} - DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel - ) diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/InternalHeaderCheck.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/InternalHeaderCheck.h new file mode 100644 index 0000000..5de2b21 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/InternalHeaderCheck.h @@ -0,0 +1,3 @@ +#ifndef EIGEN_CHOLESKY_MODULE_H +#error "Please include Eigen/Cholesky instead of including headers inside the src directory directly." +#endif diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LDLT.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LDLT.h index a19e947..1d0369b 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LDLT.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LDLT.h @@ -1,77 +1,78 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008-2010 Gael Guennebaud +// Copyright (C) 2008-2011 Gael Guennebaud // Copyright (C) 2009 Keir Mierle // Copyright (C) 2009 Benoit Jacob +// Copyright (C) 2011 Timothy E. Holy // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_LDLT_H #define EIGEN_LDLT_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { -template struct LDLT_Traits; + template struct traits > + : traits + { + typedef MatrixXpr XprKind; + typedef SolverStorage StorageKind; + typedef int StorageIndex; + enum { Flags = 0 }; + }; + + template struct LDLT_Traits; + + // PositiveSemiDef means positive semi-definite and non-zero; same for NegativeSemiDef + enum SignMatrix { PositiveSemiDef, NegativeSemiDef, ZeroSign, Indefinite }; } -/** \ingroup cholesky_Module +/** \ingroup Cholesky_Module * * \class LDLT * * \brief Robust Cholesky decomposition of a matrix with pivoting * - * \param MatrixType the type of the matrix of which to compute the LDL^T Cholesky decomposition + * \tparam MatrixType_ the type of the matrix of which to compute the LDL^T Cholesky decomposition + * \tparam UpLo_ the triangular part that will be used for the decomposition: Lower (default) or Upper. + * The other triangular part won't be read. * * Perform a robust Cholesky decomposition of a positive semidefinite or negative semidefinite * matrix \f$ A \f$ such that \f$ A = P^TLDL^*P \f$, where P is a permutation matrix, L * is lower triangular with a unit diagonal and D is a diagonal matrix. * - * The decomposition uses pivoting to ensure stability, so that L will have + * The decomposition uses pivoting to ensure stability, so that D will have * zeros in the bottom right rank(A) - n submatrix. Avoiding the square root * on D also stabilizes the computation. * * Remember that Cholesky decompositions are not rank-revealing. Also, do not use a Cholesky - * decomposition to determine whether a system of equations has a solution. + * decomposition to determine whether a system of equations has a solution. * - * \sa MatrixBase::ldlt(), class LLT - */ - /* THIS PART OF THE DOX IS CURRENTLY DISABLED BECAUSE INACCURATE BECAUSE OF BUG IN THE DECOMPOSITION CODE - * Note that during the decomposition, only the upper triangular part of A is considered. Therefore, - * the strict lower part does not have to store correct values. + * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. + * + * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt(), class LLT */ -template class LDLT +template class LDLT + : public SolverBase > { public: - typedef _MatrixType MatrixType; + typedef MatrixType_ MatrixType; + typedef SolverBase Base; + friend class SolverBase; + + EIGEN_GENERIC_PUBLIC_INTERFACE(LDLT) enum { - RowsAtCompileTime = MatrixType::RowsAtCompileTime, - ColsAtCompileTime = MatrixType::ColsAtCompileTime, - Options = MatrixType::Options & ~RowMajorBit, // these are the options for the TmpMatrixType, we need a ColMajor matrix here! MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, - UpLo = _UpLo + UpLo = UpLo_ }; - typedef typename MatrixType::Scalar Scalar; - typedef typename NumTraits::Real RealScalar; - typedef typename MatrixType::Index Index; - typedef Matrix TmpMatrixType; + typedef Matrix TmpMatrixType; typedef Transpositions TranspositionType; typedef PermutationMatrix PermutationType; @@ -83,7 +84,12 @@ template class LDLT * The default constructor is useful in cases in which the user intends to * perform decompositions via LDLT::compute(const MatrixType&). */ - LDLT() : m_matrix(), m_transpositions(), m_isInitialized(false) {} + LDLT() + : m_matrix(), + m_transpositions(), + m_sign(internal::ZeroSign), + m_isInitialized(false) + {} /** \brief Default Constructor with memory preallocation * @@ -91,20 +97,54 @@ template class LDLT * according to the specified problem \a size. * \sa LDLT() */ - LDLT(Index size) + explicit LDLT(Index size) : m_matrix(size, size), m_transpositions(size), m_temporary(size), + m_sign(internal::ZeroSign), m_isInitialized(false) {} - LDLT(const MatrixType& matrix) + /** \brief Constructor with decomposition + * + * This calculates the decomposition for the input \a matrix. + * + * \sa LDLT(Index size) + */ + template + explicit LDLT(const EigenBase& matrix) : m_matrix(matrix.rows(), matrix.cols()), m_transpositions(matrix.rows()), m_temporary(matrix.rows()), + m_sign(internal::ZeroSign), m_isInitialized(false) { - compute(matrix); + compute(matrix.derived()); + } + + /** \brief Constructs a LDLT factorization from a given matrix + * + * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref. + * + * \sa LDLT(const EigenBase&) + */ + template + explicit LDLT(EigenBase& matrix) + : m_matrix(matrix.derived()), + m_transpositions(matrix.rows()), + m_temporary(matrix.rows()), + m_sign(internal::ZeroSign), + m_isInitialized(false) + { + compute(matrix.derived()); + } + + /** Clear any existing decomposition + * \sa rankUpdate(w,sigma) + */ + void setZero() + { + m_isInitialized = false; } /** \returns a view of the upper triangular matrix U */ @@ -130,33 +170,27 @@ template class LDLT } /** \returns the coefficients of the diagonal matrix D */ - inline Diagonal vectorD(void) const + inline Diagonal vectorD() const { eigen_assert(m_isInitialized && "LDLT is not initialized."); return m_matrix.diagonal(); } /** \returns true if the matrix is positive (semidefinite) */ - inline bool isPositive(void) const + inline bool isPositive() const { eigen_assert(m_isInitialized && "LDLT is not initialized."); - return m_sign == 1; - } - - #ifdef EIGEN2_SUPPORT - inline bool isPositiveDefinite() const - { - return isPositive(); + return m_sign == internal::PositiveSemiDef || m_sign == internal::ZeroSign; } - #endif /** \returns true if the matrix is negative (semidefinite) */ inline bool isNegative(void) const { eigen_assert(m_isInitialized && "LDLT is not initialized."); - return m_sign == -1; + return m_sign == internal::NegativeSemiDef || m_sign == internal::ZeroSign; } + #ifdef EIGEN_PARSED_BY_DOXYGEN /** \returns a solution x of \f$ A x = b \f$ using the current decomposition of A. * * This function also supports in-place solves using the syntax x = decompositionObject.solve(x) . @@ -164,37 +198,36 @@ template class LDLT * \note_about_checking_solutions * * More precisely, this method solves \f$ A x = b \f$ using the decomposition \f$ A = P^T L D L^* P \f$ - * by solving the systems \f$ P^T y_1 = b \f$, \f$ L y_2 = y_1 \f$, \f$ D y_3 = y_2 \f$, + * by solving the systems \f$ P^T y_1 = b \f$, \f$ L y_2 = y_1 \f$, \f$ D y_3 = y_2 \f$, * \f$ L^* y_4 = y_3 \f$ and \f$ P x = y_4 \f$ in succession. If the matrix \f$ A \f$ is singular, then * \f$ D \f$ will also be singular (all the other matrices are invertible). In that case, the * least-square solution of \f$ D y_3 = y_2 \f$ is computed. This does not mean that this function - * computes the least-square solution of \f$ A x = b \f$ is \f$ A \f$ is singular. + * computes the least-square solution of \f$ A x = b \f$ if \f$ A \f$ is singular. * - * \sa MatrixBase::ldlt() + * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt() */ template - inline const internal::solve_retval - solve(const MatrixBase& b) const - { - eigen_assert(m_isInitialized && "LDLT is not initialized."); - eigen_assert(m_matrix.rows()==b.rows() - && "LDLT::solve(): invalid number of rows of the right hand side matrix b"); - return internal::solve_retval(*this, b.derived()); - } - - #ifdef EIGEN2_SUPPORT - template - bool solve(const MatrixBase& b, ResultType *result) const - { - *result = this->solve(b); - return true; - } + inline const Solve + solve(const MatrixBase& b) const; #endif template bool solveInPlace(MatrixBase &bAndX) const; - LDLT& compute(const MatrixType& matrix); + template + LDLT& compute(const EigenBase& matrix); + + /** \returns an estimate of the reciprocal condition number of the matrix of + * which \c *this is the LDLT decomposition. + */ + RealScalar rcond() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return internal::rcond_estimate_helper(m_l1_norm, *this); + } + + template + LDLT& rankUpdate(const MatrixBase& w, const RealScalar& alpha=1); /** \returns the internal LDLT decomposition matrix * @@ -208,11 +241,39 @@ template class LDLT MatrixType reconstructedMatrix() const; - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } + /** \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint. + * + * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: + * \code x = decomposition.adjoint().solve(b) \endcode + */ + const LDLT& adjoint() const { return *this; } + + EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } + + /** \brief Reports whether previous computation was successful. + * + * \returns \c Success if computation was successful, + * \c NumericalIssue if the factorization failed because of a zero pivot. + */ + ComputationInfo info() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_info; + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void _solve_impl(const RhsType &rhs, DstType &dst) const; + + template + void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; + #endif protected: + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + /** \internal * Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U. * The strict upper part is used during the decomposition, the strict lower @@ -220,10 +281,12 @@ template class LDLT * is not stored), and the diagonal entries correspond to D. */ MatrixType m_matrix; + RealScalar m_l1_norm; TranspositionType m_transpositions; TmpMatrixType m_temporary; - int m_sign; + internal::SignMatrix m_sign; bool m_isInitialized; + ComputationInfo m_info; }; namespace internal { @@ -233,50 +296,35 @@ template struct ldlt_inplace; template<> struct ldlt_inplace { template - static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0) + static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign) { + using std::abs; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - typedef typename MatrixType::Index Index; + typedef typename TranspositionType::StorageIndex IndexType; eigen_assert(mat.rows()==mat.cols()); const Index size = mat.rows(); + bool found_zero_pivot = false; + bool ret = true; if (size <= 1) { transpositions.setIdentity(); - if(sign) - *sign = real(mat.coeff(0,0))>0 ? 1:-1; + if(size==0) sign = ZeroSign; + else if (numext::real(mat.coeff(0,0)) > static_cast(0) ) sign = PositiveSemiDef; + else if (numext::real(mat.coeff(0,0)) < static_cast(0)) sign = NegativeSemiDef; + else sign = ZeroSign; return true; } - RealScalar cutoff = 0, biggest_in_corner; - for (Index k = 0; k < size; ++k) { // Find largest diagonal element Index index_of_biggest_in_corner; - biggest_in_corner = mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner); + mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner); index_of_biggest_in_corner += k; - if(k == 0) - { - // The biggest overall is the point of reference to which further diagonals - // are compared; if any diagonal is negligible compared - // to the largest overall, the algorithm bails. - cutoff = abs(NumTraits::epsilon() * biggest_in_corner); - - if(sign) - *sign = real(mat.diagonal().coeff(index_of_biggest_in_corner)) > 0 ? 1 : -1; - } - - // Finish early if the matrix is not full rank. - if(biggest_in_corner < cutoff) - { - for(Index i = k; i < size; i++) transpositions.coeffRef(i) = i; - break; - } - - transpositions.coeffRef(k) = index_of_biggest_in_corner; + transpositions.coeffRef(k) = IndexType(index_of_biggest_in_corner); if(k != index_of_biggest_in_corner) { // apply the transposition while taking care to consider only @@ -285,14 +333,14 @@ template<> struct ldlt_inplace mat.row(k).head(k).swap(mat.row(index_of_biggest_in_corner).head(k)); mat.col(k).tail(s).swap(mat.col(index_of_biggest_in_corner).tail(s)); std::swap(mat.coeffRef(k,k),mat.coeffRef(index_of_biggest_in_corner,index_of_biggest_in_corner)); - for(int i=k+1;i::IsComplex) - mat.coeffRef(index_of_biggest_in_corner,k) = conj(mat.coeff(index_of_biggest_in_corner,k)); + mat.coeffRef(index_of_biggest_in_corner,k) = numext::conj(mat.coeff(index_of_biggest_in_corner,k)); } // partition the matrix: @@ -306,109 +354,259 @@ template<> struct ldlt_inplace if(k>0) { - temp.head(k) = mat.diagonal().head(k).asDiagonal() * A10.adjoint(); + temp.head(k) = mat.diagonal().real().head(k).asDiagonal() * A10.adjoint(); mat.coeffRef(k,k) -= (A10 * temp.head(k)).value(); if(rs>0) A21.noalias() -= A20 * temp.head(k); } - if((rs>0) && (abs(mat.coeffRef(k,k)) > cutoff)) - A21 /= mat.coeffRef(k,k); + + // In some previous versions of Eigen (e.g., 3.2.1), the scaling was omitted if the pivot + // was smaller than the cutoff value. However, since LDLT is not rank-revealing + // we should only make sure that we do not introduce INF or NaN values. + // Remark that LAPACK also uses 0 as the cutoff value. + RealScalar realAkk = numext::real(mat.coeffRef(k,k)); + bool pivot_is_valid = (abs(realAkk) > RealScalar(0)); + + if(k==0 && !pivot_is_valid) + { + // The entire diagonal is zero, there is nothing more to do + // except filling the transpositions, and checking whether the matrix is zero. + sign = ZeroSign; + for(Index j = 0; j0) && pivot_is_valid) + A21 /= realAkk; + else if(rs>0) + ret = ret && (A21.array()==Scalar(0)).all(); + + if(found_zero_pivot && pivot_is_valid) ret = false; // factorization failed + else if(!pivot_is_valid) found_zero_pivot = true; + + if (sign == PositiveSemiDef) { + if (realAkk < static_cast(0)) sign = Indefinite; + } else if (sign == NegativeSemiDef) { + if (realAkk > static_cast(0)) sign = Indefinite; + } else if (sign == ZeroSign) { + if (realAkk > static_cast(0)) sign = PositiveSemiDef; + else if (realAkk < static_cast(0)) sign = NegativeSemiDef; + } } + return ret; + } + + // Reference for the algorithm: Davis and Hager, "Multiple Rank + // Modifications of a Sparse Cholesky Factorization" (Algorithm 1) + // Trivial rearrangements of their computations (Timothy E. Holy) + // allow their algorithm to work for rank-1 updates even if the + // original matrix is not of full rank. + // Here only rank-1 updates are implemented, to reduce the + // requirement for intermediate storage and improve accuracy + template + static bool updateInPlace(MatrixType& mat, MatrixBase& w, const typename MatrixType::RealScalar& sigma=1) + { + using numext::isfinite; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + + const Index size = mat.rows(); + eigen_assert(mat.cols() == size && w.size()==size); + + RealScalar alpha = 1; + + // Apply the update + for (Index j = 0; j < size; j++) + { + // Check for termination due to an original decomposition of low-rank + if (!(isfinite)(alpha)) + break; + + // Update the diagonal terms + RealScalar dj = numext::real(mat.coeff(j,j)); + Scalar wj = w.coeff(j); + RealScalar swj2 = sigma*numext::abs2(wj); + RealScalar gamma = dj*alpha + swj2; + + mat.coeffRef(j,j) += swj2/alpha; + alpha += swj2/dj; + + + // Update the terms of L + Index rs = size-j-1; + w.tail(rs) -= wj * mat.col(j).tail(rs); + if(!numext::is_exactly_zero(gamma)) + mat.col(j).tail(rs) += (sigma*numext::conj(wj)/gamma)*w.tail(rs); + } return true; } + + template + static bool update(MatrixType& mat, const TranspositionType& transpositions, Workspace& tmp, const WType& w, const typename MatrixType::RealScalar& sigma=1) + { + // Apply the permutation to the input w + tmp = transpositions * w; + + return ldlt_inplace::updateInPlace(mat,tmp,sigma); + } }; template<> struct ldlt_inplace { template - static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0) + static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign) { Transpose matt(mat); return ldlt_inplace::unblocked(matt, transpositions, temp, sign); } + + template + static EIGEN_STRONG_INLINE bool update(MatrixType& mat, TranspositionType& transpositions, Workspace& tmp, WType& w, const typename MatrixType::RealScalar& sigma=1) + { + Transpose matt(mat); + return ldlt_inplace::update(matt, transpositions, tmp, w.conjugate(), sigma); + } }; template struct LDLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; - inline static MatrixL getL(const MatrixType& m) { return m; } - inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); } + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } }; template struct LDLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; - inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); } - inline static MatrixU getU(const MatrixType& m) { return m; } + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m.adjoint()); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m); } }; } // end namespace internal /** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix */ -template -LDLT& LDLT::compute(const MatrixType& a) +template +template +LDLT& LDLT::compute(const EigenBase& a) { eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); - m_matrix = a; + m_matrix = a.derived(); + + // Compute matrix L1 norm = max abs column sum. + m_l1_norm = RealScalar(0); + // TODO move this code to SelfAdjointView + for (Index col = 0; col < size; ++col) { + RealScalar abs_col_sum; + if (UpLo_ == Lower) + abs_col_sum = m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>(); + else + abs_col_sum = m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>(); + if (abs_col_sum > m_l1_norm) + m_l1_norm = abs_col_sum; + } m_transpositions.resize(size); m_isInitialized = false; m_temporary.resize(size); + m_sign = internal::ZeroSign; - internal::ldlt_inplace::unblocked(m_matrix, m_transpositions, m_temporary, &m_sign); + m_info = internal::ldlt_inplace::unblocked(m_matrix, m_transpositions, m_temporary, m_sign) ? Success : NumericalIssue; m_isInitialized = true; return *this; } -namespace internal { -template -struct solve_retval, Rhs> - : solve_retval_base, Rhs> +/** Update the LDLT decomposition: given A = L D L^T, efficiently compute the decomposition of A + sigma w w^T. + * \param w a vector to be incorporated into the decomposition. + * \param sigma a scalar, +1 for updates and -1 for "downdates," which correspond to removing previously-added column vectors. Optional; default value is +1. + * \sa setZero() + */ +template +template +LDLT& LDLT::rankUpdate(const MatrixBase& w, const typename LDLT::RealScalar& sigma) { - typedef LDLT<_MatrixType,_UpLo> LDLTType; - EIGEN_MAKE_SOLVE_HELPERS(LDLTType,Rhs) - - template void evalTo(Dest& dst) const + typedef typename TranspositionType::StorageIndex IndexType; + const Index size = w.rows(); + if (m_isInitialized) + { + eigen_assert(m_matrix.rows()==size); + } + else { - eigen_assert(rhs().rows() == dec().matrixLDLT().rows()); - // dst = P b - dst = dec().transpositionsP() * rhs(); + m_matrix.resize(size,size); + m_matrix.setZero(); + m_transpositions.resize(size); + for (Index i = 0; i < size; i++) + m_transpositions.coeffRef(i) = IndexType(i); + m_temporary.resize(size); + m_sign = sigma>=0 ? internal::PositiveSemiDef : internal::NegativeSemiDef; + m_isInitialized = true; + } - // dst = L^-1 (P b) - dec().matrixL().solveInPlace(dst); + internal::ldlt_inplace::update(m_matrix, m_transpositions, m_temporary, w, sigma); - // dst = D^-1 (L^-1 P b) - // more precisely, use pseudo-inverse of D (see bug 241) - using std::abs; - using std::max; - typedef typename LDLTType::MatrixType MatrixType; - typedef typename LDLTType::Scalar Scalar; - typedef typename LDLTType::RealScalar RealScalar; - const Diagonal vectorD = dec().vectorD(); - RealScalar tolerance = (max)(vectorD.array().abs().maxCoeff() * NumTraits::epsilon(), - RealScalar(1) / NumTraits::highest()); // motivated by LAPACK's xGELSS - for (Index i = 0; i < vectorD.size(); ++i) { - if(abs(vectorD(i)) > tolerance) - dst.row(i) /= vectorD(i); - else - dst.row(i).setZero(); - } + return *this; +} - // dst = L^-T (D^-1 L^-1 P b) - dec().matrixU().solveInPlace(dst); +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +template +void LDLT::_solve_impl(const RhsType &rhs, DstType &dst) const +{ + _solve_impl_transposed(rhs, dst); +} - // dst = P^-1 (L^-T D^-1 L^-1 P b) = A^-1 b - dst = dec().transpositionsP().transpose() * dst; +template +template +void LDLT::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const +{ + // dst = P b + dst = m_transpositions * rhs; + + // dst = L^-1 (P b) + // dst = L^-*T (P b) + matrixL().template conjugateIf().solveInPlace(dst); + + // dst = D^-* (L^-1 P b) + // dst = D^-1 (L^-*T P b) + // more precisely, use pseudo-inverse of D (see bug 241) + using std::abs; + const typename Diagonal::RealReturnType vecD(vectorD()); + // In some previous versions, tolerance was set to the max of 1/highest (or rather numeric_limits::min()) + // and the maximal diagonal entry * epsilon as motivated by LAPACK's xGELSS: + // RealScalar tolerance = numext::maxi(vecD.array().abs().maxCoeff() * NumTraits::epsilon(),RealScalar(1) / NumTraits::highest()); + // However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest + // diagonal element is not well justified and leads to numerical issues in some cases. + // Moreover, Lapack's xSYTRS routines use 0 for the tolerance. + // Using numeric_limits::min() gives us more robustness to denormals. + RealScalar tolerance = (std::numeric_limits::min)(); + for (Index i = 0; i < vecD.size(); ++i) + { + if(abs(vecD(i)) > tolerance) + dst.row(i) /= vecD(i); + else + dst.row(i).setZero(); } -}; + + // dst = L^-* (D^-* L^-1 P b) + // dst = L^-T (D^-1 L^-*T P b) + matrixL().transpose().template conjugateIf().solveInPlace(dst); + + // dst = P^T (L^-* D^-* L^-1 P b) = A^-1 b + // dst = P^-T (L^-T D^-1 L^-*T P b) = A^-1 b + dst = m_transpositions.transpose() * dst; } +#endif /** \internal use x = ldlt_object.solve(x); * @@ -423,13 +621,12 @@ struct solve_retval, Rhs> * * \sa LDLT::solve(), MatrixBase::ldlt() */ -template +template template -bool LDLT::solveInPlace(MatrixBase &bAndX) const +bool LDLT::solveInPlace(MatrixBase &bAndX) const { eigen_assert(m_isInitialized && "LDLT is not initialized."); - const Index size = m_matrix.rows(); - eigen_assert(size == bAndX.rows()); + eigen_assert(m_matrix.rows() == bAndX.rows()); bAndX = this->solve(bAndX); @@ -439,8 +636,8 @@ bool LDLT::solveInPlace(MatrixBase &bAndX) const /** \returns the matrix represented by the decomposition, * i.e., it returns the product: P^T L D L^* P. * This function is provided for debug purpose. */ -template -MatrixType LDLT::reconstructedMatrix() const +template +MatrixType LDLT::reconstructedMatrix() const { eigen_assert(m_isInitialized && "LDLT is not initialized."); const Index size = m_matrix.rows(); @@ -452,7 +649,7 @@ MatrixType LDLT::reconstructedMatrix() const // L^* P res = matrixU() * res; // D(L^*P) - res = vectorD().asDiagonal() * res; + res = vectorD().real().asDiagonal() * res; // L(DL^*P) res = matrixL() * res; // P^T (LDL^*P) @@ -463,6 +660,7 @@ MatrixType LDLT::reconstructedMatrix() const /** \cholesky_module * \returns the Cholesky decomposition with full pivoting without square root of \c *this + * \sa MatrixBase::ldlt() */ template inline const LDLT::PlainObject, UpLo> @@ -473,6 +671,7 @@ SelfAdjointView::ldlt() const /** \cholesky_module * \returns the Cholesky decomposition with full pivoting without square root of \c *this + * \sa SelfAdjointView::ldlt() */ template inline const LDLT::PlainObject> @@ -481,4 +680,6 @@ MatrixBase::ldlt() const return LDLT(derived()); } +} // end namespace Eigen + #endif // EIGEN_LDLT_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LLT.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LLT.h index 3bb76b5..1443eac 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LLT.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LLT.h @@ -3,39 +3,40 @@ // // Copyright (C) 2008 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_LLT_H #define EIGEN_LLT_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal{ + +template struct traits > + : traits +{ + typedef MatrixXpr XprKind; + typedef SolverStorage StorageKind; + typedef int StorageIndex; + enum { Flags = 0 }; +}; + template struct LLT_Traits; } -/** \ingroup cholesky_Module +/** \ingroup Cholesky_Module * * \class LLT * * \brief Standard Cholesky decomposition (LL^T) of a matrix and associated features * - * \param MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition + * \tparam MatrixType_ the type of the matrix of which we are computing the LL^T Cholesky decomposition + * \tparam UpLo_ the triangular part that will be used for the decomposition: Lower (default) or Upper. + * The other triangular part won't be read. * * This class performs a LL^T Cholesky decomposition of a symmetric, positive definite * matrix A such that A = LL^* = U^*U, where L is lower triangular. @@ -49,30 +50,38 @@ template struct LLT_Traits; * use LDLT instead for the semidefinite case. Also, do not use a Cholesky decomposition to determine whether a system of equations * has a solution. * - * \sa MatrixBase::llt(), class LDLT - */ - /* HEY THIS DOX IS DISABLED BECAUSE THERE's A BUG EITHER HERE OR IN LDLT ABOUT THAT (OR BOTH) - * Note that during the decomposition, only the upper triangular part of A is considered. Therefore, - * the strict lower part does not have to store correct values. + * Example: \include LLT_example.cpp + * Output: \verbinclude LLT_example.out + * + * \b Performance: for best performance, it is recommended to use a column-major storage format + * with the Lower triangular part (the default), or, equivalently, a row-major storage format + * with the Upper triangular part. Otherwise, you might get a 20% slowdown for the full factorization + * step, and rank-updates can be up to 3 times slower. + * + * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. + * + * Note that during the decomposition, only the lower (or upper, as defined by UpLo_) triangular part of A is considered. + * Therefore, the strict lower part does not have to store correct values. + * + * \sa MatrixBase::llt(), SelfAdjointView::llt(), class LDLT */ -template class LLT +template class LLT + : public SolverBase > { public: - typedef _MatrixType MatrixType; + typedef MatrixType_ MatrixType; + typedef SolverBase Base; + friend class SolverBase; + + EIGEN_GENERIC_PUBLIC_INTERFACE(LLT) enum { - RowsAtCompileTime = MatrixType::RowsAtCompileTime, - ColsAtCompileTime = MatrixType::ColsAtCompileTime, - Options = MatrixType::Options, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; - typedef typename MatrixType::Scalar Scalar; - typedef typename NumTraits::Real RealScalar; - typedef typename MatrixType::Index Index; enum { PacketSize = internal::packet_traits::size, AlignmentMask = int(PacketSize)-1, - UpLo = _UpLo + UpLo = UpLo_ }; typedef internal::LLT_Traits Traits; @@ -91,14 +100,30 @@ template class LLT * according to the specified problem \a size. * \sa LLT() */ - LLT(Index size) : m_matrix(size, size), + explicit LLT(Index size) : m_matrix(size, size), m_isInitialized(false) {} - LLT(const MatrixType& matrix) + template + explicit LLT(const EigenBase& matrix) : m_matrix(matrix.rows(), matrix.cols()), m_isInitialized(false) { - compute(matrix); + compute(matrix.derived()); + } + + /** \brief Constructs a LLT factorization from a given matrix + * + * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when + * \c MatrixType is a Eigen::Ref. + * + * \sa LLT(const EigenBase&) + */ + template + explicit LLT(EigenBase& matrix) + : m_matrix(matrix.derived()), + m_isInitialized(false) + { + compute(matrix.derived()); } /** \returns a view of the upper triangular matrix U */ @@ -115,6 +140,7 @@ template class LLT return Traits::getL(m_matrix); } + #ifdef EIGEN_PARSED_BY_DOXYGEN /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A. * * Since this LLT class assumes anyway that the matrix A is invertible, the solution @@ -123,33 +149,28 @@ template class LLT * Example: \include LLT_solve.cpp * Output: \verbinclude LLT_solve.out * - * \sa solveInPlace(), MatrixBase::llt() + * \sa solveInPlace(), MatrixBase::llt(), SelfAdjointView::llt() */ template - inline const internal::solve_retval - solve(const MatrixBase& b) const - { - eigen_assert(m_isInitialized && "LLT is not initialized."); - eigen_assert(m_matrix.rows()==b.rows() - && "LLT::solve(): invalid number of rows of the right hand side matrix b"); - return internal::solve_retval(*this, b.derived()); - } - - #ifdef EIGEN2_SUPPORT - template - bool solve(const MatrixBase& b, ResultType *result) const - { - *result = this->solve(b); - return true; - } - - bool isPositiveDefinite() const { return true; } + inline const Solve + solve(const MatrixBase& b) const; #endif template - void solveInPlace(MatrixBase &bAndX) const; + void solveInPlace(const MatrixBase &bAndX) const; - LLT& compute(const MatrixType& matrix); + template + LLT& compute(const EigenBase& matrix); + + /** \returns an estimate of the reciprocal condition number of the matrix of + * which \c *this is the Cholesky decomposition. + */ + RealScalar rcond() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + eigen_assert(m_info == Success && "LLT failed because matrix appears to be negative"); + return internal::rcond_estimate_helper(m_l1_norm, *this); + } /** \returns the LLT decomposition matrix * @@ -166,8 +187,8 @@ template class LLT /** \brief Reports whether previous computation was successful. * - * \returns \c Success if computation was succesful, - * \c NumericalIssue if the matrix.appears to be negative. + * \returns \c Success if computation was successful, + * \c NumericalIssue if the matrix.appears not to be positive definite. */ ComputationInfo info() const { @@ -175,32 +196,123 @@ template class LLT return m_info; } - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } + /** \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint. + * + * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: + * \code x = decomposition.adjoint().solve(b) \endcode + */ + const LLT& adjoint() const EIGEN_NOEXCEPT { return *this; } + + inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } + + template + LLT & rankUpdate(const VectorType& vec, const RealScalar& sigma = 1); + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void _solve_impl(const RhsType &rhs, DstType &dst) const; + + template + void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; + #endif protected: + + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + /** \internal * Used to compute and store L * The strict upper part is not used and even not initialized. */ MatrixType m_matrix; + RealScalar m_l1_norm; bool m_isInitialized; ComputationInfo m_info; }; namespace internal { -template struct llt_inplace; +template struct llt_inplace; -template<> struct llt_inplace +template +static Index llt_rank_update_lower(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) { + using std::sqrt; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef typename MatrixType::ColXpr ColXpr; + typedef internal::remove_all_t ColXprCleaned; + typedef typename ColXprCleaned::SegmentReturnType ColXprSegment; + typedef Matrix TempVectorType; + typedef typename TempVectorType::SegmentReturnType TempVecSegment; + + Index n = mat.cols(); + eigen_assert(mat.rows()==n && vec.size()==n); + + TempVectorType temp; + + if(sigma>0) + { + // This version is based on Givens rotations. + // It is faster than the other one below, but only works for updates, + // i.e., for sigma > 0 + temp = sqrt(sigma) * vec; + + for(Index i=0; i g; + g.makeGivens(mat(i,i), -temp(i), &mat(i,i)); + + Index rs = n-i-1; + if(rs>0) + { + ColXprSegment x(mat.col(i).tail(rs)); + TempVecSegment y(temp.tail(rs)); + apply_rotation_in_the_plane(x, y, g); + } + } + } + else + { + temp = vec; + RealScalar beta = 1; + for(Index j=0; j struct llt_inplace +{ + typedef typename NumTraits::Real RealScalar; template - static typename MatrixType::Index unblocked(MatrixType& mat) + static Index unblocked(MatrixType& mat) { - typedef typename MatrixType::Index Index; - typedef typename MatrixType::Scalar Scalar; - typedef typename MatrixType::RealScalar RealScalar; - + using std::sqrt; + eigen_assert(mat.rows()==mat.cols()); const Index size = mat.rows(); for(Index k = 0; k < size; ++k) @@ -211,21 +323,20 @@ template<> struct llt_inplace Block A10(mat,k,0,1,k); Block A20(mat,k+1,0,rs,k); - RealScalar x = real(mat.coeff(k,k)); + RealScalar x = numext::real(mat.coeff(k,k)); if (k>0) x -= A10.squaredNorm(); if (x<=RealScalar(0)) return k; mat.coeffRef(k,k) = x = sqrt(x); if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint(); - if (rs>0) A21 *= RealScalar(1)/x; + if (rs>0) A21 /= x; } return -1; } template - static typename MatrixType::Index blocked(MatrixType& m) + static Index blocked(MatrixType& m) { - typedef typename MatrixType::Index Index; eigen_assert(m.rows()==m.cols()); Index size = m.rows(); if(size<32) @@ -250,25 +361,39 @@ template<> struct llt_inplace Index ret; if((ret=unblocked(A11))>=0) return k+ret; if(rs>0) A11.adjoint().template triangularView().template solveInPlace(A21); - if(rs>0) A22.template selfadjointView().rankUpdate(A21,-1); // bottleneck + if(rs>0) A22.template selfadjointView().rankUpdate(A21,typename NumTraits::Literal(-1)); // bottleneck } return -1; } + + template + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) + { + return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); + } }; -template<> struct llt_inplace +template struct llt_inplace { + typedef typename NumTraits::Real RealScalar; + template - static EIGEN_STRONG_INLINE typename MatrixType::Index unblocked(MatrixType& mat) + static EIGEN_STRONG_INLINE Index unblocked(MatrixType& mat) { Transpose matt(mat); - return llt_inplace::unblocked(matt); + return llt_inplace::unblocked(matt); } template - static EIGEN_STRONG_INLINE typename MatrixType::Index blocked(MatrixType& mat) + static EIGEN_STRONG_INLINE Index blocked(MatrixType& mat) { Transpose matt(mat); - return llt_inplace::blocked(matt); + return llt_inplace::blocked(matt); + } + template + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) + { + Transpose matt(mat); + return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); } }; @@ -276,36 +401,53 @@ template struct LLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; - inline static MatrixL getL(const MatrixType& m) { return m; } - inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); } + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } static bool inplace_decomposition(MatrixType& m) - { return llt_inplace::blocked(m)==-1; } + { return llt_inplace::blocked(m)==-1; } }; template struct LLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; - inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); } - inline static MatrixU getU(const MatrixType& m) { return m; } + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m.adjoint()); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m); } static bool inplace_decomposition(MatrixType& m) - { return llt_inplace::blocked(m)==-1; } + { return llt_inplace::blocked(m)==-1; } }; } // end namespace internal /** Computes / recomputes the Cholesky decomposition A = LL^* = U^*U of \a matrix - * * * \returns a reference to *this + * + * Example: \include TutorialLinAlgComputeTwice.cpp + * Output: \verbinclude TutorialLinAlgComputeTwice.out */ -template -LLT& LLT::compute(const MatrixType& a) +template +template +LLT& LLT::compute(const EigenBase& a) { - assert(a.rows()==a.cols()); + eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); m_matrix.resize(size, size); - m_matrix = a; + if (!internal::is_same_dense(m_matrix, a.derived())) + m_matrix = a.derived(); + + // Compute matrix L1 norm = max abs column sum. + m_l1_norm = RealScalar(0); + // TODO move this code to SelfAdjointView + for (Index col = 0; col < size; ++col) { + RealScalar abs_col_sum; + if (UpLo_ == Lower) + abs_col_sum = m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>(); + else + abs_col_sum = m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>(); + if (abs_col_sum > m_l1_norm) + m_l1_norm = abs_col_sum; + } m_isInitialized = true; bool ok = Traits::inplace_decomposition(m_matrix); @@ -314,38 +456,61 @@ LLT& LLT::compute(const MatrixType& a) return *this; } -namespace internal { -template -struct solve_retval, Rhs> - : solve_retval_base, Rhs> +/** Performs a rank one update (or dowdate) of the current decomposition. + * If A = LL^* before the rank one update, + * then after it we have LL^* = A + sigma * v v^* where \a v must be a vector + * of same dimension. + */ +template +template +LLT & LLT::rankUpdate(const VectorType& v, const RealScalar& sigma) { - typedef LLT<_MatrixType,UpLo> LLTType; - EIGEN_MAKE_SOLVE_HELPERS(LLTType,Rhs) + EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorType); + eigen_assert(v.size()==m_matrix.cols()); + eigen_assert(m_isInitialized); + if(internal::llt_inplace::rankUpdate(m_matrix,v,sigma)>=0) + m_info = NumericalIssue; + else + m_info = Success; - template void evalTo(Dest& dst) const - { - dst = rhs(); - dec().solveInPlace(dst); - } -}; + return *this; +} + +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +template +void LLT::_solve_impl(const RhsType &rhs, DstType &dst) const +{ + _solve_impl_transposed(rhs, dst); +} + +template +template +void LLT::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const +{ + dst = rhs; + + matrixL().template conjugateIf().solveInPlace(dst); + matrixU().template conjugateIf().solveInPlace(dst); } +#endif /** \internal use x = llt_object.solve(x); - * + * * This is the \em in-place version of solve(). * * \param bAndX represents both the right-hand side matrix b and result x. * - * \returns true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD. + * This version avoids a copy when the right hand side matrix b is not needed anymore. * - * This version avoids a copy when the right hand side matrix b is not - * needed anymore. + * \warning The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here. + * This function will const_cast it, so constness isn't honored here. * * \sa LLT::solve(), MatrixBase::llt() */ -template +template template -void LLT::solveInPlace(MatrixBase &bAndX) const +void LLT::solveInPlace(const MatrixBase &bAndX) const { eigen_assert(m_isInitialized && "LLT is not initialized."); eigen_assert(m_matrix.rows()==bAndX.rows()); @@ -356,8 +521,8 @@ void LLT::solveInPlace(MatrixBase &bAndX) const /** \returns the matrix represented by the decomposition, * i.e., it returns the product: L L^*. * This function is provided for debug purpose. */ -template -MatrixType LLT::reconstructedMatrix() const +template +MatrixType LLT::reconstructedMatrix() const { eigen_assert(m_isInitialized && "LLT is not initialized."); return matrixL() * matrixL().adjoint().toDenseMatrix(); @@ -365,6 +530,7 @@ MatrixType LLT::reconstructedMatrix() const /** \cholesky_module * \returns the LLT decomposition of \c *this + * \sa SelfAdjointView::llt() */ template inline const LLT::PlainObject> @@ -375,6 +541,7 @@ MatrixBase::llt() const /** \cholesky_module * \returns the LLT decomposition of \c *this + * \sa SelfAdjointView::llt() */ template inline const LLT::PlainObject, UpLo> @@ -383,4 +550,6 @@ SelfAdjointView::llt() const return LLT(m_matrix); } +} // end namespace Eigen + #endif // EIGEN_LLT_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LLT_LAPACKE.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LLT_LAPACKE.h new file mode 100644 index 0000000..62bc679 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Cholesky/LLT_LAPACKE.h @@ -0,0 +1,121 @@ +/* + Copyright (c) 2011, Intel Corporation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ******************************************************************************** + * Content : Eigen bindings to LAPACKe + * LLt decomposition based on LAPACKE_?potrf function. + ******************************************************************************** +*/ + +#ifndef EIGEN_LLT_LAPACKE_H +#define EIGEN_LLT_LAPACKE_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +namespace lapacke_helpers { + // ------------------------------------------------------------------------------------------------------------------- + // Dispatch for rank update handling upper and lower parts + // ------------------------------------------------------------------------------------------------------------------- + + template + struct rank_update {}; + + template<> + struct rank_update { + template + static Index run(MatrixType &mat, const VectorType &vec, const typename MatrixType::RealScalar &sigma) { + return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); + } + }; + + template<> + struct rank_update { + template + static Index run(MatrixType &mat, const VectorType &vec, const typename MatrixType::RealScalar &sigma) { + Transpose matt(mat); + return Eigen::internal::llt_rank_update_lower(matt, vec.conjugate(), sigma); + } + }; + + // ------------------------------------------------------------------------------------------------------------------- + // Generic lapacke llt implementation that hands of to the dispatches + // ------------------------------------------------------------------------------------------------------------------- + + template + struct lapacke_llt { + template + static Index blocked(MatrixType& m) + { + eigen_assert(m.rows() == m.cols()); + if(m.rows() == 0) { + return -1; + } + /* Set up parameters for ?potrf */ + lapack_int size = to_lapack(m.rows()); + lapack_int matrix_order = lapack_storage_of(m); + Scalar* a = &(m.coeffRef(0,0)); + lapack_int lda = to_lapack(m.outerStride()); + + lapack_int info = potrf(matrix_order, translate_mode, size, to_lapack(a), lda ); + info = (info==0) ? -1 : info>0 ? info-1 : size; + return info; + } + + template + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) + { + return rank_update::run(mat, vec, sigma); + } + }; +} +// end namespace lapacke_helpers + +/* + * Here, we just put the generic implementation from lapacke_llt into a full specialization of the llt_inplace + * type. By being a full specialization, the versions defined here thus get precedence over the generic implementation + * in LLT.h for double, float and complex double, complex float types. + */ + +#define EIGEN_LAPACKE_LLT(EIGTYPE) \ +template<> struct llt_inplace : public lapacke_helpers::lapacke_llt {}; \ +template<> struct llt_inplace : public lapacke_helpers::lapacke_llt {}; + +EIGEN_LAPACKE_LLT(double) +EIGEN_LAPACKE_LLT(float) +EIGEN_LAPACKE_LLT(std::complex) +EIGEN_LAPACKE_LLT(std::complex) + +#undef EIGEN_LAPACKE_LLT + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_LLT_LAPACKE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/CholmodSupport/CholmodSupport.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/CholmodSupport/CholmodSupport.h new file mode 100644 index 0000000..91c1cfc --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/CholmodSupport/CholmodSupport.h @@ -0,0 +1,684 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CHOLMODSUPPORT_H +#define EIGEN_CHOLMODSUPPORT_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +template struct cholmod_configure_matrix; + +template<> struct cholmod_configure_matrix { + template + static void run(CholmodType& mat) { + mat.xtype = CHOLMOD_REAL; + mat.dtype = CHOLMOD_DOUBLE; + } +}; + +template<> struct cholmod_configure_matrix > { + template + static void run(CholmodType& mat) { + mat.xtype = CHOLMOD_COMPLEX; + mat.dtype = CHOLMOD_DOUBLE; + } +}; + +// Other scalar types are not yet supported by Cholmod +// template<> struct cholmod_configure_matrix { +// template +// static void run(CholmodType& mat) { +// mat.xtype = CHOLMOD_REAL; +// mat.dtype = CHOLMOD_SINGLE; +// } +// }; +// +// template<> struct cholmod_configure_matrix > { +// template +// static void run(CholmodType& mat) { +// mat.xtype = CHOLMOD_COMPLEX; +// mat.dtype = CHOLMOD_SINGLE; +// } +// }; + +} // namespace internal + +/** Wraps the Eigen sparse matrix \a mat into a Cholmod sparse matrix object. + * Note that the data are shared. + */ +template +cholmod_sparse viewAsCholmod(Ref > mat) +{ + cholmod_sparse res; + res.nzmax = mat.nonZeros(); + res.nrow = mat.rows(); + res.ncol = mat.cols(); + res.p = mat.outerIndexPtr(); + res.i = mat.innerIndexPtr(); + res.x = mat.valuePtr(); + res.z = 0; + res.sorted = 1; + if(mat.isCompressed()) + { + res.packed = 1; + res.nz = 0; + } + else + { + res.packed = 0; + res.nz = mat.innerNonZeroPtr(); + } + + res.dtype = 0; + res.stype = -1; + + if (internal::is_same::value) + { + res.itype = CHOLMOD_INT; + } + else if (internal::is_same::value) + { + res.itype = CHOLMOD_LONG; + } + else + { + eigen_assert(false && "Index type not supported yet"); + } + + // setup res.xtype + internal::cholmod_configure_matrix::run(res); + + res.stype = 0; + + return res; +} + +template +const cholmod_sparse viewAsCholmod(const SparseMatrix& mat) +{ + cholmod_sparse res = viewAsCholmod(Ref >(mat.const_cast_derived())); + return res; +} + +template +const cholmod_sparse viewAsCholmod(const SparseVector& mat) +{ + cholmod_sparse res = viewAsCholmod(Ref >(mat.const_cast_derived())); + return res; +} + +/** Returns a view of the Eigen sparse matrix \a mat as Cholmod sparse matrix. + * The data are not copied but shared. */ +template +cholmod_sparse viewAsCholmod(const SparseSelfAdjointView, UpLo>& mat) +{ + cholmod_sparse res = viewAsCholmod(Ref >(mat.matrix().const_cast_derived())); + + if(UpLo==Upper) res.stype = 1; + if(UpLo==Lower) res.stype = -1; + // swap stype for rowmajor matrices (only works for real matrices) + EIGEN_STATIC_ASSERT((Options_ & RowMajorBit) == 0 || NumTraits::IsComplex == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + if(Options_ & RowMajorBit) res.stype *=-1; + + return res; +} + +/** Returns a view of the Eigen \b dense matrix \a mat as Cholmod dense matrix. + * The data are not copied but shared. */ +template +cholmod_dense viewAsCholmod(MatrixBase& mat) +{ + EIGEN_STATIC_ASSERT((internal::traits::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + typedef typename Derived::Scalar Scalar; + + cholmod_dense res; + res.nrow = mat.rows(); + res.ncol = mat.cols(); + res.nzmax = res.nrow * res.ncol; + res.d = Derived::IsVectorAtCompileTime ? mat.derived().size() : mat.derived().outerStride(); + res.x = (void*)(mat.derived().data()); + res.z = 0; + + internal::cholmod_configure_matrix::run(res); + + return res; +} + +/** Returns a view of the Cholmod sparse matrix \a cm as an Eigen sparse matrix. + * The data are not copied but shared. */ +template +Map > viewAsEigen(cholmod_sparse& cm) +{ + return Map > + (cm.nrow, cm.ncol, static_cast(cm.p)[cm.ncol], + static_cast(cm.p), static_cast(cm.i),static_cast(cm.x) ); +} + +namespace internal { + +// template specializations for int and long that call the correct cholmod method + +#define EIGEN_CHOLMOD_SPECIALIZE0(ret, name) \ + template inline ret cm_ ## name (cholmod_common &Common) { return cholmod_ ## name (&Common); } \ + template<> inline ret cm_ ## name (cholmod_common &Common) { return cholmod_l_ ## name (&Common); } + +#define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \ + template inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return cholmod_ ## name (&a1, &Common); } \ + template<> inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return cholmod_l_ ## name (&a1, &Common); } + +EIGEN_CHOLMOD_SPECIALIZE0(int, start) +EIGEN_CHOLMOD_SPECIALIZE0(int, finish) + +EIGEN_CHOLMOD_SPECIALIZE1(int, free_factor, cholmod_factor*, L) +EIGEN_CHOLMOD_SPECIALIZE1(int, free_dense, cholmod_dense*, X) +EIGEN_CHOLMOD_SPECIALIZE1(int, free_sparse, cholmod_sparse*, A) + +EIGEN_CHOLMOD_SPECIALIZE1(cholmod_factor*, analyze, cholmod_sparse, A) + +template inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return cholmod_solve (sys, &L, &B, &Common); } +template<> inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return cholmod_l_solve (sys, &L, &B, &Common); } + +template inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_spsolve (sys, &L, &B, &Common); } +template<> inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_l_spsolve (sys, &L, &B, &Common); } + +template +inline int cm_factorize_p (cholmod_sparse* A, double beta[2], StorageIndex_* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return cholmod_factorize_p (A, beta, fset, fsize, L, &Common); } +template<> +inline int cm_factorize_p (cholmod_sparse* A, double beta[2], SuiteSparse_long* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return cholmod_l_factorize_p (A, beta, fset, fsize, L, &Common); } + +#undef EIGEN_CHOLMOD_SPECIALIZE0 +#undef EIGEN_CHOLMOD_SPECIALIZE1 + +} // namespace internal + + +enum CholmodMode { + CholmodAuto, CholmodSimplicialLLt, CholmodSupernodalLLt, CholmodLDLt +}; + + +/** \ingroup CholmodSupport_Module + * \class CholmodBase + * \brief The base class for the direct Cholesky factorization of Cholmod + * \sa class CholmodSupernodalLLT, class CholmodSimplicialLDLT, class CholmodSimplicialLLT + */ +template +class CholmodBase : public SparseSolverBase +{ + protected: + typedef SparseSolverBase Base; + using Base::derived; + using Base::m_isInitialized; + public: + typedef MatrixType_ MatrixType; + enum { UpLo = UpLo_ }; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef MatrixType CholMatrixType; + typedef typename MatrixType::StorageIndex StorageIndex; + enum { + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime + }; + + public: + + CholmodBase() + : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) + { + EIGEN_STATIC_ASSERT((internal::is_same::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); + m_shiftOffset[0] = m_shiftOffset[1] = 0.0; + internal::cm_start(m_cholmod); + } + + explicit CholmodBase(const MatrixType& matrix) + : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) + { + EIGEN_STATIC_ASSERT((internal::is_same::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); + m_shiftOffset[0] = m_shiftOffset[1] = 0.0; + internal::cm_start(m_cholmod); + compute(matrix); + } + + ~CholmodBase() + { + if(m_cholmodFactor) + internal::cm_free_factor(m_cholmodFactor, m_cholmod); + internal::cm_finish(m_cholmod); + } + + inline StorageIndex cols() const { return internal::convert_index(m_cholmodFactor->n); } + inline StorageIndex rows() const { return internal::convert_index(m_cholmodFactor->n); } + + /** \brief Reports whether previous computation was successful. + * + * \returns \c Success if computation was successful, + * \c NumericalIssue if the matrix.appears to be negative. + */ + ComputationInfo info() const + { + eigen_assert(m_isInitialized && "Decomposition is not initialized."); + return m_info; + } + + /** Computes the sparse Cholesky decomposition of \a matrix */ + Derived& compute(const MatrixType& matrix) + { + analyzePattern(matrix); + factorize(matrix); + return derived(); + } + + /** Performs a symbolic decomposition on the sparsity pattern of \a matrix. + * + * This function is particularly useful when solving for several problems having the same structure. + * + * \sa factorize() + */ + void analyzePattern(const MatrixType& matrix) + { + if(m_cholmodFactor) + { + internal::cm_free_factor(m_cholmodFactor, m_cholmod); + m_cholmodFactor = 0; + } + cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); + m_cholmodFactor = internal::cm_analyze(A, m_cholmod); + + this->m_isInitialized = true; + this->m_info = Success; + m_analysisIsOk = true; + m_factorizationIsOk = false; + } + + /** Performs a numeric decomposition of \a matrix + * + * The given matrix must have the same sparsity pattern as the matrix on which the symbolic decomposition has been performed. + * + * \sa analyzePattern() + */ + void factorize(const MatrixType& matrix) + { + eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); + cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); + internal::cm_factorize_p(&A, m_shiftOffset, 0, 0, m_cholmodFactor, m_cholmod); + + // If the factorization failed, minor is the column at which it did. On success minor == n. + this->m_info = (m_cholmodFactor->minor == m_cholmodFactor->n ? Success : NumericalIssue); + m_factorizationIsOk = true; + } + + /** Returns a reference to the Cholmod's configuration structure to get a full control over the performed operations. + * See the Cholmod user guide for details. */ + cholmod_common& cholmod() { return m_cholmod; } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal */ + template + void _solve_impl(const MatrixBase &b, MatrixBase &dest) const + { + eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); + const Index size = m_cholmodFactor->n; + EIGEN_UNUSED_VARIABLE(size); + eigen_assert(size==b.rows()); + + // Cholmod needs column-major storage without inner-stride, which corresponds to the default behavior of Ref. + Ref > b_ref(b.derived()); + + cholmod_dense b_cd = viewAsCholmod(b_ref); + cholmod_dense* x_cd = internal::cm_solve(CHOLMOD_A, *m_cholmodFactor, b_cd, m_cholmod); + if(!x_cd) + { + this->m_info = NumericalIssue; + return; + } + // TODO optimize this copy by swapping when possible (be careful with alignment, etc.) + // NOTE Actually, the copy can be avoided by calling cholmod_solve2 instead of cholmod_solve + dest = Matrix::Map(reinterpret_cast(x_cd->x),b.rows(),b.cols()); + internal::cm_free_dense(x_cd, m_cholmod); + } + + /** \internal */ + template + void _solve_impl(const SparseMatrixBase &b, SparseMatrixBase &dest) const + { + eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); + const Index size = m_cholmodFactor->n; + EIGEN_UNUSED_VARIABLE(size); + eigen_assert(size==b.rows()); + + // note: cs stands for Cholmod Sparse + Ref > b_ref(b.const_cast_derived()); + cholmod_sparse b_cs = viewAsCholmod(b_ref); + cholmod_sparse* x_cs = internal::cm_spsolve(CHOLMOD_A, *m_cholmodFactor, b_cs, m_cholmod); + if(!x_cs) + { + this->m_info = NumericalIssue; + return; + } + // TODO optimize this copy by swapping when possible (be careful with alignment, etc.) + // NOTE cholmod_spsolve in fact just calls the dense solver for blocks of 4 columns at a time (similar to Eigen's sparse solver) + dest.derived() = viewAsEigen(*x_cs); + internal::cm_free_sparse(x_cs, m_cholmod); + } + #endif // EIGEN_PARSED_BY_DOXYGEN + + + /** Sets the shift parameter that will be used to adjust the diagonal coefficients during the numerical factorization. + * + * During the numerical factorization, an offset term is added to the diagonal coefficients:\n + * \c d_ii = \a offset + \c d_ii + * + * The default is \a offset=0. + * + * \returns a reference to \c *this. + */ + Derived& setShift(const RealScalar& offset) + { + m_shiftOffset[0] = double(offset); + return derived(); + } + + /** \returns the determinant of the underlying matrix from the current factorization */ + Scalar determinant() const + { + using std::exp; + return exp(logDeterminant()); + } + + /** \returns the log determinant of the underlying matrix from the current factorization */ + Scalar logDeterminant() const + { + using std::log; + using numext::real; + eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); + + RealScalar logDet = 0; + Scalar *x = static_cast(m_cholmodFactor->x); + if (m_cholmodFactor->is_super) + { + // Supernodal factorization stored as a packed list of dense column-major blocs, + // as described by the following structure: + + // super[k] == index of the first column of the j-th super node + StorageIndex *super = static_cast(m_cholmodFactor->super); + // pi[k] == offset to the description of row indices + StorageIndex *pi = static_cast(m_cholmodFactor->pi); + // px[k] == offset to the respective dense block + StorageIndex *px = static_cast(m_cholmodFactor->px); + + Index nb_super_nodes = m_cholmodFactor->nsuper; + for (Index k=0; k < nb_super_nodes; ++k) + { + StorageIndex ncols = super[k + 1] - super[k]; + StorageIndex nrows = pi[k + 1] - pi[k]; + + Map, 0, InnerStride<> > sk(x + px[k], ncols, InnerStride<>(nrows+1)); + logDet += sk.real().log().sum(); + } + } + else + { + // Simplicial factorization stored as standard CSC matrix. + StorageIndex *p = static_cast(m_cholmodFactor->p); + Index size = m_cholmodFactor->n; + for (Index k=0; kis_ll) + logDet *= 2.0; + return logDet; + } + + template + void dumpMemory(Stream& /*s*/) + {} + + protected: + mutable cholmod_common m_cholmod; + cholmod_factor* m_cholmodFactor; + double m_shiftOffset[2]; + mutable ComputationInfo m_info; + int m_factorizationIsOk; + int m_analysisIsOk; +}; + +/** \ingroup CholmodSupport_Module + * \class CholmodSimplicialLLT + * \brief A simplicial direct Cholesky (LLT) factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a simplicial LL^T Cholesky factorization + * using the Cholmod library. + * This simplicial variant is equivalent to Eigen's built-in SimplicialLLT class. Therefore, it has little practical interest. + * The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices + * X and B can be either dense or sparse. + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower + * or Upper. Default is Lower. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept, class CholmodSupernodalLLT, class SimplicialLLT + */ +template +class CholmodSimplicialLLT : public CholmodBase > +{ + typedef CholmodBase Base; + using Base::m_cholmod; + + public: + + typedef MatrixType_ MatrixType; + + CholmodSimplicialLLT() : Base() { init(); } + + CholmodSimplicialLLT(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodSimplicialLLT() {} + protected: + void init() + { + m_cholmod.final_asis = 0; + m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; + m_cholmod.final_ll = 1; + } +}; + + +/** \ingroup CholmodSupport_Module + * \class CholmodSimplicialLDLT + * \brief A simplicial direct Cholesky (LDLT) factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a simplicial LDL^T Cholesky factorization + * using the Cholmod library. + * This simplicial variant is equivalent to Eigen's built-in SimplicialLDLT class. Therefore, it has little practical interest. + * The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices + * X and B can be either dense or sparse. + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower + * or Upper. Default is Lower. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept, class CholmodSupernodalLLT, class SimplicialLDLT + */ +template +class CholmodSimplicialLDLT : public CholmodBase > +{ + typedef CholmodBase Base; + using Base::m_cholmod; + + public: + + typedef MatrixType_ MatrixType; + + CholmodSimplicialLDLT() : Base() { init(); } + + CholmodSimplicialLDLT(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodSimplicialLDLT() {} + protected: + void init() + { + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; + } +}; + +/** \ingroup CholmodSupport_Module + * \class CholmodSupernodalLLT + * \brief A supernodal Cholesky (LLT) factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a supernodal LL^T Cholesky factorization + * using the Cholmod library. + * This supernodal variant performs best on dense enough problems, e.g., 3D FEM, or very high order 2D FEM. + * The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices + * X and B can be either dense or sparse. + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower + * or Upper. Default is Lower. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept + */ +template +class CholmodSupernodalLLT : public CholmodBase > +{ + typedef CholmodBase Base; + using Base::m_cholmod; + + public: + + typedef MatrixType_ MatrixType; + + CholmodSupernodalLLT() : Base() { init(); } + + CholmodSupernodalLLT(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodSupernodalLLT() {} + protected: + void init() + { + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_SUPERNODAL; + } +}; + +/** \ingroup CholmodSupport_Module + * \class CholmodDecomposition + * \brief A general Cholesky factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a LL^T or LDL^T Cholesky factorization + * using the Cholmod library. The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices + * X and B can be either dense or sparse. + * + * This variant permits to change the underlying Cholesky method at runtime. + * On the other hand, it does not provide access to the result of the factorization. + * The default is to let Cholmod automatically choose between a simplicial and supernodal factorization. + * + * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower + * or Upper. Default is Lower. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept + */ +template +class CholmodDecomposition : public CholmodBase > +{ + typedef CholmodBase Base; + using Base::m_cholmod; + + public: + + typedef MatrixType_ MatrixType; + + CholmodDecomposition() : Base() { init(); } + + CholmodDecomposition(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodDecomposition() {} + + void setMode(CholmodMode mode) + { + switch(mode) + { + case CholmodAuto: + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_AUTO; + break; + case CholmodSimplicialLLt: + m_cholmod.final_asis = 0; + m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; + m_cholmod.final_ll = 1; + break; + case CholmodSupernodalLLt: + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_SUPERNODAL; + break; + case CholmodLDLt: + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; + break; + default: + break; + } + } + protected: + void init() + { + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_AUTO; + } +}; + +} // end namespace Eigen + +#endif // EIGEN_CHOLMODSUPPORT_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/CholmodSupport/InternalHeaderCheck.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/CholmodSupport/InternalHeaderCheck.h new file mode 100644 index 0000000..0fb3abc --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/CholmodSupport/InternalHeaderCheck.h @@ -0,0 +1,3 @@ +#ifndef EIGEN_CHOLMODSUPPORT_MODULE_H +#error "Please include Eigen/CholmodSupport instead of including headers inside the src directory directly." +#endif diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArithmeticSequence.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArithmeticSequence.h new file mode 100644 index 0000000..81005c5 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArithmeticSequence.h @@ -0,0 +1,258 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2017 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ARITHMETIC_SEQUENCE_H +#define EIGEN_ARITHMETIC_SEQUENCE_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +// Helper to cleanup the type of the increment: +template struct cleanup_seq_incr { + typedef typename cleanup_index_type::type type; +}; + +} // namespace internal + +//-------------------------------------------------------------------------------- +// seq(first,last,incr) and seqN(first,size,incr) +//-------------------------------------------------------------------------------- + +template > +class ArithmeticSequence; + +template +ArithmeticSequence::type, + typename internal::cleanup_index_type::type, + typename internal::cleanup_seq_incr::type > +seqN(FirstType first, SizeType size, IncrType incr); + +/** \class ArithmeticSequence + * \ingroup Core_Module + * + * This class represents an arithmetic progression \f$ a_0, a_1, a_2, ..., a_{n-1}\f$ defined by + * its \em first value \f$ a_0 \f$, its \em size (aka length) \em n, and the \em increment (aka stride) + * that is equal to \f$ a_{i+1}-a_{i}\f$ for any \em i. + * + * It is internally used as the return type of the Eigen::seq and Eigen::seqN functions, and as the input arguments + * of DenseBase::operator()(const RowIndices&, const ColIndices&), and most of the time this is the + * only way it is used. + * + * \tparam FirstType type of the first element, usually an Index, + * but internally it can be a symbolic expression + * \tparam SizeType type representing the size of the sequence, usually an Index + * or a compile time integral constant. Internally, it can also be a symbolic expression + * \tparam IncrType type of the increment, can be a runtime Index, or a compile time integral constant (default is compile-time 1) + * + * \sa Eigen::seq, Eigen::seqN, DenseBase::operator()(const RowIndices&, const ColIndices&), class IndexedView + */ +template +class ArithmeticSequence +{ +public: + ArithmeticSequence(FirstType first, SizeType size) : m_first(first), m_size(size) {} + ArithmeticSequence(FirstType first, SizeType size, IncrType incr) : m_first(first), m_size(size), m_incr(incr) {} + + enum { + SizeAtCompileTime = internal::get_fixed_value::value, + IncrAtCompileTime = internal::get_fixed_value::value + }; + + /** \returns the size, i.e., number of elements, of the sequence */ + Index size() const { return m_size; } + + /** \returns the first element \f$ a_0 \f$ in the sequence */ + Index first() const { return m_first; } + + /** \returns the value \f$ a_i \f$ at index \a i in the sequence. */ + Index operator[](Index i) const { return m_first + i * m_incr; } + + const FirstType& firstObject() const { return m_first; } + const SizeType& sizeObject() const { return m_size; } + const IncrType& incrObject() const { return m_incr; } + +protected: + FirstType m_first; + SizeType m_size; + IncrType m_incr; + +public: + auto reverse() const -> decltype(Eigen::seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr)) { + return seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr); + } +}; + +/** \returns an ArithmeticSequence starting at \a first, of length \a size, and increment \a incr + * + * \sa seqN(FirstType,SizeType), seq(FirstType,LastType,IncrType) */ +template +ArithmeticSequence::type,typename internal::cleanup_index_type::type,typename internal::cleanup_seq_incr::type > +seqN(FirstType first, SizeType size, IncrType incr) { + return ArithmeticSequence::type,typename internal::cleanup_index_type::type,typename internal::cleanup_seq_incr::type>(first,size,incr); +} + +/** \returns an ArithmeticSequence starting at \a first, of length \a size, and unit increment + * + * \sa seqN(FirstType,SizeType,IncrType), seq(FirstType,LastType) */ +template +ArithmeticSequence::type,typename internal::cleanup_index_type::type > +seqN(FirstType first, SizeType size) { + return ArithmeticSequence::type,typename internal::cleanup_index_type::type>(first,size); +} + +#ifdef EIGEN_PARSED_BY_DOXYGEN + +/** \returns an ArithmeticSequence starting at \a f, up (or down) to \a l, and with positive (or negative) increment \a incr + * + * It is essentially an alias to: + * \code + * seqN(f, (l-f+incr)/incr, incr); + * \endcode + * + * \sa seqN(FirstType,SizeType,IncrType), seq(FirstType,LastType) + */ +template +auto seq(FirstType f, LastType l, IncrType incr); + +/** \returns an ArithmeticSequence starting at \a f, up (or down) to \a l, and unit increment + * + * It is essentially an alias to: + * \code + * seqN(f,l-f+1); + * \endcode + * + * \sa seqN(FirstType,SizeType), seq(FirstType,LastType,IncrType) + */ +template +auto seq(FirstType f, LastType l); + +#else // EIGEN_PARSED_BY_DOXYGEN + +template +auto seq(FirstType f, LastType l) -> decltype(seqN(typename internal::cleanup_index_type::type(f), + ( typename internal::cleanup_index_type::type(l) + - typename internal::cleanup_index_type::type(f)+fix<1>()))) +{ + return seqN(typename internal::cleanup_index_type::type(f), + (typename internal::cleanup_index_type::type(l) + -typename internal::cleanup_index_type::type(f)+fix<1>())); +} + +template +auto seq(FirstType f, LastType l, IncrType incr) + -> decltype(seqN(typename internal::cleanup_index_type::type(f), + ( typename internal::cleanup_index_type::type(l) + - typename internal::cleanup_index_type::type(f)+typename internal::cleanup_seq_incr::type(incr) + ) / typename internal::cleanup_seq_incr::type(incr), + typename internal::cleanup_seq_incr::type(incr))) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(typename internal::cleanup_index_type::type(f), + ( typename internal::cleanup_index_type::type(l) + -typename internal::cleanup_index_type::type(f)+CleanedIncrType(incr)) / CleanedIncrType(incr), + CleanedIncrType(incr)); +} + + +#endif // EIGEN_PARSED_BY_DOXYGEN + +namespace placeholders { + +/** \cpp11 + * \returns a symbolic ArithmeticSequence representing the last \a size elements with increment \a incr. + * + * It is a shortcut for: \code seqN(last-(size-fix<1>)*incr, size, incr) \endcode + * + * \sa lastN(SizeType), seqN(FirstType,SizeType), seq(FirstType,LastType,IncrType) */ +template +auto lastN(SizeType size, IncrType incr) +-> decltype(seqN(Eigen::placeholders::last-(size-fix<1>())*incr, size, incr)) +{ + return seqN(Eigen::placeholders::last-(size-fix<1>())*incr, size, incr); +} + +/** \cpp11 + * \returns a symbolic ArithmeticSequence representing the last \a size elements with a unit increment. + * + * It is a shortcut for: \code seq(last+fix<1>-size, last) \endcode + * + * \sa lastN(SizeType,IncrType, seqN(FirstType,SizeType), seq(FirstType,LastType) */ +template +auto lastN(SizeType size) +-> decltype(seqN(Eigen::placeholders::last+fix<1>()-size, size)) +{ + return seqN(Eigen::placeholders::last+fix<1>()-size, size); +} + +} // namespace placeholders + +namespace internal { + +// Convert a symbolic span into a usable one (i.e., remove last/end "keywords") +template +struct make_size_type { + typedef std::conditional_t::value, Index, T> type; +}; + +template +struct IndexedViewCompatibleType, XprSize> { + typedef ArithmeticSequence::type,IncrType> type; +}; + +template +ArithmeticSequence::type,IncrType> +makeIndexedViewCompatible(const ArithmeticSequence& ids, Index size,SpecializedType) { + return ArithmeticSequence::type,IncrType>( + eval_expr_given_size(ids.firstObject(),size),eval_expr_given_size(ids.sizeObject(),size),ids.incrObject()); +} + +template +struct get_compile_time_incr > { + enum { value = get_fixed_value::value }; +}; + +} // end namespace internal + +/** \namespace Eigen::indexing + * \ingroup Core_Module + * + * The sole purpose of this namespace is to be able to import all functions + * and symbols that are expected to be used within operator() for indexing + * and slicing. If you already imported the whole Eigen namespace: + * \code using namespace Eigen; \endcode + * then you are already all set. Otherwise, if you don't want/cannot import + * the whole Eigen namespace, the following line: + * \code using namespace Eigen::indexing; \endcode + * is equivalent to: + * \code + using Eigen::fix; + using Eigen::seq; + using Eigen::seqN; + using Eigen::placeholders::all; + using Eigen::placeholders::last; + using Eigen::placeholders::lastN; // c++11 only + using Eigen::placeholders::lastp1; + \endcode + */ +namespace indexing { + using Eigen::fix; + using Eigen::seq; + using Eigen::seqN; + using Eigen::placeholders::all; + using Eigen::placeholders::last; + using Eigen::placeholders::lastN; + using Eigen::placeholders::lastp1; +} + +} // end namespace Eigen + +#endif // EIGEN_ARITHMETIC_SEQUENCE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Array.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Array.h index a11fb1b..7be8971 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Array.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Array.h @@ -3,29 +3,27 @@ // // Copyright (C) 2009 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ARRAY_H #define EIGEN_ARRAY_H -/** \class Array +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { +template +struct traits > : traits > +{ + typedef ArrayXpr XprKind; + typedef ArrayBase > XprBase; +}; +} + +/** \class Array * \ingroup Core_Module * * \brief General-purpose arrays with easy API for coefficient-wise operations @@ -37,30 +35,24 @@ * API for the %Matrix class provides easy access to linear-algebra * operations. * + * See documentation of class Matrix for detailed information on the template parameters + * storage layout. + * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_ARRAY_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_ARRAY_PLUGIN. * - * \sa \ref TutorialArrayClass, \ref TopicClassHierarchy + * \sa \blank \ref TutorialArrayClass, \ref TopicClassHierarchy */ -namespace internal { -template -struct traits > : traits > -{ - typedef ArrayXpr XprKind; - typedef ArrayBase > XprBase; -}; -} - -template +template class Array - : public PlainObjectBase > + : public PlainObjectBase > { public: typedef PlainObjectBase Base; EIGEN_DENSE_PUBLIC_INTERFACE(Array) - enum { Options = _Options }; + enum { Options = Options_ }; typedef typename Base::PlainObject PlainObject; protected: @@ -82,11 +74,27 @@ class Array * the usage of 'using'. This should be done only for operator=. */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array& operator=(const EigenBase &other) { return Base::operator=(other); } + /** Set all the entries to \a value. + * \sa DenseBase::setConstant(), DenseBase::fill() + */ + /* This overload is needed because the usage of + * using Base::operator=; + * fails on MSVC. Since the code below is working with GCC and MSVC, we skipped + * the usage of 'using'. This should be done only for operator=. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const Scalar &value) + { + Base::setConstant(value); + return *this; + } + /** Copies the value of the expression \a other into \c *this with automatic resizing. * * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), @@ -97,7 +105,8 @@ class Array * remain row-vectors and vectors remain vectors. */ template - EIGEN_STRONG_INLINE Array& operator=(const ArrayBase& other) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const DenseBase& other) { return Base::_set(other); } @@ -105,6 +114,7 @@ class Array /** This is a special case of the templated operator=. Its purpose is to * prevent a default operator= from hiding the templated operator=. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array& operator=(const Array& other) { return Base::_set(other); @@ -120,122 +130,159 @@ class Array * * \sa resize(Index,Index) */ - EIGEN_STRONG_INLINE explicit Array() : Base() + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array() : Base() { - Base::_check_template_params(); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #ifndef EIGEN_PARSED_BY_DOXYGEN // FIXME is it still needed ?? /** \internal */ + EIGEN_DEVICE_FUNC Array(internal::constructor_without_unaligned_array_assert) : Base(internal::constructor_without_unaligned_array_assert()) { - Base::_check_template_params(); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #endif - /** Constructs a vector or row-vector with given dimension. \only_for_vectors + EIGEN_DEVICE_FUNC + Array(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) + : Base(std::move(other)) + { + } + EIGEN_DEVICE_FUNC + Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) + { + Base::operator=(std::move(other)); + return *this; + } + + /** \copydoc PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + * + * Example: \include Array_variadic_ctor_cxx11.cpp + * Output: \verbinclude Array_variadic_ctor_cxx11.out + * + * \sa Array(const std::initializer_list>&) + * \sa Array(const Scalar&), Array(const Scalar&,const Scalar&) + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + : Base(a0, a1, a2, a3, args...) {} + + /** \brief Constructs an array and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11 * - * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, - * it is redundant to pass the dimension here, so it makes more sense to use the default - * constructor Matrix() instead. + * In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients: + * + * Example: \include Array_initializer_list_23_cxx11.cpp + * Output: \verbinclude Array_initializer_list_23_cxx11.out + * + * Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered. + * + * In the case of a compile-time column 1D array, implicit transposition from a single row is allowed. + * Therefore Array{{1,2,3,4,5}} is legal and the more verbose syntax + * Array{{1},{2},{3},{4},{5}} can be avoided: + * + * Example: \include Array_initializer_list_vector_cxx11.cpp + * Output: \verbinclude Array_initializer_list_vector_cxx11.out + * + * In the case of fixed-sized arrays, the initializer list sizes must exactly match the array sizes, + * and implicit transposition is allowed for compile-time 1D arrays only. + * + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) */ - EIGEN_STRONG_INLINE explicit Array(Index dim) - : Base(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const std::initializer_list>& list) : Base(list) {} + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE explicit Array(const T& x) { - Base::_check_template_params(); - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Array) - eigen_assert(dim >= 0); - eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + Base::template _init1(x); } - #ifndef EIGEN_PARSED_BY_DOXYGEN template - EIGEN_STRONG_INLINE Array(const T0& x, const T1& y) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const T0& val0, const T1& val1) { - Base::_check_template_params(); - this->template _init2(x, y); + this->template _init2(val0, val1); } + #else - /** constructs an uninitialized matrix with \a rows rows and \a cols columns. + /** \brief Constructs a fixed-sized array initialized with coefficients starting at \a data */ + EIGEN_DEVICE_FUNC explicit Array(const Scalar *data); + /** Constructs a vector or row-vector with given dimension. \only_for_vectors * - * This is useful for dynamic-size matrices. For fixed-size matrices, + * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass the dimension here, so it makes more sense to use the default + * constructor Array() instead. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE explicit Array(Index dim); + /** constructs an initialized 1x1 Array with the given coefficient + * \sa const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args */ + Array(const Scalar& value); + /** constructs an uninitialized array with \a rows rows and \a cols columns. + * + * This is useful for dynamic-size arrays. For fixed-size arrays, * it is redundant to pass these parameters, so one should use the default constructor - * Matrix() instead. */ + * Array() instead. */ Array(Index rows, Index cols); - /** constructs an initialized 2D vector with given coefficients */ - Array(const Scalar& x, const Scalar& y); - #endif + /** constructs an initialized 2D vector with given coefficients + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) */ + Array(const Scalar& val0, const Scalar& val1); + #endif // end EIGEN_PARSED_BY_DOXYGEN - /** constructs an initialized 3D vector with given coefficients */ - EIGEN_STRONG_INLINE Array(const Scalar& x, const Scalar& y, const Scalar& z) + /** constructs an initialized 3D vector with given coefficients + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2) { - Base::_check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 3) - m_storage.data()[0] = x; - m_storage.data()[1] = y; - m_storage.data()[2] = z; + m_storage.data()[0] = val0; + m_storage.data()[1] = val1; + m_storage.data()[2] = val2; } - /** constructs an initialized 4D vector with given coefficients */ - EIGEN_STRONG_INLINE Array(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) + /** constructs an initialized 4D vector with given coefficients + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2, const Scalar& val3) { - Base::_check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 4) - m_storage.data()[0] = x; - m_storage.data()[1] = y; - m_storage.data()[2] = z; - m_storage.data()[3] = w; + m_storage.data()[0] = val0; + m_storage.data()[1] = val1; + m_storage.data()[2] = val2; + m_storage.data()[3] = val3; } - explicit Array(const Scalar *data); - - /** Constructor copying the value of the expression \a other */ - template - EIGEN_STRONG_INLINE Array(const ArrayBase& other) - : Base(other.rows() * other.cols(), other.rows(), other.cols()) - { - Base::_check_template_params(); - Base::_set_noalias(other); - } /** Copy constructor */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array(const Array& other) - : Base(other.rows() * other.cols(), other.rows(), other.cols()) - { - Base::_check_template_params(); - Base::_set_noalias(other); - } - /** Copy constructor with in-place evaluation */ - template - EIGEN_STRONG_INLINE Array(const ReturnByValue& other) - { - Base::_check_template_params(); - Base::resize(other.rows(), other.cols()); - other.evalTo(*this); - } + : Base(other) + { } - /** \sa MatrixBase::operator=(const EigenBase&) */ - template - EIGEN_STRONG_INLINE Array(const EigenBase &other) - : Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) - { - Base::_check_template_params(); - Base::resize(other.rows(), other.cols()); - *this = other; - } + private: + struct PrivateType {}; + public: - /** Override MatrixBase::swap() since for dynamic-sized matrices of same type it is enough to swap the - * data pointers. - */ + /** \sa MatrixBase::operator=(const EigenBase&) */ template - void swap(ArrayBase const & other) - { this->_swap(other.derived()); } - - inline Index innerStride() const { return 1; } - inline Index outerStride() const { return this->innerSize(); } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const EigenBase &other, + std::enable_if_t::value, + PrivateType> = PrivateType()) + : Base(other.derived()) + { } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT{ return 1; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return this->innerSize(); } #ifdef EIGEN_ARRAY_PLUGIN #include EIGEN_ARRAY_PLUGIN @@ -250,7 +297,7 @@ class Array /** \defgroup arraytypedefs Global array typedefs * \ingroup Core_Module * - * Eigen defines several typedef shortcuts for most common 1D and 2D array types. + * %Eigen defines several typedef shortcuts for most common 1D and 2D array types. * * The general patterns are the following: * @@ -263,6 +310,12 @@ class Array * There are also \c ArraySizeType which are self-explanatory. For example, \c Array4cf is * a fixed-size 1D array of 4 complex floats. * + * With \cpp11, template alias are also defined for common sizes. + * They follow the same pattern as above except that the scalar type suffix is replaced by a + * template parameter, i.e.: + * - `ArrayRowsCols` where `Rows` and `Cols` can be \c 2,\c 3,\c 4, or \c X for fixed or dynamic size. + * - `ArraySize` where `Size` can be \c 2,\c 3,\c 4 or \c X for fixed or dynamic size 1D arrays. + * * \sa class Array */ @@ -295,8 +348,38 @@ EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex, cd) #undef EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES #undef EIGEN_MAKE_ARRAY_TYPEDEFS +#undef EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS + +#define EIGEN_MAKE_ARRAY_TYPEDEFS(Size, SizeSuffix) \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##SizeSuffix##SizeSuffix = Array; \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##SizeSuffix = Array; + +#define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Size) \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##Size##X = Array; \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##X##Size = Array; + +EIGEN_MAKE_ARRAY_TYPEDEFS(2, 2) +EIGEN_MAKE_ARRAY_TYPEDEFS(3, 3) +EIGEN_MAKE_ARRAY_TYPEDEFS(4, 4) +EIGEN_MAKE_ARRAY_TYPEDEFS(Dynamic, X) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(2) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(3) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(4) -#undef EIGEN_MAKE_ARRAY_TYPEDEFS_LARGE +#undef EIGEN_MAKE_ARRAY_TYPEDEFS +#undef EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS #define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ using Eigen::Matrix##SizeSuffix##TypeSuffix; \ @@ -316,5 +399,6 @@ EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(d) \ EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cf) \ EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cd) +} // end namespace Eigen #endif // EIGEN_ARRAY_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArrayBase.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArrayBase.h index 9399ac3..28397e5 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArrayBase.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArrayBase.h @@ -3,28 +3,17 @@ // // Copyright (C) 2009 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ARRAYBASE_H #define EIGEN_ARRAYBASE_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + template class MatrixWrapper; /** \class ArrayBase @@ -34,7 +23,7 @@ template class MatrixWrapper; * * An array is similar to a dense vector or matrix. While matrices are mathematical * objects with well defined linear algebra operators, an array is just a collection - * of scalar values arranged in a one or two dimensionnal fashion. As the main consequence, + * of scalar values arranged in a one or two dimensional fashion. As the main consequence, * all operations applied to an array are performed coefficient wise. Furthermore, * arrays support scalar math functions of the c++ standard library (e.g., std::sin(x)), and convenient * constructors allowing to easily write generic code working for both scalar values @@ -45,7 +34,7 @@ template class MatrixWrapper; * \tparam Derived is the derived type, e.g., an array or an expression type. * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_ARRAYBASE_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_ARRAYBASE_PLUGIN. * * \sa class MatrixBase, \ref TopicClassHierarchy */ @@ -59,11 +48,7 @@ template class ArrayBase typedef ArrayBase Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl; - using internal::special_scalar_op_base::Scalar, - typename NumTraits::Scalar>::Real>::operator*; - typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; @@ -77,8 +62,7 @@ template class ArrayBase using Base::MaxSizeAtCompileTime; using Base::IsVectorAtCompileTime; using Base::Flags; - using Base::CoeffReadCost; - + using Base::derived; using Base::const_cast_derived; using Base::rows; @@ -87,6 +71,7 @@ template class ArrayBase using Base::coeff; using Base::coeffRef; using Base::lazyAssign; + using Base::operator-; using Base::operator=; using Base::operator+=; using Base::operator-=; @@ -98,26 +83,14 @@ template class ArrayBase #endif // not EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN - /** \internal the plain matrix type corresponding to this expression. Note that is not necessarily - * exactly the return type of eval(): in the case of plain matrices, the return type of eval() is a const - * reference to a matrix, not a matrix! It is however guaranteed that the return type of eval() is either - * PlainObject or const PlainObject&. - */ - typedef Array::Scalar, - internal::traits::RowsAtCompileTime, - internal::traits::ColsAtCompileTime, - AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), - internal::traits::MaxRowsAtCompileTime, - internal::traits::MaxColsAtCompileTime - > PlainObject; - + typedef typename Base::PlainObject PlainObject; /** \internal Represents a matrix with all coefficients equal to one another*/ - typedef CwiseNullaryOp,Derived> ConstantReturnType; + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; #endif // not EIGEN_PARSED_BY_DOXYGEN #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::ArrayBase -# include "../plugins/CommonCwiseUnaryOps.h" +#define EIGEN_DOC_UNARY_ADDONS(X,Y) # include "../plugins/MatrixCwiseUnaryOps.h" # include "../plugins/ArrayCwiseUnaryOps.h" # include "../plugins/CommonCwiseBinaryOps.h" @@ -127,45 +100,63 @@ template class ArrayBase # include EIGEN_ARRAYBASE_PLUGIN # endif #undef EIGEN_CURRENT_STORAGE_BASE_CLASS +#undef EIGEN_DOC_UNARY_ADDONS /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const ArrayBase& other) { - return internal::assign_selector::run(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } - - Derived& operator+=(const Scalar& scalar) - { return *this = derived() + scalar; } - Derived& operator-=(const Scalar& scalar) - { return *this = derived() - scalar; } + + /** Set all the entries to \a value. + * \sa DenseBase::setConstant(), DenseBase::fill() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const Scalar &value) + { Base::setConstant(value); return derived(); } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator+=(const Scalar& scalar); + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator-=(const Scalar& scalar); template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator+=(const ArrayBase& other); template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator-=(const ArrayBase& other); template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator*=(const ArrayBase& other); template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator/=(const ArrayBase& other); public: + EIGEN_DEVICE_FUNC ArrayBase& array() { return *this; } + EIGEN_DEVICE_FUNC const ArrayBase& array() const { return *this; } - /** \returns an \link MatrixBase Matrix \endlink expression of this array + /** \returns an \link Eigen::MatrixBase Matrix \endlink expression of this array * \sa MatrixBase::array() */ - MatrixWrapper matrix() { return derived(); } - const MatrixWrapper matrix() const { return derived(); } + EIGEN_DEVICE_FUNC + MatrixWrapper matrix() { return MatrixWrapper(derived()); } + EIGEN_DEVICE_FUNC + const MatrixWrapper matrix() const { return MatrixWrapper(derived()); } // template // inline void evalTo(Dest& dst) const { dst = matrix(); } protected: - ArrayBase() : Base() {} + EIGEN_DEFAULT_COPY_CONSTRUCTOR(ArrayBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(ArrayBase) private: explicit ArrayBase(Index); @@ -174,10 +165,10 @@ template class ArrayBase protected: // mixing arrays and matrices is not legal template Derived& operator+=(const MatrixBase& ) - {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);} + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} // mixing arrays and matrices is not legal template Derived& operator-=(const MatrixBase& ) - {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);} + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} }; /** replaces \c *this by \c *this - \a other. @@ -186,11 +177,10 @@ template class ArrayBase */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & ArrayBase::operator-=(const ArrayBase &other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::sub_assign_op()); return derived(); } @@ -200,11 +190,10 @@ ArrayBase::operator-=(const ArrayBase &other) */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & ArrayBase::operator+=(const ArrayBase& other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::add_assign_op()); return derived(); } @@ -214,11 +203,10 @@ ArrayBase::operator+=(const ArrayBase& other) */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & ArrayBase::operator*=(const ArrayBase& other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::mul_assign_op()); return derived(); } @@ -228,12 +216,13 @@ ArrayBase::operator*=(const ArrayBase& other) */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & ArrayBase::operator/=(const ArrayBase& other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::div_assign_op()); return derived(); } +} // end namespace Eigen + #endif // EIGEN_ARRAYBASE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArrayWrapper.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArrayWrapper.h index 07f082e..e65b8fb 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArrayWrapper.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ArrayWrapper.h @@ -3,28 +3,17 @@ // // Copyright (C) 2009-2010 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ARRAYWRAPPER_H #define EIGEN_ARRAYWRAPPER_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + /** \class ArrayWrapper * \ingroup Core_Module * @@ -39,9 +28,15 @@ namespace internal { template struct traits > - : public traits::type > + : public traits > { typedef ArrayXpr XprKind; + // Let's remove NestByRefBit + enum { + Flags0 = traits >::Flags, + LvalueBitFlag = is_lvalue::value ? LvalueBit : 0, + Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag + }; }; } @@ -52,84 +47,69 @@ class ArrayWrapper : public ArrayBase > typedef ArrayBase Base; EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper) + typedef internal::remove_all_t NestedExpression; - typedef typename internal::conditional< + typedef std::conditional_t< internal::is_lvalue::value, Scalar, const Scalar - >::type ScalarWithConstIfNotLvalue; + > ScalarWithConstIfNotLvalue; + + typedef typename internal::ref_selector::non_const_type NestedExpressionType; - typedef typename internal::nested::type NestedExpressionType; + using Base::coeffRef; - inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {} + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {} - inline Index rows() const { return m_expression.rows(); } - inline Index cols() const { return m_expression.cols(); } - inline Index outerStride() const { return m_expression.outerStride(); } - inline Index innerStride() const { return m_expression.innerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_expression.data(); } - inline const CoeffReturnType coeff(Index row, Index col) const - { - return m_expression.coeff(row, col); - } - - inline Scalar& coeffRef(Index row, Index col) - { - return m_expression.const_cast_derived().coeffRef(row, col); - } - - inline const Scalar& coeffRef(Index row, Index col) const - { - return m_expression.const_cast_derived().coeffRef(row, col); - } - - inline const CoeffReturnType coeff(Index index) const - { - return m_expression.coeff(index); - } - - inline Scalar& coeffRef(Index index) + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const { - return m_expression.const_cast_derived().coeffRef(index); + return m_expression.coeffRef(rowId, colId); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const { - return m_expression.const_cast_derived().coeffRef(index); - } - - template - inline const PacketScalar packet(Index row, Index col) const - { - return m_expression.template packet(row, col); + return m_expression.coeffRef(index); } - template - inline void writePacket(Index row, Index col, const PacketScalar& x) - { - m_expression.const_cast_derived().template writePacket(row, col, x); - } + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& dst) const { dst = m_expression; } - template - inline const PacketScalar packet(Index index) const + EIGEN_DEVICE_FUNC + const internal::remove_all_t& + nestedExpression() const { - return m_expression.template packet(index); + return m_expression; } - template - inline void writePacket(Index index, const PacketScalar& x) - { - m_expression.const_cast_derived().template writePacket(index, x); - } - - template - inline void evalTo(Dest& dst) const { dst = m_expression; } + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index) */ + EIGEN_DEVICE_FUNC + void resize(Index newSize) { m_expression.resize(newSize); } + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index,Index)*/ + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) { m_expression.resize(rows,cols); } protected: - const NestedExpressionType m_expression; + NestedExpressionType m_expression; }; /** \class MatrixWrapper @@ -146,9 +126,15 @@ class ArrayWrapper : public ArrayBase > namespace internal { template struct traits > - : public traits::type > + : public traits > { typedef MatrixXpr XprKind; + // Let's remove NestByRefBit + enum { + Flags0 = traits >::Flags, + LvalueBitFlag = is_lvalue::value ? LvalueBit : 0, + Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag + }; }; } @@ -159,81 +145,67 @@ class MatrixWrapper : public MatrixBase > typedef MatrixBase > Base; EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper) + typedef internal::remove_all_t NestedExpression; - typedef typename internal::conditional< - internal::is_lvalue::value, - Scalar, - const Scalar - >::type ScalarWithConstIfNotLvalue; + typedef std::conditional_t< + internal::is_lvalue::value, + Scalar, + const Scalar + > ScalarWithConstIfNotLvalue; + + typedef typename internal::ref_selector::non_const_type NestedExpressionType; - typedef typename internal::nested::type NestedExpressionType; + using Base::coeffRef; - inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {} + EIGEN_DEVICE_FUNC + explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {} - inline Index rows() const { return m_expression.rows(); } - inline Index cols() const { return m_expression.cols(); } - inline Index outerStride() const { return m_expression.outerStride(); } - inline Index innerStride() const { return m_expression.innerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_expression.data(); } - inline const CoeffReturnType coeff(Index row, Index col) const - { - return m_expression.coeff(row, col); - } - - inline Scalar& coeffRef(Index row, Index col) + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const { - return m_expression.const_cast_derived().coeffRef(row, col); - } - - inline const Scalar& coeffRef(Index row, Index col) const - { - return m_expression.derived().coeffRef(row, col); - } - - inline const CoeffReturnType coeff(Index index) const - { - return m_expression.coeff(index); - } - - inline Scalar& coeffRef(Index index) - { - return m_expression.const_cast_derived().coeffRef(index); + return m_expression.derived().coeffRef(rowId, colId); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const { - return m_expression.const_cast_derived().coeffRef(index); + return m_expression.coeffRef(index); } - template - inline const PacketScalar packet(Index row, Index col) const + EIGEN_DEVICE_FUNC + const internal::remove_all_t& + nestedExpression() const { - return m_expression.template packet(row, col); + return m_expression; } - template - inline void writePacket(Index row, Index col, const PacketScalar& x) - { - m_expression.const_cast_derived().template writePacket(row, col, x); - } - - template - inline const PacketScalar packet(Index index) const - { - return m_expression.template packet(index); - } - - template - inline void writePacket(Index index, const PacketScalar& x) - { - m_expression.const_cast_derived().template writePacket(index, x); - } + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index) */ + EIGEN_DEVICE_FUNC + void resize(Index newSize) { m_expression.resize(newSize); } + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index,Index)*/ + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) { m_expression.resize(rows,cols); } protected: - const NestedExpressionType m_expression; + NestedExpressionType m_expression; }; +} // end namespace Eigen + #endif // EIGEN_ARRAYWRAPPER_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Assign.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Assign.h index 3a17152..dc716d3 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Assign.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Assign.h @@ -5,495 +5,20 @@ // Copyright (C) 2006-2010 Benoit Jacob // Copyright (C) 2008 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ASSIGN_H #define EIGEN_ASSIGN_H -namespace internal { - -/*************************************************************************** -* Part 1 : the logic deciding a strategy for traversal and unrolling * -***************************************************************************/ - -template -struct assign_traits -{ -public: - enum { - DstIsAligned = Derived::Flags & AlignedBit, - DstHasDirectAccess = Derived::Flags & DirectAccessBit, - SrcIsAligned = OtherDerived::Flags & AlignedBit, - JointAlignment = bool(DstIsAligned) && bool(SrcIsAligned) ? Aligned : Unaligned - }; - -private: - enum { - InnerSize = int(Derived::IsVectorAtCompileTime) ? int(Derived::SizeAtCompileTime) - : int(Derived::Flags)&RowMajorBit ? int(Derived::ColsAtCompileTime) - : int(Derived::RowsAtCompileTime), - InnerMaxSize = int(Derived::IsVectorAtCompileTime) ? int(Derived::MaxSizeAtCompileTime) - : int(Derived::Flags)&RowMajorBit ? int(Derived::MaxColsAtCompileTime) - : int(Derived::MaxRowsAtCompileTime), - MaxSizeAtCompileTime = Derived::SizeAtCompileTime, - PacketSize = packet_traits::size - }; - - enum { - StorageOrdersAgree = (int(Derived::IsRowMajor) == int(OtherDerived::IsRowMajor)), - MightVectorize = StorageOrdersAgree - && (int(Derived::Flags) & int(OtherDerived::Flags) & ActualPacketAccessBit), - MayInnerVectorize = MightVectorize && int(InnerSize)!=Dynamic && int(InnerSize)%int(PacketSize)==0 - && int(DstIsAligned) && int(SrcIsAligned), - MayLinearize = StorageOrdersAgree && (int(Derived::Flags) & int(OtherDerived::Flags) & LinearAccessBit), - MayLinearVectorize = MightVectorize && MayLinearize && DstHasDirectAccess - && (DstIsAligned || MaxSizeAtCompileTime == Dynamic), - /* If the destination isn't aligned, we have to do runtime checks and we don't unroll, - so it's only good for large enough sizes. */ - MaySliceVectorize = MightVectorize && DstHasDirectAccess - && (int(InnerMaxSize)==Dynamic || int(InnerMaxSize)>=3*PacketSize) - /* slice vectorization can be slow, so we only want it if the slices are big, which is - indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block - in a fixed-size matrix */ - }; - -public: - enum { - Traversal = int(MayInnerVectorize) ? int(InnerVectorizedTraversal) - : int(MayLinearVectorize) ? int(LinearVectorizedTraversal) - : int(MaySliceVectorize) ? int(SliceVectorizedTraversal) - : int(MayLinearize) ? int(LinearTraversal) - : int(DefaultTraversal), - Vectorized = int(Traversal) == InnerVectorizedTraversal - || int(Traversal) == LinearVectorizedTraversal - || int(Traversal) == SliceVectorizedTraversal - }; - -private: - enum { - UnrollingLimit = EIGEN_UNROLLING_LIMIT * (Vectorized ? int(PacketSize) : 1), - MayUnrollCompletely = int(Derived::SizeAtCompileTime) != Dynamic - && int(OtherDerived::CoeffReadCost) != Dynamic - && int(Derived::SizeAtCompileTime) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit), - MayUnrollInner = int(InnerSize) != Dynamic - && int(OtherDerived::CoeffReadCost) != Dynamic - && int(InnerSize) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit) - }; - -public: - enum { - Unrolling = (int(Traversal) == int(InnerVectorizedTraversal) || int(Traversal) == int(DefaultTraversal)) - ? ( - int(MayUnrollCompletely) ? int(CompleteUnrolling) - : int(MayUnrollInner) ? int(InnerUnrolling) - : int(NoUnrolling) - ) - : int(Traversal) == int(LinearVectorizedTraversal) - ? ( bool(MayUnrollCompletely) && bool(DstIsAligned) ? int(CompleteUnrolling) : int(NoUnrolling) ) - : int(Traversal) == int(LinearTraversal) - ? ( bool(MayUnrollCompletely) ? int(CompleteUnrolling) : int(NoUnrolling) ) - : int(NoUnrolling) - }; +#include "./InternalHeaderCheck.h" -#ifdef EIGEN_DEBUG_ASSIGN - static void debug() - { - EIGEN_DEBUG_VAR(DstIsAligned) - EIGEN_DEBUG_VAR(SrcIsAligned) - EIGEN_DEBUG_VAR(JointAlignment) - EIGEN_DEBUG_VAR(InnerSize) - EIGEN_DEBUG_VAR(InnerMaxSize) - EIGEN_DEBUG_VAR(PacketSize) - EIGEN_DEBUG_VAR(StorageOrdersAgree) - EIGEN_DEBUG_VAR(MightVectorize) - EIGEN_DEBUG_VAR(MayLinearize) - EIGEN_DEBUG_VAR(MayInnerVectorize) - EIGEN_DEBUG_VAR(MayLinearVectorize) - EIGEN_DEBUG_VAR(MaySliceVectorize) - EIGEN_DEBUG_VAR(Traversal) - EIGEN_DEBUG_VAR(UnrollingLimit) - EIGEN_DEBUG_VAR(MayUnrollCompletely) - EIGEN_DEBUG_VAR(MayUnrollInner) - EIGEN_DEBUG_VAR(Unrolling) - } -#endif -}; - -/*************************************************************************** -* Part 2 : meta-unrollers -***************************************************************************/ - -/************************ -*** Default traversal *** -************************/ - -template -struct assign_DefaultTraversal_CompleteUnrolling -{ - enum { - outer = Index / Derived1::InnerSizeAtCompileTime, - inner = Index % Derived1::InnerSizeAtCompileTime - }; - - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) - { - dst.copyCoeffByOuterInner(outer, inner, src); - assign_DefaultTraversal_CompleteUnrolling::run(dst, src); - } -}; - -template -struct assign_DefaultTraversal_CompleteUnrolling -{ - EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {} -}; - -template -struct assign_DefaultTraversal_InnerUnrolling -{ - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src, int outer) - { - dst.copyCoeffByOuterInner(outer, Index, src); - assign_DefaultTraversal_InnerUnrolling::run(dst, src, outer); - } -}; - -template -struct assign_DefaultTraversal_InnerUnrolling -{ - EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &, int) {} -}; - -/*********************** -*** Linear traversal *** -***********************/ - -template -struct assign_LinearTraversal_CompleteUnrolling -{ - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) - { - dst.copyCoeff(Index, src); - assign_LinearTraversal_CompleteUnrolling::run(dst, src); - } -}; - -template -struct assign_LinearTraversal_CompleteUnrolling -{ - EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {} -}; - -/************************** -*** Inner vectorization *** -**************************/ - -template -struct assign_innervec_CompleteUnrolling -{ - enum { - outer = Index / Derived1::InnerSizeAtCompileTime, - inner = Index % Derived1::InnerSizeAtCompileTime, - JointAlignment = assign_traits::JointAlignment - }; - - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) - { - dst.template copyPacketByOuterInner(outer, inner, src); - assign_innervec_CompleteUnrolling::size, Stop>::run(dst, src); - } -}; - -template -struct assign_innervec_CompleteUnrolling -{ - EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {} -}; - -template -struct assign_innervec_InnerUnrolling -{ - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src, int outer) - { - dst.template copyPacketByOuterInner(outer, Index, src); - assign_innervec_InnerUnrolling::size, Stop>::run(dst, src, outer); - } -}; - -template -struct assign_innervec_InnerUnrolling -{ - EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &, int) {} -}; - -/*************************************************************************** -* Part 3 : implementation of all cases -***************************************************************************/ - -template::Traversal, - int Unrolling = assign_traits::Unrolling> -struct assign_impl; - -/************************ -*** Default traversal *** -************************/ - -template -struct assign_impl -{ - inline static void run(Derived1 &, const Derived2 &) { } -}; - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - inline static void run(Derived1 &dst, const Derived2 &src) - { - const Index innerSize = dst.innerSize(); - const Index outerSize = dst.outerSize(); - for(Index outer = 0; outer < outerSize; ++outer) - for(Index inner = 0; inner < innerSize; ++inner) - dst.copyCoeffByOuterInner(outer, inner, src); - } -}; - -template -struct assign_impl -{ - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) - { - assign_DefaultTraversal_CompleteUnrolling - ::run(dst, src); - } -}; - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) - { - const Index outerSize = dst.outerSize(); - for(Index outer = 0; outer < outerSize; ++outer) - assign_DefaultTraversal_InnerUnrolling - ::run(dst, src, outer); - } -}; - -/*********************** -*** Linear traversal *** -***********************/ - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - inline static void run(Derived1 &dst, const Derived2 &src) - { - const Index size = dst.size(); - for(Index i = 0; i < size; ++i) - dst.copyCoeff(i, src); - } -}; - -template -struct assign_impl -{ - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) - { - assign_LinearTraversal_CompleteUnrolling - ::run(dst, src); - } -}; - -/************************** -*** Inner vectorization *** -**************************/ - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - inline static void run(Derived1 &dst, const Derived2 &src) - { - const Index innerSize = dst.innerSize(); - const Index outerSize = dst.outerSize(); - const Index packetSize = packet_traits::size; - for(Index outer = 0; outer < outerSize; ++outer) - for(Index inner = 0; inner < innerSize; inner+=packetSize) - dst.template copyPacketByOuterInner(outer, inner, src); - } -}; - -template -struct assign_impl -{ - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) - { - assign_innervec_CompleteUnrolling - ::run(dst, src); - } -}; - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) - { - const Index outerSize = dst.outerSize(); - for(Index outer = 0; outer < outerSize; ++outer) - assign_innervec_InnerUnrolling - ::run(dst, src, outer); - } -}; - -/*************************** -*** Linear vectorization *** -***************************/ - -template -struct unaligned_assign_impl -{ - template - static EIGEN_STRONG_INLINE void run(const Derived&, OtherDerived&, typename Derived::Index, typename Derived::Index) {} -}; - -template <> -struct unaligned_assign_impl -{ - // MSVC must not inline this functions. If it does, it fails to optimize the - // packet access path. -#ifdef _MSC_VER - template - static EIGEN_DONT_INLINE void run(const Derived& src, OtherDerived& dst, typename Derived::Index start, typename Derived::Index end) -#else - template - static EIGEN_STRONG_INLINE void run(const Derived& src, OtherDerived& dst, typename Derived::Index start, typename Derived::Index end) -#endif - { - for (typename Derived::Index index = start; index < end; ++index) - dst.copyCoeff(index, src); - } -}; - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) - { - const Index size = dst.size(); - typedef packet_traits PacketTraits; - enum { - packetSize = PacketTraits::size, - dstAlignment = PacketTraits::AlignedOnScalar ? Aligned : int(assign_traits::DstIsAligned) , - srcAlignment = assign_traits::JointAlignment - }; - const Index alignedStart = assign_traits::DstIsAligned ? 0 - : first_aligned(&dst.coeffRef(0), size); - const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize; - - unaligned_assign_impl::DstIsAligned!=0>::run(src,dst,0,alignedStart); - - for(Index index = alignedStart; index < alignedEnd; index += packetSize) - { - dst.template copyPacket(index, src); - } - - unaligned_assign_impl<>::run(src,dst,alignedEnd,size); - } -}; - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) - { - enum { size = Derived1::SizeAtCompileTime, - packetSize = packet_traits::size, - alignedSize = (size/packetSize)*packetSize }; - - assign_innervec_CompleteUnrolling::run(dst, src); - assign_DefaultTraversal_CompleteUnrolling::run(dst, src); - } -}; - -/************************** -*** Slice vectorization *** -***************************/ - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - inline static void run(Derived1 &dst, const Derived2 &src) - { - typedef packet_traits PacketTraits; - enum { - packetSize = PacketTraits::size, - alignable = PacketTraits::AlignedOnScalar, - dstAlignment = alignable ? Aligned : int(assign_traits::DstIsAligned) , - srcAlignment = assign_traits::JointAlignment - }; - const Index packetAlignedMask = packetSize - 1; - const Index innerSize = dst.innerSize(); - const Index outerSize = dst.outerSize(); - const Index alignedStep = alignable ? (packetSize - dst.outerStride() % packetSize) & packetAlignedMask : 0; - Index alignedStart = ((!alignable) || assign_traits::DstIsAligned) ? 0 - : first_aligned(&dst.coeffRef(0,0), innerSize); - - for(Index outer = 0; outer < outerSize; ++outer) - { - const Index alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask); - // do the non-vectorizable part of the assignment - for(Index inner = 0; inner(outer, inner, src); - - // do the non-vectorizable part of the assignment - for(Index inner = alignedEnd; inner((alignedStart+alignedStep)%packetSize, innerSize); - } - } -}; - -} // end namespace internal - -/*************************************************************************** -* Part 4 : implementation of DenseBase methods -***************************************************************************/ +namespace Eigen { template template -EIGEN_STRONG_INLINE Derived& DenseBase +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase ::lazyAssign(const DenseBase& other) { enum{ @@ -504,90 +29,64 @@ EIGEN_STRONG_INLINE Derived& DenseBase EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived) EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) -#ifdef EIGEN_DEBUG_ASSIGN - internal::assign_traits::debug(); -#endif eigen_assert(rows() == other.rows() && cols() == other.cols()); - internal::assign_impl::Traversal) - : int(InvalidTraversal)>::run(derived(),other.derived()); -#ifndef EIGEN_NO_DEBUG - checkTransposeAliasing(other.derived()); -#endif + internal::call_assignment_no_alias(derived(),other.derived()); + return derived(); } -namespace internal { - -template -struct assign_selector; - -template -struct assign_selector { - EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); } -}; -template -struct assign_selector { - EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.eval()); } -}; -template -struct assign_selector { - EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose()); } -}; -template -struct assign_selector { - EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose().eval()); } -}; - -} // end namespace internal - template template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) { - return internal::assign_selector::run(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) { - return internal::assign_selector::run(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const MatrixBase& other) { - return internal::assign_selector::run(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } template template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const DenseBase& other) { - return internal::assign_selector::run(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } template template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const EigenBase& other) { - other.derived().evalTo(derived()); + internal::call_assignment(derived(), other.derived()); return derived(); } template template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const ReturnByValue& other) { - other.evalTo(derived()); + other.derived().evalTo(derived()); return derived(); } +} // end namespace Eigen + #endif // EIGEN_ASSIGN_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/AssignEvaluator.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/AssignEvaluator.h new file mode 100644 index 0000000..f9dc7a1 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/AssignEvaluator.h @@ -0,0 +1,1011 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Benoit Jacob +// Copyright (C) 2011-2014 Gael Guennebaud +// Copyright (C) 2011-2012 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ASSIGN_EVALUATOR_H +#define EIGEN_ASSIGN_EVALUATOR_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +// This implementation is based on Assign.h + +namespace internal { + +/*************************************************************************** +* Part 1 : the logic deciding a strategy for traversal and unrolling * +***************************************************************************/ + +// copy_using_evaluator_traits is based on assign_traits + +template +struct copy_using_evaluator_traits +{ + typedef typename DstEvaluator::XprType Dst; + typedef typename Dst::Scalar DstScalar; + + enum { + DstFlags = DstEvaluator::Flags, + SrcFlags = SrcEvaluator::Flags + }; + +public: + enum { + DstAlignment = DstEvaluator::Alignment, + SrcAlignment = SrcEvaluator::Alignment, + DstHasDirectAccess = (DstFlags & DirectAccessBit) == DirectAccessBit, + JointAlignment = plain_enum_min(DstAlignment, SrcAlignment) + }; + +private: + enum { + InnerSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::SizeAtCompileTime) + : int(DstFlags)&RowMajorBit ? int(Dst::ColsAtCompileTime) + : int(Dst::RowsAtCompileTime), + InnerMaxSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::MaxSizeAtCompileTime) + : int(DstFlags)&RowMajorBit ? int(Dst::MaxColsAtCompileTime) + : int(Dst::MaxRowsAtCompileTime), + RestrictedInnerSize = min_size_prefer_fixed(InnerSize, MaxPacketSize), + RestrictedLinearSize = min_size_prefer_fixed(Dst::SizeAtCompileTime, MaxPacketSize), + OuterStride = int(outer_stride_at_compile_time::ret), + MaxSizeAtCompileTime = Dst::SizeAtCompileTime + }; + + // TODO distinguish between linear traversal and inner-traversals + typedef typename find_best_packet::type LinearPacketType; + typedef typename find_best_packet::type InnerPacketType; + + enum { + LinearPacketSize = unpacket_traits::size, + InnerPacketSize = unpacket_traits::size + }; + +public: + enum { + LinearRequiredAlignment = unpacket_traits::alignment, + InnerRequiredAlignment = unpacket_traits::alignment + }; + +private: + enum { + DstIsRowMajor = DstFlags&RowMajorBit, + SrcIsRowMajor = SrcFlags&RowMajorBit, + StorageOrdersAgree = (int(DstIsRowMajor) == int(SrcIsRowMajor)), + MightVectorize = bool(StorageOrdersAgree) + && (int(DstFlags) & int(SrcFlags) & ActualPacketAccessBit) + && bool(functor_traits::PacketAccess), + MayInnerVectorize = MightVectorize + && int(InnerSize)!=Dynamic && int(InnerSize)%int(InnerPacketSize)==0 + && int(OuterStride)!=Dynamic && int(OuterStride)%int(InnerPacketSize)==0 + && (EIGEN_UNALIGNED_VECTORIZE || int(JointAlignment)>=int(InnerRequiredAlignment)), + MayLinearize = bool(StorageOrdersAgree) && (int(DstFlags) & int(SrcFlags) & LinearAccessBit), + MayLinearVectorize = bool(MightVectorize) && bool(MayLinearize) && bool(DstHasDirectAccess) + && (EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment)) || MaxSizeAtCompileTime == Dynamic), + /* If the destination isn't aligned, we have to do runtime checks and we don't unroll, + so it's only good for large enough sizes. */ + MaySliceVectorize = bool(MightVectorize) && bool(DstHasDirectAccess) + && (int(InnerMaxSize)==Dynamic || int(InnerMaxSize)>=(EIGEN_UNALIGNED_VECTORIZE?InnerPacketSize:(3*InnerPacketSize))) + /* slice vectorization can be slow, so we only want it if the slices are big, which is + indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block + in a fixed-size matrix + However, with EIGEN_UNALIGNED_VECTORIZE and unrolling, slice vectorization is still worth it */ + }; + +public: + enum { + Traversal = int(Dst::SizeAtCompileTime) == 0 ? int(AllAtOnceTraversal) // If compile-size is zero, traversing will fail at compile-time. + : (int(MayLinearVectorize) && (LinearPacketSize>InnerPacketSize)) ? int(LinearVectorizedTraversal) + : int(MayInnerVectorize) ? int(InnerVectorizedTraversal) + : int(MayLinearVectorize) ? int(LinearVectorizedTraversal) + : int(MaySliceVectorize) ? int(SliceVectorizedTraversal) + : int(MayLinearize) ? int(LinearTraversal) + : int(DefaultTraversal), + Vectorized = int(Traversal) == InnerVectorizedTraversal + || int(Traversal) == LinearVectorizedTraversal + || int(Traversal) == SliceVectorizedTraversal + }; + + typedef std::conditional_t PacketType; + +private: + enum { + ActualPacketSize = int(Traversal)==LinearVectorizedTraversal ? LinearPacketSize + : Vectorized ? InnerPacketSize + : 1, + UnrollingLimit = EIGEN_UNROLLING_LIMIT * ActualPacketSize, + MayUnrollCompletely = int(Dst::SizeAtCompileTime) != Dynamic + && int(Dst::SizeAtCompileTime) * (int(DstEvaluator::CoeffReadCost)+int(SrcEvaluator::CoeffReadCost)) <= int(UnrollingLimit), + MayUnrollInner = int(InnerSize) != Dynamic + && int(InnerSize) * (int(DstEvaluator::CoeffReadCost)+int(SrcEvaluator::CoeffReadCost)) <= int(UnrollingLimit) + }; + +public: + enum { + Unrolling = (int(Traversal) == int(InnerVectorizedTraversal) || int(Traversal) == int(DefaultTraversal)) + ? ( + int(MayUnrollCompletely) ? int(CompleteUnrolling) + : int(MayUnrollInner) ? int(InnerUnrolling) + : int(NoUnrolling) + ) + : int(Traversal) == int(LinearVectorizedTraversal) + ? ( bool(MayUnrollCompletely) && ( EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment))) + ? int(CompleteUnrolling) + : int(NoUnrolling) ) + : int(Traversal) == int(LinearTraversal) + ? ( bool(MayUnrollCompletely) ? int(CompleteUnrolling) + : int(NoUnrolling) ) +#if EIGEN_UNALIGNED_VECTORIZE + : int(Traversal) == int(SliceVectorizedTraversal) + ? ( bool(MayUnrollInner) ? int(InnerUnrolling) + : int(NoUnrolling) ) +#endif + : int(NoUnrolling) + }; + +#ifdef EIGEN_DEBUG_ASSIGN + static void debug() + { + std::cerr << "DstXpr: " << typeid(typename DstEvaluator::XprType).name() << std::endl; + std::cerr << "SrcXpr: " << typeid(typename SrcEvaluator::XprType).name() << std::endl; + std::cerr.setf(std::ios::hex, std::ios::basefield); + std::cerr << "DstFlags" << " = " << DstFlags << " (" << demangle_flags(DstFlags) << " )" << std::endl; + std::cerr << "SrcFlags" << " = " << SrcFlags << " (" << demangle_flags(SrcFlags) << " )" << std::endl; + std::cerr.unsetf(std::ios::hex); + EIGEN_DEBUG_VAR(DstAlignment) + EIGEN_DEBUG_VAR(SrcAlignment) + EIGEN_DEBUG_VAR(LinearRequiredAlignment) + EIGEN_DEBUG_VAR(InnerRequiredAlignment) + EIGEN_DEBUG_VAR(JointAlignment) + EIGEN_DEBUG_VAR(InnerSize) + EIGEN_DEBUG_VAR(InnerMaxSize) + EIGEN_DEBUG_VAR(LinearPacketSize) + EIGEN_DEBUG_VAR(InnerPacketSize) + EIGEN_DEBUG_VAR(ActualPacketSize) + EIGEN_DEBUG_VAR(StorageOrdersAgree) + EIGEN_DEBUG_VAR(MightVectorize) + EIGEN_DEBUG_VAR(MayLinearize) + EIGEN_DEBUG_VAR(MayInnerVectorize) + EIGEN_DEBUG_VAR(MayLinearVectorize) + EIGEN_DEBUG_VAR(MaySliceVectorize) + std::cerr << "Traversal" << " = " << Traversal << " (" << demangle_traversal(Traversal) << ")" << std::endl; + EIGEN_DEBUG_VAR(SrcEvaluator::CoeffReadCost) + EIGEN_DEBUG_VAR(DstEvaluator::CoeffReadCost) + EIGEN_DEBUG_VAR(Dst::SizeAtCompileTime) + EIGEN_DEBUG_VAR(UnrollingLimit) + EIGEN_DEBUG_VAR(MayUnrollCompletely) + EIGEN_DEBUG_VAR(MayUnrollInner) + std::cerr << "Unrolling" << " = " << Unrolling << " (" << demangle_unrolling(Unrolling) << ")" << std::endl; + std::cerr << std::endl; + } +#endif +}; + +/*************************************************************************** +* Part 2 : meta-unrollers +***************************************************************************/ + +/************************ +*** Default traversal *** +************************/ + +template +struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling +{ + // FIXME: this is not very clean, perhaps this information should be provided by the kernel? + typedef typename Kernel::DstEvaluatorType DstEvaluatorType; + typedef typename DstEvaluatorType::XprType DstXprType; + + enum { + outer = Index / DstXprType::InnerSizeAtCompileTime, + inner = Index % DstXprType::InnerSizeAtCompileTime + }; + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + kernel.assignCoeffByOuterInner(outer, inner); + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +template +struct copy_using_evaluator_DefaultTraversal_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer) + { + kernel.assignCoeffByOuterInner(outer, Index_); + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } +}; + +template +struct copy_using_evaluator_DefaultTraversal_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index) { } +}; + +/*********************** +*** Linear traversal *** +***********************/ + +template +struct copy_using_evaluator_LinearTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel& kernel) + { + kernel.assignCoeff(Index); + copy_using_evaluator_LinearTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_LinearTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +/************************** +*** Inner vectorization *** +**************************/ + +template +struct copy_using_evaluator_innervec_CompleteUnrolling +{ + // FIXME: this is not very clean, perhaps this information should be provided by the kernel? + typedef typename Kernel::DstEvaluatorType DstEvaluatorType; + typedef typename DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { + outer = Index / DstXprType::InnerSizeAtCompileTime, + inner = Index % DstXprType::InnerSizeAtCompileTime, + SrcAlignment = Kernel::AssignmentTraits::SrcAlignment, + DstAlignment = Kernel::AssignmentTraits::DstAlignment + }; + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + kernel.template assignPacketByOuterInner(outer, inner); + enum { NextIndex = Index + unpacket_traits::size }; + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_innervec_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +template +struct copy_using_evaluator_innervec_InnerUnrolling +{ + typedef typename Kernel::PacketType PacketType; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer) + { + kernel.template assignPacketByOuterInner(outer, Index_); + enum { NextIndex = Index_ + unpacket_traits::size }; + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + } +}; + +template +struct copy_using_evaluator_innervec_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &, Index) { } +}; + +/*************************************************************************** +* Part 3 : implementation of all cases +***************************************************************************/ + +// dense_assignment_loop is based on assign_impl + +template +struct dense_assignment_loop; + +/************************ +***** Special Cases ***** +************************/ + +// Zero-sized assignment is a no-op. +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static void EIGEN_STRONG_INLINE run(Kernel& /*kernel*/) + { + EIGEN_STATIC_ASSERT(int(Kernel::DstEvaluatorType::XprType::SizeAtCompileTime) == 0, + EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT) + } +}; + +/************************ +*** Default traversal *** +************************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static void EIGEN_STRONG_INLINE run(Kernel &kernel) + { + for(Index outer = 0; outer < kernel.outerSize(); ++outer) { + for(Index inner = 0; inner < kernel.innerSize(); ++inner) { + kernel.assignCoeffByOuterInner(outer, inner); + } + } + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + + const Index outerSize = kernel.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } +}; + +/*************************** +*** Linear vectorization *** +***************************/ + + +// The goal of unaligned_dense_assignment_loop is simply to factorize the handling +// of the non vectorizable beginning and ending parts + +template +struct unaligned_dense_assignment_loop +{ + // if IsAligned = true, then do nothing + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index, Index) {} +}; + +template <> +struct unaligned_dense_assignment_loop +{ + // MSVC must not inline this functions. If it does, it fails to optimize the + // packet access path. + // FIXME check which version exhibits this issue +#if EIGEN_COMP_MSVC + template + static EIGEN_DONT_INLINE void run(Kernel &kernel, + Index start, + Index end) +#else + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, + Index start, + Index end) +#endif + { + for (Index index = start; index < end; ++index) + kernel.assignCoeff(index); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index size = kernel.size(); + typedef typename Kernel::Scalar Scalar; + typedef typename Kernel::PacketType PacketType; + enum { + requestedAlignment = Kernel::AssignmentTraits::LinearRequiredAlignment, + packetSize = unpacket_traits::size, + dstIsAligned = int(Kernel::AssignmentTraits::DstAlignment)>=int(requestedAlignment), + dstAlignment = packet_traits::AlignedOnScalar ? int(requestedAlignment) + : int(Kernel::AssignmentTraits::DstAlignment), + srcAlignment = Kernel::AssignmentTraits::JointAlignment + }; + const Index alignedStart = dstIsAligned ? 0 : internal::first_aligned(kernel.dstDataPtr(), size); + const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize; + + unaligned_dense_assignment_loop::run(kernel, 0, alignedStart); + + for(Index index = alignedStart; index < alignedEnd; index += packetSize) + kernel.template assignPacket(index); + + unaligned_dense_assignment_loop<>::run(kernel, alignedEnd, size); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { size = DstXprType::SizeAtCompileTime, + packetSize =unpacket_traits::size, + alignedSize = (int(size)/packetSize)*packetSize }; + + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +/************************** +*** Inner vectorization *** +**************************/ + +template +struct dense_assignment_loop +{ + typedef typename Kernel::PacketType PacketType; + enum { + SrcAlignment = Kernel::AssignmentTraits::SrcAlignment, + DstAlignment = Kernel::AssignmentTraits::DstAlignment + }; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index innerSize = kernel.innerSize(); + const Index outerSize = kernel.outerSize(); + const Index packetSize = unpacket_traits::size; + for(Index outer = 0; outer < outerSize; ++outer) + for(Index inner = 0; inner < innerSize; inner+=packetSize) + kernel.template assignPacketByOuterInner(outer, inner); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::AssignmentTraits Traits; + const Index outerSize = kernel.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + } +}; + +/*********************** +*** Linear traversal *** +***********************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index size = kernel.size(); + for(Index i = 0; i < size; ++i) + kernel.assignCoeff(i); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_LinearTraversal_CompleteUnrolling::run(kernel); + } +}; + +/************************** +*** Slice vectorization *** +***************************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::Scalar Scalar; + typedef typename Kernel::PacketType PacketType; + enum { + packetSize = unpacket_traits::size, + requestedAlignment = int(Kernel::AssignmentTraits::InnerRequiredAlignment), + alignable = packet_traits::AlignedOnScalar || int(Kernel::AssignmentTraits::DstAlignment)>=sizeof(Scalar), + dstIsAligned = int(Kernel::AssignmentTraits::DstAlignment)>=int(requestedAlignment), + dstAlignment = alignable ? int(requestedAlignment) + : int(Kernel::AssignmentTraits::DstAlignment) + }; + const Scalar *dst_ptr = kernel.dstDataPtr(); + if((!bool(dstIsAligned)) && (UIntPtr(dst_ptr) % sizeof(Scalar))>0) + { + // the pointer is not aligned-on scalar, so alignment is not possible + return dense_assignment_loop::run(kernel); + } + const Index packetAlignedMask = packetSize - 1; + const Index innerSize = kernel.innerSize(); + const Index outerSize = kernel.outerSize(); + const Index alignedStep = alignable ? (packetSize - kernel.outerStride() % packetSize) & packetAlignedMask : 0; + Index alignedStart = ((!alignable) || bool(dstIsAligned)) ? 0 : internal::first_aligned(dst_ptr, innerSize); + + for(Index outer = 0; outer < outerSize; ++outer) + { + const Index alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask); + // do the non-vectorizable part of the assignment + for(Index inner = 0; inner(outer, inner); + + // do the non-vectorizable part of the assignment + for(Index inner = alignedEnd; inner +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { innerSize = DstXprType::InnerSizeAtCompileTime, + packetSize =unpacket_traits::size, + vectorizableSize = (int(innerSize) / int(packetSize)) * int(packetSize), + size = DstXprType::SizeAtCompileTime }; + + for(Index outer = 0; outer < kernel.outerSize(); ++outer) + { + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } + } +}; +#endif + + +/*************************************************************************** +* Part 4 : Generic dense assignment kernel +***************************************************************************/ + +// This class generalize the assignment of a coefficient (or packet) from one dense evaluator +// to another dense writable evaluator. +// It is parametrized by the two evaluators, and the actual assignment functor. +// This abstraction level permits to keep the evaluation loops as simple and as generic as possible. +// One can customize the assignment using this generic dense_assignment_kernel with different +// functors, or by completely overloading it, by-passing a functor. +template +class generic_dense_assignment_kernel +{ +protected: + typedef typename DstEvaluatorTypeT::XprType DstXprType; + typedef typename SrcEvaluatorTypeT::XprType SrcXprType; +public: + + typedef DstEvaluatorTypeT DstEvaluatorType; + typedef SrcEvaluatorTypeT SrcEvaluatorType; + typedef typename DstEvaluatorType::Scalar Scalar; + typedef copy_using_evaluator_traits AssignmentTraits; + typedef typename AssignmentTraits::PacketType PacketType; + + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + generic_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr) + : m_dst(dst), m_src(src), m_functor(func), m_dstExpr(dstExpr) + { + #ifdef EIGEN_DEBUG_ASSIGN + AssignmentTraits::debug(); + #endif + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT { return m_dstExpr.size(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerSize() const EIGEN_NOEXCEPT { return m_dstExpr.innerSize(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerSize() const EIGEN_NOEXCEPT { return m_dstExpr.outerSize(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_dstExpr.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_dstExpr.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerStride() const EIGEN_NOEXCEPT { return m_dstExpr.outerStride(); } + + EIGEN_DEVICE_FUNC DstEvaluatorType& dstEvaluator() EIGEN_NOEXCEPT { return m_dst; } + EIGEN_DEVICE_FUNC const SrcEvaluatorType& srcEvaluator() const EIGEN_NOEXCEPT { return m_src; } + + /// Assign src(row,col) to dst(row,col) through the assignment functor. + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index row, Index col) + { + m_functor.assignCoeff(m_dst.coeffRef(row,col), m_src.coeff(row,col)); + } + + /// \sa assignCoeff(Index,Index) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index index) + { + m_functor.assignCoeff(m_dst.coeffRef(index), m_src.coeff(index)); + } + + /// \sa assignCoeff(Index,Index) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeffByOuterInner(Index outer, Index inner) + { + Index row = rowIndexByOuterInner(outer, inner); + Index col = colIndexByOuterInner(outer, inner); + assignCoeff(row, col); + } + + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacket(Index row, Index col) + { + m_functor.template assignPacket(&m_dst.coeffRef(row,col), m_src.template packet(row,col)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacket(Index index) + { + m_functor.template assignPacket(&m_dst.coeffRef(index), m_src.template packet(index)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacketByOuterInner(Index outer, Index inner) + { + Index row = rowIndexByOuterInner(outer, inner); + Index col = colIndexByOuterInner(outer, inner); + assignPacket(row, col); + } + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) + { + typedef typename DstEvaluatorType::ExpressionTraits Traits; + return int(Traits::RowsAtCompileTime) == 1 ? 0 + : int(Traits::ColsAtCompileTime) == 1 ? inner + : int(DstEvaluatorType::Flags)&RowMajorBit ? outer + : inner; + } + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) + { + typedef typename DstEvaluatorType::ExpressionTraits Traits; + return int(Traits::ColsAtCompileTime) == 1 ? 0 + : int(Traits::RowsAtCompileTime) == 1 ? inner + : int(DstEvaluatorType::Flags)&RowMajorBit ? inner + : outer; + } + + EIGEN_DEVICE_FUNC const Scalar* dstDataPtr() const + { + return m_dstExpr.data(); + } + +protected: + DstEvaluatorType& m_dst; + const SrcEvaluatorType& m_src; + const Functor &m_functor; + // TODO find a way to avoid the needs of the original expression + DstXprType& m_dstExpr; +}; + +// Special kernel used when computing small products whose operands have dynamic dimensions. It ensures that the +// PacketSize used is no larger than 4, thereby increasing the chance that vectorized instructions will be used +// when computing the product. + +template +class restricted_packet_dense_assignment_kernel : public generic_dense_assignment_kernel +{ +protected: + typedef generic_dense_assignment_kernel Base; + public: + typedef typename Base::Scalar Scalar; + typedef typename Base::DstXprType DstXprType; + typedef copy_using_evaluator_traits AssignmentTraits; + typedef typename AssignmentTraits::PacketType PacketType; + + EIGEN_DEVICE_FUNC restricted_packet_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType& dstExpr) + : Base(dst, src, func, dstExpr) + { + } + }; + +/*************************************************************************** +* Part 5 : Entry point for dense rectangular assignment +***************************************************************************/ + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const Functor &/*func*/) +{ + EIGEN_ONLY_USED_FOR_DEBUG(dst); + EIGEN_ONLY_USED_FOR_DEBUG(src); + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const internal::assign_op &/*func*/) +{ + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if(((dst.rows()!=dstRows) || (dst.cols()!=dstCols))) + dst.resize(dstRows, dstCols); + eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src, const Functor &func) +{ + typedef evaluator DstEvaluatorType; + typedef evaluator SrcEvaluatorType; + + SrcEvaluatorType srcEvaluator(src); + + // NOTE To properly handle A = (A*A.transpose())/s with A rectangular, + // we need to resize the destination after the source evaluator has been created. + resize_if_allowed(dst, src, func); + + DstEvaluatorType dstEvaluator(dst); + + typedef generic_dense_assignment_kernel Kernel; + Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived()); + + dense_assignment_loop::run(kernel); +} + +// Specialization for filling the destination with a constant value. +#ifndef EIGEN_GPU_COMPILE_PHASE +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const Eigen::CwiseNullaryOp, DstXprType>& src, const internal::assign_op& func) +{ + resize_if_allowed(dst, src, func); + std::fill_n(dst.data(), dst.size(), src.functor()()); +} +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src) +{ + call_dense_assignment_loop(dst, src, internal::assign_op()); +} + +/*************************************************************************** +* Part 6 : Generic assignment +***************************************************************************/ + +// Based on the respective shapes of the destination and source, +// the class AssignmentKind determine the kind of assignment mechanism. +// AssignmentKind must define a Kind typedef. +template struct AssignmentKind; + +// Assignment kind defined in this file: +struct Dense2Dense {}; +struct EigenBase2EigenBase {}; + +template struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; +template<> struct AssignmentKind { typedef Dense2Dense Kind; }; + +// This is the main assignment class +template< typename DstXprType, typename SrcXprType, typename Functor, + typename Kind = typename AssignmentKind< typename evaluator_traits::Shape , typename evaluator_traits::Shape >::Kind, + typename EnableIf = void> +struct Assignment; + + +// The only purpose of this call_assignment() function is to deal with noalias() / "assume-aliasing" and automatic transposition. +// Indeed, I (Gael) think that this concept of "assume-aliasing" was a mistake, and it makes thing quite complicated. +// So this intermediate function removes everything related to "assume-aliasing" such that Assignment +// does not has to bother about these annoying details. + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src) +{ + call_assignment(dst, src, internal::assign_op()); +} +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(const Dst& dst, const Src& src) +{ + call_assignment(dst, src, internal::assign_op()); +} + +// Deal with "assume-aliasing" +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src, const Func& func, std::enable_if_t< evaluator_assume_aliasing::value, void*> = 0) +{ + typename plain_matrix_type::type tmp(src); + call_assignment_no_alias(dst, tmp, func); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src, const Func& func, std::enable_if_t::value, void*> = 0) +{ + call_assignment_no_alias(dst, src, func); +} + +// by-pass "assume-aliasing" +// When there is no aliasing, we require that 'dst' has been properly resized +template class StorageBase, typename Src, typename Func> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(NoAlias& dst, const Src& src, const Func& func) +{ + call_assignment_no_alias(dst.expression(), src, func); +} + + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias(Dst& dst, const Src& src, const Func& func) +{ + enum { + NeedToTranspose = ( (int(Dst::RowsAtCompileTime) == 1 && int(Src::ColsAtCompileTime) == 1) + || (int(Dst::ColsAtCompileTime) == 1 && int(Src::RowsAtCompileTime) == 1) + ) && int(Dst::SizeAtCompileTime) != 1 + }; + + typedef std::conditional_t, Dst> ActualDstTypeCleaned; + typedef std::conditional_t, Dst&> ActualDstType; + ActualDstType actualDst(dst); + + // TODO check whether this is the right place to perform these checks: + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(ActualDstTypeCleaned,Src) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar); + + Assignment::run(actualDst, src, func); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_restricted_packet_assignment_no_alias(Dst& dst, const Src& src, const Func& func) +{ + typedef evaluator DstEvaluatorType; + typedef evaluator SrcEvaluatorType; + typedef restricted_packet_dense_assignment_kernel Kernel; + + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename Dst::Scalar,typename Src::Scalar); + + SrcEvaluatorType srcEvaluator(src); + resize_if_allowed(dst, src, func); + + DstEvaluatorType dstEvaluator(dst); + Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived()); + + dense_assignment_loop::run(kernel); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias(Dst& dst, const Src& src) +{ + call_assignment_no_alias(dst, src, internal::assign_op()); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src, const Func& func) +{ + // TODO check whether this is the right place to perform these checks: + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Dst,Src) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename Dst::Scalar,typename Src::Scalar); + + Assignment::run(dst, src, func); +} +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src) +{ + call_assignment_no_alias_no_transpose(dst, src, internal::assign_op()); +} + +// forward declaration +template void check_for_aliasing(const Dst &dst, const Src &src); + +// Generic Dense to Dense assignment +// Note that the last template argument "Weak" is needed to make it possible to perform +// both partial specialization+SFINAE without ambiguous specialization +template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak> +struct Assignment +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const Functor &func) + { +#ifndef EIGEN_NO_DEBUG + internal::check_for_aliasing(dst, src); +#endif + + call_dense_assignment_loop(dst, src, func); + } +}; + +// Generic assignment through evalTo. +// TODO: not sure we have to keep that one, but it helps porting current code to new evaluator mechanism. +// Note that the last template argument "Weak" is needed to make it possible to perform +// both partial specialization+SFINAE without ambiguous specialization +template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak> +struct Assignment +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.evalTo(dst); + } + + // NOTE The following two functions are templated to avoid their instantiation if not needed + // This is needed because some expressions supports evalTo only and/or have 'void' as scalar type. + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.addTo(dst); + } + + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.subTo(dst); + } +}; + +} // namespace internal + +} // end namespace Eigen + +#endif // EIGEN_ASSIGN_EVALUATOR_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Assign_MKL.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Assign_MKL.h new file mode 100644 index 0000000..f9b86c8 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Assign_MKL.h @@ -0,0 +1,180 @@ +/* + Copyright (c) 2011, Intel Corporation. All rights reserved. + Copyright (C) 2015 Gael Guennebaud + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ******************************************************************************** + * Content : Eigen bindings to Intel(R) MKL + * MKL VML support for coefficient-wise unary Eigen expressions like a=b.sin() + ******************************************************************************** +*/ + +#ifndef EIGEN_ASSIGN_VML_H +#define EIGEN_ASSIGN_VML_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +template +class vml_assign_traits +{ + private: + enum { + DstHasDirectAccess = Dst::Flags & DirectAccessBit, + SrcHasDirectAccess = Src::Flags & DirectAccessBit, + StorageOrdersAgree = (int(Dst::IsRowMajor) == int(Src::IsRowMajor)), + InnerSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::SizeAtCompileTime) + : int(Dst::Flags)&RowMajorBit ? int(Dst::ColsAtCompileTime) + : int(Dst::RowsAtCompileTime), + InnerMaxSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::MaxSizeAtCompileTime) + : int(Dst::Flags)&RowMajorBit ? int(Dst::MaxColsAtCompileTime) + : int(Dst::MaxRowsAtCompileTime), + MaxSizeAtCompileTime = Dst::SizeAtCompileTime, + + MightEnableVml = StorageOrdersAgree && DstHasDirectAccess && SrcHasDirectAccess && Src::InnerStrideAtCompileTime==1 && Dst::InnerStrideAtCompileTime==1, + MightLinearize = MightEnableVml && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit), + VmlSize = MightLinearize ? MaxSizeAtCompileTime : InnerMaxSize, + LargeEnough = VmlSize==Dynamic || VmlSize>=EIGEN_MKL_VML_THRESHOLD + }; + public: + enum { + EnableVml = MightEnableVml && LargeEnough, + Traversal = MightLinearize ? LinearTraversal : DefaultTraversal + }; +}; + +#define EIGEN_PP_EXPAND(ARG) ARG +#if !defined (EIGEN_FAST_MATH) || (EIGEN_FAST_MATH != 1) +#define EIGEN_VMLMODE_EXPAND_xLA , VML_HA +#else +#define EIGEN_VMLMODE_EXPAND_xLA , VML_LA +#endif + +#define EIGEN_VMLMODE_EXPAND_x_ + +#define EIGEN_VMLMODE_PREFIX_xLA vm +#define EIGEN_VMLMODE_PREFIX_x_ v +#define EIGEN_VMLMODE_PREFIX(VMLMODE) EIGEN_CAT(EIGEN_VMLMODE_PREFIX_x,VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE, VMLMODE) \ + template< typename DstXprType, typename SrcXprNested> \ + struct Assignment, SrcXprNested>, assign_op, \ + Dense2Dense, std::enable_if_t::EnableVml>> { \ + typedef CwiseUnaryOp, SrcXprNested> SrcXprType; \ + static void run(DstXprType &dst, const SrcXprType &src, const assign_op &func) { \ + resize_if_allowed(dst, src, func); \ + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \ + if(vml_assign_traits::Traversal==LinearTraversal) { \ + VMLOP(dst.size(), (const VMLTYPE*)src.nestedExpression().data(), \ + (VMLTYPE*)dst.data() EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE) ); \ + } else { \ + const Index outerSize = dst.outerSize(); \ + for(Index outer = 0; outer < outerSize; ++outer) { \ + const EIGENTYPE *src_ptr = src.IsRowMajor ? &(src.nestedExpression().coeffRef(outer,0)) : \ + &(src.nestedExpression().coeffRef(0, outer)); \ + EIGENTYPE *dst_ptr = dst.IsRowMajor ? &(dst.coeffRef(outer,0)) : &(dst.coeffRef(0, outer)); \ + VMLOP( dst.innerSize(), (const VMLTYPE*)src_ptr, \ + (VMLTYPE*)dst_ptr EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE)); \ + } \ + } \ + } \ + }; \ + + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),s##VMLOP), float, float, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),d##VMLOP), double, double, VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),c##VMLOP), scomplex, MKL_Complex8, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),z##VMLOP), dcomplex, MKL_Complex16, VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(EIGENOP, VMLOP, VMLMODE) + + +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sin, Sin, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(asin, Asin, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sinh, Sinh, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(cos, Cos, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(acos, Acos, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(cosh, Cosh, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(tan, Tan, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(atan, Atan, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(tanh, Tanh, LA) +// EIGEN_MKL_VML_DECLARE_UNARY_CALLS(abs, Abs, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(exp, Exp, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(log, Ln, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(log10, Log10, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sqrt, Sqrt, _) + +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(square, Sqr, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(arg, Arg, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(round, Round, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(floor, Floor, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(ceil, Ceil, _) + +#define EIGEN_MKL_VML_DECLARE_POW_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE, VMLMODE) \ + template< typename DstXprType, typename SrcXprNested, typename Plain> \ + struct Assignment, SrcXprNested, \ + const CwiseNullaryOp,Plain> >, assign_op, \ + Dense2Dense, std::enable_if_t::EnableVml>> { \ + typedef CwiseBinaryOp, SrcXprNested, \ + const CwiseNullaryOp,Plain> > SrcXprType; \ + static void run(DstXprType &dst, const SrcXprType &src, const assign_op &func) { \ + resize_if_allowed(dst, src, func); \ + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \ + VMLTYPE exponent = reinterpret_cast(src.rhs().functor().m_other); \ + if(vml_assign_traits::Traversal==LinearTraversal) \ + { \ + VMLOP( dst.size(), (const VMLTYPE*)src.lhs().data(), exponent, \ + (VMLTYPE*)dst.data() EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE) ); \ + } else { \ + const Index outerSize = dst.outerSize(); \ + for(Index outer = 0; outer < outerSize; ++outer) { \ + const EIGENTYPE *src_ptr = src.IsRowMajor ? &(src.lhs().coeffRef(outer,0)) : \ + &(src.lhs().coeffRef(0, outer)); \ + EIGENTYPE *dst_ptr = dst.IsRowMajor ? &(dst.coeffRef(outer,0)) : &(dst.coeffRef(0, outer)); \ + VMLOP( dst.innerSize(), (const VMLTYPE*)src_ptr, exponent, \ + (VMLTYPE*)dst_ptr EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE)); \ + } \ + } \ + } \ + }; + +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmsPowx, float, float, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmdPowx, double, double, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmcPowx, scomplex, MKL_Complex8, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmzPowx, dcomplex, MKL_Complex16, LA) + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_ASSIGN_VML_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/BandMatrix.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/BandMatrix.h index 2570d7b..c2d943c 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/BandMatrix.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/BandMatrix.h @@ -3,30 +3,18 @@ // // Copyright (C) 2009 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_BANDMATRIX_H #define EIGEN_BANDMATRIX_H -namespace internal { +#include "./InternalHeaderCheck.h" + +namespace Eigen { +namespace internal { template class BandMatrixBase : public EigenBase @@ -46,7 +34,7 @@ class BandMatrixBase : public EigenBase }; typedef typename internal::traits::Scalar Scalar; typedef Matrix DenseMatrixType; - typedef typename DenseMatrixType::Index Index; + typedef typename DenseMatrixType::StorageIndex StorageIndex; typedef typename internal::traits::CoefficientsType CoefficientsType; typedef EigenBase Base; @@ -55,11 +43,11 @@ class BandMatrixBase : public EigenBase DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) ? 1 + Supers + Subs : Dynamic, - SizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime,ColsAtCompileTime) + SizeAtCompileTime = min_size_prefer_dynamic(RowsAtCompileTime,ColsAtCompileTime) }; public: - + using Base::derived; using Base::rows; using Base::cols; @@ -69,10 +57,10 @@ class BandMatrixBase : public EigenBase /** \returns the number of sub diagonals */ inline Index subs() const { return derived().subs(); } - + /** \returns an expression of the underlying coefficient matrix */ inline const CoefficientsType& coeffs() const { return derived().coeffs(); } - + /** \returns an expression of the underlying coefficient matrix */ inline CoefficientsType& coeffs() { return derived().coeffs(); } @@ -81,7 +69,7 @@ class BandMatrixBase : public EigenBase * \warning the internal storage must be column major. */ inline Block col(Index i) { - EIGEN_STATIC_ASSERT((Options&RowMajor)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + EIGEN_STATIC_ASSERT((int(Options) & int(RowMajor)) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); Index start = 0; Index len = coeffs().rows(); if (i<=supers()) @@ -104,19 +92,19 @@ class BandMatrixBase : public EigenBase template struct DiagonalIntReturnType { enum { - ReturnOpposite = (Options&SelfAdjoint) && (((Index)>0 && Supers==0) || ((Index)<0 && Subs==0)), + ReturnOpposite = (int(Options) & int(SelfAdjoint)) && (((Index) > 0 && Supers == 0) || ((Index) < 0 && Subs == 0)), Conjugate = ReturnOpposite && NumTraits::IsComplex, ActualIndex = ReturnOpposite ? -Index : Index, DiagonalSize = (RowsAtCompileTime==Dynamic || ColsAtCompileTime==Dynamic) ? Dynamic : (ActualIndex<0 - ? EIGEN_SIZE_MIN_PREFER_DYNAMIC(ColsAtCompileTime, RowsAtCompileTime + ActualIndex) - : EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime, ColsAtCompileTime - ActualIndex)) + ? min_size_prefer_dynamic(ColsAtCompileTime, RowsAtCompileTime + ActualIndex) + : min_size_prefer_dynamic(RowsAtCompileTime, ColsAtCompileTime - ActualIndex)) }; typedef Block BuildType; - typedef typename internal::conditional,BuildType >, - BuildType>::type Type; + BuildType> Type; }; /** \returns a vector expression of the \a N -th sub or super diagonal */ @@ -144,7 +132,7 @@ class BandMatrixBase : public EigenBase eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers())); return Block(coeffs(), supers()-i, std::max(0,i), 1, diagonalLength(i)); } - + template inline void evalTo(Dest& dst) const { dst.resize(rows(),cols()); @@ -175,66 +163,66 @@ class BandMatrixBase : public EigenBase * * \brief Represents a rectangular matrix with a banded storage * - * \param _Scalar Numeric type, i.e. float, double, int - * \param Rows Number of rows, or \b Dynamic - * \param Cols Number of columns, or \b Dynamic - * \param Supers Number of super diagonal - * \param Subs Number of sub diagonal - * \param _Options A combination of either \b #RowMajor or \b #ColMajor, and of \b #SelfAdjoint - * The former controls \ref TopicStorageOrders "storage order", and defaults to - * column-major. The latter controls whether the matrix represents a selfadjoint - * matrix in which case either Supers of Subs have to be null. + * \tparam Scalar_ Numeric type, i.e. float, double, int + * \tparam Rows_ Number of rows, or \b Dynamic + * \tparam Cols_ Number of columns, or \b Dynamic + * \tparam Supers_ Number of super diagonal + * \tparam Subs_ Number of sub diagonal + * \tparam Options_ A combination of either \b #RowMajor or \b #ColMajor, and of \b #SelfAdjoint + * The former controls \ref TopicStorageOrders "storage order", and defaults to + * column-major. The latter controls whether the matrix represents a selfadjoint + * matrix in which case either Supers of Subs have to be null. * * \sa class TridiagonalMatrix */ -template -struct traits > +template +struct traits > { - typedef _Scalar Scalar; + typedef Scalar_ Scalar; typedef Dense StorageKind; - typedef DenseIndex Index; + typedef Eigen::Index StorageIndex; enum { CoeffReadCost = NumTraits::ReadCost, - RowsAtCompileTime = _Rows, - ColsAtCompileTime = _Cols, - MaxRowsAtCompileTime = _Rows, - MaxColsAtCompileTime = _Cols, + RowsAtCompileTime = Rows_, + ColsAtCompileTime = Cols_, + MaxRowsAtCompileTime = Rows_, + MaxColsAtCompileTime = Cols_, Flags = LvalueBit, - Supers = _Supers, - Subs = _Subs, - Options = _Options, + Supers = Supers_, + Subs = Subs_, + Options = Options_, DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) ? 1 + Supers + Subs : Dynamic }; - typedef Matrix CoefficientsType; + typedef Matrix CoefficientsType; }; -template -class BandMatrix : public BandMatrixBase > +template +class BandMatrix : public BandMatrixBase > { public: typedef typename internal::traits::Scalar Scalar; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; typedef typename internal::traits::CoefficientsType CoefficientsType; - inline BandMatrix(Index rows=Rows, Index cols=Cols, Index supers=Supers, Index subs=Subs) + explicit inline BandMatrix(Index rows=Rows, Index cols=Cols, Index supers=Supers, Index subs=Subs) : m_coeffs(1+supers+subs,cols), m_rows(rows), m_supers(supers), m_subs(subs) { } /** \returns the number of columns */ - inline Index rows() const { return m_rows.value(); } + inline EIGEN_CONSTEXPR Index rows() const { return m_rows.value(); } /** \returns the number of rows */ - inline Index cols() const { return m_coeffs.cols(); } + inline EIGEN_CONSTEXPR Index cols() const { return m_coeffs.cols(); } /** \returns the number of super diagonals */ - inline Index supers() const { return m_supers.value(); } + inline EIGEN_CONSTEXPR Index supers() const { return m_supers.value(); } /** \returns the number of sub diagonals */ - inline Index subs() const { return m_subs.value(); } + inline EIGEN_CONSTEXPR Index subs() const { return m_subs.value(); } inline const CoefficientsType& coeffs() const { return m_coeffs; } inline CoefficientsType& coeffs() { return m_coeffs; } @@ -247,40 +235,40 @@ class BandMatrix : public BandMatrixBase m_subs; }; -template +template class BandMatrixWrapper; -template -struct traits > +template +struct traits > { - typedef typename _CoefficientsType::Scalar Scalar; - typedef typename _CoefficientsType::StorageKind StorageKind; - typedef typename _CoefficientsType::Index Index; + typedef typename CoefficientsType_::Scalar Scalar; + typedef typename CoefficientsType_::StorageKind StorageKind; + typedef typename CoefficientsType_::StorageIndex StorageIndex; enum { - CoeffReadCost = internal::traits<_CoefficientsType>::CoeffReadCost, - RowsAtCompileTime = _Rows, - ColsAtCompileTime = _Cols, - MaxRowsAtCompileTime = _Rows, - MaxColsAtCompileTime = _Cols, + CoeffReadCost = internal::traits::CoeffReadCost, + RowsAtCompileTime = Rows_, + ColsAtCompileTime = Cols_, + MaxRowsAtCompileTime = Rows_, + MaxColsAtCompileTime = Cols_, Flags = LvalueBit, - Supers = _Supers, - Subs = _Subs, - Options = _Options, + Supers = Supers_, + Subs = Subs_, + Options = Options_, DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) ? 1 + Supers + Subs : Dynamic }; - typedef _CoefficientsType CoefficientsType; + typedef CoefficientsType_ CoefficientsType; }; -template -class BandMatrixWrapper : public BandMatrixBase > +template +class BandMatrixWrapper : public BandMatrixBase > { public: typedef typename internal::traits::Scalar Scalar; typedef typename internal::traits::CoefficientsType CoefficientsType; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; - inline BandMatrixWrapper(const CoefficientsType& coeffs, Index rows=_Rows, Index cols=_Cols, Index supers=_Supers, Index subs=_Subs) + explicit inline BandMatrixWrapper(const CoefficientsType& coeffs, Index rows=Rows_, Index cols=Cols_, Index supers=Supers_, Index subs=Subs_) : m_coeffs(coeffs), m_rows(rows), m_supers(supers), m_subs(subs) { @@ -289,25 +277,25 @@ class BandMatrixWrapper : public BandMatrixBase m_rows; - internal::variable_if_dynamic m_supers; - internal::variable_if_dynamic m_subs; + internal::variable_if_dynamic m_rows; + internal::variable_if_dynamic m_supers; + internal::variable_if_dynamic m_subs; }; /** @@ -316,9 +304,9 @@ class BandMatrixWrapper : public BandMatrixBase class TridiagonalMatrix : public BandMatrix { typedef BandMatrix Base; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; public: - TridiagonalMatrix(Index size = Size) : Base(size,size,Options&SelfAdjoint?0:1,1) {} + explicit TridiagonalMatrix(Index size = Size) : Base(size,size,Options&SelfAdjoint?0:1,1) {} inline typename Base::template DiagonalIntReturnType<1>::Type super() { return Base::template diagonal<1>(); } @@ -341,6 +329,27 @@ class TridiagonalMatrix : public BandMatrix +struct evaluator_traits > + : public evaluator_traits_base > +{ + typedef BandShape Shape; +}; + +template +struct evaluator_traits > + : public evaluator_traits_base > +{ + typedef BandShape Shape; +}; + +template<> struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; + } // end namespace internal +} // end namespace Eigen + #endif // EIGEN_BANDMATRIX_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Block.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Block.h index d470bc1..19c4b68 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Block.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Block.h @@ -4,70 +4,26 @@ // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2006-2010 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_BLOCK_H #define EIGEN_BLOCK_H -/** \class Block - * \ingroup Core_Module - * - * \brief Expression of a fixed-size or dynamic-size block - * - * \param XprType the type of the expression in which we are taking a block - * \param BlockRows the number of rows of the block we are taking at compile time (optional) - * \param BlockCols the number of columns of the block we are taking at compile time (optional) - * \param _DirectAccessStatus \internal used for partial specialization - * - * This class represents an expression of either a fixed-size or dynamic-size block. It is the return - * type of DenseBase::block(Index,Index,Index,Index) and DenseBase::block(Index,Index) and - * most of the time this is the only way it is used. - * - * However, if you want to directly maniputate block expressions, - * for instance if you want to write a function returning such an expression, you - * will need to use this class. - * - * Here is an example illustrating the dynamic case: - * \include class_Block.cpp - * Output: \verbinclude class_Block.out - * - * \note Even though this expression has dynamic size, in the case where \a XprType - * has fixed size, this expression inherits a fixed maximal size which means that evaluating - * it does not cause a dynamic memory allocation. - * - * Here is an example illustrating the fixed-size case: - * \include class_FixedBlock.cpp - * Output: \verbinclude class_FixedBlock.out - * - * \sa DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class VectorBlock - */ +#include "./InternalHeaderCheck.h" + +namespace Eigen { namespace internal { -template -struct traits > : traits +template +struct traits > : traits { typedef typename traits::Scalar Scalar; typedef typename traits::StorageKind StorageKind; typedef typename traits::XprKind XprKind; - typedef typename nested::type XprTypeNested; - typedef typename remove_reference::type _XprTypeNested; + typedef typename ref_selector::type XprTypeNested; + typedef std::remove_reference_t XprTypeNested_; enum{ MatrixRows = traits::RowsAtCompileTime, MatrixCols = traits::ColsAtCompileTime, @@ -79,6 +35,7 @@ struct traits MaxColsAtCompileTime = BlockCols==0 ? 0 : ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) : int(traits::MaxColsAtCompileTime), + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0, IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 @@ -91,44 +48,76 @@ struct traits OuterStrideAtCompileTime = HasSameStorageOrderAsXprType ? int(outer_stride_at_compile_time::ret) : int(inner_stride_at_compile_time::ret), - MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits::size) == 0) - && (InnerStrideAtCompileTime == 1) - ? PacketAccessBit : 0, - MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0, - FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0, + + // FIXME, this traits is rather specialized for dense object and it needs to be cleaned further FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, - Flags0 = traits::Flags & ( (HereditaryBits & ~RowMajorBit) | - DirectAccessBit | - MaskPacketAccessBit | - MaskAlignedBit), - Flags = Flags0 | FlagsLinearAccessBit | FlagsLvalueBit | FlagsRowMajorBit + Flags = (traits::Flags & (DirectAccessBit | (InnerPanel?CompressedAccessBit:0))) | FlagsLvalueBit | FlagsRowMajorBit, + // FIXME DirectAccessBit should not be handled by expressions + // + // Alignment is needed by MapBase's assertions + // We can sefely set it to false here. Internal alignment errors will be detected by an eigen_internal_assert in the respective evaluator + Alignment = 0 }; }; -} -template class Block - : public internal::dense_xpr_base >::type +template::ret> class BlockImpl_dense; + +} // end namespace internal + +template class BlockImpl; + +/** \class Block + * \ingroup Core_Module + * + * \brief Expression of a fixed-size or dynamic-size block + * + * \tparam XprType the type of the expression in which we are taking a block + * \tparam BlockRows the number of rows of the block we are taking at compile time (optional) + * \tparam BlockCols the number of columns of the block we are taking at compile time (optional) + * \tparam InnerPanel is true, if the block maps to a set of rows of a row major matrix or + * to set of columns of a column major matrix (optional). The parameter allows to determine + * at compile time whether aligned access is possible on the block expression. + * + * This class represents an expression of either a fixed-size or dynamic-size block. It is the return + * type of DenseBase::block(Index,Index,Index,Index) and DenseBase::block(Index,Index) and + * most of the time this is the only way it is used. + * + * However, if you want to directly maniputate block expressions, + * for instance if you want to write a function returning such an expression, you + * will need to use this class. + * + * Here is an example illustrating the dynamic case: + * \include class_Block.cpp + * Output: \verbinclude class_Block.out + * + * \note Even though this expression has dynamic size, in the case where \a XprType + * has fixed size, this expression inherits a fixed maximal size which means that evaluating + * it does not cause a dynamic memory allocation. + * + * Here is an example illustrating the fixed-size case: + * \include class_FixedBlock.cpp + * Output: \verbinclude class_FixedBlock.out + * + * \sa DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class VectorBlock + */ +template class Block + : public BlockImpl::StorageKind> { + typedef BlockImpl::StorageKind> Impl; public: + //typedef typename Impl::Base Base; + typedef Impl Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Block) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) - typedef typename internal::dense_xpr_base::type Base; - EIGEN_DENSE_PUBLIC_INTERFACE(Block) - - class InnerIterator; + typedef internal::remove_all_t NestedExpression; /** Column or Row constructor */ - inline Block(XprType& xpr, Index i) - : m_xpr(xpr), - // It is a row if and only if BlockRows==1 and BlockCols==XprType::ColsAtCompileTime, - // and it is a column if and only if BlockRows==XprType::RowsAtCompileTime and BlockCols==1, - // all other cases are invalid. - // The case a 1x1 matrix seems ambiguous, but the result is the same anyway. - m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), - m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0), - m_blockRows(BlockRows==1 ? 1 : xpr.rows()), - m_blockCols(BlockCols==1 ? 1 : xpr.cols()) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Block(XprType& xpr, Index i) : Impl(xpr,i) { eigen_assert( (i>=0) && ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows() - && startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols()); + eigen_assert(startRow >= 0 && BlockRows >= 0 && startRow + BlockRows <= xpr.rows() + && startCol >= 0 && BlockCols >= 0 && startCol + BlockCols <= xpr.cols()); } /** Dynamic-size constructor */ - inline Block(XprType& xpr, + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Block(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) - : m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), - m_blockRows(blockRows), m_blockCols(blockCols) + : Impl(xpr, startRow, startCol, blockRows, blockCols) { eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); - eigen_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows() - && startCol >= 0 && blockCols >= 0 && startCol + blockCols <= xpr.cols()); + eigen_assert(startRow >= 0 && blockRows >= 0 && startRow <= xpr.rows() - blockRows + && startCol >= 0 && blockCols >= 0 && startCol <= xpr.cols() - blockCols); } +}; - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) +// The generic default implementation for dense block simplu forward to the internal::BlockImpl_dense +// that must be specialized for direct and non-direct access... +template +class BlockImpl + : public internal::BlockImpl_dense +{ + typedef internal::BlockImpl_dense Impl; + typedef typename XprType::StorageIndex StorageIndex; + public: + typedef Impl Base; + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index i) : Impl(xpr,i) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index startRow, Index startCol) : Impl(xpr, startRow, startCol) {} + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) + : Impl(xpr, startRow, startCol, blockRows, blockCols) {} +}; + +namespace internal { + +/** \internal Internal implementation of dense Blocks in the general case. */ +template class BlockImpl_dense + : public internal::dense_xpr_base >::type +{ + typedef Block BlockType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(BlockType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl_dense) + + // class InnerIterator; // FIXME apparently never used + + /** Column or Row constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, Index i) + : m_xpr(xpr), + // It is a row if and only if BlockRows==1 and BlockCols==XprType::ColsAtCompileTime, + // and it is a column if and only if BlockRows==XprType::RowsAtCompileTime and BlockCols==1, + // all other cases are invalid. + // The case a 1x1 matrix seems ambiguous, but the result is the same anyway. + m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), + m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0), + m_blockRows(BlockRows==1 ? 1 : xpr.rows()), + m_blockCols(BlockCols==1 ? 1 : xpr.cols()) + {} + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, Index startRow, Index startCol) + : m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), + m_blockRows(BlockRows), m_blockCols(BlockCols) + {} - inline Index rows() const { return m_blockRows.value(); } - inline Index cols() const { return m_blockCols.value(); } + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, + Index startRow, Index startCol, + Index blockRows, Index blockCols) + : m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), + m_blockRows(blockRows), m_blockCols(blockCols) + {} - inline Scalar& coeffRef(Index row, Index col) + EIGEN_DEVICE_FUNC inline Index rows() const { return m_blockRows.value(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return m_blockCols.value(); } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index rowId, Index colId) { EIGEN_STATIC_ASSERT_LVALUE(XprType) - return m_xpr.const_cast_derived() - .coeffRef(row + m_startRow.value(), col + m_startCol.value()); + return m_xpr.coeffRef(rowId + m_startRow.value(), colId + m_startCol.value()); } - inline const Scalar& coeffRef(Index row, Index col) const + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const { - return m_xpr.derived() - .coeffRef(row + m_startRow.value(), col + m_startCol.value()); + return m_xpr.derived().coeffRef(rowId + m_startRow.value(), colId + m_startCol.value()); } - EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const { - return m_xpr.coeff(row + m_startRow.value(), col + m_startCol.value()); + return m_xpr.coeff(rowId + m_startRow.value(), colId + m_startCol.value()); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) { EIGEN_STATIC_ASSERT_LVALUE(XprType) - return m_xpr.const_cast_derived() - .coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), - m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + return m_xpr.coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const { - return m_xpr.const_cast_derived() - .coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), - m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + return m_xpr.coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); } + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const { - return m_xpr - .coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), - m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + return m_xpr.coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); } template - inline PacketScalar packet(Index row, Index col) const + EIGEN_DEVICE_FUNC inline PacketScalar packet(Index rowId, Index colId) const { - return m_xpr.template packet - (row + m_startRow.value(), col + m_startCol.value()); + return m_xpr.template packet(rowId + m_startRow.value(), colId + m_startCol.value()); } template - inline void writePacket(Index row, Index col, const PacketScalar& x) + EIGEN_DEVICE_FUNC inline void writePacket(Index rowId, Index colId, const PacketScalar& val) { - m_xpr.const_cast_derived().template writePacket - (row + m_startRow.value(), col + m_startCol.value(), x); + m_xpr.template writePacket(rowId + m_startRow.value(), colId + m_startCol.value(), val); } template - inline PacketScalar packet(Index index) const + EIGEN_DEVICE_FUNC inline PacketScalar packet(Index index) const { return m_xpr.template packet (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), @@ -228,96 +282,136 @@ template - inline void writePacket(Index index, const PacketScalar& x) + EIGEN_DEVICE_FUNC inline void writePacket(Index index, const PacketScalar& val) { - m_xpr.const_cast_derived().template writePacket + m_xpr.template writePacket (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), - m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0), x); + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0), val); } #ifdef EIGEN_PARSED_BY_DOXYGEN /** \sa MapBase::data() */ - inline const Scalar* data() const; - inline Index innerStride() const; - inline Index outerStride() const; + EIGEN_DEVICE_FUNC inline const Scalar* data() const; + EIGEN_DEVICE_FUNC inline Index innerStride() const; + EIGEN_DEVICE_FUNC inline Index outerStride() const; #endif + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const internal::remove_all_t& nestedExpression() const + { + return m_xpr; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + XprType& nestedExpression() { return m_xpr; } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startRow() const EIGEN_NOEXCEPT + { + return m_startRow.value(); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startCol() const EIGEN_NOEXCEPT + { + return m_startCol.value(); + } + protected: - const typename XprType::Nested m_xpr; - const internal::variable_if_dynamic m_startRow; - const internal::variable_if_dynamic m_startCol; - const internal::variable_if_dynamic m_blockRows; - const internal::variable_if_dynamic m_blockCols; + XprTypeNested m_xpr; + const internal::variable_if_dynamic m_startRow; + const internal::variable_if_dynamic m_startCol; + const internal::variable_if_dynamic m_blockRows; + const internal::variable_if_dynamic m_blockCols; }; -/** \internal */ +/** \internal Internal implementation of dense Blocks in the direct access case.*/ template -class Block - : public MapBase > +class BlockImpl_dense + : public MapBase > { + typedef Block BlockType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; + enum { + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0 + }; public: - typedef MapBase Base; - EIGEN_DENSE_PUBLIC_INTERFACE(Block) - - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(BlockType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl_dense) /** Column or Row constructor */ - inline Block(XprType& xpr, Index i) - : Base(internal::const_cast_ptr(&xpr.coeffRef( - (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0, - (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0)), + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, Index i) + : Base(xpr.data() + i * ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && (!XprTypeIsRowMajor)) + || ((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && ( XprTypeIsRowMajor)) ? xpr.innerStride() : xpr.outerStride()), BlockRows==1 ? 1 : xpr.rows(), BlockCols==1 ? 1 : xpr.cols()), - m_xpr(xpr) + m_xpr(xpr), + m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), + m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0) { - eigen_assert( (i>=0) && ( - ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows() - && startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols()); init(); } /** Dynamic-size constructor */ - inline Block(XprType& xpr, + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) - : Base(internal::const_cast_ptr(&xpr.coeffRef(startRow,startCol)), blockRows, blockCols), - m_xpr(xpr) + : Base(xpr.data()+xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol), blockRows, blockCols), + m_xpr(xpr), m_startRow(startRow), m_startCol(startCol) { - eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) - && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); - eigen_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows() - && startCol >= 0 && blockCols >= 0 && startCol + blockCols <= xpr.cols()); init(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const internal::remove_all_t& nestedExpression() const EIGEN_NOEXCEPT + { + return m_xpr; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + XprType& nestedExpression() { return m_xpr; } + /** \sa MapBase::innerStride() */ - inline Index innerStride() const + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index innerStride() const EIGEN_NOEXCEPT { - return internal::traits::HasSameStorageOrderAsXprType + return internal::traits::HasSameStorageOrderAsXprType ? m_xpr.innerStride() : m_xpr.outerStride(); } /** \sa MapBase::outerStride() */ - inline Index outerStride() const + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index outerStride() const EIGEN_NOEXCEPT { - return m_outerStride; + return internal::traits::HasSameStorageOrderAsXprType + ? m_xpr.outerStride() + : m_xpr.innerStride(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startRow() const EIGEN_NOEXCEPT { return m_startRow.value(); } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startCol() const EIGEN_NOEXCEPT { return m_startCol.value(); } + #ifndef __SUNPRO_CC // FIXME sunstudio is not friendly with the above friend... // META-FIXME there is no 'friend' keyword around here. Is this obsolete? @@ -326,7 +420,8 @@ class Block #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal used by allowAligned() */ - inline Block(XprType& xpr, const Scalar* data, Index blockRows, Index blockCols) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, const Scalar* data, Index blockRows, Index blockCols) : Base(data, blockRows, blockCols), m_xpr(xpr) { init(); @@ -334,16 +429,22 @@ class Block #endif protected: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void init() { - m_outerStride = internal::traits::HasSameStorageOrderAsXprType + m_outerStride = internal::traits::HasSameStorageOrderAsXprType ? m_xpr.outerStride() : m_xpr.innerStride(); } - const typename XprType::Nested m_xpr; + XprTypeNested m_xpr; + const internal::variable_if_dynamic m_startRow; + const internal::variable_if_dynamic m_startCol; Index m_outerStride; }; +} // end namespace internal + +} // end namespace Eigen #endif // EIGEN_BLOCK_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/BooleanRedux.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/BooleanRedux.h index 5c3444a..20e5bd9 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/BooleanRedux.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/BooleanRedux.h @@ -3,80 +3,71 @@ // // Copyright (C) 2008 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ALLANDANY_H #define EIGEN_ALLANDANY_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { -template +template struct all_unroller { enum { - col = (UnrollCount-1) / Derived::RowsAtCompileTime, - row = (UnrollCount-1) % Derived::RowsAtCompileTime + IsRowMajor = (int(Derived::Flags) & int(RowMajor)), + i = (UnrollCount-1) / InnerSize, + j = (UnrollCount-1) % InnerSize }; - inline static bool run(const Derived &mat) + EIGEN_DEVICE_FUNC static inline bool run(const Derived &mat) { - return all_unroller::run(mat) && mat.coeff(row, col); + return all_unroller::run(mat) && mat.coeff(IsRowMajor ? i : j, IsRowMajor ? j : i); } }; -template -struct all_unroller +template +struct all_unroller { - inline static bool run(const Derived &mat) { return mat.coeff(0, 0); } + EIGEN_DEVICE_FUNC static inline bool run(const Derived &/*mat*/) { return true; } }; -template -struct all_unroller +template +struct all_unroller { - inline static bool run(const Derived &) { return false; } + EIGEN_DEVICE_FUNC static inline bool run(const Derived &) { return false; } }; -template +template struct any_unroller { enum { - col = (UnrollCount-1) / Derived::RowsAtCompileTime, - row = (UnrollCount-1) % Derived::RowsAtCompileTime + IsRowMajor = (int(Derived::Flags) & int(RowMajor)), + i = (UnrollCount-1) / InnerSize, + j = (UnrollCount-1) % InnerSize }; - inline static bool run(const Derived &mat) + EIGEN_DEVICE_FUNC static inline bool run(const Derived &mat) { - return any_unroller::run(mat) || mat.coeff(row, col); + return any_unroller::run(mat) || mat.coeff(IsRowMajor ? i : j, IsRowMajor ? j : i); } }; -template -struct any_unroller +template +struct any_unroller { - inline static bool run(const Derived &mat) { return mat.coeff(0, 0); } + EIGEN_DEVICE_FUNC static inline bool run(const Derived & /*mat*/) { return false; } }; -template -struct any_unroller +template +struct any_unroller { - inline static bool run(const Derived &) { return false; } + EIGEN_DEVICE_FUNC static inline bool run(const Derived &) { return false; } }; } // end namespace internal @@ -89,23 +80,21 @@ struct any_unroller * \sa any(), Cwise::operator<() */ template -inline bool DenseBase::all() const +EIGEN_DEVICE_FUNC inline bool DenseBase::all() const { + typedef internal::evaluator Evaluator; enum { unroll = SizeAtCompileTime != Dynamic - && CoeffReadCost != Dynamic - && NumTraits::AddCost != Dynamic - && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT + && SizeAtCompileTime * (int(Evaluator::CoeffReadCost) + int(NumTraits::AddCost)) <= EIGEN_UNROLLING_LIMIT, }; + Evaluator evaluator(derived()); if(unroll) - return internal::all_unroller::run(derived()); + return internal::all_unroller::run(evaluator); else { - for(Index j = 0; j < cols(); ++j) - for(Index i = 0; i < rows(); ++i) - if (!coeff(i, j)) return false; + for(Index i = 0; i < derived().outerSize(); ++i) + for(Index j = 0; j < derived().innerSize(); ++j) + if (!evaluator.coeff(IsRowMajor ? i : j, IsRowMajor ? j : i)) return false; return true; } } @@ -115,23 +104,21 @@ inline bool DenseBase::all() const * \sa all() */ template -inline bool DenseBase::any() const +EIGEN_DEVICE_FUNC inline bool DenseBase::any() const { + typedef internal::evaluator Evaluator; enum { unroll = SizeAtCompileTime != Dynamic - && CoeffReadCost != Dynamic - && NumTraits::AddCost != Dynamic - && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT + && SizeAtCompileTime * (int(Evaluator::CoeffReadCost) + int(NumTraits::AddCost)) <= EIGEN_UNROLLING_LIMIT, }; + Evaluator evaluator(derived()); if(unroll) - return internal::any_unroller::run(derived()); + return internal::any_unroller::run(evaluator); else { - for(Index j = 0; j < cols(); ++j) - for(Index i = 0; i < rows(); ++i) - if (coeff(i, j)) return true; + for(Index i = 0; i < derived().outerSize(); ++i) + for(Index j = 0; j < derived().innerSize(); ++j) + if (evaluator.coeff(IsRowMajor ? i : j, IsRowMajor ? j : i)) return true; return false; } } @@ -141,9 +128,39 @@ inline bool DenseBase::any() const * \sa all(), any() */ template -inline typename DenseBase::Index DenseBase::count() const +EIGEN_DEVICE_FUNC inline Eigen::Index DenseBase::count() const { return derived().template cast().template cast().sum(); } +/** \returns true is \c *this contains at least one Not A Number (NaN). + * + * \sa allFinite() + */ +template +EIGEN_DEVICE_FUNC inline bool DenseBase::hasNaN() const +{ +#if EIGEN_COMP_MSVC || (defined __FAST_MATH__) + return derived().array().isNaN().any(); +#else + return !((derived().array()==derived().array()).all()); +#endif +} + +/** \returns true if \c *this contains only finite numbers, i.e., no NaN and no +/-INF values. + * + * \sa hasNaN() + */ +template +EIGEN_DEVICE_FUNC inline bool DenseBase::allFinite() const +{ +#if EIGEN_COMP_MSVC || (defined __FAST_MATH__) + return derived().array().isFinite().all(); +#else + return !((derived()-derived()).hasNaN()); +#endif +} + +} // end namespace Eigen + #endif // EIGEN_ALLANDANY_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CMakeLists.txt b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CMakeLists.txt deleted file mode 100644 index 2346fc2..0000000 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -FILE(GLOB Eigen_Core_SRCS "*.h") - -INSTALL(FILES - ${Eigen_Core_SRCS} - DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel - ) - -ADD_SUBDIRECTORY(products) -ADD_SUBDIRECTORY(util) -ADD_SUBDIRECTORY(arch) diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CommaInitializer.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CommaInitializer.h index 92422bf..7c2eea8 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CommaInitializer.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CommaInitializer.h @@ -4,28 +4,17 @@ // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_COMMAINITIALIZER_H #define EIGEN_COMMAINITIALIZER_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + /** \class CommaInitializer * \ingroup Core_Module * @@ -35,28 +24,46 @@ * the return type of MatrixBase::operator<<, and most of the time this is the only * way it is used. * - * \sa \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished() + * \sa \blank \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished() */ template struct CommaInitializer { typedef typename XprType::Scalar Scalar; - typedef typename XprType::Index Index; + EIGEN_DEVICE_FUNC inline CommaInitializer(XprType& xpr, const Scalar& s) : m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1) { + eigen_assert(m_xpr.rows() > 0 && m_xpr.cols() > 0 + && "Cannot comma-initialize a 0x0 matrix (operator<<)"); m_xpr.coeffRef(0,0) = s; } template + EIGEN_DEVICE_FUNC inline CommaInitializer(XprType& xpr, const DenseBase& other) : m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows()) { - m_xpr.block(0, 0, other.rows(), other.cols()) = other; + eigen_assert(m_xpr.rows() >= other.rows() && m_xpr.cols() >= other.cols() + && "Cannot comma-initialize a 0x0 matrix (operator<<)"); + m_xpr.template block(0, 0, other.rows(), other.cols()) = other; + } + + /* Copy/Move constructor which transfers ownership. This is crucial in + * absence of return value optimization to avoid assertions during destruction. */ + // FIXME in C++11 mode this could be replaced by a proper RValue constructor + EIGEN_DEVICE_FUNC + inline CommaInitializer(const CommaInitializer& o) + : m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) { + // Mark original object as finished. In absence of R-value references we need to const_cast: + const_cast(o).m_row = m_xpr.rows(); + const_cast(o).m_col = m_xpr.cols(); + const_cast(o).m_currentBlockRows = 0; } /* inserts a scalar value in the target matrix */ + EIGEN_DEVICE_FUNC CommaInitializer& operator,(const Scalar& s) { if (m_col==m_xpr.cols()) @@ -76,9 +83,10 @@ struct CommaInitializer /* inserts a matrix expression in the target matrix */ template + EIGEN_DEVICE_FUNC CommaInitializer& operator,(const DenseBase& other) { - if (m_col==m_xpr.cols()) + if (m_col==m_xpr.cols() && (other.cols()!=0 || other.rows()!=m_currentBlockRows)) { m_row+=m_currentBlockRows; m_col = 0; @@ -86,24 +94,22 @@ struct CommaInitializer eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows() && "Too many rows passed to comma initializer (operator<<)"); } - eigen_assert(m_col - (m_row, m_col) = other; - else - m_xpr.block(m_row, m_col, other.rows(), other.cols()) = other; + m_xpr.template block + (m_row, m_col, other.rows(), other.cols()) = other; m_col += other.cols(); return *this; } + EIGEN_DEVICE_FUNC inline ~CommaInitializer() +#if defined VERIFY_RAISES_ASSERT && (!defined EIGEN_NO_ASSERTION_CHECKING) && defined EIGEN_EXCEPTIONS + EIGEN_EXCEPTION_SPEC(Eigen::eigen_assert_exception) +#endif { - eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows() - && m_col == m_xpr.cols() - && "Too few coefficients passed to comma initializer (operator<<)"); + finished(); } /** \returns the built matrix once all its coefficients have been set. @@ -113,9 +119,15 @@ struct CommaInitializer * quaternion.fromRotationMatrix((Matrix3f() << axis0, axis1, axis2).finished()); * \endcode */ - inline XprType& finished() { return m_xpr; } + EIGEN_DEVICE_FUNC + inline XprType& finished() { + eigen_assert(((m_row+m_currentBlockRows) == m_xpr.rows() || m_xpr.cols() == 0) + && m_col == m_xpr.cols() + && "Too few coefficients passed to comma initializer (operator<<)"); + return m_xpr; + } - XprType& m_xpr; // target expression + XprType& m_xpr; // target expression Index m_row; // current row id Index m_col; // current col id Index m_currentBlockRows; // current block height @@ -129,11 +141,13 @@ struct CommaInitializer * * Example: \include MatrixBase_set.cpp * Output: \verbinclude MatrixBase_set.out + * + * \note According the c++ standard, the argument expressions of this comma initializer are evaluated in arbitrary order. * * \sa CommaInitializer::finished(), class CommaInitializer */ template -inline CommaInitializer DenseBase::operator<< (const Scalar& s) +EIGEN_DEVICE_FUNC inline CommaInitializer DenseBase::operator<< (const Scalar& s) { return CommaInitializer(*static_cast(this), s); } @@ -141,10 +155,12 @@ inline CommaInitializer DenseBase::operator<< (const Scalar& s /** \sa operator<<(const Scalar&) */ template template -inline CommaInitializer +EIGEN_DEVICE_FUNC inline CommaInitializer DenseBase::operator<<(const DenseBase& other) { return CommaInitializer(*static_cast(this), other); } +} // end namespace Eigen + #endif // EIGEN_COMMAINITIALIZER_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ConditionEstimator.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ConditionEstimator.h new file mode 100644 index 0000000..694be8b --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ConditionEstimator.h @@ -0,0 +1,177 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2016 Rasmus Munk Larsen (rmlarsen@google.com) +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CONDITIONESTIMATOR_H +#define EIGEN_CONDITIONESTIMATOR_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +template +struct rcond_compute_sign { + static inline Vector run(const Vector& v) { + const RealVector v_abs = v.cwiseAbs(); + return (v_abs.array() == static_cast(0)) + .select(Vector::Ones(v.size()), v.cwiseQuotient(v_abs)); + } +}; + +// Partial specialization to avoid elementwise division for real vectors. +template +struct rcond_compute_sign { + static inline Vector run(const Vector& v) { + return (v.array() < static_cast(0)) + .select(-Vector::Ones(v.size()), Vector::Ones(v.size())); + } +}; + +/** + * \returns an estimate of ||inv(matrix)||_1 given a decomposition of + * \a matrix that implements .solve() and .adjoint().solve() methods. + * + * This function implements Algorithms 4.1 and 5.1 from + * http://www.maths.manchester.ac.uk/~higham/narep/narep135.pdf + * which also forms the basis for the condition number estimators in + * LAPACK. Since at most 10 calls to the solve method of dec are + * performed, the total cost is O(dims^2), as opposed to O(dims^3) + * needed to compute the inverse matrix explicitly. + * + * The most common usage is in estimating the condition number + * ||matrix||_1 * ||inv(matrix)||_1. The first term ||matrix||_1 can be + * computed directly in O(n^2) operations. + * + * Supports the following decompositions: FullPivLU, PartialPivLU, LDLT, and + * LLT. + * + * \sa FullPivLU, PartialPivLU, LDLT, LLT. + */ +template +typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomposition& dec) +{ + typedef typename Decomposition::MatrixType MatrixType; + typedef typename Decomposition::Scalar Scalar; + typedef typename Decomposition::RealScalar RealScalar; + typedef typename internal::plain_col_type::type Vector; + typedef typename internal::plain_col_type::type RealVector; + const bool is_complex = (NumTraits::IsComplex != 0); + + eigen_assert(dec.rows() == dec.cols()); + const Index n = dec.rows(); + if (n == 0) + return 0; + + // Disable Index to float conversion warning +#ifdef __INTEL_COMPILER + #pragma warning push + #pragma warning ( disable : 2259 ) +#endif + Vector v = dec.solve(Vector::Ones(n) / Scalar(n)); +#ifdef __INTEL_COMPILER + #pragma warning pop +#endif + + // lower_bound is a lower bound on + // ||inv(matrix)||_1 = sup_v ||inv(matrix) v||_1 / ||v||_1 + // and is the objective maximized by the ("super-") gradient ascent + // algorithm below. + RealScalar lower_bound = v.template lpNorm<1>(); + if (n == 1) + return lower_bound; + + // Gradient ascent algorithm follows: We know that the optimum is achieved at + // one of the simplices v = e_i, so in each iteration we follow a + // super-gradient to move towards the optimal one. + RealScalar old_lower_bound = lower_bound; + Vector sign_vector(n); + Vector old_sign_vector; + Index v_max_abs_index = -1; + Index old_v_max_abs_index = v_max_abs_index; + for (int k = 0; k < 4; ++k) + { + sign_vector = internal::rcond_compute_sign::run(v); + if (k > 0 && !is_complex && sign_vector == old_sign_vector) { + // Break if the solution stagnated. + break; + } + // v_max_abs_index = argmax |real( inv(matrix)^T * sign_vector )| + v = dec.adjoint().solve(sign_vector); + v.real().cwiseAbs().maxCoeff(&v_max_abs_index); + if (v_max_abs_index == old_v_max_abs_index) { + // Break if the solution stagnated. + break; + } + // Move to the new simplex e_j, where j = v_max_abs_index. + v = dec.solve(Vector::Unit(n, v_max_abs_index)); // v = inv(matrix) * e_j. + lower_bound = v.template lpNorm<1>(); + if (lower_bound <= old_lower_bound) { + // Break if the gradient step did not increase the lower_bound. + break; + } + if (!is_complex) { + old_sign_vector = sign_vector; + } + old_v_max_abs_index = v_max_abs_index; + old_lower_bound = lower_bound; + } + // The following calculates an independent estimate of ||matrix||_1 by + // multiplying matrix by a vector with entries of slowly increasing + // magnitude and alternating sign: + // v_i = (-1)^{i} (1 + (i / (dim-1))), i = 0,...,dim-1. + // This improvement to Hager's algorithm above is due to Higham. It was + // added to make the algorithm more robust in certain corner cases where + // large elements in the matrix might otherwise escape detection due to + // exact cancellation (especially when op and op_adjoint correspond to a + // sequence of backsubstitutions and permutations), which could cause + // Hager's algorithm to vastly underestimate ||matrix||_1. + Scalar alternating_sign(RealScalar(1)); + for (Index i = 0; i < n; ++i) { + // The static_cast is needed when Scalar is a complex and RealScalar implements expression templates + v[i] = alternating_sign * static_cast(RealScalar(1) + (RealScalar(i) / (RealScalar(n - 1)))); + alternating_sign = -alternating_sign; + } + v = dec.solve(v); + const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 * RealScalar(n)); + return numext::maxi(lower_bound, alternate_lower_bound); +} + +/** \brief Reciprocal condition number estimator. + * + * Computing a decomposition of a dense matrix takes O(n^3) operations, while + * this method estimates the condition number quickly and reliably in O(n^2) + * operations. + * + * \returns an estimate of the reciprocal condition number + * (1 / (||matrix||_1 * ||inv(matrix)||_1)) of matrix, given ||matrix||_1 and + * its decomposition. Supports the following decompositions: FullPivLU, + * PartialPivLU, LDLT, and LLT. + * + * \sa FullPivLU, PartialPivLU, LDLT, LLT. + */ +template +typename Decomposition::RealScalar +rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition& dec) +{ + typedef typename Decomposition::RealScalar RealScalar; + eigen_assert(dec.rows() == dec.cols()); + if (dec.rows() == 0) return NumTraits::infinity(); + if (numext::is_exactly_zero(matrix_norm)) return RealScalar(0); + if (dec.rows() == 1) return RealScalar(1); + const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec); + return (numext::is_exactly_zero(inverse_matrix_norm) ? RealScalar(0) + : (RealScalar(1) / inverse_matrix_norm) / matrix_norm); +} + +} // namespace internal + +} // namespace Eigen + +#endif diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CoreEvaluators.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CoreEvaluators.h new file mode 100644 index 0000000..1729507 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CoreEvaluators.h @@ -0,0 +1,1744 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Benoit Jacob +// Copyright (C) 2011-2014 Gael Guennebaud +// Copyright (C) 2011-2012 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#ifndef EIGEN_COREEVALUATORS_H +#define EIGEN_COREEVALUATORS_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +// This class returns the evaluator kind from the expression storage kind. +// Default assumes index based accessors +template +struct storage_kind_to_evaluator_kind { + typedef IndexBased Kind; +}; + +// This class returns the evaluator shape from the expression storage kind. +// It can be Dense, Sparse, Triangular, Diagonal, SelfAdjoint, Band, etc. +template struct storage_kind_to_shape; + +template<> struct storage_kind_to_shape { typedef DenseShape Shape; }; +template<> struct storage_kind_to_shape { typedef SolverShape Shape; }; +template<> struct storage_kind_to_shape { typedef PermutationShape Shape; }; +template<> struct storage_kind_to_shape { typedef TranspositionsShape Shape; }; + +// Evaluators have to be specialized with respect to various criteria such as: +// - storage/structure/shape +// - scalar type +// - etc. +// Therefore, we need specialization of evaluator providing additional template arguments for each kind of evaluators. +// We currently distinguish the following kind of evaluators: +// - unary_evaluator for expressions taking only one arguments (CwiseUnaryOp, CwiseUnaryView, Transpose, MatrixWrapper, ArrayWrapper, Reverse, Replicate) +// - binary_evaluator for expression taking two arguments (CwiseBinaryOp) +// - ternary_evaluator for expression taking three arguments (CwiseTernaryOp) +// - product_evaluator for linear algebra products (Product); special case of binary_evaluator because it requires additional tags for dispatching. +// - mapbase_evaluator for Map, Block, Ref +// - block_evaluator for Block (special dispatching to a mapbase_evaluator or unary_evaluator) + +template< typename T, + typename Arg1Kind = typename evaluator_traits::Kind, + typename Arg2Kind = typename evaluator_traits::Kind, + typename Arg3Kind = typename evaluator_traits::Kind, + typename Arg1Scalar = typename traits::Scalar, + typename Arg2Scalar = typename traits::Scalar, + typename Arg3Scalar = typename traits::Scalar> struct ternary_evaluator; + +template< typename T, + typename LhsKind = typename evaluator_traits::Kind, + typename RhsKind = typename evaluator_traits::Kind, + typename LhsScalar = typename traits::Scalar, + typename RhsScalar = typename traits::Scalar> struct binary_evaluator; + +template< typename T, + typename Kind = typename evaluator_traits::Kind, + typename Scalar = typename T::Scalar> struct unary_evaluator; + +// evaluator_traits contains traits for evaluator + +template +struct evaluator_traits_base +{ + // by default, get evaluator kind and shape from storage + typedef typename storage_kind_to_evaluator_kind::StorageKind>::Kind Kind; + typedef typename storage_kind_to_shape::StorageKind>::Shape Shape; +}; + +// Default evaluator traits +template +struct evaluator_traits : public evaluator_traits_base +{ +}; + +template::Shape > +struct evaluator_assume_aliasing { + static const bool value = false; +}; + +// By default, we assume a unary expression: +template +struct evaluator : public unary_evaluator +{ + typedef unary_evaluator Base; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const T& xpr) : Base(xpr) {} +}; + + +// TODO: Think about const-correctness +template +struct evaluator + : evaluator +{ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const T& xpr) : evaluator(xpr) {} +}; + +// ---------- base class for all evaluators ---------- + +template +struct evaluator_base +{ + // TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle outer,inner indices. + typedef traits ExpressionTraits; + + enum { + Alignment = 0 + }; + // noncopyable: + // Don't make this class inherit noncopyable as this kills EBO (Empty Base Optimization) + // and make complex evaluator much larger than then should do. + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator_base() {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ~evaluator_base() {} +private: + EIGEN_DEVICE_FUNC evaluator_base(const evaluator_base&); + EIGEN_DEVICE_FUNC const evaluator_base& operator=(const evaluator_base&); +}; + +// -------------------- Matrix and Array -------------------- +// +// evaluator is a common base class for the +// Matrix and Array evaluators. +// Here we directly specialize evaluator. This is not really a unary expression, and it is, by definition, dense, +// so no need for more sophisticated dispatching. + +// this helper permits to completely eliminate m_outerStride if it is known at compiletime. +template class plainobjectbase_evaluator_data { +public: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr) + { +#ifndef EIGEN_INTERNAL_DEBUGGING + EIGEN_UNUSED_VARIABLE(outerStride); +#endif + eigen_internal_assert(outerStride==OuterStride); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index outerStride() const EIGEN_NOEXCEPT { return OuterStride; } + const Scalar *data; +}; + +template class plainobjectbase_evaluator_data { +public: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr), m_outerStride(outerStride) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Index outerStride() const { return m_outerStride; } + const Scalar *data; +protected: + Index m_outerStride; +}; + +template +struct evaluator > + : evaluator_base +{ + typedef PlainObjectBase PlainObjectType; + typedef typename PlainObjectType::Scalar Scalar; + typedef typename PlainObjectType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = PlainObjectType::IsRowMajor, + IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime, + RowsAtCompileTime = PlainObjectType::RowsAtCompileTime, + ColsAtCompileTime = PlainObjectType::ColsAtCompileTime, + + CoeffReadCost = NumTraits::ReadCost, + Flags = traits::EvaluatorFlags, + Alignment = traits::Alignment + }; + enum { + // We do not need to know the outer stride for vectors + OuterStrideAtCompileTime = IsVectorAtCompileTime ? 0 + : int(IsRowMajor) ? ColsAtCompileTime + : RowsAtCompileTime + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + evaluator() + : m_d(0,OuterStrideAtCompileTime) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const PlainObjectType& m) + : m_d(m.data(),IsVectorAtCompileTime ? 0 : m.outerStride()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + if (IsRowMajor) + return m_d.data[row * m_d.outerStride() + col]; + else + return m_d.data[row + col * m_d.outerStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.data[index]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + if (IsRowMajor) + return const_cast(m_d.data)[row * m_d.outerStride() + col]; + else + return const_cast(m_d.data)[row + col * m_d.outerStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return const_cast(m_d.data)[index]; + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + if (IsRowMajor) + return ploadt(m_d.data + row * m_d.outerStride() + col); + else + return ploadt(m_d.data + row + col * m_d.outerStride()); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return ploadt(m_d.data + index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + if (IsRowMajor) + return pstoret + (const_cast(m_d.data) + row * m_d.outerStride() + col, x); + else + return pstoret + (const_cast(m_d.data) + row + col * m_d.outerStride(), x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + return pstoret(const_cast(m_d.data) + index, x); + } + +protected: + + plainobjectbase_evaluator_data m_d; +}; + +template +struct evaluator > + : evaluator > > +{ + typedef Matrix XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + evaluator() {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& m) + : evaluator >(m) + { } +}; + +template +struct evaluator > + : evaluator > > +{ + typedef Array XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + evaluator() {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& m) + : evaluator >(m) + { } +}; + +// -------------------- Transpose -------------------- + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef Transpose XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + Flags = evaluator::Flags ^ RowMajorBit, + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& t) : m_argImpl(t.nestedExpression()) {} + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(col, row); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(col, row); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + typename XprType::Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(col, row); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_argImpl.template packet(index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + m_argImpl.template writePacket(col, row, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + m_argImpl.template writePacket(index, x); + } + +protected: + evaluator m_argImpl; +}; + +// -------------------- CwiseNullaryOp -------------------- +// Like Matrix and Array, this is not really a unary expression, so we directly specialize evaluator. +// Likewise, there is not need to more sophisticated dispatching here. + +template::value, + bool has_unary = has_unary_operator::value, + bool has_binary = has_binary_operator::value> +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { return op(i,j); } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { return op(i); } + + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { return op.template packetOp(i,j); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { return op.template packetOp(i); } +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType=0, IndexType=0) const { return op(); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType=0, IndexType=0) const { return op.template packetOp(); } +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j=0) const { return op(i,j); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j=0) const { return op.template packetOp(i,j); } +}; + +// We need the following specialization for vector-only functors assigned to a runtime vector, +// for instance, using linspace and assigning a RowVectorXd to a MatrixXd or even a row of a MatrixXd. +// In this case, i==0 and j is used for the actual iteration. +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { + eigen_assert(i==0 || j==0); + return op(i+j); + } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { + eigen_assert(i==0 || j==0); + return op.template packetOp(i+j); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { return op(i); } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { return op.template packetOp(i); } +}; + +template +struct nullary_wrapper {}; + +#if 0 && EIGEN_COMP_MSVC>0 +// Disable this ugly workaround. This is now handled in traits::match, +// but this piece of code might still become handly if some other weird compilation +// erros pop up again. + +// MSVC exhibits a weird compilation error when +// compiling: +// Eigen::MatrixXf A = MatrixXf::Random(3,3); +// Ref R = 2.f*A; +// and that has_*ary_operator> have not been instantiated yet. +// The "problem" is that evaluator<2.f*A> is instantiated by traits::match<2.f*A> +// and at that time has_*ary_operator returns true regardless of T. +// Then nullary_wrapper is badly instantiated as nullary_wrapper<.,.,true,true,true>. +// The trick is thus to defer the proper instantiation of nullary_wrapper when coeff(), +// and packet() are really instantiated as implemented below: + +// This is a simple wrapper around Index to enforce the re-instantiation of +// has_*ary_operator when needed. +template struct nullary_wrapper_workaround_msvc { + nullary_wrapper_workaround_msvc(const T&); + operator T()const; +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().operator()(op,i,j); + } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().operator()(op,i); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().template packetOp(op,i,j); + } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().template packetOp(op,i); + } +}; +#endif // MSVC workaround + +template +struct evaluator > + : evaluator_base > +{ + typedef CwiseNullaryOp XprType; + typedef internal::remove_all_t PlainObjectTypeCleaned; + + enum { + CoeffReadCost = internal::functor_traits::Cost, + + Flags = (evaluator::Flags + & ( HereditaryBits + | (functor_has_linear_access::ret ? LinearAccessBit : 0) + | (functor_traits::PacketAccess ? PacketAccessBit : 0))) + | (functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), + Alignment = AlignedMax + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& n) + : m_functor(n.functor()), m_wrapper() + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(IndexType row, IndexType col) const + { + return m_wrapper(m_functor, row, col); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(IndexType index) const + { + return m_wrapper(m_functor,index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(IndexType row, IndexType col) const + { + return m_wrapper.template packetOp(m_functor, row, col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(IndexType index) const + { + return m_wrapper.template packetOp(m_functor, index); + } + +protected: + const NullaryOp m_functor; + const internal::nullary_wrapper m_wrapper; +}; + +// -------------------- CwiseUnaryOp -------------------- + +template +struct unary_evaluator, IndexBased > + : evaluator_base > +{ + typedef CwiseUnaryOp XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + Flags = evaluator::Flags + & (HereditaryBits | LinearAccessBit | (functor_traits::PacketAccess ? PacketAccessBit : 0)), + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& op) : m_d(op) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.argImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.argImpl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_d.func().packetOp(m_d.argImpl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_d.func().packetOp(m_d.argImpl.template packet(index)); + } + +protected: + + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), argImpl(xpr.nestedExpression()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const UnaryOp& func() const { return op; } + UnaryOp op; + evaluator argImpl; + }; + + Data m_d; +}; + +// -------------------- CwiseTernaryOp -------------------- + +// this is a ternary expression +template +struct evaluator > + : public ternary_evaluator > +{ + typedef CwiseTernaryOp XprType; + typedef ternary_evaluator > Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +template +struct ternary_evaluator, IndexBased, IndexBased> + : evaluator_base > +{ + typedef CwiseTernaryOp XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + Arg1Flags = evaluator::Flags, + Arg2Flags = evaluator::Flags, + Arg3Flags = evaluator::Flags, + SameType = is_same::value && is_same::value, + StorageOrdersAgree = (int(Arg1Flags)&RowMajorBit)==(int(Arg2Flags)&RowMajorBit) && (int(Arg1Flags)&RowMajorBit)==(int(Arg3Flags)&RowMajorBit), + Flags0 = (int(Arg1Flags) | int(Arg2Flags) | int(Arg3Flags)) & ( + HereditaryBits + | (int(Arg1Flags) & int(Arg2Flags) & int(Arg3Flags) & + ( (StorageOrdersAgree ? LinearAccessBit : 0) + | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) + ) + ) + ), + Flags = (Flags0 & ~RowMajorBit) | (Arg1Flags & RowMajorBit), + Alignment = plain_enum_min( + plain_enum_min(evaluator::Alignment, evaluator::Alignment), + evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC explicit ternary_evaluator(const XprType& xpr) : m_d(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.arg1Impl.coeff(row, col), m_d.arg2Impl.coeff(row, col), m_d.arg3Impl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.arg1Impl.coeff(index), m_d.arg2Impl.coeff(index), m_d.arg3Impl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_d.func().packetOp(m_d.arg1Impl.template packet(row, col), + m_d.arg2Impl.template packet(row, col), + m_d.arg3Impl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_d.func().packetOp(m_d.arg1Impl.template packet(index), + m_d.arg2Impl.template packet(index), + m_d.arg3Impl.template packet(index)); + } + +protected: + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), arg1Impl(xpr.arg1()), arg2Impl(xpr.arg2()), arg3Impl(xpr.arg3()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const TernaryOp& func() const { return op; } + TernaryOp op; + evaluator arg1Impl; + evaluator arg2Impl; + evaluator arg3Impl; + }; + + Data m_d; +}; + +// -------------------- CwiseBinaryOp -------------------- + +// this is a binary expression +template +struct evaluator > + : public binary_evaluator > +{ + typedef CwiseBinaryOp XprType; + typedef binary_evaluator > Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +template +struct binary_evaluator, IndexBased, IndexBased> + : evaluator_base > +{ + typedef CwiseBinaryOp XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + LhsFlags = evaluator::Flags, + RhsFlags = evaluator::Flags, + SameType = is_same::value, + StorageOrdersAgree = (int(LhsFlags)&RowMajorBit)==(int(RhsFlags)&RowMajorBit), + Flags0 = (int(LhsFlags) | int(RhsFlags)) & ( + HereditaryBits + | (int(LhsFlags) & int(RhsFlags) & + ( (StorageOrdersAgree ? LinearAccessBit : 0) + | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) + ) + ) + ), + Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit), + Alignment = plain_enum_min(evaluator::Alignment, evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit binary_evaluator(const XprType& xpr) : m_d(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.lhsImpl.coeff(row, col), m_d.rhsImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.lhsImpl.coeff(index), m_d.rhsImpl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_d.func().packetOp(m_d.lhsImpl.template packet(row, col), + m_d.rhsImpl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_d.func().packetOp(m_d.lhsImpl.template packet(index), + m_d.rhsImpl.template packet(index)); + } + +protected: + + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), lhsImpl(xpr.lhs()), rhsImpl(xpr.rhs()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const BinaryOp& func() const { return op; } + BinaryOp op; + evaluator lhsImpl; + evaluator rhsImpl; + }; + + Data m_d; +}; + +// -------------------- CwiseUnaryView -------------------- + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef CwiseUnaryView XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + Flags = (evaluator::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit)), + + Alignment = 0 // FIXME it is not very clear why alignment is necessarily lost... + }; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& op) : m_d(op) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.argImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.argImpl.coeff(index)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_d.func()(m_d.argImpl.coeffRef(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_d.func()(m_d.argImpl.coeffRef(index)); + } + +protected: + + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), argImpl(xpr.nestedExpression()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const UnaryOp& func() const { return op; } + UnaryOp op; + evaluator argImpl; + }; + + Data m_d; +}; + +// -------------------- Map -------------------- + +// FIXME perhaps the PlainObjectType could be provided by Derived::PlainObject ? +// but that might complicate template specialization +template +struct mapbase_evaluator; + +template +struct mapbase_evaluator : evaluator_base +{ + typedef Derived XprType; + typedef typename XprType::PointerType PointerType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = XprType::RowsAtCompileTime, + ColsAtCompileTime = XprType::ColsAtCompileTime, + CoeffReadCost = NumTraits::ReadCost + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit mapbase_evaluator(const XprType& map) + : m_data(const_cast(map.data())), + m_innerStride(map.innerStride()), + m_outerStride(map.outerStride()) + { + EIGEN_STATIC_ASSERT(check_implication((evaluator::Flags & PacketAccessBit) != 0, + internal::inner_stride_at_compile_time::ret == 1), + PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_data[col * colStride() + row * rowStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_data[index * m_innerStride.value()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_data[col * colStride() + row * rowStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_data[index * m_innerStride.value()]; + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + PointerType ptr = m_data + row * rowStride() + col * colStride(); + return internal::ploadt(ptr); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return internal::ploadt(m_data + index * m_innerStride.value()); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + PointerType ptr = m_data + row * rowStride() + col * colStride(); + return internal::pstoret(ptr, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + internal::pstoret(m_data + index * m_innerStride.value(), x); + } +protected: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rowStride() const EIGEN_NOEXCEPT { + return XprType::IsRowMajor ? m_outerStride.value() : m_innerStride.value(); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index colStride() const EIGEN_NOEXCEPT { + return XprType::IsRowMajor ? m_innerStride.value() : m_outerStride.value(); + } + + PointerType m_data; + const internal::variable_if_dynamic m_innerStride; + const internal::variable_if_dynamic m_outerStride; +}; + +template +struct evaluator > + : public mapbase_evaluator, PlainObjectType> +{ + typedef Map XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types once we can handle multi-sized packet types + typedef typename packet_traits::type PacketScalar; + + enum { + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 + ? int(PlainObjectType::InnerStrideAtCompileTime) + : int(StrideType::InnerStrideAtCompileTime), + OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 + ? int(PlainObjectType::OuterStrideAtCompileTime) + : int(StrideType::OuterStrideAtCompileTime), + HasNoInnerStride = InnerStrideAtCompileTime == 1, + HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0, + HasNoStride = HasNoInnerStride && HasNoOuterStride, + IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic, + + PacketAccessMask = bool(HasNoInnerStride) ? ~int(0) : ~int(PacketAccessBit), + LinearAccessMask = bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime) ? ~int(0) : ~int(LinearAccessBit), + Flags = int( evaluator::Flags) & (LinearAccessMask&PacketAccessMask), + + Alignment = int(MapOptions)&int(AlignedMask) + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map) + : mapbase_evaluator(map) + { } +}; + +// -------------------- Ref -------------------- + +template +struct evaluator > + : public mapbase_evaluator, PlainObjectType> +{ + typedef Ref XprType; + + enum { + Flags = evaluator >::Flags, + Alignment = evaluator >::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& ref) + : mapbase_evaluator(ref) + { } +}; + +// -------------------- Block -------------------- + +template::ret> struct block_evaluator; + +template +struct evaluator > + : block_evaluator +{ + typedef Block XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types once we can handle multi-sized packet types + typedef typename packet_traits::type PacketScalar; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime, + + ArgTypeIsRowMajor = (int(evaluator::Flags)&RowMajorBit) != 0, + IsRowMajor = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0 + : ArgTypeIsRowMajor, + HasSameStorageOrderAsArgType = (IsRowMajor == ArgTypeIsRowMajor), + InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + InnerStrideAtCompileTime = HasSameStorageOrderAsArgType + ? int(inner_stride_at_compile_time::ret) + : int(outer_stride_at_compile_time::ret), + OuterStrideAtCompileTime = HasSameStorageOrderAsArgType + ? int(outer_stride_at_compile_time::ret) + : int(inner_stride_at_compile_time::ret), + MaskPacketAccessBit = (InnerStrideAtCompileTime == 1 || HasSameStorageOrderAsArgType) ? PacketAccessBit : 0, + + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (evaluator::Flags&LinearAccessBit))) ? LinearAccessBit : 0, + FlagsRowMajorBit = XprType::Flags&RowMajorBit, + Flags0 = evaluator::Flags & ( (HereditaryBits & ~RowMajorBit) | + DirectAccessBit | + MaskPacketAccessBit), + Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit, + + PacketAlignment = unpacket_traits::alignment, + Alignment0 = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) + && (OuterStrideAtCompileTime!=0) + && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % int(PacketAlignment)) == 0)) ? int(PacketAlignment) : 0, + Alignment = plain_enum_min(evaluator::Alignment, Alignment0) + }; + typedef block_evaluator block_evaluator_type; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& block) : block_evaluator_type(block) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } +}; + +// no direct-access => dispatch to a unary evaluator +template +struct block_evaluator + : unary_evaluator > +{ + typedef Block XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit block_evaluator(const XprType& block) + : unary_evaluator(block) + {} +}; + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef Block XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& block) + : m_argImpl(block.nestedExpression()), + m_startRow(block.startRow()), + m_startCol(block.startCol()), + m_linear_offset(ForwardLinearAccess?(ArgType::IsRowMajor ? block.startRow()*block.nestedExpression().cols() + block.startCol() : block.startCol()*block.nestedExpression().rows() + block.startRow()):0) + { } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + RowsAtCompileTime = XprType::RowsAtCompileTime, + ForwardLinearAccess = (InnerPanel || int(XprType::IsRowMajor)==int(ArgType::IsRowMajor)) && bool(evaluator::Flags&LinearAccessBit) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(m_startRow.value() + row, m_startCol.value() + col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return linear_coeff_impl(index, bool_constant()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(m_startRow.value() + row, m_startCol.value() + col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return linear_coeffRef_impl(index, bool_constant()); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(m_startRow.value() + row, m_startCol.value() + col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + if (ForwardLinearAccess) + return m_argImpl.template packet(m_linear_offset.value() + index); + else + return packet(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + return m_argImpl.template writePacket(m_startRow.value() + row, m_startCol.value() + col, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + if (ForwardLinearAccess) + return m_argImpl.template writePacket(m_linear_offset.value() + index, x); + else + return writePacket(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0, + x); + } + +protected: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType linear_coeff_impl(Index index, internal::true_type /* ForwardLinearAccess */) const + { + return m_argImpl.coeff(m_linear_offset.value() + index); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType linear_coeff_impl(Index index, internal::false_type /* not ForwardLinearAccess */) const + { + return coeff(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& linear_coeffRef_impl(Index index, internal::true_type /* ForwardLinearAccess */) + { + return m_argImpl.coeffRef(m_linear_offset.value() + index); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& linear_coeffRef_impl(Index index, internal::false_type /* not ForwardLinearAccess */) + { + return coeffRef(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); + } + + evaluator m_argImpl; + const variable_if_dynamic m_startRow; + const variable_if_dynamic m_startCol; + const variable_if_dynamic m_linear_offset; +}; + +// TODO: This evaluator does not actually use the child evaluator; +// all action is via the data() as returned by the Block expression. + +template +struct block_evaluator + : mapbase_evaluator, + typename Block::PlainObject> +{ + typedef Block XprType; + typedef typename XprType::Scalar Scalar; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit block_evaluator(const XprType& block) + : mapbase_evaluator(block) + { + eigen_internal_assert((internal::is_constant_evaluated() || (internal::UIntPtr(block.data()) % plain_enum_max(1,evaluator::Alignment)) == 0) \ + && "data is not aligned"); + } +}; + + +// -------------------- Select -------------------- +// NOTE shall we introduce a ternary_evaluator? + +// TODO enable vectorization for Select +template +struct evaluator > + : evaluator_base > +{ + typedef Select XprType; + enum { + CoeffReadCost = evaluator::CoeffReadCost + + plain_enum_max(evaluator::CoeffReadCost, + evaluator::CoeffReadCost), + + Flags = (unsigned int)evaluator::Flags & evaluator::Flags & HereditaryBits, + + Alignment = plain_enum_min(evaluator::Alignment, evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& select) + : m_conditionImpl(select.conditionMatrix()), + m_thenImpl(select.thenMatrix()), + m_elseImpl(select.elseMatrix()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + if (m_conditionImpl.coeff(row, col)) + return m_thenImpl.coeff(row, col); + else + return m_elseImpl.coeff(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + if (m_conditionImpl.coeff(index)) + return m_thenImpl.coeff(index); + else + return m_elseImpl.coeff(index); + } + +protected: + evaluator m_conditionImpl; + evaluator m_thenImpl; + evaluator m_elseImpl; +}; + + +// -------------------- Replicate -------------------- + +template +struct unary_evaluator > + : evaluator_base > +{ + typedef Replicate XprType; + typedef typename XprType::CoeffReturnType CoeffReturnType; + enum { + Factor = (RowFactor==Dynamic || ColFactor==Dynamic) ? Dynamic : RowFactor*ColFactor + }; + typedef typename internal::nested_eval::type ArgTypeNested; + typedef internal::remove_all_t ArgTypeNestedCleaned; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + LinearAccessMask = XprType::IsVectorAtCompileTime ? LinearAccessBit : 0, + Flags = (evaluator::Flags & (HereditaryBits|LinearAccessMask) & ~RowMajorBit) | (traits::Flags & RowMajorBit), + + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& replicate) + : m_arg(replicate.nestedExpression()), + m_argImpl(m_arg), + m_rows(replicate.nestedExpression().rows()), + m_cols(replicate.nestedExpression().cols()) + {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + // try to avoid using modulo; this is a pure optimization strategy + const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 + : RowFactor==1 ? row + : row % m_rows.value(); + const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 + : ColFactor==1 ? col + : col % m_cols.value(); + + return m_argImpl.coeff(actual_row, actual_col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + // try to avoid using modulo; this is a pure optimization strategy + const Index actual_index = internal::traits::RowsAtCompileTime==1 + ? (ColFactor==1 ? index : index%m_cols.value()) + : (RowFactor==1 ? index : index%m_rows.value()); + + return m_argImpl.coeff(actual_index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 + : RowFactor==1 ? row + : row % m_rows.value(); + const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 + : ColFactor==1 ? col + : col % m_cols.value(); + + return m_argImpl.template packet(actual_row, actual_col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + const Index actual_index = internal::traits::RowsAtCompileTime==1 + ? (ColFactor==1 ? index : index%m_cols.value()) + : (RowFactor==1 ? index : index%m_rows.value()); + + return m_argImpl.template packet(actual_index); + } + +protected: + const ArgTypeNested m_arg; + evaluator m_argImpl; + const variable_if_dynamic m_rows; + const variable_if_dynamic m_cols; +}; + +// -------------------- MatrixWrapper and ArrayWrapper -------------------- +// +// evaluator_wrapper_base is a common base class for the +// MatrixWrapper and ArrayWrapper evaluators. + +template +struct evaluator_wrapper_base + : evaluator_base +{ + typedef remove_all_t ArgType; + enum { + CoeffReadCost = evaluator::CoeffReadCost, + Flags = evaluator::Flags, + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator_wrapper_base(const ArgType& arg) : m_argImpl(arg) {} + + typedef typename ArgType::Scalar Scalar; + typedef typename ArgType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(row, col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_argImpl.template packet(index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + m_argImpl.template writePacket(row, col, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + m_argImpl.template writePacket(index, x); + } + +protected: + evaluator m_argImpl; +}; + +template +struct unary_evaluator > + : evaluator_wrapper_base > +{ + typedef MatrixWrapper XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& wrapper) + : evaluator_wrapper_base >(wrapper.nestedExpression()) + { } +}; + +template +struct unary_evaluator > + : evaluator_wrapper_base > +{ + typedef ArrayWrapper XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& wrapper) + : evaluator_wrapper_base >(wrapper.nestedExpression()) + { } +}; + + +// -------------------- Reverse -------------------- + +// defined in Reverse.h: +template struct reverse_packet_cond; + +template +struct unary_evaluator > + : evaluator_base > +{ + typedef Reverse XprType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = XprType::IsRowMajor, + IsColMajor = !IsRowMajor, + ReverseRow = (Direction == Vertical) || (Direction == BothDirections), + ReverseCol = (Direction == Horizontal) || (Direction == BothDirections), + ReversePacket = (Direction == BothDirections) + || ((Direction == Vertical) && IsColMajor) + || ((Direction == Horizontal) && IsRowMajor), + + CoeffReadCost = evaluator::CoeffReadCost, + + // let's enable LinearAccess only with vectorization because of the product overhead + // FIXME enable DirectAccess with negative strides? + Flags0 = evaluator::Flags, + LinearAccess = ( (Direction==BothDirections) && (int(Flags0)&PacketAccessBit) ) + || ((ReverseRow && XprType::ColsAtCompileTime==1) || (ReverseCol && XprType::RowsAtCompileTime==1)) + ? LinearAccessBit : 0, + + Flags = int(Flags0) & (HereditaryBits | PacketAccessBit | LinearAccess), + + Alignment = 0 // FIXME in some rare cases, Alignment could be preserved, like a Vector4f. + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& reverse) + : m_argImpl(reverse.nestedExpression()), + m_rows(ReverseRow ? reverse.nestedExpression().rows() : 1), + m_cols(ReverseCol ? reverse.nestedExpression().cols() : 1) + { } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(ReverseRow ? m_rows.value() - row - 1 : row, + ReverseCol ? m_cols.value() - col - 1 : col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(m_rows.value() * m_cols.value() - index - 1); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(ReverseRow ? m_rows.value() - row - 1 : row, + ReverseCol ? m_cols.value() - col - 1 : col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(m_rows.value() * m_cols.value() - index - 1); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + enum { + PacketSize = unpacket_traits::size, + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1 + }; + typedef internal::reverse_packet_cond reverse_packet; + return reverse_packet::run(m_argImpl.template packet( + ReverseRow ? m_rows.value() - row - OffsetRow : row, + ReverseCol ? m_cols.value() - col - OffsetCol : col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + enum { PacketSize = unpacket_traits::size }; + return preverse(m_argImpl.template packet(m_rows.value() * m_cols.value() - index - PacketSize)); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + // FIXME we could factorize some code with packet(i,j) + enum { + PacketSize = unpacket_traits::size, + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1 + }; + typedef internal::reverse_packet_cond reverse_packet; + m_argImpl.template writePacket( + ReverseRow ? m_rows.value() - row - OffsetRow : row, + ReverseCol ? m_cols.value() - col - OffsetCol : col, + reverse_packet::run(x)); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + enum { PacketSize = unpacket_traits::size }; + m_argImpl.template writePacket + (m_rows.value() * m_cols.value() - index - PacketSize, preverse(x)); + } + +protected: + evaluator m_argImpl; + + // If we do not reverse rows, then we do not need to know the number of rows; same for columns + // Nonetheless, in this case it is important to set to 1 such that the coeff(index) method works fine for vectors. + const variable_if_dynamic m_rows; + const variable_if_dynamic m_cols; +}; + + +// -------------------- Diagonal -------------------- + +template +struct evaluator > + : evaluator_base > +{ + typedef Diagonal XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + + Flags = (unsigned int)(evaluator::Flags & (HereditaryBits | DirectAccessBit) & ~RowMajorBit) | LinearAccessBit, + + Alignment = 0 + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& diagonal) + : m_argImpl(diagonal.nestedExpression()), + m_index(diagonal.index()) + { } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index) const + { + return m_argImpl.coeff(row + rowOffset(), row + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index + rowOffset(), index + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index) + { + return m_argImpl.coeffRef(row + rowOffset(), row + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index + rowOffset(), index + colOffset()); + } + +protected: + evaluator m_argImpl; + const internal::variable_if_dynamicindex m_index; + +private: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rowOffset() const { return m_index.value() > 0 ? 0 : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index colOffset() const { return m_index.value() > 0 ? m_index.value() : 0; } +}; + + +//---------------------------------------------------------------------- +// deprecated code +//---------------------------------------------------------------------- + +// -------------------- EvalToTemp -------------------- + +// expression class for evaluating nested expression to a temporary + +template class EvalToTemp; + +template +struct traits > + : public traits +{ }; + +template +class EvalToTemp + : public dense_xpr_base >::type +{ + public: + + typedef typename dense_xpr_base::type Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(EvalToTemp) + + explicit EvalToTemp(const ArgType& arg) + : m_arg(arg) + { } + + const ArgType& arg() const + { + return m_arg; + } + + EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT + { + return m_arg.rows(); + } + + EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT + { + return m_arg.cols(); + } + + private: + const ArgType& m_arg; +}; + +template +struct evaluator > + : public evaluator +{ + typedef EvalToTemp XprType; + typedef typename ArgType::PlainObject PlainObject; + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) + : m_result(xpr.arg()) + { + internal::construct_at(this, m_result); + } + + // This constructor is used when nesting an EvalTo evaluator in another evaluator + EIGEN_DEVICE_FUNC evaluator(const ArgType& arg) + : m_result(arg) + { + internal::construct_at(this, m_result); + } + +protected: + PlainObject m_result; +}; + +} // namespace internal + +} // end namespace Eigen + +#endif // EIGEN_COREEVALUATORS_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CoreIterators.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CoreIterators.h new file mode 100644 index 0000000..f74568a --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CoreIterators.h @@ -0,0 +1,134 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_COREITERATORS_H +#define EIGEN_COREITERATORS_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +/* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core + */ + +namespace internal { + +template +class inner_iterator_selector; + +} + +/** \class InnerIterator + * \brief An InnerIterator allows to loop over the element of any matrix expression. + * + * \warning To be used with care because an evaluator is constructed every time an InnerIterator iterator is constructed. + * + * TODO: add a usage example + */ +template +class InnerIterator +{ +protected: + typedef internal::inner_iterator_selector::Kind> IteratorType; + typedef internal::evaluator EvaluatorType; + typedef typename internal::traits::Scalar Scalar; +public: + /** Construct an iterator over the \a outerId -th row or column of \a xpr */ + InnerIterator(const XprType &xpr, const Index &outerId) + : m_eval(xpr), m_iter(m_eval, outerId, xpr.innerSize()) + {} + + /// \returns the value of the current coefficient. + EIGEN_STRONG_INLINE Scalar value() const { return m_iter.value(); } + /** Increment the iterator \c *this to the next non-zero coefficient. + * Explicit zeros are not skipped over. To skip explicit zeros, see class SparseView + */ + EIGEN_STRONG_INLINE InnerIterator& operator++() { m_iter.operator++(); return *this; } + EIGEN_STRONG_INLINE InnerIterator& operator+=(Index i) { m_iter.operator+=(i); return *this; } + EIGEN_STRONG_INLINE InnerIterator operator+(Index i) + { InnerIterator result(*this); result+=i; return result; } + + + /// \returns the column or row index of the current coefficient. + EIGEN_STRONG_INLINE Index index() const { return m_iter.index(); } + /// \returns the row index of the current coefficient. + EIGEN_STRONG_INLINE Index row() const { return m_iter.row(); } + /// \returns the column index of the current coefficient. + EIGEN_STRONG_INLINE Index col() const { return m_iter.col(); } + /// \returns \c true if the iterator \c *this still references a valid coefficient. + EIGEN_STRONG_INLINE operator bool() const { return m_iter; } + +protected: + EvaluatorType m_eval; + IteratorType m_iter; +private: + // If you get here, then you're not using the right InnerIterator type, e.g.: + // SparseMatrix A; + // SparseMatrix::InnerIterator it(A,0); + template InnerIterator(const EigenBase&,Index outer); +}; + +namespace internal { + +// Generic inner iterator implementation for dense objects +template +class inner_iterator_selector +{ +protected: + typedef evaluator EvaluatorType; + typedef typename traits::Scalar Scalar; + enum { IsRowMajor = (XprType::Flags&RowMajorBit)==RowMajorBit }; + +public: + EIGEN_STRONG_INLINE inner_iterator_selector(const EvaluatorType &eval, const Index &outerId, const Index &innerSize) + : m_eval(eval), m_inner(0), m_outer(outerId), m_end(innerSize) + {} + + EIGEN_STRONG_INLINE Scalar value() const + { + return (IsRowMajor) ? m_eval.coeff(m_outer, m_inner) + : m_eval.coeff(m_inner, m_outer); + } + + EIGEN_STRONG_INLINE inner_iterator_selector& operator++() { m_inner++; return *this; } + + EIGEN_STRONG_INLINE Index index() const { return m_inner; } + inline Index row() const { return IsRowMajor ? m_outer : index(); } + inline Index col() const { return IsRowMajor ? index() : m_outer; } + + EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } + +protected: + const EvaluatorType& m_eval; + Index m_inner; + const Index m_outer; + const Index m_end; +}; + +// For iterator-based evaluator, inner-iterator is already implemented as +// evaluator<>::InnerIterator +template +class inner_iterator_selector + : public evaluator::InnerIterator +{ +protected: + typedef typename evaluator::InnerIterator Base; + typedef evaluator EvaluatorType; + +public: + EIGEN_STRONG_INLINE inner_iterator_selector(const EvaluatorType &eval, const Index &outerId, const Index &/*innerSize*/) + : Base(eval, outerId) + {} +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_COREITERATORS_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseBinaryOp.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseBinaryOp.h index 7386b2e..21a061a 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseBinaryOp.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseBinaryOp.h @@ -1,50 +1,19 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008-2009 Gael Guennebaud +// Copyright (C) 2008-2014 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_CWISE_BINARY_OP_H #define EIGEN_CWISE_BINARY_OP_H -/** \class CwiseBinaryOp - * \ingroup Core_Module - * - * \brief Generic expression where a coefficient-wise binary operator is applied to two expressions - * - * \param BinaryOp template functor implementing the operator - * \param Lhs the type of the left-hand side - * \param Rhs the type of the right-hand side - * - * This class represents an expression where a coefficient-wise binary operator is applied to two expressions. - * It is the return type of binary operators, by which we mean only those binary operators where - * both the left-hand side and the right-hand side are Eigen expressions. - * For example, the return type of matrix1+matrix2 is a CwiseBinaryOp. - * - * Most of the time, this is the only way that it is used, so you typically don't have to name - * CwiseBinaryOp types explicitly. - * - * \sa MatrixBase::binaryExpr(const MatrixBase &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp - */ +#include "./InternalHeaderCheck.h" + +namespace Eigen { namespace internal { template @@ -52,7 +21,7 @@ struct traits > { // we must not inherit from traits since it has // the potential to cause problems with MSVC - typedef typename remove_all::type Ancestor; + typedef remove_all_t Ancestor; typedef typename traits::XprKind XprKind; enum { RowsAtCompileTime = traits::RowsAtCompileTime, @@ -65,148 +34,124 @@ struct traits > // we still want to handle the case when the result type is different. typedef typename result_of< BinaryOp( - typename Lhs::Scalar, - typename Rhs::Scalar + const typename Lhs::Scalar&, + const typename Rhs::Scalar& ) >::type Scalar; - typedef typename promote_storage_type::StorageKind, - typename traits::StorageKind>::ret StorageKind; - typedef typename promote_index_type::Index, - typename traits::Index>::type Index; + typedef typename cwise_promote_storage_type::StorageKind, + typename traits::StorageKind, + BinaryOp>::ret StorageKind; + typedef typename promote_index_type::StorageIndex, + typename traits::StorageIndex>::type StorageIndex; typedef typename Lhs::Nested LhsNested; typedef typename Rhs::Nested RhsNested; - typedef typename remove_reference::type _LhsNested; - typedef typename remove_reference::type _RhsNested; + typedef std::remove_reference_t LhsNested_; + typedef std::remove_reference_t RhsNested_; enum { - LhsCoeffReadCost = _LhsNested::CoeffReadCost, - RhsCoeffReadCost = _RhsNested::CoeffReadCost, - LhsFlags = _LhsNested::Flags, - RhsFlags = _RhsNested::Flags, - SameType = is_same::value, - StorageOrdersAgree = (int(Lhs::Flags)&RowMajorBit)==(int(Rhs::Flags)&RowMajorBit), - Flags0 = (int(LhsFlags) | int(RhsFlags)) & ( - HereditaryBits - | (int(LhsFlags) & int(RhsFlags) & - ( AlignedBit - | (StorageOrdersAgree ? LinearAccessBit : 0) - | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) - ) - ) - ), - Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit), - CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + functor_traits::Cost + Flags = cwise_promote_storage_order::StorageKind,typename traits::StorageKind,LhsNested_::Flags & RowMajorBit,RhsNested_::Flags & RowMajorBit>::value }; }; } // end namespace internal -// we require Lhs and Rhs to have the same scalar type. Currently there is no example of a binary functor -// that would take two operands of different types. If there were such an example, then this check should be -// moved to the BinaryOp functors, on a per-case basis. This would however require a change in the BinaryOp functors, as -// currently they take only one typename Scalar template parameter. -// It is tempting to always allow mixing different types but remember that this is often impossible in the vectorized paths. -// So allowing mixing different types gives very unexpected errors when enabling vectorization, when the user tries to -// add together a float matrix and a double matrix. -#define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \ - EIGEN_STATIC_ASSERT((internal::functor_allows_mixing_real_and_complex::ret \ - ? int(internal::is_same::Real, typename NumTraits::Real>::value) \ - : int(internal::is_same::value)), \ - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - template class CwiseBinaryOpImpl; -template -class CwiseBinaryOp : internal::no_assignment_operator, +/** \class CwiseBinaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise binary operator is applied to two expressions + * + * \tparam BinaryOp template functor implementing the operator + * \tparam LhsType the type of the left-hand side + * \tparam RhsType the type of the right-hand side + * + * This class represents an expression where a coefficient-wise binary operator is applied to two expressions. + * It is the return type of binary operators, by which we mean only those binary operators where + * both the left-hand side and the right-hand side are Eigen expressions. + * For example, the return type of matrix1+matrix2 is a CwiseBinaryOp. + * + * Most of the time, this is the only way that it is used, so you typically don't have to name + * CwiseBinaryOp types explicitly. + * + * \sa MatrixBase::binaryExpr(const MatrixBase &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp + */ +template +class CwiseBinaryOp : public CwiseBinaryOpImpl< - BinaryOp, Lhs, Rhs, - typename internal::promote_storage_type::StorageKind, - typename internal::traits::StorageKind>::ret> + BinaryOp, LhsType, RhsType, + typename internal::cwise_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + BinaryOp>::ret>, + internal::no_assignment_operator { public: + typedef internal::remove_all_t Functor; + typedef internal::remove_all_t Lhs; + typedef internal::remove_all_t Rhs; + typedef typename CwiseBinaryOpImpl< - BinaryOp, Lhs, Rhs, - typename internal::promote_storage_type::StorageKind, - typename internal::traits::StorageKind>::ret>::Base Base; + BinaryOp, LhsType, RhsType, + typename internal::cwise_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + BinaryOp>::ret>::Base Base; EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp) - typedef typename internal::nested::type LhsNested; - typedef typename internal::nested::type RhsNested; - typedef typename internal::remove_reference::type _LhsNested; - typedef typename internal::remove_reference::type _RhsNested; + EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs) + + typedef typename internal::ref_selector::type LhsNested; + typedef typename internal::ref_selector::type RhsNested; + typedef std::remove_reference_t LhsNested_; + typedef std::remove_reference_t RhsNested_; + +#if EIGEN_COMP_MSVC + //Required for Visual Studio or the Copy constructor will probably not get inlined! + EIGEN_STRONG_INLINE + CwiseBinaryOp(const CwiseBinaryOp&) = default; +#endif - EIGEN_STRONG_INLINE CwiseBinaryOp(const Lhs& lhs, const Rhs& rhs, const BinaryOp& func = BinaryOp()) - : m_lhs(lhs), m_rhs(rhs), m_functor(func) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CwiseBinaryOp(const Lhs& aLhs, const Rhs& aRhs, const BinaryOp& func = BinaryOp()) + : m_lhs(aLhs), m_rhs(aRhs), m_functor(func) { - EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar); - // require the sizes to match - EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs) - eigen_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); + eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols()); } - EIGEN_STRONG_INLINE Index rows() const { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { // return the fixed size type if available to enable compile time optimizations - if (internal::traits::type>::RowsAtCompileTime==Dynamic) - return m_rhs.rows(); - else - return m_lhs.rows(); + return internal::traits>::RowsAtCompileTime==Dynamic ? m_rhs.rows() : m_lhs.rows(); } - EIGEN_STRONG_INLINE Index cols() const { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { // return the fixed size type if available to enable compile time optimizations - if (internal::traits::type>::ColsAtCompileTime==Dynamic) - return m_rhs.cols(); - else - return m_lhs.cols(); + return internal::traits>::ColsAtCompileTime==Dynamic ? m_rhs.cols() : m_lhs.cols(); } /** \returns the left hand side nested expression */ - const _LhsNested& lhs() const { return m_lhs; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const LhsNested_& lhs() const { return m_lhs; } /** \returns the right hand side nested expression */ - const _RhsNested& rhs() const { return m_rhs; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const RhsNested_& rhs() const { return m_rhs; } /** \returns the functor representing the binary operation */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const BinaryOp& functor() const { return m_functor; } protected: - const LhsNested m_lhs; - const RhsNested m_rhs; + LhsNested m_lhs; + RhsNested m_rhs; const BinaryOp m_functor; }; -template -class CwiseBinaryOpImpl - : public internal::dense_xpr_base >::type +// Generic API dispatcher +template +class CwiseBinaryOpImpl + : public internal::generic_xpr_base >::type { - typedef CwiseBinaryOp Derived; - public: - - typedef typename internal::dense_xpr_base >::type Base; - EIGEN_DENSE_PUBLIC_INTERFACE( Derived ) - - EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const - { - return derived().functor()(derived().lhs().coeff(row, col), - derived().rhs().coeff(row, col)); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const - { - return derived().functor().packetOp(derived().lhs().template packet(row, col), - derived().rhs().template packet(row, col)); - } - - EIGEN_STRONG_INLINE const Scalar coeff(Index index) const - { - return derived().functor()(derived().lhs().coeff(index), - derived().rhs().coeff(index)); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index index) const - { - return derived().functor().packetOp(derived().lhs().template packet(index), - derived().rhs().template packet(index)); - } +public: + typedef typename internal::generic_xpr_base >::type Base; }; /** replaces \c *this by \c *this - \a other. @@ -215,11 +160,10 @@ class CwiseBinaryOpImpl */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & MatrixBase::operator-=(const MatrixBase &other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::sub_assign_op()); return derived(); } @@ -229,12 +173,13 @@ MatrixBase::operator-=(const MatrixBase &other) */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & MatrixBase::operator+=(const MatrixBase& other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::add_assign_op()); return derived(); } +} // end namespace Eigen + #endif // EIGEN_CWISE_BINARY_OP_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseNullaryOp.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseNullaryOp.h index c616e7a..a62f54d 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseNullaryOp.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseNullaryOp.h @@ -3,35 +3,35 @@ // // Copyright (C) 2008-2010 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_CWISE_NULLARY_OP_H #define EIGEN_CWISE_NULLARY_OP_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { +template +struct traits > : traits +{ + enum { + Flags = traits::Flags & RowMajorBit + }; +}; + +} // namespace internal + /** \class CwiseNullaryOp * \ingroup Core_Module * * \brief Generic expression of a matrix where all coefficients are defined by a functor * - * \param NullaryOp template functor implementing the operator - * \param PlainObjectType the underlying plain matrix/array type + * \tparam NullaryOp template functor implementing the operator + * \tparam PlainObjectType the underlying plain matrix/array type * * This class represents an expression of a generic nullary operator. * It is the return type of the Ones(), Zero(), Constant(), Identity() and Random() methods, @@ -40,33 +40,33 @@ * However, if you want to write a function returning such an expression, you * will need to use this class. * - * \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr() + * The functor NullaryOp must expose one of the following method: + + + + +
\c operator()() if the procedural generation does not depend on the coefficient entries (e.g., random numbers)
\c operator()(Index i)if the procedural generation makes sense for vectors only and that it depends on the coefficient index \c i (e.g., linspace)
\c operator()(Index i,Index j)if the procedural generation depends on the matrix coordinates \c i, \c j (e.g., to generate a checkerboard with 0 and 1)
+ * It is also possible to expose the last two operators if the generation makes sense for matrices but can be optimized for vectors. + * + * See DenseBase::NullaryExpr(Index,const CustomNullaryOp&) for an example binding + * C++11 random number generators. + * + * A nullary expression can also be used to implement custom sophisticated matrix manipulations + * that cannot be covered by the existing set of natively supported matrix manipulations. + * See this \ref TopicCustomizing_NullaryExpr "page" for some examples and additional explanations + * on the behavior of CwiseNullaryOp. + * + * \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr */ - -namespace internal { template -struct traits > : traits -{ - enum { - Flags = (traits::Flags - & ( HereditaryBits - | (functor_has_linear_access::ret ? LinearAccessBit : 0) - | (functor_traits::PacketAccess ? PacketAccessBit : 0))) - | (functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), - CoeffReadCost = functor_traits::Cost - }; -}; -} - -template -class CwiseNullaryOp : internal::no_assignment_operator, - public internal::dense_xpr_base< CwiseNullaryOp >::type +class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp >::type, internal::no_assignment_operator { public: typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp) + EIGEN_DEVICE_FUNC CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp()) : m_rows(rows), m_cols(cols), m_functor(func) { @@ -76,30 +76,14 @@ class CwiseNullaryOp : internal::no_assignment_operator, && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); } - EIGEN_STRONG_INLINE Index rows() const { return m_rows.value(); } - EIGEN_STRONG_INLINE Index cols() const { return m_cols.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const { return m_rows.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const { return m_cols.value(); } - EIGEN_STRONG_INLINE const Scalar coeff(Index rows, Index cols) const - { - return m_functor(rows, cols); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const - { - return m_functor.packetOp(row, col); - } - - EIGEN_STRONG_INLINE const Scalar coeff(Index index) const - { - return m_functor(index); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index index) const - { - return m_functor.packetOp(index); - } + /** \returns the functor representing the nullary operation */ + EIGEN_DEVICE_FUNC + const NullaryOp& functor() const { return m_functor; } protected: const internal::variable_if_dynamic m_rows; @@ -123,10 +107,15 @@ class CwiseNullaryOp : internal::no_assignment_operator, */ template template -EIGEN_STRONG_INLINE const CwiseNullaryOp +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +#ifndef EIGEN_PARSED_BY_DOXYGEN +const CwiseNullaryOp::PlainObject> +#else +const CwiseNullaryOp +#endif DenseBase::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func) { - return CwiseNullaryOp(rows, cols, func); + return CwiseNullaryOp(rows, cols, func); } /** \returns an expression of a matrix defined by a custom functor \a func @@ -142,16 +131,24 @@ DenseBase::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& f * * The template parameter \a CustomNullaryOp is the type of the functor. * + * Here is an example with C++11 random generators: \include random_cpp11.cpp + * Output: \verbinclude random_cpp11.out + * * \sa class CwiseNullaryOp */ template template -EIGEN_STRONG_INLINE const CwiseNullaryOp +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +#ifndef EIGEN_PARSED_BY_DOXYGEN +const CwiseNullaryOp::PlainObject> +#else +const CwiseNullaryOp +#endif DenseBase::NullaryExpr(Index size, const CustomNullaryOp& func) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - if(RowsAtCompileTime == 1) return CwiseNullaryOp(1, size, func); - else return CwiseNullaryOp(size, 1, func); + if(RowsAtCompileTime == 1) return CwiseNullaryOp(1, size, func); + else return CwiseNullaryOp(size, 1, func); } /** \returns an expression of a matrix defined by a custom functor \a func @@ -165,10 +162,15 @@ DenseBase::NullaryExpr(Index size, const CustomNullaryOp& func) */ template template -EIGEN_STRONG_INLINE const CwiseNullaryOp +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +#ifndef EIGEN_PARSED_BY_DOXYGEN +const CwiseNullaryOp::PlainObject> +#else +const CwiseNullaryOp +#endif DenseBase::NullaryExpr(const CustomNullaryOp& func) { - return CwiseNullaryOp(RowsAtCompileTime, ColsAtCompileTime, func); + return CwiseNullaryOp(RowsAtCompileTime, ColsAtCompileTime, func); } /** \returns an expression of a constant matrix of value \a value @@ -185,7 +187,7 @@ DenseBase::NullaryExpr(const CustomNullaryOp& func) * \sa class CwiseNullaryOp */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Constant(Index rows, Index cols, const Scalar& value) { return DenseBase::NullaryExpr(rows, cols, internal::scalar_constant_op(value)); @@ -207,7 +209,7 @@ DenseBase::Constant(Index rows, Index cols, const Scalar& value) * \sa class CwiseNullaryOp */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Constant(Index size, const Scalar& value) { return DenseBase::NullaryExpr(size, internal::scalar_constant_op(value)); @@ -223,67 +225,72 @@ DenseBase::Constant(Index size, const Scalar& value) * \sa class CwiseNullaryOp */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Constant(const Scalar& value) { EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) return DenseBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_constant_op(value)); } -/** - * \brief Sets a linearly space vector. - * - * The function generates 'size' equally spaced values in the closed interval [low,high]. - * This particular version of LinSpaced() uses sequential access, i.e. vector access is - * assumed to be a(0), a(1), ..., a(size). This assumption allows for better vectorization - * and yields faster code than the random access version. +/** \deprecated because of accuracy loss. In Eigen 3.3, it is an alias for LinSpaced(Index,const Scalar&,const Scalar&) * * \only_for_vectors * - * Example: \include DenseBase_LinSpaced_seq.cpp - * Output: \verbinclude DenseBase_LinSpaced_seq.out + * Example: \include DenseBase_LinSpaced_seq_deprecated.cpp + * Output: \verbinclude DenseBase_LinSpaced_seq_deprecated.out * - * \sa setLinSpaced(Index,const Scalar&,const Scalar&), LinSpaced(Index,Scalar,Scalar), CwiseNullaryOp + * \sa LinSpaced(Index,const Scalar&, const Scalar&), setLinSpaced(Index,const Scalar&,const Scalar&) */ template -EIGEN_STRONG_INLINE const typename DenseBase::SequentialLinSpacedReturnType +EIGEN_DEPRECATED EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType DenseBase::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); } -/** - * \copydoc DenseBase::LinSpaced(Sequential_t, Index, const Scalar&, const Scalar&) - * Special version for fixed size types which does not require the size parameter. +/** \deprecated because of accuracy loss. In Eigen 3.3, it is an alias for LinSpaced(const Scalar&,const Scalar&) + * + * \sa LinSpaced(const Scalar&, const Scalar&) */ template -EIGEN_STRONG_INLINE const typename DenseBase::SequentialLinSpacedReturnType +EIGEN_DEPRECATED EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType DenseBase::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) - return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); } /** - * \brief Sets a linearly space vector. + * \brief Sets a linearly spaced vector. * * The function generates 'size' equally spaced values in the closed interval [low,high]. + * When size is set to 1, a vector of length 1 containing 'high' is returned. * * \only_for_vectors * * Example: \include DenseBase_LinSpaced.cpp * Output: \verbinclude DenseBase_LinSpaced.out * - * \sa setLinSpaced(Index,const Scalar&,const Scalar&), LinSpaced(Sequential_t,Index,const Scalar&,const Scalar&,Index), CwiseNullaryOp + * For integer scalar types, an even spacing is possible if and only if the length of the range, + * i.e., \c high-low is a scalar multiple of \c size-1, or if \c size is a scalar multiple of the + * number of values \c high-low+1 (meaning each value can be repeated the same number of time). + * If one of these two considions is not satisfied, then \c high is lowered to the largest value + * satisfying one of this constraint. + * Here are some examples: + * + * Example: \include DenseBase_LinSpacedInt.cpp + * Output: \verbinclude DenseBase_LinSpacedInt.out + * + * \sa setLinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp */ template -EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType DenseBase::LinSpaced(Index size, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); } /** @@ -291,22 +298,23 @@ DenseBase::LinSpaced(Index size, const Scalar& low, const Scalar& high) * Special version for fixed size types which does not require the size parameter. */ template -EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType DenseBase::LinSpaced(const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) - return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); } -/** \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ +/** \returns true if all coefficients in this matrix are approximately equal to \a val, to within precision \a prec */ template -bool DenseBase::isApproxToConstant -(const Scalar& value, RealScalar prec) const +EIGEN_DEVICE_FUNC bool DenseBase::isApproxToConstant +(const Scalar& val, const RealScalar& prec) const { + typename internal::nested_eval::type self(derived()); for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) - if(!internal::isApprox(this->coeff(i, j), value, prec)) + if(!internal::isApprox(self.coeff(i, j), val, prec)) return false; return true; } @@ -315,33 +323,33 @@ bool DenseBase::isApproxToConstant * * \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ template -bool DenseBase::isConstant -(const Scalar& value, RealScalar prec) const +EIGEN_DEVICE_FUNC bool DenseBase::isConstant +(const Scalar& val, const RealScalar& prec) const { - return isApproxToConstant(value, prec); + return isApproxToConstant(val, prec); } -/** Alias for setConstant(): sets all coefficients in this expression to \a value. +/** Alias for setConstant(): sets all coefficients in this expression to \a val. * * \sa setConstant(), Constant(), class CwiseNullaryOp */ template -EIGEN_STRONG_INLINE void DenseBase::fill(const Scalar& value) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void DenseBase::fill(const Scalar& val) { - setConstant(value); + setConstant(val); } -/** Sets all coefficients in this expression to \a value. +/** Sets all coefficients in this expression to value \a val. * * \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes() */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& value) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& val) { - return derived() = Constant(rows(), cols(), value); + return derived() = Constant(rows(), cols(), val); } -/** Resizes to the given \a size, and sets all coefficients in this expression to the given \a value. +/** Resizes to the given \a size, and sets all coefficients in this expression to the given value \a val. * * \only_for_vectors * @@ -351,18 +359,18 @@ EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& value * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) */ template -EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setConstant(Index size, const Scalar& value) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index size, const Scalar& val) { resize(size); - return setConstant(value); + return setConstant(val); } -/** Resizes to the given size, and sets all coefficients in this expression to the given \a value. +/** Resizes to the given size, and sets all coefficients in this expression to the given value \a val. * * \param rows the new number of rows * \param cols the new number of columns - * \param value the value to which all coefficients are set + * \param val the value to which all coefficients are set * * Example: \include Matrix_setConstant_int_int.cpp * Output: \verbinclude Matrix_setConstant_int_int.out @@ -370,30 +378,81 @@ PlainObjectBase::setConstant(Index size, const Scalar& value) * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) */ template -EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setConstant(Index rows, Index cols, const Scalar& value) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index rows, Index cols, const Scalar& val) { resize(rows, cols); - return setConstant(value); + return setConstant(val); +} + +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to the given value \a val. For the parameter + * of type NoChange_t, just pass the special value \c NoChange. + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(NoChange_t, Index cols, const Scalar& val) +{ + return setConstant(rows(), cols, val); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to the given value \a val. For the parameter + * of type NoChange_t, just pass the special value \c NoChange. + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index rows, NoChange_t, const Scalar& val) +{ + return setConstant(rows, cols(), val); } + /** - * \brief Sets a linearly space vector. + * \brief Sets a linearly spaced vector. * * The function generates 'size' equally spaced values in the closed interval [low,high]. + * When size is set to 1, a vector of length 1 containing 'high' is returned. * * \only_for_vectors * * Example: \include DenseBase_setLinSpaced.cpp * Output: \verbinclude DenseBase_setLinSpaced.out * - * \sa CwiseNullaryOp + * For integer scalar types, do not miss the explanations on the definition + * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink. + * + * \sa LinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index size, const Scalar& low, const Scalar& high) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return derived() = Derived::NullaryExpr(size, internal::linspaced_op(low,high,size)); + return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op(low,high,newSize)); +} + +/** + * \brief Sets a linearly spaced vector. + * + * The function fills \c *this with equally spaced values in the closed interval [low,high]. + * When size is set to 1, a vector of length 1 containing 'high' is returned. + * + * \only_for_vectors + * + * For integer scalar types, do not miss the explanations on the definition + * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink. + * + * \sa LinSpaced(Index,const Scalar&,const Scalar&), setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return setLinSpaced(size(), low, high); } // zero: @@ -413,7 +472,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index size, const * \sa Zero(), Zero(Index) */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Zero(Index rows, Index cols) { return Constant(rows, cols, Scalar(0)); @@ -436,7 +495,7 @@ DenseBase::Zero(Index rows, Index cols) * \sa Zero(), Zero(Index,Index) */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Zero(Index size) { return Constant(size, Scalar(0)); @@ -453,7 +512,7 @@ DenseBase::Zero(Index size) * \sa Zero(Index), Zero(Index,Index) */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Zero() { return Constant(Scalar(0)); @@ -468,11 +527,12 @@ DenseBase::Zero() * \sa class CwiseNullaryOp, Zero() */ template -bool DenseBase::isZero(RealScalar prec) const +EIGEN_DEVICE_FUNC bool DenseBase::isZero(const RealScalar& prec) const { + typename internal::nested_eval::type self(derived()); for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) - if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast(1), prec)) + if(!internal::isMuchSmallerThan(self.coeff(i, j), static_cast(1), prec)) return false; return true; } @@ -485,7 +545,7 @@ bool DenseBase::isZero(RealScalar prec) const * \sa class CwiseNullaryOp, Zero() */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setZero() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setZero() { return setConstant(Scalar(0)); } @@ -500,10 +560,10 @@ EIGEN_STRONG_INLINE Derived& DenseBase::setZero() * \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero() */ template -EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setZero(Index size) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index newSize) { - resize(size); + resize(newSize); return setConstant(Scalar(0)); } @@ -518,13 +578,39 @@ PlainObjectBase::setZero(Index size) * \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero() */ template -EIGEN_STRONG_INLINE Derived& +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase::setZero(Index rows, Index cols) { resize(rows, cols); return setConstant(Scalar(0)); } +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to zero. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(Index, NoChange_t), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(NoChange_t, Index cols) +{ + return setZero(rows(), cols); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to zero. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(NoChange_t, Index), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index rows, NoChange_t) +{ + return setZero(rows, cols()); +} + // ones: /** \returns an expression of a matrix where all coefficients equal one. @@ -542,7 +628,7 @@ PlainObjectBase::setZero(Index rows, Index cols) * \sa Ones(), Ones(Index), isOnes(), class Ones */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Ones(Index rows, Index cols) { return Constant(rows, cols, Scalar(1)); @@ -550,7 +636,7 @@ DenseBase::Ones(Index rows, Index cols) /** \returns an expression of a vector where all coefficients equal one. * - * The parameter \a size is the size of the returned vector. + * The parameter \a newSize is the size of the returned vector. * Must be compatible with this MatrixBase type. * * \only_for_vectors @@ -565,10 +651,10 @@ DenseBase::Ones(Index rows, Index cols) * \sa Ones(), Ones(Index,Index), isOnes(), class Ones */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType -DenseBase::Ones(Index size) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones(Index newSize) { - return Constant(size, Scalar(1)); + return Constant(newSize, Scalar(1)); } /** \returns an expression of a fixed-size matrix or vector where all coefficients equal one. @@ -582,7 +668,7 @@ DenseBase::Ones(Index size) * \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Ones() { return Constant(Scalar(1)); @@ -597,8 +683,8 @@ DenseBase::Ones() * \sa class CwiseNullaryOp, Ones() */ template -bool DenseBase::isOnes -(RealScalar prec) const +EIGEN_DEVICE_FUNC bool DenseBase::isOnes +(const RealScalar& prec) const { return isApproxToConstant(Scalar(1), prec); } @@ -611,12 +697,12 @@ bool DenseBase::isOnes * \sa class CwiseNullaryOp, Ones() */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setOnes() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setOnes() { return setConstant(Scalar(1)); } -/** Resizes to the given \a size, and sets all coefficients in this expression to one. +/** Resizes to the given \a newSize, and sets all coefficients in this expression to one. * * \only_for_vectors * @@ -626,10 +712,10 @@ EIGEN_STRONG_INLINE Derived& DenseBase::setOnes() * \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones() */ template -EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setOnes(Index size) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index newSize) { - resize(size); + resize(newSize); return setConstant(Scalar(1)); } @@ -644,13 +730,39 @@ PlainObjectBase::setOnes(Index size) * \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones() */ template -EIGEN_STRONG_INLINE Derived& +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase::setOnes(Index rows, Index cols) { resize(rows, cols); return setConstant(Scalar(1)); } +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to one. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(NoChange_t, Index), class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index rows, NoChange_t) +{ + return setOnes(rows, cols()); +} + +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to one. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(Index, NoChange_t) class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(NoChange_t, Index cols) +{ + return setOnes(rows(), cols); +} + // Identity: /** \returns an expression of the identity matrix (not necessarily square). @@ -668,7 +780,7 @@ PlainObjectBase::setOnes(Index rows, Index cols) * \sa Identity(), setIdentity(), isIdentity() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType MatrixBase::Identity(Index rows, Index cols) { return DenseBase::NullaryExpr(rows, cols, internal::scalar_identity_op()); @@ -685,7 +797,7 @@ MatrixBase::Identity(Index rows, Index cols) * \sa Identity(Index,Index), setIdentity(), isIdentity() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType MatrixBase::Identity() { EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) @@ -703,20 +815,21 @@ MatrixBase::Identity() */ template bool MatrixBase::isIdentity -(RealScalar prec) const +(const RealScalar& prec) const { + typename internal::nested_eval::type self(derived()); for(Index j = 0; j < cols(); ++j) { for(Index i = 0; i < rows(); ++i) { if(i == j) { - if(!internal::isApprox(this->coeff(i, j), static_cast(1), prec)) + if(!internal::isApprox(self.coeff(i, j), static_cast(1), prec)) return false; } else { - if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast(1), prec)) + if(!internal::isMuchSmallerThan(self.coeff(i, j), static_cast(1), prec)) return false; } } @@ -729,6 +842,7 @@ namespace internal { template=16)> struct setIdentity_impl { + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Derived& run(Derived& m) { return m = Derived::Identity(m.rows(), m.cols()); @@ -738,11 +852,11 @@ struct setIdentity_impl template struct setIdentity_impl { - typedef typename Derived::Index Index; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Derived& run(Derived& m) { m.setZero(); - const Index size = (std::min)(m.rows(), m.cols()); + const Index size = numext::mini(m.rows(), m.cols()); for(Index i = 0; i < size; ++i) m.coeffRef(i,i) = typename Derived::Scalar(1); return m; } @@ -758,7 +872,7 @@ struct setIdentity_impl * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity() */ template -EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity() { return internal::setIdentity_impl::run(derived()); } @@ -774,7 +888,7 @@ EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity() * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity() */ template -EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index rows, Index cols) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index rows, Index cols) { derived().resize(rows, cols); return setIdentity(); @@ -787,10 +901,10 @@ EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index rows, Index * \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index size, Index i) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index newSize, Index i) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return BasisReturnType(SquareMatrixType::Identity(size,size), i); + return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i); } /** \returns an expression of the i-th unit (basis) vector. @@ -802,7 +916,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBa * \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index i) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index i) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return BasisReturnType(SquareMatrixType::Identity(),i); @@ -815,7 +929,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBa * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitX() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitX() { return Derived::Unit(0); } /** \returns an expression of the Y axis unit vector (0,1{,0}^*) @@ -825,7 +939,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBa * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitY() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitY() { return Derived::Unit(1); } /** \returns an expression of the Z axis unit vector (0,0,1{,0}^*) @@ -835,7 +949,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBa * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitZ() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitZ() { return Derived::Unit(2); } /** \returns an expression of the W axis unit vector (0,0,0,1) @@ -845,7 +959,45 @@ EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBa * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitW() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitW() { return Derived::Unit(3); } +/** \brief Set the coefficients of \c *this to the i-th unit (basis) vector + * + * \param i index of the unique coefficient to be set to 1 + * + * \only_for_vectors + * + * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Unit(Index,Index) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setUnit(Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); + eigen_assert(i +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setUnit(Index newSize, Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); + eigen_assert(i +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2016 Eugene Brevdo +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_TERNARY_OP_H +#define EIGEN_CWISE_TERNARY_OP_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { +template +struct traits > { + // we must not inherit from traits since it has + // the potential to cause problems with MSVC + typedef remove_all_t Ancestor; + typedef typename traits::XprKind XprKind; + enum { + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime + }; + + // even though we require Arg1, Arg2, and Arg3 to have the same scalar type + // (see CwiseTernaryOp constructor), + // we still want to handle the case when the result type is different. + typedef typename result_of::type Scalar; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::StorageIndex StorageIndex; + + typedef typename Arg1::Nested Arg1Nested; + typedef typename Arg2::Nested Arg2Nested; + typedef typename Arg3::Nested Arg3Nested; + typedef std::remove_reference_t Arg1Nested_; + typedef std::remove_reference_t Arg2Nested_; + typedef std::remove_reference_t Arg3Nested_; + enum { Flags = Arg1Nested_::Flags & RowMajorBit }; +}; +} // end namespace internal + +template +class CwiseTernaryOpImpl; + +/** \class CwiseTernaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise ternary operator is + * applied to two expressions + * + * \tparam TernaryOp template functor implementing the operator + * \tparam Arg1Type the type of the first argument + * \tparam Arg2Type the type of the second argument + * \tparam Arg3Type the type of the third argument + * + * This class represents an expression where a coefficient-wise ternary + * operator is applied to three expressions. + * It is the return type of ternary operators, by which we mean only those + * ternary operators where + * all three arguments are Eigen expressions. + * For example, the return type of betainc(matrix1, matrix2, matrix3) is a + * CwiseTernaryOp. + * + * Most of the time, this is the only way that it is used, so you typically + * don't have to name + * CwiseTernaryOp types explicitly. + * + * \sa MatrixBase::ternaryExpr(const MatrixBase &, const + * MatrixBase &, const CustomTernaryOp &) const, class CwiseBinaryOp, + * class CwiseUnaryOp, class CwiseNullaryOp + */ +template +class CwiseTernaryOp : public CwiseTernaryOpImpl< + TernaryOp, Arg1Type, Arg2Type, Arg3Type, + typename internal::traits::StorageKind>, + internal::no_assignment_operator +{ + public: + typedef internal::remove_all_t Arg1; + typedef internal::remove_all_t Arg2; + typedef internal::remove_all_t Arg3; + + // require the sizes to match + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg2) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg3) + + // The index types should match + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + + typedef typename CwiseTernaryOpImpl< + TernaryOp, Arg1Type, Arg2Type, Arg3Type, + typename internal::traits::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseTernaryOp) + + typedef typename internal::ref_selector::type Arg1Nested; + typedef typename internal::ref_selector::type Arg2Nested; + typedef typename internal::ref_selector::type Arg3Nested; + typedef std::remove_reference_t Arg1Nested_; + typedef std::remove_reference_t Arg2Nested_; + typedef std::remove_reference_t Arg3Nested_; + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CwiseTernaryOp(const Arg1& a1, const Arg2& a2, + const Arg3& a3, + const TernaryOp& func = TernaryOp()) + : m_arg1(a1), m_arg2(a2), m_arg3(a3), m_functor(func) { + eigen_assert(a1.rows() == a2.rows() && a1.cols() == a2.cols() && + a1.rows() == a3.rows() && a1.cols() == a3.cols()); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index rows() const { + // return the fixed size type if available to enable compile time + // optimizations + if (internal::traits>:: + RowsAtCompileTime == Dynamic && + internal::traits>:: + RowsAtCompileTime == Dynamic) + return m_arg3.rows(); + else if (internal::traits>:: + RowsAtCompileTime == Dynamic && + internal::traits>:: + RowsAtCompileTime == Dynamic) + return m_arg2.rows(); + else + return m_arg1.rows(); + } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index cols() const { + // return the fixed size type if available to enable compile time + // optimizations + if (internal::traits>:: + ColsAtCompileTime == Dynamic && + internal::traits>:: + ColsAtCompileTime == Dynamic) + return m_arg3.cols(); + else if (internal::traits>:: + ColsAtCompileTime == Dynamic && + internal::traits>:: + ColsAtCompileTime == Dynamic) + return m_arg2.cols(); + else + return m_arg1.cols(); + } + + /** \returns the first argument nested expression */ + EIGEN_DEVICE_FUNC + const Arg1Nested_& arg1() const { return m_arg1; } + /** \returns the first argument nested expression */ + EIGEN_DEVICE_FUNC + const Arg2Nested_& arg2() const { return m_arg2; } + /** \returns the third argument nested expression */ + EIGEN_DEVICE_FUNC + const Arg3Nested_& arg3() const { return m_arg3; } + /** \returns the functor representing the ternary operation */ + EIGEN_DEVICE_FUNC + const TernaryOp& functor() const { return m_functor; } + + protected: + Arg1Nested m_arg1; + Arg2Nested m_arg2; + Arg3Nested m_arg3; + const TernaryOp m_functor; +}; + +// Generic API dispatcher +template +class CwiseTernaryOpImpl + : public internal::generic_xpr_base< + CwiseTernaryOp >::type { + public: + typedef typename internal::generic_xpr_base< + CwiseTernaryOp >::type Base; +}; + +} // end namespace Eigen + +#endif // EIGEN_CWISE_TERNARY_OP_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseUnaryOp.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseUnaryOp.h index 958571d..ff7d0b9 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseUnaryOp.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseUnaryOp.h @@ -1,50 +1,19 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008-2010 Gael Guennebaud +// Copyright (C) 2008-2014 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_CWISE_UNARY_OP_H #define EIGEN_CWISE_UNARY_OP_H -/** \class CwiseUnaryOp - * \ingroup Core_Module - * - * \brief Generic expression where a coefficient-wise unary operator is applied to an expression - * - * \param UnaryOp template functor implementing the operator - * \param XprType the type of the expression to which we are applying the unary operator - * - * This class represents an expression where a unary operator is applied to an expression. - * It is the return type of all operations taking exactly 1 input expression, regardless of the - * presence of other inputs such as scalars. For example, the operator* in the expression 3*matrix - * is considered unary, because only the right-hand side is an expression, and its - * return type is a specialization of CwiseUnaryOp. - * - * Most of the time, this is the only way that it is used, so you typically don't have to name - * CwiseUnaryOp types explicitly. - * - * \sa MatrixBase::unaryExpr(const CustomUnaryOp &) const, class CwiseBinaryOp, class CwiseNullaryOp - */ +#include "./InternalHeaderCheck.h" + +namespace Eigen { namespace internal { template @@ -52,15 +21,12 @@ struct traits > : traits { typedef typename result_of< - UnaryOp(typename XprType::Scalar) + UnaryOp(const typename XprType::Scalar&) >::type Scalar; typedef typename XprType::Nested XprTypeNested; - typedef typename remove_reference::type _XprTypeNested; + typedef std::remove_reference_t XprTypeNested_; enum { - Flags = _XprTypeNested::Flags & ( - HereditaryBits | LinearAccessBit | AlignedBit - | (functor_traits::PacketAccess ? PacketAccessBit : 0)), - CoeffReadCost = _XprTypeNested::CoeffReadCost + functor_traits::Cost + Flags = XprTypeNested_::Flags & RowMajorBit }; }; } @@ -68,70 +34,72 @@ struct traits > template class CwiseUnaryOpImpl; +/** \class CwiseUnaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise unary operator is applied to an expression + * + * \tparam UnaryOp template functor implementing the operator + * \tparam XprType the type of the expression to which we are applying the unary operator + * + * This class represents an expression where a unary operator is applied to an expression. + * It is the return type of all operations taking exactly 1 input expression, regardless of the + * presence of other inputs such as scalars. For example, the operator* in the expression 3*matrix + * is considered unary, because only the right-hand side is an expression, and its + * return type is a specialization of CwiseUnaryOp. + * + * Most of the time, this is the only way that it is used, so you typically don't have to name + * CwiseUnaryOp types explicitly. + * + * \sa MatrixBase::unaryExpr(const CustomUnaryOp &) const, class CwiseBinaryOp, class CwiseNullaryOp + */ template -class CwiseUnaryOp : internal::no_assignment_operator, - public CwiseUnaryOpImpl::StorageKind> +class CwiseUnaryOp : public CwiseUnaryOpImpl::StorageKind>, internal::no_assignment_operator { public: typedef typename CwiseUnaryOpImpl::StorageKind>::Base Base; EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp) + typedef typename internal::ref_selector::type XprTypeNested; + typedef internal::remove_all_t NestedExpression; - inline CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp()) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp()) : m_xpr(xpr), m_functor(func) {} - EIGEN_STRONG_INLINE Index rows() const { return m_xpr.rows(); } - EIGEN_STRONG_INLINE Index cols() const { return m_xpr.cols(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_xpr.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_xpr.cols(); } /** \returns the functor representing the unary operation */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp& functor() const { return m_functor; } /** \returns the nested expression */ - const typename internal::remove_all::type& + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const internal::remove_all_t& nestedExpression() const { return m_xpr; } /** \returns the nested expression */ - typename internal::remove_all::type& - nestedExpression() { return m_xpr.const_cast_derived(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + internal::remove_all_t& + nestedExpression() { return m_xpr; } protected: - const typename XprType::Nested m_xpr; + XprTypeNested m_xpr; const UnaryOp m_functor; }; -// This is the generic implementation for dense storage. -// It can be used for any expression types implementing the dense concept. -template -class CwiseUnaryOpImpl - : public internal::dense_xpr_base >::type +// Generic API dispatcher +template +class CwiseUnaryOpImpl + : public internal::generic_xpr_base >::type { - public: - - typedef CwiseUnaryOp Derived; - typedef typename internal::dense_xpr_base >::type Base; - EIGEN_DENSE_PUBLIC_INTERFACE(Derived) - - EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const - { - return derived().functor()(derived().nestedExpression().coeff(row, col)); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const - { - return derived().functor().packetOp(derived().nestedExpression().template packet(row, col)); - } - - EIGEN_STRONG_INLINE const Scalar coeff(Index index) const - { - return derived().functor()(derived().nestedExpression().coeff(index)); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index index) const - { - return derived().functor().packetOp(derived().nestedExpression().template packet(index)); - } +public: + typedef typename internal::generic_xpr_base >::type Base; }; +} // end namespace Eigen + #endif // EIGEN_CWISE_UNARY_OP_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseUnaryView.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseUnaryView.h index d24ef03..b4539a6 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseUnaryView.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/CwiseUnaryView.h @@ -3,146 +3,141 @@ // // Copyright (C) 2009-2010 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_CWISE_UNARY_VIEW_H #define EIGEN_CWISE_UNARY_VIEW_H -/** \class CwiseUnaryView - * \ingroup Core_Module - * - * \brief Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector - * - * \param ViewOp template functor implementing the view - * \param MatrixType the type of the matrix we are applying the unary operator - * - * This class represents a lvalue expression of a generic unary view operator of a matrix or a vector. - * It is the return type of real() and imag(), and most of the time this is the only way it is used. - * - * \sa MatrixBase::unaryViewExpr(const CustomUnaryOp &) const, class CwiseUnaryOp - */ +#include "./InternalHeaderCheck.h" + +namespace Eigen { namespace internal { -template -struct traits > +template +struct traits > : traits { typedef typename result_of< - ViewOp(typename traits::Scalar) + ViewOp(const typename traits::Scalar&) >::type Scalar; typedef typename MatrixType::Nested MatrixTypeNested; - typedef typename remove_all::type _MatrixTypeNested; + typedef remove_all_t MatrixTypeNested_; enum { - Flags = (traits<_MatrixTypeNested>::Flags & (HereditaryBits | LvalueBit | LinearAccessBit | DirectAccessBit)), - CoeffReadCost = traits<_MatrixTypeNested>::CoeffReadCost + functor_traits::Cost, + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + Flags = traits::Flags & (RowMajorBit | FlagsLvalueBit | DirectAccessBit), // FIXME DirectAccessBit should not be handled by expressions MatrixTypeInnerStride = inner_stride_at_compile_time::ret, // need to cast the sizeof's from size_t to int explicitly, otherwise: // "error: no integral type can represent all of the enumerator values - InnerStrideAtCompileTime = MatrixTypeInnerStride == Dynamic - ? int(Dynamic) - : int(MatrixTypeInnerStride) - * int(sizeof(typename traits::Scalar) / sizeof(Scalar)), - OuterStrideAtCompileTime = outer_stride_at_compile_time::ret + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 + ? (MatrixTypeInnerStride == Dynamic + ? int(Dynamic) + : int(MatrixTypeInnerStride) * int(sizeof(typename traits::Scalar) / sizeof(Scalar))) + : int(StrideType::InnerStrideAtCompileTime), + + OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 + ? (outer_stride_at_compile_time::ret == Dynamic + ? int(Dynamic) + : outer_stride_at_compile_time::ret * int(sizeof(typename traits::Scalar) / sizeof(Scalar))) + : int(StrideType::OuterStrideAtCompileTime) }; }; } -template +template class CwiseUnaryViewImpl; -template -class CwiseUnaryView : internal::no_assignment_operator, - public CwiseUnaryViewImpl::StorageKind> +/** \class CwiseUnaryView + * \ingroup Core_Module + * + * \brief Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector + * + * \tparam ViewOp template functor implementing the view + * \tparam MatrixType the type of the matrix we are applying the unary operator + * + * This class represents a lvalue expression of a generic unary view operator of a matrix or a vector. + * It is the return type of real() and imag(), and most of the time this is the only way it is used. + * + * \sa MatrixBase::unaryViewExpr(const CustomUnaryOp &) const, class CwiseUnaryOp + */ +template +class CwiseUnaryView : public CwiseUnaryViewImpl::StorageKind> { public: - typedef typename CwiseUnaryViewImpl::StorageKind>::Base Base; + typedef typename CwiseUnaryViewImpl::StorageKind>::Base Base; EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryView) + typedef typename internal::ref_selector::non_const_type MatrixTypeNested; + typedef internal::remove_all_t NestedExpression; - inline CwiseUnaryView(const MatrixType& mat, const ViewOp& func = ViewOp()) + explicit EIGEN_DEVICE_FUNC inline CwiseUnaryView(MatrixType& mat, const ViewOp& func = ViewOp()) : m_matrix(mat), m_functor(func) {} EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryView) - EIGEN_STRONG_INLINE Index rows() const { return m_matrix.rows(); } - EIGEN_STRONG_INLINE Index cols() const { return m_matrix.cols(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } /** \returns the functor representing unary operation */ - const ViewOp& functor() const { return m_functor; } + EIGEN_DEVICE_FUNC const ViewOp& functor() const { return m_functor; } /** \returns the nested expression */ - const typename internal::remove_all::type& + EIGEN_DEVICE_FUNC const internal::remove_all_t& nestedExpression() const { return m_matrix; } /** \returns the nested expression */ - typename internal::remove_all::type& - nestedExpression() { return m_matrix.const_cast_derived(); } + EIGEN_DEVICE_FUNC std::remove_reference_t& + nestedExpression() { return m_matrix; } protected: - // FIXME changed from MatrixType::Nested because of a weird compilation error with sun CC - const typename internal::nested::type m_matrix; + MatrixTypeNested m_matrix; ViewOp m_functor; }; -template -class CwiseUnaryViewImpl - : public internal::dense_xpr_base< CwiseUnaryView >::type +// Generic API dispatcher +template +class CwiseUnaryViewImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + +template +class CwiseUnaryViewImpl + : public internal::dense_xpr_base< CwiseUnaryView >::type { public: - typedef CwiseUnaryView Derived; - typedef typename internal::dense_xpr_base< CwiseUnaryView >::type Base; + typedef CwiseUnaryView Derived; + typedef typename internal::dense_xpr_base< CwiseUnaryView >::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryViewImpl) - inline Index innerStride() const - { - return derived().nestedExpression().innerStride() * sizeof(typename internal::traits::Scalar) / sizeof(Scalar); - } + EIGEN_DEVICE_FUNC inline Scalar* data() { return &(this->coeffRef(0)); } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return &(this->coeff(0)); } - inline Index outerStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const { - return derived().nestedExpression().outerStride(); + return StrideType::InnerStrideAtCompileTime != 0 + ? int(StrideType::InnerStrideAtCompileTime) + : derived().nestedExpression().innerStride() * sizeof(typename internal::traits::Scalar) / sizeof(Scalar); } - EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const { - return derived().functor()(derived().nestedExpression().coeff(row, col)); - } - - EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const - { - return derived().functor()(derived().nestedExpression().coeff(index)); - } - - EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) - { - return derived().functor()(const_cast_derived().nestedExpression().coeffRef(row, col)); - } - - EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) - { - return derived().functor()(const_cast_derived().nestedExpression().coeffRef(index)); + return StrideType::OuterStrideAtCompileTime != 0 + ? int(StrideType::OuterStrideAtCompileTime) + : derived().nestedExpression().outerStride() * sizeof(typename internal::traits::Scalar) / sizeof(Scalar); } + protected: + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(CwiseUnaryViewImpl) }; - +} // end namespace Eigen #endif // EIGEN_CWISE_UNARY_VIEW_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseBase.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseBase.h index 920904f..6e17779 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseBase.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseBase.h @@ -4,28 +4,20 @@ // Copyright (C) 2007-2010 Benoit Jacob // Copyright (C) 2008-2010 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_DENSEBASE_H #define EIGEN_DENSEBASE_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +// The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type. +EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE) + /** \class DenseBase * \ingroup Core_Module * @@ -37,37 +29,45 @@ * \tparam Derived is the derived type, e.g., a matrix type or an expression. * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_DENSEBASE_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_DENSEBASE_PLUGIN. * - * \sa \ref TopicClassHierarchy + * \sa \blank \ref TopicClassHierarchy */ template class DenseBase #ifndef EIGEN_PARSED_BY_DOXYGEN - : public internal::special_scalar_op_base::Scalar, - typename NumTraits::Scalar>::Real> + : public DenseCoeffsBase::value> #else - : public DenseCoeffsBase + : public DenseCoeffsBase #endif // not EIGEN_PARSED_BY_DOXYGEN { public: - using internal::special_scalar_op_base::Scalar, - typename NumTraits::Scalar>::Real>::operator*; - class InnerIterator; + /** Inner iterator type to iterate over the coefficients of a row or column. + * \sa class InnerIterator + */ + typedef Eigen::InnerIterator InnerIterator; typedef typename internal::traits::StorageKind StorageKind; - /** \brief The type of indices - * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. - * \sa \ref TopicPreprocessorDirectives. - */ - typedef typename internal::traits::Index Index; + /** + * \brief The type used to store indices + * \details This typedef is relevant for types that store multiple indices such as + * PermutationMatrix or Transpositions, otherwise it defaults to Eigen::Index + * \sa \blank \ref TopicPreprocessorDirectives, Eigen::Index, SparseMatrixBase. + */ + typedef typename internal::traits::StorageIndex StorageIndex; + /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex, etc. */ typedef typename internal::traits::Scalar Scalar; - typedef typename internal::packet_traits::type PacketScalar; + + /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex, etc. + * + * It is an alias for the Scalar type */ + typedef Scalar value_type; + typedef typename NumTraits::Real RealScalar; + typedef DenseCoeffsBase::value> Base; - typedef DenseCoeffsBase Base; using Base::derived; using Base::const_cast_derived; using Base::rows; @@ -77,16 +77,6 @@ template class DenseBase using Base::colIndexByOuterInner; using Base::coeff; using Base::coeffByOuterInner; - using Base::packet; - using Base::packetByOuterInner; - using Base::writePacket; - using Base::writePacketByOuterInner; - using Base::coeffRef; - using Base::coeffRefByOuterInner; - using Base::copyCoeff; - using Base::copyCoeffByOuterInner; - using Base::copyPacket; - using Base::copyPacketByOuterInner; using Base::operator(); using Base::operator[]; using Base::x; @@ -115,8 +105,7 @@ template class DenseBase * \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */ - SizeAtCompileTime = (internal::size_at_compile_time::RowsAtCompileTime, - internal::traits::ColsAtCompileTime>::ret), + SizeAtCompileTime = (internal::size_of_xpr_at_compile_time::ret), /**< This is equal to the number of coefficients, i.e. the number of * rows times the number of columns, or to \a Dynamic if this is not * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */ @@ -143,8 +132,8 @@ template class DenseBase * \sa ColsAtCompileTime, MaxRowsAtCompileTime, MaxSizeAtCompileTime */ - MaxSizeAtCompileTime = (internal::size_at_compile_time::MaxRowsAtCompileTime, - internal::traits::MaxColsAtCompileTime>::ret), + MaxSizeAtCompileTime = internal::size_at_compile_time(internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime), /**< This value is equal to the maximum possible number of coefficients that this expression * might have. If this expression might have an arbitrarily high number of coefficients, * this value is set to \a Dynamic. @@ -155,13 +144,18 @@ template class DenseBase * \sa SizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime */ - IsVectorAtCompileTime = internal::traits::MaxRowsAtCompileTime == 1 - || internal::traits::MaxColsAtCompileTime == 1, + IsVectorAtCompileTime = internal::traits::RowsAtCompileTime == 1 + || internal::traits::ColsAtCompileTime == 1, /**< This is set to true if either the number of rows or the number of * columns is known at compile-time to be equal to 1. Indeed, in that case, * we are dealing with a column-vector (if there is only one column) or with * a row-vector (if there is only one row). */ + NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2, + /**< This value is equal to Tensor::NumDimensions, i.e. 0 for scalars, 1 for vectors, + * and 2 for matrices. + */ + Flags = internal::traits::Flags, /**< This stores expression \ref flags flags which may or may not be inherited by new expressions * constructed from this one. See the \ref flags "list of flags". @@ -172,30 +166,49 @@ template class DenseBase InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime) : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), - CoeffReadCost = internal::traits::CoeffReadCost, - /**< This is a rough measure of how expensive it is to read one coefficient from - * this expression. - */ - InnerStrideAtCompileTime = internal::inner_stride_at_compile_time::ret, OuterStrideAtCompileTime = internal::outer_stride_at_compile_time::ret }; - enum { ThisConstantIsPrivateInPlainObjectBase }; - - /** \returns the number of nonzero coefficients which is in practice the number - * of stored coefficients. */ - inline Index nonZeros() const { return size(); } - /** \returns true if either the number of rows or the number of columns is equal to 1. - * In other words, this function returns - * \code rows()==1 || cols()==1 \endcode - * \sa rows(), cols(), IsVectorAtCompileTime. */ + typedef typename internal::find_best_packet::type PacketScalar; + + enum { IsPlainObjectBase = 0 }; + + /** The plain matrix type corresponding to this expression. + * \sa PlainObject */ + typedef Matrix::Scalar, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime, + AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), + internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime + > PlainMatrix; + + /** The plain array type corresponding to this expression. + * \sa PlainObject */ + typedef Array::Scalar, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime, + AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), + internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime + > PlainArray; + + /** \brief The plain matrix or array type corresponding to this expression. + * + * This is not necessarily exactly the return type of eval(). In the case of plain matrices, + * the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed + * that the return type of eval() is either PlainObject or const PlainObject&. + */ + typedef std::conditional_t::XprKind,MatrixXpr >::value, + PlainMatrix, PlainArray> PlainObject; /** \returns the outer size. * * \note For a vector, this returns just 1. For a matrix (non-vector), this is the major dimension * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of columns for a * column-major matrix, and the number of rows for a row-major matrix. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerSize() const { return IsVectorAtCompileTime ? 1 @@ -205,8 +218,9 @@ template class DenseBase /** \returns the inner size. * * \note For a vector, this is just the size. For a matrix (non-vector), this is the minor dimension - * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a + * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a * column-major matrix, and the number of columns for a row-major matrix. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerSize() const { return IsVectorAtCompileTime ? this->size() @@ -217,16 +231,18 @@ template class DenseBase * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does * nothing else. */ - void resize(Index size) + EIGEN_DEVICE_FUNC + void resize(Index newSize) { - EIGEN_ONLY_USED_FOR_DEBUG(size); - eigen_assert(size == this->size() + EIGEN_ONLY_USED_FOR_DEBUG(newSize); + eigen_assert(newSize == this->size() && "DenseBase::resize() does not actually allow to resize."); } /** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does * nothing else. */ + EIGEN_DEVICE_FUNC void resize(Index rows, Index cols) { EIGEN_ONLY_USED_FOR_DEBUG(rows); @@ -236,13 +252,12 @@ template class DenseBase } #ifndef EIGEN_PARSED_BY_DOXYGEN - /** \internal Represents a matrix with all coefficients equal to one another*/ - typedef CwiseNullaryOp,Derived> ConstantReturnType; - /** \internal Represents a vector with linearly spaced coefficients that allows sequential access only. */ - typedef CwiseNullaryOp,Derived> SequentialLinSpacedReturnType; + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; + /** \internal \deprecated Represents a vector with linearly spaced coefficients that allows sequential access only. */ + EIGEN_DEPRECATED typedef CwiseNullaryOp,PlainObject> SequentialLinSpacedReturnType; /** \internal Represents a vector with linearly spaced coefficients that allows random access. */ - typedef CwiseNullaryOp,Derived> RandomAccessLinSpacedReturnType; + typedef CwiseNullaryOp,PlainObject> RandomAccessLinSpacedReturnType; /** \internal the return type of MatrixBase::eigenvalues() */ typedef Matrix::Scalar>::Real, internal::traits::ColsAtCompileTime, 1> EigenvaluesReturnType; @@ -250,138 +265,135 @@ template class DenseBase /** Copies \a other into *this. \returns a reference to *this. */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase& other); /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase& other); template + EIGEN_DEVICE_FUNC Derived& operator=(const EigenBase &other); template + EIGEN_DEVICE_FUNC Derived& operator+=(const EigenBase &other); template + EIGEN_DEVICE_FUNC Derived& operator-=(const EigenBase &other); template + EIGEN_DEVICE_FUNC Derived& operator=(const ReturnByValue& func); -#ifndef EIGEN_PARSED_BY_DOXYGEN - /** Copies \a other into *this without evaluating other. \returns a reference to *this. */ + /** \internal + * Copies \a other into *this without evaluating other. \returns a reference to *this. */ template + /** \deprecated */ + EIGEN_DEPRECATED EIGEN_DEVICE_FUNC Derived& lazyAssign(const DenseBase& other); -#endif // not EIGEN_PARSED_BY_DOXYGEN + EIGEN_DEVICE_FUNC CommaInitializer operator<< (const Scalar& s); template - const Flagged flagged() const; + /** \deprecated it now returns \c *this */ + EIGEN_DEPRECATED + const Derived& flagged() const + { return derived(); } template + EIGEN_DEVICE_FUNC CommaInitializer operator<< (const DenseBase& other); - Eigen::Transpose transpose(); - typedef const Transpose ConstTransposeReturnType; - ConstTransposeReturnType transpose() const; + typedef Transpose TransposeReturnType; + EIGEN_DEVICE_FUNC + TransposeReturnType transpose(); + typedef Transpose ConstTransposeReturnType; + EIGEN_DEVICE_FUNC + const ConstTransposeReturnType transpose() const; + EIGEN_DEVICE_FUNC void transposeInPlace(); -#ifndef EIGEN_NO_DEBUG - protected: - template - void checkTransposeAliasing(const OtherDerived& other) const; - public: -#endif - - typedef VectorBlock SegmentReturnType; - typedef const VectorBlock ConstSegmentReturnType; - template struct FixedSegmentReturnType { typedef VectorBlock Type; }; - template struct ConstFixedSegmentReturnType { typedef const VectorBlock Type; }; - - // Note: The "DenseBase::" prefixes are added to help MSVC9 to match these declarations with the later implementations. - SegmentReturnType segment(Index start, Index size); - typename DenseBase::ConstSegmentReturnType segment(Index start, Index size) const; - - SegmentReturnType head(Index size); - typename DenseBase::ConstSegmentReturnType head(Index size) const; - - SegmentReturnType tail(Index size); - typename DenseBase::ConstSegmentReturnType tail(Index size) const; - template typename FixedSegmentReturnType::Type head(); - template typename ConstFixedSegmentReturnType::Type head() const; - - template typename FixedSegmentReturnType::Type tail(); - template typename ConstFixedSegmentReturnType::Type tail() const; - - template typename FixedSegmentReturnType::Type segment(Index start); - template typename ConstFixedSegmentReturnType::Type segment(Index start) const; - - static const ConstantReturnType + EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(Index rows, Index cols, const Scalar& value); - static const ConstantReturnType + EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(Index size, const Scalar& value); - static const ConstantReturnType + EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(const Scalar& value); - static const SequentialLinSpacedReturnType + EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high); - static const RandomAccessLinSpacedReturnType - LinSpaced(Index size, const Scalar& low, const Scalar& high); - static const SequentialLinSpacedReturnType + EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, const Scalar& low, const Scalar& high); - static const RandomAccessLinSpacedReturnType + + EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType + LinSpaced(Index size, const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(const Scalar& low, const Scalar& high); - template - static const CwiseNullaryOp + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func); - template - static const CwiseNullaryOp + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp NullaryExpr(Index size, const CustomNullaryOp& func); - template - static const CwiseNullaryOp + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp NullaryExpr(const CustomNullaryOp& func); - static const ConstantReturnType Zero(Index rows, Index cols); - static const ConstantReturnType Zero(Index size); - static const ConstantReturnType Zero(); - static const ConstantReturnType Ones(Index rows, Index cols); - static const ConstantReturnType Ones(Index size); - static const ConstantReturnType Ones(); - - void fill(const Scalar& value); - Derived& setConstant(const Scalar& value); - Derived& setLinSpaced(Index size, const Scalar& low, const Scalar& high); - Derived& setLinSpaced(const Scalar& low, const Scalar& high); - Derived& setZero(); - Derived& setOnes(); - Derived& setRandom(); - - template + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index size); + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index size); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(); + + EIGEN_DEVICE_FUNC void fill(const Scalar& value); + EIGEN_DEVICE_FUNC Derived& setConstant(const Scalar& value); + EIGEN_DEVICE_FUNC Derived& setLinSpaced(Index size, const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC Derived& setLinSpaced(const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC Derived& setZero(); + EIGEN_DEVICE_FUNC Derived& setOnes(); + EIGEN_DEVICE_FUNC Derived& setRandom(); + + template EIGEN_DEVICE_FUNC bool isApprox(const DenseBase& other, - RealScalar prec = NumTraits::dummy_precision()) const; + const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const RealScalar& other, - RealScalar prec = NumTraits::dummy_precision()) const; - template + const RealScalar& prec = NumTraits::dummy_precision()) const; + template EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const DenseBase& other, - RealScalar prec = NumTraits::dummy_precision()) const; + const RealScalar& prec = NumTraits::dummy_precision()) const; - bool isApproxToConstant(const Scalar& value, RealScalar prec = NumTraits::dummy_precision()) const; - bool isConstant(const Scalar& value, RealScalar prec = NumTraits::dummy_precision()) const; - bool isZero(RealScalar prec = NumTraits::dummy_precision()) const; - bool isOnes(RealScalar prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isApproxToConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isZero(const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isOnes(const RealScalar& prec = NumTraits::dummy_precision()) const; - inline Derived& operator*=(const Scalar& other); - inline Derived& operator/=(const Scalar& other); + EIGEN_DEVICE_FUNC inline bool hasNaN() const; + EIGEN_DEVICE_FUNC inline bool allFinite() const; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator*=(const Scalar& other); + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator/=(const Scalar& other); + + typedef internal::add_const_on_value_type_t::type> EvalReturnType; /** \returns the matrix or vector obtained by evaluating this expression. * * Notice that in the case of a plain matrix or vector (not an expression) this function just returns * a const reference, in order to avoid a useless copy. + * + * \warning Be careful with eval() and the auto C++ keyword, as detailed in this \link TopicPitfalls_auto_keyword page \endlink. */ - EIGEN_STRONG_INLINE const typename internal::eval::type eval() const + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE EvalReturnType eval() const { // Even though MSVC does not honor strong inlining when the return type // is a dynamic matrix, we desperately need strong inlining for fixed @@ -393,56 +405,113 @@ template class DenseBase * */ template - void swap(const DenseBase& other, - int = OtherDerived::ThisConstantIsPrivateInPlainObjectBase) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void swap(const DenseBase& other) { - SwapWrapper(derived()).lazyAssign(other.derived()); + EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + eigen_assert(rows()==other.rows() && cols()==other.cols()); + call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op()); } /** swaps *this with the matrix or array \a other. * */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void swap(PlainObjectBase& other) { - SwapWrapper(derived()).lazyAssign(other.derived()); + eigen_assert(rows()==other.rows() && cols()==other.cols()); + call_assignment(derived(), other.derived(), internal::swap_assign_op()); } + EIGEN_DEVICE_FUNC inline const NestByValue nestByValue() const; + EIGEN_DEVICE_FUNC inline const ForceAlignedAccess forceAlignedAccess() const; + EIGEN_DEVICE_FUNC inline ForceAlignedAccess forceAlignedAccess(); + template EIGEN_DEVICE_FUNC + inline const std::conditional_t,Derived&> forceAlignedAccessIf() const; + template EIGEN_DEVICE_FUNC + inline std::conditional_t,Derived&> forceAlignedAccessIf(); - inline const NestByValue nestByValue() const; - inline const ForceAlignedAccess forceAlignedAccess() const; - inline ForceAlignedAccess forceAlignedAccess(); - template inline const typename internal::conditional,Derived&>::type forceAlignedAccessIf() const; - template inline typename internal::conditional,Derived&>::type forceAlignedAccessIf(); + EIGEN_DEVICE_FUNC Scalar sum() const; + EIGEN_DEVICE_FUNC Scalar mean() const; + EIGEN_DEVICE_FUNC Scalar trace() const; - Scalar sum() const; - Scalar mean() const; - Scalar trace() const; + EIGEN_DEVICE_FUNC Scalar prod() const; - Scalar prod() const; + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar minCoeff() const; + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar maxCoeff() const; - typename internal::traits::Scalar minCoeff() const; - typename internal::traits::Scalar maxCoeff() const; - template + // By default, the fastest version with undefined NaN propagation semantics is + // used. + // TODO(rmlarsen): Replace with default template argument when we move to + // c++11 or beyond. + EIGEN_DEVICE_FUNC inline typename internal::traits::Scalar minCoeff() const { + return minCoeff(); + } + EIGEN_DEVICE_FUNC inline typename internal::traits::Scalar maxCoeff() const { + return maxCoeff(); + } + + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar minCoeff(IndexType* row, IndexType* col) const; - template + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar maxCoeff(IndexType* row, IndexType* col) const; - template + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar minCoeff(IndexType* index) const; - template + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar maxCoeff(IndexType* index) const; + // TODO(rmlarsen): Replace these methods with a default template argument. + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar minCoeff(IndexType* row, IndexType* col) const { + return minCoeff(row, col); + } + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar maxCoeff(IndexType* row, IndexType* col) const { + return maxCoeff(row, col); + } + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar minCoeff(IndexType* index) const { + return minCoeff(index); + } + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar maxCoeff(IndexType* index) const { + return maxCoeff(index); + } + template - typename internal::result_of::Scalar)>::type - redux(const BinaryOp& func) const; + EIGEN_DEVICE_FUNC + Scalar redux(const BinaryOp& func) const; template + EIGEN_DEVICE_FUNC void visit(Visitor& func) const; - inline const WithFormat format(const IOFormat& fmt) const; + /** \returns a WithFormat proxy object allowing to print a matrix the with given + * format \a fmt. + * + * See class IOFormat for some examples. + * + * \sa class IOFormat, class WithFormat + */ + inline const WithFormat format(const IOFormat& fmt) const + { + return WithFormat(derived(), fmt); + } /** \returns the unique coefficient of a 1x1 expression */ + EIGEN_DEVICE_FUNC CoeffReturnType value() const { EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) @@ -450,94 +519,166 @@ template class DenseBase return derived().coeff(0,0); } -/////////// Array module /////////// - - bool all(void) const; - bool any(void) const; - Index count() const; + EIGEN_DEVICE_FUNC bool all() const; + EIGEN_DEVICE_FUNC bool any() const; + EIGEN_DEVICE_FUNC Index count() const; typedef VectorwiseOp RowwiseReturnType; typedef const VectorwiseOp ConstRowwiseReturnType; typedef VectorwiseOp ColwiseReturnType; typedef const VectorwiseOp ConstColwiseReturnType; - ConstRowwiseReturnType rowwise() const; - RowwiseReturnType rowwise(); - ConstColwiseReturnType colwise() const; - ColwiseReturnType colwise(); + /** \returns a VectorwiseOp wrapper of *this for broadcasting and partial reductions + * + * Example: \include MatrixBase_rowwise.cpp + * Output: \verbinclude MatrixBase_rowwise.out + * + * \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting + */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC inline ConstRowwiseReturnType rowwise() const { + return ConstRowwiseReturnType(derived()); + } + EIGEN_DEVICE_FUNC RowwiseReturnType rowwise(); + + /** \returns a VectorwiseOp wrapper of *this broadcasting and partial reductions + * + * Example: \include MatrixBase_colwise.cpp + * Output: \verbinclude MatrixBase_colwise.out + * + * \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting + */ + EIGEN_DEVICE_FUNC inline ConstColwiseReturnType colwise() const { + return ConstColwiseReturnType(derived()); + } + EIGEN_DEVICE_FUNC ColwiseReturnType colwise(); - static const CwiseNullaryOp,Derived> Random(Index rows, Index cols); - static const CwiseNullaryOp,Derived> Random(Index size); - static const CwiseNullaryOp,Derived> Random(); + typedef CwiseNullaryOp,PlainObject> RandomReturnType; + static const RandomReturnType Random(Index rows, Index cols); + static const RandomReturnType Random(Index size); + static const RandomReturnType Random(); template - const Select + inline EIGEN_DEVICE_FUNC const Select select(const DenseBase& thenMatrix, const DenseBase& elseMatrix) const; template - inline const Select - select(const DenseBase& thenMatrix, typename ThenDerived::Scalar elseScalar) const; + inline EIGEN_DEVICE_FUNC const Select + select(const DenseBase& thenMatrix, const typename ThenDerived::Scalar& elseScalar) const; template - inline const Select - select(typename ElseDerived::Scalar thenScalar, const DenseBase& elseMatrix) const; + inline EIGEN_DEVICE_FUNC const Select + select(const typename ElseDerived::Scalar& thenScalar, const DenseBase& elseMatrix) const; template RealScalar lpNorm() const; template + EIGEN_DEVICE_FUNC const Replicate replicate() const; - const Replicate replicate(Index rowFacor,Index colFactor) const; + /** + * \return an expression of the replication of \c *this + * + * Example: \include MatrixBase_replicate_int_int.cpp + * Output: \verbinclude MatrixBase_replicate_int_int.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate + */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC + const Replicate replicate(Index rowFactor, Index colFactor) const + { + return Replicate(derived(), rowFactor, colFactor); + } typedef Reverse ReverseReturnType; typedef const Reverse ConstReverseReturnType; - ReverseReturnType reverse(); - ConstReverseReturnType reverse() const; - void reverseInPlace(); + EIGEN_DEVICE_FUNC ReverseReturnType reverse(); + /** This is the const version of reverse(). */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC ConstReverseReturnType reverse() const + { + return ConstReverseReturnType(derived()); + } + EIGEN_DEVICE_FUNC void reverseInPlace(); + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** STL-like RandomAccessIterator + * iterator type as returned by the begin() and end() methods. + */ + typedef random_access_iterator_type iterator; + /** This is the const version of iterator (aka read-only) */ + typedef random_access_iterator_type const_iterator; + #else + typedef std::conditional_t< (Flags&DirectAccessBit)==DirectAccessBit, + internal::pointer_based_stl_iterator, + internal::generic_randaccess_stl_iterator + > iterator_type; + + typedef std::conditional_t< (Flags&DirectAccessBit)==DirectAccessBit, + internal::pointer_based_stl_iterator, + internal::generic_randaccess_stl_iterator + > const_iterator_type; + + // Stl-style iterators are supported only for vectors. + + typedef std::conditional_t iterator; + + typedef std::conditional_t const_iterator; + #endif + + inline iterator begin(); + inline const_iterator begin() const; + inline const_iterator cbegin() const; + inline iterator end(); + inline const_iterator end() const; + inline const_iterator cend() const; #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase +#define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL +#define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND) +#define EIGEN_DOC_UNARY_ADDONS(X,Y) +# include "../plugins/CommonCwiseUnaryOps.h" # include "../plugins/BlockMethods.h" +# include "../plugins/IndexedViewMethods.h" +# include "../plugins/ReshapedMethods.h" # ifdef EIGEN_DENSEBASE_PLUGIN # include EIGEN_DENSEBASE_PLUGIN # endif #undef EIGEN_CURRENT_STORAGE_BASE_CLASS - -#ifdef EIGEN2_SUPPORT - - Block corner(CornerType type, Index cRows, Index cCols); - const Block corner(CornerType type, Index cRows, Index cCols) const; - template - Block corner(CornerType type); - template - const Block corner(CornerType type) const; - -#endif // EIGEN2_SUPPORT - +#undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL +#undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF +#undef EIGEN_DOC_UNARY_ADDONS // disable the use of evalTo for dense objects with a nice compilation error - template inline void evalTo(Dest& ) const + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& ) const { EIGEN_STATIC_ASSERT((internal::is_same::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS); } protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(DenseBase) /** Default constructor. Do nothing. */ - DenseBase() + EIGEN_DEVICE_FUNC DenseBase() { /* Just checks for self-consistency of the flags. - * Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down + * Only do it when debugging Eigen, as this borders on paranoia and could slow compilation down */ #ifdef EIGEN_INTERNAL_DEBUGGING - EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor)) - && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, int(!IsRowMajor))), + EIGEN_STATIC_ASSERT((internal::check_implication(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor)) + && internal::check_implication(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, int(!IsRowMajor))), INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION) #endif } private: - explicit DenseBase(int); - DenseBase(int,int); - template explicit DenseBase(const DenseBase&); + EIGEN_DEVICE_FUNC explicit DenseBase(int); + EIGEN_DEVICE_FUNC DenseBase(int,int); + template EIGEN_DEVICE_FUNC explicit DenseBase(const DenseBase&); }; +} // end namespace Eigen + #endif // EIGEN_DENSEBASE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseCoeffsBase.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseCoeffsBase.h index e45238f..7f0bcf4 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseCoeffsBase.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseCoeffsBase.h @@ -3,43 +3,33 @@ // // Copyright (C) 2006-2010 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_DENSECOEFFSBASE_H #define EIGEN_DENSECOEFFSBASE_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { template struct add_const_on_value_type_if_arithmetic { - typedef typename conditional::value, T, typename add_const_on_value_type::type>::type type; + typedef std::conditional_t::value, T, add_const_on_value_type_t> type; }; } /** \brief Base class providing read-only coefficient access to matrices and arrays. * \ingroup Core_Module * \tparam Derived Type of the derived class - * \tparam #ReadOnlyAccessors Constant indicating read-only access + * + * \note #ReadOnlyAccessors Constant indicating read-only access * * This class defines the \c operator() \c const function and friends, which can be used to read specific * entries of a matrix or array. - * + * * \sa DenseCoeffsBase, DenseCoeffsBase, * \ref TopicClassHierarchy */ @@ -48,7 +38,6 @@ class DenseCoeffsBase : public EigenBase { public: typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; @@ -56,13 +45,13 @@ class DenseCoeffsBase : public EigenBase // - This is the return type of the coeff() method. // - The LvalueBit means exactly that we can offer a coeffRef() method, which means exactly that we can get references // to coeffs, which means exactly that we can have coeff() return a const reference (as opposed to returning a value). - // - The is_artihmetic check is required since "const int", "const double", etc. will cause warnings on some systems + // - The is_arithmetic check is required since "const int", "const double", etc. will cause warnings on some systems // while the declaration of "const T", where T is a non arithmetic type does not. Always returning "const Scalar&" is // not possible, since the underlying expressions might not offer a valid address the reference could be referring to. - typedef typename internal::conditional::Flags&LvalueBit), - const Scalar&, - typename internal::conditional::value, Scalar, const Scalar>::type - >::type CoeffReturnType; + typedef std::conditional_t::Flags&LvalueBit), + const Scalar&, + std::conditional_t::value, Scalar, const Scalar> + > CoeffReturnType; typedef typename internal::add_const_on_value_type_if_arithmetic< typename internal::packet_traits::type @@ -74,6 +63,7 @@ class DenseCoeffsBase : public EigenBase using Base::size; using Base::derived; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) const { return int(Derived::RowsAtCompileTime) == 1 ? 0 @@ -82,6 +72,7 @@ class DenseCoeffsBase : public EigenBase : inner; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) const { return int(Derived::ColsAtCompileTime) == 1 ? 0 @@ -104,13 +95,15 @@ class DenseCoeffsBase : public EigenBase * * \sa operator()(Index,Index) const, coeffRef(Index,Index), coeff(Index) const */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const { eigen_internal_assert(row >= 0 && row < rows() - && col >= 0 && col < cols()); - return derived().coeff(row, col); + && col >= 0 && col < cols()); + return internal::evaluator(derived()).coeff(row,col); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeffByOuterInner(Index outer, Index inner) const { return coeff(rowIndexByOuterInner(outer, inner), @@ -121,11 +114,12 @@ class DenseCoeffsBase : public EigenBase * * \sa operator()(Index,Index), operator[](Index) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator()(Index row, Index col) const { eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - return derived().coeff(row, col); + return coeff(row, col); } /** Short version: don't use this function, use @@ -143,11 +137,14 @@ class DenseCoeffsBase : public EigenBase * \sa operator[](Index) const, coeffRef(Index), coeff(Index,Index) const */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const { + EIGEN_STATIC_ASSERT(internal::evaluator::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) eigen_internal_assert(index >= 0 && index < size()); - return derived().coeff(index); + return internal::evaluator(derived()).coeff(index); } @@ -159,15 +156,14 @@ class DenseCoeffsBase : public EigenBase * z() const, w() const */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator[](Index index) const { - #ifndef EIGEN2_SUPPORT EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime, THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD) - #endif eigen_assert(index >= 0 && index < size()); - return derived().coeff(index); + return coeff(index); } /** \returns the coefficient at given index. @@ -180,32 +176,49 @@ class DenseCoeffsBase : public EigenBase * z() const, w() const */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator()(Index index) const { eigen_assert(index >= 0 && index < size()); - return derived().coeff(index); + return coeff(index); } /** equivalent to operator[](0). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType x() const { return (*this)[0]; } /** equivalent to operator[](1). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType - y() const { return (*this)[1]; } + y() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS); + return (*this)[1]; + } /** equivalent to operator[](2). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType - z() const { return (*this)[2]; } + z() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS); + return (*this)[2]; + } /** equivalent to operator[](3). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType - w() const { return (*this)[3]; } + w() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS); + return (*this)[3]; + } /** \internal * \returns the packet of coefficients starting at the given row and column. It is your responsibility @@ -220,9 +233,9 @@ class DenseCoeffsBase : public EigenBase template EIGEN_STRONG_INLINE PacketReturnType packet(Index row, Index col) const { - eigen_internal_assert(row >= 0 && row < rows() - && col >= 0 && col < cols()); - return derived().template packet(row,col); + typedef typename internal::packet_traits::type DefaultPacketType; + eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); + return internal::evaluator(derived()).template packet(row,col); } @@ -247,8 +260,11 @@ class DenseCoeffsBase : public EigenBase template EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const { + EIGEN_STATIC_ASSERT(internal::evaluator::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) + typedef typename internal::packet_traits::type DefaultPacketType; eigen_internal_assert(index >= 0 && index < size()); - return derived().template packet(index); + return internal::evaluator(derived()).template packet(index); } protected: @@ -275,12 +291,13 @@ class DenseCoeffsBase : public EigenBase /** \brief Base class providing read/write coefficient access to matrices and arrays. * \ingroup Core_Module * \tparam Derived Type of the derived class - * \tparam #WriteAccessors Constant indicating read/write access + * + * \note #WriteAccessors Constant indicating read/write access * * This class defines the non-const \c operator() function and friends, which can be used to write specific * entries of a matrix or array. This class inherits DenseCoeffsBase which * defines the const variant for reading specific entries. - * + * * \sa DenseCoeffsBase, \ref TopicClassHierarchy */ template @@ -291,7 +308,6 @@ class DenseCoeffsBase : public DenseCoeffsBase Base; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; @@ -324,13 +340,15 @@ class DenseCoeffsBase : public DenseCoeffsBase= 0 && row < rows() - && col >= 0 && col < cols()); - return derived().coeffRef(row, col); + && col >= 0 && col < cols()); + return internal::evaluator(derived()).coeffRef(row,col); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRefByOuterInner(Index outer, Index inner) { @@ -343,12 +361,13 @@ class DenseCoeffsBase : public DenseCoeffsBase= 0 && row < rows() && col >= 0 && col < cols()); - return derived().coeffRef(row, col); + return coeffRef(row, col); } @@ -367,11 +386,14 @@ class DenseCoeffsBase : public DenseCoeffsBase::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) eigen_internal_assert(index >= 0 && index < size()); - return derived().coeffRef(index); + return internal::evaluator(derived()).coeffRef(index); } /** \returns a reference to the coefficient at given index. @@ -381,15 +403,14 @@ class DenseCoeffsBase : public DenseCoeffsBase= 0 && index < size()); - return derived().coeffRef(index); + return coeffRef(index); } /** \returns a reference to the coefficient at given index. @@ -401,179 +422,62 @@ class DenseCoeffsBase : public DenseCoeffsBase= 0 && index < size()); - return derived().coeffRef(index); + return coeffRef(index); } /** equivalent to operator[](0). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& x() { return (*this)[0]; } /** equivalent to operator[](1). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& - y() { return (*this)[1]; } - - /** equivalent to operator[](2). */ - - EIGEN_STRONG_INLINE Scalar& - z() { return (*this)[2]; } - - /** equivalent to operator[](3). */ - - EIGEN_STRONG_INLINE Scalar& - w() { return (*this)[3]; } - - /** \internal - * Stores the given packet of coefficients, at the given row and column of this expression. It is your responsibility - * to ensure that a packet really starts there. This method is only available on expressions having the - * PacketAccessBit. - * - * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select - * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets - * starting at an address which is a multiple of the packet size. - */ - - template - EIGEN_STRONG_INLINE void writePacket - (Index row, Index col, const typename internal::packet_traits::type& x) + y() { - eigen_internal_assert(row >= 0 && row < rows() - && col >= 0 && col < cols()); - derived().template writePacket(row,col,x); - } - - - /** \internal */ - template - EIGEN_STRONG_INLINE void writePacketByOuterInner - (Index outer, Index inner, const typename internal::packet_traits::type& x) - { - writePacket(rowIndexByOuterInner(outer, inner), - colIndexByOuterInner(outer, inner), - x); - } - - /** \internal - * Stores the given packet of coefficients, at the given index in this expression. It is your responsibility - * to ensure that a packet really starts there. This method is only available on expressions having the - * PacketAccessBit and the LinearAccessBit. - * - * The \a LoadMode parameter may have the value \a Aligned or \a Unaligned. Its effect is to select - * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets - * starting at an address which is a multiple of the packet size. - */ - template - EIGEN_STRONG_INLINE void writePacket - (Index index, const typename internal::packet_traits::type& x) - { - eigen_internal_assert(index >= 0 && index < size()); - derived().template writePacket(index,x); + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS); + return (*this)[1]; } -#ifndef EIGEN_PARSED_BY_DOXYGEN - - /** \internal Copies the coefficient at position (row,col) of other into *this. - * - * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code - * with usual assignments. - * - * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. - */ - - template - EIGEN_STRONG_INLINE void copyCoeff(Index row, Index col, const DenseBase& other) - { - eigen_internal_assert(row >= 0 && row < rows() - && col >= 0 && col < cols()); - derived().coeffRef(row, col) = other.derived().coeff(row, col); - } - - /** \internal Copies the coefficient at the given index of other into *this. - * - * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code - * with usual assignments. - * - * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. - */ - - template - EIGEN_STRONG_INLINE void copyCoeff(Index index, const DenseBase& other) - { - eigen_internal_assert(index >= 0 && index < size()); - derived().coeffRef(index) = other.derived().coeff(index); - } - - - template - EIGEN_STRONG_INLINE void copyCoeffByOuterInner(Index outer, Index inner, const DenseBase& other) - { - const Index row = rowIndexByOuterInner(outer,inner); - const Index col = colIndexByOuterInner(outer,inner); - // derived() is important here: copyCoeff() may be reimplemented in Derived! - derived().copyCoeff(row, col, other); - } - - /** \internal Copies the packet at position (row,col) of other into *this. - * - * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code - * with usual assignments. - * - * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. - */ + /** equivalent to operator[](2). */ - template - EIGEN_STRONG_INLINE void copyPacket(Index row, Index col, const DenseBase& other) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + z() { - eigen_internal_assert(row >= 0 && row < rows() - && col >= 0 && col < cols()); - derived().template writePacket(row, col, - other.derived().template packet(row, col)); + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS); + return (*this)[2]; } - /** \internal Copies the packet at the given index of other into *this. - * - * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code - * with usual assignments. - * - * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. - */ - - template - EIGEN_STRONG_INLINE void copyPacket(Index index, const DenseBase& other) - { - eigen_internal_assert(index >= 0 && index < size()); - derived().template writePacket(index, - other.derived().template packet(index)); - } + /** equivalent to operator[](3). */ - /** \internal */ - template - EIGEN_STRONG_INLINE void copyPacketByOuterInner(Index outer, Index inner, const DenseBase& other) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + w() { - const Index row = rowIndexByOuterInner(outer,inner); - const Index col = colIndexByOuterInner(outer,inner); - // derived() is important here: copyCoeff() may be reimplemented in Derived! - derived().template copyPacket< OtherDerived, StoreMode, LoadMode>(row, col, other); + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS); + return (*this)[3]; } -#endif - }; /** \brief Base class providing direct read-only coefficient access to matrices and arrays. * \ingroup Core_Module * \tparam Derived Type of the derived class - * \tparam #DirectAccessors Constant indicating direct access + * + * \note #DirectAccessors Constant indicating direct access * * This class defines functions to work with strides which can be used to access entries directly. This class * inherits DenseCoeffsBase which defines functions to access entries read-only using * \c operator() . * - * \sa \ref TopicClassHierarchy + * \sa \blank \ref TopicClassHierarchy */ template class DenseCoeffsBase : public DenseCoeffsBase @@ -581,7 +485,6 @@ class DenseCoeffsBase : public DenseCoeffsBase Base; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; @@ -594,6 +497,7 @@ class DenseCoeffsBase : public DenseCoeffsBase : public DenseCoeffsBase : public DenseCoeffsBase : public DenseCoeffsBase : public DenseCoeffsBase which defines functions to access entries read/write using * \c operator(). * - * \sa \ref TopicClassHierarchy + * \sa \blank \ref TopicClassHierarchy */ template class DenseCoeffsBase @@ -652,7 +560,6 @@ class DenseCoeffsBase public: typedef DenseCoeffsBase Base; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; @@ -665,7 +572,8 @@ class DenseCoeffsBase * * \sa outerStride(), rowStride(), colStride() */ - inline Index innerStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return derived().innerStride(); } @@ -675,13 +583,14 @@ class DenseCoeffsBase * * \sa innerStride(), rowStride(), colStride() */ - inline Index outerStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return derived().outerStride(); } // FIXME shall we remove it ? - inline Index stride() const + EIGEN_CONSTEXPR inline Index stride() const EIGEN_NOEXCEPT { return Derived::IsVectorAtCompileTime ? innerStride() : outerStride(); } @@ -690,7 +599,8 @@ class DenseCoeffsBase * * \sa innerStride(), outerStride(), colStride() */ - inline Index rowStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rowStride() const EIGEN_NOEXCEPT { return Derived::IsRowMajor ? outerStride() : innerStride(); } @@ -699,7 +609,8 @@ class DenseCoeffsBase * * \sa innerStride(), outerStride(), rowStride() */ - inline Index colStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index colStride() const EIGEN_NOEXCEPT { return Derived::IsRowMajor ? innerStride() : outerStride(); } @@ -707,33 +618,42 @@ class DenseCoeffsBase namespace internal { -template +template struct first_aligned_impl { - inline static typename Derived::Index run(const Derived&) + static EIGEN_CONSTEXPR inline Index run(const Derived&) EIGEN_NOEXCEPT { return 0; } }; -template -struct first_aligned_impl +template +struct first_aligned_impl { - inline static typename Derived::Index run(const Derived& m) + static inline Index run(const Derived& m) { - return first_aligned(&m.const_cast_derived().coeffRef(0,0), m.size()); + return internal::first_aligned(m.data(), m.size()); } }; -/** \internal \returns the index of the first element of the array that is well aligned for vectorization. +/** \internal \returns the index of the first element of the array stored by \a m that is properly aligned with respect to \a Alignment for vectorization. + * + * \tparam Alignment requested alignment in Bytes. * * There is also the variant first_aligned(const Scalar*, Integer) defined in Memory.h. See it for more * documentation. */ +template +static inline Index first_aligned(const DenseBase& m) +{ + enum { ReturnZero = (int(evaluator::Alignment) >= Alignment) || !(Derived::Flags & DirectAccessBit) }; + return first_aligned_impl::run(m.derived()); +} + template -inline static typename Derived::Index first_aligned(const Derived& m) +static inline Index first_default_aligned(const DenseBase& m) { - return first_aligned_impl - - ::run(m); + typedef typename Derived::Scalar Scalar; + typedef typename packet_traits::type DefaultPacketType; + return internal::first_aligned::alignment),Derived>(m); } template::ret> @@ -762,4 +682,6 @@ struct outer_stride_at_compile_time } // end namespace internal +} // end namespace Eigen + #endif // EIGEN_DENSECOEFFSBASE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseStorage.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseStorage.h index 813053b..5e2763e 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseStorage.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DenseStorage.h @@ -3,79 +3,191 @@ // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2006-2009 Benoit Jacob -// Copyright (C) 2010 Hauke Heibel +// Copyright (C) 2010-2013 Hauke Heibel // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MATRIXSTORAGE_H #define EIGEN_MATRIXSTORAGE_H #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN - #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN EIGEN_DENSE_STORAGE_CTOR_PLUGIN; + #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X) X; EIGEN_DENSE_STORAGE_CTOR_PLUGIN; #else - #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X) #endif +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { struct constructor_without_unaligned_array_assert {}; +template +EIGEN_DEVICE_FUNC +void check_static_allocation_size() +{ + // if EIGEN_STACK_ALLOCATION_LIMIT is defined to 0, then no limit + #if EIGEN_STACK_ALLOCATION_LIMIT + EIGEN_STATIC_ASSERT(Size * sizeof(T) <= EIGEN_STACK_ALLOCATION_LIMIT, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG); + #endif +} + /** \internal * Static array. If the MatrixOrArrayOptions require auto-alignment, the array will be automatically aligned: * to 16 bytes boundary if the total size is a multiple of 16 bytes. */ template + : compute_default_alignment::value > struct plain_array { T array[Size]; - plain_array() {} - plain_array(constructor_without_unaligned_array_assert) {} + + EIGEN_DEVICE_FUNC + plain_array() + { + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } }; -#ifdef EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT +#if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT) #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) +#elif EIGEN_COMP_GNUC + // GCC 4.7 is too aggressive in its optimizations and remove the alignment test based on the fact the array is declared to be aligned. + // See this bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53900 + // Hiding the origin of the array pointer behind a function argument seems to do the trick even if the function is inlined: + template + EIGEN_ALWAYS_INLINE PtrType eigen_unaligned_array_assert_workaround_gcc47(PtrType array) { return array; } + #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ + eigen_assert((internal::is_constant_evaluated() \ + || (internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) & (sizemask)) == 0) \ + && "this assertion is explained here: " \ + "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ + " **** READ THIS WEB PAGE !!! ****"); #else #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ - eigen_assert((reinterpret_cast(array) & sizemask) == 0 \ + eigen_assert((internal::is_constant_evaluated() || (internal::UIntPtr(array) & (sizemask)) == 0) \ && "this assertion is explained here: " \ - "http://eigen.tuxfamily.org/dox-devel/TopicUnalignedArrayAssert.html" \ + "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ " **** READ THIS WEB PAGE !!! ****"); #endif +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(8) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(7); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + template struct plain_array { - EIGEN_USER_ALIGN16 T array[Size]; - plain_array() { EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf) } - plain_array(constructor_without_unaligned_array_assert) {} + EIGEN_ALIGN_TO_BOUNDARY(16) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(15); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(32) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(31); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(64) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(63); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } }; template struct plain_array { - EIGEN_USER_ALIGN16 T array[1]; - plain_array() {} - plain_array(constructor_without_unaligned_array_assert) {} + T array[1]; + EIGEN_DEVICE_FUNC plain_array() {} + EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert) {} +}; + +struct plain_array_helper { + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + static void copy(const plain_array& src, const Eigen::Index size, + plain_array& dst) { + smart_copy(src.array, src.array + size, dst.array); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + static void swap(plain_array& a, const Eigen::Index a_size, + plain_array& b, const Eigen::Index b_size) { + if (a_size < b_size) { + std::swap_ranges(b.array, b.array + a_size, a.array); + smart_move(b.array + a_size, b.array + b_size, a.array + a_size); + } else if (a_size > b_size) { + std::swap_ranges(a.array, a.array + b_size, b.array); + smart_move(a.array + b_size, a.array + a_size, b.array + b_size); + } else { + std::swap_ranges(a.array, a.array + a_size, b.array); + } + } }; } // end namespace internal @@ -92,213 +204,422 @@ struct plain_array * * \sa Matrix */ -template class DenseStorage; +template class DenseStorage; // purely fixed-size matrix -template class DenseStorage +template class DenseStorage { - internal::plain_array m_data; + internal::plain_array m_data; public: - inline explicit DenseStorage() {} - inline DenseStorage(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC DenseStorage() { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size) + } + EIGEN_DEVICE_FUNC + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()) {} - inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {} - inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); } - inline static DenseIndex rows(void) {return _Rows;} - inline static DenseIndex cols(void) {return _Cols;} - inline void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {} - inline void resize(DenseIndex,DenseIndex,DenseIndex) {} - inline const T *data() const { return m_data.array; } - inline T *data() { return m_data.array; } +#if defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN) + EIGEN_DEVICE_FUNC + DenseStorage(const DenseStorage& other) : m_data(other.m_data) { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size) + } +#else + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage&) = default; +#endif + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage&) = default; + EIGEN_DEVICE_FUNC DenseStorage(DenseStorage&&) = default; + EIGEN_DEVICE_FUNC DenseStorage& operator=(DenseStorage&&) = default; + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows==Rows_ && cols==Cols_); + EIGEN_UNUSED_VARIABLE(size); + EIGEN_UNUSED_VARIABLE(rows); + EIGEN_UNUSED_VARIABLE(cols); + } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + numext::swap(m_data, other.m_data); + } + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return Rows_;} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) EIGEN_NOEXCEPT {return Cols_;} + EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } }; // null matrix -template class DenseStorage +template class DenseStorage { public: - inline explicit DenseStorage() {} - inline DenseStorage(internal::constructor_without_unaligned_array_assert) {} - inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {} - inline void swap(DenseStorage& ) {} - inline static DenseIndex rows(void) {return _Rows;} - inline static DenseIndex cols(void) {return _Cols;} - inline void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {} - inline void resize(DenseIndex,DenseIndex,DenseIndex) {} - inline const T *data() const { return 0; } - inline T *data() { return 0; } + EIGEN_DEVICE_FUNC DenseStorage() {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) {} + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage&) {} + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage&) { return *this; } + EIGEN_DEVICE_FUNC DenseStorage(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& ) {} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return Rows_;} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) EIGEN_NOEXCEPT {return Cols_;} + EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC const T *data() const { return 0; } + EIGEN_DEVICE_FUNC T *data() { return 0; } }; +// more specializations for null matrices; these are necessary to resolve ambiguities +template class DenseStorage +: public DenseStorage { }; + +template class DenseStorage +: public DenseStorage { }; + +template class DenseStorage +: public DenseStorage { }; + // dynamic-size matrix with fixed-size storage -template class DenseStorage +template class DenseStorage { - internal::plain_array m_data; - DenseIndex m_rows; - DenseIndex m_cols; + internal::plain_array m_data; + Index m_rows; + Index m_cols; public: - inline explicit DenseStorage() : m_rows(0), m_cols(0) {} - inline DenseStorage(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {} - inline DenseStorage(DenseIndex, DenseIndex rows, DenseIndex cols) : m_rows(rows), m_cols(cols) {} - inline void swap(DenseStorage& other) - { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); } - inline DenseIndex rows(void) const {return m_rows;} - inline DenseIndex cols(void) const {return m_cols;} - inline void conservativeResize(DenseIndex, DenseIndex rows, DenseIndex cols) { m_rows = rows; m_cols = cols; } - inline void resize(DenseIndex, DenseIndex rows, DenseIndex cols) { m_rows = rows; m_cols = cols; } - inline const T *data() const { return m_data.array; } - inline T *data() { return m_data.array; } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows), m_cols(other.m_cols) + { + internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + m_rows = other.m_rows; + m_cols = other.m_cols; + internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data); + } + return *this; + } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index cols) : m_rows(rows), m_cols(cols) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { + internal::plain_array_helper::swap(m_data, m_rows * m_cols, other.m_data, other.m_rows * other.m_cols); + numext::swap(m_rows,other.m_rows); + numext::swap(m_cols,other.m_cols); + } + EIGEN_DEVICE_FUNC Index rows() const {return m_rows;} + EIGEN_DEVICE_FUNC Index cols() const {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index cols) { m_rows = rows; m_cols = cols; } + EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index cols) { m_rows = rows; m_cols = cols; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } }; // dynamic-size matrix with fixed-size storage and fixed width -template class DenseStorage +template class DenseStorage { - internal::plain_array m_data; - DenseIndex m_rows; + internal::plain_array m_data; + Index m_rows; public: - inline explicit DenseStorage() : m_rows(0) {} - inline DenseStorage(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {} - inline DenseStorage(DenseIndex, DenseIndex rows, DenseIndex) : m_rows(rows) {} - inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } - inline DenseIndex rows(void) const {return m_rows;} - inline DenseIndex cols(void) const {return _Cols;} - inline void conservativeResize(DenseIndex, DenseIndex rows, DenseIndex) { m_rows = rows; } - inline void resize(DenseIndex, DenseIndex rows, DenseIndex) { m_rows = rows; } - inline const T *data() const { return m_data.array; } - inline T *data() { return m_data.array; } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows) + { + internal::plain_array_helper::copy(other.m_data, m_rows * Cols_, m_data); + } + + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + m_rows = other.m_rows; + internal::plain_array_helper::copy(other.m_data, m_rows * Cols_, m_data); + } + return *this; + } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index) : m_rows(rows) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { + internal::plain_array_helper::swap(m_data, m_rows * Cols_, other.m_data, other.m_rows * Cols_); + numext::swap(m_rows, other.m_rows); + } + EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols(void) const EIGEN_NOEXCEPT {return Cols_;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index) { m_rows = rows; } + EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index) { m_rows = rows; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } }; // dynamic-size matrix with fixed-size storage and fixed height -template class DenseStorage +template class DenseStorage { - internal::plain_array m_data; - DenseIndex m_cols; + internal::plain_array m_data; + Index m_cols; public: - inline explicit DenseStorage() : m_cols(0) {} - inline DenseStorage(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC DenseStorage() : m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(0) {} - inline DenseStorage(DenseIndex, DenseIndex, DenseIndex cols) : m_cols(cols) {} - inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } - inline DenseIndex rows(void) const {return _Rows;} - inline DenseIndex cols(void) const {return m_cols;} - inline void conservativeResize(DenseIndex, DenseIndex, DenseIndex cols) { m_cols = cols; } - inline void resize(DenseIndex, DenseIndex, DenseIndex cols) { m_cols = cols; } - inline const T *data() const { return m_data.array; } - inline T *data() { return m_data.array; } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(other.m_cols) + { + internal::plain_array_helper::copy(other.m_data, Rows_ * m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + m_cols = other.m_cols; + internal::plain_array_helper::copy(other.m_data, Rows_ * m_cols, m_data); + } + return *this; + } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index, Index cols) : m_cols(cols) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + internal::plain_array_helper::swap(m_data, Rows_ * m_cols, other.m_data, Rows_ * other.m_cols); + numext::swap(m_cols, other.m_cols); + } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows(void) const EIGEN_NOEXCEPT {return Rows_;} + EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index, Index cols) { m_cols = cols; } + EIGEN_DEVICE_FUNC void resize(Index, Index, Index cols) { m_cols = cols; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } }; // purely dynamic matrix. -template class DenseStorage +template class DenseStorage { T *m_data; - DenseIndex m_rows; - DenseIndex m_cols; + Index m_rows; + Index m_cols; public: - inline explicit DenseStorage() : m_data(0), m_rows(0), m_cols(0) {} - inline DenseStorage(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0), m_cols(0) {} - inline DenseStorage(DenseIndex size, DenseIndex rows, DenseIndex cols) - : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows), m_cols(cols) - { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } - inline ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); } - inline void swap(DenseStorage& other) - { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); } - inline DenseIndex rows(void) const {return m_rows;} - inline DenseIndex cols(void) const {return m_cols;} - inline void conservativeResize(DenseIndex size, DenseIndex rows, DenseIndex cols) + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) + : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows), m_cols(cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows>=0 && cols >=0); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(other.m_rows*other.m_cols)) + , m_rows(other.m_rows) + , m_cols(other.m_cols) { - m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*m_cols); + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_rows*m_cols) + internal::smart_copy(other.m_data, other.m_data+other.m_rows*other.m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + , m_rows(std::move(other.m_rows)) + , m_cols(std::move(other.m_cols)) + { + other.m_data = nullptr; + other.m_rows = 0; + other.m_cols = 0; + } + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + numext::swap(m_data, other.m_data); + numext::swap(m_rows, other.m_rows); + numext::swap(m_cols, other.m_cols); + return *this; + } + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { + numext::swap(m_data,other.m_data); + numext::swap(m_rows,other.m_rows); + numext::swap(m_cols,other.m_cols); + } + EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} + EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} + void conservativeResize(Index size, Index rows, Index cols) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*m_cols); m_rows = rows; m_cols = cols; } - void resize(DenseIndex size, DenseIndex rows, DenseIndex cols) + EIGEN_DEVICE_FUNC void resize(Index size, Index rows, Index cols) { if(size != m_rows*m_cols) { - internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); - if (size) - m_data = internal::conditional_aligned_new_auto(size); + internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); + if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative + m_data = internal::conditional_aligned_new_auto(size); else m_data = 0; - EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) } m_rows = rows; m_cols = cols; } - inline const T *data() const { return m_data; } - inline T *data() { return m_data; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } }; // matrix with dynamic width and fixed height (so that matrix has dynamic size). -template class DenseStorage +template class DenseStorage { T *m_data; - DenseIndex m_cols; + Index m_cols; public: - inline explicit DenseStorage() : m_data(0), m_cols(0) {} - inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {} - inline DenseStorage(DenseIndex size, DenseIndex, DenseIndex cols) : m_data(internal::conditional_aligned_new_auto(size)), m_cols(cols) - { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } - inline ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); } - inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } - inline static DenseIndex rows(void) {return _Rows;} - inline DenseIndex cols(void) const {return m_cols;} - inline void conservativeResize(DenseIndex size, DenseIndex, DenseIndex cols) + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_cols(0) {} + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {} + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) : m_data(internal::conditional_aligned_new_auto(size)), m_cols(cols) { - m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, _Rows*m_cols); + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows==Rows_ && cols >=0); + EIGEN_UNUSED_VARIABLE(rows); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(Rows_*other.m_cols)) + , m_cols(other.m_cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_cols*Rows_) + internal::smart_copy(other.m_data, other.m_data+Rows_*m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + , m_cols(std::move(other.m_cols)) + { + other.m_data = nullptr; + other.m_cols = 0; + } + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + numext::swap(m_data, other.m_data); + numext::swap(m_cols, other.m_cols); + return *this; + } + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, Rows_*m_cols); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + numext::swap(m_data,other.m_data); + numext::swap(m_cols,other.m_cols); + } + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return Rows_;} + EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index size, Index, Index cols) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, Rows_*m_cols); m_cols = cols; } - EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex, DenseIndex cols) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index, Index cols) { - if(size != _Rows*m_cols) + if(size != Rows_*m_cols) { - internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); - if (size) - m_data = internal::conditional_aligned_new_auto(size); + internal::conditional_aligned_delete_auto(m_data, Rows_*m_cols); + if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative + m_data = internal::conditional_aligned_new_auto(size); else m_data = 0; - EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) } m_cols = cols; } - inline const T *data() const { return m_data; } - inline T *data() { return m_data; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } }; // matrix with dynamic height and fixed width (so that matrix has dynamic size). -template class DenseStorage +template class DenseStorage { T *m_data; - DenseIndex m_rows; + Index m_rows; public: - inline explicit DenseStorage() : m_data(0), m_rows(0) {} - inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {} - inline DenseStorage(DenseIndex size, DenseIndex rows, DenseIndex) : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows) - { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } - inline ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); } - inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } - inline DenseIndex rows(void) const {return m_rows;} - inline static DenseIndex cols(void) {return _Cols;} - inline void conservativeResize(DenseIndex size, DenseIndex rows, DenseIndex) + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0) {} + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {} + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows>=0 && cols == Cols_); + EIGEN_UNUSED_VARIABLE(cols); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(other.m_rows*Cols_)) + , m_rows(other.m_rows) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_rows*Cols_) + internal::smart_copy(other.m_data, other.m_data+other.m_rows*Cols_, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + , m_rows(std::move(other.m_rows)) { - m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*_Cols); + other.m_data = nullptr; + other.m_rows = 0; + } + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + numext::swap(m_data, other.m_data); + numext::swap(m_rows, other.m_rows); + return *this; + } + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, Cols_*m_rows); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + numext::swap(m_data,other.m_data); + numext::swap(m_rows,other.m_rows); + } + EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) {return Cols_;} + void conservativeResize(Index size, Index rows, Index) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*Cols_); m_rows = rows; } - EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex rows, DenseIndex) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index rows, Index) { - if(size != m_rows*_Cols) + if(size != m_rows*Cols_) { - internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); - if (size) - m_data = internal::conditional_aligned_new_auto(size); + internal::conditional_aligned_delete_auto(m_data, Cols_*m_rows); + if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative + m_data = internal::conditional_aligned_new_auto(size); else m_data = 0; - EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) } m_rows = rows; } - inline const T *data() const { return m_data; } - inline T *data() { return m_data; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } }; +} // end namespace Eigen + #endif // EIGEN_MATRIX_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Diagonal.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Diagonal.h index 61d3b06..4af17dd 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Diagonal.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Diagonal.h @@ -2,38 +2,28 @@ // for linear algebra. // // Copyright (C) 2007-2009 Benoit Jacob +// Copyright (C) 2009-2010 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_DIAGONAL_H #define EIGEN_DIAGONAL_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + /** \class Diagonal * \ingroup Core_Module * * \brief Expression of a diagonal/subdiagonal/superdiagonal in a matrix * - * \param MatrixType the type of the object in which we are taking a sub/main/super diagonal - * \param DiagIndex the index of the sub/super diagonal. The default is 0 and it means the main diagonal. + * \tparam MatrixType the type of the object in which we are taking a sub/main/super diagonal + * \tparam DiagIndex the index of the sub/super diagonal. The default is 0 and it means the main diagonal. * A positive value means a superdiagonal, a negative value means a subdiagonal. - * You can also use Dynamic so the index can be set at runtime. + * You can also use DynamicIndex so the index can be set at runtime. * * The matrix is not required to be square. * @@ -49,24 +39,22 @@ template struct traits > : traits { - typedef typename nested::type MatrixTypeNested; - typedef typename remove_reference::type _MatrixTypeNested; + typedef typename ref_selector::type MatrixTypeNested; + typedef std::remove_reference_t MatrixTypeNested_; typedef typename MatrixType::StorageKind StorageKind; enum { - AbsDiagIndex = DiagIndex<0 ? -DiagIndex : DiagIndex, // only used if DiagIndex != Dynamic - // FIXME these computations are broken in the case where the matrix is rectangular and DiagIndex!=0 - RowsAtCompileTime = (int(DiagIndex) == Dynamic || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic - : (EIGEN_SIZE_MIN_PREFER_DYNAMIC(MatrixType::RowsAtCompileTime, - MatrixType::ColsAtCompileTime) - AbsDiagIndex), + RowsAtCompileTime = (int(DiagIndex) == DynamicIndex || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic + : (plain_enum_min(MatrixType::RowsAtCompileTime - plain_enum_max(-DiagIndex, 0), + MatrixType::ColsAtCompileTime - plain_enum_max( DiagIndex, 0))), ColsAtCompileTime = 1, MaxRowsAtCompileTime = int(MatrixType::MaxSizeAtCompileTime) == Dynamic ? Dynamic - : DiagIndex == Dynamic ? EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, - MatrixType::MaxColsAtCompileTime) - : (EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime) - AbsDiagIndex), + : DiagIndex == DynamicIndex ? min_size_prefer_fixed(MatrixType::MaxRowsAtCompileTime, + MatrixType::MaxColsAtCompileTime) + : (plain_enum_min(MatrixType::MaxRowsAtCompileTime - plain_enum_max(-DiagIndex, 0), + MatrixType::MaxColsAtCompileTime - plain_enum_max( DiagIndex, 0))), MaxColsAtCompileTime = 1, MaskLvalueBit = is_lvalue::value ? LvalueBit : 0, - Flags = (unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit | MaskLvalueBit | DirectAccessBit) & ~RowMajorBit, - CoeffReadCost = _MatrixTypeNested::CoeffReadCost, + Flags = (unsigned int)MatrixTypeNested_::Flags & (RowMajorBit | MaskLvalueBit | DirectAccessBit) & ~RowMajorBit, // FIXME DirectAccessBit should not be handled by expressions MatrixTypeOuterStride = outer_stride_at_compile_time::ret, InnerStrideAtCompileTime = MatrixTypeOuterStride == Dynamic ? Dynamic : MatrixTypeOuterStride+1, OuterStrideAtCompileTime = 0 @@ -74,75 +62,116 @@ struct traits > }; } -template class Diagonal - : public internal::dense_xpr_base< Diagonal >::type +template class Diagonal + : public internal::dense_xpr_base< Diagonal >::type { public: + enum { DiagIndex = DiagIndex_ }; typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal) - inline Diagonal(MatrixType& matrix, Index index = DiagIndex) : m_matrix(matrix), m_index(index) {} + EIGEN_DEVICE_FUNC + explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) + { + eigen_assert( a_index <= m_matrix.cols() && -a_index <= m_matrix.rows() ); + } EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal) + EIGEN_DEVICE_FUNC inline Index rows() const - { return m_index.value()<0 ? (std::min)(m_matrix.cols(),m_matrix.rows()+m_index.value()) : (std::min)(m_matrix.rows(),m_matrix.cols()-m_index.value()); } + { + return m_index.value()<0 ? numext::mini(m_matrix.cols(),m_matrix.rows()+m_index.value()) + : numext::mini(m_matrix.rows(),m_matrix.cols()-m_index.value()); + } - inline Index cols() const { return 1; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return 1; } - inline Index innerStride() const - { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_matrix.outerStride() + 1; } - inline Index outerStride() const - { - return 0; - } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return 0; } + + typedef std::conditional_t< + internal::is_lvalue::value, + Scalar, + const Scalar + > ScalarWithConstIfNotLvalue; + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return &(m_matrix.coeffRef(rowOffset(), colOffset())); } + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return &(m_matrix.coeffRef(rowOffset(), colOffset())); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index) { EIGEN_STATIC_ASSERT_LVALUE(MatrixType) - return m_matrix.const_cast_derived().coeffRef(row+rowOffset(), row+colOffset()); + return m_matrix.coeffRef(row+rowOffset(), row+colOffset()); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index row, Index) const { - return m_matrix.const_cast_derived().coeffRef(row+rowOffset(), row+colOffset()); + return m_matrix.coeffRef(row+rowOffset(), row+colOffset()); } + EIGEN_DEVICE_FUNC inline CoeffReturnType coeff(Index row, Index) const { return m_matrix.coeff(row+rowOffset(), row+colOffset()); } - inline Scalar& coeffRef(Index index) + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index idx) { EIGEN_STATIC_ASSERT_LVALUE(MatrixType) - return m_matrix.const_cast_derived().coeffRef(index+rowOffset(), index+colOffset()); + return m_matrix.coeffRef(idx+rowOffset(), idx+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index idx) const + { + return m_matrix.coeffRef(idx+rowOffset(), idx+colOffset()); } - inline const Scalar& coeffRef(Index index) const + EIGEN_DEVICE_FUNC + inline CoeffReturnType coeff(Index idx) const { - return m_matrix.const_cast_derived().coeffRef(index+rowOffset(), index+colOffset()); + return m_matrix.coeff(idx+rowOffset(), idx+colOffset()); } - inline CoeffReturnType coeff(Index index) const + EIGEN_DEVICE_FUNC + inline const internal::remove_all_t& + nestedExpression() const { - return m_matrix.coeff(index+rowOffset(), index+colOffset()); + return m_matrix; + } + + EIGEN_DEVICE_FUNC + inline Index index() const + { + return m_index.value(); } protected: - const typename MatrixType::Nested m_matrix; - const internal::variable_if_dynamic m_index; + typename internal::ref_selector::non_const_type m_matrix; + const internal::variable_if_dynamicindex m_index; private: // some compilers may fail to optimize std::max etc in case of compile-time constants... - EIGEN_STRONG_INLINE Index absDiagIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); } - EIGEN_STRONG_INLINE Index rowOffset() const { return m_index.value()>0 ? 0 : -m_index.value(); } - EIGEN_STRONG_INLINE Index colOffset() const { return m_index.value()>0 ? m_index.value() : 0; } - // triger a compile time error is someone try to call packet + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index absDiagIndex() const EIGEN_NOEXCEPT { return m_index.value()>0 ? m_index.value() : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rowOffset() const EIGEN_NOEXCEPT { return m_index.value()>0 ? 0 : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index colOffset() const EIGEN_NOEXCEPT { return m_index.value()>0 ? m_index.value() : 0; } + // trigger a compile-time error if someone try to call packet template typename MatrixType::PacketReturnType packet(Index) const; template typename MatrixType::PacketReturnType packet(Index,Index) const; }; @@ -156,15 +185,16 @@ template class Diagonal * * \sa class Diagonal */ template -inline typename MatrixBase::DiagonalReturnType +EIGEN_DEVICE_FUNC inline typename MatrixBase::DiagonalReturnType MatrixBase::diagonal() { - return derived(); + return DiagonalReturnType(derived()); } /** This is the const version of diagonal(). */ template -inline const typename MatrixBase::ConstDiagonalReturnType +EIGEN_DEVICE_FUNC inline +const typename MatrixBase::ConstDiagonalReturnType MatrixBase::diagonal() const { return ConstDiagonalReturnType(derived()); @@ -182,18 +212,18 @@ MatrixBase::diagonal() const * * \sa MatrixBase::diagonal(), class Diagonal */ template -inline typename MatrixBase::template DiagonalIndexReturnType::Type +EIGEN_DEVICE_FUNC inline Diagonal MatrixBase::diagonal(Index index) { - return typename DiagonalIndexReturnType::Type(derived(), index); + return Diagonal(derived(), index); } /** This is the const version of diagonal(Index). */ template -inline typename MatrixBase::template ConstDiagonalIndexReturnType::Type +EIGEN_DEVICE_FUNC inline const Diagonal MatrixBase::diagonal(Index index) const { - return typename ConstDiagonalIndexReturnType::Type(derived(), index); + return Diagonal(derived(), index); } /** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this @@ -208,20 +238,24 @@ MatrixBase::diagonal(Index index) const * * \sa MatrixBase::diagonal(), class Diagonal */ template -template -inline typename MatrixBase::template DiagonalIndexReturnType::Type +template +EIGEN_DEVICE_FUNC +inline Diagonal MatrixBase::diagonal() { - return derived(); + return Diagonal(derived()); } /** This is the const version of diagonal(). */ template -template -inline typename MatrixBase::template ConstDiagonalIndexReturnType::Type +template +EIGEN_DEVICE_FUNC +inline const Diagonal MatrixBase::diagonal() const { - return derived(); + return Diagonal(derived()); } +} // end namespace Eigen + #endif // EIGEN_DIAGONAL_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DiagonalMatrix.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DiagonalMatrix.h index f41a74b..405cc71 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DiagonalMatrix.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DiagonalMatrix.h @@ -4,37 +4,39 @@ // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2007-2009 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_DIAGONALMATRIX_H #define EIGEN_DIAGONALMATRIX_H -#ifndef EIGEN_PARSED_BY_DOXYGEN +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +/** \class DiagonalBase + * \ingroup Core_Module + * + * \brief Base class for diagonal matrices and expressions + * + * This is the base class that is inherited by diagonal matrix and related expression + * types, which internally use a vector for storing the diagonal entries. Diagonal + * types always represent square matrices. + * + * \tparam Derived is the derived type, a DiagonalMatrix or DiagonalWrapper. + * + * \sa class DiagonalMatrix, class DiagonalWrapper + */ template class DiagonalBase : public EigenBase { public: typedef typename internal::traits::DiagonalVectorType DiagonalVectorType; typedef typename DiagonalVectorType::Scalar Scalar; + typedef typename DiagonalVectorType::RealScalar RealScalar; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; enum { RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, @@ -42,102 +44,145 @@ class DiagonalBase : public EigenBase MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, IsVectorAtCompileTime = 0, - Flags = 0 + Flags = NoPreferredStorageOrderBit }; typedef Matrix DenseMatrixType; typedef DenseMatrixType DenseType; typedef DiagonalMatrix PlainObject; + /** \returns a reference to the derived object. */ + EIGEN_DEVICE_FUNC inline const Derived& derived() const { return *static_cast(this); } + /** \returns a const reference to the derived object. */ + EIGEN_DEVICE_FUNC inline Derived& derived() { return *static_cast(this); } + /** + * Constructs a dense matrix from \c *this. Note, this directly returns a dense matrix type, + * not an expression. + * \returns A dense matrix, with its diagonal entries set from the the derived object. */ + EIGEN_DEVICE_FUNC DenseMatrixType toDenseMatrix() const { return derived(); } - template - void evalTo(MatrixBase &other) const; - template - void addTo(MatrixBase &other) const - { other.diagonal() += diagonal(); } - template - void subTo(MatrixBase &other) const - { other.diagonal() -= diagonal(); } + /** \returns a reference to the derived object's vector of diagonal coefficients. */ + EIGEN_DEVICE_FUNC inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); } + /** \returns a const reference to the derived object's vector of diagonal coefficients. */ + EIGEN_DEVICE_FUNC inline DiagonalVectorType& diagonal() { return derived().diagonal(); } + /** \returns the number of rows. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const { return diagonal().size(); } + /** \returns the number of columns. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const { return diagonal().size(); } + /** \returns the diagonal matrix product of \c *this by the dense matrix, \a matrix */ template - const DiagonalProduct - operator*(const MatrixBase &matrix) const; - - inline const DiagonalWrapper, const DiagonalVectorType> > - inverse() const + EIGEN_DEVICE_FUNC + const Product + operator*(const MatrixBase &matrix) const { - return diagonal().cwiseInverse(); + return Product(derived(),matrix.derived()); } - - #ifdef EIGEN2_SUPPORT - template - bool isApprox(const DiagonalBase& other, typename NumTraits::Real precision = NumTraits::dummy_precision()) const - { - return diagonal().isApprox(other.diagonal(), precision); + + template + using DiagonalProductReturnType = DiagonalWrapper; + + /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a other */ + template + EIGEN_DEVICE_FUNC const DiagonalProductReturnType operator*( + const DiagonalBase& other) const { + return diagonal().cwiseProduct(other.diagonal()).asDiagonal(); } - template - bool isApprox(const MatrixBase& other, typename NumTraits::Real precision = NumTraits::dummy_precision()) const - { - return toDenseMatrix().isApprox(other, precision); + + using DiagonalInverseReturnType = + DiagonalWrapper, const DiagonalVectorType>>; + + /** \returns the inverse \c *this. Computed as the coefficient-wise inverse of the diagonal. */ + EIGEN_DEVICE_FUNC + inline const DiagonalInverseReturnType inverse() const { return diagonal().cwiseInverse().asDiagonal(); } + + using DiagonalScaleReturnType = + DiagonalWrapper; + + /** \returns the product of \c *this by the scalar \a scalar */ + EIGEN_DEVICE_FUNC + inline const DiagonalScaleReturnType operator*(const Scalar& scalar) const { + return (diagonal() * scalar).asDiagonal(); } - #endif -}; -template -template -void DiagonalBase::evalTo(MatrixBase &other) const -{ - other.setZero(); - other.diagonal() = diagonal(); -} -#endif + using ScaleDiagonalReturnType = + DiagonalWrapper; + + /** \returns the product of a scalar and the diagonal matrix \a other */ + EIGEN_DEVICE_FUNC + friend inline const ScaleDiagonalReturnType operator*(const Scalar& scalar, const DiagonalBase& other) { + return (scalar * other.diagonal()).asDiagonal(); + } + + template + using DiagonalSumReturnType = DiagonalWrapper; + + /** \returns the sum of \c *this and the diagonal matrix \a other */ + template + EIGEN_DEVICE_FUNC inline const DiagonalSumReturnType operator+( + const DiagonalBase& other) const { + return (diagonal() + other.diagonal()).asDiagonal(); + } + + template + using DiagonalDifferenceReturnType = DiagonalWrapper; + + /** \returns the difference of \c *this and the diagonal matrix \a other */ + template + EIGEN_DEVICE_FUNC inline const DiagonalDifferenceReturnType operator-( + const DiagonalBase& other) const { + return (diagonal() - other.diagonal()).asDiagonal(); + } +}; /** \class DiagonalMatrix - * \ingroup Core_Module - * - * \brief Represents a diagonal matrix with its storage - * - * \param _Scalar the type of coefficients - * \param SizeAtCompileTime the dimension of the matrix, or Dynamic - * \param MaxSizeAtCompileTime the dimension of the matrix, or Dynamic. This parameter is optional and defaults - * to SizeAtCompileTime. Most of the time, you do not need to specify it. - * - * \sa class DiagonalWrapper - */ + * \ingroup Core_Module + * + * \brief Represents a diagonal matrix with its storage + * + * \tparam Scalar_ the type of coefficients + * \tparam SizeAtCompileTime the dimension of the matrix, or Dynamic + * \tparam MaxSizeAtCompileTime the dimension of the matrix, or Dynamic. This parameter is optional and defaults + * to SizeAtCompileTime. Most of the time, you do not need to specify it. + * + * \sa class DiagonalBase, class DiagonalWrapper + */ namespace internal { -template -struct traits > - : traits > +template +struct traits > + : traits > { - typedef Matrix<_Scalar,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1> DiagonalVectorType; - typedef Dense StorageKind; - typedef DenseIndex Index; + typedef Matrix DiagonalVectorType; + typedef DiagonalShape StorageKind; enum { - Flags = LvalueBit + Flags = LvalueBit | NoPreferredStorageOrderBit | NestByRefBit }; }; } -template +template class DiagonalMatrix - : public DiagonalBase > + : public DiagonalBase > { public: #ifndef EIGEN_PARSED_BY_DOXYGEN typedef typename internal::traits::DiagonalVectorType DiagonalVectorType; typedef const DiagonalMatrix& Nested; - typedef _Scalar Scalar; + typedef Scalar_ Scalar; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; #endif protected: @@ -147,24 +192,55 @@ class DiagonalMatrix public: /** const version of diagonal(). */ + EIGEN_DEVICE_FUNC inline const DiagonalVectorType& diagonal() const { return m_diagonal; } /** \returns a reference to the stored vector of diagonal coefficients. */ + EIGEN_DEVICE_FUNC inline DiagonalVectorType& diagonal() { return m_diagonal; } /** Default constructor without initialization */ + EIGEN_DEVICE_FUNC inline DiagonalMatrix() {} /** Constructs a diagonal matrix with given dimension */ - inline DiagonalMatrix(Index dim) : m_diagonal(dim) {} + EIGEN_DEVICE_FUNC + explicit inline DiagonalMatrix(Index dim) : m_diagonal(dim) {} /** 2D constructor. */ + EIGEN_DEVICE_FUNC inline DiagonalMatrix(const Scalar& x, const Scalar& y) : m_diagonal(x,y) {} /** 3D constructor. */ + EIGEN_DEVICE_FUNC inline DiagonalMatrix(const Scalar& x, const Scalar& y, const Scalar& z) : m_diagonal(x,y,z) {} + /** \brief Construct a diagonal matrix with fixed size from an arbitrary number of coefficients. + * + * \warning To construct a diagonal matrix of fixed size, the number of values passed to this + * constructor must match the fixed dimension of \c *this. + * + * \sa DiagonalMatrix(const Scalar&, const Scalar&) + * \sa DiagonalMatrix(const Scalar&, const Scalar&, const Scalar&) + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + DiagonalMatrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const ArgTypes&... args) + : m_diagonal(a0, a1, a2, args...) {} + + /** \brief Constructs a DiagonalMatrix and initializes it by elements given by an initializer list of initializer + * lists \cpp11 + */ + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE DiagonalMatrix(const std::initializer_list>& list) + : m_diagonal(list) {} + + /** \brief Constructs a DiagonalMatrix from an r-value diagonal vector type */ + EIGEN_DEVICE_FUNC + explicit inline DiagonalMatrix(DiagonalVectorType&& diag) : m_diagonal(std::move(diag)) {} + /** Copy constructor. */ template + EIGEN_DEVICE_FUNC inline DiagonalMatrix(const DiagonalBase& other) : m_diagonal(other.diagonal()) {} #ifndef EIGEN_PARSED_BY_DOXYGEN @@ -174,11 +250,13 @@ class DiagonalMatrix /** generic constructor from expression of the diagonal coefficients */ template + EIGEN_DEVICE_FUNC explicit inline DiagonalMatrix(const MatrixBase& other) : m_diagonal(other) {} /** Copy operator. */ template + EIGEN_DEVICE_FUNC DiagonalMatrix& operator=(const DiagonalBase& other) { m_diagonal = other.diagonal(); @@ -189,6 +267,7 @@ class DiagonalMatrix /** This is a special case of the templated operator=. Its purpose is to * prevent a default operator= from hiding the templated operator=. */ + EIGEN_DEVICE_FUNC DiagonalMatrix& operator=(const DiagonalMatrix& other) { m_diagonal = other.diagonal(); @@ -196,15 +275,36 @@ class DiagonalMatrix } #endif + typedef DiagonalWrapper, DiagonalVectorType>> + InitializeReturnType; + + /** Initializes a diagonal matrix of size SizeAtCompileTime with coefficients set to zero */ + EIGEN_DEVICE_FUNC + static const InitializeReturnType Zero() { return DiagonalVectorType::Zero().asDiagonal(); } + /** Initializes a diagonal matrix of size dim with coefficients set to zero */ + EIGEN_DEVICE_FUNC + static const InitializeReturnType Zero(Index size) { return DiagonalVectorType::Zero(size).asDiagonal(); } + /** Initializes a identity matrix of size SizeAtCompileTime */ + EIGEN_DEVICE_FUNC + static const InitializeReturnType Identity() { return DiagonalVectorType::Ones().asDiagonal(); } + /** Initializes a identity matrix of size dim */ + EIGEN_DEVICE_FUNC + static const InitializeReturnType Identity(Index size) { return DiagonalVectorType::Ones(size).asDiagonal(); } + /** Resizes to given size. */ + EIGEN_DEVICE_FUNC inline void resize(Index size) { m_diagonal.resize(size); } /** Sets all coefficients to zero. */ + EIGEN_DEVICE_FUNC inline void setZero() { m_diagonal.setZero(); } /** Resizes and sets all coefficients to zero. */ + EIGEN_DEVICE_FUNC inline void setZero(Index size) { m_diagonal.setZero(size); } /** Sets this matrix to be the identity matrix of the current size. */ + EIGEN_DEVICE_FUNC inline void setIdentity() { m_diagonal.setOnes(); } /** Sets this matrix to be the identity matrix of the given size. */ + EIGEN_DEVICE_FUNC inline void setIdentity(Index size) { m_diagonal.setOnes(size); } }; @@ -213,7 +313,7 @@ class DiagonalMatrix * * \brief Expression of a diagonal matrix * - * \param _DiagonalVectorType the type of the vector of diagonal coefficients + * \tparam DiagonalVectorType_ the type of the vector of diagonal coefficients * * This class is an expression of a diagonal matrix, but not storing its own vector of diagonal coefficients, * instead wrapping an existing vector expression. It is the return type of MatrixBase::asDiagonal() @@ -223,41 +323,44 @@ class DiagonalMatrix */ namespace internal { -template -struct traits > +template +struct traits > { - typedef _DiagonalVectorType DiagonalVectorType; + typedef DiagonalVectorType_ DiagonalVectorType; typedef typename DiagonalVectorType::Scalar Scalar; - typedef typename DiagonalVectorType::Index Index; - typedef typename DiagonalVectorType::StorageKind StorageKind; + typedef typename DiagonalVectorType::StorageIndex StorageIndex; + typedef DiagonalShape StorageKind; + typedef typename traits::XprKind XprKind; enum { RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, - MaxRowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, - MaxColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, - Flags = traits::Flags & LvalueBit + MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + Flags = (traits::Flags & LvalueBit) | NoPreferredStorageOrderBit }; }; } -template +template class DiagonalWrapper - : public DiagonalBase >, internal::no_assignment_operator + : public DiagonalBase >, internal::no_assignment_operator { public: #ifndef EIGEN_PARSED_BY_DOXYGEN - typedef _DiagonalVectorType DiagonalVectorType; + typedef DiagonalVectorType_ DiagonalVectorType; typedef DiagonalWrapper Nested; #endif /** Constructor from expression of diagonal coefficients to wrap. */ - inline DiagonalWrapper(const DiagonalVectorType& diagonal) : m_diagonal(diagonal) {} + EIGEN_DEVICE_FUNC + explicit inline DiagonalWrapper(DiagonalVectorType& a_diagonal) : m_diagonal(a_diagonal) {} /** \returns a const reference to the wrapped expression of diagonal coefficients. */ + EIGEN_DEVICE_FUNC const DiagonalVectorType& diagonal() const { return m_diagonal; } protected: - const typename DiagonalVectorType::Nested m_diagonal; + typename DiagonalVectorType::Nested m_diagonal; }; /** \returns a pseudo-expression of a diagonal matrix with *this as vector of diagonal coefficients @@ -270,10 +373,10 @@ class DiagonalWrapper * \sa class DiagonalWrapper, class DiagonalMatrix, diagonal(), isDiagonal() **/ template -inline const DiagonalWrapper +EIGEN_DEVICE_FUNC inline const DiagonalWrapper MatrixBase::asDiagonal() const { - return derived(); + return DiagonalWrapper(derived()); } /** \returns true if *this is approximately equal to a diagonal matrix, @@ -285,13 +388,13 @@ MatrixBase::asDiagonal() const * \sa asDiagonal() */ template -bool MatrixBase::isDiagonal(RealScalar prec) const +bool MatrixBase::isDiagonal(const RealScalar& prec) const { if(cols() != rows()) return false; RealScalar maxAbsOnDiagonal = static_cast(-1); for(Index j = 0; j < cols(); ++j) { - RealScalar absOnDiagonal = internal::abs(coeff(j,j)); + RealScalar absOnDiagonal = numext::abs(coeff(j,j)); if(absOnDiagonal > maxAbsOnDiagonal) maxAbsOnDiagonal = absOnDiagonal; } for(Index j = 0; j < cols(); ++j) @@ -303,4 +406,38 @@ bool MatrixBase::isDiagonal(RealScalar prec) const return true; } +namespace internal { + +template<> struct storage_kind_to_shape { typedef DiagonalShape Shape; }; + +struct Diagonal2Dense {}; + +template<> struct AssignmentKind { typedef Diagonal2Dense Kind; }; + +// Diagonal matrix to Dense assignment +template< typename DstXprType, typename SrcXprType, typename Functor> +struct Assignment +{ + static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + dst.setZero(); + dst.diagonal() = src.diagonal(); + } + + static void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &/*func*/) + { dst.diagonal() += src.diagonal(); } + + static void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &/*func*/) + { dst.diagonal() -= src.diagonal(); } +}; + +} // namespace internal + +} // end namespace Eigen + #endif // EIGEN_DIAGONALMATRIX_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DiagonalProduct.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DiagonalProduct.h index de0c6ed..3cd34ba 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DiagonalProduct.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/DiagonalProduct.h @@ -4,132 +4,27 @@ // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2007-2009 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_DIAGONALPRODUCT_H #define EIGEN_DIAGONALPRODUCT_H -namespace internal { -template -struct traits > - : traits -{ - typedef typename scalar_product_traits::ReturnType Scalar; - enum { - RowsAtCompileTime = MatrixType::RowsAtCompileTime, - ColsAtCompileTime = MatrixType::ColsAtCompileTime, - MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, - MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, - - _StorageOrder = MatrixType::Flags & RowMajorBit ? RowMajor : ColMajor, - _PacketOnDiag = !((int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheLeft) - ||(int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)), - _SameTypes = is_same::value, - // FIXME currently we need same types, but in the future the next rule should be the one - //_Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && ((!_PacketOnDiag) || (_SameTypes && bool(int(DiagonalType::Flags)&PacketAccessBit))), - _Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && _SameTypes && ((!_PacketOnDiag) || (bool(int(DiagonalType::Flags)&PacketAccessBit))), - - Flags = (HereditaryBits & (unsigned int)(MatrixType::Flags)) | (_Vectorizable ? PacketAccessBit : 0), - CoeffReadCost = NumTraits::MulCost + MatrixType::CoeffReadCost + DiagonalType::DiagonalVectorType::CoeffReadCost - }; -}; -} - -template -class DiagonalProduct : internal::no_assignment_operator, - public MatrixBase > -{ - public: - - typedef MatrixBase Base; - EIGEN_DENSE_PUBLIC_INTERFACE(DiagonalProduct) - - inline DiagonalProduct(const MatrixType& matrix, const DiagonalType& diagonal) - : m_matrix(matrix), m_diagonal(diagonal) - { - eigen_assert(diagonal.diagonal().size() == (ProductOrder == OnTheLeft ? matrix.rows() : matrix.cols())); - } +#include "./InternalHeaderCheck.h" - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } - - const Scalar coeff(Index row, Index col) const - { - return m_diagonal.diagonal().coeff(ProductOrder == OnTheLeft ? row : col) * m_matrix.coeff(row, col); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const - { - enum { - StorageOrder = Flags & RowMajorBit ? RowMajor : ColMajor - }; - const Index indexInDiagonalVector = ProductOrder == OnTheLeft ? row : col; - - return packet_impl(row,col,indexInDiagonalVector,typename internal::conditional< - ((int(StorageOrder) == RowMajor && int(ProductOrder) == OnTheLeft) - ||(int(StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)), internal::true_type, internal::false_type>::type()); - } - - protected: - template - EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::true_type) const - { - return internal::pmul(m_matrix.template packet(row, col), - internal::pset1(m_diagonal.diagonal().coeff(id))); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::false_type) const - { - enum { - InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime, - DiagonalVectorPacketLoadMode = (LoadMode == Aligned && ((InnerSize%16) == 0)) ? Aligned : Unaligned - }; - return internal::pmul(m_matrix.template packet(row, col), - m_diagonal.diagonal().template packet(id)); - } - - const typename MatrixType::Nested m_matrix; - const typename DiagonalType::Nested m_diagonal; -}; +namespace Eigen { /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. */ template template -inline const DiagonalProduct -MatrixBase::operator*(const DiagonalBase &diagonal) const -{ - return DiagonalProduct(derived(), diagonal.derived()); -} - -/** \returns the diagonal matrix product of \c *this by the matrix \a matrix. - */ -template -template -inline const DiagonalProduct -DiagonalBase::operator*(const MatrixBase &matrix) const +EIGEN_DEVICE_FUNC inline const Product +MatrixBase::operator*(const DiagonalBase &a_diagonal) const { - return DiagonalProduct(matrix.derived(), derived()); + return Product(derived(),a_diagonal.derived()); } +} // end namespace Eigen #endif // EIGEN_DIAGONALPRODUCT_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Dot.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Dot.h index 42da784..0c13192 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Dot.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Dot.h @@ -3,64 +3,55 @@ // // Copyright (C) 2006-2008, 2010 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_DOT_H #define EIGEN_DOT_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { // helper function for dot(). The problem is that if we put that in the body of dot(), then upon calling dot // with mismatched types, the compiler emits errors about failing to instantiate cwiseProduct BEFORE // looking at the static assertions. Thus this is a trick to get better compile errors. template + bool NeedToTranspose = T::IsVectorAtCompileTime && U::IsVectorAtCompileTime && + ((int(T::RowsAtCompileTime) == 1 && int(U::ColsAtCompileTime) == 1) || + (int(T::ColsAtCompileTime) == 1 && int(U::RowsAtCompileTime) == 1))> struct dot_nocheck { - typedef typename scalar_product_traits::Scalar,typename traits::Scalar>::ReturnType ResScalar; - static inline ResScalar run(const MatrixBase& a, const MatrixBase& b) + typedef scalar_conj_product_op::Scalar,typename traits::Scalar> conj_prod; + typedef typename conj_prod::result_type ResScalar; + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE + static ResScalar run(const MatrixBase& a, const MatrixBase& b) { - return a.template binaryExpr::Scalar,typename traits::Scalar> >(b).sum(); + return a.template binaryExpr(b).sum(); } }; template struct dot_nocheck { - typedef typename scalar_product_traits::Scalar,typename traits::Scalar>::ReturnType ResScalar; - static inline ResScalar run(const MatrixBase& a, const MatrixBase& b) + typedef scalar_conj_product_op::Scalar,typename traits::Scalar> conj_prod; + typedef typename conj_prod::result_type ResScalar; + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE + static ResScalar run(const MatrixBase& a, const MatrixBase& b) { - return a.transpose().template binaryExpr::Scalar,typename traits::Scalar> >(b).sum(); + return a.transpose().template binaryExpr(b).sum(); } }; } // end namespace internal -/** \returns the dot product of *this with other. +/** \fn MatrixBase::dot + * \returns the dot product of *this with other. * * \only_for_vectors * @@ -72,100 +63,134 @@ struct dot_nocheck */ template template -typename internal::scalar_product_traits::Scalar,typename internal::traits::Scalar>::ReturnType +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE +typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType MatrixBase::dot(const MatrixBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) +#if !(defined(EIGEN_NO_STATIC_ASSERT) && defined(EIGEN_NO_DEBUG)) typedef internal::scalar_conj_product_op func; EIGEN_CHECK_BINARY_COMPATIBILIY(func,Scalar,typename OtherDerived::Scalar); - +#endif + eigen_assert(size() == other.size()); return internal::dot_nocheck::run(*this, other); } -#ifdef EIGEN2_SUPPORT -/** \returns the dot product of *this with other, with the Eigen2 convention that the dot product is linear in the first variable - * (conjugating the second variable). Of course this only makes a difference in the complex case. - * - * This method is only available in EIGEN2_SUPPORT mode. - * - * \only_for_vectors - * - * \sa dot() - */ -template -template -typename internal::traits::Scalar -MatrixBase::eigen2_dot(const MatrixBase& other) const -{ - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) - EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) - EIGEN_STATIC_ASSERT((internal::is_same::value), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - - eigen_assert(size() == other.size()); - - return internal::dot_nocheck::run(other,*this); -} -#endif - - //---------- implementation of L2 norm and related functions ---------- -/** \returns, for vectors, the squared \em l2 norm of \c *this, and for matrices the Frobenius norm. +/** \returns, for vectors, the squared \em l2 norm of \c *this, and for matrices the squared Frobenius norm. * In both cases, it consists in the sum of the square of all the matrix entries. * For vectors, this is also equals to the dot product of \c *this with itself. * - * \sa dot(), norm() + * \sa dot(), norm(), lpNorm() */ template -EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::squaredNorm() const +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::squaredNorm() const { - return internal::real((*this).cwiseAbs2().sum()); + return numext::real((*this).cwiseAbs2().sum()); } /** \returns, for vectors, the \em l2 norm of \c *this, and for matrices the Frobenius norm. * In both cases, it consists in the square root of the sum of the square of all the matrix entries. * For vectors, this is also equals to the square root of the dot product of \c *this with itself. * - * \sa dot(), squaredNorm() + * \sa lpNorm(), dot(), squaredNorm() */ template -inline typename NumTraits::Scalar>::Real MatrixBase::norm() const +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::norm() const { - return internal::sqrt(squaredNorm()); + return numext::sqrt(squaredNorm()); } -/** \returns an expression of the quotient of *this by its own norm. +/** \returns an expression of the quotient of \c *this by its own norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), + * then this function returns a copy of the input. * * \only_for_vectors * * \sa norm(), normalize() */ template -inline const typename MatrixBase::PlainObject +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::PlainObject MatrixBase::normalized() const { - typedef typename internal::nested::type Nested; - typedef typename internal::remove_reference::type _Nested; - _Nested n(derived()); - return n / n.norm(); + typedef typename internal::nested_eval::type Nested_; + Nested_ n(derived()); + RealScalar z = n.squaredNorm(); + // NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU + if(z>RealScalar(0)) + return n / numext::sqrt(z); + else + return n; } /** Normalizes the vector, i.e. divides it by its own norm. * * \only_for_vectors * + * \warning If the input vector is too small (i.e., this->norm()==0), then \c *this is left unchanged. + * * \sa norm(), normalized() */ template -inline void MatrixBase::normalize() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void MatrixBase::normalize() +{ + RealScalar z = squaredNorm(); + // NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU + if(z>RealScalar(0)) + derived() /= numext::sqrt(z); +} + +/** \returns an expression of the quotient of \c *this by its own norm while avoiding underflow and overflow. + * + * \only_for_vectors + * + * This method is analogue to the normalized() method, but it reduces the risk of + * underflow and overflow when computing the norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), + * then this function returns a copy of the input. + * + * \sa stableNorm(), stableNormalize(), normalized() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::PlainObject +MatrixBase::stableNormalized() const +{ + typedef typename internal::nested_eval::type Nested_; + Nested_ n(derived()); + RealScalar w = n.cwiseAbs().maxCoeff(); + RealScalar z = (n/w).squaredNorm(); + if(z>RealScalar(0)) + return n / (numext::sqrt(z)*w); + else + return n; +} + +/** Normalizes the vector while avoid underflow and overflow + * + * \only_for_vectors + * + * This method is analogue to the normalize() method, but it reduces the risk of + * underflow and overflow when computing the norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), then \c *this is left unchanged. + * + * \sa stableNorm(), stableNormalized(), normalize() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void MatrixBase::stableNormalize() { - *this /= norm(); + RealScalar w = cwiseAbs().maxCoeff(); + RealScalar z = (derived()/w).squaredNorm(); + if(z>RealScalar(0)) + derived() /= numext::sqrt(z)*w; } //---------- implementation of other norms ---------- @@ -176,8 +201,10 @@ template struct lpNorm_selector { typedef typename NumTraits::Scalar>::Real RealScalar; - inline static RealScalar run(const MatrixBase& m) + EIGEN_DEVICE_FUNC + static inline RealScalar run(const MatrixBase& m) { + EIGEN_USING_STD(pow) return pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p); } }; @@ -185,7 +212,8 @@ struct lpNorm_selector template struct lpNorm_selector { - inline static typename NumTraits::Scalar>::Real run(const MatrixBase& m) + EIGEN_DEVICE_FUNC + static inline typename NumTraits::Scalar>::Real run(const MatrixBase& m) { return m.cwiseAbs().sum(); } @@ -194,7 +222,8 @@ struct lpNorm_selector template struct lpNorm_selector { - inline static typename NumTraits::Scalar>::Real run(const MatrixBase& m) + EIGEN_DEVICE_FUNC + static inline typename NumTraits::Scalar>::Real run(const MatrixBase& m) { return m.norm(); } @@ -203,23 +232,35 @@ struct lpNorm_selector template struct lpNorm_selector { - inline static typename NumTraits::Scalar>::Real run(const MatrixBase& m) + typedef typename NumTraits::Scalar>::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const MatrixBase& m) { + if(Derived::SizeAtCompileTime==0 || (Derived::SizeAtCompileTime==Dynamic && m.size()==0)) + return RealScalar(0); return m.cwiseAbs().maxCoeff(); } }; } // end namespace internal -/** \returns the \f$ \ell^p \f$ norm of *this, that is, returns the p-th root of the sum of the p-th powers of the absolute values - * of the coefficients of *this. If \a p is the special value \a Eigen::Infinity, this function returns the \f$ \ell^\infty \f$ - * norm, that is the maximum of the absolute values of the coefficients of *this. +/** \returns the \b coefficient-wise \f$ \ell^p \f$ norm of \c *this, that is, returns the p-th root of the sum of the p-th powers of the absolute values + * of the coefficients of \c *this. If \a p is the special value \a Eigen::Infinity, this function returns the \f$ \ell^\infty \f$ + * norm, that is the maximum of the absolute values of the coefficients of \c *this. + * + * In all cases, if \c *this is empty, then the value 0 is returned. + * + * \note For matrices, this function does not compute the operator-norm. That is, if \c *this is a matrix, then its coefficients are interpreted as a 1D vector. Nonetheless, you can easily compute the 1-norm and \f$\infty\f$-norm matrix operator norms using \link TutorialReductionsVisitorsBroadcastingReductionsNorm partial reductions \endlink. * * \sa norm() */ template template -inline typename NumTraits::Scalar>::Real +#ifndef EIGEN_PARSED_BY_DOXYGEN +EIGEN_DEVICE_FUNC inline typename NumTraits::Scalar>::Real +#else +EIGEN_DEVICE_FUNC MatrixBase::RealScalar +#endif MatrixBase::lpNorm() const { return internal::lpNorm_selector::run(*this); @@ -236,11 +277,11 @@ MatrixBase::lpNorm() const template template bool MatrixBase::isOrthogonal -(const MatrixBase& other, RealScalar prec) const +(const MatrixBase& other, const RealScalar& prec) const { - typename internal::nested::type nested(derived()); - typename internal::nested::type otherNested(other.derived()); - return internal::abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm(); + typename internal::nested_eval::type nested(derived()); + typename internal::nested_eval::type otherNested(other.derived()); + return numext::abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm(); } /** \returns true if *this is approximately an unitary matrix, @@ -255,18 +296,20 @@ bool MatrixBase::isOrthogonal * Output: \verbinclude MatrixBase_isUnitary.out */ template -bool MatrixBase::isUnitary(RealScalar prec) const +bool MatrixBase::isUnitary(const RealScalar& prec) const { - typename Derived::Nested nested(derived()); + typename internal::nested_eval::type self(derived()); for(Index i = 0; i < cols(); ++i) { - if(!internal::isApprox(nested.col(i).squaredNorm(), static_cast(1), prec)) + if(!internal::isApprox(self.col(i).squaredNorm(), static_cast(1), prec)) return false; for(Index j = 0; j < i; ++j) - if(!internal::isMuchSmallerThan(nested.col(i).dot(nested.col(j)), static_cast(1), prec)) + if(!internal::isMuchSmallerThan(self.col(i).dot(self.col(j)), static_cast(1), prec)) return false; } return true; } +} // end namespace Eigen + #endif // EIGEN_DOT_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/EigenBase.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/EigenBase.h index 0472539..105488d 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/EigenBase.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/EigenBase.h @@ -4,30 +4,21 @@ // Copyright (C) 2009 Benoit Jacob // Copyright (C) 2009 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_EIGENBASE_H #define EIGEN_EIGENBASE_H +#include "./InternalHeaderCheck.h" -/** Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T). +namespace Eigen { + +/** \class EigenBase + * \ingroup Core_Module + * + * Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T). * * In other words, an EigenBase object is an object that can be copied into a MatrixBase. * @@ -35,39 +26,58 @@ * * Notice that this class is trivial, it is only used to disambiguate overloaded functions. * - * \sa \ref TopicClassHierarchy + * \sa \blank \ref TopicClassHierarchy */ template struct EigenBase { // typedef typename internal::plain_matrix_type::type PlainObject; + /** \brief The interface type of indices + * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. + * \sa StorageIndex, \ref TopicPreprocessorDirectives. + * DEPRECATED: Since Eigen 3.3, its usage is deprecated. Use Eigen::Index instead. + * Deprecation is not marked with a doxygen comment because there are too many existing usages to add the deprecation attribute. + */ + typedef Eigen::Index Index; + + // FIXME is it needed? typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; /** \returns a reference to the derived object */ + EIGEN_DEVICE_FUNC Derived& derived() { return *static_cast(this); } /** \returns a const reference to the derived object */ + EIGEN_DEVICE_FUNC const Derived& derived() const { return *static_cast(this); } + EIGEN_DEVICE_FUNC inline Derived& const_cast_derived() const { return *static_cast(const_cast(this)); } + EIGEN_DEVICE_FUNC inline const Derived& const_derived() const { return *static_cast(this); } /** \returns the number of rows. \sa cols(), RowsAtCompileTime */ - inline Index rows() const { return derived().rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return derived().rows(); } /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/ - inline Index cols() const { return derived().cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return derived().cols(); } /** \returns the number of coefficients, which is rows()*cols(). * \sa rows(), cols(), SizeAtCompileTime. */ - inline Index size() const { return rows() * cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index size() const EIGEN_NOEXCEPT { return rows() * cols(); } /** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */ - template inline void evalTo(Dest& dst) const + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& dst) const { derived().evalTo(dst); } /** \internal Don't use it, but do the equivalent: \code dst += *this; \endcode */ - template inline void addTo(Dest& dst) const + template + EIGEN_DEVICE_FUNC + inline void addTo(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -77,7 +87,9 @@ template struct EigenBase } /** \internal Don't use it, but do the equivalent: \code dst -= *this; \endcode */ - template inline void subTo(Dest& dst) const + template + EIGEN_DEVICE_FUNC + inline void subTo(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -87,7 +99,8 @@ template struct EigenBase } /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheRight(*this); \endcode */ - template inline void applyThisOnTheRight(Dest& dst) const + template + EIGEN_DEVICE_FUNC inline void applyThisOnTheRight(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -95,7 +108,8 @@ template struct EigenBase } /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheLeft(*this); \endcode */ - template inline void applyThisOnTheLeft(Dest& dst) const + template + EIGEN_DEVICE_FUNC inline void applyThisOnTheLeft(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -118,55 +132,31 @@ template struct EigenBase */ template template +EIGEN_DEVICE_FUNC Derived& DenseBase::operator=(const EigenBase &other) { - other.derived().evalTo(derived()); + call_assignment(derived(), other.derived()); return derived(); } template template +EIGEN_DEVICE_FUNC Derived& DenseBase::operator+=(const EigenBase &other) { - other.derived().addTo(derived()); + call_assignment(derived(), other.derived(), internal::add_assign_op()); return derived(); } template template +EIGEN_DEVICE_FUNC Derived& DenseBase::operator-=(const EigenBase &other) { - other.derived().subTo(derived()); + call_assignment(derived(), other.derived(), internal::sub_assign_op()); return derived(); } -/** replaces \c *this by \c *this * \a other. - * - * \returns a reference to \c *this - */ -template -template -inline Derived& -MatrixBase::operator*=(const EigenBase &other) -{ - other.derived().applyThisOnTheRight(derived()); - return derived(); -} - -/** replaces \c *this by \c *this * \a other. It is equivalent to MatrixBase::operator*=() */ -template -template -inline void MatrixBase::applyOnTheRight(const EigenBase &other) -{ - other.derived().applyThisOnTheRight(derived()); -} - -/** replaces \c *this by \c *this * \a other. */ -template -template -inline void MatrixBase::applyOnTheLeft(const EigenBase &other) -{ - other.derived().applyThisOnTheLeft(derived()); -} +} // end namespace Eigen #endif // EIGEN_EIGENBASE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Flagged.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Flagged.h deleted file mode 100644 index 458213a..0000000 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Flagged.h +++ /dev/null @@ -1,151 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008 Benoit Jacob -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_FLAGGED_H -#define EIGEN_FLAGGED_H - -/** \class Flagged - * \ingroup Core_Module - * - * \brief Expression with modified flags - * - * \param ExpressionType the type of the object of which we are modifying the flags - * \param Added the flags added to the expression - * \param Removed the flags removed from the expression (has priority over Added). - * - * This class represents an expression whose flags have been modified. - * It is the return type of MatrixBase::flagged() - * and most of the time this is the only way it is used. - * - * \sa MatrixBase::flagged() - */ - -namespace internal { -template -struct traits > : traits -{ - enum { Flags = (ExpressionType::Flags | Added) & ~Removed }; -}; -} - -template class Flagged - : public MatrixBase > -{ - public: - - typedef MatrixBase Base; - - EIGEN_DENSE_PUBLIC_INTERFACE(Flagged) - typedef typename internal::conditional::ret, - ExpressionType, const ExpressionType&>::type ExpressionTypeNested; - typedef typename ExpressionType::InnerIterator InnerIterator; - - inline Flagged(const ExpressionType& matrix) : m_matrix(matrix) {} - - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } - inline Index outerStride() const { return m_matrix.outerStride(); } - inline Index innerStride() const { return m_matrix.innerStride(); } - - inline CoeffReturnType coeff(Index row, Index col) const - { - return m_matrix.coeff(row, col); - } - - inline CoeffReturnType coeff(Index index) const - { - return m_matrix.coeff(index); - } - - inline const Scalar& coeffRef(Index row, Index col) const - { - return m_matrix.const_cast_derived().coeffRef(row, col); - } - - inline const Scalar& coeffRef(Index index) const - { - return m_matrix.const_cast_derived().coeffRef(index); - } - - inline Scalar& coeffRef(Index row, Index col) - { - return m_matrix.const_cast_derived().coeffRef(row, col); - } - - inline Scalar& coeffRef(Index index) - { - return m_matrix.const_cast_derived().coeffRef(index); - } - - template - inline const PacketScalar packet(Index row, Index col) const - { - return m_matrix.template packet(row, col); - } - - template - inline void writePacket(Index row, Index col, const PacketScalar& x) - { - m_matrix.const_cast_derived().template writePacket(row, col, x); - } - - template - inline const PacketScalar packet(Index index) const - { - return m_matrix.template packet(index); - } - - template - inline void writePacket(Index index, const PacketScalar& x) - { - m_matrix.const_cast_derived().template writePacket(index, x); - } - - const ExpressionType& _expression() const { return m_matrix; } - - template - typename ExpressionType::PlainObject solveTriangular(const MatrixBase& other) const; - - template - void solveTriangularInPlace(const MatrixBase& other) const; - - protected: - ExpressionTypeNested m_matrix; -}; - -/** \returns an expression of *this with added and removed flags - * - * This is mostly for internal use. - * - * \sa class Flagged - */ -template -template -inline const Flagged -DenseBase::flagged() const -{ - return derived(); -} - -#endif // EIGEN_FLAGGED_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ForceAlignedAccess.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ForceAlignedAccess.h index 11c1f8f..b00785e 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ForceAlignedAccess.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ForceAlignedAccess.h @@ -3,28 +3,17 @@ // // Copyright (C) 2009-2010 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_FORCEALIGNEDACCESS_H #define EIGEN_FORCEALIGNEDACCESS_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + /** \class ForceAlignedAccess * \ingroup Core_Module * @@ -52,29 +41,33 @@ template class ForceAlignedAccess typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess) - inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {} + EIGEN_DEVICE_FUNC explicit inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {} - inline Index rows() const { return m_expression.rows(); } - inline Index cols() const { return m_expression.cols(); } - inline Index outerStride() const { return m_expression.outerStride(); } - inline Index innerStride() const { return m_expression.innerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } - inline const CoeffReturnType coeff(Index row, Index col) const + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const { return m_expression.coeff(row, col); } - inline Scalar& coeffRef(Index row, Index col) + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col) { return m_expression.const_cast_derived().coeffRef(row, col); } - inline const CoeffReturnType coeff(Index index) const + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const { return m_expression.coeff(index); } - inline Scalar& coeffRef(Index index) + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) { return m_expression.const_cast_derived().coeffRef(index); } @@ -103,7 +96,7 @@ template class ForceAlignedAccess m_expression.const_cast_derived().template writePacket(index, x); } - operator const ExpressionType&() const { return m_expression; } + EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } protected: const ExpressionType& m_expression; @@ -137,10 +130,10 @@ MatrixBase::forceAlignedAccess() */ template template -inline typename internal::add_const_on_value_type,Derived&>::type>::type +inline add_const_on_value_type_t,Derived&>> MatrixBase::forceAlignedAccessIf() const { - return derived(); + return derived(); // FIXME This should not work but apparently is never used } /** \returns an expression of *this with forced aligned access if \a Enable is true. @@ -148,10 +141,12 @@ MatrixBase::forceAlignedAccessIf() const */ template template -inline typename internal::conditional,Derived&>::type +inline std::conditional_t,Derived&> MatrixBase::forceAlignedAccessIf() { - return derived(); + return derived(); // FIXME This should not work but apparently is never used } +} // end namespace Eigen + #endif // EIGEN_FORCEALIGNEDACCESS_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Functors.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Functors.h deleted file mode 100644 index 302a51a..0000000 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Functors.h +++ /dev/null @@ -1,942 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008-2010 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_FUNCTORS_H -#define EIGEN_FUNCTORS_H - -namespace internal { - -// associative functors: - -/** \internal - * \brief Template functor to compute the sum of two scalars - * - * \sa class CwiseBinaryOp, MatrixBase::operator+, class VectorwiseOp, MatrixBase::sum() - */ -template struct scalar_sum_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_sum_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::padd(a,b); } - template - EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const - { return internal::predux(a); } -}; -template -struct functor_traits > { - enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasAdd - }; -}; - -/** \internal - * \brief Template functor to compute the product of two scalars - * - * \sa class CwiseBinaryOp, Cwise::operator*(), class VectorwiseOp, MatrixBase::redux() - */ -template struct scalar_product_op { - enum { - // TODO vectorize mixed product - Vectorizable = is_same::value && packet_traits::HasMul && packet_traits::HasMul - }; - typedef typename scalar_product_traits::ReturnType result_type; - EIGEN_EMPTY_STRUCT_CTOR(scalar_product_op) - EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const { return a * b; } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::pmul(a,b); } - template - EIGEN_STRONG_INLINE const result_type predux(const Packet& a) const - { return internal::predux_mul(a); } -}; -template -struct functor_traits > { - enum { - Cost = (NumTraits::MulCost + NumTraits::MulCost)/2, // rough estimate! - PacketAccess = scalar_product_op::Vectorizable - }; -}; - -/** \internal - * \brief Template functor to compute the conjugate product of two scalars - * - * This is a short cut for conj(x) * y which is needed for optimization purpose; in Eigen2 support mode, this becomes x * conj(y) - */ -template struct scalar_conj_product_op { - - enum { - Conj = NumTraits::IsComplex - }; - - typedef typename scalar_product_traits::ReturnType result_type; - - EIGEN_EMPTY_STRUCT_CTOR(scalar_conj_product_op) - EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const - { return conj_helper().pmul(a,b); } - - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return conj_helper().pmul(a,b); } -}; -template -struct functor_traits > { - enum { - Cost = NumTraits::MulCost, - PacketAccess = internal::is_same::value && packet_traits::HasMul - }; -}; - -/** \internal - * \brief Template functor to compute the min of two scalars - * - * \sa class CwiseBinaryOp, MatrixBase::cwiseMin, class VectorwiseOp, MatrixBase::minCoeff() - */ -template struct scalar_min_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_min_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { using std::min; return (min)(a, b); } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::pmin(a,b); } - template - EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const - { return internal::predux_min(a); } -}; -template -struct functor_traits > { - enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasMin - }; -}; - -/** \internal - * \brief Template functor to compute the max of two scalars - * - * \sa class CwiseBinaryOp, MatrixBase::cwiseMax, class VectorwiseOp, MatrixBase::maxCoeff() - */ -template struct scalar_max_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_max_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { using std::max; return (max)(a, b); } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::pmax(a,b); } - template - EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const - { return internal::predux_max(a); } -}; -template -struct functor_traits > { - enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasMax - }; -}; - -/** \internal - * \brief Template functor to compute the hypot of two scalars - * - * \sa MatrixBase::stableNorm(), class Redux - */ -template struct scalar_hypot_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_hypot_op) -// typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& _x, const Scalar& _y) const - { - using std::max; - using std::min; - Scalar p = (max)(_x, _y); - Scalar q = (min)(_x, _y); - Scalar qp = q/p; - return p * sqrt(Scalar(1) + qp*qp); - } -}; -template -struct functor_traits > { - enum { Cost = 5 * NumTraits::MulCost, PacketAccess=0 }; -}; - -// other binary functors: - -/** \internal - * \brief Template functor to compute the difference of two scalars - * - * \sa class CwiseBinaryOp, MatrixBase::operator- - */ -template struct scalar_difference_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_difference_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::psub(a,b); } -}; -template -struct functor_traits > { - enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasSub - }; -}; - -/** \internal - * \brief Template functor to compute the quotient of two scalars - * - * \sa class CwiseBinaryOp, Cwise::operator/() - */ -template struct scalar_quotient_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_quotient_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::pdiv(a,b); } -}; -template -struct functor_traits > { - enum { - Cost = 2 * NumTraits::MulCost, - PacketAccess = packet_traits::HasDiv - }; -}; - -// unary functors: - -/** \internal - * \brief Template functor to compute the opposite of a scalar - * - * \sa class CwiseUnaryOp, MatrixBase::operator- - */ -template struct scalar_opposite_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_opposite_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return -a; } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const - { return internal::pnegate(a); } -}; -template -struct functor_traits > -{ enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasNegate }; -}; - -/** \internal - * \brief Template functor to compute the absolute value of a scalar - * - * \sa class CwiseUnaryOp, Cwise::abs - */ -template struct scalar_abs_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_abs_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return internal::abs(a); } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const - { return internal::pabs(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasAbs - }; -}; - -/** \internal - * \brief Template functor to compute the squared absolute value of a scalar - * - * \sa class CwiseUnaryOp, Cwise::abs2 - */ -template struct scalar_abs2_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_abs2_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return internal::abs2(a); } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const - { return internal::pmul(a,a); } -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasAbs2 }; }; - -/** \internal - * \brief Template functor to compute the conjugate of a complex value - * - * \sa class CwiseUnaryOp, MatrixBase::conjugate() - */ -template struct scalar_conjugate_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_conjugate_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return internal::conj(a); } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return internal::pconj(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = NumTraits::IsComplex ? NumTraits::AddCost : 0, - PacketAccess = packet_traits::HasConj - }; -}; - -/** \internal - * \brief Template functor to cast a scalar to another type - * - * \sa class CwiseUnaryOp, MatrixBase::cast() - */ -template -struct scalar_cast_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cast_op) - typedef NewType result_type; - EIGEN_STRONG_INLINE const NewType operator() (const Scalar& a) const { return cast(a); } -}; -template -struct functor_traits > -{ enum { Cost = is_same::value ? 0 : NumTraits::AddCost, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to extract the real part of a complex - * - * \sa class CwiseUnaryOp, MatrixBase::real() - */ -template -struct scalar_real_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_real_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return internal::real(a); } -}; -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to extract the imaginary part of a complex - * - * \sa class CwiseUnaryOp, MatrixBase::imag() - */ -template -struct scalar_imag_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return internal::imag(a); } -}; -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to extract the real part of a complex as a reference - * - * \sa class CwiseUnaryOp, MatrixBase::real() - */ -template -struct scalar_real_ref_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_real_ref_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return internal::real_ref(*const_cast(&a)); } -}; -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to extract the imaginary part of a complex as a reference - * - * \sa class CwiseUnaryOp, MatrixBase::imag() - */ -template -struct scalar_imag_ref_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_ref_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return internal::imag_ref(*const_cast(&a)); } -}; -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -/** \internal - * - * \brief Template functor to compute the exponential of a scalar - * - * \sa class CwiseUnaryOp, Cwise::exp() - */ -template struct scalar_exp_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_exp_op) - inline const Scalar operator() (const Scalar& a) const { return internal::exp(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::pexp(a); } -}; -template -struct functor_traits > -{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = packet_traits::HasExp }; }; - -/** \internal - * - * \brief Template functor to compute the logarithm of a scalar - * - * \sa class CwiseUnaryOp, Cwise::log() - */ -template struct scalar_log_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_log_op) - inline const Scalar operator() (const Scalar& a) const { return internal::log(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::plog(a); } -}; -template -struct functor_traits > -{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = packet_traits::HasLog }; }; - -/** \internal - * \brief Template functor to multiply a scalar by a fixed other one - * - * \sa class CwiseUnaryOp, MatrixBase::operator*, MatrixBase::operator/ - */ -/* NOTE why doing the pset1() in packetOp *is* an optimization ? - * indeed it seems better to declare m_other as a Packet and do the pset1() once - * in the constructor. However, in practice: - * - GCC does not like m_other as a Packet and generate a load every time it needs it - * - on the other hand GCC is able to moves the pset1() away the loop :) - * - simpler code ;) - * (ICC and gcc 4.4 seems to perform well in both cases, the issue is visible with y = a*x + b*y) - */ -template -struct scalar_multiple_op { - typedef typename packet_traits::type Packet; - // FIXME default copy constructors seems bugged with std::complex<> - EIGEN_STRONG_INLINE scalar_multiple_op(const scalar_multiple_op& other) : m_other(other.m_other) { } - EIGEN_STRONG_INLINE scalar_multiple_op(const Scalar& other) : m_other(other) { } - EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a * m_other; } - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const - { return internal::pmul(a, pset1(m_other)); } - typename add_const_on_value_type::Nested>::type m_other; -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; - -template -struct scalar_multiple2_op { - typedef typename scalar_product_traits::ReturnType result_type; - EIGEN_STRONG_INLINE scalar_multiple2_op(const scalar_multiple2_op& other) : m_other(other.m_other) { } - EIGEN_STRONG_INLINE scalar_multiple2_op(const Scalar2& other) : m_other(other) { } - EIGEN_STRONG_INLINE result_type operator() (const Scalar1& a) const { return a * m_other; } - typename add_const_on_value_type::Nested>::type m_other; -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = false }; }; - -template -struct scalar_quotient1_impl { - typedef typename packet_traits::type Packet; - // FIXME default copy constructors seems bugged with std::complex<> - EIGEN_STRONG_INLINE scalar_quotient1_impl(const scalar_quotient1_impl& other) : m_other(other.m_other) { } - EIGEN_STRONG_INLINE scalar_quotient1_impl(const Scalar& other) : m_other(static_cast(1) / other) {} - EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a * m_other; } - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const - { return internal::pmul(a, pset1(m_other)); } - const Scalar m_other; -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; - -template -struct scalar_quotient1_impl { - // FIXME default copy constructors seems bugged with std::complex<> - EIGEN_STRONG_INLINE scalar_quotient1_impl(const scalar_quotient1_impl& other) : m_other(other.m_other) { } - EIGEN_STRONG_INLINE scalar_quotient1_impl(const Scalar& other) : m_other(other) {} - EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a / m_other; } - typename add_const_on_value_type::Nested>::type m_other; -}; -template -struct functor_traits > -{ enum { Cost = 2 * NumTraits::MulCost, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to divide a scalar by a fixed other one - * - * This functor is used to implement the quotient of a matrix by - * a scalar where the scalar type is not necessarily a floating point type. - * - * \sa class CwiseUnaryOp, MatrixBase::operator/ - */ -template -struct scalar_quotient1_op : scalar_quotient1_impl::IsInteger > { - EIGEN_STRONG_INLINE scalar_quotient1_op(const Scalar& other) - : scalar_quotient1_impl::IsInteger >(other) {} -}; -template -struct functor_traits > -: functor_traits::IsInteger> > -{}; - -// nullary functors - -template -struct scalar_constant_op { - typedef typename packet_traits::type Packet; - EIGEN_STRONG_INLINE scalar_constant_op(const scalar_constant_op& other) : m_other(other.m_other) { } - EIGEN_STRONG_INLINE scalar_constant_op(const Scalar& other) : m_other(other) { } - template - EIGEN_STRONG_INLINE const Scalar operator() (Index, Index = 0) const { return m_other; } - template - EIGEN_STRONG_INLINE const Packet packetOp(Index, Index = 0) const { return internal::pset1(m_other); } - const Scalar m_other; -}; -template -struct functor_traits > -// FIXME replace this packet test by a safe one -{ enum { Cost = 1, PacketAccess = packet_traits::Vectorizable, IsRepeatable = true }; }; - -template struct scalar_identity_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_identity_op) - template - EIGEN_STRONG_INLINE const Scalar operator() (Index row, Index col) const { return row==col ? Scalar(1) : Scalar(0); } -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = false, IsRepeatable = true }; }; - -template struct linspaced_op_impl; - -// linear access for packet ops: -// 1) initialization -// base = [low, ..., low] + ([step, ..., step] * [-size, ..., 0]) -// 2) each step -// base += [size*step, ..., size*step] -template -struct linspaced_op_impl -{ - typedef typename packet_traits::type Packet; - - linspaced_op_impl(Scalar low, Scalar step) : - m_low(low), m_step(step), - m_packetStep(pset1(packet_traits::size*step)), - m_base(padd(pset1(low),pmul(pset1(step),plset(-packet_traits::size)))) {} - - template - EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return m_low+i*m_step; } - template - EIGEN_STRONG_INLINE const Packet packetOp(Index) const { return m_base = padd(m_base,m_packetStep); } - - const Scalar m_low; - const Scalar m_step; - const Packet m_packetStep; - mutable Packet m_base; -}; - -// random access for packet ops: -// 1) each step -// [low, ..., low] + ( [step, ..., step] * ( [i, ..., i] + [0, ..., size] ) ) -template -struct linspaced_op_impl -{ - typedef typename packet_traits::type Packet; - - linspaced_op_impl(Scalar low, Scalar step) : - m_low(low), m_step(step), - m_lowPacket(pset1(m_low)), m_stepPacket(pset1(m_step)), m_interPacket(plset(0)) {} - - template - EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return m_low+i*m_step; } - - template - EIGEN_STRONG_INLINE const Packet packetOp(Index i) const - { return internal::padd(m_lowPacket, pmul(m_stepPacket, padd(pset1(i),m_interPacket))); } - - const Scalar m_low; - const Scalar m_step; - const Packet m_lowPacket; - const Packet m_stepPacket; - const Packet m_interPacket; -}; - -// ----- Linspace functor ---------------------------------------------------------------- - -// Forward declaration (we default to random access which does not really give -// us a speed gain when using packet access but it allows to use the functor in -// nested expressions). -template struct linspaced_op; -template struct functor_traits< linspaced_op > -{ enum { Cost = 1, PacketAccess = packet_traits::HasSetLinear, IsRepeatable = true }; }; -template struct linspaced_op -{ - typedef typename packet_traits::type Packet; - linspaced_op(Scalar low, Scalar high, int num_steps) : impl(low, (high-low)/(num_steps-1)) {} - - template - EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); } - - // We need this function when assigning e.g. a RowVectorXd to a MatrixXd since - // there row==0 and col is used for the actual iteration. - template - EIGEN_STRONG_INLINE const Scalar operator() (Index row, Index col) const - { - eigen_assert(col==0 || row==0); - return impl(col + row); - } - - template - EIGEN_STRONG_INLINE const Packet packetOp(Index i) const { return impl.packetOp(i); } - - // We need this function when assigning e.g. a RowVectorXd to a MatrixXd since - // there row==0 and col is used for the actual iteration. - template - EIGEN_STRONG_INLINE const Packet packetOp(Index row, Index col) const - { - eigen_assert(col==0 || row==0); - return impl.packetOp(col + row); - } - - // This proxy object handles the actual required temporaries, the different - // implementations (random vs. sequential access) as well as the - // correct piping to size 2/4 packet operations. - const linspaced_op_impl impl; -}; - -// all functors allow linear access, except scalar_identity_op. So we fix here a quick meta -// to indicate whether a functor allows linear access, just always answering 'yes' except for -// scalar_identity_op. -// FIXME move this to functor_traits adding a functor_default -template struct functor_has_linear_access { enum { ret = 1 }; }; -template struct functor_has_linear_access > { enum { ret = 0 }; }; - -// in CwiseBinaryOp, we require the Lhs and Rhs to have the same scalar type, except for multiplication -// where we only require them to have the same _real_ scalar type so one may multiply, say, float by complex. -// FIXME move this to functor_traits adding a functor_default -template struct functor_allows_mixing_real_and_complex { enum { ret = 0 }; }; -template struct functor_allows_mixing_real_and_complex > { enum { ret = 1 }; }; -template struct functor_allows_mixing_real_and_complex > { enum { ret = 1 }; }; - - -/** \internal - * \brief Template functor to add a scalar to a fixed other one - * \sa class CwiseUnaryOp, Array::operator+ - */ -/* If you wonder why doing the pset1() in packetOp() is an optimization check scalar_multiple_op */ -template -struct scalar_add_op { - typedef typename packet_traits::type Packet; - // FIXME default copy constructors seems bugged with std::complex<> - inline scalar_add_op(const scalar_add_op& other) : m_other(other.m_other) { } - inline scalar_add_op(const Scalar& other) : m_other(other) { } - inline Scalar operator() (const Scalar& a) const { return a + m_other; } - inline const Packet packetOp(const Packet& a) const - { return internal::padd(a, pset1(m_other)); } - const Scalar m_other; -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = packet_traits::HasAdd }; }; - -/** \internal - * \brief Template functor to compute the square root of a scalar - * \sa class CwiseUnaryOp, Cwise::sqrt() - */ -template struct scalar_sqrt_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_sqrt_op) - inline const Scalar operator() (const Scalar& a) const { return internal::sqrt(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::psqrt(a); } -}; -template -struct functor_traits > -{ enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasSqrt - }; -}; - -/** \internal - * \brief Template functor to compute the cosine of a scalar - * \sa class CwiseUnaryOp, ArrayBase::cos() - */ -template struct scalar_cos_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cos_op) - inline Scalar operator() (const Scalar& a) const { return internal::cos(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::pcos(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasCos - }; -}; - -/** \internal - * \brief Template functor to compute the sine of a scalar - * \sa class CwiseUnaryOp, ArrayBase::sin() - */ -template struct scalar_sin_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_sin_op) - inline const Scalar operator() (const Scalar& a) const { return internal::sin(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::psin(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasSin - }; -}; - - -/** \internal - * \brief Template functor to compute the tan of a scalar - * \sa class CwiseUnaryOp, ArrayBase::tan() - */ -template struct scalar_tan_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_tan_op) - inline const Scalar operator() (const Scalar& a) const { return internal::tan(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::ptan(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasTan - }; -}; - -/** \internal - * \brief Template functor to compute the arc cosine of a scalar - * \sa class CwiseUnaryOp, ArrayBase::acos() - */ -template struct scalar_acos_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_acos_op) - inline const Scalar operator() (const Scalar& a) const { return internal::acos(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::pacos(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasACos - }; -}; - -/** \internal - * \brief Template functor to compute the arc sine of a scalar - * \sa class CwiseUnaryOp, ArrayBase::asin() - */ -template struct scalar_asin_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_asin_op) - inline const Scalar operator() (const Scalar& a) const { return internal::asin(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::pasin(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasASin - }; -}; - -/** \internal - * \brief Template functor to raise a scalar to a power - * \sa class CwiseUnaryOp, Cwise::pow - */ -template -struct scalar_pow_op { - // FIXME default copy constructors seems bugged with std::complex<> - inline scalar_pow_op(const scalar_pow_op& other) : m_exponent(other.m_exponent) { } - inline scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {} - inline Scalar operator() (const Scalar& a) const { return internal::pow(a, m_exponent); } - const Scalar m_exponent; -}; -template -struct functor_traits > -{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to compute the inverse of a scalar - * \sa class CwiseUnaryOp, Cwise::inverse() - */ -template -struct scalar_inverse_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_inverse_op) - inline Scalar operator() (const Scalar& a) const { return Scalar(1)/a; } - template - inline const Packet packetOp(const Packet& a) const - { return internal::pdiv(pset1(Scalar(1)),a); } -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasDiv }; }; - -/** \internal - * \brief Template functor to compute the square of a scalar - * \sa class CwiseUnaryOp, Cwise::square() - */ -template -struct scalar_square_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_square_op) - inline Scalar operator() (const Scalar& a) const { return a*a; } - template - inline const Packet packetOp(const Packet& a) const - { return internal::pmul(a,a); } -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; - -/** \internal - * \brief Template functor to compute the cube of a scalar - * \sa class CwiseUnaryOp, Cwise::cube() - */ -template -struct scalar_cube_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cube_op) - inline Scalar operator() (const Scalar& a) const { return a*a*a; } - template - inline const Packet packetOp(const Packet& a) const - { return internal::pmul(a,pmul(a,a)); } -}; -template -struct functor_traits > -{ enum { Cost = 2*NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; - -// default functor traits for STL functors: - -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = functor_traits::Cost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = functor_traits::Cost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1 + functor_traits::Cost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1 + functor_traits::Cost, PacketAccess = false }; }; - -#ifdef EIGEN_STDEXT_SUPPORT - -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -template -struct functor_traits > > -{ enum { Cost = 0, PacketAccess = false }; }; - -template -struct functor_traits > > -{ enum { Cost = 0, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = functor_traits::Cost + functor_traits::Cost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = functor_traits::Cost + functor_traits::Cost + functor_traits::Cost, PacketAccess = false }; }; - -#endif // EIGEN_STDEXT_SUPPORT - -// allow to add new functors and specializations of functor_traits from outside Eigen. -// this macro is really needed because functor_traits must be specialized after it is declared but before it is used... -#ifdef EIGEN_FUNCTORS_PLUGIN -#include EIGEN_FUNCTORS_PLUGIN -#endif - -} // end namespace internal - -#endif // EIGEN_FUNCTORS_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Fuzzy.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Fuzzy.h index d266eed..b16b2da 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Fuzzy.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Fuzzy.h @@ -4,47 +4,37 @@ // Copyright (C) 2006-2008 Benoit Jacob // Copyright (C) 2008 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_FUZZY_H #define EIGEN_FUZZY_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { template::IsInteger> struct isApprox_selector { - static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec) + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) { - using std::min; - const typename internal::nested::type nested(x); - const typename internal::nested::type otherNested(y); - return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * (min)(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum()); + typename internal::nested_eval::type nested(x); + typename internal::nested_eval::type otherNested(y); + return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * numext::mini(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum()); } }; template struct isApprox_selector { - static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar) + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar&) { return x.matrix() == y.matrix(); } @@ -53,16 +43,18 @@ struct isApprox_selector template::IsInteger> struct isMuchSmallerThan_object_selector { - static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec) + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) { - return x.cwiseAbs2().sum() <= abs2(prec) * y.cwiseAbs2().sum(); + return x.cwiseAbs2().sum() <= numext::abs2(prec) * y.cwiseAbs2().sum(); } }; template struct isMuchSmallerThan_object_selector { - static bool run(const Derived& x, const OtherDerived&, typename Derived::RealScalar) + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived&, const typename Derived::RealScalar&) { return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); } @@ -71,16 +63,18 @@ struct isMuchSmallerThan_object_selector template::IsInteger> struct isMuchSmallerThan_scalar_selector { - static bool run(const Derived& x, const typename Derived::RealScalar& y, typename Derived::RealScalar prec) + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const typename Derived::RealScalar& y, const typename Derived::RealScalar& prec) { - return x.cwiseAbs2().sum() <= abs2(prec * y); + return x.cwiseAbs2().sum() <= numext::abs2(prec * y); } }; template struct isMuchSmallerThan_scalar_selector { - static bool run(const Derived& x, const typename Derived::RealScalar&, typename Derived::RealScalar) + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const typename Derived::RealScalar&, const typename Derived::RealScalar&) { return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); } @@ -108,9 +102,9 @@ struct isMuchSmallerThan_scalar_selector */ template template -bool DenseBase::isApprox( +EIGEN_DEVICE_FUNC bool DenseBase::isApprox( const DenseBase& other, - RealScalar prec + const RealScalar& prec ) const { return internal::isApprox_selector::run(derived(), other.derived(), prec); @@ -130,9 +124,9 @@ bool DenseBase::isApprox( * \sa isApprox(), isMuchSmallerThan(const DenseBase&, RealScalar) const */ template -bool DenseBase::isMuchSmallerThan( +EIGEN_DEVICE_FUNC bool DenseBase::isMuchSmallerThan( const typename NumTraits::Real& other, - RealScalar prec + const RealScalar& prec ) const { return internal::isMuchSmallerThan_scalar_selector::run(derived(), other, prec); @@ -150,12 +144,14 @@ bool DenseBase::isMuchSmallerThan( */ template template -bool DenseBase::isMuchSmallerThan( +EIGEN_DEVICE_FUNC bool DenseBase::isMuchSmallerThan( const DenseBase& other, - RealScalar prec + const RealScalar& prec ) const { return internal::isMuchSmallerThan_object_selector::run(derived(), other.derived(), prec); } +} // end namespace Eigen + #endif // EIGEN_FUZZY_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GeneralProduct.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GeneralProduct.h new file mode 100644 index 0000000..661a3c4 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GeneralProduct.h @@ -0,0 +1,467 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008-2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_GENERAL_PRODUCT_H +#define EIGEN_GENERAL_PRODUCT_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +enum { + Large = 2, + Small = 3 +}; + +// Define the threshold value to fallback from the generic matrix-matrix product +// implementation (heavy) to the lightweight coeff-based product one. +// See generic_product_impl +// in products/GeneralMatrixMatrix.h for more details. +// TODO This threshold should also be used in the compile-time selector below. +#ifndef EIGEN_GEMM_TO_COEFFBASED_THRESHOLD +// This default value has been obtained on a Haswell architecture. +#define EIGEN_GEMM_TO_COEFFBASED_THRESHOLD 20 +#endif + +namespace internal { + +template struct product_type_selector; + +template struct product_size_category +{ + enum { + #ifndef EIGEN_GPU_COMPILE_PHASE + is_large = MaxSize == Dynamic || + Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD || + (Size==Dynamic && MaxSize>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD), + #else + is_large = 0, + #endif + value = is_large ? Large + : Size == 1 ? 1 + : Small + }; +}; + +template struct product_type +{ + typedef remove_all_t Lhs_; + typedef remove_all_t Rhs_; + enum { + MaxRows = traits::MaxRowsAtCompileTime, + Rows = traits::RowsAtCompileTime, + MaxCols = traits::MaxColsAtCompileTime, + Cols = traits::ColsAtCompileTime, + MaxDepth = min_size_prefer_fixed(traits::MaxColsAtCompileTime, + traits::MaxRowsAtCompileTime), + Depth = min_size_prefer_fixed(traits::ColsAtCompileTime, + traits::RowsAtCompileTime) + }; + + // the splitting into different lines of code here, introducing the _select enums and the typedef below, + // is to work around an internal compiler error with gcc 4.1 and 4.2. +private: + enum { + rows_select = product_size_category::value, + cols_select = product_size_category::value, + depth_select = product_size_category::value + }; + typedef product_type_selector selector; + +public: + enum { + value = selector::ret, + ret = selector::ret + }; +#ifdef EIGEN_DEBUG_PRODUCT + static void debug() + { + EIGEN_DEBUG_VAR(Rows); + EIGEN_DEBUG_VAR(Cols); + EIGEN_DEBUG_VAR(Depth); + EIGEN_DEBUG_VAR(rows_select); + EIGEN_DEBUG_VAR(cols_select); + EIGEN_DEBUG_VAR(depth_select); + EIGEN_DEBUG_VAR(value); + } +#endif +}; + +/* The following allows to select the kind of product at compile time + * based on the three dimensions of the product. + * This is a compile time mapping from {1,Small,Large}^3 -> {product types} */ +// FIXME I'm not sure the current mapping is the ideal one. +template struct product_type_selector { enum { ret = OuterProduct }; }; +template struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template struct product_type_selector<1, N, 1> { enum { ret = LazyCoeffBasedProductMode }; }; +template struct product_type_selector<1, 1, Depth> { enum { ret = InnerProduct }; }; +template<> struct product_type_selector<1, 1, 1> { enum { ret = InnerProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector<1, Small,Small> { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector<1, Large,Small> { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector<1, Large,Large> { enum { ret = GemvProduct }; }; +template<> struct product_type_selector<1, Small,Large> { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemvProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; + +} // end namespace internal + +/*********************************************************************** +* Implementation of Inner Vector Vector Product +***********************************************************************/ + +// FIXME : maybe the "inner product" could return a Scalar +// instead of a 1x1 matrix ?? +// Pro: more natural for the user +// Cons: this could be a problem if in a meta unrolled algorithm a matrix-matrix +// product ends up to a row-vector times col-vector product... To tackle this use +// case, we could have a specialization for Block with: operator=(Scalar x); + +/*********************************************************************** +* Implementation of Outer Vector Vector Product +***********************************************************************/ + +/*********************************************************************** +* Implementation of General Matrix Vector Product +***********************************************************************/ + +/* According to the shape/flags of the matrix we have to distinghish 3 different cases: + * 1 - the matrix is col-major, BLAS compatible and M is large => call fast BLAS-like colmajor routine + * 2 - the matrix is row-major, BLAS compatible and N is large => call fast BLAS-like rowmajor routine + * 3 - all other cases are handled using a simple loop along the outer-storage direction. + * Therefore we need a lower level meta selector. + * Furthermore, if the matrix is the rhs, then the product has to be transposed. + */ +namespace internal { + +template +struct gemv_dense_selector; + +} // end namespace internal + +namespace internal { + +template struct gemv_static_vector_if; + +template +struct gemv_static_vector_if +{ + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; } +}; + +template +struct gemv_static_vector_if +{ + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar* data() { return 0; } +}; + +template +struct gemv_static_vector_if +{ + enum { + ForceAlignment = internal::packet_traits::Vectorizable, + PacketSize = internal::packet_traits::size + }; + #if EIGEN_MAX_STATIC_ALIGN_BYTES!=0 + internal::plain_array m_data; + EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; } + #else + // Some architectures cannot align on the stack, + // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. + internal::plain_array m_data; + EIGEN_STRONG_INLINE Scalar* data() { + return ForceAlignment + ? reinterpret_cast((internal::UIntPtr(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES-1))) + EIGEN_MAX_ALIGN_BYTES) + : m_data.array; + } + #endif +}; + +// The vector is on the left => transposition +template +struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + Transpose destT(dest); + enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor }; + gemv_dense_selector + ::run(rhs.transpose(), lhs.transpose(), destT, alpha); + } +}; + +template<> struct gemv_dense_selector +{ + template + static inline void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + typedef typename Lhs::Scalar LhsScalar; + typedef typename Rhs::Scalar RhsScalar; + typedef typename Dest::Scalar ResScalar; + + typedef internal::blas_traits LhsBlasTraits; + typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; + typedef internal::blas_traits RhsBlasTraits; + typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; + + typedef Map, plain_enum_min(AlignedMax, internal::packet_traits::size)> MappedDest; + + ActualLhsType actualLhs = LhsBlasTraits::extract(lhs); + ActualRhsType actualRhs = RhsBlasTraits::extract(rhs); + + ResScalar actualAlpha = combine_scalar_factors(alpha, lhs, rhs); + + // make sure Dest is a compile-time vector type (bug 1166) + typedef std::conditional_t ActualDest; + + enum { + // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 + // on, the other hand it is good for the cache to pack the vector anyways... + EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime==1), + ComplexByReal = (NumTraits::IsComplex) && (!NumTraits::IsComplex), + MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime!=0) + }; + + typedef const_blas_data_mapper LhsMapper; + typedef const_blas_data_mapper RhsMapper; + RhsScalar compatibleAlpha = get_factor::run(actualAlpha); + + if(!MightCannotUseDest) + { + // shortcut if we are sure to be able to use dest directly, + // this ease the compiler to generate cleaner and more optimzized code for most common cases + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhs.data(), actualRhs.innerStride()), + dest.data(), 1, + compatibleAlpha); + } + else + { + gemv_static_vector_if static_dest; + + const bool alphaIsCompatible = (!ComplexByReal) || (numext::is_exactly_zero(numext::imag(actualAlpha))); + const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; + + ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(), + evalToDest ? dest.data() : static_dest.data()); + + if(!evalToDest) + { + #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + Index size = dest.size(); + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #endif + if(!alphaIsCompatible) + { + MappedDest(actualDestPtr, dest.size()).setZero(); + compatibleAlpha = RhsScalar(1); + } + else + MappedDest(actualDestPtr, dest.size()) = dest; + } + + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhs.data(), actualRhs.innerStride()), + actualDestPtr, 1, + compatibleAlpha); + + if (!evalToDest) + { + if(!alphaIsCompatible) + dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size()); + else + dest = MappedDest(actualDestPtr, dest.size()); + } + } + } +}; + +template<> struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + typedef typename Lhs::Scalar LhsScalar; + typedef typename Rhs::Scalar RhsScalar; + typedef typename Dest::Scalar ResScalar; + + typedef internal::blas_traits LhsBlasTraits; + typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; + typedef internal::blas_traits RhsBlasTraits; + typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; + typedef internal::remove_all_t ActualRhsTypeCleaned; + + std::add_const_t actualLhs = LhsBlasTraits::extract(lhs); + std::add_const_t actualRhs = RhsBlasTraits::extract(rhs); + + ResScalar actualAlpha = combine_scalar_factors(alpha, lhs, rhs); + + enum { + // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 + // on, the other hand it is good for the cache to pack the vector anyways... + DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1 || ActualRhsTypeCleaned::MaxSizeAtCompileTime==0 + }; + + gemv_static_vector_if static_rhs; + + ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(), + DirectlyUseRhs ? const_cast(actualRhs.data()) : static_rhs.data()); + + if(!DirectlyUseRhs) + { + #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + Index size = actualRhs.size(); + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #endif + Map(actualRhsPtr, actualRhs.size()) = actualRhs; + } + + typedef const_blas_data_mapper LhsMapper; + typedef const_blas_data_mapper RhsMapper; + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhsPtr, 1), + dest.data(), dest.col(0).innerStride(), //NOTE if dest is not a vector at compile-time, then dest.innerStride() might be wrong. (bug 1166) + actualAlpha); + } +}; + +template<> struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + EIGEN_STATIC_ASSERT((!nested_eval::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE); + // TODO if rhs is large enough it might be beneficial to make sure that dest is sequentially stored in memory, otherwise use a temp + typename nested_eval::type actual_rhs(rhs); + const Index size = rhs.rows(); + for(Index k=0; k struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + EIGEN_STATIC_ASSERT((!nested_eval::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE); + typename nested_eval::type actual_rhs(rhs); + const Index rows = dest.rows(); + for(Index i=0; i +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +const Product +MatrixBase::operator*(const MatrixBase &other) const +{ + // A note regarding the function declaration: In MSVC, this function will sometimes + // not be inlined since DenseStorage is an unwindable object for dynamic + // matrices and product types are holding a member to store the result. + // Thus it does not help tagging this function with EIGEN_STRONG_INLINE. + enum { + ProductIsValid = Derived::ColsAtCompileTime==Dynamic + || OtherDerived::RowsAtCompileTime==Dynamic + || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime), + AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime, + SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived) + }; + // note to the lost user: + // * for a dot product use: v1.dot(v2) + // * for a coeff-wise product use: v1.cwiseProduct(v2) + EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes), + INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS) + EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors), + INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION) + EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT) +#ifdef EIGEN_DEBUG_PRODUCT + internal::product_type::debug(); +#endif + + return Product(derived(), other.derived()); +} + +/** \returns an expression of the matrix product of \c *this and \a other without implicit evaluation. + * + * The returned product will behave like any other expressions: the coefficients of the product will be + * computed once at a time as requested. This might be useful in some extremely rare cases when only + * a small and no coherent fraction of the result's coefficients have to be computed. + * + * \warning This version of the matrix product can be much much slower. So use it only if you know + * what you are doing and that you measured a true speed improvement. + * + * \sa operator*(const MatrixBase&) + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +const Product +MatrixBase::lazyProduct(const MatrixBase &other) const +{ + enum { + ProductIsValid = Derived::ColsAtCompileTime==Dynamic + || OtherDerived::RowsAtCompileTime==Dynamic + || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime), + AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime, + SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived) + }; + // note to the lost user: + // * for a dot product use: v1.dot(v2) + // * for a coeff-wise product use: v1.cwiseProduct(v2) + EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes), + INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS) + EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors), + INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION) + EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT) + + return Product(derived(), other.derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_PRODUCT_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GenericPacketMath.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GenericPacketMath.h index 8ed8353..8119200 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GenericPacketMath.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GenericPacketMath.h @@ -4,28 +4,17 @@ // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_GENERIC_PACKET_MATH_H #define EIGEN_GENERIC_PACKET_MATH_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { /** \internal @@ -55,21 +44,35 @@ namespace internal { struct default_packet_traits { enum { - HasAdd = 1, - HasSub = 1, - HasMul = 1, - HasNegate = 1, - HasAbs = 1, - HasAbs2 = 1, - HasMin = 1, - HasMax = 1, - HasConj = 1, + HasHalfPacket = 0, + + HasAdd = 1, + HasSub = 1, + HasShift = 1, + HasMul = 1, + HasNegate = 1, + HasAbs = 1, + HasArg = 0, + HasAbs2 = 1, + HasAbsDiff = 0, + HasMin = 1, + HasMax = 1, + HasConj = 1, HasSetLinear = 1, + HasBlend = 0, + // This flag is used to indicate whether packet comparison is supported. + // pcmp_eq, pcmp_lt and pcmp_le should be defined for it to be true. + HasCmp = 0, HasDiv = 0, + HasReciprocal = 0, HasSqrt = 0, + HasRsqrt = 0, HasExp = 0, + HasExpm1 = 0, HasLog = 0, + HasLog1p = 0, + HasLog10 = 0, HasPow = 0, HasSin = 0, @@ -77,17 +80,41 @@ struct default_packet_traits HasTan = 0, HasASin = 0, HasACos = 0, - HasATan = 0 + HasATan = 0, + HasSinh = 0, + HasCosh = 0, + HasTanh = 0, + HasLGamma = 0, + HasDiGamma = 0, + HasZeta = 0, + HasPolygamma = 0, + HasErf = 0, + HasErfc = 0, + HasNdtri = 0, + HasBessel = 0, + HasIGamma = 0, + HasIGammaDerA = 0, + HasGammaSampleDerAlpha = 0, + HasIGammac = 0, + HasBetaInc = 0, + + HasRound = 0, + HasRint = 0, + HasFloor = 0, + HasCeil = 0, + HasSign = 0 }; }; template struct packet_traits : default_packet_traits { typedef T type; + typedef T half; enum { Vectorizable = 0, size = 1, - AlignedOnScalar = 0 + AlignedOnScalar = 0, + HasHalfPacket = 0 }; enum { HasAdd = 0, @@ -103,132 +130,708 @@ template struct packet_traits : default_packet_traits }; }; +template struct packet_traits : packet_traits { }; + +template struct unpacket_traits +{ + typedef T type; + typedef T half; + enum + { + size = 1, + alignment = 1, + vectorizable = false, + masked_load_available=false, + masked_store_available=false + }; +}; + +template struct unpacket_traits : unpacket_traits { }; + +template struct type_casting_traits { + enum { + VectorizedCast = 0, + SrcCoeffRatio = 1, + TgtCoeffRatio = 1 + }; +}; + +/** \internal Wrapper to ensure that multiple packet types can map to the same + same underlying vector type. */ +template +struct eigen_packet_wrapper +{ + EIGEN_ALWAYS_INLINE operator T&() { return m_val; } + EIGEN_ALWAYS_INLINE operator const T&() const { return m_val; } + EIGEN_ALWAYS_INLINE eigen_packet_wrapper() = default; + EIGEN_ALWAYS_INLINE eigen_packet_wrapper(const T &v) : m_val(v) {} + EIGEN_ALWAYS_INLINE eigen_packet_wrapper& operator=(const T &v) { + m_val = v; + return *this; + } + + T m_val; +}; + + +/** \internal A convenience utility for determining if the type is a scalar. + * This is used to enable some generic packet implementations. + */ +template +struct is_scalar { + typedef typename unpacket_traits::type Scalar; + enum { + value = internal::is_same::value + }; +}; + +/** \internal \returns static_cast(a) (coeff-wise) */ +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a) { + return static_cast(a); +} +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/) { + return static_cast(a); +} +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/) { + return static_cast(a); +} +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/, + const SrcPacket& /*e*/, const SrcPacket& /*f*/, const SrcPacket& /*g*/, const SrcPacket& /*h*/) { + return static_cast(a); +} + +/** \internal \returns reinterpret_cast(a) */ +template +EIGEN_DEVICE_FUNC inline Target +preinterpret(const Packet& a); /* { return reinterpret_cast(a); } */ + /** \internal \returns a + b (coeff-wise) */ -template inline Packet -padd(const Packet& a, - const Packet& b) { return a+b; } +template EIGEN_DEVICE_FUNC inline Packet +padd(const Packet& a, const Packet& b) { return a+b; } +// Avoid compiler warning for boolean algebra. +template<> EIGEN_DEVICE_FUNC inline bool +padd(const bool& a, const bool& b) { return a || b; } + +/** \internal \returns a packet version of \a *from, (un-aligned masked add) + * There is no generic implementation. We only have implementations for specialized + * cases. Generic case should not be called. + */ +template EIGEN_DEVICE_FUNC inline +std::enable_if_t::masked_fpops_available, Packet> +padd(const Packet& a, const Packet& b, typename unpacket_traits::mask_t umask); + /** \internal \returns a - b (coeff-wise) */ -template inline Packet -psub(const Packet& a, - const Packet& b) { return a-b; } +template EIGEN_DEVICE_FUNC inline Packet +psub(const Packet& a, const Packet& b) { return a-b; } /** \internal \returns -a (coeff-wise) */ -template inline Packet +template EIGEN_DEVICE_FUNC inline Packet pnegate(const Packet& a) { return -a; } +template<> EIGEN_DEVICE_FUNC inline bool +pnegate(const bool& a) { return !a; } + /** \internal \returns conj(a) (coeff-wise) */ -template inline Packet -pconj(const Packet& a) { return conj(a); } +template EIGEN_DEVICE_FUNC inline Packet +pconj(const Packet& a) { return numext::conj(a); } /** \internal \returns a * b (coeff-wise) */ -template inline Packet -pmul(const Packet& a, - const Packet& b) { return a*b; } +template EIGEN_DEVICE_FUNC inline Packet +pmul(const Packet& a, const Packet& b) { return a*b; } +// Avoid compiler warning for boolean algebra. +template<> EIGEN_DEVICE_FUNC inline bool +pmul(const bool& a, const bool& b) { return a && b; } /** \internal \returns a / b (coeff-wise) */ -template inline Packet -pdiv(const Packet& a, - const Packet& b) { return a/b; } +template EIGEN_DEVICE_FUNC inline Packet +pdiv(const Packet& a, const Packet& b) { return a/b; } -/** \internal \returns the min of \a a and \a b (coeff-wise) */ -template inline Packet -pmin(const Packet& a, - const Packet& b) { using std::min; return (min)(a, b); } +// In the generic case, memset to all one bits. +template +struct ptrue_impl { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& /*a*/){ + Packet b; + memset(static_cast(&b), 0xff, sizeof(Packet)); + return b; + } +}; -/** \internal \returns the max of \a a and \a b (coeff-wise) */ -template inline Packet -pmax(const Packet& a, - const Packet& b) { using std::max; return (max)(a, b); } +// For non-trivial scalars, set to Scalar(1) (i.e. a non-zero value). +// Although this is technically not a valid bitmask, the scalar path for pselect +// uses a comparison to zero, so this should still work in most cases. We don't +// have another option, since the scalar type requires initialization. +template +struct ptrue_impl::value && NumTraits::RequireInitialization> > { + static EIGEN_DEVICE_FUNC inline T run(const T& /*a*/){ + return T(1); + } +}; -/** \internal \returns the absolute value of \a a */ -template inline Packet -pabs(const Packet& a) { return abs(a); } +/** \internal \returns one bits. */ +template EIGEN_DEVICE_FUNC inline Packet +ptrue(const Packet& a) { + return ptrue_impl::run(a); +} + +// In the general case, memset to zero. +template +struct pzero_impl { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& /*a*/) { + Packet b; + memset(static_cast(&b), 0x00, sizeof(Packet)); + return b; + } +}; + +// For scalars, explicitly set to Scalar(0), since the underlying representation +// for zero may not consist of all-zero bits. +template +struct pzero_impl::value>> { + static EIGEN_DEVICE_FUNC inline T run(const T& /*a*/) { + return T(0); + } +}; + +/** \internal \returns packet of zeros */ +template EIGEN_DEVICE_FUNC inline Packet +pzero(const Packet& a) { + return pzero_impl::run(a); +} + +/** \internal \returns a <= b as a bit mask */ +template EIGEN_DEVICE_FUNC inline Packet +pcmp_le(const Packet& a, const Packet& b) { return a<=b ? ptrue(a) : pzero(a); } + +/** \internal \returns a < b as a bit mask */ +template EIGEN_DEVICE_FUNC inline Packet +pcmp_lt(const Packet& a, const Packet& b) { return a EIGEN_DEVICE_FUNC inline Packet +pcmp_eq(const Packet& a, const Packet& b) { return a==b ? ptrue(a) : pzero(a); } + +/** \internal \returns a < b or a==NaN or b==NaN as a bit mask */ +template EIGEN_DEVICE_FUNC inline Packet +pcmp_lt_or_nan(const Packet& a, const Packet& b) { return a>=b ? pzero(a) : ptrue(a); } + +template +struct bit_and { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a & b; + } +}; + +template +struct bit_or { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a | b; + } +}; + +template +struct bit_xor { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a ^ b; + } +}; + +template +struct bit_not { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a) const { + return ~a; + } +}; + +// Use operators &, |, ^, ~. +template +struct operator_bitwise_helper { + EIGEN_DEVICE_FUNC static inline T bitwise_and(const T& a, const T& b) { return bit_and()(a, b); } + EIGEN_DEVICE_FUNC static inline T bitwise_or(const T& a, const T& b) { return bit_or()(a, b); } + EIGEN_DEVICE_FUNC static inline T bitwise_xor(const T& a, const T& b) { return bit_xor()(a, b); } + EIGEN_DEVICE_FUNC static inline T bitwise_not(const T& a) { return bit_not()(a); } +}; + +// Apply binary operations byte-by-byte +template +struct bytewise_bitwise_helper { + EIGEN_DEVICE_FUNC static inline T bitwise_and(const T& a, const T& b) { + return binary(a, b, bit_and()); + } + EIGEN_DEVICE_FUNC static inline T bitwise_or(const T& a, const T& b) { + return binary(a, b, bit_or()); + } + EIGEN_DEVICE_FUNC static inline T bitwise_xor(const T& a, const T& b) { + return binary(a, b, bit_xor()); + } + EIGEN_DEVICE_FUNC static inline T bitwise_not(const T& a) { + return unary(a,bit_not()); + } + + private: + template + EIGEN_DEVICE_FUNC static inline T unary(const T& a, Op op) { + const unsigned char* a_ptr = reinterpret_cast(&a); + T c; + unsigned char* c_ptr = reinterpret_cast(&c); + for (size_t i = 0; i < sizeof(T); ++i) { + *c_ptr++ = op(*a_ptr++); + } + return c; + } + + template + EIGEN_DEVICE_FUNC static inline T binary(const T& a, const T& b, Op op) { + const unsigned char* a_ptr = reinterpret_cast(&a); + const unsigned char* b_ptr = reinterpret_cast(&b); + T c; + unsigned char* c_ptr = reinterpret_cast(&c); + for (size_t i = 0; i < sizeof(T); ++i) { + *c_ptr++ = op(*a_ptr++, *b_ptr++); + } + return c; + } +}; + +// In the general case, use byte-by-byte manipulation. +template +struct bitwise_helper : public bytewise_bitwise_helper {}; + +// For integers or non-trivial scalars, use binary operators. +template +struct bitwise_helper::value && (NumTraits::IsInteger || NumTraits::RequireInitialization)> + > : public operator_bitwise_helper {}; /** \internal \returns the bitwise and of \a a and \a b */ -template inline Packet -pand(const Packet& a, const Packet& b) { return a & b; } +template EIGEN_DEVICE_FUNC inline Packet +pand(const Packet& a, const Packet& b) { + return bitwise_helper::bitwise_and(a, b); +} /** \internal \returns the bitwise or of \a a and \a b */ -template inline Packet -por(const Packet& a, const Packet& b) { return a | b; } +template EIGEN_DEVICE_FUNC inline Packet +por(const Packet& a, const Packet& b) { + return bitwise_helper::bitwise_or(a, b); +} /** \internal \returns the bitwise xor of \a a and \a b */ -template inline Packet -pxor(const Packet& a, const Packet& b) { return a ^ b; } +template EIGEN_DEVICE_FUNC inline Packet +pxor(const Packet& a, const Packet& b) { + return bitwise_helper::bitwise_xor(a, b); +} + +/** \internal \returns the bitwise not of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +pnot(const Packet& a) { + return bitwise_helper::bitwise_not(a); +} + +/** \internal \returns the bitwise and of \a a and not \a b */ +template EIGEN_DEVICE_FUNC inline Packet +pandnot(const Packet& a, const Packet& b) { return pand(a, pnot(b)); } + +// In the general case, use bitwise select. +template +struct pselect_impl { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) { + return por(pand(a,mask),pandnot(b,mask)); + } +}; + +// For scalars, use ternary select. +template +struct pselect_impl::value> > { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) { + return numext::equal_strict(mask, Packet(0)) ? b : a; + } +}; + +/** \internal \returns \a or \b for each field in packet according to \mask */ +template EIGEN_DEVICE_FUNC inline Packet +pselect(const Packet& mask, const Packet& a, const Packet& b) { + return pselect_impl::run(mask, a, b); +} + +template<> EIGEN_DEVICE_FUNC inline bool pselect( + const bool& cond, const bool& a, const bool& b) { + return cond ? a : b; +} + +/** \internal \returns the min or of \a a and \a b (coeff-wise) + If either \a a or \a b are NaN, the result is implementation defined. */ +template +struct pminmax_impl { + template + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) { + return op(a,b); + } +}; + +/** \internal \returns the min or max of \a a and \a b (coeff-wise) + If either \a a or \a b are NaN, NaN is returned. */ +template<> +struct pminmax_impl { + template + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) { + Packet not_nan_mask_a = pcmp_eq(a, a); + Packet not_nan_mask_b = pcmp_eq(b, b); + return pselect(not_nan_mask_a, + pselect(not_nan_mask_b, op(a, b), b), + a); + } +}; + +/** \internal \returns the min or max of \a a and \a b (coeff-wise) + If both \a a and \a b are NaN, NaN is returned. + Equivalent to std::fmin(a, b). */ +template<> +struct pminmax_impl { + template + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) { + Packet not_nan_mask_a = pcmp_eq(a, a); + Packet not_nan_mask_b = pcmp_eq(b, b); + return pselect(not_nan_mask_a, + pselect(not_nan_mask_b, op(a, b), a), + b); + } +}; + + +#ifndef SYCL_DEVICE_ONLY +#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) Func +#else +#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) \ +[](const Type& a, const Type& b) { \ + return Func(a, b);} +#endif + +/** \internal \returns the min of \a a and \a b (coeff-wise). + If \a a or \b b is NaN, the return value is implementation defined. */ +template EIGEN_DEVICE_FUNC inline Packet +pmin(const Packet& a, const Packet& b) { return numext::mini(a,b); } + +/** \internal \returns the min of \a a and \a b (coeff-wise). + NaNPropagation determines the NaN propagation semantics. */ +template +EIGEN_DEVICE_FUNC inline Packet pmin(const Packet& a, const Packet& b) { + return pminmax_impl::run(a, b, EIGEN_BINARY_OP_NAN_PROPAGATION(Packet, (pmin))); +} + +/** \internal \returns the max of \a a and \a b (coeff-wise) + If \a a or \b b is NaN, the return value is implementation defined. */ +template EIGEN_DEVICE_FUNC inline Packet +pmax(const Packet& a, const Packet& b) { return numext::maxi(a, b); } + +/** \internal \returns the max of \a a and \a b (coeff-wise). + NaNPropagation determines the NaN propagation semantics. */ +template +EIGEN_DEVICE_FUNC inline Packet pmax(const Packet& a, const Packet& b) { + return pminmax_impl::run(a, b, EIGEN_BINARY_OP_NAN_PROPAGATION(Packet,(pmax))); +} + +/** \internal \returns the absolute value of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +pabs(const Packet& a) { return numext::abs(a); } +template<> EIGEN_DEVICE_FUNC inline unsigned int +pabs(const unsigned int& a) { return a; } +template<> EIGEN_DEVICE_FUNC inline unsigned long +pabs(const unsigned long& a) { return a; } +template<> EIGEN_DEVICE_FUNC inline unsigned long long +pabs(const unsigned long long& a) { return a; } + +/** \internal \returns the addsub value of \a a,b */ +template EIGEN_DEVICE_FUNC inline Packet +paddsub(const Packet& a, const Packet& b) { + return pselect(peven_mask(a), padd(a, b), psub(a, b)); + } + +/** \internal \returns the phase angle of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +parg(const Packet& a) { using numext::arg; return arg(a); } + + +/** \internal \returns \a a logically shifted by N bits to the right */ +template EIGEN_DEVICE_FUNC inline int +parithmetic_shift_right(const int& a) { return a >> N; } +template EIGEN_DEVICE_FUNC inline long int +parithmetic_shift_right(const long int& a) { return a >> N; } -/** \internal \returns the bitwise andnot of \a a and \a b */ -template inline Packet -pandnot(const Packet& a, const Packet& b) { return a & (!b); } +/** \internal \returns \a a arithmetically shifted by N bits to the right */ +template EIGEN_DEVICE_FUNC inline int +plogical_shift_right(const int& a) { return static_cast(static_cast(a) >> N); } +template EIGEN_DEVICE_FUNC inline long int +plogical_shift_right(const long int& a) { return static_cast(static_cast(a) >> N); } + +/** \internal \returns \a a shifted by N bits to the left */ +template EIGEN_DEVICE_FUNC inline int +plogical_shift_left(const int& a) { return a << N; } +template EIGEN_DEVICE_FUNC inline long int +plogical_shift_left(const long int& a) { return a << N; } + +/** \internal \returns the significant and exponent of the underlying floating point numbers + * See https://en.cppreference.com/w/cpp/numeric/math/frexp + */ +template +EIGEN_DEVICE_FUNC inline Packet pfrexp(const Packet& a, Packet& exponent) { + int exp; + EIGEN_USING_STD(frexp); + Packet result = static_cast(frexp(a, &exp)); + exponent = static_cast(exp); + return result; +} -/** \internal \returns a packet version of \a *from, from must be 16 bytes aligned */ -template inline Packet +/** \internal \returns a * 2^((int)exponent) + * See https://en.cppreference.com/w/cpp/numeric/math/ldexp + */ +template EIGEN_DEVICE_FUNC inline Packet +pldexp(const Packet &a, const Packet &exponent) { + EIGEN_USING_STD(ldexp) + return static_cast(ldexp(a, static_cast(exponent))); +} + +/** \internal \returns the min of \a a and \a b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pabsdiff(const Packet& a, const Packet& b) { return pselect(pcmp_lt(a, b), psub(b, a), psub(a, b)); } + +/** \internal \returns a packet version of \a *from, from must be properly aligned */ +template EIGEN_DEVICE_FUNC inline Packet pload(const typename unpacket_traits::type* from) { return *from; } +/** \internal \returns n elements of a packet version of \a *from, from must be properly aligned + * offset indicates the starting element in which to load and + * offset + n <= unpacket_traits::size + * All elements before offset and after the last element loaded will initialized with zero */ +template EIGEN_DEVICE_FUNC inline Packet +pload_partial(const typename unpacket_traits::type* from, const Index n, const Index offset = 0) +{ + const Index packet_size = unpacket_traits::size; + eigen_assert(n + offset <= packet_size && "number of elements plus offset will read past end of packet"); + typedef typename unpacket_traits::type Scalar; + EIGEN_ALIGN_MAX Scalar elements[packet_size] = { Scalar(0) }; + for (Index i = offset; i < numext::mini(n+offset,packet_size); i++) { + elements[i] = from[i-offset]; + } + return pload(elements); +} + /** \internal \returns a packet version of \a *from, (un-aligned load) */ -template inline Packet +template EIGEN_DEVICE_FUNC inline Packet ploadu(const typename unpacket_traits::type* from) { return *from; } -/** \internal \returns a packet with elements of \a *from duplicated, e.g.: (from[0],from[0],from[1],from[1]) */ -template inline Packet -ploaddup(const typename unpacket_traits::type* from) { return *from; } +/** \internal \returns n elements of a packet version of \a *from, (un-aligned load) + * All elements after the last element loaded will initialized with zero */ +template EIGEN_DEVICE_FUNC inline Packet +ploadu_partial(const typename unpacket_traits::type* from, const Index n) +{ + const Index packet_size = unpacket_traits::size; + eigen_assert(n <= packet_size && "number of elements will read past end of packet"); + typedef typename unpacket_traits::type Scalar; + EIGEN_ALIGN_MAX Scalar elements[packet_size] = { Scalar(0) }; + for (Index i = 0; i < numext::mini(n,packet_size); i++) { + elements[i] = from[i]; + } + return pload(elements); +} + +/** \internal \returns a packet version of \a *from, (un-aligned masked load) + * There is no generic implementation. We only have implementations for specialized + * cases. Generic case should not be called. + */ +template EIGEN_DEVICE_FUNC inline +std::enable_if_t::masked_load_available, Packet> +ploadu(const typename unpacket_traits::type* from, typename unpacket_traits::mask_t umask); /** \internal \returns a packet with constant coefficients \a a, e.g.: (a,a,a,a) */ -template inline Packet +template EIGEN_DEVICE_FUNC inline Packet pset1(const typename unpacket_traits::type& a) { return a; } +/** \internal \returns a packet with constant coefficients set from bits */ +template EIGEN_DEVICE_FUNC inline Packet +pset1frombits(BitsType a); + +/** \internal \returns a packet with constant coefficients \a a[0], e.g.: (a[0],a[0],a[0],a[0]) */ +template EIGEN_DEVICE_FUNC inline Packet +pload1(const typename unpacket_traits::type *a) { return pset1(*a); } + +/** \internal \returns a packet with elements of \a *from duplicated. + * For instance, for a packet of 8 elements, 4 scalars will be read from \a *from and + * duplicated to form: {from[0],from[0],from[1],from[1],from[2],from[2],from[3],from[3]} + * Currently, this function is only used for scalar * complex products. + */ +template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet +ploaddup(const typename unpacket_traits::type* from) { return *from; } + +/** \internal \returns a packet with elements of \a *from quadrupled. + * For instance, for a packet of 8 elements, 2 scalars will be read from \a *from and + * replicated to form: {from[0],from[0],from[0],from[0],from[1],from[1],from[1],from[1]} + * Currently, this function is only used in matrix products. + * For packet-size smaller or equal to 4, this function is equivalent to pload1 + */ +template EIGEN_DEVICE_FUNC inline Packet +ploadquad(const typename unpacket_traits::type* from) +{ return pload1(from); } + +/** \internal equivalent to + * \code + * a0 = pload1(a+0); + * a1 = pload1(a+1); + * a2 = pload1(a+2); + * a3 = pload1(a+3); + * \endcode + * \sa pset1, pload1, ploaddup, pbroadcast2 + */ +template EIGEN_DEVICE_FUNC +inline void pbroadcast4(const typename unpacket_traits::type *a, + Packet& a0, Packet& a1, Packet& a2, Packet& a3) +{ + a0 = pload1(a+0); + a1 = pload1(a+1); + a2 = pload1(a+2); + a3 = pload1(a+3); +} + +/** \internal equivalent to + * \code + * a0 = pload1(a+0); + * a1 = pload1(a+1); + * \endcode + * \sa pset1, pload1, ploaddup, pbroadcast4 + */ +template EIGEN_DEVICE_FUNC +inline void pbroadcast2(const typename unpacket_traits::type *a, + Packet& a0, Packet& a1) +{ + a0 = pload1(a+0); + a1 = pload1(a+1); +} + /** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */ -template inline typename packet_traits::type -plset(const Scalar& a) { return a; } +template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet +plset(const typename unpacket_traits::type& a) { return a; } + +/** \internal \returns a packet with constant coefficients \a a, e.g.: (x, 0, x, 0), + where x is the value of all 1-bits. */ +template EIGEN_DEVICE_FUNC inline Packet +peven_mask(const Packet& /*a*/) { + typedef typename unpacket_traits::type Scalar; + const size_t n = unpacket_traits::size; + EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; + for(size_t i = 0; i < n; ++i) { + memset(elements+i, ((i & 1) == 0 ? 0xff : 0), sizeof(Scalar)); + } + return ploadu(elements); +} -/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */ -template inline void pstore(Scalar* to, const Packet& from) + +/** \internal copy the packet \a from to \a *to, \a to must be properly aligned */ +template EIGEN_DEVICE_FUNC inline void pstore(Scalar* to, const Packet& from) { (*to) = from; } +/** \internal copy n elements of the packet \a from to \a *to, \a to must be properly aligned + * offset indicates the starting element in which to store and + * offset + n <= unpacket_traits::size */ +template EIGEN_DEVICE_FUNC inline void pstore_partial(Scalar* to, const Packet& from, const Index n, const Index offset = 0) +{ + const Index packet_size = unpacket_traits::size; + eigen_assert(n + offset <= packet_size && "number of elements plus offset will write past end of packet"); + EIGEN_ALIGN_MAX Scalar elements[packet_size]; + pstore(elements, from); + for (Index i = 0; i < numext::mini(n,packet_size-offset); i++) { + to[i] = elements[i + offset]; + } +} + /** \internal copy the packet \a from to \a *to, (un-aligned store) */ -template inline void pstoreu(Scalar* to, const Packet& from) -{ (*to) = from; } +template EIGEN_DEVICE_FUNC inline void pstoreu(Scalar* to, const Packet& from) +{ (*to) = from; } -/** \internal tries to do cache prefetching of \a addr */ -template inline void prefetch(const Scalar* addr) +/** \internal copy n elements of the packet \a from to \a *to, (un-aligned store) */ +template EIGEN_DEVICE_FUNC inline void pstoreu_partial(Scalar* to, const Packet& from, const Index n) { -#if !defined(_MSC_VER) -__builtin_prefetch(addr); -#endif + const Index packet_size = unpacket_traits::size; + eigen_assert(n <= packet_size && "number of elements will write past end of packet"); + EIGEN_ALIGN_MAX Scalar elements[packet_size]; + pstore(elements, from); + for (Index i = 0; i < numext::mini(n,packet_size); i++) { + to[i] = elements[i]; + } } -/** \internal \returns the first element of a packet */ -template inline typename unpacket_traits::type pfirst(const Packet& a) -{ return a; } +/** \internal copy the packet \a from to \a *to, (un-aligned store with a mask) + * There is no generic implementation. We only have implementations for specialized + * cases. Generic case should not be called. + */ +template +EIGEN_DEVICE_FUNC inline +std::enable_if_t::masked_store_available, void> +pstoreu(Scalar* to, const Packet& from, typename unpacket_traits::mask_t umask); -/** \internal \returns a packet where the element i contains the sum of the packet of \a vec[i] */ -template inline Packet -preduxp(const Packet* vecs) { return vecs[0]; } +template EIGEN_DEVICE_FUNC inline Packet pgather(const Scalar* from, Index /*stride*/) +{ return ploadu(from); } -/** \internal \returns the sum of the elements of \a a*/ -template inline typename unpacket_traits::type predux(const Packet& a) -{ return a; } +template EIGEN_DEVICE_FUNC inline Packet pgather_partial(const Scalar* from, Index stride, const Index n) +{ + const Index packet_size = unpacket_traits::size; + EIGEN_ALIGN_MAX Scalar elements[packet_size] = { Scalar(0) }; + for (Index i = 0; i < numext::mini(n,packet_size); i++) { + elements[i] = from[i*stride]; + } + return pload(elements); +} -/** \internal \returns the product of the elements of \a a*/ -template inline typename unpacket_traits::type predux_mul(const Packet& a) -{ return a; } +template EIGEN_DEVICE_FUNC inline void pscatter(Scalar* to, const Packet& from, Index /*stride*/) +{ pstore(to, from); } -/** \internal \returns the min of the elements of \a a*/ -template inline typename unpacket_traits::type predux_min(const Packet& a) -{ return a; } +template EIGEN_DEVICE_FUNC inline void pscatter_partial(Scalar* to, const Packet& from, Index stride, const Index n) +{ + const Index packet_size = unpacket_traits::size; + EIGEN_ALIGN_MAX Scalar elements[packet_size]; + pstore(elements, from); + for (Index i = 0; i < numext::mini(n,packet_size); i++) { + to[i*stride] = elements[i]; + } +} -/** \internal \returns the max of the elements of \a a*/ -template inline typename unpacket_traits::type predux_max(const Packet& a) -{ return a; } +/** \internal tries to do cache prefetching of \a addr */ +template EIGEN_DEVICE_FUNC inline void prefetch(const Scalar* addr) +{ +#if defined(EIGEN_HIP_DEVICE_COMPILE) + // do nothing +#elif defined(EIGEN_CUDA_ARCH) +#if defined(__LP64__) || EIGEN_OS_WIN64 + // 64-bit pointer operand constraint for inlined asm + asm(" prefetch.L1 [ %1 ];" : "=l"(addr) : "l"(addr)); +#else + // 32-bit pointer operand constraint for inlined asm + asm(" prefetch.L1 [ %1 ];" : "=r"(addr) : "r"(addr)); +#endif +#elif (!EIGEN_COMP_MSVC) && (EIGEN_COMP_GNUC || EIGEN_COMP_CLANG || EIGEN_COMP_ICC) + __builtin_prefetch(addr); +#endif +} /** \internal \returns the reversed elements of \a a*/ -template inline Packet preverse(const Packet& a) +template EIGEN_DEVICE_FUNC inline Packet preverse(const Packet& a) { return a; } - /** \internal \returns \a a with real and imaginary part flipped (for complex type only) */ -template inline Packet pcplxflip(const Packet& a) -{ return Packet(imag(a),real(a)); } +template EIGEN_DEVICE_FUNC inline Packet pcplxflip(const Packet& a) +{ + return Packet(numext::imag(a),numext::real(a)); +} /************************** * Special math functions @@ -236,41 +839,223 @@ template inline Packet pcplxflip(const Packet& a) /** \internal \returns the sine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet psin(const Packet& a) { return sin(a); } +Packet psin(const Packet& a) { EIGEN_USING_STD(sin); return sin(a); } /** \internal \returns the cosine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pcos(const Packet& a) { return cos(a); } +Packet pcos(const Packet& a) { EIGEN_USING_STD(cos); return cos(a); } /** \internal \returns the tan of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet ptan(const Packet& a) { return tan(a); } +Packet ptan(const Packet& a) { EIGEN_USING_STD(tan); return tan(a); } /** \internal \returns the arc sine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pasin(const Packet& a) { return asin(a); } +Packet pasin(const Packet& a) { EIGEN_USING_STD(asin); return asin(a); } /** \internal \returns the arc cosine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pacos(const Packet& a) { return acos(a); } +Packet pacos(const Packet& a) { EIGEN_USING_STD(acos); return acos(a); } + +/** \internal \returns the arc tangent of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet patan(const Packet& a) { EIGEN_USING_STD(atan); return atan(a); } + +/** \internal \returns the hyperbolic sine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet psinh(const Packet& a) { EIGEN_USING_STD(sinh); return sinh(a); } + +/** \internal \returns the hyperbolic cosine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pcosh(const Packet& a) { EIGEN_USING_STD(cosh); return cosh(a); } + +/** \internal \returns the hyperbolic tan of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet ptanh(const Packet& a) { EIGEN_USING_STD(tanh); return tanh(a); } /** \internal \returns the exp of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pexp(const Packet& a) { return exp(a); } +Packet pexp(const Packet& a) { EIGEN_USING_STD(exp); return exp(a); } + +/** \internal \returns the expm1 of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pexpm1(const Packet& a) { return numext::expm1(a); } /** \internal \returns the log of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet plog(const Packet& a) { return log(a); } +Packet plog(const Packet& a) { EIGEN_USING_STD(log); return log(a); } + +/** \internal \returns the log1p of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog1p(const Packet& a) { return numext::log1p(a); } + +/** \internal \returns the log10 of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog10(const Packet& a) { EIGEN_USING_STD(log10); return log10(a); } + +/** \internal \returns the log10 of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog2(const Packet& a) { + typedef typename internal::unpacket_traits::type Scalar; + return pmul(pset1(Scalar(EIGEN_LOG2E)), plog(a)); +} /** \internal \returns the square-root of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet psqrt(const Packet& a) { return sqrt(a); } +Packet psqrt(const Packet& a) { return numext::sqrt(a); } + +/** \internal \returns the rounded value of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pround(const Packet& a) { using numext::round; return round(a); } + +/** \internal \returns the floor of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pfloor(const Packet& a) { using numext::floor; return floor(a); } + +/** \internal \returns the rounded value of \a a (coeff-wise) with current + * rounding mode */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet print(const Packet& a) { using numext::rint; return rint(a); } + +/** \internal \returns the ceil of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pceil(const Packet& a) { using numext::ceil; return ceil(a); } + +/** \internal \returns the first element of a packet */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type +pfirst(const Packet& a) +{ return a; } + +/** \internal \returns the sum of the elements of upper and lower half of \a a if \a a is larger than 4. + * For a packet {a0, a1, a2, a3, a4, a5, a6, a7}, it returns a half packet {a0+a4, a1+a5, a2+a6, a3+a7} + * For packet-size smaller or equal to 4, this boils down to a noop. + */ +template +EIGEN_DEVICE_FUNC inline std::conditional_t<(unpacket_traits::size%8)==0,typename unpacket_traits::half,Packet> +predux_half_dowto4(const Packet& a) +{ return a; } + +// Slow generic implementation of Packet reduction. +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type +predux_helper(const Packet& a, Op op) { + typedef typename unpacket_traits::type Scalar; + const size_t n = unpacket_traits::size; + EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; + pstoreu(elements, a); + for(size_t k = n / 2; k > 0; k /= 2) { + for(size_t i = 0; i < k; ++i) { + elements[i] = op(elements[i], elements[i + k]); + } + } + return elements[0]; +} + +/** \internal \returns the sum of the elements of \a a*/ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type +predux(const Packet& a) +{ + return a; +} + +/** \internal \returns the product of the elements of \a a */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_mul( + const Packet& a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmul))); +} + +/** \internal \returns the min of the elements of \a a */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_min( + const Packet &a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmin))); +} + +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_min( + const Packet& a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmin))); +} + +/** \internal \returns the min of the elements of \a a */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_max( + const Packet &a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmax))); +} + +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_max( + const Packet& a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmax))); +} + +#undef EIGEN_BINARY_OP_NAN_PROPAGATION + +/** \internal \returns true if all coeffs of \a a means "true" + * It is supposed to be called on values returned by pcmp_*. + */ +// not needed yet +// template EIGEN_DEVICE_FUNC inline bool predux_all(const Packet& a) +// { return bool(a); } + +/** \internal \returns true if any coeffs of \a a means "true" + * It is supposed to be called on values returned by pcmp_*. + */ +template EIGEN_DEVICE_FUNC inline bool predux_any(const Packet& a) +{ + // Dirty but generic implementation where "true" is assumed to be non 0 and all the sames. + // It is expected that "true" is either: + // - Scalar(1) + // - bits full of ones (NaN for floats), + // - or first bit equals to 1 (1 for ints, smallest denormal for floats). + // For all these cases, taking the sum is just fine, and this boils down to a no-op for scalars. + typedef typename unpacket_traits::type Scalar; + return numext::not_equal_strict(predux(a), Scalar(0)); +} /*************************************************************************** * The following functions might not have to be overwritten for vectorized types ***************************************************************************/ -/** \internal copy a packet with constant coeficient \a a (e.g., [a,a,a,a]) to \a *to. \a to must be 16 bytes aligned */ +// FMA instructions. +/** \internal \returns a * b + c (coeff-wise) */ +template +EIGEN_DEVICE_FUNC inline Packet pmadd(const Packet& a, const Packet& b, + const Packet& c) { + return padd(pmul(a, b), c); +} + +/** \internal \returns a * b - c (coeff-wise) */ +template +EIGEN_DEVICE_FUNC inline Packet pmsub(const Packet& a, const Packet& b, + const Packet& c) { + return psub(pmul(a, b), c); +} + +/** \internal \returns -(a * b) + c (coeff-wise) */ +template +EIGEN_DEVICE_FUNC inline Packet pnmadd(const Packet& a, const Packet& b, + const Packet& c) { + return padd(pnegate(pmul(a, b)), c); +} + +/** \internal \returns -(a * b) - c (coeff-wise) */ +template +EIGEN_DEVICE_FUNC inline Packet pnmsub(const Packet& a, const Packet& b, + const Packet& c) { + return psub(pnegate(pmul(a, b)), c); +} + +/** \internal copy a packet with constant coefficient \a a (e.g., [a,a,a,a]) to \a *to. \a to must be 16 bytes aligned */ // NOTE: this function must really be templated on the packet type (think about different packet types for the same scalar type) template inline void pstore1(typename unpacket_traits::type* to, const typename unpacket_traits::type& a) @@ -278,62 +1063,118 @@ inline void pstore1(typename unpacket_traits::type* to, const typename u pstore(to, pset1(a)); } -/** \internal \returns a * b + c (coeff-wise) */ -template inline Packet -pmadd(const Packet& a, - const Packet& b, - const Packet& c) -{ return padd(pmul(a, b),c); } - /** \internal \returns a packet version of \a *from. - * If LoadMode equals #Aligned, \a from must be 16 bytes aligned */ -template -inline Packet ploadt(const typename unpacket_traits::type* from) + * The pointer \a from must be aligned on a \a Alignment bytes boundary. */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt(const typename unpacket_traits::type* from) { - if(LoadMode == Aligned) + if(Alignment >= unpacket_traits::alignment) return pload(from); else return ploadu(from); } +/** \internal \returns n elements of a packet version of \a *from. + * The pointer \a from must be aligned on a \a Alignment bytes boundary. */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt_partial(const typename unpacket_traits::type* from, const Index n, const Index offset = 0) +{ + if(Alignment >= unpacket_traits::alignment) + return pload_partial(from, n, offset); + else + return ploadu_partial(from, n); +} + /** \internal copy the packet \a from to \a *to. - * If StoreMode equals #Aligned, \a to must be 16 bytes aligned */ -template -inline void pstoret(Scalar* to, const Packet& from) + * The pointer \a from must be aligned on a \a Alignment bytes boundary. */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoret(Scalar* to, const Packet& from) { - if(LoadMode == Aligned) + if(Alignment >= unpacket_traits::alignment) pstore(to, from); else pstoreu(to, from); } -/** \internal default implementation of palign() allowing partial specialization */ -template -struct palign_impl +/** \internal copy n elements of the packet \a from to \a *to. + * The pointer \a from must be aligned on a \a Alignment bytes boundary. */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoret_partial(Scalar* to, const Packet& from, const Index n, const Index offset = 0) { - // by default data are aligned, so there is nothing to be done :) - inline static void run(PacketType&, const PacketType&) {} -}; + if(Alignment >= unpacket_traits::alignment) + pstore_partial(to, from, n, offset); + else + pstoreu_partial(to, from, n); +} -/** \internal update \a first using the concatenation of the \a Offset last elements - * of \a first and packet_size minus \a Offset first elements of \a second */ -template -inline void palign(PacketType& first, const PacketType& second) +/** \internal \returns a packet version of \a *from. + * Unlike ploadt, ploadt_ro takes advantage of the read-only memory path on the + * hardware if available to speedup the loading of data that won't be modified + * by the current computation. + */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt_ro(const typename unpacket_traits::type* from) { - palign_impl::run(first,second); + return ploadt(from); } /*************************************************************************** * Fast complex products (GCC generates a function call which is very slow) ***************************************************************************/ +// Eigen+CUDA does not support complexes. +#if !defined(EIGEN_GPUCC) + template<> inline std::complex pmul(const std::complex& a, const std::complex& b) -{ return std::complex(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); } +{ return std::complex(a.real()*b.real() - a.imag()*b.imag(), a.imag()*b.real() + a.real()*b.imag()); } template<> inline std::complex pmul(const std::complex& a, const std::complex& b) -{ return std::complex(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); } +{ return std::complex(a.real()*b.real() - a.imag()*b.imag(), a.imag()*b.real() + a.real()*b.imag()); } + +#endif + + +/*************************************************************************** + * PacketBlock, that is a collection of N packets where the number of words + * in the packet is a multiple of N. +***************************************************************************/ +template ::size> struct PacketBlock { + Packet packet[N]; +}; + +template EIGEN_DEVICE_FUNC inline void +ptranspose(PacketBlock& /*kernel*/) { + // Nothing to do in the scalar case, i.e. a 1x1 matrix. +} + +/*************************************************************************** + * Selector, i.e. vector of N boolean values used to select (i.e. blend) + * words from 2 packets. +***************************************************************************/ +template struct Selector { + bool select[N]; +}; + +template EIGEN_DEVICE_FUNC inline Packet +pblend(const Selector::size>& ifPacket, const Packet& thenPacket, const Packet& elsePacket) { + return ifPacket.select[0] ? thenPacket : elsePacket; +} + +/** \internal \returns 1 / a (coeff-wise) */ +template +EIGEN_DEVICE_FUNC inline Packet preciprocal(const Packet& a) { + using Scalar = typename unpacket_traits::type; + return pdiv(pset1(Scalar(1)), a); +} + +/** \internal \returns the reciprocal square-root of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet prsqrt(const Packet& a) { + return preciprocal(psqrt(a)); +} } // end namespace internal -#endif // EIGEN_GENERIC_PACKET_MATH_H +} // end namespace Eigen +#endif // EIGEN_GENERIC_PACKET_MATH_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GlobalFunctions.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GlobalFunctions.h index 144145a..53f9dfa 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GlobalFunctions.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/GlobalFunctions.h @@ -1,38 +1,40 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2010 Gael Guennebaud +// Copyright (C) 2010-2016 Gael Guennebaud // Copyright (C) 2010 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_GLOBAL_FUNCTIONS_H #define EIGEN_GLOBAL_FUNCTIONS_H -#define EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(NAME,FUNCTOR) \ +#ifdef EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR,DOC_OP,DOC_DETAILS) \ + /** \returns an expression of the coefficient-wise DOC_OP of \a x + + DOC_DETAILS + + \sa Math functions, class CwiseUnaryOp + */ \ template \ inline const Eigen::CwiseUnaryOp, const Derived> \ - NAME(const Eigen::ArrayBase& x) { \ - return x.derived(); \ + NAME(const Eigen::ArrayBase& x); + +#else + +#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR,DOC_OP,DOC_DETAILS) \ + template \ + inline const Eigen::CwiseUnaryOp, const Derived> \ + (NAME)(const Eigen::ArrayBase& x) { \ + return Eigen::CwiseUnaryOp, const Derived>(x.derived()); \ } +#endif // EIGEN_PARSED_BY_DOXYGEN + #define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME,FUNCTOR) \ \ template \ @@ -45,51 +47,148 @@ { \ static inline typename NAME##_retval >::type run(const Eigen::ArrayBase& x) \ { \ - return x.derived(); \ + return typename NAME##_retval >::type(x.derived()); \ } \ }; +#include "./InternalHeaderCheck.h" -namespace std +namespace Eigen { - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(real,scalar_real_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(imag,scalar_imag_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sin,scalar_sin_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(cos,scalar_cos_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(asin,scalar_asin_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(acos,scalar_acos_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(tan,scalar_tan_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(exp,scalar_exp_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(log,scalar_log_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(abs,scalar_abs_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sqrt,scalar_sqrt_op) - - template - inline const Eigen::CwiseUnaryOp, const Derived> - pow(const Eigen::ArrayBase& x, const typename Derived::Scalar& exponent) { \ - return x.derived().pow(exponent); \ + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(real,scalar_real_op,real part,\sa ArrayBase::real) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(imag,scalar_imag_op,imaginary part,\sa ArrayBase::imag) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(conj,scalar_conjugate_op,complex conjugate,\sa ArrayBase::conjugate) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(inverse,scalar_inverse_op,inverse,\sa ArrayBase::inverse) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sin,scalar_sin_op,sine,\sa ArrayBase::sin) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cos,scalar_cos_op,cosine,\sa ArrayBase::cos) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tan,scalar_tan_op,tangent,\sa ArrayBase::tan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(atan,scalar_atan_op,arc-tangent,\sa ArrayBase::atan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(asin,scalar_asin_op,arc-sine,\sa ArrayBase::asin) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(acos,scalar_acos_op,arc-consine,\sa ArrayBase::acos) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sinh,scalar_sinh_op,hyperbolic sine,\sa ArrayBase::sinh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cosh,scalar_cosh_op,hyperbolic cosine,\sa ArrayBase::cosh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tanh,scalar_tanh_op,hyperbolic tangent,\sa ArrayBase::tanh) +#if EIGEN_HAS_CXX11_MATH + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(asinh,scalar_asinh_op,inverse hyperbolic sine,\sa ArrayBase::asinh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(acosh,scalar_acosh_op,inverse hyperbolic cosine,\sa ArrayBase::acosh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(atanh,scalar_atanh_op,inverse hyperbolic tangent,\sa ArrayBase::atanh) +#endif + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(logistic,scalar_logistic_op,logistic function,\sa ArrayBase::logistic) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(lgamma,scalar_lgamma_op,natural logarithm of the gamma function,\sa ArrayBase::lgamma) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(digamma,scalar_digamma_op,derivative of lgamma,\sa ArrayBase::digamma) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erf,scalar_erf_op,error function,\sa ArrayBase::erf) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erfc,scalar_erfc_op,complement error function,\sa ArrayBase::erfc) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ndtri,scalar_ndtri_op,inverse normal distribution function,\sa ArrayBase::ndtri) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(exp,scalar_exp_op,exponential,\sa ArrayBase::exp) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(expm1,scalar_expm1_op,exponential of a value minus 1,\sa ArrayBase::expm1) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log,scalar_log_op,natural logarithm,\sa Eigen::log10 DOXCOMMA ArrayBase::log) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log1p,scalar_log1p_op,natural logarithm of 1 plus the value,\sa ArrayBase::log1p) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log10,scalar_log10_op,base 10 logarithm,\sa Eigen::log DOXCOMMA ArrayBase::log10) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log2,scalar_log2_op,base 2 logarithm,\sa Eigen::log DOXCOMMA ArrayBase::log2) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs,scalar_abs_op,absolute value,\sa ArrayBase::abs DOXCOMMA MatrixBase::cwiseAbs) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs2,scalar_abs2_op,squared absolute value,\sa ArrayBase::abs2 DOXCOMMA MatrixBase::cwiseAbs2) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(arg,scalar_arg_op,complex argument,\sa ArrayBase::arg DOXCOMMA MatrixBase::cwiseArg) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sqrt,scalar_sqrt_op,square root,\sa ArrayBase::sqrt DOXCOMMA MatrixBase::cwiseSqrt) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(rsqrt,scalar_rsqrt_op,reciprocal square root,\sa ArrayBase::rsqrt) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(square,scalar_square_op,square (power 2),\sa Eigen::abs2 DOXCOMMA Eigen::pow DOXCOMMA ArrayBase::square) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cube,scalar_cube_op,cube (power 3),\sa Eigen::pow DOXCOMMA ArrayBase::cube) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(rint,scalar_rint_op,nearest integer,\sa Eigen::floor DOXCOMMA Eigen::ceil DOXCOMMA ArrayBase::round) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(round,scalar_round_op,nearest integer,\sa Eigen::floor DOXCOMMA Eigen::ceil DOXCOMMA ArrayBase::round) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(floor,scalar_floor_op,nearest integer not greater than the giben value,\sa Eigen::ceil DOXCOMMA ArrayBase::floor) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ceil,scalar_ceil_op,nearest integer not less than the giben value,\sa Eigen::floor DOXCOMMA ArrayBase::ceil) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isnan,scalar_isnan_op,not-a-number test,\sa Eigen::isinf DOXCOMMA Eigen::isfinite DOXCOMMA ArrayBase::isnan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isinf,scalar_isinf_op,infinite value test,\sa Eigen::isnan DOXCOMMA Eigen::isfinite DOXCOMMA ArrayBase::isinf) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isfinite,scalar_isfinite_op,finite value test,\sa Eigen::isinf DOXCOMMA Eigen::isnan DOXCOMMA ArrayBase::isfinite) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sign,scalar_sign_op,sign (or 0),\sa ArrayBase::sign) + + /** \returns an expression of the coefficient-wise power of \a x to the given constant \a exponent. + * + * \tparam ScalarExponent is the scalar type of \a exponent. It must be compatible with the scalar type of the given expression (\c Derived::Scalar). + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ +#ifdef EIGEN_PARSED_BY_DOXYGEN + template + inline const CwiseBinaryOp,Derived,Constant > + pow(const Eigen::ArrayBase& x, const ScalarExponent& exponent); +#else + template + EIGEN_DEVICE_FUNC inline + const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename internal::promote_scalar_arg::type,pow) + pow(const Eigen::ArrayBase& x, const ScalarExponent& exponent) + { + typedef typename internal::promote_scalar_arg::type PromotedExponent; + return EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,PromotedExponent,pow)(x.derived(), + typename internal::plain_constant_type::type(x.derived().rows(), x.derived().cols(), internal::scalar_constant_op(exponent))); } -} +#endif + + /** \returns an expression of the coefficient-wise power of \a x to the given array of \a exponents. + * + * This function computes the coefficient-wise power. + * + * Example: \include Cwise_array_power_array.cpp + * Output: \verbinclude Cwise_array_power_array.out + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ + template + inline const Eigen::CwiseBinaryOp, const Derived, const ExponentDerived> + pow(const Eigen::ArrayBase& x, const Eigen::ArrayBase& exponents) + { + return Eigen::CwiseBinaryOp, const Derived, const ExponentDerived>( + x.derived(), + exponents.derived() + ); + } + + /** \returns an expression of the coefficient-wise power of the scalar \a x to the given array of \a exponents. + * + * This function computes the coefficient-wise power between a scalar and an array of exponents. + * + * \tparam Scalar is the scalar type of \a x. It must be compatible with the scalar type of the given array expression (\c Derived::Scalar). + * + * Example: \include Cwise_scalar_power_array.cpp + * Output: \verbinclude Cwise_scalar_power_array.out + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ +#ifdef EIGEN_PARSED_BY_DOXYGEN + template + inline const CwiseBinaryOp,Constant,Derived> + pow(const Scalar& x,const Eigen::ArrayBase& x); +#else + template + EIGEN_DEVICE_FUNC inline + const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename internal::promote_scalar_arg::type,Derived,pow) + pow(const Scalar& x, const Eigen::ArrayBase& exponents) { + typedef typename internal::promote_scalar_arg::type PromotedScalar; + return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(PromotedScalar,Derived,pow)( + typename internal::plain_constant_type::type(exponents.derived().rows(), exponents.derived().cols(), internal::scalar_constant_op(x)), exponents.derived()); + } +#endif + -namespace Eigen -{ namespace internal { EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(real,scalar_real_op) EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(imag,scalar_imag_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sin,scalar_sin_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(cos,scalar_cos_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(asin,scalar_asin_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(acos,scalar_acos_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(tan,scalar_tan_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(exp,scalar_exp_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(log,scalar_log_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs,scalar_abs_op) EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs2,scalar_abs2_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sqrt,scalar_sqrt_op) } } -// TODO: cleanly disable those functions that are not supported on Array (internal::real_ref, internal::random, internal::isApprox...) +// TODO: cleanly disable those functions that are not supported on Array (numext::real_ref, internal::random, internal::isApprox...) #endif // EIGEN_GLOBAL_FUNCTIONS_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/IO.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/IO.h index f3cfcdb..897d7b0 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/IO.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/IO.h @@ -4,28 +4,17 @@ // Copyright (C) 2006-2008 Benoit Jacob // Copyright (C) 2008 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_IO_H #define EIGEN_IO_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + enum { DontAlignCols = 1 }; enum { StreamPrecision = -1, FullPrecision = -2 }; @@ -54,6 +43,7 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& * - \b rowSuffix string printed at the end of each row * - \b matPrefix string printed at the beginning of the matrix * - \b matSuffix string printed at the end of the matrix + * - \b fill character printed to fill the empty space in aligned columns * * Example: \include IOFormat.cpp * Output: \verbinclude IOFormat.out @@ -62,15 +52,18 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& */ struct IOFormat { - /** Default contructor, see class IOFormat for the meaning of the parameters */ + /** Default constructor, see class IOFormat for the meaning of the parameters */ IOFormat(int _precision = StreamPrecision, int _flags = 0, const std::string& _coeffSeparator = " ", const std::string& _rowSeparator = "\n", const std::string& _rowPrefix="", const std::string& _rowSuffix="", - const std::string& _matPrefix="", const std::string& _matSuffix="") + const std::string& _matPrefix="", const std::string& _matSuffix="", const char _fill=' ') : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator), - coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags) + rowSpacer(""), coeffSeparator(_coeffSeparator), fill(_fill), precision(_precision), flags(_flags) { - rowSpacer = ""; + // TODO check if rowPrefix, rowSuffix or rowSeparator contains a newline + // don't add rowSpacer if columns are not to be aligned + if((flags & DontAlignCols)) + return; int i = int(matSuffix.length())-1; while (i>=0 && matSuffix[i]!='\n') { @@ -81,6 +74,7 @@ struct IOFormat std::string matPrefix, matSuffix; std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer; std::string coeffSeparator; + char fill; int precision; int flags; }; @@ -90,7 +84,7 @@ struct IOFormat * * \brief Pseudo expression providing matrix output with given format * - * \param ExpressionType the type of the object on which IO stream operations are performed + * \tparam ExpressionType the type of the object on which IO stream operations are performed * * This class represents an expression with stream operators controlled by a given IOFormat. * It is the return type of DenseBase::format() @@ -115,65 +109,54 @@ class WithFormat } protected: - const typename ExpressionType::Nested m_matrix; + typename ExpressionType::Nested m_matrix; IOFormat m_format; }; -/** \returns a WithFormat proxy object allowing to print a matrix the with given - * format \a fmt. - * - * See class IOFormat for some examples. - * - * \sa class IOFormat, class WithFormat - */ -template -inline const WithFormat -DenseBase::format(const IOFormat& fmt) const -{ - return WithFormat(derived(), fmt); -} - namespace internal { -template -struct significant_decimals_default_impl -{ - typedef typename NumTraits::Real RealScalar; - static inline int run() - { - using std::ceil; - return cast(ceil(-log(NumTraits::epsilon())/log(RealScalar(10)))); - } -}; - +// NOTE: This helper is kept for backward compatibility with previous code specializing +// this internal::significant_decimals_impl structure. In the future we should directly +// call digits10() which has been introduced in July 2016 in 3.3. template -struct significant_decimals_default_impl +struct significant_decimals_impl { static inline int run() { - return 0; + return NumTraits::digits10(); } }; -template -struct significant_decimals_impl - : significant_decimals_default_impl::IsInteger> -{}; - /** \internal * print the matrix \a _m to the output stream \a s using the output format \a fmt */ template std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt) { + using internal::is_same; + if(_m.size() == 0) { s << fmt.matPrefix << fmt.matSuffix; return s; } - const typename Derived::Nested m = _m; + typename Derived::Nested m = _m; typedef typename Derived::Scalar Scalar; - typedef typename Derived::Index Index; + typedef std::conditional_t< + is_same::value || + is_same::value || + is_same::value || + is_same::value, + int, + std::conditional_t< + is_same >::value || + is_same >::value || + is_same >::value || + is_same >::value, + std::complex, + const Scalar& + > + > PrintType; Index width = 0; @@ -198,34 +181,43 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& explicit_precision = fmt.precision; } + std::streamsize old_precision = 0; + if(explicit_precision) old_precision = s.precision(explicit_precision); + bool align_cols = !(fmt.flags & DontAlignCols); if(align_cols) { // compute the largest width - for(Index j = 1; j < m.cols(); ++j) + for(Index j = 0; j < m.cols(); ++j) for(Index i = 0; i < m.rows(); ++i) { std::stringstream sstr; - if(explicit_precision) sstr.precision(explicit_precision); - sstr << m.coeff(i,j); + sstr.copyfmt(s); + sstr << static_cast(m.coeff(i,j)); width = std::max(width, Index(sstr.str().length())); } } - std::streamsize old_precision = 0; - if(explicit_precision) old_precision = s.precision(explicit_precision); + std::streamsize old_width = s.width(); + char old_fill_character = s.fill(); s << fmt.matPrefix; for(Index i = 0; i < m.rows(); ++i) { if (i) s << fmt.rowSpacer; s << fmt.rowPrefix; - if(width) s.width(width); - s << m.coeff(i, 0); + if(width) { + s.fill(fmt.fill); + s.width(width); + } + s << static_cast(m.coeff(i, 0)); for(Index j = 1; j < m.cols(); ++j) { s << fmt.coeffSeparator; - if (width) s.width(width); - s << m.coeff(i, j); + if(width) { + s.fill(fmt.fill); + s.width(width); + } + s << static_cast(m.coeff(i, j)); } s << fmt.rowSuffix; if( i < m.rows() - 1) @@ -233,6 +225,10 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& } s << fmt.matSuffix; if(explicit_precision) s.precision(old_precision); + if(width) { + s.fill(old_fill_character); + s.width(old_width); + } return s; } @@ -257,4 +253,6 @@ std::ostream & operator << return internal::print_matrix(s, m.eval(), EIGEN_DEFAULT_IO_FORMAT); } +} // end namespace Eigen + #endif // EIGEN_IO_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/IndexedView.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/IndexedView.h new file mode 100644 index 0000000..c0907bf --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/IndexedView.h @@ -0,0 +1,239 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2017 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_INDEXED_VIEW_H +#define EIGEN_INDEXED_VIEW_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +template +struct traits > + : traits +{ + enum { + RowsAtCompileTime = int(array_size::value), + ColsAtCompileTime = int(array_size::value), + MaxRowsAtCompileTime = RowsAtCompileTime, + MaxColsAtCompileTime = ColsAtCompileTime, + + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0, + IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 + : XprTypeIsRowMajor, + + RowIncr = int(get_compile_time_incr::value), + ColIncr = int(get_compile_time_incr::value), + InnerIncr = IsRowMajor ? ColIncr : RowIncr, + OuterIncr = IsRowMajor ? RowIncr : ColIncr, + + HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor), + XprInnerStride = HasSameStorageOrderAsXprType ? int(inner_stride_at_compile_time::ret) : int(outer_stride_at_compile_time::ret), + XprOuterstride = HasSameStorageOrderAsXprType ? int(outer_stride_at_compile_time::ret) : int(inner_stride_at_compile_time::ret), + + InnerSize = XprTypeIsRowMajor ? ColsAtCompileTime : RowsAtCompileTime, + IsBlockAlike = InnerIncr==1 && OuterIncr==1, + IsInnerPannel = HasSameStorageOrderAsXprType && is_same,std::conditional_t>::value, + + InnerStrideAtCompileTime = InnerIncr<0 || InnerIncr==DynamicIndex || XprInnerStride==Dynamic || InnerIncr==UndefinedIncr ? Dynamic : XprInnerStride * InnerIncr, + OuterStrideAtCompileTime = OuterIncr<0 || OuterIncr==DynamicIndex || XprOuterstride==Dynamic || OuterIncr==UndefinedIncr ? Dynamic : XprOuterstride * OuterIncr, + + ReturnAsScalar = is_same::value && is_same::value, + ReturnAsBlock = (!ReturnAsScalar) && IsBlockAlike, + ReturnAsIndexedView = (!ReturnAsScalar) && (!ReturnAsBlock), + + // FIXME we deal with compile-time strides if and only if we have DirectAccessBit flag, + // but this is too strict regarding negative strides... + DirectAccessMask = (int(InnerIncr)!=UndefinedIncr && int(OuterIncr)!=UndefinedIncr && InnerIncr>=0 && OuterIncr>=0) ? DirectAccessBit : 0, + FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0, + Flags = (traits::Flags & (HereditaryBits | DirectAccessMask )) | FlagsLvalueBit | FlagsRowMajorBit | FlagsLinearAccessBit + }; + + typedef Block BlockType; +}; + +} + +template +class IndexedViewImpl; + + +/** \class IndexedView + * \ingroup Core_Module + * + * \brief Expression of a non-sequential sub-matrix defined by arbitrary sequences of row and column indices + * + * \tparam XprType the type of the expression in which we are taking the intersections of sub-rows and sub-columns + * \tparam RowIndices the type of the object defining the sequence of row indices + * \tparam ColIndices the type of the object defining the sequence of column indices + * + * This class represents an expression of a sub-matrix (or sub-vector) defined as the intersection + * of sub-sets of rows and columns, that are themself defined by generic sequences of row indices \f$ \{r_0,r_1,..r_{m-1}\} \f$ + * and column indices \f$ \{c_0,c_1,..c_{n-1} \}\f$. Let \f$ A \f$ be the nested matrix, then the resulting matrix \f$ B \f$ has \c m + * rows and \c n columns, and its entries are given by: \f$ B(i,j) = A(r_i,c_j) \f$. + * + * The \c RowIndices and \c ColIndices types must be compatible with the following API: + * \code + * operator[](Index) const; + * Index size() const; + * \endcode + * + * Typical supported types thus include: + * - std::vector + * - std::valarray + * - std::array + * - Plain C arrays: int[N] + * - Eigen::ArrayXi + * - decltype(ArrayXi::LinSpaced(...)) + * - Any view/expressions of the previous types + * - Eigen::ArithmeticSequence + * - Eigen::internal::AllRange (helper for Eigen::placeholders::all) + * - Eigen::internal::SingleRange (helper for single index) + * - etc. + * + * In typical usages of %Eigen, this class should never be used directly. It is the return type of + * DenseBase::operator()(const RowIndices&, const ColIndices&). + * + * \sa class Block + */ +template +class IndexedView : public IndexedViewImpl::StorageKind> +{ +public: + typedef typename IndexedViewImpl::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(IndexedView) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(IndexedView) + + typedef typename internal::ref_selector::non_const_type MatrixTypeNested; + typedef internal::remove_all_t NestedExpression; + + template + IndexedView(XprType& xpr, const T0& rowIndices, const T1& colIndices) + : m_xpr(xpr), m_rowIndices(rowIndices), m_colIndices(colIndices) + {} + + /** \returns number of rows */ + Index rows() const { return internal::index_list_size(m_rowIndices); } + + /** \returns number of columns */ + Index cols() const { return internal::index_list_size(m_colIndices); } + + /** \returns the nested expression */ + const internal::remove_all_t& + nestedExpression() const { return m_xpr; } + + /** \returns the nested expression */ + std::remove_reference_t& + nestedExpression() { return m_xpr; } + + /** \returns a const reference to the object storing/generating the row indices */ + const RowIndices& rowIndices() const { return m_rowIndices; } + + /** \returns a const reference to the object storing/generating the column indices */ + const ColIndices& colIndices() const { return m_colIndices; } + +protected: + MatrixTypeNested m_xpr; + RowIndices m_rowIndices; + ColIndices m_colIndices; +}; + + +// Generic API dispatcher +template +class IndexedViewImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + +namespace internal { + + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef IndexedView XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost /* TODO + cost of row/col index */, + + FlagsLinearAccessBit = (traits::RowsAtCompileTime == 1 || traits::ColsAtCompileTime == 1) ? LinearAccessBit : 0, + + FlagsRowMajorBit = traits::FlagsRowMajorBit, + + Flags = (evaluator::Flags & (HereditaryBits & ~RowMajorBit /*| LinearAccessBit | DirectAccessBit*/)) | FlagsLinearAccessBit | FlagsRowMajorBit, + + Alignment = 0 + }; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& xpr) : m_argImpl(xpr.nestedExpression()), m_xpr(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + Index row = XprType::RowsAtCompileTime == 1 ? 0 : index; + Index col = XprType::RowsAtCompileTime == 1 ? index : 0; + return m_argImpl.coeffRef( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar& coeffRef(Index index) const + { + Index row = XprType::RowsAtCompileTime == 1 ? 0 : index; + Index col = XprType::RowsAtCompileTime == 1 ? index : 0; + return m_argImpl.coeffRef( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const CoeffReturnType coeff(Index index) const + { + Index row = XprType::RowsAtCompileTime == 1 ? 0 : index; + Index col = XprType::RowsAtCompileTime == 1 ? index : 0; + return m_argImpl.coeff( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + +protected: + + evaluator m_argImpl; + const XprType& m_xpr; + +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_INDEXED_VIEW_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/InternalHeaderCheck.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/InternalHeaderCheck.h new file mode 100644 index 0000000..1cea572 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/InternalHeaderCheck.h @@ -0,0 +1,3 @@ +#ifndef EIGEN_CORE_MODULE_H +#error "Please include Eigen/Core instead of including headers inside the src directory directly." +#endif diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Inverse.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Inverse.h new file mode 100644 index 0000000..9c70733 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Inverse.h @@ -0,0 +1,119 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014-2019 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_INVERSE_H +#define EIGEN_INVERSE_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +template class InverseImpl; + +namespace internal { + +template +struct traits > + : traits +{ + typedef typename XprType::PlainObject PlainObject; + typedef traits BaseTraits; + enum { + Flags = BaseTraits::Flags & RowMajorBit + }; +}; + +} // end namespace internal + +/** \class Inverse + * + * \brief Expression of the inverse of another expression + * + * \tparam XprType the type of the expression we are taking the inverse + * + * This class represents an abstract expression of A.inverse() + * and most of the time this is the only way it is used. + * + */ +template +class Inverse : public InverseImpl::StorageKind> +{ +public: + typedef typename XprType::StorageIndex StorageIndex; + typedef typename XprType::Scalar Scalar; + typedef typename internal::ref_selector::type XprTypeNested; + typedef internal::remove_all_t XprTypeNestedCleaned; + typedef typename internal::ref_selector::type Nested; + typedef internal::remove_all_t NestedExpression; + + explicit EIGEN_DEVICE_FUNC Inverse(const XprType &xpr) + : m_xpr(xpr) + {} + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_xpr.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_xpr.rows(); } + + EIGEN_DEVICE_FUNC const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; } + +protected: + XprTypeNested m_xpr; +}; + +// Generic API dispatcher +template +class InverseImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; + typedef typename XprType::Scalar Scalar; +private: + + Scalar coeff(Index row, Index col) const; + Scalar coeff(Index i) const; +}; + +namespace internal { + +/** \internal + * \brief Default evaluator for Inverse expression. + * + * This default evaluator for Inverse expression simply evaluate the inverse into a temporary + * by a call to internal::call_assignment_no_alias. + * Therefore, inverse implementers only have to specialize Assignment, ...> for + * there own nested expression. + * + * \sa class Inverse + */ +template +struct unary_evaluator > + : public evaluator::PlainObject> +{ + typedef Inverse InverseType; + typedef typename InverseType::PlainObject PlainObject; + typedef evaluator Base; + + enum { Flags = Base::Flags | EvalBeforeNestingBit }; + + unary_evaluator(const InverseType& inv_xpr) + : m_result(inv_xpr.rows(), inv_xpr.cols()) + { + internal::construct_at(this, m_result); + internal::call_assignment_no_alias(m_result, inv_xpr); + } + +protected: + PlainObject m_result; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_INVERSE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Map.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Map.h index 2bf80b3..56d1ff8 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Map.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Map.h @@ -4,35 +4,52 @@ // Copyright (C) 2007-2010 Benoit Jacob // Copyright (C) 2008 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MAP_H #define EIGEN_MAP_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { +template +struct traits > + : public traits +{ + typedef traits TraitsBase; + enum { + PlainObjectTypeInnerSize = ((traits::Flags&RowMajorBit)==RowMajorBit) + ? PlainObjectType::ColsAtCompileTime + : PlainObjectType::RowsAtCompileTime, + + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 + ? int(PlainObjectType::InnerStrideAtCompileTime) + : int(StrideType::InnerStrideAtCompileTime), + OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 + ? (InnerStrideAtCompileTime==Dynamic || PlainObjectTypeInnerSize==Dynamic + ? Dynamic + : int(InnerStrideAtCompileTime) * int(PlainObjectTypeInnerSize)) + : int(StrideType::OuterStrideAtCompileTime), + Alignment = int(MapOptions)&int(AlignedMask), + Flags0 = TraitsBase::Flags & (~NestByRefBit), + Flags = is_lvalue::value ? int(Flags0) : (int(Flags0) & ~LvalueBit) + }; +private: + enum { Options }; // Expressions don't have Options +}; +} + /** \class Map * \ingroup Core_Module * * \brief A matrix or vector expression mapping an existing array of data. * * \tparam PlainObjectType the equivalent matrix type of the mapped data - * \tparam MapOptions specifies whether the pointer is \c #Aligned, or \c #Unaligned. + * \tparam MapOptions specifies the pointer alignment in bytes. It can be: \c #Aligned128, \c #Aligned64, \c #Aligned32, \c #Aligned16, \c #Aligned8 or \c #Unaligned. * The default is \c #Unaligned. * \tparam StrideType optionally specifies strides. By default, Map assumes the memory layout * of an ordinary, contiguous array. This can be overridden by specifying strides. @@ -76,44 +93,6 @@ * * \sa PlainObjectBase::Map(), \ref TopicStorageOrders */ - -namespace internal { -template -struct traits > - : public traits -{ - typedef traits TraitsBase; - typedef typename PlainObjectType::Index Index; - typedef typename PlainObjectType::Scalar Scalar; - enum { - InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 - ? int(PlainObjectType::InnerStrideAtCompileTime) - : int(StrideType::InnerStrideAtCompileTime), - OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 - ? int(PlainObjectType::OuterStrideAtCompileTime) - : int(StrideType::OuterStrideAtCompileTime), - HasNoInnerStride = InnerStrideAtCompileTime == 1, - HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0, - HasNoStride = HasNoInnerStride && HasNoOuterStride, - IsAligned = bool(EIGEN_ALIGN) && ((int(MapOptions)&Aligned)==Aligned), - IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic, - KeepsPacketAccess = bool(HasNoInnerStride) - && ( bool(IsDynamicSize) - || HasNoOuterStride - || ( OuterStrideAtCompileTime!=Dynamic - && ((static_cast(sizeof(Scalar))*OuterStrideAtCompileTime)%16)==0 ) ), - Flags0 = TraitsBase::Flags & (~NestByRefBit), - Flags1 = IsAligned ? (int(Flags0) | AlignedBit) : (int(Flags0) & ~AlignedBit), - Flags2 = (bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime)) - ? int(Flags1) : int(Flags1 & ~LinearAccessBit), - Flags3 = is_lvalue::value ? int(Flags2) : (int(Flags2) & ~LvalueBit), - Flags = KeepsPacketAccess ? int(Flags3) : (int(Flags3) & ~PacketAccessBit) - }; -private: - enum { Options }; // Expressions don't have Options -}; -} - template class Map : public MapBase > { @@ -123,61 +102,60 @@ template class Ma EIGEN_DENSE_PUBLIC_INTERFACE(Map) typedef typename Base::PointerType PointerType; -#if EIGEN2_SUPPORT_STAGE <= STAGE30_FULL_EIGEN3_API - typedef const Scalar* PointerArgType; - inline PointerType cast_to_pointer_type(PointerArgType ptr) { return const_cast(ptr); } -#else typedef PointerType PointerArgType; + EIGEN_DEVICE_FUNC inline PointerType cast_to_pointer_type(PointerArgType ptr) { return ptr; } -#endif + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const { return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const { return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() - : IsVectorAtCompileTime ? this->size() - : int(Flags)&RowMajorBit ? this->cols() - : this->rows(); + : internal::traits::OuterStrideAtCompileTime != Dynamic ? Index(internal::traits::OuterStrideAtCompileTime) + : IsVectorAtCompileTime ? (this->size() * innerStride()) + : int(Flags)&RowMajorBit ? (this->cols() * innerStride()) + : (this->rows() * innerStride()); } /** Constructor in the fixed-size case. * - * \param data pointer to the array to map + * \param dataPtr pointer to the array to map * \param stride optional Stride object, passing the strides. */ - inline Map(PointerArgType data, const StrideType& stride = StrideType()) - : Base(cast_to_pointer_type(data)), m_stride(stride) + EIGEN_DEVICE_FUNC + explicit inline Map(PointerArgType dataPtr, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr)), m_stride(stride) { - PlainObjectType::Base::_check_template_params(); } /** Constructor in the dynamic-size vector case. * - * \param data pointer to the array to map + * \param dataPtr pointer to the array to map * \param size the size of the vector expression * \param stride optional Stride object, passing the strides. */ - inline Map(PointerArgType data, Index size, const StrideType& stride = StrideType()) - : Base(cast_to_pointer_type(data), size), m_stride(stride) + EIGEN_DEVICE_FUNC + inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr), size), m_stride(stride) { - PlainObjectType::Base::_check_template_params(); } /** Constructor in the dynamic-size matrix case. * - * \param data pointer to the array to map + * \param dataPtr pointer to the array to map * \param rows the number of rows of the matrix expression * \param cols the number of columns of the matrix expression * \param stride optional Stride object, passing the strides. */ - inline Map(PointerArgType data, Index rows, Index cols, const StrideType& stride = StrideType()) - : Base(cast_to_pointer_type(data), rows, cols), m_stride(stride) + EIGEN_DEVICE_FUNC + inline Map(PointerArgType dataPtr, Index rows, Index cols, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr), rows, cols), m_stride(stride) { - PlainObjectType::Base::_check_template_params(); } EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map) @@ -186,18 +164,7 @@ template class Ma StrideType m_stride; }; -template -inline Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> - ::Array(const Scalar *data) -{ - this->_set_noalias(Eigen::Map(data)); -} -template -inline Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> - ::Matrix(const Scalar *data) -{ - this->_set_noalias(Eigen::Map(data)); -} +} // end namespace Eigen #endif // EIGEN_MAP_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MapBase.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MapBase.h index 9426e2d..bf8c163 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MapBase.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MapBase.h @@ -4,37 +4,35 @@ // Copyright (C) 2007-2010 Benoit Jacob // Copyright (C) 2008 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MAPBASE_H #define EIGEN_MAPBASE_H #define EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) \ - EIGEN_STATIC_ASSERT((int(internal::traits::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \ + EIGEN_STATIC_ASSERT((int(internal::evaluator::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \ YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT) +#include "./InternalHeaderCheck.h" -/** \class MapBase - * \ingroup Core_Module +namespace Eigen { + +/** \ingroup Core_Module + * + * \brief Base class for dense Map and Block expression with direct access * - * \brief Base class for Map and Block expression with direct access + * This base class provides the const low-level accessors (e.g. coeff, coeffRef) of dense + * Map and Block objects with direct access. + * Typical users do not have to directly deal with this class. + * + * This class can be extended by through the macro plugin \c EIGEN_MAPBASE_PLUGIN. + * See \link TopicCustomizing_Plugins customizing Eigen \endlink for details. + * + * The \c Derived class has to provide the following two methods describing the memory layout: + * \code Index innerStride() const; \endcode + * \code Index outerStride() const; \endcode * * \sa class Map, class Block */ @@ -47,19 +45,19 @@ template class MapBase enum { RowsAtCompileTime = internal::traits::RowsAtCompileTime, ColsAtCompileTime = internal::traits::ColsAtCompileTime, + InnerStrideAtCompileTime = internal::traits::InnerStrideAtCompileTime, SizeAtCompileTime = Base::SizeAtCompileTime }; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; - typedef typename internal::conditional< - bool(internal::is_lvalue::value), - Scalar *, - const Scalar *>::type - PointerType; + typedef std::conditional_t< + bool(internal::is_lvalue::value), + Scalar *, + const Scalar *> + PointerType; using Base::derived; // using Base::RowsAtCompileTime; @@ -90,8 +88,12 @@ template class MapBase typedef typename Base::CoeffReturnType CoeffReturnType; - inline Index rows() const { return m_rows.value(); } - inline Index cols() const { return m_cols.value(); } + /** \copydoc DenseBase::rows() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_rows.value(); } + /** \copydoc DenseBase::cols() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_cols.value(); } /** Returns a pointer to the first coefficient of the matrix or vector. * @@ -99,37 +101,47 @@ template class MapBase * * \sa innerStride(), outerStride() */ - inline const Scalar* data() const { return m_data; } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_data; } - inline const Scalar& coeff(Index row, Index col) const + /** \copydoc PlainObjectBase::coeff(Index,Index) const */ + EIGEN_DEVICE_FUNC + inline const Scalar& coeff(Index rowId, Index colId) const { - return m_data[col * colStride() + row * rowStride()]; + return m_data[colId * colStride() + rowId * rowStride()]; } + /** \copydoc PlainObjectBase::coeff(Index) const */ + EIGEN_DEVICE_FUNC inline const Scalar& coeff(Index index) const { EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) return m_data[index * innerStride()]; } - inline const Scalar& coeffRef(Index row, Index col) const + /** \copydoc PlainObjectBase::coeffRef(Index,Index) const */ + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const { - return this->m_data[col * colStride() + row * rowStride()]; + return this->m_data[colId * colStride() + rowId * rowStride()]; } + /** \copydoc PlainObjectBase::coeffRef(Index) const */ + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const { EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) return this->m_data[index * innerStride()]; } + /** \internal */ template - inline PacketScalar packet(Index row, Index col) const + inline PacketScalar packet(Index rowId, Index colId) const { return internal::ploadt - (m_data + (col * colStride() + row * rowStride())); + (m_data + (colId * colStride() + rowId * rowStride())); } + /** \internal */ template inline PacketScalar packet(Index index) const { @@ -137,58 +149,90 @@ template class MapBase return internal::ploadt(m_data + index * innerStride()); } - inline MapBase(PointerType data) : m_data(data), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime) + /** \internal Constructor for fixed size matrices or vectors */ + EIGEN_DEVICE_FUNC + explicit inline MapBase(PointerType dataPtr) : m_data(dataPtr), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime) { EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) - checkSanity(); + checkSanity(); } - inline MapBase(PointerType data, Index size) - : m_data(data), - m_rows(RowsAtCompileTime == Dynamic ? size : Index(RowsAtCompileTime)), - m_cols(ColsAtCompileTime == Dynamic ? size : Index(ColsAtCompileTime)) + /** \internal Constructor for dynamically sized vectors */ + EIGEN_DEVICE_FUNC + inline MapBase(PointerType dataPtr, Index vecSize) + : m_data(dataPtr), + m_rows(RowsAtCompileTime == Dynamic ? vecSize : Index(RowsAtCompileTime)), + m_cols(ColsAtCompileTime == Dynamic ? vecSize : Index(ColsAtCompileTime)) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - eigen_assert(size >= 0); - eigen_assert(data == 0 || SizeAtCompileTime == Dynamic || SizeAtCompileTime == size); - checkSanity(); + eigen_assert(vecSize >= 0); + eigen_assert(dataPtr == 0 || SizeAtCompileTime == Dynamic || SizeAtCompileTime == vecSize); + checkSanity(); } - inline MapBase(PointerType data, Index rows, Index cols) - : m_data(data), m_rows(rows), m_cols(cols) + /** \internal Constructor for dynamically sized matrices */ + EIGEN_DEVICE_FUNC + inline MapBase(PointerType dataPtr, Index rows, Index cols) + : m_data(dataPtr), m_rows(rows), m_cols(cols) { - eigen_assert( (data == 0) + eigen_assert( (dataPtr == 0) || ( rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols))); - checkSanity(); + checkSanity(); } + #ifdef EIGEN_MAPBASE_PLUGIN + #include EIGEN_MAPBASE_PLUGIN + #endif + protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(MapBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MapBase) - void checkSanity() const + template + EIGEN_DEVICE_FUNC + void checkSanity(std::enable_if_t<(internal::traits::Alignment>0),void*> = 0) const { - EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(internal::traits::Flags&PacketAccessBit, - internal::inner_stride_at_compile_time::ret==1), - PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1); - eigen_assert(EIGEN_IMPLIES(internal::traits::Flags&AlignedBit, (size_t(m_data) % 16) == 0) - && "data is not aligned"); +#if EIGEN_MAX_ALIGN_BYTES>0 + // innerStride() is not set yet when this function is called, so we optimistically assume the lowest plausible value: + const Index minInnerStride = InnerStrideAtCompileTime == Dynamic ? 1 : Index(InnerStrideAtCompileTime); + EIGEN_ONLY_USED_FOR_DEBUG(minInnerStride); + eigen_assert(( ((internal::UIntPtr(m_data) % internal::traits::Alignment) == 0) + || (cols() * rows() * minInnerStride * sizeof(Scalar)) < internal::traits::Alignment ) && "data is not aligned"); +#endif } + template + EIGEN_DEVICE_FUNC + void checkSanity(std::enable_if_t::Alignment==0,void*> = 0) const + {} + PointerType m_data; const internal::variable_if_dynamic m_rows; const internal::variable_if_dynamic m_cols; }; +/** \ingroup Core_Module + * + * \brief Base class for non-const dense Map and Block expression with direct access + * + * This base class provides the non-const low-level accessors (e.g. coeff and coeffRef) of + * dense Map and Block objects with direct access. + * It inherits MapBase which defines the const variant for reading specific entries. + * + * \sa class Map, class Block + */ template class MapBase : public MapBase { + typedef MapBase ReadOnlyMapBase; public: typedef MapBase Base; typedef typename Base::Scalar Scalar; typedef typename Base::PacketScalar PacketScalar; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; typedef typename Base::PointerType PointerType; using Base::derived; @@ -203,20 +247,24 @@ template class MapBase using Base::rowStride; using Base::colStride; - typedef typename internal::conditional< + typedef std::conditional_t< internal::is_lvalue::value, Scalar, const Scalar - >::type ScalarWithConstIfNotLvalue; + > ScalarWithConstIfNotLvalue; + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return this->m_data; } + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return this->m_data; } // no const-cast here so non-const-correct code will give a compile error + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue& coeffRef(Index row, Index col) { return this->m_data[col * colStride() + row * rowStride()]; } + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue& coeffRef(Index index) { EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) @@ -224,32 +272,41 @@ template class MapBase } template - inline void writePacket(Index row, Index col, const PacketScalar& x) + inline void writePacket(Index row, Index col, const PacketScalar& val) { internal::pstoret - (this->m_data + (col * colStride() + row * rowStride()), x); + (this->m_data + (col * colStride() + row * rowStride()), val); } template - inline void writePacket(Index index, const PacketScalar& x) + inline void writePacket(Index index, const PacketScalar& val) { EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) internal::pstoret - (this->m_data + index * innerStride(), x); + (this->m_data + index * innerStride(), val); } - explicit inline MapBase(PointerType data) : Base(data) {} - inline MapBase(PointerType data, Index size) : Base(data, size) {} - inline MapBase(PointerType data, Index rows, Index cols) : Base(data, rows, cols) {} + EIGEN_DEVICE_FUNC explicit inline MapBase(PointerType dataPtr) : Base(dataPtr) {} + EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index vecSize) : Base(dataPtr, vecSize) {} + EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index rows, Index cols) : Base(dataPtr, rows, cols) {} + EIGEN_DEVICE_FUNC Derived& operator=(const MapBase& other) { - Base::Base::operator=(other); + ReadOnlyMapBase::Base::operator=(other); return derived(); } - using Base::Base::operator=; + // In theory we could simply refer to Base:Base::operator=, but MSVC does not like Base::Base, + // see bugs 821 and 920. + using ReadOnlyMapBase::Base::operator=; + protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(MapBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MapBase) }; +#undef EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS + +} // end namespace Eigen #endif // EIGEN_MAPBASE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MathFunctions.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MathFunctions.h index 2b454db..59cc831 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MathFunctions.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MathFunctions.h @@ -2,32 +2,28 @@ // for linear algebra. // // Copyright (C) 2006-2010 Benoit Jacob +// Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MATHFUNCTIONS_H #define EIGEN_MATHFUNCTIONS_H +// TODO this should better be moved to NumTraits +// Source: WolframAlpha +#define EIGEN_PI 3.141592653589793238462643383279502884197169399375105820974944592307816406L +#define EIGEN_LOG2E 1.442695040888963407359924681001892137426645954152985934135449406931109219L +#define EIGEN_LN2 0.693147180559945309417232121458176568075500134360255254120680009493393621L + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { -/** \internal \struct global_math_functions_filtering_base +/** \internal \class global_math_functions_filtering_base * * What it does: * Defines a typedef 'type' as follows: @@ -64,81 +60,104 @@ struct global_math_functions_filtering_base typedef typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl type; }; -#define EIGEN_MATHFUNC_IMPL(func, scalar) func##_impl::type> -#define EIGEN_MATHFUNC_RETVAL(func, scalar) typename func##_retval::type>::type - +#define EIGEN_MATHFUNC_IMPL(func, scalar) Eigen::internal::func##_impl::type> +#define EIGEN_MATHFUNC_RETVAL(func, scalar) typename Eigen::internal::func##_retval::type>::type /**************************************************************************** * Implementation of real * ****************************************************************************/ -template -struct real_impl +template::IsComplex> +struct real_default_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { return x; } }; -template -struct real_impl > +template +struct real_default_impl { - static inline RealScalar run(const std::complex& x) + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) { using std::real; return real(x); } }; -template -struct real_retval +template struct real_impl : real_default_impl {}; + +#if defined(EIGEN_GPU_COMPILE_PHASE) +template +struct real_impl > { - typedef typename NumTraits::Real type; + typedef T RealScalar; + EIGEN_DEVICE_FUNC + static inline T run(const std::complex& x) + { + return x.real(); + } }; +#endif template -inline EIGEN_MATHFUNC_RETVAL(real, Scalar) real(const Scalar& x) +struct real_retval { - return EIGEN_MATHFUNC_IMPL(real, Scalar)::run(x); -} + typedef typename NumTraits::Real type; +}; /**************************************************************************** * Implementation of imag * ****************************************************************************/ -template -struct imag_impl +template::IsComplex> +struct imag_default_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar&) { return RealScalar(0); } }; -template -struct imag_impl > +template +struct imag_default_impl { - static inline RealScalar run(const std::complex& x) + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) { using std::imag; return imag(x); } }; -template -struct imag_retval +template struct imag_impl : imag_default_impl {}; + +#if defined(EIGEN_GPU_COMPILE_PHASE) +template +struct imag_impl > { - typedef typename NumTraits::Real type; + typedef T RealScalar; + EIGEN_DEVICE_FUNC + static inline T run(const std::complex& x) + { + return x.imag(); + } }; +#endif template -inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) imag(const Scalar& x) +struct imag_retval { - return EIGEN_MATHFUNC_IMPL(imag, Scalar)::run(x); -} + typedef typename NumTraits::Real type; +}; /**************************************************************************** * Implementation of real_ref * @@ -148,10 +167,12 @@ template struct real_ref_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar& run(Scalar& x) { return reinterpret_cast(&x)[0]; } + EIGEN_DEVICE_FUNC static inline const RealScalar& run(const Scalar& x) { return reinterpret_cast(&x)[0]; @@ -164,18 +185,6 @@ struct real_ref_retval typedef typename NumTraits::Real & type; }; -template -inline typename add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x) -{ - return real_ref_impl::run(x); -} - -template -inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) real_ref(Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(real_ref, Scalar)::run(x); -} - /**************************************************************************** * Implementation of imag_ref * ****************************************************************************/ @@ -184,10 +193,12 @@ template struct imag_ref_default_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar& run(Scalar& x) { return reinterpret_cast(&x)[1]; } + EIGEN_DEVICE_FUNC static inline const RealScalar& run(const Scalar& x) { return reinterpret_cast(&x)[1]; @@ -197,10 +208,12 @@ struct imag_ref_default_impl template struct imag_ref_default_impl { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline Scalar run(Scalar&) { return Scalar(0); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline const Scalar run(const Scalar&) { return Scalar(0); @@ -216,135 +229,168 @@ struct imag_ref_retval typedef typename NumTraits::Real & type; }; -template -inline typename add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar& x) -{ - return imag_ref_impl::run(x); -} - -template -inline EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) imag_ref(Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(imag_ref, Scalar)::run(x); -} - /**************************************************************************** * Implementation of conj * ****************************************************************************/ -template -struct conj_impl +template::IsComplex> +struct conj_default_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { return x; } }; -template -struct conj_impl > +template +struct conj_default_impl { - static inline std::complex run(const std::complex& x) + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) { using std::conj; return conj(x); } }; +template::IsComplex> +struct conj_impl : conj_default_impl {}; + template struct conj_retval { typedef Scalar type; }; -template -inline EIGEN_MATHFUNC_RETVAL(conj, Scalar) conj(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(conj, Scalar)::run(x); -} - /**************************************************************************** -* Implementation of abs * +* Implementation of abs2 * ****************************************************************************/ +template +struct abs2_impl_default +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return x*x; + } +}; + template -struct abs_impl +struct abs2_impl_default // IsComplex { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { - using std::abs; - return abs(x); + return x.real()*x.real() + x.imag()*x.imag(); } }; template -struct abs_retval +struct abs2_impl { - typedef typename NumTraits::Real type; + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return abs2_impl_default::IsComplex>::run(x); + } }; template -inline EIGEN_MATHFUNC_RETVAL(abs, Scalar) abs(const Scalar& x) +struct abs2_retval { - return EIGEN_MATHFUNC_IMPL(abs, Scalar)::run(x); -} + typedef typename NumTraits::Real type; +}; /**************************************************************************** -* Implementation of abs2 * +* Implementation of sqrt/rsqrt * ****************************************************************************/ template -struct abs2_impl +struct sqrt_impl { - typedef typename NumTraits::Real RealScalar; - static inline RealScalar run(const Scalar& x) + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE Scalar run(const Scalar& x) { - return x*x; + EIGEN_USING_STD(sqrt); + return sqrt(x); } }; -template -struct abs2_impl > +// Complex sqrt defined in MathFunctionsImpl.h. +template EIGEN_DEVICE_FUNC std::complex complex_sqrt(const std::complex& a_x); + +// Custom implementation is faster than `std::sqrt`, works on +// GPU, and correctly handles special cases (unlike MSVC). +template +struct sqrt_impl > { - static inline RealScalar run(const std::complex& x) + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE std::complex run(const std::complex& x) { - using std::norm; - return norm(x); + return complex_sqrt(x); } }; template -struct abs2_retval +struct sqrt_retval { - typedef typename NumTraits::Real type; + typedef Scalar type; +}; + +// Default implementation relies on numext::sqrt, at bottom of file. +template +struct rsqrt_impl; + +// Complex rsqrt defined in MathFunctionsImpl.h. +template EIGEN_DEVICE_FUNC std::complex complex_rsqrt(const std::complex& a_x); + +template +struct rsqrt_impl > +{ + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE std::complex run(const std::complex& x) + { + return complex_rsqrt(x); + } }; template -inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) abs2(const Scalar& x) +struct rsqrt_retval { - return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x); -} + typedef Scalar type; +}; /**************************************************************************** * Implementation of norm1 * ****************************************************************************/ template -struct norm1_default_impl +struct norm1_default_impl; + +template +struct norm1_default_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { - return abs(real(x)) + abs(imag(x)); + EIGEN_USING_STD(abs); + return abs(x.real()) + abs(x.imag()); } }; template struct norm1_default_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { + EIGEN_USING_STD(abs); return abs(x); } }; @@ -358,32 +404,11 @@ struct norm1_retval typedef typename NumTraits::Real type; }; -template -inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(norm1, Scalar)::run(x); -} - /**************************************************************************** * Implementation of hypot * ****************************************************************************/ -template -struct hypot_impl -{ - typedef typename NumTraits::Real RealScalar; - static inline RealScalar run(const Scalar& x, const Scalar& y) - { - using std::max; - using std::min; - RealScalar _x = abs(x); - RealScalar _y = abs(y); - RealScalar p = (max)(_x, _y); - RealScalar q = (min)(_x, _y); - RealScalar qp = q/p; - return p * sqrt(RealScalar(1) + qp*qp); - } -}; +template struct hypot_impl; template struct hypot_retval @@ -391,222 +416,413 @@ struct hypot_retval typedef typename NumTraits::Real type; }; -template -inline EIGEN_MATHFUNC_RETVAL(hypot, Scalar) hypot(const Scalar& x, const Scalar& y) -{ - return EIGEN_MATHFUNC_IMPL(hypot, Scalar)::run(x, y); -} - /**************************************************************************** * Implementation of cast * ****************************************************************************/ -template +template struct cast_impl { + EIGEN_DEVICE_FUNC static inline NewType run(const OldType& x) { return static_cast(x); } }; +// Casting from S -> Complex leads to an implicit conversion from S to T, +// generating warnings on clang. Here we explicitly cast the real component. +template +struct cast_impl::IsComplex && NumTraits::IsComplex + >> +{ + EIGEN_DEVICE_FUNC + static inline NewType run(const OldType& x) + { + typedef typename NumTraits::Real NewReal; + return static_cast(static_cast(x)); + } +}; + // here, for once, we're plainly returning NewType: we don't want cast to do weird things. template +EIGEN_DEVICE_FUNC inline NewType cast(const OldType& x) { return cast_impl::run(x); } /**************************************************************************** -* Implementation of sqrt * +* Implementation of round * ****************************************************************************/ -template -struct sqrt_default_impl +template +struct round_impl { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) + + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { - using std::sqrt; - return sqrt(x); +#if EIGEN_HAS_CXX11_MATH + EIGEN_USING_STD(round); +#endif + return Scalar(round(x)); } }; +#if !EIGEN_HAS_CXX11_MATH +#if EIGEN_HAS_C99_MATH +// Use ::roundf for float. +template<> +struct round_impl { + EIGEN_DEVICE_FUNC + static inline float run(const float& x) + { + return ::roundf(x); + } +}; +#else template -struct sqrt_default_impl +struct round_using_floor_ceil_impl { - static inline Scalar run(const Scalar&) + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) + + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) { -#ifdef EIGEN2_SUPPORT - eigen_assert(!NumTraits::IsInteger); -#else - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) -#endif - return Scalar(0); + // Without C99 round/roundf, resort to floor/ceil. + EIGEN_USING_STD(floor); + EIGEN_USING_STD(ceil); + // If not enough precision to resolve a decimal at all, return the input. + // Otherwise, adding 0.5 can trigger an increment by 1. + const Scalar limit = Scalar(1ull << (NumTraits::digits() - 1)); + if (x >= limit || x <= -limit) { + return x; + } + return (x > Scalar(0)) ? Scalar(floor(x + Scalar(0.5))) : Scalar(ceil(x - Scalar(0.5))); } }; -template -struct sqrt_impl : sqrt_default_impl::IsInteger> {}; +template<> +struct round_impl : round_using_floor_ceil_impl {}; + +template<> +struct round_impl : round_using_floor_ceil_impl {}; +#endif // EIGEN_HAS_C99_MATH +#endif // !EIGEN_HAS_CXX11_MATH template -struct sqrt_retval +struct round_retval { typedef Scalar type; }; -template -inline EIGEN_MATHFUNC_RETVAL(sqrt, Scalar) sqrt(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(sqrt, Scalar)::run(x); -} - /**************************************************************************** -* Implementation of standard unary real functions (exp, log, sin, cos, ... * +* Implementation of rint * ****************************************************************************/ -// This macro instanciate all the necessary template mechanism which is common to all unary real functions. -#define EIGEN_MATHFUNC_STANDARD_REAL_UNARY(NAME) \ - template struct NAME##_default_impl { \ - static inline Scalar run(const Scalar& x) { using std::NAME; return NAME(x); } \ - }; \ - template struct NAME##_default_impl { \ - static inline Scalar run(const Scalar&) { \ - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) \ - return Scalar(0); \ - } \ - }; \ - template struct NAME##_impl \ - : NAME##_default_impl::IsInteger> \ - {}; \ - template struct NAME##_retval { typedef Scalar type; }; \ - template \ - inline EIGEN_MATHFUNC_RETVAL(NAME, Scalar) NAME(const Scalar& x) { \ - return EIGEN_MATHFUNC_IMPL(NAME, Scalar)::run(x); \ - } - -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(exp) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(log) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(sin) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(cos) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(tan) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(asin) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(acos) - -/**************************************************************************** -* Implementation of atan2 * -****************************************************************************/ +template +struct rint_impl { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) -template -struct atan2_default_impl -{ - typedef Scalar retval; - static inline Scalar run(const Scalar& x, const Scalar& y) + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) { - using std::atan2; - return atan2(x, y); +#if EIGEN_HAS_CXX11_MATH + EIGEN_USING_STD(rint); +#endif + return rint(x); } }; -template -struct atan2_default_impl -{ - static inline Scalar run(const Scalar&, const Scalar&) +#if !EIGEN_HAS_CXX11_MATH +template<> +struct rint_impl { + EIGEN_DEVICE_FUNC + static inline double run(const double& x) { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) - return Scalar(0); + return ::rint(x); } }; +template<> +struct rint_impl { + EIGEN_DEVICE_FUNC + static inline float run(const float& x) + { + return ::rintf(x); + } +}; +#endif template -struct atan2_impl : atan2_default_impl::IsInteger> {}; - -template -struct atan2_retval +struct rint_retval { typedef Scalar type; }; -template -inline EIGEN_MATHFUNC_RETVAL(atan2, Scalar) atan2(const Scalar& x, const Scalar& y) -{ - return EIGEN_MATHFUNC_IMPL(atan2, Scalar)::run(x, y); -} - /**************************************************************************** -* Implementation of pow * +* Implementation of arg * ****************************************************************************/ -template -struct pow_default_impl -{ - typedef Scalar retval; - static inline Scalar run(const Scalar& x, const Scalar& y) +// Visual Studio 2017 has a bug where arg(float) returns 0 for negative inputs. +// This seems to be fixed in VS 2019. +#if EIGEN_HAS_CXX11_MATH && (!EIGEN_COMP_MSVC || EIGEN_COMP_MSVC >= 1920) +// std::arg is only defined for types of std::complex, or integer types or float/double/long double +template::IsComplex || is_integral::value + || is_same::value || is_same::value + || is_same::value > +struct arg_default_impl; + +template +struct arg_default_impl { + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) { - using std::pow; - return pow(x, y); + #if defined(EIGEN_HIP_DEVICE_COMPILE) + // HIP does not seem to have a native device side implementation for the math routine "arg" + using std::arg; + #else + EIGEN_USING_STD(arg); + #endif + return static_cast(arg(x)); } }; +// Must be non-complex floating-point type (e.g. half/bfloat16). template -struct pow_default_impl +struct arg_default_impl { + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return (x < Scalar(0)) ? RealScalar(EIGEN_PI) : RealScalar(0); + } +}; +#else +template::IsComplex> +struct arg_default_impl { - static inline Scalar run(Scalar x, Scalar y) + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) { - Scalar res = 1; - eigen_assert(!NumTraits::IsSigned || y >= 0); - if(y & 1) res *= x; - y >>= 1; - while(y) - { - x *= x; - if(y&1) res *= x; - y >>= 1; - } - return res; + return (x < RealScalar(0)) ? RealScalar(EIGEN_PI) : RealScalar(0); } }; template -struct pow_impl : pow_default_impl::IsInteger> {}; - -template -struct pow_retval +struct arg_default_impl { - typedef Scalar type; + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + EIGEN_USING_STD(arg); + return arg(x); + } }; +#endif +template struct arg_impl : arg_default_impl {}; template -inline EIGEN_MATHFUNC_RETVAL(pow, Scalar) pow(const Scalar& x, const Scalar& y) +struct arg_retval { - return EIGEN_MATHFUNC_IMPL(pow, Scalar)::run(x, y); -} + typedef typename NumTraits::Real type; +}; /**************************************************************************** -* Implementation of random * +* Implementation of expm1 * ****************************************************************************/ -template -struct random_default_impl {}; +// This implementation is based on GSL Math's expm1. +namespace std_fallback { + // fallback expm1 implementation in case there is no expm1(Scalar) function in namespace of Scalar, + // or that there is no suitable std::expm1 function available. Implementation + // attributed to Kahan. See: http://www.plunk.org/~hatch/rightway.php. + template + EIGEN_DEVICE_FUNC inline Scalar expm1(const Scalar& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + typedef typename NumTraits::Real RealScalar; + + EIGEN_USING_STD(exp); + Scalar u = exp(x); + if (numext::equal_strict(u, Scalar(1))) { + return x; + } + Scalar um1 = u - RealScalar(1); + if (numext::equal_strict(um1, Scalar(-1))) { + return RealScalar(-1); + } + + EIGEN_USING_STD(log); + Scalar logu = log(u); + return numext::equal_strict(u, logu) ? u : (u - RealScalar(1)) * x / logu; + } +} template -struct random_impl : random_default_impl::IsComplex, NumTraits::IsInteger> {}; +struct expm1_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + #if EIGEN_HAS_CXX11_MATH + using std::expm1; + #else + using std_fallback::expm1; + #endif + return expm1(x); + } +}; template -struct random_retval +struct expm1_retval { typedef Scalar type; }; -template inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar& x, const Scalar& y); -template inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(); +/**************************************************************************** +* Implementation of log * +****************************************************************************/ + +// Complex log defined in MathFunctionsImpl.h. +template EIGEN_DEVICE_FUNC std::complex complex_log(const std::complex& z); template -struct random_default_impl -{ - static inline Scalar run(const Scalar& x, const Scalar& y) +struct log_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) + { + EIGEN_USING_STD(log); + return static_cast(log(x)); + } +}; + +template +struct log_impl > { + EIGEN_DEVICE_FUNC static inline std::complex run(const std::complex& z) + { + return complex_log(z); + } +}; + +/**************************************************************************** +* Implementation of log1p * +****************************************************************************/ + +namespace std_fallback { + // fallback log1p implementation in case there is no log1p(Scalar) function in namespace of Scalar, + // or that there is no suitable std::log1p function available + template + EIGEN_DEVICE_FUNC inline Scalar log1p(const Scalar& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + typedef typename NumTraits::Real RealScalar; + EIGEN_USING_STD(log); + Scalar x1p = RealScalar(1) + x; + Scalar log_1p = log_impl::run(x1p); + const bool is_small = numext::equal_strict(x1p, Scalar(1)); + const bool is_inf = numext::equal_strict(x1p, log_1p); + return (is_small || is_inf) ? x : x * (log_1p / (x1p - RealScalar(1))); + } +} + +template +struct log1p_impl { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) + { + #if EIGEN_HAS_CXX11_MATH + using std::log1p; + #else + using std_fallback::log1p; + #endif + return log1p(x); + } +}; + +// Specialization for complex types that are not supported by std::log1p. +template +struct log1p_impl > { + EIGEN_STATIC_ASSERT_NON_INTEGER(RealScalar) + + EIGEN_DEVICE_FUNC static inline std::complex run( + const std::complex& x) { + return std_fallback::log1p(x); + } +}; + +template +struct log1p_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of pow * +****************************************************************************/ + +template::IsInteger&&NumTraits::IsInteger> +struct pow_impl +{ + //typedef Scalar retval; + typedef typename ScalarBinaryOpTraits >::ReturnType result_type; + static EIGEN_DEVICE_FUNC inline result_type run(const ScalarX& x, const ScalarY& y) + { + EIGEN_USING_STD(pow); + return pow(x, y); + } +}; + +template +struct pow_impl +{ + typedef ScalarX result_type; + static EIGEN_DEVICE_FUNC inline ScalarX run(ScalarX x, ScalarY y) + { + ScalarX res(1); + eigen_assert(!NumTraits::IsSigned || y >= 0); + if(y & 1) res *= x; + y >>= 1; + while(y) + { + x *= x; + if(y&1) res *= x; + y >>= 1; + } + return res; + } +}; + +/**************************************************************************** +* Implementation of random * +****************************************************************************/ + +template +struct random_default_impl {}; + +template +struct random_impl : random_default_impl::IsComplex, NumTraits::IsInteger> {}; + +template +struct random_retval +{ + typedef Scalar type; +}; + +template inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar& x, const Scalar& y); +template inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(); + +template +struct random_default_impl +{ + static inline Scalar run(const Scalar& x, const Scalar& y) { return x + (y-x) * Scalar(std::rand()) / Scalar(RAND_MAX); } @@ -617,48 +833,48 @@ struct random_default_impl }; enum { - floor_log2_terminate, - floor_log2_move_up, - floor_log2_move_down, - floor_log2_bogus + meta_floor_log2_terminate, + meta_floor_log2_move_up, + meta_floor_log2_move_down, + meta_floor_log2_bogus }; -template struct floor_log2_selector +template struct meta_floor_log2_selector { enum { middle = (lower + upper) / 2, - value = (upper <= lower + 1) ? int(floor_log2_terminate) - : (n < (1 << middle)) ? int(floor_log2_move_down) - : (n==0) ? int(floor_log2_bogus) - : int(floor_log2_move_up) + value = (upper <= lower + 1) ? int(meta_floor_log2_terminate) + : (n < (1 << middle)) ? int(meta_floor_log2_move_down) + : (n==0) ? int(meta_floor_log2_bogus) + : int(meta_floor_log2_move_up) }; }; template::value> -struct floor_log2 {}; + int selector = meta_floor_log2_selector::value> +struct meta_floor_log2 {}; template -struct floor_log2 +struct meta_floor_log2 { - enum { value = floor_log2::middle>::value }; + enum { value = meta_floor_log2::middle>::value }; }; template -struct floor_log2 +struct meta_floor_log2 { - enum { value = floor_log2::middle, upper>::value }; + enum { value = meta_floor_log2::middle, upper>::value }; }; template -struct floor_log2 +struct meta_floor_log2 { enum { value = (n >= ((unsigned int)(1) << (lower+1))) ? lower+1 : lower }; }; template -struct floor_log2 +struct meta_floor_log2 { // no value, error at compile time }; @@ -666,11 +882,31 @@ struct floor_log2 template struct random_default_impl { - typedef typename NumTraits::NonInteger NonInteger; - static inline Scalar run(const Scalar& x, const Scalar& y) { - return x + Scalar((NonInteger(y)-x+1) * std::rand() / (RAND_MAX + NonInteger(1))); + if (y <= x) + return x; + // ScalarU is the unsigned counterpart of Scalar, possibly Scalar itself. + typedef typename make_unsigned::type ScalarU; + // ScalarX is the widest of ScalarU and unsigned int. + // We'll deal only with ScalarX and unsigned int below thus avoiding signed + // types and arithmetic and signed overflows (which are undefined behavior). + typedef std::conditional_t<(ScalarU(-1) > unsigned(-1)), ScalarU, unsigned> ScalarX; + // The following difference doesn't overflow, provided our integer types are two's + // complement and have the same number of padding bits in signed and unsigned variants. + // This is the case in most modern implementations of C++. + ScalarX range = ScalarX(y) - ScalarX(x); + ScalarX offset = 0; + ScalarX divisor = 1; + ScalarX multiplier = 1; + const unsigned rand_max = RAND_MAX; + if (range <= rand_max) divisor = (rand_max + 1) / (range + 1); + else multiplier = 1 + range / (rand_max + 1); + // Rejection sampling. + do { + offset = (unsigned(std::rand()) * multiplier) / divisor; + } while (offset > range); + return Scalar(ScalarX(x) + offset); } static inline Scalar run() @@ -678,13 +914,12 @@ struct random_default_impl #ifdef EIGEN_MAKING_DOCS return run(Scalar(NumTraits::IsSigned ? -10 : 0), Scalar(10)); #else - enum { rand_bits = floor_log2<(unsigned int)(RAND_MAX)+1>::value, + enum { rand_bits = meta_floor_log2<(unsigned int)(RAND_MAX)+1>::value, scalar_bits = sizeof(Scalar) * CHAR_BIT, - shift = EIGEN_PLAIN_ENUM_MAX(0, int(rand_bits) - int(scalar_bits)) + shift = plain_enum_max(0, int(rand_bits) - int(scalar_bits)), + offset = NumTraits::IsSigned ? (1 << (plain_enum_min(rand_bits, scalar_bits)-1)) : 0 }; - Scalar x = Scalar(std::rand() >> shift); - Scalar offset = NumTraits::IsSigned ? Scalar(1 << (rand_bits-1)) : Scalar(0); - return x - offset; + return Scalar((std::rand() >> shift) - offset); #endif } }; @@ -694,8 +929,8 @@ struct random_default_impl { static inline Scalar run(const Scalar& x, const Scalar& y) { - return Scalar(random(real(x), real(y)), - random(imag(x), imag(y))); + return Scalar(random(x.real(), y.real()), + random(x.imag(), y.imag())); } static inline Scalar run() { @@ -716,6 +951,919 @@ inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random() return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(); } +// Implementation of is* functions + +// std::is* do not work with fast-math and gcc, std::is* are available on MSVC 2013 and newer, as well as in clang. +#if (EIGEN_HAS_CXX11_MATH && !(EIGEN_COMP_GNUC_STRICT && __FINITE_MATH_ONLY__)) || (EIGEN_COMP_MSVC) || (EIGEN_COMP_CLANG) +#define EIGEN_USE_STD_FPCLASSIFY 1 +#else +#define EIGEN_USE_STD_FPCLASSIFY 0 +#endif + +template +EIGEN_DEVICE_FUNC +std::enable_if_t::value,bool> +isnan_impl(const T&) { return false; } + +template +EIGEN_DEVICE_FUNC +std::enable_if_t::value,bool> +isinf_impl(const T&) { return false; } + +template +EIGEN_DEVICE_FUNC +std::enable_if_t::value,bool> +isfinite_impl(const T&) { return true; } + +template +EIGEN_DEVICE_FUNC +std::enable_if_t<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool> +isfinite_impl(const T& x) +{ + #if defined(EIGEN_GPU_COMPILE_PHASE) + return (::isfinite)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isfinite; + return isfinite EIGEN_NOT_A_MACRO (x); + #else + return x<=NumTraits::highest() && x>=NumTraits::lowest(); + #endif +} + +template +EIGEN_DEVICE_FUNC +std::enable_if_t<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool> +isinf_impl(const T& x) +{ + #if defined(EIGEN_GPU_COMPILE_PHASE) + return (::isinf)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isinf; + return isinf EIGEN_NOT_A_MACRO (x); + #else + return x>NumTraits::highest() || x::lowest(); + #endif +} + +template +EIGEN_DEVICE_FUNC +std::enable_if_t<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool> +isnan_impl(const T& x) +{ + #if defined(EIGEN_GPU_COMPILE_PHASE) + return (::isnan)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isnan; + return isnan EIGEN_NOT_A_MACRO (x); + #else + return x != x; + #endif +} + +#if (!EIGEN_USE_STD_FPCLASSIFY) + +#if EIGEN_COMP_MSVC + +template EIGEN_DEVICE_FUNC bool isinf_msvc_helper(T x) +{ + return _fpclass(x)==_FPCLASS_NINF || _fpclass(x)==_FPCLASS_PINF; +} + +//MSVC defines a _isnan builtin function, but for double only +EIGEN_DEVICE_FUNC inline bool isnan_impl(const long double& x) { return _isnan(x)!=0; } +EIGEN_DEVICE_FUNC inline bool isnan_impl(const double& x) { return _isnan(x)!=0; } +EIGEN_DEVICE_FUNC inline bool isnan_impl(const float& x) { return _isnan(x)!=0; } + +EIGEN_DEVICE_FUNC inline bool isinf_impl(const long double& x) { return isinf_msvc_helper(x); } +EIGEN_DEVICE_FUNC inline bool isinf_impl(const double& x) { return isinf_msvc_helper(x); } +EIGEN_DEVICE_FUNC inline bool isinf_impl(const float& x) { return isinf_msvc_helper(x); } + +#elif (defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ && EIGEN_COMP_GNUC) + +#if EIGEN_COMP_GNUC + #define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((optimize("no-finite-math-only"))) +#else + // NOTE the inline qualifier and noinline attribute are both needed: the former is to avoid linking issue (duplicate symbol), + // while the second prevent too aggressive optimizations in fast-math mode: + #define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((noinline,optimize("no-finite-math-only"))) +#endif + +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const long double& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const double& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const float& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const double& x) { return __builtin_isinf(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const float& x) { return __builtin_isinf(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const long double& x) { return __builtin_isinf(x); } + +#undef EIGEN_TMP_NOOPT_ATTRIB + +#endif + +#endif + +// The following overload are defined at the end of this file +template EIGEN_DEVICE_FUNC bool isfinite_impl(const std::complex& x); +template EIGEN_DEVICE_FUNC bool isnan_impl(const std::complex& x); +template EIGEN_DEVICE_FUNC bool isinf_impl(const std::complex& x); + +template T generic_fast_tanh_float(const T& a_x); +} // end namespace internal + +/**************************************************************************** +* Generic math functions * +****************************************************************************/ + +namespace numext { + +#if (!defined(EIGEN_GPUCC) || defined(EIGEN_CONSTEXPR_ARE_DEVICE_FUNC)) +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) +{ + EIGEN_USING_STD(min) + return min EIGEN_NOT_A_MACRO (x,y); +} + +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) +{ + EIGEN_USING_STD(max) + return max EIGEN_NOT_A_MACRO (x,y); +} +#else +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) +{ + return y < x ? y : x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float mini(const float& x, const float& y) +{ + return fminf(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE double mini(const double& x, const double& y) +{ + return fmin(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE long double mini(const long double& x, const long double& y) +{ +#if defined(EIGEN_HIPCC) + // no "fminl" on HIP yet + return (x < y) ? x : y; +#else + return fminl(x, y); +#endif +} + +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) +{ + return x < y ? y : x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float maxi(const float& x, const float& y) +{ + return fmaxf(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE double maxi(const double& x, const double& y) +{ + return fmax(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE long double maxi(const long double& x, const long double& y) +{ +#if defined(EIGEN_HIPCC) + // no "fmaxl" on HIP yet + return (x > y) ? x : y; +#else + return fmaxl(x, y); +#endif +} +#endif + +#if defined(SYCL_DEVICE_ONLY) + + +#define SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_char) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_short) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_int) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_long) +#define SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_char) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_short) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_int) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_long) +#define SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_uchar) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_ushort) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_uint) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_ulong) +#define SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_uchar) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_ushort) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_uint) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_ulong) +#define SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) +#define SYCL_SPECIALIZE_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) +#define SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_float) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC,cl::sycl::cl_double) +#define SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_float) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC,cl::sycl::cl_double) +#define SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(NAME, FUNC, RET_TYPE) \ + SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, cl::sycl::cl_float) \ + SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, cl::sycl::cl_double) + +#define SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE) \ +template<> \ + EIGEN_DEVICE_FUNC \ + EIGEN_ALWAYS_INLINE RET_TYPE NAME(const ARG_TYPE& x) { \ + return cl::sycl::FUNC(x); \ + } + +#define SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, TYPE) \ + SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, TYPE, TYPE) + +#define SYCL_SPECIALIZE_GEN1_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE1, ARG_TYPE2) \ + template<> \ + EIGEN_DEVICE_FUNC \ + EIGEN_ALWAYS_INLINE RET_TYPE NAME(const ARG_TYPE1& x, const ARG_TYPE2& y) { \ + return cl::sycl::FUNC(x, y); \ + } + +#define SYCL_SPECIALIZE_GEN2_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE) \ + SYCL_SPECIALIZE_GEN1_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE, ARG_TYPE) + +#define SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, TYPE) \ + SYCL_SPECIALIZE_GEN2_BINARY_FUNC(NAME, FUNC, TYPE, TYPE) + +SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(mini, min) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(mini, fmin) +SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(maxi, max) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(maxi, fmax) + +#endif + + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(real, Scalar) real(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline internal::add_const_on_value_type_t< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) > real_ref(const Scalar& x) +{ + return internal::real_ref_impl::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) real_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real_ref, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) imag(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(arg, Scalar) arg(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(arg, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline internal::add_const_on_value_type_t< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) > imag_ref(const Scalar& x) +{ + return internal::imag_ref_impl::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) imag_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag_ref, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(conj, Scalar) conj(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(conj, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) abs2(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x); +} + +EIGEN_DEVICE_FUNC +inline bool abs2(bool x) { return x; } + +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T absdiff(const T& x, const T& y) +{ + return x > y ? x - y : y - x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float absdiff(const float& x, const float& y) +{ + return fabsf(x - y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE double absdiff(const double& x, const double& y) +{ + return fabs(x - y); +} + +#if !defined(EIGEN_GPUCC) +// HIP and CUDA do not support long double. +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE long double absdiff(const long double& x, const long double& y) { + return fabsl(x - y); +} +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(norm1, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(hypot, Scalar) hypot(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(hypot, Scalar)::run(x, y); +} + +#if defined(SYCL_DEVICE_ONLY) + SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(hypot, hypot) +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(log1p, Scalar) log1p(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(log1p, Scalar)::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(log1p, log1p) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float log1p(const float &x) { return ::log1pf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double log1p(const double &x) { return ::log1p(x); } +#endif + +template +EIGEN_DEVICE_FUNC +inline typename internal::pow_impl::result_type pow(const ScalarX& x, const ScalarY& y) +{ + return internal::pow_impl::run(x, y); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(pow, pow) +#endif + +template EIGEN_DEVICE_FUNC bool (isnan) (const T &x) { return internal::isnan_impl(x); } +template EIGEN_DEVICE_FUNC bool (isinf) (const T &x) { return internal::isinf_impl(x); } +template EIGEN_DEVICE_FUNC bool (isfinite)(const T &x) { return internal::isfinite_impl(x); } + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(isnan, isnan, bool) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(isinf, isinf, bool) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(isfinite, isfinite, bool) +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(rint, Scalar) rint(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(rint, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(round, Scalar) round(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(round, Scalar)::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(round, round) +#endif + +template +EIGEN_DEVICE_FUNC +T (floor)(const T& x) +{ + EIGEN_USING_STD(floor) + return floor(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(floor, floor) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float floor(const float &x) { return ::floorf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double floor(const double &x) { return ::floor(x); } +#endif + +template +EIGEN_DEVICE_FUNC +T (ceil)(const T& x) +{ + EIGEN_USING_STD(ceil); + return ceil(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(ceil, ceil) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float ceil(const float &x) { return ::ceilf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double ceil(const double &x) { return ::ceil(x); } +#endif + + +/** Log base 2 for 32 bits positive integers. + * Conveniently returns 0 for x==0. */ +inline int log2(int x) +{ + eigen_assert(x>=0); + unsigned int v(x); + static const int table[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 }; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + return table[(v * 0x07C4ACDDU) >> 27]; +} + +/** \returns the square root of \a x. + * + * It is essentially equivalent to + * \code using std::sqrt; return sqrt(x); \endcode + * but slightly faster for float/double and some compilers (e.g., gcc), thanks to + * specializations when SSE is enabled. + * + * It's usage is justified in performance critical functions, like norm/normalize. + */ +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE EIGEN_MATHFUNC_RETVAL(sqrt, Scalar) sqrt(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(sqrt, Scalar)::run(x); +} + +// Boolean specialization, avoids implicit float to bool conversion (-Wimplicit-conversion-floating-point-to-bool). +template<> +EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC +bool sqrt(const bool &x) { return x; } + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(sqrt, sqrt) +#endif + +/** \returns the reciprocal square root of \a x. **/ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T rsqrt(const T& x) +{ + return internal::rsqrt_impl::run(x); +} + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T log(const T &x) { + return internal::log_impl::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(log, log) +#endif + + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float log(const float &x) { return ::logf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double log(const double &x) { return ::log(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +std::enable_if_t::IsSigned || NumTraits::IsComplex,typename NumTraits::Real> +abs(const T &x) { + EIGEN_USING_STD(abs); + return abs(x); +} + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +std::enable_if_t::IsSigned || NumTraits::IsComplex),typename NumTraits::Real> +abs(const T &x) { + return x; +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_INTEGER_TYPES_UNARY(abs, abs) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(abs, fabs) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float abs(const float &x) { return ::fabsf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double abs(const double &x) { return ::fabs(x); } + +template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float abs(const std::complex& x) { + return ::hypotf(x.real(), x.imag()); +} + +template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double abs(const std::complex& x) { + return ::hypot(x.real(), x.imag()); +} +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T exp(const T &x) { + EIGEN_USING_STD(exp); + return exp(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(exp, exp) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float exp(const float &x) { return ::expf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double exp(const double &x) { return ::exp(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +std::complex exp(const std::complex& x) { + float com = ::expf(x.real()); + float res_real = com * ::cosf(x.imag()); + float res_imag = com * ::sinf(x.imag()); + return std::complex(res_real, res_imag); +} + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +std::complex exp(const std::complex& x) { + double com = ::exp(x.real()); + double res_real = com * ::cos(x.imag()); + double res_imag = com * ::sin(x.imag()); + return std::complex(res_real, res_imag); +} +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(expm1, Scalar) expm1(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(expm1, Scalar)::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(expm1, expm1) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float expm1(const float &x) { return ::expm1f(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double expm1(const double &x) { return ::expm1(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T cos(const T &x) { + EIGEN_USING_STD(cos); + return cos(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(cos,cos) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float cos(const float &x) { return ::cosf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double cos(const double &x) { return ::cos(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T sin(const T &x) { + EIGEN_USING_STD(sin); + return sin(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(sin, sin) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float sin(const float &x) { return ::sinf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double sin(const double &x) { return ::sin(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T tan(const T &x) { + EIGEN_USING_STD(tan); + return tan(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(tan, tan) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tan(const float &x) { return ::tanf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double tan(const double &x) { return ::tan(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T acos(const T &x) { + EIGEN_USING_STD(acos); + return acos(x); +} + +#if EIGEN_HAS_CXX11_MATH +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T acosh(const T &x) { + EIGEN_USING_STD(acosh); + return static_cast(acosh(x)); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(acos, acos) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(acosh, acosh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float acos(const float &x) { return ::acosf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double acos(const double &x) { return ::acos(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T asin(const T &x) { + EIGEN_USING_STD(asin); + return asin(x); +} + +#if EIGEN_HAS_CXX11_MATH +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T asinh(const T &x) { + EIGEN_USING_STD(asinh); + return static_cast(asinh(x)); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(asin, asin) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(asinh, asinh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float asin(const float &x) { return ::asinf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double asin(const double &x) { return ::asin(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T atan(const T &x) { + EIGEN_USING_STD(atan); + return static_cast(atan(x)); +} + +#if EIGEN_HAS_CXX11_MATH +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T atanh(const T &x) { + EIGEN_USING_STD(atanh); + return static_cast(atanh(x)); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(atan, atan) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(atanh, atanh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float atan(const float &x) { return ::atanf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double atan(const double &x) { return ::atan(x); } +#endif + + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T cosh(const T &x) { + EIGEN_USING_STD(cosh); + return static_cast(cosh(x)); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(cosh, cosh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float cosh(const float &x) { return ::coshf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double cosh(const double &x) { return ::cosh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T sinh(const T &x) { + EIGEN_USING_STD(sinh); + return static_cast(sinh(x)); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(sinh, sinh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float sinh(const float &x) { return ::sinhf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double sinh(const double &x) { return ::sinh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T tanh(const T &x) { + EIGEN_USING_STD(tanh); + return tanh(x); +} + +#if (!defined(EIGEN_GPUCC)) && EIGEN_FAST_MATH && !defined(SYCL_DEVICE_ONLY) +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tanh(float x) { return internal::generic_fast_tanh_float(x); } +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(tanh, tanh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tanh(const float &x) { return ::tanhf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double tanh(const double &x) { return ::tanh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T fmod(const T& a, const T& b) { + EIGEN_USING_STD(fmod); + return fmod(a, b); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(fmod, fmod) +#endif + +#if defined(EIGEN_GPUCC) +template <> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float fmod(const float& a, const float& b) { + return ::fmodf(a, b); +} + +template <> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double fmod(const double& a, const double& b) { + return ::fmod(a, b); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +#undef SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY +#undef SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY +#undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY +#undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY +#undef SYCL_SPECIALIZE_INTEGER_TYPES_BINARY +#undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY +#undef SYCL_SPECIALIZE_FLOATING_TYPES_BINARY +#undef SYCL_SPECIALIZE_FLOATING_TYPES_UNARY +#undef SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE +#undef SYCL_SPECIALIZE_GEN_UNARY_FUNC +#undef SYCL_SPECIALIZE_UNARY_FUNC +#undef SYCL_SPECIALIZE_GEN1_BINARY_FUNC +#undef SYCL_SPECIALIZE_GEN2_BINARY_FUNC +#undef SYCL_SPECIALIZE_BINARY_FUNC +#endif + +} // end namespace numext + +namespace internal { + +template +EIGEN_DEVICE_FUNC bool isfinite_impl(const std::complex& x) +{ + return (numext::isfinite)(numext::real(x)) && (numext::isfinite)(numext::imag(x)); +} + +template +EIGEN_DEVICE_FUNC bool isnan_impl(const std::complex& x) +{ + return (numext::isnan)(numext::real(x)) || (numext::isnan)(numext::imag(x)); +} + +template +EIGEN_DEVICE_FUNC bool isinf_impl(const std::complex& x) +{ + return ((numext::isinf)(numext::real(x)) || (numext::isinf)(numext::imag(x))) && (!(numext::isnan)(x)); +} + /**************************************************************************** * Implementation of fuzzy comparisons * ****************************************************************************/ @@ -729,16 +1877,17 @@ template struct scalar_fuzzy_default_impl { typedef typename NumTraits::Real RealScalar; - template + template EIGEN_DEVICE_FUNC static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) { - return abs(x) <= abs(y) * prec; + return numext::abs(x) <= numext::abs(y) * prec; } + EIGEN_DEVICE_FUNC static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) { - using std::min; - return abs(x - y) <= (min)(abs(x), abs(y)) * prec; + return numext::abs(x - y) <= numext::mini(numext::abs(x), numext::abs(y)) * prec; } + EIGEN_DEVICE_FUNC static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar& prec) { return x <= y || isApprox(x, y, prec); @@ -749,15 +1898,17 @@ template struct scalar_fuzzy_default_impl { typedef typename NumTraits::Real RealScalar; - template + template EIGEN_DEVICE_FUNC static inline bool isMuchSmallerThan(const Scalar& x, const Scalar&, const RealScalar&) { return x == Scalar(0); } + EIGEN_DEVICE_FUNC static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar&) { return x == y; } + EIGEN_DEVICE_FUNC static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar&) { return x <= y; @@ -768,38 +1919,38 @@ template struct scalar_fuzzy_default_impl { typedef typename NumTraits::Real RealScalar; - template + template EIGEN_DEVICE_FUNC static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) { - return abs2(x) <= abs2(y) * prec * prec; + return numext::abs2(x) <= numext::abs2(y) * prec * prec; } + EIGEN_DEVICE_FUNC static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) { - using std::min; - return abs2(x - y) <= (min)(abs2(x), abs2(y)) * prec * prec; + return numext::abs2(x - y) <= numext::mini(numext::abs2(x), numext::abs2(y)) * prec * prec; } }; template struct scalar_fuzzy_impl : scalar_fuzzy_default_impl::IsComplex, NumTraits::IsInteger> {}; -template +template EIGEN_DEVICE_FUNC inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, - typename NumTraits::Real precision = NumTraits::dummy_precision()) + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) { return scalar_fuzzy_impl::template isMuchSmallerThan(x, y, precision); } -template +template EIGEN_DEVICE_FUNC inline bool isApprox(const Scalar& x, const Scalar& y, - typename NumTraits::Real precision = NumTraits::dummy_precision()) + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) { return scalar_fuzzy_impl::isApprox(x, y, precision); } -template +template EIGEN_DEVICE_FUNC inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, - typename NumTraits::Real precision = NumTraits::dummy_precision()) + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) { return scalar_fuzzy_impl::isApproxOrLessThan(x, y, precision); } @@ -814,30 +1965,92 @@ template<> struct random_impl { return random(0,1)==0 ? false : true; } + + static inline bool run(const bool& a, const bool& b) + { + return random(a, b)==0 ? false : true; + } }; template<> struct scalar_fuzzy_impl { typedef bool RealScalar; - - template + + template EIGEN_DEVICE_FUNC static inline bool isMuchSmallerThan(const bool& x, const bool&, const bool&) { return !x; } - + + EIGEN_DEVICE_FUNC static inline bool isApprox(bool x, bool y, bool) { return x == y; } + EIGEN_DEVICE_FUNC static inline bool isApproxOrLessThan(const bool& x, const bool& y, const bool&) { return (!x) || y; } - + +}; + +} // end namespace internal + +// Default implementations that rely on other numext implementations +namespace internal { + +// Specialization for complex types that are not supported by std::expm1. +template +struct expm1_impl > { + EIGEN_STATIC_ASSERT_NON_INTEGER(RealScalar) + + EIGEN_DEVICE_FUNC static inline std::complex run( + const std::complex& x) { + RealScalar xr = x.real(); + RealScalar xi = x.imag(); + // expm1(z) = exp(z) - 1 + // = exp(x + i * y) - 1 + // = exp(x) * (cos(y) + i * sin(y)) - 1 + // = exp(x) * cos(y) - 1 + i * exp(x) * sin(y) + // Imag(expm1(z)) = exp(x) * sin(y) + // Real(expm1(z)) = exp(x) * cos(y) - 1 + // = exp(x) * cos(y) - 1. + // = expm1(x) + exp(x) * (cos(y) - 1) + // = expm1(x) + exp(x) * (2 * sin(y / 2) ** 2) + RealScalar erm1 = numext::expm1(xr); + RealScalar er = erm1 + RealScalar(1.); + RealScalar sin2 = numext::sin(xi / RealScalar(2.)); + sin2 = sin2 * sin2; + RealScalar s = numext::sin(xi); + RealScalar real_part = erm1 - RealScalar(2.) * er * sin2; + return std::complex(real_part, er * s); + } +}; + +template +struct rsqrt_impl { + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE T run(const T& x) { + return T(1)/numext::sqrt(x); + } }; +#if defined(EIGEN_GPU_COMPILE_PHASE) +template +struct conj_impl, true> +{ + EIGEN_DEVICE_FUNC + static inline std::complex run(const std::complex& x) + { + return std::complex(numext::real(x), -numext::imag(x)); + } +}; +#endif + } // end namespace internal +} // end namespace Eigen + #endif // EIGEN_MATHFUNCTIONS_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MathFunctionsImpl.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MathFunctionsImpl.h new file mode 100644 index 0000000..642e5d6 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MathFunctionsImpl.h @@ -0,0 +1,335 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014 Pedro Gonnet (pedro.gonnet@gmail.com) +// Copyright (C) 2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATHFUNCTIONSIMPL_H +#define EIGEN_MATHFUNCTIONSIMPL_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +/** \internal Fast reciprocal using Newton-Raphson's method. + + Preconditions: + 1. The starting guess provided in approx_a_recip must have at least half + the leading mantissa bits in the correct result, such that a single + Newton-Raphson step is sufficient to get within 1-2 ulps of the currect + result. + 2. If a is zero, approx_a_recip must be infinite with the same sign as a. + 3. If a is infinite, approx_a_recip must be zero with the same sign as a. + + If the preconditions are satisfied, which they are for for the _*_rcp_ps + instructions on x86, the result has a maximum relative error of 2 ulps, + and correctly handles reciprocals of zero, infinity, and NaN. +*/ +template +struct generic_reciprocal_newton_step { + static_assert(Steps > 0, "Steps must be at least 1."); + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Packet + run(const Packet& a, const Packet& approx_a_recip) { + using Scalar = typename unpacket_traits::type; + const Packet two = pset1(Scalar(2)); + // Refine the approximation using one Newton-Raphson step: + // x_{i} = x_{i-1} * (2 - a * x_{i-1}) + const Packet x = + generic_reciprocal_newton_step::run(a, approx_a_recip); + const Packet tmp = pnmadd(a, x, two); + // If tmp is NaN, it means that a is either +/-0 or +/-Inf. + // In this case return the approximation directly. + const Packet is_not_nan = pcmp_eq(tmp, tmp); + return pselect(is_not_nan, pmul(x, tmp), x); + } +}; + +template +struct generic_reciprocal_newton_step { + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Packet + run(const Packet& /*unused*/, const Packet& approx_rsqrt) { + return approx_rsqrt; + } +}; + + +/** \internal Fast reciprocal sqrt using Newton-Raphson's method. + + Preconditions: + 1. The starting guess provided in approx_a_recip must have at least half + the leading mantissa bits in the correct result, such that a single + Newton-Raphson step is sufficient to get within 1-2 ulps of the currect + result. + 2. If a is zero, approx_a_recip must be infinite with the same sign as a. + 3. If a is infinite, approx_a_recip must be zero with the same sign as a. + + If the preconditions are satisfied, which they are for for the _*_rcp_ps + instructions on x86, the result has a maximum relative error of 2 ulps, + and correctly handles zero, infinity, and NaN. Positive denormals are + treated as zero. +*/ +template +struct generic_rsqrt_newton_step { + static_assert(Steps > 0, "Steps must be at least 1."); + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Packet + run(const Packet& a, const Packet& approx_rsqrt) { + using Scalar = typename unpacket_traits::type; + const Packet one_point_five = pset1(Scalar(1.5)); + const Packet minus_half = pset1(Scalar(-0.5)); + + // Refine the approximation using one Newton-Raphson step: + // x_{n+1} = x_n * (1.5 + (-0.5 * x_n) * (a * x_n)). + // The approximation is expressed this way to avoid over/under-flows. + Packet x_newton = pmul(approx_rsqrt, pmadd(pmul(minus_half, approx_rsqrt), pmul(a, approx_rsqrt), one_point_five)); + for (int step = 1; step < Steps; ++step) { + x_newton = pmul(x_newton, pmadd(pmul(minus_half, x_newton), pmul(a, x_newton), one_point_five)); + } + + // If approx_rsqrt is 0 or +/-inf, we should return it as is. Note: + // on intel, approx_rsqrt can be inf for small denormal values. + const Packet return_approx = por(pcmp_eq(approx_rsqrt, pzero(a)), + pcmp_eq(pabs(approx_rsqrt), pset1(NumTraits::infinity()))); + return pselect(return_approx, approx_rsqrt, x_newton); + } +}; + +template +struct generic_rsqrt_newton_step { + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Packet + run(const Packet& /*unused*/, const Packet& approx_rsqrt) { + return approx_rsqrt; + } +}; + + +/** \internal Fast sqrt using Newton-Raphson's method. + + Preconditions: + 1. The starting guess for the reciprocal sqrt provided in approx_rsqrt must + have at least half the leading mantissa bits in the correct result, such + that a single Newton-Raphson step is sufficient to get within 1-2 ulps of + the currect result. + 2. If a is zero, approx_rsqrt must be infinite. + 3. If a is infinite, approx_rsqrt must be zero. + + If the preconditions are satisfied, which they are for for the _*_rsqrt_ps + instructions on x86, the result has a maximum relative error of 2 ulps, + and correctly handles zero and infinity, and NaN. Positive denormal inputs + are treated as zero. +*/ +template +struct generic_sqrt_newton_step { + static_assert(Steps > 0, "Steps must be at least 1."); + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Packet + run(const Packet& a, const Packet& approx_rsqrt) { + using Scalar = typename unpacket_traits::type; + const Packet one_point_five = pset1(Scalar(1.5)); + const Packet minus_half = pset1(Scalar(-0.5)); + // If a is inf or zero, return a directly. + const Packet inf_mask = pcmp_eq(a, pset1(NumTraits::infinity())); + const Packet return_a = por(pcmp_eq(a, pzero(a)), inf_mask); + // Do a single step of Newton's iteration for reciprocal square root: + // x_{n+1} = x_n * (1.5 + (-0.5 * x_n) * (a * x_n))). + // The Newton's step is computed this way to avoid over/under-flows. + Packet rsqrt = pmul(approx_rsqrt, pmadd(pmul(minus_half, approx_rsqrt), pmul(a, approx_rsqrt), one_point_five)); + for (int step = 1; step < Steps; ++step) { + rsqrt = pmul(rsqrt, pmadd(pmul(minus_half, rsqrt), pmul(a, rsqrt), one_point_five)); + } + + // Return sqrt(x) = x * rsqrt(x) for non-zero finite positive arguments. + // Return a itself for 0 or +inf, NaN for negative arguments. + return pselect(return_a, a, pmul(a, rsqrt)); + } +}; + +/** \internal \returns the hyperbolic tan of \a a (coeff-wise) + Doesn't do anything fancy, just a 13/6-degree rational interpolant which + is accurate up to a couple of ulps in the (approximate) range [-8, 8], + outside of which tanh(x) = +/-1 in single precision. The input is clamped + to the range [-c, c]. The value c is chosen as the smallest value where + the approximation evaluates to exactly 1. In the reange [-0.0004, 0.0004] + the approximation tanh(x) ~= x is used for better accuracy as x tends to zero. + + This implementation works on both scalars and packets. +*/ +template +T generic_fast_tanh_float(const T& a_x) +{ + // Clamp the inputs to the range [-c, c] +#ifdef EIGEN_VECTORIZE_FMA + const T plus_clamp = pset1(7.99881172180175781f); + const T minus_clamp = pset1(-7.99881172180175781f); +#else + const T plus_clamp = pset1(7.90531110763549805f); + const T minus_clamp = pset1(-7.90531110763549805f); +#endif + const T tiny = pset1(0.0004f); + const T x = pmax(pmin(a_x, plus_clamp), minus_clamp); + const T tiny_mask = pcmp_lt(pabs(a_x), tiny); + // The monomial coefficients of the numerator polynomial (odd). + const T alpha_1 = pset1(4.89352455891786e-03f); + const T alpha_3 = pset1(6.37261928875436e-04f); + const T alpha_5 = pset1(1.48572235717979e-05f); + const T alpha_7 = pset1(5.12229709037114e-08f); + const T alpha_9 = pset1(-8.60467152213735e-11f); + const T alpha_11 = pset1(2.00018790482477e-13f); + const T alpha_13 = pset1(-2.76076847742355e-16f); + + // The monomial coefficients of the denominator polynomial (even). + const T beta_0 = pset1(4.89352518554385e-03f); + const T beta_2 = pset1(2.26843463243900e-03f); + const T beta_4 = pset1(1.18534705686654e-04f); + const T beta_6 = pset1(1.19825839466702e-06f); + + // Since the polynomials are odd/even, we need x^2. + const T x2 = pmul(x, x); + + // Evaluate the numerator polynomial p. + T p = pmadd(x2, alpha_13, alpha_11); + p = pmadd(x2, p, alpha_9); + p = pmadd(x2, p, alpha_7); + p = pmadd(x2, p, alpha_5); + p = pmadd(x2, p, alpha_3); + p = pmadd(x2, p, alpha_1); + p = pmul(x, p); + + // Evaluate the denominator polynomial q. + T q = pmadd(x2, beta_6, beta_4); + q = pmadd(x2, q, beta_2); + q = pmadd(x2, q, beta_0); + + // Divide the numerator by the denominator. + return pselect(tiny_mask, x, pdiv(p, q)); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +RealScalar positive_real_hypot(const RealScalar& x, const RealScalar& y) +{ + // IEEE IEC 6059 special cases. + if ((numext::isinf)(x) || (numext::isinf)(y)) + return NumTraits::infinity(); + if ((numext::isnan)(x) || (numext::isnan)(y)) + return NumTraits::quiet_NaN(); + + EIGEN_USING_STD(sqrt); + RealScalar p, qp; + p = numext::maxi(x,y); + if(numext::is_exactly_zero(p)) return RealScalar(0); + qp = numext::mini(y,x) / p; + return p * sqrt(RealScalar(1) + qp*qp); +} + +template +struct hypot_impl +{ + typedef typename NumTraits::Real RealScalar; + static EIGEN_DEVICE_FUNC + inline RealScalar run(const Scalar& x, const Scalar& y) + { + EIGEN_USING_STD(abs); + return positive_real_hypot(abs(x), abs(y)); + } +}; + +// Generic complex sqrt implementation that correctly handles corner cases +// according to https://en.cppreference.com/w/cpp/numeric/complex/sqrt +template +EIGEN_DEVICE_FUNC std::complex complex_sqrt(const std::complex& z) { + // Computes the principal sqrt of the input. + // + // For a complex square root of the number x + i*y. We want to find real + // numbers u and v such that + // (u + i*v)^2 = x + i*y <=> + // u^2 - v^2 + i*2*u*v = x + i*v. + // By equating the real and imaginary parts we get: + // u^2 - v^2 = x + // 2*u*v = y. + // + // For x >= 0, this has the numerically stable solution + // u = sqrt(0.5 * (x + sqrt(x^2 + y^2))) + // v = y / (2 * u) + // and for x < 0, + // v = sign(y) * sqrt(0.5 * (-x + sqrt(x^2 + y^2))) + // u = y / (2 * v) + // + // Letting w = sqrt(0.5 * (|x| + |z|)), + // if x == 0: u = w, v = sign(y) * w + // if x > 0: u = w, v = y / (2 * w) + // if x < 0: u = |y| / (2 * w), v = sign(y) * w + + const T x = numext::real(z); + const T y = numext::imag(z); + const T zero = T(0); + const T w = numext::sqrt(T(0.5) * (numext::abs(x) + numext::hypot(x, y))); + + return + (numext::isinf)(y) ? std::complex(NumTraits::infinity(), y) + : numext::is_exactly_zero(x) ? std::complex(w, y < zero ? -w : w) + : x > zero ? std::complex(w, y / (2 * w)) + : std::complex(numext::abs(y) / (2 * w), y < zero ? -w : w ); +} + +// Generic complex rsqrt implementation. +template +EIGEN_DEVICE_FUNC std::complex complex_rsqrt(const std::complex& z) { + // Computes the principal reciprocal sqrt of the input. + // + // For a complex reciprocal square root of the number z = x + i*y. We want to + // find real numbers u and v such that + // (u + i*v)^2 = 1 / (x + i*y) <=> + // u^2 - v^2 + i*2*u*v = x/|z|^2 - i*v/|z|^2. + // By equating the real and imaginary parts we get: + // u^2 - v^2 = x/|z|^2 + // 2*u*v = y/|z|^2. + // + // For x >= 0, this has the numerically stable solution + // u = sqrt(0.5 * (x + |z|)) / |z| + // v = -y / (2 * u * |z|) + // and for x < 0, + // v = -sign(y) * sqrt(0.5 * (-x + |z|)) / |z| + // u = -y / (2 * v * |z|) + // + // Letting w = sqrt(0.5 * (|x| + |z|)), + // if x == 0: u = w / |z|, v = -sign(y) * w / |z| + // if x > 0: u = w / |z|, v = -y / (2 * w * |z|) + // if x < 0: u = |y| / (2 * w * |z|), v = -sign(y) * w / |z| + + const T x = numext::real(z); + const T y = numext::imag(z); + const T zero = T(0); + + const T abs_z = numext::hypot(x, y); + const T w = numext::sqrt(T(0.5) * (numext::abs(x) + abs_z)); + const T woz = w / abs_z; + // Corner cases consistent with 1/sqrt(z) on gcc/clang. + return + numext::is_exactly_zero(abs_z) ? std::complex(NumTraits::infinity(), NumTraits::quiet_NaN()) + : ((numext::isinf)(x) || (numext::isinf)(y)) ? std::complex(zero, zero) + : numext::is_exactly_zero(x) ? std::complex(woz, y < zero ? woz : -woz) + : x > zero ? std::complex(woz, -y / (2 * w * abs_z)) + : std::complex(numext::abs(y) / (2 * w * abs_z), y < zero ? woz : -woz ); +} + +template +EIGEN_DEVICE_FUNC std::complex complex_log(const std::complex& z) { + // Computes complex log. + T a = numext::abs(z); + EIGEN_USING_STD(atan2); + T b = atan2(z.imag(), z.real()); + return std::complex(numext::log(a), b); +} + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_MATHFUNCTIONSIMPL_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Matrix.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Matrix.h index 982c925..23acd8a 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Matrix.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Matrix.h @@ -4,28 +4,56 @@ // Copyright (C) 2006-2010 Benoit Jacob // Copyright (C) 2008-2009 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MATRIX_H #define EIGEN_MATRIX_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { +template +struct traits > +{ +private: + constexpr static int size = internal::size_at_compile_time(Rows_,Cols_); + typedef typename find_best_packet::type PacketScalar; + enum { + row_major_bit = Options_&RowMajor ? RowMajorBit : 0, + is_dynamic_size_storage = MaxRows_==Dynamic || MaxCols_==Dynamic, + max_size = is_dynamic_size_storage ? Dynamic : MaxRows_*MaxCols_, + default_alignment = compute_default_alignment::value, + actual_alignment = ((Options_&DontAlign)==0) ? default_alignment : 0, + required_alignment = unpacket_traits::alignment, + packet_access_bit = (packet_traits::Vectorizable && (EIGEN_UNALIGNED_VECTORIZE || (actual_alignment>=required_alignment))) ? PacketAccessBit : 0 + }; + +public: + typedef Scalar_ Scalar; + typedef Dense StorageKind; + typedef Eigen::Index StorageIndex; + typedef MatrixXpr XprKind; + enum { + RowsAtCompileTime = Rows_, + ColsAtCompileTime = Cols_, + MaxRowsAtCompileTime = MaxRows_, + MaxColsAtCompileTime = MaxCols_, + Flags = compute_matrix_flags(Options_), + Options = Options_, + InnerStrideAtCompileTime = 1, + OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime, + + // FIXME, the following flag in only used to define NeedsToAlign in PlainObjectBase + EvaluatorFlags = LinearAccessBit | DirectAccessBit | packet_access_bit | row_major_bit, + Alignment = actual_alignment + }; +}; +} + /** \class Matrix * \ingroup Core_Module * @@ -37,18 +65,18 @@ * The %Matrix class encompasses \em both fixed-size and dynamic-size objects (\ref fixedsize "note"). * * The first three template parameters are required: - * \tparam _Scalar \anchor matrix_tparam_scalar Numeric type, e.g. float, double, int or std::complex. - * User defined sclar types are supported as well (see \ref user_defined_scalars "here"). - * \tparam _Rows Number of rows, or \b Dynamic - * \tparam _Cols Number of columns, or \b Dynamic + * \tparam Scalar_ Numeric type, e.g. float, double, int or std::complex. + * User defined scalar types are supported as well (see \ref user_defined_scalars "here"). + * \tparam Rows_ Number of rows, or \b Dynamic + * \tparam Cols_ Number of columns, or \b Dynamic * * The remaining template parameters are optional -- in most cases you don't have to worry about them. - * \tparam _Options \anchor matrix_tparam_options A combination of either \b #RowMajor or \b #ColMajor, and of either + * \tparam Options_ A combination of either \b #RowMajor or \b #ColMajor, and of either * \b #AutoAlign or \b #DontAlign. * The former controls \ref TopicStorageOrders "storage order", and defaults to column-major. The latter controls alignment, which is required * for vectorization. It defaults to aligning matrices except for fixed sizes that aren't a multiple of the packet size. - * \tparam _MaxRows Maximum number of rows. Defaults to \a _Rows (\ref maxrows "note"). - * \tparam _MaxCols Maximum number of columns. Defaults to \a _Cols (\ref maxrows "note"). + * \tparam MaxRows_ Maximum number of rows. Defaults to \a Rows_ (\ref maxrows "note"). + * \tparam MaxCols_ Maximum number of columns. Defaults to \a Cols_ (\ref maxrows "note"). * * Eigen provides a number of typedefs covering the usual cases. Here are some examples: * @@ -80,7 +108,7 @@ * \endcode * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_MATRIX_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_MATRIX_PLUGIN. * * Some notes: * @@ -102,43 +130,55 @@ * Note that \em dense matrices, be they Fixed-size or Dynamic-size, do not expand dynamically in the sense of a std::map. * If you want this behavior, see the Sparse module. * - *
\anchor maxrows _MaxRows and _MaxCols:
+ *
\anchor maxrows MaxRows_ and MaxCols_:
*
In most cases, one just leaves these parameters to the default values. * These parameters mean the maximum size of rows and columns that the matrix may have. They are useful in cases * when the exact numbers of rows and columns are not known are compile-time, but it is known at compile-time that they cannot - * exceed a certain value. This happens when taking dynamic-size blocks inside fixed-size matrices: in this case _MaxRows and _MaxCols - * are the dimensions of the original matrix, while _Rows and _Cols are Dynamic.
+ * exceed a certain value. This happens when taking dynamic-size blocks inside fixed-size matrices: in this case MaxRows_ and MaxCols_ + * are the dimensions of the original matrix, while Rows_ and Cols_ are Dynamic. * * - * \see MatrixBase for the majority of the API methods for matrices, \ref TopicClassHierarchy, - * \ref TopicStorageOrders + * ABI and storage layout + * + * The table below summarizes the ABI of some possible Matrix instances which is fixed thorough the lifetime of Eigen 3. + * + * + * + * + * + * + *
Matrix typeEquivalent C structure
\code Matrix \endcode\code + * struct { + * T *data; // with (size_t(data)%EIGEN_MAX_ALIGN_BYTES)==0 + * Eigen::Index rows, cols; + * }; + * \endcode
\code + * Matrix + * Matrix \endcode\code + * struct { + * T *data; // with (size_t(data)%EIGEN_MAX_ALIGN_BYTES)==0 + * Eigen::Index size; + * }; + * \endcode
\code Matrix \endcode\code + * struct { + * T data[Rows*Cols]; // with (size_t(data)%A(Rows*Cols*sizeof(T)))==0 + * }; + * \endcode
\code Matrix \endcode\code + * struct { + * T data[MaxRows*MaxCols]; // with (size_t(data)%A(MaxRows*MaxCols*sizeof(T)))==0 + * Eigen::Index rows, cols; + * }; + * \endcode
+ * Note that in this table Rows, Cols, MaxRows and MaxCols are all positive integers. A(S) is defined to the largest possible power-of-two + * smaller to EIGEN_MAX_STATIC_ALIGN_BYTES. + * + * \see MatrixBase for the majority of the API methods for matrices, \ref TopicClassHierarchy, + * \ref TopicStorageOrders */ -namespace internal { -template -struct traits > -{ - typedef _Scalar Scalar; - typedef Dense StorageKind; - typedef DenseIndex Index; - typedef MatrixXpr XprKind; - enum { - RowsAtCompileTime = _Rows, - ColsAtCompileTime = _Cols, - MaxRowsAtCompileTime = _MaxRows, - MaxColsAtCompileTime = _MaxCols, - Flags = compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret, - CoeffReadCost = NumTraits::ReadCost, - Options = _Options, - InnerStrideAtCompileTime = 1, - OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime - }; -}; -} - -template +template class Matrix - : public PlainObjectBase > + : public PlainObjectBase > { public: @@ -147,7 +187,7 @@ class Matrix */ typedef PlainObjectBase Base; - enum { Options = _Options }; + enum { Options = Options_ }; EIGEN_DENSE_PUBLIC_INTERFACE(Matrix) @@ -164,6 +204,7 @@ class Matrix * * \callgraph */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix& operator=(const Matrix& other) { return Base::_set(other); @@ -180,7 +221,8 @@ class Matrix * remain row-vectors and vectors remain vectors. */ template - EIGEN_STRONG_INLINE Matrix& operator=(const MatrixBase& other) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix& operator=(const DenseBase& other) { return Base::_set(other); } @@ -192,12 +234,14 @@ class Matrix * \copydetails DenseBase::operator=(const EigenBase &other) */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix& operator=(const EigenBase &other) { return Base::operator=(other); } template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix& operator=(const ReturnByValue& func) { return Base::operator=(func); @@ -213,64 +257,140 @@ class Matrix * * \sa resize(Index,Index) */ - EIGEN_STRONG_INLINE explicit Matrix() : Base() + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix() : Base() { - Base::_check_template_params(); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } // FIXME is it still needed - Matrix(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit Matrix(internal::constructor_without_unaligned_array_assert) : Base(internal::constructor_without_unaligned_array_assert()) - { Base::_check_template_params(); EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED } + { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } - /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) + : Base(std::move(other)) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) + { + Base::operator=(std::move(other)); + return *this; + } + + /** \copydoc PlainObjectBase(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&... args) + * + * Example: \include Matrix_variadic_ctor_cxx11.cpp + * Output: \verbinclude Matrix_variadic_ctor_cxx11.out + * + * \sa Matrix(const std::initializer_list>&) + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + : Base(a0, a1, a2, a3, args...) {} + + /** \brief Constructs a Matrix and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11 + * + * In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients: + * + * Example: \include Matrix_initializer_list_23_cxx11.cpp + * Output: \verbinclude Matrix_initializer_list_23_cxx11.out * - * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, - * it is redundant to pass the dimension here, so it makes more sense to use the default - * constructor Matrix() instead. + * Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered. + * + * In the case of a compile-time column vector, implicit transposition from a single row is allowed. + * Therefore VectorXd{{1,2,3,4,5}} is legal and the more verbose syntax + * RowVectorXd{{1},{2},{3},{4},{5}} can be avoided: + * + * Example: \include Matrix_initializer_list_vector_cxx11.cpp + * Output: \verbinclude Matrix_initializer_list_vector_cxx11.out + * + * In the case of fixed-sized matrices, the initializer list sizes must exactly match the matrix sizes, + * and implicit transposition is allowed for compile-time vectors only. + * + * \sa Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) */ - EIGEN_STRONG_INLINE explicit Matrix(Index dim) - : Base(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE Matrix(const std::initializer_list>& list) : Base(list) {} + +#ifndef EIGEN_PARSED_BY_DOXYGEN + + // This constructor is for both 1x1 matrices and dynamic vectors + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit Matrix(const T& x) { - Base::_check_template_params(); - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Matrix) - eigen_assert(dim >= 0); - eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + Base::template _init1(x); } - #ifndef EIGEN_PARSED_BY_DOXYGEN template - EIGEN_STRONG_INLINE Matrix(const T0& x, const T1& y) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix(const T0& x, const T1& y) { - Base::_check_template_params(); Base::template _init2(x, y); } - #else + + +#else + /** \brief Constructs a fixed-sized matrix initialized with coefficients starting at \a data */ + EIGEN_DEVICE_FUNC + explicit Matrix(const Scalar *data); + + /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors + * + * This is useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass these parameters, so one should use the default constructor + * Matrix() instead. + * + * \warning This constructor is disabled for fixed-size \c 1x1 matrices. For instance, + * calling Matrix(1) will call the initialization constructor: Matrix(const Scalar&). + * For fixed-size \c 1x1 matrices it is therefore recommended to use the default + * constructor Matrix() instead, especially when using one of the non standard + * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives). + */ + EIGEN_STRONG_INLINE explicit Matrix(Index dim); + /** \brief Constructs an initialized 1x1 matrix with the given coefficient + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) */ + Matrix(const Scalar& x); /** \brief Constructs an uninitialized matrix with \a rows rows and \a cols columns. * * This is useful for dynamic-size matrices. For fixed-size matrices, * it is redundant to pass these parameters, so one should use the default constructor - * Matrix() instead. */ + * Matrix() instead. + * + * \warning This constructor is disabled for fixed-size \c 1x2 and \c 2x1 vectors. For instance, + * calling Matrix2f(2,1) will call the initialization constructor: Matrix(const Scalar& x, const Scalar& y). + * For fixed-size \c 1x2 or \c 2x1 vectors it is therefore recommended to use the default + * constructor Matrix() instead, especially when using one of the non standard + * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives). + */ + EIGEN_DEVICE_FUNC Matrix(Index rows, Index cols); - /** \brief Constructs an initialized 2D vector with given coefficients */ + + /** \brief Constructs an initialized 2D vector with given coefficients + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) */ Matrix(const Scalar& x, const Scalar& y); - #endif + #endif // end EIGEN_PARSED_BY_DOXYGEN - /** \brief Constructs an initialized 3D vector with given coefficients */ + /** \brief Constructs an initialized 3D vector with given coefficients + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z) { - Base::_check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 3) m_storage.data()[0] = x; m_storage.data()[1] = y; m_storage.data()[2] = z; } - /** \brief Constructs an initialized 4D vector with given coefficients */ + /** \brief Constructs an initialized 4D vector with given coefficients + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) { - Base::_check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 4) m_storage.data()[0] = x; m_storage.data()[1] = y; @@ -278,76 +398,35 @@ class Matrix m_storage.data()[3] = w; } - explicit Matrix(const Scalar *data); - - /** \brief Constructor copying the value of the expression \a other */ - template - EIGEN_STRONG_INLINE Matrix(const MatrixBase& other) - : Base(other.rows() * other.cols(), other.rows(), other.cols()) - { - // This test resides here, to bring the error messages closer to the user. Normally, these checks - // are performed deeply within the library, thus causing long and scary error traces. - EIGEN_STATIC_ASSERT((internal::is_same::value), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - Base::_check_template_params(); - Base::_set_noalias(other); - } /** \brief Copy constructor */ - EIGEN_STRONG_INLINE Matrix(const Matrix& other) - : Base(other.rows() * other.cols(), other.rows(), other.cols()) - { - Base::_check_template_params(); - Base::_set_noalias(other); - } - /** \brief Copy constructor with in-place evaluation */ - template - EIGEN_STRONG_INLINE Matrix(const ReturnByValue& other) - { - Base::_check_template_params(); - Base::resize(other.rows(), other.cols()); - other.evalTo(*this); - } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const Matrix& other) : Base(other) + { } /** \brief Copy constructor for generic expressions. * \sa MatrixBase::operator=(const EigenBase&) */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const EigenBase &other) - : Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) - { - Base::_check_template_params(); - Base::resize(other.rows(), other.cols()); - // FIXME/CHECK: isn't *this = other.derived() more efficient. it allows to - // go for pure _set() implementations, right? - *this = other; - } - - /** \internal - * \brief Override MatrixBase::swap() since for dynamic-sized matrices - * of same type it is enough to swap the data pointers. - */ - template - void swap(MatrixBase const & other) - { this->_swap(other.derived()); } + : Base(other.derived()) + { } - inline Index innerStride() const { return 1; } - inline Index outerStride() const { return this->innerSize(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return 1; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return this->innerSize(); } /////////// Geometry module /////////// template + EIGEN_DEVICE_FUNC explicit Matrix(const RotationBase& r); template + EIGEN_DEVICE_FUNC Matrix& operator=(const RotationBase& r); - #ifdef EIGEN2_SUPPORT - template - explicit Matrix(const eigen2_RotationBase& r); - template - Matrix& operator=(const eigen2_RotationBase& r); - #endif - // allow to extend Matrix outside Eigen #ifdef EIGEN_MATRIX_PLUGIN #include EIGEN_MATRIX_PLUGIN @@ -364,7 +443,7 @@ class Matrix * * \ingroup Core_Module * - * Eigen defines several typedef shortcuts for most common matrix and vector types. + * %Eigen defines several typedef shortcuts for most common matrix and vector types. * * The general patterns are the following: * @@ -377,21 +456,35 @@ class Matrix * There are also \c VectorSizeType and \c RowVectorSizeType which are self-explanatory. For example, \c Vector4cf is * a fixed-size vector of 4 complex floats. * + * With \cpp11, template alias are also defined for common sizes. + * They follow the same pattern as above except that the scalar type suffix is replaced by a + * template parameter, i.e.: + * - `MatrixSize` where `Size` can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size. + * - `MatrixXSize` and `MatrixSizeX` where `Size` can be \c 2,\c 3,\c 4 for hybrid dynamic/fixed matrices. + * - `VectorSize` and `RowVectorSize` for column and row vectors. + * + * With \cpp11, you can also use fully generic column and row vector types: `Vector` and `RowVector`. + * * \sa class Matrix */ #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ /** \ingroup matrixtypedefs */ \ +/** \brief `Size`×`Size` matrix of type `Type`. */ \ typedef Matrix Matrix##SizeSuffix##TypeSuffix; \ /** \ingroup matrixtypedefs */ \ +/** \brief `Size`×`1` vector of type `Type`. */ \ typedef Matrix Vector##SizeSuffix##TypeSuffix; \ /** \ingroup matrixtypedefs */ \ +/** \brief `1`×`Size` vector of type `Type`. */ \ typedef Matrix RowVector##SizeSuffix##TypeSuffix; #define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \ /** \ingroup matrixtypedefs */ \ +/** \brief `Size`×`Dynamic` matrix of type `Type`. */ \ typedef Matrix Matrix##Size##X##TypeSuffix; \ /** \ingroup matrixtypedefs */ \ +/** \brief `Dynamic`×`Size` matrix of type `Type`. */ \ typedef Matrix Matrix##X##Size##TypeSuffix; #define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ @@ -411,25 +504,53 @@ EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex, cd) #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES #undef EIGEN_MAKE_TYPEDEFS +#undef EIGEN_MAKE_FIXED_TYPEDEFS + +#define EIGEN_MAKE_TYPEDEFS(Size, SizeSuffix) \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 `Size`×`Size` matrix of type `Type`.*/ \ +template \ +using Matrix##SizeSuffix = Matrix; \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 `Size`×`1` vector of type `Type`.*/ \ +template \ +using Vector##SizeSuffix = Matrix; \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 `1`×`Size` vector of type `Type`.*/ \ +template \ +using RowVector##SizeSuffix = Matrix; + +#define EIGEN_MAKE_FIXED_TYPEDEFS(Size) \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 `Size`×`Dynamic` matrix of type `Type` */ \ +template \ +using Matrix##Size##X = Matrix; \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 `Dynamic`×`Size` matrix of type `Type`. */ \ +template \ +using Matrix##X##Size = Matrix; + +EIGEN_MAKE_TYPEDEFS(2, 2) +EIGEN_MAKE_TYPEDEFS(3, 3) +EIGEN_MAKE_TYPEDEFS(4, 4) +EIGEN_MAKE_TYPEDEFS(Dynamic, X) +EIGEN_MAKE_FIXED_TYPEDEFS(2) +EIGEN_MAKE_FIXED_TYPEDEFS(3) +EIGEN_MAKE_FIXED_TYPEDEFS(4) + +/** \ingroup matrixtypedefs + * \brief \cpp11 `Size`×`1` vector of type `Type`. */ +template +using Vector = Matrix; + +/** \ingroup matrixtypedefs + * \brief \cpp11 `1`×`Size` vector of type `Type`. */ +template +using RowVector = Matrix; + +#undef EIGEN_MAKE_TYPEDEFS +#undef EIGEN_MAKE_FIXED_TYPEDEFS -#undef EIGEN_MAKE_TYPEDEFS_LARGE - -#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ -using Eigen::Matrix##SizeSuffix##TypeSuffix; \ -using Eigen::Vector##SizeSuffix##TypeSuffix; \ -using Eigen::RowVector##SizeSuffix##TypeSuffix; - -#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(TypeSuffix) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \ - -#define EIGEN_USING_MATRIX_TYPEDEFS \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(f) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(d) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cf) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cd) +} // end namespace Eigen #endif // EIGEN_MATRIX_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MatrixBase.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MatrixBase.h index 62877bc..a5463b3 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MatrixBase.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/MatrixBase.h @@ -4,28 +4,17 @@ // Copyright (C) 2006-2009 Benoit Jacob // Copyright (C) 2008 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MATRIXBASE_H #define EIGEN_MATRIXBASE_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + /** \class MatrixBase * \ingroup Core_Module * @@ -54,9 +43,9 @@ * \endcode * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_MATRIXBASE_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_MATRIXBASE_PLUGIN. * - * \sa \ref TopicClassHierarchy + * \sa \blank \ref TopicClassHierarchy */ template class MatrixBase : public DenseBase @@ -65,7 +54,7 @@ template class MatrixBase #ifndef EIGEN_PARSED_BY_DOXYGEN typedef MatrixBase StorageBaseType; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; @@ -79,7 +68,6 @@ template class MatrixBase using Base::MaxSizeAtCompileTime; using Base::IsVectorAtCompileTime; using Base::Flags; - using Base::CoeffReadCost; using Base::derived; using Base::const_cast_derived; @@ -90,6 +78,7 @@ template class MatrixBase using Base::coeffRef; using Base::lazyAssign; using Base::eval; + using Base::operator-; using Base::operator+=; using Base::operator-=; using Base::operator*=; @@ -105,40 +94,29 @@ template class MatrixBase #ifndef EIGEN_PARSED_BY_DOXYGEN /** type of the equivalent square matrix */ - typedef Matrix SquareMatrixType; + typedef Matrix SquareMatrixType; #endif // not EIGEN_PARSED_BY_DOXYGEN /** \returns the size of the main diagonal, which is min(rows(),cols()). * \sa rows(), cols(), SizeAtCompileTime. */ - inline Index diagonalSize() const { return (std::min)(rows(),cols()); } + EIGEN_DEVICE_FUNC + inline Index diagonalSize() const { return (numext::mini)(rows(),cols()); } - /** \brief The plain matrix type corresponding to this expression. - * - * This is not necessarily exactly the return type of eval(). In the case of plain matrices, - * the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed - * that the return type of eval() is either PlainObject or const PlainObject&. - */ - typedef Matrix::Scalar, - internal::traits::RowsAtCompileTime, - internal::traits::ColsAtCompileTime, - AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), - internal::traits::MaxRowsAtCompileTime, - internal::traits::MaxColsAtCompileTime - > PlainObject; + typedef typename Base::PlainObject PlainObject; #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal Represents a matrix with all coefficients equal to one another*/ - typedef CwiseNullaryOp,Derived> ConstantReturnType; + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; /** \internal the return type of MatrixBase::adjoint() */ - typedef typename internal::conditional::IsComplex, - CwiseUnaryOp, ConstTransposeReturnType>, - ConstTransposeReturnType - >::type AdjointReturnType; + typedef std::conditional_t::IsComplex, + CwiseUnaryOp, ConstTransposeReturnType>, + ConstTransposeReturnType + > AdjointReturnType; /** \internal Return type of eigenvalues() */ typedef Matrix, internal::traits::ColsAtCompileTime, 1, ColMajor> EigenvaluesReturnType; /** \internal the return type of identity */ - typedef CwiseNullaryOp,Derived> IdentityReturnType; + typedef CwiseNullaryOp,PlainObject> IdentityReturnType; /** \internal the return type of unit vectors */ typedef Block, SquareMatrixType>, internal::traits::RowsAtCompileTime, @@ -146,7 +124,7 @@ template class MatrixBase #endif // not EIGEN_PARSED_BY_DOXYGEN #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase -# include "../plugins/CommonCwiseUnaryOps.h" +#define EIGEN_DOC_UNARY_ADDONS(X,Y) # include "../plugins/CommonCwiseBinaryOps.h" # include "../plugins/MatrixCwiseUnaryOps.h" # include "../plugins/MatrixCwiseBinaryOps.h" @@ -154,40 +132,44 @@ template class MatrixBase # include EIGEN_MATRIXBASE_PLUGIN # endif #undef EIGEN_CURRENT_STORAGE_BASE_CLASS +#undef EIGEN_DOC_UNARY_ADDONS /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const MatrixBase& other); // We cannot inherit here via Base::operator= since it is causing // trouble with MSVC. template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase& other); template + EIGEN_DEVICE_FUNC Derived& operator=(const EigenBase& other); template + EIGEN_DEVICE_FUNC Derived& operator=(const ReturnByValue& other); -#ifndef EIGEN_PARSED_BY_DOXYGEN - template - Derived& lazyAssign(const ProductBase& other); -#endif // not EIGEN_PARSED_BY_DOXYGEN - template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator+=(const MatrixBase& other); template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator-=(const MatrixBase& other); template - const typename ProductReturnType::Type + EIGEN_DEVICE_FUNC + const Product operator*(const MatrixBase &other) const; template - const typename LazyProductReturnType::Type + EIGEN_DEVICE_FUNC + const Product lazyProduct(const MatrixBase &other) const; template @@ -200,108 +182,108 @@ template class MatrixBase void applyOnTheRight(const EigenBase& other); template - const DiagonalProduct + EIGEN_DEVICE_FUNC + const Product operator*(const DiagonalBase &diagonal) const; template - typename internal::scalar_product_traits::Scalar,typename internal::traits::Scalar>::ReturnType + EIGEN_DEVICE_FUNC + typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType dot(const MatrixBase& other) const; - #ifdef EIGEN2_SUPPORT - template - Scalar eigen2_dot(const MatrixBase& other) const; - #endif - - RealScalar squaredNorm() const; - RealScalar norm() const; + EIGEN_DEVICE_FUNC RealScalar squaredNorm() const; + EIGEN_DEVICE_FUNC RealScalar norm() const; RealScalar stableNorm() const; RealScalar blueNorm() const; RealScalar hypotNorm() const; - const PlainObject normalized() const; - void normalize(); + EIGEN_DEVICE_FUNC const PlainObject normalized() const; + EIGEN_DEVICE_FUNC const PlainObject stableNormalized() const; + EIGEN_DEVICE_FUNC void normalize(); + EIGEN_DEVICE_FUNC void stableNormalize(); - const AdjointReturnType adjoint() const; - void adjointInPlace(); + EIGEN_DEVICE_FUNC const AdjointReturnType adjoint() const; + EIGEN_DEVICE_FUNC void adjointInPlace(); typedef Diagonal DiagonalReturnType; + EIGEN_DEVICE_FUNC DiagonalReturnType diagonal(); - typedef const Diagonal ConstDiagonalReturnType; + + typedef Diagonal ConstDiagonalReturnType; + EIGEN_DEVICE_FUNC const ConstDiagonalReturnType diagonal() const; - template struct DiagonalIndexReturnType { typedef Diagonal Type; }; - template struct ConstDiagonalIndexReturnType { typedef const Diagonal Type; }; - - template typename DiagonalIndexReturnType::Type diagonal(); - template typename ConstDiagonalIndexReturnType::Type diagonal() const; - - // Note: The "MatrixBase::" prefixes are added to help MSVC9 to match these declarations with the later implementations. - // On the other hand they confuse MSVC8... - #if (defined _MSC_VER) && (_MSC_VER >= 1500) // 2008 or later - typename MatrixBase::template DiagonalIndexReturnType::Type diagonal(Index index); - typename MatrixBase::template ConstDiagonalIndexReturnType::Type diagonal(Index index) const; - #else - typename DiagonalIndexReturnType::Type diagonal(Index index); - typename ConstDiagonalIndexReturnType::Type diagonal(Index index) const; - #endif - - #ifdef EIGEN2_SUPPORT - template typename internal::eigen2_part_return_type::type part(); - template const typename internal::eigen2_part_return_type::type part() const; - - // huuuge hack. make Eigen2's matrix.part() work in eigen3. Problem: Diagonal is now a class template instead - // of an integer constant. Solution: overload the part() method template wrt template parameters list. - // Note: replacing next line by "template class U>" produces a mysterious error C2082 in MSVC. - template class U> - const DiagonalWrapper part() const - { return diagonal().asDiagonal(); } - #endif // EIGEN2_SUPPORT + template + EIGEN_DEVICE_FUNC + Diagonal diagonal(); + + template + EIGEN_DEVICE_FUNC + const Diagonal diagonal() const; + + EIGEN_DEVICE_FUNC + Diagonal diagonal(Index index); + EIGEN_DEVICE_FUNC + const Diagonal diagonal(Index index) const; template struct TriangularViewReturnType { typedef TriangularView Type; }; template struct ConstTriangularViewReturnType { typedef const TriangularView Type; }; - template typename TriangularViewReturnType::Type triangularView(); - template typename ConstTriangularViewReturnType::Type triangularView() const; + template + EIGEN_DEVICE_FUNC + typename TriangularViewReturnType::Type triangularView(); + template + EIGEN_DEVICE_FUNC + typename ConstTriangularViewReturnType::Type triangularView() const; template struct SelfAdjointViewReturnType { typedef SelfAdjointView Type; }; template struct ConstSelfAdjointViewReturnType { typedef const SelfAdjointView Type; }; - template typename SelfAdjointViewReturnType::Type selfadjointView(); - template typename ConstSelfAdjointViewReturnType::Type selfadjointView() const; + template + EIGEN_DEVICE_FUNC + typename SelfAdjointViewReturnType::Type selfadjointView(); + template + EIGEN_DEVICE_FUNC + typename ConstSelfAdjointViewReturnType::Type selfadjointView() const; const SparseView sparseView(const Scalar& m_reference = Scalar(0), - typename NumTraits::Real m_epsilon = NumTraits::dummy_precision()) const; - static const IdentityReturnType Identity(); - static const IdentityReturnType Identity(Index rows, Index cols); - static const BasisReturnType Unit(Index size, Index i); - static const BasisReturnType Unit(Index i); - static const BasisReturnType UnitX(); - static const BasisReturnType UnitY(); - static const BasisReturnType UnitZ(); - static const BasisReturnType UnitW(); - + const typename NumTraits::Real& m_epsilon = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC static const IdentityReturnType Identity(); + EIGEN_DEVICE_FUNC static const IdentityReturnType Identity(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const BasisReturnType Unit(Index size, Index i); + EIGEN_DEVICE_FUNC static const BasisReturnType Unit(Index i); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitX(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitY(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitZ(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitW(); + + EIGEN_DEVICE_FUNC const DiagonalWrapper asDiagonal() const; const PermutationWrapper asPermutation() const; + EIGEN_DEVICE_FUNC Derived& setIdentity(); + EIGEN_DEVICE_FUNC Derived& setIdentity(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setUnit(Index i); + EIGEN_DEVICE_FUNC Derived& setUnit(Index newSize, Index i); - bool isIdentity(RealScalar prec = NumTraits::dummy_precision()) const; - bool isDiagonal(RealScalar prec = NumTraits::dummy_precision()) const; + bool isIdentity(const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isDiagonal(const RealScalar& prec = NumTraits::dummy_precision()) const; - bool isUpperTriangular(RealScalar prec = NumTraits::dummy_precision()) const; - bool isLowerTriangular(RealScalar prec = NumTraits::dummy_precision()) const; + bool isUpperTriangular(const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isLowerTriangular(const RealScalar& prec = NumTraits::dummy_precision()) const; template bool isOrthogonal(const MatrixBase& other, - RealScalar prec = NumTraits::dummy_precision()) const; - bool isUnitary(RealScalar prec = NumTraits::dummy_precision()) const; + const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isUnitary(const RealScalar& prec = NumTraits::dummy_precision()) const; /** \returns true if each coefficients of \c *this and \a other are all exactly equal. * \warning When using floating point scalar values you probably should rather use a * fuzzy comparison such as isApprox() * \sa isApprox(), operator!= */ template - inline bool operator==(const MatrixBase& other) const + EIGEN_DEVICE_FUNC inline bool operator==(const MatrixBase& other) const { return cwiseEqual(other).all(); } /** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other. @@ -309,143 +291,151 @@ template class MatrixBase * fuzzy comparison such as isApprox() * \sa isApprox(), operator== */ template - inline bool operator!=(const MatrixBase& other) const + EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase& other) const { return cwiseNotEqual(other).any(); } - NoAlias noalias(); - - inline const ForceAlignedAccess forceAlignedAccess() const; - inline ForceAlignedAccess forceAlignedAccess(); - template inline typename internal::add_const_on_value_type,Derived&>::type>::type forceAlignedAccessIf() const; - template inline typename internal::conditional,Derived&>::type forceAlignedAccessIf(); + NoAlias EIGEN_DEVICE_FUNC noalias(); - Scalar trace() const; + // TODO forceAlignedAccess is temporarily disabled + // Need to find a nicer workaround. + inline const Derived& forceAlignedAccess() const { return derived(); } + inline Derived& forceAlignedAccess() { return derived(); } + template inline const Derived& forceAlignedAccessIf() const { return derived(); } + template inline Derived& forceAlignedAccessIf() { return derived(); } -/////////// Array module /////////// + EIGEN_DEVICE_FUNC Scalar trace() const; - template RealScalar lpNorm() const; + template EIGEN_DEVICE_FUNC RealScalar lpNorm() const; - MatrixBase& matrix() { return *this; } - const MatrixBase& matrix() const { return *this; } + EIGEN_DEVICE_FUNC MatrixBase& matrix() { return *this; } + EIGEN_DEVICE_FUNC const MatrixBase& matrix() const { return *this; } - /** \returns an \link ArrayBase Array \endlink expression of this matrix + /** \returns an \link Eigen::ArrayBase Array \endlink expression of this matrix * \sa ArrayBase::matrix() */ - ArrayWrapper array() { return derived(); } - const ArrayWrapper array() const { return derived(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ArrayWrapper array() { return ArrayWrapper(derived()); } + /** \returns a const \link Eigen::ArrayBase Array \endlink expression of this matrix + * \sa ArrayBase::matrix() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArrayWrapper array() const { return ArrayWrapper(derived()); } /////////// LU module /////////// - const FullPivLU fullPivLu() const; - const PartialPivLU partialPivLu() const; + inline const FullPivLU fullPivLu() const; + inline const PartialPivLU partialPivLu() const; - #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS - const LU lu() const; - #endif + inline const PartialPivLU lu() const; - #ifdef EIGEN2_SUPPORT - const LU eigen2_lu() const; - #endif + EIGEN_DEVICE_FUNC + inline const Inverse inverse() const; - #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS - const PartialPivLU lu() const; - #endif - - #ifdef EIGEN2_SUPPORT template - void computeInverse(MatrixBase *result) const { - *result = this->inverse(); - } - #endif - - const internal::inverse_impl inverse() const; - template - void computeInverseAndDetWithCheck( + inline void computeInverseAndDetWithCheck( ResultType& inverse, typename ResultType::Scalar& determinant, bool& invertible, const RealScalar& absDeterminantThreshold = NumTraits::dummy_precision() ) const; + template - void computeInverseWithCheck( + inline void computeInverseWithCheck( ResultType& inverse, bool& invertible, const RealScalar& absDeterminantThreshold = NumTraits::dummy_precision() ) const; + + EIGEN_DEVICE_FUNC Scalar determinant() const; /////////// Cholesky module /////////// - const LLT llt() const; - const LDLT ldlt() const; + inline const LLT llt() const; + inline const LDLT ldlt() const; /////////// QR module /////////// - const HouseholderQR householderQr() const; - const ColPivHouseholderQR colPivHouseholderQr() const; - const FullPivHouseholderQR fullPivHouseholderQr() const; - - #ifdef EIGEN2_SUPPORT - const QR qr() const; - #endif + inline const HouseholderQR householderQr() const; + inline const ColPivHouseholderQR colPivHouseholderQr() const; + inline const FullPivHouseholderQR fullPivHouseholderQr() const; + inline const CompleteOrthogonalDecomposition completeOrthogonalDecomposition() const; + +/////////// Eigenvalues module /////////// - EigenvaluesReturnType eigenvalues() const; - RealScalar operatorNorm() const; + inline EigenvaluesReturnType eigenvalues() const; + inline RealScalar operatorNorm() const; /////////// SVD module /////////// - JacobiSVD jacobiSvd(unsigned int computationOptions = 0) const; + template + inline JacobiSVD jacobiSvd() const; + template + EIGEN_DEPRECATED + inline JacobiSVD jacobiSvd(unsigned int computationOptions) const; - #ifdef EIGEN2_SUPPORT - SVD svd() const; - #endif + template + inline BDCSVD bdcSvd() const; + template + EIGEN_DEPRECATED + inline BDCSVD bdcSvd(unsigned int computationOptions) const; /////////// Geometry module /////////// #ifndef EIGEN_PARSED_BY_DOXYGEN /// \internal helper struct to form the return type of the cross product template struct cross_product_return_type { - typedef typename internal::scalar_product_traits::Scalar,typename internal::traits::Scalar>::ReturnType Scalar; + typedef typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType Scalar; typedef Matrix type; }; #endif // EIGEN_PARSED_BY_DOXYGEN template - typename cross_product_return_type::type + EIGEN_DEVICE_FUNC +#ifndef EIGEN_PARSED_BY_DOXYGEN + inline typename cross_product_return_type::type +#else + inline PlainObject +#endif cross(const MatrixBase& other) const; + template - PlainObject cross3(const MatrixBase& other) const; - PlainObject unitOrthogonal(void) const; - Matrix eulerAngles(Index a0, Index a1, Index a2) const; - - #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS - ScalarMultipleReturnType operator*(const UniformScaling& s) const; + EIGEN_DEVICE_FUNC + inline PlainObject cross3(const MatrixBase& other) const; + + EIGEN_DEVICE_FUNC + inline PlainObject unitOrthogonal(void) const; + + EIGEN_DEVICE_FUNC + inline Matrix eulerAngles(Index a0, Index a1, Index a2) const; + // put this as separate enum value to work around possible GCC 4.3 bug (?) - enum { HomogeneousReturnTypeDirection = ColsAtCompileTime==1?Vertical:Horizontal }; + enum { HomogeneousReturnTypeDirection = ColsAtCompileTime==1&&RowsAtCompileTime==1 ? ((internal::traits::Flags&RowMajorBit)==RowMajorBit ? Horizontal : Vertical) + : ColsAtCompileTime==1 ? Vertical : Horizontal }; typedef Homogeneous HomogeneousReturnType; - HomogeneousReturnType homogeneous() const; - #endif - + EIGEN_DEVICE_FUNC + inline HomogeneousReturnType homogeneous() const; + enum { SizeMinusOne = SizeAtCompileTime==Dynamic ? Dynamic : SizeAtCompileTime-1 }; typedef Block::ColsAtCompileTime==1 ? SizeMinusOne : 1, internal::traits::ColsAtCompileTime==1 ? 1 : SizeMinusOne> ConstStartMinusOne; - typedef CwiseUnaryOp::Scalar>, - const ConstStartMinusOne > HNormalizedReturnType; - - const HNormalizedReturnType hnormalized() const; + typedef EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(ConstStartMinusOne,Scalar,quotient) HNormalizedReturnType; + EIGEN_DEVICE_FUNC + inline const HNormalizedReturnType hnormalized() const; ////////// Householder module /////////// + EIGEN_DEVICE_FUNC void makeHouseholderInPlace(Scalar& tau, RealScalar& beta); template + EIGEN_DEVICE_FUNC void makeHouseholder(EssentialPart& essential, Scalar& tau, RealScalar& beta) const; template + EIGEN_DEVICE_FUNC void applyHouseholderOnTheLeft(const EssentialPart& essential, const Scalar& tau, Scalar* workspace); template + EIGEN_DEVICE_FUNC void applyHouseholderOnTheRight(const EssentialPart& essential, const Scalar& tau, Scalar* workspace); @@ -453,69 +443,110 @@ template class MatrixBase ///////// Jacobi module ///////// template + EIGEN_DEVICE_FUNC void applyOnTheLeft(Index p, Index q, const JacobiRotation& j); template + EIGEN_DEVICE_FUNC void applyOnTheRight(Index p, Index q, const JacobiRotation& j); +///////// SparseCore module ///////// + + template + EIGEN_STRONG_INLINE const typename SparseMatrixBase::template CwiseProductDenseReturnType::Type + cwiseProduct(const SparseMatrixBase &other) const + { + return other.cwiseProduct(derived()); + } + ///////// MatrixFunctions module ///////// typedef typename internal::stem_function::type StemFunction; - const MatrixExponentialReturnValue exp() const; +#define EIGEN_MATRIX_FUNCTION(ReturnType, Name, Description) \ + /** \returns an expression of the matrix Description of \c *this. \brief This function requires the unsupported MatrixFunctions module. To compute the coefficient-wise Description use ArrayBase::##Name . */ \ + const ReturnType Name() const; +#define EIGEN_MATRIX_FUNCTION_1(ReturnType, Name, Description, Argument) \ + /** \returns an expression of the matrix Description of \c *this. \brief This function requires the unsupported MatrixFunctions module. To compute the coefficient-wise Description use ArrayBase::##Name . */ \ + const ReturnType Name(Argument) const; + + EIGEN_MATRIX_FUNCTION(MatrixExponentialReturnValue, exp, exponential) + /** \brief Helper function for the unsupported MatrixFunctions module.*/ const MatrixFunctionReturnValue matrixFunction(StemFunction f) const; - const MatrixFunctionReturnValue cosh() const; - const MatrixFunctionReturnValue sinh() const; - const MatrixFunctionReturnValue cos() const; - const MatrixFunctionReturnValue sin() const; - -#ifdef EIGEN2_SUPPORT - template - Derived& operator+=(const Flagged, 0, - EvalBeforeAssigningBit>& other); - - template - Derived& operator-=(const Flagged, 0, - EvalBeforeAssigningBit>& other); - - /** \deprecated because .lazy() is deprecated - * Overloaded for cache friendly product evaluation */ - template - Derived& lazyAssign(const Flagged& other) - { return lazyAssign(other._expression()); } - - template - const Flagged marked() const; - const Flagged lazy() const; - - inline const Cwise cwise() const; - inline Cwise cwise(); - - VectorBlock start(Index size); - const VectorBlock start(Index size) const; - VectorBlock end(Index size); - const VectorBlock end(Index size) const; - template VectorBlock start(); - template const VectorBlock start() const; - template VectorBlock end(); - template const VectorBlock end() const; - - Minor minor(Index row, Index col); - const Minor minor(Index row, Index col) const; + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cosh, hyperbolic cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sinh, hyperbolic sine) +#if EIGEN_HAS_CXX11_MATH + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, atanh, inverse hyperbolic cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, acosh, inverse hyperbolic cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, asinh, inverse hyperbolic sine) #endif + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cos, cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sin, sine) + EIGEN_MATRIX_FUNCTION(MatrixSquareRootReturnValue, sqrt, square root) + EIGEN_MATRIX_FUNCTION(MatrixLogarithmReturnValue, log, logarithm) + EIGEN_MATRIX_FUNCTION_1(MatrixPowerReturnValue, pow, power to \c p, const RealScalar& p) + EIGEN_MATRIX_FUNCTION_1(MatrixComplexPowerReturnValue, pow, power to \c p, const std::complex& p) protected: - MatrixBase() : Base() {} + EIGEN_DEFAULT_COPY_CONSTRUCTOR(MatrixBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MatrixBase) private: - explicit MatrixBase(int); - MatrixBase(int,int); - template explicit MatrixBase(const MatrixBase&); + EIGEN_DEVICE_FUNC explicit MatrixBase(int); + EIGEN_DEVICE_FUNC MatrixBase(int,int); + template EIGEN_DEVICE_FUNC explicit MatrixBase(const MatrixBase&); protected: // mixing arrays and matrices is not legal template Derived& operator+=(const ArrayBase& ) - {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);} + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} // mixing arrays and matrices is not legal template Derived& operator-=(const ArrayBase& ) - {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);} + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} }; + +/*************************************************************************** +* Implementation of matrix base methods +***************************************************************************/ + +/** replaces \c *this by \c *this * \a other. + * + * \returns a reference to \c *this + * + * Example: \include MatrixBase_applyOnTheRight.cpp + * Output: \verbinclude MatrixBase_applyOnTheRight.out + */ +template +template +inline Derived& +MatrixBase::operator*=(const EigenBase &other) +{ + other.derived().applyThisOnTheRight(derived()); + return derived(); +} + +/** replaces \c *this by \c *this * \a other. It is equivalent to MatrixBase::operator*=(). + * + * Example: \include MatrixBase_applyOnTheRight.cpp + * Output: \verbinclude MatrixBase_applyOnTheRight.out + */ +template +template +inline void MatrixBase::applyOnTheRight(const EigenBase &other) +{ + other.derived().applyThisOnTheRight(derived()); +} + +/** replaces \c *this by \a other * \c *this. + * + * Example: \include MatrixBase_applyOnTheLeft.cpp + * Output: \verbinclude MatrixBase_applyOnTheLeft.out + */ +template +template +inline void MatrixBase::applyOnTheLeft(const EigenBase &other) +{ + other.derived().applyThisOnTheLeft(derived()); +} + +} // end namespace Eigen + #endif // EIGEN_MATRIXBASE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NestByValue.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NestByValue.h index a6104d2..5f1dc84 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NestByValue.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NestByValue.h @@ -4,47 +4,39 @@ // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_NESTBYVALUE_H #define EIGEN_NESTBYVALUE_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { +template +struct traits > : public traits +{ + enum { + Flags = traits::Flags & ~NestByRefBit + }; +}; +} + /** \class NestByValue * \ingroup Core_Module * * \brief Expression which must be nested by value * - * \param ExpressionType the type of the object of which we are requiring nesting-by-value + * \tparam ExpressionType the type of the object of which we are requiring nesting-by-value * * This class is the return type of MatrixBase::nestByValue() * and most of the time this is the only way it is used. * * \sa MatrixBase::nestByValue() */ - -namespace internal { -template -struct traits > : public traits -{}; -} - template class NestByValue : public internal::dense_xpr_base< NestByValue >::type { @@ -53,58 +45,14 @@ template class NestByValue typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) - inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} - - inline Index rows() const { return m_expression.rows(); } - inline Index cols() const { return m_expression.cols(); } - inline Index outerStride() const { return m_expression.outerStride(); } - inline Index innerStride() const { return m_expression.innerStride(); } - - inline const CoeffReturnType coeff(Index row, Index col) const - { - return m_expression.coeff(row, col); - } - - inline Scalar& coeffRef(Index row, Index col) - { - return m_expression.const_cast_derived().coeffRef(row, col); - } - - inline const CoeffReturnType coeff(Index index) const - { - return m_expression.coeff(index); - } - - inline Scalar& coeffRef(Index index) - { - return m_expression.const_cast_derived().coeffRef(index); - } - - template - inline const PacketScalar packet(Index row, Index col) const - { - return m_expression.template packet(row, col); - } - - template - inline void writePacket(Index row, Index col, const PacketScalar& x) - { - m_expression.const_cast_derived().template writePacket(row, col, x); - } - - template - inline const PacketScalar packet(Index index) const - { - return m_expression.template packet(index); - } - - template - inline void writePacket(Index index, const PacketScalar& x) - { - m_expression.const_cast_derived().template writePacket(index, x); - } - - operator const ExpressionType&() const { return m_expression; } + EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + + EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } + + EIGEN_DEVICE_FUNC const ExpressionType& nestedExpression() const { return m_expression; } protected: const ExpressionType m_expression; @@ -113,10 +61,27 @@ template class NestByValue /** \returns an expression of the temporary version of *this. */ template -inline const NestByValue +EIGEN_DEVICE_FUNC inline const NestByValue DenseBase::nestByValue() const { return NestByValue(derived()); } +namespace internal { + +// Evaluator of Solve -> eval into a temporary +template +struct evaluator > + : public evaluator +{ + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const NestByValue& xpr) + : Base(xpr.nestedExpression()) + {} +}; +} + +} // end namespace Eigen + #endif // EIGEN_NESTBYVALUE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NoAlias.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NoAlias.h index da64aff..09c0aac 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NoAlias.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NoAlias.h @@ -3,34 +3,23 @@ // // Copyright (C) 2009 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_NOALIAS_H #define EIGEN_NOALIAS_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + /** \class NoAlias * \ingroup Core_Module * * \brief Pseudo expression providing an operator = assuming no aliasing * - * \param ExpressionType the type of the object on which to do the lazy assignment + * \tparam ExpressionType the type of the object on which to do the lazy assignment * * This class represents an expression with special assignment operators * assuming no aliasing between the target expression and the source expression. @@ -43,57 +32,41 @@ template class StorageBase> class NoAlias { - typedef typename ExpressionType::Scalar Scalar; public: - NoAlias(ExpressionType& expression) : m_expression(expression) {} - - /** Behaves like MatrixBase::lazyAssign(other) - * \sa MatrixBase::lazyAssign() */ + typedef typename ExpressionType::Scalar Scalar; + + EIGEN_DEVICE_FUNC + explicit NoAlias(ExpressionType& expression) : m_expression(expression) {} + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase& other) - { return internal::assign_selector::run(m_expression,other.derived()); } - - /** \sa MatrixBase::operator+= */ + { + call_assignment_no_alias(m_expression, other.derived(), internal::assign_op()); + return m_expression; + } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase& other) { - typedef SelfCwiseBinaryOp, ExpressionType, OtherDerived> SelfAdder; - SelfAdder tmp(m_expression); - typedef typename internal::nested::type OtherDerivedNested; - typedef typename internal::remove_all::type _OtherDerivedNested; - internal::assign_selector::run(tmp,OtherDerivedNested(other.derived())); + call_assignment_no_alias(m_expression, other.derived(), internal::add_assign_op()); return m_expression; } - - /** \sa MatrixBase::operator-= */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase& other) { - typedef SelfCwiseBinaryOp, ExpressionType, OtherDerived> SelfAdder; - SelfAdder tmp(m_expression); - typedef typename internal::nested::type OtherDerivedNested; - typedef typename internal::remove_all::type _OtherDerivedNested; - internal::assign_selector::run(tmp,OtherDerivedNested(other.derived())); + call_assignment_no_alias(m_expression, other.derived(), internal::sub_assign_op()); return m_expression; } -#ifndef EIGEN_PARSED_BY_DOXYGEN - template - EIGEN_STRONG_INLINE ExpressionType& operator+=(const ProductBase& other) - { other.derived().addTo(m_expression); return m_expression; } - - template - EIGEN_STRONG_INLINE ExpressionType& operator-=(const ProductBase& other) - { other.derived().subTo(m_expression); return m_expression; } - - template - EIGEN_STRONG_INLINE ExpressionType& operator+=(const CoeffBasedProduct& other) - { return m_expression.derived() += CoeffBasedProduct(other.lhs(), other.rhs()); } - - template - EIGEN_STRONG_INLINE ExpressionType& operator-=(const CoeffBasedProduct& other) - { return m_expression.derived() -= CoeffBasedProduct(other.lhs(), other.rhs()); } -#endif + EIGEN_DEVICE_FUNC + ExpressionType& expression() const + { + return m_expression; + } protected: ExpressionType& m_expression; @@ -104,10 +77,10 @@ class NoAlias * * More precisely, noalias() allows to bypass the EvalBeforeAssignBit flag. * Currently, even though several expressions may alias, only product - * expressions have this flag. Therefore, noalias() is only usefull when + * expressions have this flag. Therefore, noalias() is only useful when * the source expression contains a matrix product. * - * Here are some examples where noalias is usefull: + * Here are some examples where noalias is useful: * \code * D.noalias() = A * B; * D.noalias() += A.transpose() * B; @@ -128,9 +101,11 @@ class NoAlias * \sa class NoAlias */ template -NoAlias MatrixBase::noalias() +NoAlias EIGEN_DEVICE_FUNC MatrixBase::noalias() { - return derived(); + return NoAlias(derived()); } +} // end namespace Eigen + #endif // EIGEN_NOALIAS_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NumTraits.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NumTraits.h index 73ef05d..74edd2c 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NumTraits.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/NumTraits.h @@ -3,46 +3,123 @@ // // Copyright (C) 2006-2010 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_NUMTRAITS_H #define EIGEN_NUMTRAITS_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +// default implementation of digits10(), based on numeric_limits if specialized, +// 0 for integer types, and log10(epsilon()) otherwise. +template< typename T, + bool use_numeric_limits = std::numeric_limits::is_specialized, + bool is_integer = NumTraits::IsInteger> +struct default_digits10_impl +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return std::numeric_limits::digits10; } +}; + +template +struct default_digits10_impl // Floating point +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { + using std::log10; + using std::ceil; + typedef typename NumTraits::Real Real; + return int(ceil(-log10(NumTraits::epsilon()))); + } +}; + +template +struct default_digits10_impl // Integer +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return 0; } +}; + + +// default implementation of digits(), based on numeric_limits if specialized, +// 0 for integer types, and log2(epsilon()) otherwise. +template< typename T, + bool use_numeric_limits = std::numeric_limits::is_specialized, + bool is_integer = NumTraits::IsInteger> +struct default_digits_impl +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return std::numeric_limits::digits; } +}; + +template +struct default_digits_impl // Floating point +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { + using std::log; + using std::ceil; + typedef typename NumTraits::Real Real; + return int(ceil(-log(NumTraits::epsilon())/log(static_cast(2)))); + } +}; + +template +struct default_digits_impl // Integer +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return 0; } +}; + +} // end namespace internal + +namespace numext { +/** \internal bit-wise cast without changing the underlying bit representation. */ + +// TODO: Replace by std::bit_cast (available in C++20) +template +EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Tgt bit_cast(const Src& src) { + // The behaviour of memcpy is not specified for non-trivially copyable types + EIGEN_STATIC_ASSERT(std::is_trivially_copyable::value, THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT(std::is_trivially_copyable::value && std::is_default_constructible::value, + THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT(sizeof(Src) == sizeof(Tgt), THIS_TYPE_IS_NOT_SUPPORTED); + + Tgt tgt; + // Load src into registers first. This allows the memcpy to be elided by CUDA. + const Src staged = src; + EIGEN_USING_STD(memcpy) + memcpy(&tgt, &staged, sizeof(Tgt)); + return tgt; +} +} // namespace numext + /** \class NumTraits * \ingroup Core_Module * * \brief Holds information about the various numeric (i.e. scalar) types allowed by Eigen. * - * \param T the numeric type at hand + * \tparam T the numeric type at hand * * This class stores enums, typedefs and static methods giving information about a numeric type. * * The provided data consists of: - * \li A typedef \a Real, giving the "real part" type of \a T. If \a T is already real, - * then \a Real is just a typedef to \a T. If \a T is \c std::complex then \a Real + * \li A typedef \c Real, giving the "real part" type of \a T. If \a T is already real, + * then \c Real is just a typedef to \a T. If \a T is \c std::complex then \c Real * is a typedef to \a U. - * \li A typedef \a NonInteger, giving the type that should be used for operations producing non-integral values, + * \li A typedef \c NonInteger, giving the type that should be used for operations producing non-integral values, * such as quotients, square roots, etc. If \a T is a floating-point type, then this typedef just gives * \a T again. Note however that many Eigen functions such as internal::sqrt simply refuse to * take integers. Outside of a few cases, Eigen doesn't do automatic type promotion. Thus, this typedef is * only intended as a helper for code that needs to explicitly promote types. + * \li A typedef \c Literal giving the type to use for numeric literals such as "2" or "0.5". For instance, for \c std::complex, Literal is defined as \c U. + * Of course, this type must be fully compatible with \a T. In doubt, just use \a T here. * \li A typedef \a Nested giving the type to use to nest a value inside of the expression tree. If you don't know what * this means, just use \a T here. * \li An enum value \a IsComplex. It is equal to 1 if \a T is a \c std::complex @@ -51,14 +128,27 @@ * and to \c 0 otherwise. * \li Enum values ReadCost, AddCost and MulCost representing a rough estimate of the number of CPU cycles needed * to by move / add / mul instructions respectively, assuming the data is already stored in CPU registers. - * Stay vague here. No need to do architecture-specific stuff. + * Stay vague here. No need to do architecture-specific stuff. If you don't know what this means, just use \c Eigen::HugeCost. * \li An enum value \a IsSigned. It is equal to \c 1 if \a T is a signed type and to 0 if \a T is unsigned. * \li An enum value \a RequireInitialization. It is equal to \c 1 if the constructor of the numeric type \a T must * be called, and to 0 if it is safe not to call it. Default is 0 if \a T is an arithmetic type, and 1 otherwise. - * \li An epsilon() function which, unlike std::numeric_limits::epsilon(), returns a \a Real instead of a \a T. + * \li An epsilon() function which, unlike std::numeric_limits::epsilon(), + * it returns a \a Real instead of a \a T. * \li A dummy_precision() function returning a weak epsilon value. It is mainly used as a default * value by the fuzzy comparison operators. * \li highest() and lowest() functions returning the highest and lowest possible values respectively. + * \li digits() function returning the number of radix digits (non-sign digits for integers, mantissa for floating-point). This is + * the analogue of std::numeric_limits::digits + * which is used as the default implementation if specialized. + * \li digits10() function returning the number of decimal digits that can be represented without change. This is + * the analogue of std::numeric_limits::digits10 + * which is used as the default implementation if specialized. + * \li min_exponent() and max_exponent() functions returning the highest and lowest possible values, respectively, + * such that the radix raised to the power exponent-1 is a normalized floating-point number. These are equivalent to + * std::numeric_limits::min_exponent/ + * std::numeric_limits::max_exponent. + * \li infinity() function returning a representation of positive infinity, if available. + * \li quiet_NaN function returning a non-signaling "not-a-number", if available. */ template struct GenericNumTraits @@ -74,28 +164,67 @@ template struct GenericNumTraits }; typedef T Real; - typedef typename internal::conditional< - IsInteger, - typename internal::conditional::type, - T - >::type NonInteger; + typedef std::conditional_t, T> NonInteger; typedef T Nested; + typedef T Literal; + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline Real epsilon() + { + return numext::numeric_limits::epsilon(); + } - inline static Real epsilon() { return std::numeric_limits::epsilon(); } - inline static Real dummy_precision() + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int digits10() + { + return internal::default_digits10_impl::run(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int digits() + { + return internal::default_digits_impl::run(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int min_exponent() + { + return numext::numeric_limits::min_exponent; + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int max_exponent() + { + return numext::numeric_limits::max_exponent; + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline Real dummy_precision() { // make sure to override this for floating-point types return Real(0); } - inline static T highest() { return (std::numeric_limits::max)(); } - inline static T lowest() { return IsInteger ? (std::numeric_limits::min)() : (-(std::numeric_limits::max)()); } - -#ifdef EIGEN2_SUPPORT - enum { - HasFloatingPoint = !IsInteger - }; - typedef NonInteger FloatingPoint; -#endif + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T highest() { + return (numext::numeric_limits::max)(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T lowest() { + return IsInteger ? (numext::numeric_limits::min)() + : static_cast(-(numext::numeric_limits::max)()); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T infinity() { + return numext::numeric_limits::infinity(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T quiet_NaN() { + return numext::numeric_limits::quiet_NaN(); + } }; template struct NumTraits : GenericNumTraits @@ -104,34 +233,42 @@ template struct NumTraits : GenericNumTraits template<> struct NumTraits : GenericNumTraits { - inline static float dummy_precision() { return 1e-5f; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline float dummy_precision() { return 1e-5f; } }; template<> struct NumTraits : GenericNumTraits { - inline static double dummy_precision() { return 1e-12; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline double dummy_precision() { return 1e-12; } }; template<> struct NumTraits : GenericNumTraits { + EIGEN_CONSTEXPR static inline long double dummy_precision() { return 1e-15l; } }; -template struct NumTraits > - : GenericNumTraits > +template struct NumTraits > + : GenericNumTraits > { - typedef _Real Real; + typedef Real_ Real; + typedef typename NumTraits::Literal Literal; enum { IsComplex = 1, - RequireInitialization = NumTraits<_Real>::RequireInitialization, - ReadCost = 2 * NumTraits<_Real>::ReadCost, + RequireInitialization = NumTraits::RequireInitialization, + ReadCost = 2 * NumTraits::ReadCost, AddCost = 2 * NumTraits::AddCost, MulCost = 4 * NumTraits::MulCost + 2 * NumTraits::AddCost }; - inline static Real epsilon() { return NumTraits::epsilon(); } - inline static Real dummy_precision() { return NumTraits::dummy_precision(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline Real epsilon() { return NumTraits::epsilon(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline Real dummy_precision() { return NumTraits::dummy_precision(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int digits10() { return NumTraits::digits10(); } }; template @@ -143,18 +280,54 @@ struct NumTraits > typedef typename NumTraits::NonInteger NonIntegerScalar; typedef Array NonInteger; typedef ArrayType & Nested; - + typedef typename NumTraits::Literal Literal; + enum { IsComplex = NumTraits::IsComplex, IsInteger = NumTraits::IsInteger, IsSigned = NumTraits::IsSigned, RequireInitialization = 1, - ReadCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::ReadCost, - AddCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::AddCost, - MulCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::MulCost + ReadCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * int(NumTraits::ReadCost), + AddCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * int(NumTraits::AddCost), + MulCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * int(NumTraits::MulCost) }; + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline RealScalar epsilon() { return NumTraits::epsilon(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline RealScalar dummy_precision() { return NumTraits::dummy_precision(); } + + EIGEN_CONSTEXPR + static inline int digits10() { return NumTraits::digits10(); } }; +template<> struct NumTraits + : GenericNumTraits +{ + enum { + RequireInitialization = 1, + ReadCost = HugeCost, + AddCost = HugeCost, + MulCost = HugeCost + }; + + EIGEN_CONSTEXPR + static inline int digits10() { return 0; } + +private: + static inline std::string epsilon(); + static inline std::string dummy_precision(); + static inline std::string lowest(); + static inline std::string highest(); + static inline std::string infinity(); + static inline std::string quiet_NaN(); +}; + +// Empty specialization for void to allow template specialization based on NumTraits::Real with T==void and SFINAE. +template<> struct NumTraits {}; + +template<> struct NumTraits : GenericNumTraits {}; +} // end namespace Eigen #endif // EIGEN_NUMTRAITS_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PartialReduxEvaluator.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PartialReduxEvaluator.h new file mode 100644 index 0000000..693fc35 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PartialReduxEvaluator.h @@ -0,0 +1,239 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011-2018 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PARTIALREDUX_H +#define EIGEN_PARTIALREDUX_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + + +/*************************************************************************** +* +* This file provides evaluators for partial reductions. +* There are two modes: +* +* - scalar path: simply calls the respective function on the column or row. +* -> nothing special here, all the tricky part is handled by the return +* types of VectorwiseOp's members. They embed the functor calling the +* respective DenseBase's member function. +* +* - vectorized path: implements a packet-wise reductions followed by +* some (optional) processing of the outcome, e.g., division by n for mean. +* +* For the vectorized path let's observe that the packet-size and outer-unrolling +* are both decided by the assignment logic. So all we have to do is to decide +* on the inner unrolling. +* +* For the unrolling, we can reuse "internal::redux_vec_unroller" from Redux.h, +* but be need to be careful to specify correct increment. +* +***************************************************************************/ + + +/* logic deciding a strategy for unrolling of vectorized paths */ +template +struct packetwise_redux_traits +{ + enum { + OuterSize = int(Evaluator::IsRowMajor) ? Evaluator::RowsAtCompileTime : Evaluator::ColsAtCompileTime, + Cost = OuterSize == Dynamic ? HugeCost + : OuterSize * Evaluator::CoeffReadCost + (OuterSize-1) * functor_traits::Cost, + Unrolling = Cost <= EIGEN_UNROLLING_LIMIT ? CompleteUnrolling : NoUnrolling + }; + +}; + +/* Value to be returned when size==0 , by default let's return 0 */ +template +EIGEN_DEVICE_FUNC +PacketType packetwise_redux_empty_value(const Func& ) { + const typename unpacket_traits::type zero(0); + return pset1(zero); +} + +/* For products the default is 1 */ +template +EIGEN_DEVICE_FUNC +PacketType packetwise_redux_empty_value(const scalar_product_op& ) { + return pset1(Scalar(1)); +} + +/* Perform the actual reduction */ +template::Unrolling +> +struct packetwise_redux_impl; + +/* Perform the actual reduction with unrolling */ +template +struct packetwise_redux_impl +{ + typedef redux_novec_unroller Base; + typedef typename Evaluator::Scalar Scalar; + + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + PacketType run(const Evaluator &eval, const Func& func, Index /*size*/) + { + return redux_vec_unroller::OuterSize>::template run(eval,func); + } +}; + +/* Add a specialization of redux_vec_unroller for size==0 at compiletime. + * This specialization is not required for general reductions, which is + * why it is defined here. + */ +template +struct redux_vec_unroller +{ + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE PacketType run(const Evaluator &, const Func& f) + { + return packetwise_redux_empty_value(f); + } +}; + +/* Perform the actual reduction for dynamic sizes */ +template +struct packetwise_redux_impl +{ + typedef typename Evaluator::Scalar Scalar; + typedef typename redux_traits::PacketType PacketScalar; + + template + EIGEN_DEVICE_FUNC + static PacketType run(const Evaluator &eval, const Func& func, Index size) + { + if(size==0) + return packetwise_redux_empty_value(func); + + const Index size4 = (size-1)&(~3); + PacketType p = eval.template packetByOuterInner(0,0); + Index i = 1; + // This loop is optimized for instruction pipelining: + // - each iteration generates two independent instructions + // - thanks to branch prediction and out-of-order execution we have independent instructions across loops + for(; i(i+0,0),eval.template packetByOuterInner(i+1,0)), + func.packetOp(eval.template packetByOuterInner(i+2,0),eval.template packetByOuterInner(i+3,0)))); + for(; i(i,0)); + return p; + } +}; + +template< typename ArgType, typename MemberOp, int Direction> +struct evaluator > + : evaluator_base > +{ + typedef PartialReduxExpr XprType; + typedef typename internal::nested_eval::type ArgTypeNested; + typedef add_const_on_value_type_t ConstArgTypeNested; + typedef internal::remove_all_t ArgTypeNestedCleaned; + typedef typename ArgType::Scalar InputScalar; + typedef typename XprType::Scalar Scalar; + enum { + TraversalSize = Direction==int(Vertical) ? int(ArgType::RowsAtCompileTime) : int(ArgType::ColsAtCompileTime) + }; + typedef typename MemberOp::template Cost CostOpType; + enum { + CoeffReadCost = TraversalSize==Dynamic ? HugeCost + : TraversalSize==0 ? 1 + : int(TraversalSize) * int(evaluator::CoeffReadCost) + int(CostOpType::value), + + ArgFlags_ = evaluator::Flags, + + Vectorizable_ = bool(int(ArgFlags_)&PacketAccessBit) + && bool(MemberOp::Vectorizable) + && (Direction==int(Vertical) ? bool(ArgFlags_&RowMajorBit) : (ArgFlags_&RowMajorBit)==0) + && (TraversalSize!=0), + + Flags = (traits::Flags&RowMajorBit) + | (evaluator::Flags&(HereditaryBits&(~RowMajorBit))) + | (Vectorizable_ ? PacketAccessBit : 0) + | LinearAccessBit, + + Alignment = 0 // FIXME this will need to be improved once PartialReduxExpr is vectorized + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType xpr) + : m_arg(xpr.nestedExpression()), m_functor(xpr.functor()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(TraversalSize==Dynamic ? HugeCost : (TraversalSize==0 ? 1 : int(CostOpType::value))); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar coeff(Index i, Index j) const + { + return coeff(Direction==Vertical ? j : i); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar coeff(Index index) const + { + return m_functor(m_arg.template subVector(index)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + PacketType packet(Index i, Index j) const + { + return packet(Direction==Vertical ? j : i); + } + + template + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC + PacketType packet(Index idx) const + { + enum { PacketSize = internal::unpacket_traits::size }; + typedef Block PanelType; + + PanelType panel(m_arg, + Direction==Vertical ? 0 : idx, + Direction==Vertical ? idx : 0, + Direction==Vertical ? m_arg.rows() : Index(PacketSize), + Direction==Vertical ? Index(PacketSize) : m_arg.cols()); + + // FIXME + // See bug 1612, currently if PacketSize==1 (i.e. complex with 128bits registers) then the storage-order of panel get reversed + // and methods like packetByOuterInner do not make sense anymore in this context. + // So let's just by pass "vectorization" in this case: + if(PacketSize==1) + return internal::pset1(coeff(idx)); + + typedef typename internal::redux_evaluator PanelEvaluator; + PanelEvaluator panel_eval(panel); + typedef typename MemberOp::BinaryOp BinaryOp; + PacketType p = internal::packetwise_redux_impl::template run(panel_eval,m_functor.binaryFunc(),m_arg.outerSize()); + return p; + } + +protected: + ConstArgTypeNested m_arg; + const MemberOp m_functor; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_PARTIALREDUX_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PermutationMatrix.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PermutationMatrix.h index a064e05..73a7300 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PermutationMatrix.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PermutationMatrix.h @@ -2,38 +2,31 @@ // for linear algebra. // // Copyright (C) 2009 Benoit Jacob -// Copyright (C) 2009-2011 Gael Guennebaud +// Copyright (C) 2009-2015 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_PERMUTATIONMATRIX_H #define EIGEN_PERMUTATIONMATRIX_H -template class PermutedImpl; +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +enum PermPermProduct_t {PermPermProduct}; + +} // end namespace internal /** \class PermutationBase * \ingroup Core_Module * * \brief Base class for permutations * - * \param Derived the derived class + * \tparam Derived the derived class * * This class is the base class for all expressions representing a permutation matrix, * internally stored as a vector of integers. @@ -51,15 +44,6 @@ template -struct permut_matrix_product_retval; -enum PermPermProduct_t {PermPermProduct}; - -} // end namespace internal - template class PermutationBase : public EigenBase { @@ -71,19 +55,20 @@ class PermutationBase : public EigenBase typedef typename Traits::IndicesType IndicesType; enum { Flags = Traits::Flags, - CoeffReadCost = Traits::CoeffReadCost, RowsAtCompileTime = Traits::RowsAtCompileTime, ColsAtCompileTime = Traits::ColsAtCompileTime, MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, MaxColsAtCompileTime = Traits::MaxColsAtCompileTime }; - typedef typename Traits::Scalar Scalar; - typedef typename Traits::Index Index; - typedef Matrix + typedef typename Traits::StorageIndex StorageIndex; + typedef Matrix DenseMatrixType; - typedef PermutationMatrix + typedef PermutationMatrix PlainPermutationType; + typedef PlainPermutationType PlainObject; using Base::derived; + typedef Inverse InverseReturnType; + typedef void Scalar; #endif /** Copies the other permutation into *this */ @@ -104,32 +89,21 @@ class PermutationBase : public EigenBase return derived(); } - #ifndef EIGEN_PARSED_BY_DOXYGEN - /** This is a special case of the templated operator=. Its purpose is to - * prevent a default operator= from hiding the templated operator=. - */ - Derived& operator=(const PermutationBase& other) - { - indices() = other.indices(); - return derived(); - } - #endif - /** \returns the number of rows */ - inline Index rows() const { return indices().size(); } + inline EIGEN_DEVICE_FUNC Index rows() const { return Index(indices().size()); } /** \returns the number of columns */ - inline Index cols() const { return indices().size(); } + inline EIGEN_DEVICE_FUNC Index cols() const { return Index(indices().size()); } /** \returns the size of a side of the respective square matrix, i.e., the number of indices */ - inline Index size() const { return indices().size(); } + inline EIGEN_DEVICE_FUNC Index size() const { return Index(indices().size()); } #ifndef EIGEN_PARSED_BY_DOXYGEN template void evalTo(MatrixBase& other) const { other.setZero(); - for (int i=0; i /** Resizes to given size. */ - inline void resize(Index size) + inline void resize(Index newSize) { - indices().resize(size); + indices().resize(newSize); } /** Sets *this to be the identity permutation matrix */ void setIdentity() { - for(Index i = 0; i < size(); ++i) + StorageIndex n = StorageIndex(size()); + for(StorageIndex i = 0; i < n; ++i) indices().coeffRef(i) = i; } /** Sets *this to be the identity permutation matrix of given size. */ - void setIdentity(Index size) + void setIdentity(Index newSize) { - resize(size); + resize(newSize); setIdentity(); } @@ -174,18 +149,18 @@ class PermutationBase : public EigenBase * * \returns a reference to *this. * - * \warning This is much slower than applyTranspositionOnTheRight(int,int): + * \warning This is much slower than applyTranspositionOnTheRight(Index,Index): * this has linear complexity and requires a lot of branching. * - * \sa applyTranspositionOnTheRight(int,int) + * \sa applyTranspositionOnTheRight(Index,Index) */ Derived& applyTranspositionOnTheLeft(Index i, Index j) { eigen_assert(i>=0 && j>=0 && i * * This is a fast operation, it only consists in swapping two indices. * - * \sa applyTranspositionOnTheLeft(int,int) + * \sa applyTranspositionOnTheLeft(Index,Index) */ Derived& applyTranspositionOnTheRight(Index i, Index j) { @@ -207,16 +182,16 @@ class PermutationBase : public EigenBase /** \returns the inverse permutation matrix. * - * \note \note_try_to_help_rvo + * \note \blank \note_try_to_help_rvo */ - inline Transpose inverse() const - { return derived(); } + inline InverseReturnType inverse() const + { return InverseReturnType(derived()); } /** \returns the tranpose permutation matrix. * - * \note \note_try_to_help_rvo + * \note \blank \note_try_to_help_rvo */ - inline Transpose transpose() const - { return derived(); } + inline InverseReturnType transpose() const + { return InverseReturnType(derived()); } /**** multiplication helpers to hopefully get RVO ****/ @@ -226,13 +201,13 @@ class PermutationBase : public EigenBase template void assignTranspose(const PermutationBase& other) { - for (int i=0; i void assignProduct(const Lhs& lhs, const Rhs& rhs) { eigen_assert(lhs.cols() == rhs.rows()); - for (int i=0; i /** \returns the product permutation matrix. * - * \note \note_try_to_help_rvo + * \note \blank \note_try_to_help_rvo */ template inline PlainPermutationType operator*(const PermutationBase& other) const @@ -248,57 +223,90 @@ class PermutationBase : public EigenBase /** \returns the product of a permutation with another inverse permutation. * - * \note \note_try_to_help_rvo + * \note \blank \note_try_to_help_rvo */ template - inline PlainPermutationType operator*(const Transpose >& other) const + inline PlainPermutationType operator*(const InverseImpl& other) const { return PlainPermutationType(internal::PermPermProduct, *this, other.eval()); } /** \returns the product of an inverse permutation with another permutation. * - * \note \note_try_to_help_rvo + * \note \blank \note_try_to_help_rvo */ template friend - inline PlainPermutationType operator*(const Transpose >& other, const PermutationBase& perm) + inline PlainPermutationType operator*(const InverseImpl& other, const PermutationBase& perm) { return PlainPermutationType(internal::PermPermProduct, other.eval(), perm); } + + /** \returns the determinant of the permutation matrix, which is either 1 or -1 depending on the parity of the permutation. + * + * This function is O(\c n) procedure allocating a buffer of \c n booleans. + */ + Index determinant() const + { + Index res = 1; + Index n = size(); + Matrix mask(n); + mask.fill(false); + Index r = 0; + while(r < n) + { + // search for the next seed + while(r=n) + break; + // we got one, let's follow it until we are back to the seed + Index k0 = r++; + mask.coeffRef(k0) = true; + for(Index k=indices().coeff(k0); k!=k0; k=indices().coeff(k)) + { + mask.coeffRef(k) = true; + res = -res; + } + } + return res; + } protected: }; +namespace internal { +template +struct traits > + : traits > +{ + typedef PermutationStorage StorageKind; + typedef Matrix IndicesType; + typedef StorageIndex_ StorageIndex; + typedef void Scalar; +}; +} + /** \class PermutationMatrix * \ingroup Core_Module * * \brief Permutation matrix * - * \param SizeAtCompileTime the number of rows/cols, or Dynamic - * \param MaxSizeAtCompileTime the maximum number of rows/cols, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it. - * \param IndexType the interger type of the indices + * \tparam SizeAtCompileTime the number of rows/cols, or Dynamic + * \tparam MaxSizeAtCompileTime the maximum number of rows/cols, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it. + * \tparam StorageIndex_ the integer type of the indices * * This class represents a permutation matrix, internally stored as a vector of integers. * * \sa class PermutationBase, class PermutationWrapper, class DiagonalMatrix */ - -namespace internal { -template -struct traits > - : traits > -{ - typedef IndexType Index; - typedef Matrix IndicesType; -}; -} - -template -class PermutationMatrix : public PermutationBase > +template +class PermutationMatrix : public PermutationBase > { typedef PermutationBase Base; typedef internal::traits Traits; public: + typedef const PermutationMatrix& Nested; + #ifndef EIGEN_PARSED_BY_DOXYGEN typedef typename Traits::IndicesType IndicesType; + typedef typename Traits::StorageIndex StorageIndex; #endif inline PermutationMatrix() @@ -306,20 +314,16 @@ class PermutationMatrix : public PermutationBase::highest()); + } /** Copy constructor. */ template inline PermutationMatrix(const PermutationBase& other) : m_indices(other.indices()) {} - #ifndef EIGEN_PARSED_BY_DOXYGEN - /** Standard copy constructor. Defined only to prevent a default copy constructor - * from hiding the other templated constructor */ - inline PermutationMatrix(const PermutationMatrix& other) : m_indices(other.indices()) {} - #endif - /** Generic constructor from expression of the indices. The indices * array has the meaning that the permutations sends each integer i to indices[i]. * @@ -354,17 +358,6 @@ class PermutationMatrix : public PermutationBase - PermutationMatrix(const Transpose >& other) - : m_indices(other.nestedPermutation().size()) + PermutationMatrix(const InverseImpl& other) + : m_indices(other.derived().nestedExpression().size()) { - for (int i=0; i::highest()); + StorageIndex end = StorageIndex(m_indices.size()); + for (StorageIndex i=0; i PermutationMatrix(internal::PermPermProduct_t, const Lhs& lhs, const Rhs& rhs) @@ -395,18 +391,20 @@ class PermutationMatrix : public PermutationBase -struct traits,_PacketAccess> > - : traits > +template +struct traits,PacketAccess_> > + : traits > { - typedef IndexType Index; - typedef Map, _PacketAccess> IndicesType; + typedef PermutationStorage StorageKind; + typedef Map, PacketAccess_> IndicesType; + typedef StorageIndex_ StorageIndex; + typedef void Scalar; }; } -template -class Map,_PacketAccess> - : public PermutationBase,_PacketAccess> > +template +class Map,PacketAccess_> + : public PermutationBase,PacketAccess_> > { typedef PermutationBase Base; typedef internal::traits Traits; @@ -414,15 +412,15 @@ class Map, #ifndef EIGEN_PARSED_BY_DOXYGEN typedef typename Traits::IndicesType IndicesType; - typedef typename IndicesType::Scalar Index; + typedef typename IndicesType::Scalar StorageIndex; #endif - inline Map(const Index* indices) - : m_indices(indices) + inline Map(const StorageIndex* indicesPtr) + : m_indices(indicesPtr) {} - inline Map(const Index* indices, Index size) - : m_indices(indices,size) + inline Map(const StorageIndex* indicesPtr, Index size) + : m_indices(indicesPtr,size) {} /** Copies the other permutation into *this */ @@ -456,42 +454,38 @@ class Map, IndicesType m_indices; }; +template class TranspositionsWrapper; +namespace internal { +template +struct traits > +{ + typedef PermutationStorage StorageKind; + typedef void Scalar; + typedef typename IndicesType_::Scalar StorageIndex; + typedef IndicesType_ IndicesType; + enum { + RowsAtCompileTime = IndicesType_::SizeAtCompileTime, + ColsAtCompileTime = IndicesType_::SizeAtCompileTime, + MaxRowsAtCompileTime = IndicesType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = IndicesType::MaxSizeAtCompileTime, + Flags = 0 + }; +}; +} + /** \class PermutationWrapper * \ingroup Core_Module * * \brief Class to view a vector of integers as a permutation matrix * - * \param _IndicesType the type of the vector of integer (can be any compatible expression) + * \tparam IndicesType_ the type of the vector of integer (can be any compatible expression) * * This class allows to view any vector expression of integers as a permutation matrix. * * \sa class PermutationBase, class PermutationMatrix */ - -struct PermutationStorage {}; - -template class TranspositionsWrapper; -namespace internal { -template -struct traits > -{ - typedef PermutationStorage StorageKind; - typedef typename _IndicesType::Scalar Scalar; - typedef typename _IndicesType::Scalar Index; - typedef _IndicesType IndicesType; - enum { - RowsAtCompileTime = _IndicesType::SizeAtCompileTime, - ColsAtCompileTime = _IndicesType::SizeAtCompileTime, - MaxRowsAtCompileTime = IndicesType::MaxRowsAtCompileTime, - MaxColsAtCompileTime = IndicesType::MaxColsAtCompileTime, - Flags = 0, - CoeffReadCost = _IndicesType::CoeffReadCost - }; -}; -} - -template -class PermutationWrapper : public PermutationBase > +template +class PermutationWrapper : public PermutationBase > { typedef PermutationBase Base; typedef internal::traits Traits; @@ -506,185 +500,94 @@ class PermutationWrapper : public PermutationBase::type& + const internal::remove_all_t& indices() const { return m_indices; } protected: - const typename IndicesType::Nested m_indices; + typename IndicesType::Nested m_indices; }; + /** \returns the matrix with the permutation applied to the columns. */ -template -inline const internal::permut_matrix_product_retval -operator*(const MatrixBase& matrix, - const PermutationBase &permutation) +template +EIGEN_DEVICE_FUNC +const Product +operator*(const MatrixBase &matrix, + const PermutationBase& permutation) { - return internal::permut_matrix_product_retval - - (permutation.derived(), matrix.derived()); + return Product + (matrix.derived(), permutation.derived()); } /** \returns the matrix with the permutation applied to the rows. */ -template -inline const internal::permut_matrix_product_retval - +template +EIGEN_DEVICE_FUNC +const Product operator*(const PermutationBase &permutation, - const MatrixBase& matrix) + const MatrixBase& matrix) { - return internal::permut_matrix_product_retval - - (permutation.derived(), matrix.derived()); + return Product + (permutation.derived(), matrix.derived()); } -namespace internal { - -template -struct traits > -{ - typedef typename MatrixType::PlainObject ReturnType; -}; -template -struct permut_matrix_product_retval - : public ReturnByValue > +template +class InverseImpl + : public EigenBase > { - typedef typename remove_all::type MatrixTypeNestedCleaned; - - permut_matrix_product_retval(const PermutationType& perm, const MatrixType& matrix) - : m_permutation(perm), m_matrix(matrix) - {} - - inline int rows() const { return m_matrix.rows(); } - inline int cols() const { return m_matrix.cols(); } - - template inline void evalTo(Dest& dst) const - { - const int n = Side==OnTheLeft ? rows() : cols(); - - if(is_same::value && extract_data(dst) == extract_data(m_matrix)) - { - // apply the permutation inplace - Matrix mask(m_permutation.size()); - mask.fill(false); - int r = 0; - while(r < m_permutation.size()) - { - // search for the next seed - while(r=m_permutation.size()) - break; - // we got one, let's follow it until we are back to the seed - int k0 = r++; - int kPrev = k0; - mask.coeffRef(k0) = true; - for(int k=m_permutation.indices().coeff(k0); k!=k0; k=m_permutation.indices().coeff(k)) - { - Block(dst, k) - .swap(Block - (dst,((Side==OnTheLeft) ^ Transposed) ? k0 : kPrev)); - - mask.coeffRef(k) = true; - kPrev = k; - } - } - } - else - { - for(int i = 0; i < n; ++i) - { - Block - (dst, ((Side==OnTheLeft) ^ Transposed) ? m_permutation.indices().coeff(i) : i) - - = - - Block - (m_matrix, ((Side==OnTheRight) ^ Transposed) ? m_permutation.indices().coeff(i) : i); - } - } - } - - protected: - const PermutationType& m_permutation; - const typename MatrixType::Nested m_matrix; -}; - -/* Template partial specialization for transposed/inverse permutations */ - -template -struct traits > > - : traits -{}; - -} // end namespace internal - -template -class Transpose > - : public EigenBase > > -{ - typedef Derived PermutationType; - typedef typename PermutationType::IndicesType IndicesType; typedef typename PermutationType::PlainPermutationType PlainPermutationType; + typedef internal::traits PermTraits; + protected: + InverseImpl() {} public: + typedef Inverse InverseType; + using EigenBase >::derived; #ifndef EIGEN_PARSED_BY_DOXYGEN - typedef internal::traits Traits; - typedef typename Derived::DenseMatrixType DenseMatrixType; + typedef typename PermutationType::DenseMatrixType DenseMatrixType; enum { - Flags = Traits::Flags, - CoeffReadCost = Traits::CoeffReadCost, - RowsAtCompileTime = Traits::RowsAtCompileTime, - ColsAtCompileTime = Traits::ColsAtCompileTime, - MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, - MaxColsAtCompileTime = Traits::MaxColsAtCompileTime + RowsAtCompileTime = PermTraits::RowsAtCompileTime, + ColsAtCompileTime = PermTraits::ColsAtCompileTime, + MaxRowsAtCompileTime = PermTraits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = PermTraits::MaxColsAtCompileTime }; - typedef typename Traits::Scalar Scalar; #endif - Transpose(const PermutationType& p) : m_permutation(p) {} - - inline int rows() const { return m_permutation.rows(); } - inline int cols() const { return m_permutation.cols(); } - #ifndef EIGEN_PARSED_BY_DOXYGEN template void evalTo(MatrixBase& other) const { other.setZero(); - for (int i=0; i friend - inline const internal::permut_matrix_product_retval - operator*(const MatrixBase& matrix, const Transpose& trPerm) + const Product + operator*(const MatrixBase& matrix, const InverseType& trPerm) { - return internal::permut_matrix_product_retval(trPerm.m_permutation, matrix.derived()); + return Product(matrix.derived(), trPerm.derived()); } /** \returns the matrix with the inverse permutation applied to the rows. */ template - inline const internal::permut_matrix_product_retval + const Product operator*(const MatrixBase& matrix) const { - return internal::permut_matrix_product_retval(m_permutation, matrix.derived()); + return Product(derived(), matrix.derived()); } - - const PermutationType& nestedPermutation() const { return m_permutation; } - - protected: - const PermutationType& m_permutation; }; template @@ -693,4 +596,12 @@ const PermutationWrapper MatrixBase::asPermutation() con return derived(); } +namespace internal { + +template<> struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; + +} // end namespace internal + +} // end namespace Eigen + #endif // EIGEN_PERMUTATIONMATRIX_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PlainObjectBase.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PlainObjectBase.h index ca24445..e0bde54 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PlainObjectBase.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/PlainObjectBase.h @@ -4,73 +4,109 @@ // Copyright (C) 2008-2009 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_DENSESTORAGEBASE_H #define EIGEN_DENSESTORAGEBASE_H -#ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO -# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED for(int i=0;i::quiet_NaN(); #else -# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED +# undef EIGEN_INITIALIZE_COEFFS +# define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED #endif +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { -template -EIGEN_ALWAYS_INLINE void check_rows_cols_for_overflow(Index rows, Index cols) -{ - // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242 - // we assume Index is signed - Index max_index = (size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed - bool error = (rows < 0 || cols < 0) ? true - : (rows == 0 || cols == 0) ? false - : (rows > max_index / cols); - if (error) - throw_std_bad_alloc(); -} - -template struct conservative_resize_like_impl; +template struct check_rows_cols_for_overflow { + template + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE void run(Index, Index) + { + } +}; + +template<> struct check_rows_cols_for_overflow { + template + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE void run(Index rows, Index cols) + { + // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242 + // we assume Index is signed + Index max_index = (std::size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed + bool error = (rows == 0 || cols == 0) ? false + : (rows > max_index / cols); + if (error) + throw_std_bad_alloc(); + } +}; + +template +struct conservative_resize_like_impl; template struct matrix_swap_impl; } // end namespace internal -/** +#ifdef EIGEN_PARSED_BY_DOXYGEN +namespace doxygen { + +// This is a workaround to doxygen not being able to understand the inheritance logic +// when it is hidden by the dense_xpr_base helper struct. +// Moreover, doxygen fails to include members that are not documented in the declaration body of +// MatrixBase if we inherits MatrixBase >, +// this is why we simply inherits MatrixBase, though this does not make sense. + +/** This class is just a workaround for Doxygen and it does not not actually exist. */ +template struct dense_xpr_base_dispatcher; +/** This class is just a workaround for Doxygen and it does not not actually exist. */ +template +struct dense_xpr_base_dispatcher > + : public MatrixBase {}; +/** This class is just a workaround for Doxygen and it does not not actually exist. */ +template +struct dense_xpr_base_dispatcher > + : public ArrayBase {}; + +} // namespace doxygen + +/** \class PlainObjectBase + * \ingroup Core_Module * \brief %Dense storage base class for matrices and arrays. * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_PLAINOBJECTBASE_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_PLAINOBJECTBASE_PLUGIN. + * + * \tparam Derived is the derived type, e.g., a Matrix or Array * * \sa \ref TopicClassHierarchy */ template +class PlainObjectBase : public doxygen::dense_xpr_base_dispatcher +#else +template class PlainObjectBase : public internal::dense_xpr_base::type +#endif { public: enum { Options = internal::traits::Options }; typedef typename internal::dense_xpr_base::type Base; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; typedef Derived DenseType; @@ -84,67 +120,102 @@ class PlainObjectBase : public internal::dense_xpr_base::type using Base::IsVectorAtCompileTime; using Base::Flags; - template friend class Eigen::Map; - friend class Eigen::Map; typedef Eigen::Map MapType; - friend class Eigen::Map; typedef const Eigen::Map ConstMapType; - friend class Eigen::Map; - typedef Eigen::Map AlignedMapType; - friend class Eigen::Map; - typedef const Eigen::Map ConstAlignedMapType; + typedef Eigen::Map AlignedMapType; + typedef const Eigen::Map ConstAlignedMapType; template struct StridedMapType { typedef Eigen::Map type; }; template struct StridedConstMapType { typedef Eigen::Map type; }; - template struct StridedAlignedMapType { typedef Eigen::Map type; }; - template struct StridedConstAlignedMapType { typedef Eigen::Map type; }; + template struct StridedAlignedMapType { typedef Eigen::Map type; }; + template struct StridedConstAlignedMapType { typedef Eigen::Map type; }; protected: DenseStorage m_storage; public: - enum { NeedsToAlign = SizeAtCompileTime != Dynamic && (internal::traits::Flags & AlignedBit) != 0 }; + enum { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits::Alignment>0) }; EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) + EIGEN_STATIC_ASSERT(internal::check_implication(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (int(Options)&RowMajor)==RowMajor), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT(internal::check_implication(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (int(Options)&RowMajor)==0), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT(((Options & (DontAlign|RowMajor)) == Options), INVALID_MATRIX_TEMPLATE_PARAMETERS) + + EIGEN_DEVICE_FUNC Base& base() { return *static_cast(this); } + EIGEN_DEVICE_FUNC const Base& base() const { return *static_cast(this); } - EIGEN_STRONG_INLINE Index rows() const { return m_storage.rows(); } - EIGEN_STRONG_INLINE Index cols() const { return m_storage.cols(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_storage.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_storage.cols(); } - EIGEN_STRONG_INLINE const Scalar& coeff(Index row, Index col) const + /** This is an overloaded version of DenseCoeffsBase::coeff(Index,Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeff(Index) const for details. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const Scalar& coeff(Index rowId, Index colId) const { if(Flags & RowMajorBit) - return m_storage.data()[col + row * m_storage.cols()]; + return m_storage.data()[colId + rowId * m_storage.cols()]; else // column-major - return m_storage.data()[row + col * m_storage.rows()]; + return m_storage.data()[rowId + colId * m_storage.rows()]; } + /** This is an overloaded version of DenseCoeffsBase::coeff(Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeff(Index) const for details. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeff(Index index) const { return m_storage.data()[index]; } - EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) + /** This is an overloaded version of DenseCoeffsBase::coeffRef(Index,Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeffRef(Index,Index) const for details. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& coeffRef(Index rowId, Index colId) { if(Flags & RowMajorBit) - return m_storage.data()[col + row * m_storage.cols()]; + return m_storage.data()[colId + rowId * m_storage.cols()]; else // column-major - return m_storage.data()[row + col * m_storage.rows()]; + return m_storage.data()[rowId + colId * m_storage.rows()]; } + /** This is an overloaded version of DenseCoeffsBase::coeffRef(Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeffRef(Index) const for details. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) { return m_storage.data()[index]; } - EIGEN_STRONG_INLINE const Scalar& coeffRef(Index row, Index col) const + /** This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index). + * It is provided for convenience. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const Scalar& coeffRef(Index rowId, Index colId) const { if(Flags & RowMajorBit) - return m_storage.data()[col + row * m_storage.cols()]; + return m_storage.data()[colId + rowId * m_storage.cols()]; else // column-major - return m_storage.data()[row + col * m_storage.rows()]; + return m_storage.data()[rowId + colId * m_storage.rows()]; } + /** This is the const version of coeffRef(Index) which is thus synonym of coeff(Index). + * It is provided for convenience. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeffRef(Index index) const { return m_storage.data()[index]; @@ -152,12 +223,12 @@ class PlainObjectBase : public internal::dense_xpr_base::type /** \internal */ template - EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const + EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const { return internal::ploadt (m_storage.data() + (Flags & RowMajorBit - ? col + row * m_storage.cols() - : row + col * m_storage.rows())); + ? colId + rowId * m_storage.cols() + : rowId + colId * m_storage.rows())); } /** \internal */ @@ -169,27 +240,27 @@ class PlainObjectBase : public internal::dense_xpr_base::type /** \internal */ template - EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketScalar& x) + EIGEN_STRONG_INLINE void writePacket(Index rowId, Index colId, const PacketScalar& val) { internal::pstoret (m_storage.data() + (Flags & RowMajorBit - ? col + row * m_storage.cols() - : row + col * m_storage.rows()), x); + ? colId + rowId * m_storage.cols() + : rowId + colId * m_storage.rows()), val); } /** \internal */ template - EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& x) + EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& val) { - internal::pstoret(m_storage.data() + index, x); + internal::pstoret(m_storage.data() + index, val); } /** \returns a const pointer to the data array of this matrix */ - EIGEN_STRONG_INLINE const Scalar *data() const + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar *data() const { return m_storage.data(); } /** \returns a pointer to the data array of this matrix */ - EIGEN_STRONG_INLINE Scalar *data() + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar *data() { return m_storage.data(); } /** Resizes \c *this to a \a rows x \a cols matrix. @@ -208,16 +279,21 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols) { - #ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO - internal::check_rows_cols_for_overflow(rows, cols); + eigen_assert(internal::check_implication(RowsAtCompileTime!=Dynamic, rows==RowsAtCompileTime) + && internal::check_implication(ColsAtCompileTime!=Dynamic, cols==ColsAtCompileTime) + && internal::check_implication(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic, rows<=MaxRowsAtCompileTime) + && internal::check_implication(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic, cols<=MaxColsAtCompileTime) + && rows>=0 && cols>=0 && "Invalid sizes when resizing a matrix or array."); + internal::check_rows_cols_for_overflow::run(rows, cols); + #ifdef EIGEN_INITIALIZE_COEFFS Index size = rows*cols; bool size_changed = size != this->size(); m_storage.resize(size, rows, cols); - if(size_changed) EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED #else - internal::check_rows_cols_for_overflow(rows, cols); m_storage.resize(rows*cols, rows, cols); #endif } @@ -233,19 +309,20 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * \sa resize(Index,Index), resize(NoChange_t, Index), resize(Index, NoChange_t) */ + EIGEN_DEVICE_FUNC inline void resize(Index size) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase) - eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == size); - #ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO + eigen_assert(((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0); + #ifdef EIGEN_INITIALIZE_COEFFS bool size_changed = size != this->size(); #endif if(RowsAtCompileTime == 1) m_storage.resize(size, 1, size); else m_storage.resize(size, size, 1); - #ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO - if(size_changed) EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + #ifdef EIGEN_INITIALIZE_COEFFS + if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED #endif } @@ -257,6 +334,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * \sa resize(Index,Index) */ + EIGEN_DEVICE_FUNC inline void resize(NoChange_t, Index cols) { resize(rows(), cols); @@ -270,6 +348,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * \sa resize(Index,Index) */ + EIGEN_DEVICE_FUNC inline void resize(Index rows, NoChange_t) { resize(rows, cols()); @@ -283,10 +362,11 @@ class PlainObjectBase : public internal::dense_xpr_base::type * remain row-vectors and vectors remain vectors. */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resizeLike(const EigenBase& _other) { const OtherDerived& other = _other.derived(); - internal::check_rows_cols_for_overflow(other.rows(), other.cols()); + internal::check_rows_cols_for_overflow::run(other.rows(), other.cols()); const Index othersize = other.rows()*other.cols(); if(RowsAtCompileTime == 1) { @@ -307,9 +387,10 @@ class PlainObjectBase : public internal::dense_xpr_base::type * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or * conservativeResize(Index, NoChange_t). * - * Matrices are resized relative to the top-left element. In case values need to be + * Matrices are resized relative to the top-left element. In case values need to be * appended to the matrix they will be uninitialized. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols) { internal::conservative_resize_like_impl::run(*this, rows, cols); @@ -322,6 +403,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * In case the matrix is growing, new rows will be uninitialized. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t) { // Note: see the comment in conservativeResize(Index,Index) @@ -335,6 +417,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * In case the matrix is growing, new columns will be uninitialized. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index cols) { // Note: see the comment in conservativeResize(Index,Index) @@ -349,6 +432,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * When values are appended, they will be uninitialized. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(Index size) { internal::conservative_resize_like_impl::run(*this, size); @@ -360,10 +444,11 @@ class PlainObjectBase : public internal::dense_xpr_base::type * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or * conservativeResize(Index, NoChange_t). * - * Matrices are resized relative to the top-left element. In case values need to be + * Matrices are resized relative to the top-left element. In case values need to be * appended to the matrix they will copied from \c other. */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResizeLike(const DenseBase& other) { internal::conservative_resize_like_impl::run(*this, other); @@ -372,6 +457,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type /** This is a special case of the templated operator=. Its purpose is to * prevent a default operator= from hiding the templated operator=. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const PlainObjectBase& other) { return _set(other); @@ -379,6 +465,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type /** \sa MatrixBase::lazyAssign() */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& lazyAssign(const DenseBase& other) { _resize_to_match(other); @@ -386,53 +473,158 @@ class PlainObjectBase : public internal::dense_xpr_base::type } template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const ReturnByValue& func) { resize(func.rows(), func.cols()); return Base::operator=(func); } - EIGEN_STRONG_INLINE explicit PlainObjectBase() : m_storage() + // Prevent user from trying to instantiate PlainObjectBase objects + // by making all its constructor protected. See bug 1074. + protected: + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase() : m_storage() { -// _check_template_params(); -// EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED +// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #ifndef EIGEN_PARSED_BY_DOXYGEN // FIXME is it still needed ? /** \internal */ - PlainObjectBase(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC + explicit PlainObjectBase(internal::constructor_without_unaligned_array_assert) : m_storage(internal::constructor_without_unaligned_array_assert()) { -// _check_template_params(); EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + // EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #endif + EIGEN_DEVICE_FUNC + PlainObjectBase(PlainObjectBase&& other) EIGEN_NOEXCEPT + : m_storage( std::move(other.m_storage) ) + { + } + + EIGEN_DEVICE_FUNC + PlainObjectBase& operator=(PlainObjectBase&& other) EIGEN_NOEXCEPT + { + m_storage = std::move(other.m_storage); + return *this; + } + + /** Copy constructor */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const PlainObjectBase& other) + : Base(), m_storage(other.m_storage) { } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols) : m_storage(size, rows, cols) { -// _check_template_params(); -// EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED +// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } - /** \copydoc MatrixBase::operator=(const EigenBase&) + /** \brief Construct a row of column vector with fixed size from an arbitrary number of coefficients. + * + * \only_for_vectors + * + * This constructor is for 1D array or vectors with more than 4 coefficients. + * + * \warning To construct a column (resp. row) vector of fixed length, the number of values passed to this + * constructor must match the the fixed number of rows (resp. columns) of \c *this. + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + : m_storage() + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, sizeof...(args) + 4); + m_storage.data()[0] = a0; + m_storage.data()[1] = a1; + m_storage.data()[2] = a2; + m_storage.data()[3] = a3; + Index i = 4; + auto x = {(m_storage.data()[i++] = args, 0)...}; + static_cast(x); + } + + /** \brief Constructs a Matrix or Array and initializes it by elements given by an initializer list of initializer + * lists */ + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE PlainObjectBase(const std::initializer_list>& list) + : m_storage() + { + size_t list_size = 0; + if (list.begin() != list.end()) { + list_size = list.begin()->size(); + } + + // This is to allow syntax like VectorXi {{1, 2, 3, 4}} + if (ColsAtCompileTime == 1 && list.size() == 1) { + eigen_assert(list_size == static_cast(RowsAtCompileTime) || RowsAtCompileTime == Dynamic); + resize(list_size, ColsAtCompileTime); + std::copy(list.begin()->begin(), list.begin()->end(), m_storage.data()); + } else { + eigen_assert(list.size() == static_cast(RowsAtCompileTime) || RowsAtCompileTime == Dynamic); + eigen_assert(list_size == static_cast(ColsAtCompileTime) || ColsAtCompileTime == Dynamic); + resize(list.size(), list_size); + + Index row_index = 0; + for (const std::initializer_list& row : list) { + eigen_assert(list_size == row.size()); + Index col_index = 0; + for (const Scalar& e : row) { + coeffRef(row_index, col_index) = e; + ++col_index; + } + ++row_index; + } + } + } + + /** \sa PlainObjectBase::operator=(const EigenBase&) */ template - EIGEN_STRONG_INLINE Derived& operator=(const EigenBase &other) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase &other) + : m_storage() { - _resize_to_match(other); - Base::operator=(other.derived()); - return this->derived(); + resizeLike(other); + _set_noalias(other); } - /** \sa MatrixBase::operator=(const EigenBase&) */ + /** \sa PlainObjectBase::operator=(const EigenBase&) */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase &other) - : m_storage(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) + : m_storage() + { + resizeLike(other); + *this = other.derived(); + } + /** \brief Copy constructor with in-place evaluation */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const ReturnByValue& other) { - _check_template_params(); - internal::check_rows_cols_for_overflow(other.derived().rows(), other.derived().cols()); + // FIXME this does not automatically transpose vectors if necessary + resize(other.rows(), other.cols()); + other.evalTo(this->derived()); + } + + public: + + /** \brief Copies the generic expression \a other into *this. + * \copydetails DenseBase::operator=(const EigenBase &other) + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& operator=(const EigenBase &other) + { + _resize_to_match(other); Base::operator=(other.derived()); + return this->derived(); } /** \name Map @@ -440,89 +632,101 @@ class PlainObjectBase : public internal::dense_xpr_base::type * while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned * \a data pointers. * + * Here is an example using strides: + * \include Matrix_Map_stride.cpp + * Output: \verbinclude Matrix_Map_stride.out + * * \see class Map */ //@{ - inline static ConstMapType Map(const Scalar* data) + static inline ConstMapType Map(const Scalar* data) { return ConstMapType(data); } - inline static MapType Map(Scalar* data) + static inline MapType Map(Scalar* data) { return MapType(data); } - inline static ConstMapType Map(const Scalar* data, Index size) + static inline ConstMapType Map(const Scalar* data, Index size) { return ConstMapType(data, size); } - inline static MapType Map(Scalar* data, Index size) + static inline MapType Map(Scalar* data, Index size) { return MapType(data, size); } - inline static ConstMapType Map(const Scalar* data, Index rows, Index cols) + static inline ConstMapType Map(const Scalar* data, Index rows, Index cols) { return ConstMapType(data, rows, cols); } - inline static MapType Map(Scalar* data, Index rows, Index cols) + static inline MapType Map(Scalar* data, Index rows, Index cols) { return MapType(data, rows, cols); } - inline static ConstAlignedMapType MapAligned(const Scalar* data) + static inline ConstAlignedMapType MapAligned(const Scalar* data) { return ConstAlignedMapType(data); } - inline static AlignedMapType MapAligned(Scalar* data) + static inline AlignedMapType MapAligned(Scalar* data) { return AlignedMapType(data); } - inline static ConstAlignedMapType MapAligned(const Scalar* data, Index size) + static inline ConstAlignedMapType MapAligned(const Scalar* data, Index size) { return ConstAlignedMapType(data, size); } - inline static AlignedMapType MapAligned(Scalar* data, Index size) + static inline AlignedMapType MapAligned(Scalar* data, Index size) { return AlignedMapType(data, size); } - inline static ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols) + static inline ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols) { return ConstAlignedMapType(data, rows, cols); } - inline static AlignedMapType MapAligned(Scalar* data, Index rows, Index cols) + static inline AlignedMapType MapAligned(Scalar* data, Index rows, Index cols) { return AlignedMapType(data, rows, cols); } template - inline static typename StridedConstMapType >::type Map(const Scalar* data, const Stride& stride) + static inline typename StridedConstMapType >::type Map(const Scalar* data, const Stride& stride) { return typename StridedConstMapType >::type(data, stride); } template - inline static typename StridedMapType >::type Map(Scalar* data, const Stride& stride) + static inline typename StridedMapType >::type Map(Scalar* data, const Stride& stride) { return typename StridedMapType >::type(data, stride); } template - inline static typename StridedConstMapType >::type Map(const Scalar* data, Index size, const Stride& stride) + static inline typename StridedConstMapType >::type Map(const Scalar* data, Index size, const Stride& stride) { return typename StridedConstMapType >::type(data, size, stride); } template - inline static typename StridedMapType >::type Map(Scalar* data, Index size, const Stride& stride) + static inline typename StridedMapType >::type Map(Scalar* data, Index size, const Stride& stride) { return typename StridedMapType >::type(data, size, stride); } template - inline static typename StridedConstMapType >::type Map(const Scalar* data, Index rows, Index cols, const Stride& stride) + static inline typename StridedConstMapType >::type Map(const Scalar* data, Index rows, Index cols, const Stride& stride) { return typename StridedConstMapType >::type(data, rows, cols, stride); } template - inline static typename StridedMapType >::type Map(Scalar* data, Index rows, Index cols, const Stride& stride) + static inline typename StridedMapType >::type Map(Scalar* data, Index rows, Index cols, const Stride& stride) { return typename StridedMapType >::type(data, rows, cols, stride); } template - inline static typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, const Stride& stride) + static inline typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, const Stride& stride) { return typename StridedConstAlignedMapType >::type(data, stride); } template - inline static typename StridedAlignedMapType >::type MapAligned(Scalar* data, const Stride& stride) + static inline typename StridedAlignedMapType >::type MapAligned(Scalar* data, const Stride& stride) { return typename StridedAlignedMapType >::type(data, stride); } template - inline static typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, Index size, const Stride& stride) + static inline typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, Index size, const Stride& stride) { return typename StridedConstAlignedMapType >::type(data, size, stride); } template - inline static typename StridedAlignedMapType >::type MapAligned(Scalar* data, Index size, const Stride& stride) + static inline typename StridedAlignedMapType >::type MapAligned(Scalar* data, Index size, const Stride& stride) { return typename StridedAlignedMapType >::type(data, size, stride); } template - inline static typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, Index rows, Index cols, const Stride& stride) + static inline typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, Index rows, Index cols, const Stride& stride) { return typename StridedConstAlignedMapType >::type(data, rows, cols, stride); } template - inline static typename StridedAlignedMapType >::type MapAligned(Scalar* data, Index rows, Index cols, const Stride& stride) + static inline typename StridedAlignedMapType >::type MapAligned(Scalar* data, Index rows, Index cols, const Stride& stride) { return typename StridedAlignedMapType >::type(data, rows, cols, stride); } //@} using Base::setConstant; - Derived& setConstant(Index size, const Scalar& value); - Derived& setConstant(Index rows, Index cols, const Scalar& value); + EIGEN_DEVICE_FUNC Derived& setConstant(Index size, const Scalar& val); + EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, Index cols, const Scalar& val); + EIGEN_DEVICE_FUNC Derived& setConstant(NoChange_t, Index cols, const Scalar& val); + EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, NoChange_t, const Scalar& val); using Base::setZero; - Derived& setZero(Index size); - Derived& setZero(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setZero(Index size); + EIGEN_DEVICE_FUNC Derived& setZero(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setZero(NoChange_t, Index cols); + EIGEN_DEVICE_FUNC Derived& setZero(Index rows, NoChange_t); using Base::setOnes; - Derived& setOnes(Index size); - Derived& setOnes(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setOnes(Index size); + EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setOnes(NoChange_t, Index cols); + EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, NoChange_t); using Base::setRandom; Derived& setRandom(Index size); Derived& setRandom(Index rows, Index cols); + Derived& setRandom(NoChange_t, Index cols); + Derived& setRandom(Index rows, NoChange_t); #ifdef EIGEN_PLAINOBJECTBASE_PLUGIN #include EIGEN_PLAINOBJECTBASE_PLUGIN @@ -537,6 +741,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type * remain row-vectors and vectors remain vectors. */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase& other) { #ifdef EIGEN_NO_AUTOMATIC_RESIZING @@ -563,25 +768,23 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * \internal */ + // aliasing is dealt once in internal::call_assignment + // so at this stage we have to assume aliasing... and resising has to be done later. template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& _set(const DenseBase& other) { - _set_selector(other.derived(), typename internal::conditional(int(OtherDerived::Flags) & EvalBeforeAssigningBit), internal::true_type, internal::false_type>::type()); + internal::call_assignment(this->derived(), other.derived()); return this->derived(); } - template - EIGEN_STRONG_INLINE void _set_selector(const OtherDerived& other, const internal::true_type&) { _set_noalias(other.eval()); } - - template - EIGEN_STRONG_INLINE void _set_selector(const OtherDerived& other, const internal::false_type&) { _set_noalias(other); } - /** \internal Like _set() but additionally makes the assumption that no aliasing effect can happen (which * is the case when creating a new matrix) so one can enforce lazy evaluation. * * \sa operator=(const MatrixBase&), _set() */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& _set_noalias(const DenseBase& other) { // I don't think we need this resize call since the lazyAssign will anyways resize @@ -589,81 +792,215 @@ class PlainObjectBase : public internal::dense_xpr_base::type //_resize_to_match(other); // the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because // it wouldn't allow to copy a row-vector into a column-vector. - return internal::assign_selector::run(this->derived(), other.derived()); + internal::call_assignment_no_alias(this->derived(), other.derived(), internal::assign_op()); + return this->derived(); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, std::enable_if_t* = 0) + { + const bool t0_is_integer_alike = internal::is_valid_index_type::value; + const bool t1_is_integer_alike = internal::is_valid_index_type::value; + EIGEN_STATIC_ASSERT(t0_is_integer_alike && + t1_is_integer_alike, + FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) + resize(rows,cols); } template - EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if::type* = 0) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1, std::enable_if_t* = 0) { - eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) - && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); - internal::check_rows_cols_for_overflow(rows, cols); - m_storage.resize(rows*cols,rows,cols); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) + m_storage.data()[0] = Scalar(val0); + m_storage.data()[1] = Scalar(val1); } + template - EIGEN_STRONG_INLINE void _init2(const Scalar& x, const Scalar& y, typename internal::enable_if::type* = 0) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(const Index& val0, const Index& val1, + std::enable_if_t< (!internal::is_same::value) + && (internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime==2,T1>* = 0) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) - m_storage.data()[0] = x; - m_storage.data()[1] = y; + m_storage.data()[0] = Scalar(val0); + m_storage.data()[1] = Scalar(val1); + } + + // The argument is convertible to the Index type and we either have a non 1x1 Matrix, or a dynamic-sized Array, + // then the argument is meant to be the size of the object. + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(Index size, std::enable_if_t< (Base::SizeAtCompileTime!=1 || !internal::is_convertible::value) + && ((!internal::is_same::XprKind,ArrayXpr>::value || Base::SizeAtCompileTime==Dynamic)),T>* = 0) + { + // NOTE MSVC 2008 complains if we directly put bool(NumTraits::IsInteger) as the EIGEN_STATIC_ASSERT argument. + const bool is_integer_alike = internal::is_valid_index_type::value; + EIGEN_UNUSED_VARIABLE(is_integer_alike); + EIGEN_STATIC_ASSERT(is_integer_alike, + FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) + resize(size); + } + + // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type can be implicitly converted) + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar& val0, std::enable_if_t::value,T>* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1) + m_storage.data()[0] = val0; + } + + // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type match the index type) + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Index& val0, + std::enable_if_t< (!internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime==1 + && internal::is_convertible::value,T*>* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1) + m_storage.data()[0] = Scalar(val0); + } + + // Initialize a fixed size matrix from a pointer to raw data + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar* data){ + this->_set_noalias(ConstMapType(data)); + } + + // Initialize an arbitrary matrix from a dense expression + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const DenseBase& other){ + this->_set_noalias(other); + } + + // Initialize an arbitrary matrix from an object convertible to the Derived type. + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Derived& other){ + this->_set_noalias(other); + } + + // Initialize an arbitrary matrix from a generic Eigen expression + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const EigenBase& other){ + this->derived() = other; + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const ReturnByValue& other) + { + resize(other.rows(), other.cols()); + other.evalTo(this->derived()); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const RotationBase& r) + { + this->derived() = r; + } + + // For fixed-size Array + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar& val0, + std::enable_if_t< Base::SizeAtCompileTime!=Dynamic + && Base::SizeAtCompileTime!=1 + && internal::is_convertible::value + && internal::is_same::XprKind,ArrayXpr>::value,T>* = 0) + { + Base::setConstant(val0); + } + + // For fixed-size Array + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Index& val0, + std::enable_if_t< (!internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime!=Dynamic + && Base::SizeAtCompileTime!=1 + && internal::is_convertible::value + && internal::is_same::XprKind,ArrayXpr>::value,T*>* = 0) + { + Base::setConstant(val0); } template friend struct internal::matrix_swap_impl; - /** \internal generic implementation of swap for dense storage since for dynamic-sized matrices of same type it is enough to swap the - * data pointers. + public: + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal + * \brief Override DenseBase::swap() since for dynamic-sized matrices + * of same type it is enough to swap the data pointers. */ template - void _swap(DenseBase const & other) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void swap(DenseBase & other) { enum { SwapPointers = internal::is_same::value && Base::SizeAtCompileTime==Dynamic }; - internal::matrix_swap_impl::run(this->derived(), other.const_cast_derived()); + internal::matrix_swap_impl::run(this->derived(), other.derived()); } + /** \internal + * \brief const version forwarded to DenseBase::swap + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void swap(DenseBase const & other) + { Base::swap(other.derived()); } + + enum { IsPlainObjectBase = 1 }; +#endif public: -#ifndef EIGEN_PARSED_BY_DOXYGEN - EIGEN_STRONG_INLINE static void _check_template_params() - { - EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor) - && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0) - && ((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0)) - && ((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0)) - && ((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0)) - && ((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0)) - && (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic) - && (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic) - && (Options & (DontAlign|RowMajor)) == Options), - INVALID_MATRIX_TEMPLATE_PARAMETERS) - } + // These apparently need to be down here for nvcc+icc to prevent duplicate + // Map symbol. + template friend class Eigen::Map; + friend class Eigen::Map; + friend class Eigen::Map; +#if EIGEN_MAX_ALIGN_BYTES>0 + // for EIGEN_MAX_ALIGN_BYTES==0, AlignedMax==Unaligned, and many compilers generate warnings for friend-ing a class twice. + friend class Eigen::Map; + friend class Eigen::Map; #endif - -private: - enum { ThisConstantIsPrivateInPlainObjectBase }; }; +namespace internal { + template -struct internal::conservative_resize_like_impl +struct conservative_resize_like_impl { - typedef typename Derived::Index Index; + static constexpr bool IsRelocatable = std::is_trivially_copyable::value; static void run(DenseBase& _this, Index rows, Index cols) { if (_this.rows() == rows && _this.cols() == cols) return; EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) - if ( ( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows - (!Derived::IsRowMajor && _this.rows() == rows) ) // column-major and we change only the number of columns + if ( IsRelocatable + && (( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows + (!Derived::IsRowMajor && _this.rows() == rows) )) // column-major and we change only the number of columns { - internal::check_rows_cols_for_overflow(rows, cols); + internal::check_rows_cols_for_overflow::run(rows, cols); _this.derived().m_storage.conservativeResize(rows*cols,rows,cols); } else { // The storage order does not allow us to use reallocation. - typename Derived::PlainObject tmp(rows,cols); - const Index common_rows = (std::min)(rows, _this.rows()); - const Index common_cols = (std::min)(cols, _this.cols()); + Derived tmp(rows,cols); + const Index common_rows = numext::mini(rows, _this.rows()); + const Index common_cols = numext::mini(cols, _this.cols()); tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); _this.derived().swap(tmp); } @@ -681,8 +1018,9 @@ struct internal::conservative_resize_like_impl EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(OtherDerived) - if ( ( Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows - (!Derived::IsRowMajor && _this.rows() == other.rows()) ) // column-major and we change only the number of columns + if ( IsRelocatable && + (( Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows + (!Derived::IsRowMajor && _this.rows() == other.rows()) )) // column-major and we change only the number of columns { const Index new_rows = other.rows() - _this.rows(); const Index new_cols = other.cols() - _this.cols(); @@ -695,26 +1033,33 @@ struct internal::conservative_resize_like_impl else { // The storage order does not allow us to use reallocation. - typename Derived::PlainObject tmp(other); - const Index common_rows = (std::min)(tmp.rows(), _this.rows()); - const Index common_cols = (std::min)(tmp.cols(), _this.cols()); + Derived tmp(other); + const Index common_rows = numext::mini(tmp.rows(), _this.rows()); + const Index common_cols = numext::mini(tmp.cols(), _this.cols()); tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); _this.derived().swap(tmp); } } }; -namespace internal { - +// Here, the specialization for vectors inherits from the general matrix case +// to allow calling .conservativeResize(rows,cols) on vectors. template struct conservative_resize_like_impl + : conservative_resize_like_impl { - typedef typename Derived::Index Index; + typedef conservative_resize_like_impl Base; + using Base::run; + using Base::IsRelocatable; + static void run(DenseBase& _this, Index size) { const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : size; const Index new_cols = Derived::RowsAtCompileTime==1 ? size : 1; - _this.derived().m_storage.conservativeResize(size,new_rows,new_cols); + if(IsRelocatable) + _this.derived().m_storage.conservativeResize(size,new_rows,new_cols); + else + Base::run(_this.derived(), new_rows, new_cols); } static void run(DenseBase& _this, const DenseBase& other) @@ -725,7 +1070,10 @@ struct conservative_resize_like_impl const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : other.rows(); const Index new_cols = Derived::RowsAtCompileTime==1 ? other.cols() : 1; - _this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols); + if(IsRelocatable) + _this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols); + else + Base::run(_this.derived(), new_rows, new_cols); if (num_new_elements > 0) _this.tail(num_new_elements) = other.tail(num_new_elements); @@ -735,7 +1083,8 @@ struct conservative_resize_like_impl template struct matrix_swap_impl { - static inline void run(MatrixTypeA& a, MatrixTypeB& b) + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(MatrixTypeA& a, MatrixTypeB& b) { a.base().swap(b); } @@ -744,6 +1093,7 @@ struct matrix_swap_impl template struct matrix_swap_impl { + EIGEN_DEVICE_FUNC static inline void run(MatrixTypeA& a, MatrixTypeB& b) { static_cast(a).m_storage.swap(static_cast(b).m_storage); @@ -752,4 +1102,6 @@ struct matrix_swap_impl } // end namespace internal +} // end namespace Eigen + #endif // EIGEN_DENSESTORAGEBASE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Product.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Product.h index e2035b2..85842d1 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Product.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Product.h @@ -1,625 +1,193 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2006-2008 Benoit Jacob -// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2008-2011 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_PRODUCT_H #define EIGEN_PRODUCT_H -/** \class GeneralProduct - * \ingroup Core_Module - * - * \brief Expression of the product of two general matrices or vectors - * - * \param LhsNested the type used to store the left-hand side - * \param RhsNested the type used to store the right-hand side - * \param ProductMode the type of the product - * - * This class represents an expression of the product of two general matrices. - * We call a general matrix, a dense matrix with full storage. For instance, - * This excludes triangular, selfadjoint, and sparse matrices. - * It is the return type of the operator* between general matrices. Its template - * arguments are determined automatically by ProductReturnType. Therefore, - * GeneralProduct should never be used direclty. To determine the result type of a - * function which involves a matrix product, use ProductReturnType::Type. - * - * \sa ProductReturnType, MatrixBase::operator*(const MatrixBase&) - */ -template::value> -class GeneralProduct; +#include "./InternalHeaderCheck.h" -enum { - Large = 2, - Small = 3 -}; +namespace Eigen { -namespace internal { +template class ProductImpl; -template struct product_type_selector; +namespace internal { -template struct product_size_category +template +struct traits > { - enum { is_large = MaxSize == Dynamic || - Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD, - value = is_large ? Large - : Size == 1 ? 1 - : Small - }; -}; + typedef remove_all_t LhsCleaned; + typedef remove_all_t RhsCleaned; + typedef traits LhsTraits; + typedef traits RhsTraits; -template struct product_type -{ - typedef typename remove_all::type _Lhs; - typedef typename remove_all::type _Rhs; - enum { - MaxRows = _Lhs::MaxRowsAtCompileTime, - Rows = _Lhs::RowsAtCompileTime, - MaxCols = _Rhs::MaxColsAtCompileTime, - Cols = _Rhs::ColsAtCompileTime, - MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::MaxColsAtCompileTime, - _Rhs::MaxRowsAtCompileTime), - Depth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::ColsAtCompileTime, - _Rhs::RowsAtCompileTime), - LargeThreshold = EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD - }; + typedef MatrixXpr XprKind; - // the splitting into different lines of code here, introducing the _select enums and the typedef below, - // is to work around an internal compiler error with gcc 4.1 and 4.2. -private: - enum { - rows_select = product_size_category::value, - cols_select = product_size_category::value, - depth_select = product_size_category::value - }; - typedef product_type_selector selector; + typedef typename ScalarBinaryOpTraits::Scalar, typename traits::Scalar>::ReturnType Scalar; + typedef typename product_promote_storage_type::ret>::ret StorageKind; + typedef typename promote_index_type::type StorageIndex; -public: enum { - value = selector::ret + RowsAtCompileTime = LhsTraits::RowsAtCompileTime, + ColsAtCompileTime = RhsTraits::ColsAtCompileTime, + MaxRowsAtCompileTime = LhsTraits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = RhsTraits::MaxColsAtCompileTime, + + // FIXME: only needed by GeneralMatrixMatrixTriangular + InnerSize = min_size_prefer_fixed(LhsTraits::ColsAtCompileTime, RhsTraits::RowsAtCompileTime), + + // The storage order is somewhat arbitrary here. The correct one will be determined through the evaluator. + Flags = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? RowMajorBit + : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0 + : ( ((LhsTraits::Flags&NoPreferredStorageOrderBit) && (RhsTraits::Flags&RowMajorBit)) + || ((RhsTraits::Flags&NoPreferredStorageOrderBit) && (LhsTraits::Flags&RowMajorBit)) ) ? RowMajorBit + : NoPreferredStorageOrderBit }; -#ifdef EIGEN_DEBUG_PRODUCT - static void debug() - { - EIGEN_DEBUG_VAR(Rows); - EIGEN_DEBUG_VAR(Cols); - EIGEN_DEBUG_VAR(Depth); - EIGEN_DEBUG_VAR(rows_select); - EIGEN_DEBUG_VAR(cols_select); - EIGEN_DEBUG_VAR(depth_select); - EIGEN_DEBUG_VAR(value); - } -#endif }; - -/* The following allows to select the kind of product at compile time - * based on the three dimensions of the product. - * This is a compile time mapping from {1,Small,Large}^3 -> {product types} */ -// FIXME I'm not sure the current mapping is the ideal one. -template struct product_type_selector { enum { ret = OuterProduct }; }; -template struct product_type_selector<1, 1, Depth> { enum { ret = InnerProduct }; }; -template<> struct product_type_selector<1, 1, 1> { enum { ret = InnerProduct }; }; -template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; -template<> struct product_type_selector<1, Small,Small> { enum { ret = CoeffBasedProductMode }; }; -template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; -template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; -template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; -template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; -template<> struct product_type_selector<1, Large,Small> { enum { ret = CoeffBasedProductMode }; }; -template<> struct product_type_selector<1, Large,Large> { enum { ret = GemvProduct }; }; -template<> struct product_type_selector<1, Small,Large> { enum { ret = CoeffBasedProductMode }; }; -template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; -template<> struct product_type_selector { enum { ret = GemvProduct }; }; -template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; -template<> struct product_type_selector { enum { ret = GemmProduct }; }; -template<> struct product_type_selector { enum { ret = GemmProduct }; }; -template<> struct product_type_selector { enum { ret = GemmProduct }; }; -template<> struct product_type_selector { enum { ret = GemmProduct }; }; -template<> struct product_type_selector { enum { ret = GemmProduct }; }; -template<> struct product_type_selector { enum { ret = GemmProduct }; }; -template<> struct product_type_selector { enum { ret = GemmProduct }; }; - } // end namespace internal -/** \class ProductReturnType +/** \class Product * \ingroup Core_Module * - * \brief Helper class to get the correct and optimized returned type of operator* + * \brief Expression of the product of two arbitrary matrices or vectors * - * \param Lhs the type of the left-hand side - * \param Rhs the type of the right-hand side - * \param ProductMode the type of the product (determined automatically by internal::product_mode) + * \tparam Lhs_ the type of the left-hand side expression + * \tparam Rhs_ the type of the right-hand side expression * - * This class defines the typename Type representing the optimized product expression - * between two matrix expressions. In practice, using ProductReturnType::Type - * is the recommended way to define the result type of a function returning an expression - * which involve a matrix product. The class Product should never be - * used directly. + * This class represents an expression of the product of two arbitrary matrices. + * + * The other template parameters are: + * \tparam Option can be DefaultProduct, AliasFreeProduct, or LazyProduct * - * \sa class Product, MatrixBase::operator*(const MatrixBase&) */ -template -struct ProductReturnType -{ - // TODO use the nested type to reduce instanciations ???? -// typedef typename internal::nested::type LhsNested; -// typedef typename internal::nested::type RhsNested; - - typedef GeneralProduct Type; -}; - -template -struct ProductReturnType -{ - typedef typename internal::nested::type >::type LhsNested; - typedef typename internal::nested::type >::type RhsNested; - typedef CoeffBasedProduct Type; -}; - -template -struct ProductReturnType -{ - typedef typename internal::nested::type >::type LhsNested; - typedef typename internal::nested::type >::type RhsNested; - typedef CoeffBasedProduct Type; -}; - -// this is a workaround for sun CC -template -struct LazyProductReturnType : public ProductReturnType -{}; - -/*********************************************************************** -* Implementation of Inner Vector Vector Product -***********************************************************************/ - -// FIXME : maybe the "inner product" could return a Scalar -// instead of a 1x1 matrix ?? -// Pro: more natural for the user -// Cons: this could be a problem if in a meta unrolled algorithm a matrix-matrix -// product ends up to a row-vector times col-vector product... To tackle this use -// case, we could have a specialization for Block with: operator=(Scalar x); - -namespace internal { - -template -struct traits > - : traits::ReturnType,1,1> > -{}; - -} - -template -class GeneralProduct - : internal::no_assignment_operator, - public Matrix::ReturnType,1,1> +template +class Product : public ProductImpl::StorageKind, + typename internal::traits::StorageKind, + internal::product_type::ret>::ret> { - typedef Matrix::ReturnType,1,1> Base; public: - GeneralProduct(const Lhs& lhs, const Rhs& rhs) - { - EIGEN_STATIC_ASSERT((internal::is_same::value), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - - Base::coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum(); - } - - /** Convertion to scalar */ - operator const typename Base::Scalar() const { - return Base::coeff(0,0); - } -}; - -/*********************************************************************** -* Implementation of Outer Vector Vector Product -***********************************************************************/ -namespace internal { -template struct outer_product_selector; - -template -struct traits > - : traits, Lhs, Rhs> > -{}; + typedef Lhs_ Lhs; + typedef Rhs_ Rhs; -} + typedef typename ProductImpl< + Lhs, Rhs, Option, + typename internal::product_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + internal::product_type::ret>::ret>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Product) -template -class GeneralProduct - : public ProductBase, Lhs, Rhs> -{ - public: - EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct) + typedef typename internal::ref_selector::type LhsNested; + typedef typename internal::ref_selector::type RhsNested; + typedef internal::remove_all_t LhsNestedCleaned; + typedef internal::remove_all_t RhsNestedCleaned; - GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs) { - EIGEN_STATIC_ASSERT((internal::is_same::value), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + eigen_assert(lhs.cols() == rhs.rows() + && "invalid matrix product" + && "if you wanted a coeff-wise or a dot product use the respective explicit functions"); } - template void scaleAndAddTo(Dest& dest, Scalar alpha) const - { - internal::outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, alpha); - } -}; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_lhs.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); } -namespace internal { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const LhsNestedCleaned& lhs() const { return m_lhs; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const RhsNestedCleaned& rhs() const { return m_rhs; } -template<> struct outer_product_selector { - template - static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) { - typedef typename Dest::Index Index; - // FIXME make sure lhs is sequentially stored - // FIXME not very good if rhs is real and lhs complex while alpha is real too - const Index cols = dest.cols(); - for (Index j=0; j struct outer_product_selector { - template - static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) { - typedef typename Dest::Index Index; - // FIXME make sure rhs is sequentially stored - // FIXME not very good if lhs is real and rhs complex while alpha is real too - const Index rows = dest.rows(); - for (Index i=0; i call fast BLAS-like colmajor routine - * 2 - the matrix is row-major, BLAS compatible and N is large => call fast BLAS-like rowmajor routine - * 3 - all other cases are handled using a simple loop along the outer-storage direction. - * Therefore we need a lower level meta selector. - * Furthermore, if the matrix is the rhs, then the product has to be transposed. - */ namespace internal { -template -struct traits > - : traits, Lhs, Rhs> > +template::ret> +class dense_product_base + : public internal::dense_xpr_base >::type {}; -template -struct gemv_selector; - -} // end namespace internal - -template -class GeneralProduct - : public ProductBase, Lhs, Rhs> +/** Conversion to scalar for inner-products */ +template +class dense_product_base + : public internal::dense_xpr_base >::type { - public: - EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct) - - typedef typename Lhs::Scalar LhsScalar; - typedef typename Rhs::Scalar RhsScalar; - - GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) - { -// EIGEN_STATIC_ASSERT((internal::is_same::value), -// YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - } - - enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight }; - typedef typename internal::conditional::type MatrixType; - - template void scaleAndAddTo(Dest& dst, Scalar alpha) const - { - eigen_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols()); - internal::gemv_selector::HasUsableDirectAccess)>::run(*this, dst, alpha); - } -}; - -namespace internal { + typedef Product ProductXpr; + typedef typename internal::dense_xpr_base::type Base; +public: + using Base::derived; + typedef typename Base::Scalar Scalar; -// The vector is on the left => transposition -template -struct gemv_selector -{ - template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE operator const Scalar() const { - Transpose destT(dest); - enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor }; - gemv_selector - ::run(GeneralProduct,Transpose, GemvProduct> - (prod.rhs().transpose(), prod.lhs().transpose()), destT, alpha); + return internal::evaluator(derived()).coeff(0,0); } }; -template struct gemv_static_vector_if; - -template -struct gemv_static_vector_if -{ - EIGEN_STRONG_INLINE Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; } -}; +} // namespace internal -template -struct gemv_static_vector_if +// Generic API dispatcher +template +class ProductImpl : public internal::generic_xpr_base, MatrixXpr, StorageKind>::type { - EIGEN_STRONG_INLINE Scalar* data() { return 0; } + public: + typedef typename internal::generic_xpr_base, MatrixXpr, StorageKind>::type Base; }; -template -struct gemv_static_vector_if +template +class ProductImpl + : public internal::dense_product_base { - #if EIGEN_ALIGN_STATICALLY - internal::plain_array m_data; - EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; } - #else - // Some architectures cannot align on the stack, - // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. - enum { - ForceAlignment = internal::packet_traits::Vectorizable, - PacketSize = internal::packet_traits::size - }; - internal::plain_array m_data; - EIGEN_STRONG_INLINE Scalar* data() { - return ForceAlignment - ? reinterpret_cast((reinterpret_cast(m_data.array) & ~(size_t(15))) + 16) - : m_data.array; - } - #endif -}; + typedef Product Derived; -template<> struct gemv_selector -{ - template - static inline void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) - { - typedef typename ProductType::Index Index; - typedef typename ProductType::LhsScalar LhsScalar; - typedef typename ProductType::RhsScalar RhsScalar; - typedef typename ProductType::Scalar ResScalar; - typedef typename ProductType::RealScalar RealScalar; - typedef typename ProductType::ActualLhsType ActualLhsType; - typedef typename ProductType::ActualRhsType ActualRhsType; - typedef typename ProductType::LhsBlasTraits LhsBlasTraits; - typedef typename ProductType::RhsBlasTraits RhsBlasTraits; - typedef Map, Aligned> MappedDest; - - const ActualLhsType actualLhs = LhsBlasTraits::extract(prod.lhs()); - const ActualRhsType actualRhs = RhsBlasTraits::extract(prod.rhs()); - - ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs()) - * RhsBlasTraits::extractScalarFactor(prod.rhs()); + public: + typedef typename internal::dense_product_base Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + protected: enum { - // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 - // on, the other hand it is good for the cache to pack the vector anyways... - EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime==1, - ComplexByReal = (NumTraits::IsComplex) && (!NumTraits::IsComplex), - MightCannotUseDest = (Dest::InnerStrideAtCompileTime!=1) || ComplexByReal + IsOneByOne = (RowsAtCompileTime == 1 || RowsAtCompileTime == Dynamic) && + (ColsAtCompileTime == 1 || ColsAtCompileTime == Dynamic), + EnableCoeff = IsOneByOne || Option==LazyProduct }; - gemv_static_vector_if static_dest; - - // this is written like this (i.e., with a ?:) to workaround an ICE with ICC 12 - bool alphaIsCompatible = (!ComplexByReal) ? true : (imag(actualAlpha)==RealScalar(0)); - bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; - - RhsScalar compatibleAlpha = get_factor::run(actualAlpha); + public: - ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(), - evalToDest ? dest.data() : static_dest.data()); - - if(!evalToDest) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(Index row, Index col) const { - #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN - int size = dest.size(); - EIGEN_DENSE_STORAGE_CTOR_PLUGIN - #endif - if(!alphaIsCompatible) - { - MappedDest(actualDestPtr, dest.size()).setZero(); - compatibleAlpha = RhsScalar(1); - } - else - MappedDest(actualDestPtr, dest.size()) = dest; - } + EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS); + eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) ); - general_matrix_vector_product - ::run( - actualLhs.rows(), actualLhs.cols(), - &actualLhs.coeffRef(0,0), actualLhs.outerStride(), - actualRhs.data(), actualRhs.innerStride(), - actualDestPtr, 1, - compatibleAlpha); - - if (!evalToDest) - { - if(!alphaIsCompatible) - dest += actualAlpha * MappedDest(actualDestPtr, dest.size()); - else - dest = MappedDest(actualDestPtr, dest.size()); + return internal::evaluator(derived()).coeff(row,col); } - } -}; -template<> struct gemv_selector -{ - template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) - { - typedef typename ProductType::LhsScalar LhsScalar; - typedef typename ProductType::RhsScalar RhsScalar; - typedef typename ProductType::Scalar ResScalar; - typedef typename ProductType::Index Index; - typedef typename ProductType::ActualLhsType ActualLhsType; - typedef typename ProductType::ActualRhsType ActualRhsType; - typedef typename ProductType::_ActualRhsType _ActualRhsType; - typedef typename ProductType::LhsBlasTraits LhsBlasTraits; - typedef typename ProductType::RhsBlasTraits RhsBlasTraits; - - typename add_const::type actualLhs = LhsBlasTraits::extract(prod.lhs()); - typename add_const::type actualRhs = RhsBlasTraits::extract(prod.rhs()); - - ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs()) - * RhsBlasTraits::extractScalarFactor(prod.rhs()); - - enum { - // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 - // on, the other hand it is good for the cache to pack the vector anyways... - DirectlyUseRhs = _ActualRhsType::InnerStrideAtCompileTime==1 - }; - - gemv_static_vector_if static_rhs; - - ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(), - DirectlyUseRhs ? const_cast(actualRhs.data()) : static_rhs.data()); - - if(!DirectlyUseRhs) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(Index i) const { - #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN - int size = actualRhs.size(); - EIGEN_DENSE_STORAGE_CTOR_PLUGIN - #endif - Map(actualRhsPtr, actualRhs.size()) = actualRhs; - } + EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS); + eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) ); - general_matrix_vector_product - ::run( - actualLhs.rows(), actualLhs.cols(), - &actualLhs.coeffRef(0,0), actualLhs.outerStride(), - actualRhsPtr, 1, - &dest.coeffRef(0,0), dest.innerStride(), - actualAlpha); - } -}; + return internal::evaluator(derived()).coeff(i); + } -template<> struct gemv_selector -{ - template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) - { - typedef typename Dest::Index Index; - // TODO makes sure dest is sequentially stored in memory, otherwise use a temp - const Index size = prod.rhs().rows(); - for(Index k=0; k struct gemv_selector -{ - template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) - { - typedef typename Dest::Index Index; - // TODO makes sure rhs is sequentially stored in memory, otherwise use a temp - const Index rows = prod.rows(); - for(Index i=0; i -template -inline const typename ProductReturnType::Type -MatrixBase::operator*(const MatrixBase &other) const -{ - // A note regarding the function declaration: In MSVC, this function will sometimes - // not be inlined since DenseStorage is an unwindable object for dynamic - // matrices and product types are holding a member to store the result. - // Thus it does not help tagging this function with EIGEN_STRONG_INLINE. - enum { - ProductIsValid = Derived::ColsAtCompileTime==Dynamic - || OtherDerived::RowsAtCompileTime==Dynamic - || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime), - AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime, - SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived) - }; - // note to the lost user: - // * for a dot product use: v1.dot(v2) - // * for a coeff-wise product use: v1.cwiseProduct(v2) - EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes), - INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS) - EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors), - INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION) - EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT) -#ifdef EIGEN_DEBUG_PRODUCT - internal::product_type::debug(); -#endif - return typename ProductReturnType::Type(derived(), other.derived()); -} - -/** \returns an expression of the matrix product of \c *this and \a other without implicit evaluation. - * - * The returned product will behave like any other expressions: the coefficients of the product will be - * computed once at a time as requested. This might be useful in some extremely rare cases when only - * a small and no coherent fraction of the result's coefficients have to be computed. - * - * \warning This version of the matrix product can be much much slower. So use it only if you know - * what you are doing and that you measured a true speed improvement. - * - * \sa operator*(const MatrixBase&) - */ -template -template -const typename LazyProductReturnType::Type -MatrixBase::lazyProduct(const MatrixBase &other) const -{ - enum { - ProductIsValid = Derived::ColsAtCompileTime==Dynamic - || OtherDerived::RowsAtCompileTime==Dynamic - || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime), - AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime, - SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived) - }; - // note to the lost user: - // * for a dot product use: v1.dot(v2) - // * for a coeff-wise product use: v1.cwiseProduct(v2) - EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes), - INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS) - EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors), - INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION) - EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT) - - return typename LazyProductReturnType::Type(derived(), other.derived()); -} +} // end namespace Eigen #endif // EIGEN_PRODUCT_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ProductBase.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ProductBase.h deleted file mode 100644 index 9197588..0000000 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ProductBase.h +++ /dev/null @@ -1,290 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2009-2010 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_PRODUCTBASE_H -#define EIGEN_PRODUCTBASE_H - -/** \class ProductBase - * \ingroup Core_Module - * - */ - -namespace internal { -template -struct traits > -{ - typedef MatrixXpr XprKind; - typedef typename remove_all<_Lhs>::type Lhs; - typedef typename remove_all<_Rhs>::type Rhs; - typedef typename scalar_product_traits::ReturnType Scalar; - typedef typename promote_storage_type::StorageKind, - typename traits::StorageKind>::ret StorageKind; - typedef typename promote_index_type::Index, - typename traits::Index>::type Index; - enum { - RowsAtCompileTime = traits::RowsAtCompileTime, - ColsAtCompileTime = traits::ColsAtCompileTime, - MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, - MaxColsAtCompileTime = traits::MaxColsAtCompileTime, - Flags = (MaxRowsAtCompileTime==1 ? RowMajorBit : 0) - | EvalBeforeNestingBit | EvalBeforeAssigningBit | NestByRefBit, - // Note that EvalBeforeNestingBit and NestByRefBit - // are not used in practice because nested is overloaded for products - CoeffReadCost = 0 // FIXME why is it needed ? - }; -}; -} - -#define EIGEN_PRODUCT_PUBLIC_INTERFACE(Derived) \ - typedef ProductBase Base; \ - EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \ - typedef typename Base::LhsNested LhsNested; \ - typedef typename Base::_LhsNested _LhsNested; \ - typedef typename Base::LhsBlasTraits LhsBlasTraits; \ - typedef typename Base::ActualLhsType ActualLhsType; \ - typedef typename Base::_ActualLhsType _ActualLhsType; \ - typedef typename Base::RhsNested RhsNested; \ - typedef typename Base::_RhsNested _RhsNested; \ - typedef typename Base::RhsBlasTraits RhsBlasTraits; \ - typedef typename Base::ActualRhsType ActualRhsType; \ - typedef typename Base::_ActualRhsType _ActualRhsType; \ - using Base::m_lhs; \ - using Base::m_rhs; - -template -class ProductBase : public MatrixBase -{ - public: - typedef MatrixBase Base; - EIGEN_DENSE_PUBLIC_INTERFACE(ProductBase) - - typedef typename Lhs::Nested LhsNested; - typedef typename internal::remove_all::type _LhsNested; - typedef internal::blas_traits<_LhsNested> LhsBlasTraits; - typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; - typedef typename internal::remove_all::type _ActualLhsType; - typedef typename internal::traits::Scalar LhsScalar; - - typedef typename Rhs::Nested RhsNested; - typedef typename internal::remove_all::type _RhsNested; - typedef internal::blas_traits<_RhsNested> RhsBlasTraits; - typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; - typedef typename internal::remove_all::type _ActualRhsType; - typedef typename internal::traits::Scalar RhsScalar; - - // Diagonal of a product: no need to evaluate the arguments because they are going to be evaluated only once - typedef CoeffBasedProduct FullyLazyCoeffBaseProductType; - - public: - - typedef typename Base::PlainObject PlainObject; - - ProductBase(const Lhs& lhs, const Rhs& rhs) - : m_lhs(lhs), m_rhs(rhs) - { - eigen_assert(lhs.cols() == rhs.rows() - && "invalid matrix product" - && "if you wanted a coeff-wise or a dot product use the respective explicit functions"); - } - - inline Index rows() const { return m_lhs.rows(); } - inline Index cols() const { return m_rhs.cols(); } - - template - inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst,Scalar(1)); } - - template - inline void addTo(Dest& dst) const { scaleAndAddTo(dst,1); } - - template - inline void subTo(Dest& dst) const { scaleAndAddTo(dst,-1); } - - template - inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { derived().scaleAndAddTo(dst,alpha); } - - const _LhsNested& lhs() const { return m_lhs; } - const _RhsNested& rhs() const { return m_rhs; } - - // Implicit conversion to the nested type (trigger the evaluation of the product) - operator const PlainObject& () const - { - m_result.resize(m_lhs.rows(), m_rhs.cols()); - derived().evalTo(m_result); - return m_result; - } - - const Diagonal diagonal() const - { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); } - - template - const Diagonal diagonal() const - { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); } - - const Diagonal diagonal(Index index) const - { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs).diagonal(index); } - - // restrict coeff accessors to 1x1 expressions. No need to care about mutators here since this isnt a Lvalue expression - typename Base::CoeffReturnType coeff(Index row, Index col) const - { -#ifdef EIGEN2_SUPPORT - return lhs().row(row).cwiseProduct(rhs().col(col).transpose()).sum(); -#else - EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) - eigen_assert(this->rows() == 1 && this->cols() == 1); - Matrix result = *this; - return result.coeff(row,col); -#endif - } - - typename Base::CoeffReturnType coeff(Index i) const - { - EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) - eigen_assert(this->rows() == 1 && this->cols() == 1); - Matrix result = *this; - return result.coeff(i); - } - - const Scalar& coeffRef(Index row, Index col) const - { - EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) - eigen_assert(this->rows() == 1 && this->cols() == 1); - return derived().coeffRef(row,col); - } - - const Scalar& coeffRef(Index i) const - { - EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) - eigen_assert(this->rows() == 1 && this->cols() == 1); - return derived().coeffRef(i); - } - - protected: - - const LhsNested m_lhs; - const RhsNested m_rhs; - - mutable PlainObject m_result; -}; - -// here we need to overload the nested rule for products -// such that the nested type is a const reference to a plain matrix -namespace internal { -template -struct nested, N, PlainObject> -{ - typedef PlainObject const& type; -}; -} - -template -class ScaledProduct; - -// Note that these two operator* functions are not defined as member -// functions of ProductBase, because, otherwise we would have to -// define all overloads defined in MatrixBase. Furthermore, Using -// "using Base::operator*" would not work with MSVC. -// -// Also note that here we accept any compatible scalar types -template -const ScaledProduct -operator*(const ProductBase& prod, typename Derived::Scalar x) -{ return ScaledProduct(prod.derived(), x); } - -template -typename internal::enable_if::value, - const ScaledProduct >::type -operator*(const ProductBase& prod, typename Derived::RealScalar x) -{ return ScaledProduct(prod.derived(), x); } - - -template -const ScaledProduct -operator*(typename Derived::Scalar x,const ProductBase& prod) -{ return ScaledProduct(prod.derived(), x); } - -template -typename internal::enable_if::value, - const ScaledProduct >::type -operator*(typename Derived::RealScalar x,const ProductBase& prod) -{ return ScaledProduct(prod.derived(), x); } - -namespace internal { -template -struct traits > - : traits, - typename NestedProduct::_LhsNested, - typename NestedProduct::_RhsNested> > -{ - typedef typename traits::StorageKind StorageKind; -}; -} - -template -class ScaledProduct - : public ProductBase, - typename NestedProduct::_LhsNested, - typename NestedProduct::_RhsNested> -{ - public: - typedef ProductBase, - typename NestedProduct::_LhsNested, - typename NestedProduct::_RhsNested> Base; - typedef typename Base::Scalar Scalar; - typedef typename Base::PlainObject PlainObject; -// EIGEN_PRODUCT_PUBLIC_INTERFACE(ScaledProduct) - - ScaledProduct(const NestedProduct& prod, Scalar x) - : Base(prod.lhs(),prod.rhs()), m_prod(prod), m_alpha(x) {} - - template - inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst, Scalar(1)); } - - template - inline void addTo(Dest& dst) const { scaleAndAddTo(dst, Scalar(1)); } - - template - inline void subTo(Dest& dst) const { scaleAndAddTo(dst, Scalar(-1)); } - - template - inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { m_prod.derived().scaleAndAddTo(dst,alpha * m_alpha); } - - const Scalar& alpha() const { return m_alpha; } - - protected: - const NestedProduct& m_prod; - Scalar m_alpha; -}; - -/** \internal - * Overloaded to perform an efficient C = (A*B).lazy() */ -template -template -Derived& MatrixBase::lazyAssign(const ProductBase& other) -{ - other.derived().evalTo(derived()); - return derived(); -} - - -#endif // EIGEN_PRODUCTBASE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ProductEvaluators.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ProductEvaluators.h new file mode 100644 index 0000000..05ffa25 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ProductEvaluators.h @@ -0,0 +1,1181 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008-2010 Gael Guennebaud +// Copyright (C) 2011 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#ifndef EIGEN_PRODUCTEVALUATORS_H +#define EIGEN_PRODUCTEVALUATORS_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +/** \internal + * Evaluator of a product expression. + * Since products require special treatments to handle all possible cases, + * we simply defer the evaluation logic to a product_evaluator class + * which offers more partial specialization possibilities. + * + * \sa class product_evaluator + */ +template +struct evaluator > + : public product_evaluator > +{ + typedef Product XprType; + typedef product_evaluator Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +// Catch "scalar * ( A * B )" and transform it to "(A*scalar) * B" +// TODO we should apply that rule only if that's really helpful +template +struct evaluator_assume_aliasing, + const CwiseNullaryOp, Plain1>, + const Product > > +{ + static const bool value = true; +}; +template +struct evaluator, + const CwiseNullaryOp, Plain1>, + const Product > > + : public evaluator > +{ + typedef CwiseBinaryOp, + const CwiseNullaryOp, Plain1>, + const Product > XprType; + typedef evaluator > Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) + : Base(xpr.lhs().functor().m_other * xpr.rhs().lhs() * xpr.rhs().rhs()) + {} +}; + + +template +struct evaluator, DiagIndex> > + : public evaluator, DiagIndex> > +{ + typedef Diagonal, DiagIndex> XprType; + typedef evaluator, DiagIndex> > Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) + : Base(Diagonal, DiagIndex>( + Product(xpr.nestedExpression().lhs(), xpr.nestedExpression().rhs()), + xpr.index() )) + {} +}; + + +// Helper class to perform a matrix product with the destination at hand. +// Depending on the sizes of the factors, there are different evaluation strategies +// as controlled by internal::product_type. +template< typename Lhs, typename Rhs, + typename LhsShape = typename evaluator_traits::Shape, + typename RhsShape = typename evaluator_traits::Shape, + int ProductType = internal::product_type::value> +struct generic_product_impl; + +template +struct evaluator_assume_aliasing > { + static const bool value = true; +}; + +// This is the default evaluator implementation for products: +// It creates a temporary and call generic_product_impl +template +struct product_evaluator, ProductTag, LhsShape, RhsShape> + : public evaluator::PlainObject> +{ + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + typedef evaluator Base; + enum { + Flags = Base::Flags | EvalBeforeNestingBit + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : m_result(xpr.rows(), xpr.cols()) + { + internal::construct_at(this, m_result); + +// FIXME shall we handle nested_eval here?, +// if so, then we must take care at removing the call to nested_eval in the specializations (e.g., in permutation_matrix_product, transposition_matrix_product, etc.) +// typedef typename internal::nested_eval::type LhsNested; +// typedef typename internal::nested_eval::type RhsNested; +// typedef internal::remove_all_t LhsNestedCleaned; +// typedef internal::remove_all_t RhsNestedCleaned; +// +// const LhsNested lhs(xpr.lhs()); +// const RhsNested rhs(xpr.rhs()); +// +// generic_product_impl::evalTo(m_result, lhs, rhs); + + generic_product_impl::evalTo(m_result, xpr.lhs(), xpr.rhs()); + } + +protected: + PlainObject m_result; +}; + +// The following three shortcuts are enabled only if the scalar types match exactly. +// TODO: we could enable them for different scalar types when the product is not vectorized. + +// Dense = Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::assign_op, Dense2Dense, + std::enable_if_t<(Options==DefaultProduct || Options==AliasFreeProduct)>> +{ + typedef Product SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + // FIXME shall we handle nested_eval here? + generic_product_impl::evalTo(dst, src.lhs(), src.rhs()); + } +}; + +// Dense += Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::add_assign_op, Dense2Dense, + std::enable_if_t<(Options==DefaultProduct || Options==AliasFreeProduct)>> +{ + typedef Product SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &) + { + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + // FIXME shall we handle nested_eval here? + generic_product_impl::addTo(dst, src.lhs(), src.rhs()); + } +}; + +// Dense -= Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::sub_assign_op, Dense2Dense, + std::enable_if_t<(Options==DefaultProduct || Options==AliasFreeProduct)>> +{ + typedef Product SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &) + { + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + // FIXME shall we handle nested_eval here? + generic_product_impl::subTo(dst, src.lhs(), src.rhs()); + } +}; + + +// Dense ?= scalar * Product +// TODO we should apply that rule if that's really helpful +// for instance, this is not good for inner products +template< typename DstXprType, typename Lhs, typename Rhs, typename AssignFunc, typename Scalar, typename ScalarBis, typename Plain> +struct Assignment, const CwiseNullaryOp,Plain>, + const Product >, AssignFunc, Dense2Dense> +{ + typedef CwiseBinaryOp, + const CwiseNullaryOp,Plain>, + const Product > SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const AssignFunc& func) + { + call_assignment_no_alias(dst, (src.lhs().functor().m_other * src.rhs().lhs())*src.rhs().rhs(), func); + } +}; + +//---------------------------------------- +// Catch "Dense ?= xpr + Product<>" expression to save one temporary +// FIXME we could probably enable these rules for any product, i.e., not only Dense and DefaultProduct + +template +struct evaluator_assume_aliasing::Scalar>, const OtherXpr, + const Product >, DenseShape > { + static const bool value = true; +}; + +template +struct evaluator_assume_aliasing::Scalar>, const OtherXpr, + const Product >, DenseShape > { + static const bool value = true; +}; + +template +struct assignment_from_xpr_op_product +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const InitialFunc& /*func*/) + { + call_assignment_no_alias(dst, src.lhs(), Func1()); + call_assignment_no_alias(dst, src.rhs(), Func2()); + } +}; + +#define EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(ASSIGN_OP,BINOP,ASSIGN_OP2) \ + template< typename DstXprType, typename OtherXpr, typename Lhs, typename Rhs, typename DstScalar, typename SrcScalar, typename OtherScalar,typename ProdScalar> \ + struct Assignment, const OtherXpr, \ + const Product >, internal::ASSIGN_OP, Dense2Dense> \ + : assignment_from_xpr_op_product, internal::ASSIGN_OP, internal::ASSIGN_OP2 > \ + {} + +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_sum_op,add_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,scalar_sum_op,add_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,scalar_sum_op,sub_assign_op); + +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_difference_op,sub_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,scalar_difference_op,sub_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,scalar_difference_op,add_assign_op); + +//---------------------------------------- + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + dst.coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum(); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + dst.coeffRef(0,0) += (lhs.transpose().cwiseProduct(rhs)).sum(); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { dst.coeffRef(0,0) -= (lhs.transpose().cwiseProduct(rhs)).sum(); } +}; + + +/*********************************************************************** +* Implementation of outer dense * dense vector product +***********************************************************************/ + +// Column major result +template +void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const false_type&) +{ + evaluator rhsEval(rhs); + ei_declare_local_nested_eval(Lhs,lhs,Rhs::SizeAtCompileTime,actual_lhs); + // FIXME if cols is large enough, then it might be useful to make sure that lhs is sequentially stored + // FIXME not very good if rhs is real and lhs complex while alpha is real too + const Index cols = dst.cols(); + for (Index j=0; j +void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const true_type&) +{ + evaluator lhsEval(lhs); + ei_declare_local_nested_eval(Rhs,rhs,Lhs::SizeAtCompileTime,actual_rhs); + // FIXME if rows is large enough, then it might be useful to make sure that rhs is sequentially stored + // FIXME not very good if lhs is real and rhs complex while alpha is real too + const Index rows = dst.rows(); + for (Index i=0; i +struct generic_product_impl +{ + template struct is_row_major : std::conditional_t<(int(T::Flags)&RowMajorBit), internal::true_type, internal::false_type> {}; + typedef typename Product::Scalar Scalar; + + // TODO it would be nice to be able to exploit our *_assign_op functors for that purpose + struct set { template EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() = src; } }; + struct add { template EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() += src; } }; + struct sub { template EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() -= src; } }; + struct adds { + Scalar m_scale; + explicit adds(const Scalar& s) : m_scale(s) {} + template void EIGEN_DEVICE_FUNC operator()(const Dst& dst, const Src& src) const { + dst.const_cast_derived() += m_scale * src; + } + }; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, set(), is_row_major()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, add(), is_row_major()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, sub(), is_row_major()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + internal::outer_product_selector_run(dst, lhs, rhs, adds(alpha), is_row_major()); + } + +}; + + +// This base class provides default implementations for evalTo, addTo, subTo, in terms of scaleAndAddTo +template +struct generic_product_impl_base +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { dst.setZero(); scaleAndAddTo(dst, lhs, rhs, Scalar(1)); } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { scaleAndAddTo(dst,lhs, rhs, Scalar(1)); } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { scaleAndAddTo(dst, lhs, rhs, Scalar(-1)); } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { Derived::scaleAndAddTo(dst,lhs,rhs,alpha); } + +}; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename nested_eval::type LhsNested; + typedef typename nested_eval::type RhsNested; + typedef typename Product::Scalar Scalar; + enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight }; + typedef internal::remove_all_t> MatrixType; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + // Fallback to inner product if both the lhs and rhs is a runtime vector. + if (lhs.rows() == 1 && rhs.cols() == 1) { + dst.coeffRef(0,0) += alpha * lhs.row(0).conjugate().dot(rhs.col(0)); + return; + } + LhsNested actual_lhs(lhs); + RhsNested actual_rhs(rhs); + internal::gemv_dense_selector::HasUsableDirectAccess) + >::run(actual_lhs, actual_rhs, dst, alpha); + } +}; + +template +struct generic_product_impl +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // Same as: dst.noalias() = lhs.lazyProduct(rhs); + // but easier on the compiler side + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::assign_op()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // dst.noalias() += lhs.lazyProduct(rhs); + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::add_assign_op()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // dst.noalias() -= lhs.lazyProduct(rhs); + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::sub_assign_op()); + } + + // This is a special evaluation path called from generic_product_impl<...,GemmProduct> in file GeneralMatrixMatrix.h + // This variant tries to extract scalar multiples from both the LHS and RHS and factor them out. For instance: + // dst {,+,-}= (s1*A)*(B*s2) + // will be rewritten as: + // dst {,+,-}= (s1*s2) * (A.lazyProduct(B)) + // There are at least four benefits of doing so: + // 1 - huge performance gain for heap-allocated matrix types as it save costly allocations. + // 2 - it is faster than simply by-passing the heap allocation through stack allocation. + // 3 - it makes this fallback consistent with the heavy GEMM routine. + // 4 - it fully by-passes huge stack allocation attempts when multiplying huge fixed-size matrices. + // (see https://stackoverflow.com/questions/54738495) + // For small fixed sizes matrices, however, the gains are less obvious, it is sometimes x2 faster, but sometimes x3 slower, + // and the behavior depends also a lot on the compiler... This is why this re-writing strategy is currently + // enabled only when falling back from the main GEMM. + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void eval_dynamic(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func &func) + { + enum { + HasScalarFactor = blas_traits::HasScalarFactor || blas_traits::HasScalarFactor, + ConjLhs = blas_traits::NeedToConjugate, + ConjRhs = blas_traits::NeedToConjugate + }; + // FIXME: in c++11 this should be auto, and extractScalarFactor should also return auto + // this is important for real*complex_mat + Scalar actualAlpha = combine_scalar_factors(lhs, rhs); + + eval_dynamic_impl(dst, + blas_traits::extract(lhs).template conjugateIf(), + blas_traits::extract(rhs).template conjugateIf(), + func, + actualAlpha, + std::conditional_t()); + } + +protected: + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func &func, const Scalar& s /* == 1 */, false_type) + { + EIGEN_UNUSED_VARIABLE(s); + eigen_internal_assert(numext::is_exactly_one(s)); + call_restricted_packet_assignment_no_alias(dst, lhs.lazyProduct(rhs), func); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func &func, const Scalar& s, true_type) + { + call_restricted_packet_assignment_no_alias(dst, s * lhs.lazyProduct(rhs), func); + } +}; + +// This specialization enforces the use of a coefficient-based evaluation strategy +template +struct generic_product_impl + : generic_product_impl {}; + +// Case 2: Evaluate coeff by coeff +// +// This is mostly taken from CoeffBasedProduct.h +// The main difference is that we add an extra argument to the etor_product_*_impl::run() function +// for the inner dimension of the product, because evaluator object do not know their size. + +template +struct etor_product_coeff_impl; + +template +struct etor_product_packet_impl; + +template +struct product_evaluator, ProductTag, DenseShape, DenseShape> + : evaluator_base > +{ + typedef Product XprType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : m_lhs(xpr.lhs()), + m_rhs(xpr.rhs()), + m_lhsImpl(m_lhs), // FIXME the creation of the evaluator objects should result in a no-op, but check that! + m_rhsImpl(m_rhs), // Moreover, they are only useful for the packet path, so we could completely disable them when not needed, + // or perhaps declare them on the fly on the packet method... We have experiment to check what's best. + m_innerDim(xpr.lhs().cols()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::MulCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::AddCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); +#if 0 + std::cerr << "LhsOuterStrideBytes= " << LhsOuterStrideBytes << "\n"; + std::cerr << "RhsOuterStrideBytes= " << RhsOuterStrideBytes << "\n"; + std::cerr << "LhsAlignment= " << LhsAlignment << "\n"; + std::cerr << "RhsAlignment= " << RhsAlignment << "\n"; + std::cerr << "CanVectorizeLhs= " << CanVectorizeLhs << "\n"; + std::cerr << "CanVectorizeRhs= " << CanVectorizeRhs << "\n"; + std::cerr << "CanVectorizeInner= " << CanVectorizeInner << "\n"; + std::cerr << "EvalToRowMajor= " << EvalToRowMajor << "\n"; + std::cerr << "Alignment= " << Alignment << "\n"; + std::cerr << "Flags= " << Flags << "\n"; +#endif + } + + // Everything below here is taken from CoeffBasedProduct.h + + typedef typename internal::nested_eval::type LhsNested; + typedef typename internal::nested_eval::type RhsNested; + + typedef internal::remove_all_t LhsNestedCleaned; + typedef internal::remove_all_t RhsNestedCleaned; + + typedef evaluator LhsEtorType; + typedef evaluator RhsEtorType; + + enum { + RowsAtCompileTime = LhsNestedCleaned::RowsAtCompileTime, + ColsAtCompileTime = RhsNestedCleaned::ColsAtCompileTime, + InnerSize = min_size_prefer_fixed(LhsNestedCleaned::ColsAtCompileTime, RhsNestedCleaned::RowsAtCompileTime), + MaxRowsAtCompileTime = LhsNestedCleaned::MaxRowsAtCompileTime, + MaxColsAtCompileTime = RhsNestedCleaned::MaxColsAtCompileTime + }; + + typedef typename find_best_packet::type LhsVecPacketType; + typedef typename find_best_packet::type RhsVecPacketType; + + enum { + + LhsCoeffReadCost = LhsEtorType::CoeffReadCost, + RhsCoeffReadCost = RhsEtorType::CoeffReadCost, + CoeffReadCost = InnerSize==0 ? NumTraits::ReadCost + : InnerSize == Dynamic ? HugeCost + : InnerSize * (NumTraits::MulCost + int(LhsCoeffReadCost) + int(RhsCoeffReadCost)) + + (InnerSize - 1) * NumTraits::AddCost, + + Unroll = CoeffReadCost <= EIGEN_UNROLLING_LIMIT, + + LhsFlags = LhsEtorType::Flags, + RhsFlags = RhsEtorType::Flags, + + LhsRowMajor = LhsFlags & RowMajorBit, + RhsRowMajor = RhsFlags & RowMajorBit, + + LhsVecPacketSize = unpacket_traits::size, + RhsVecPacketSize = unpacket_traits::size, + + // Here, we don't care about alignment larger than the usable packet size. + LhsAlignment = plain_enum_min(LhsEtorType::Alignment, LhsVecPacketSize*int(sizeof(typename LhsNestedCleaned::Scalar))), + RhsAlignment = plain_enum_min(RhsEtorType::Alignment, RhsVecPacketSize*int(sizeof(typename RhsNestedCleaned::Scalar))), + + SameType = is_same::value, + + CanVectorizeRhs = bool(RhsRowMajor) && (RhsFlags & PacketAccessBit) && (ColsAtCompileTime!=1), + CanVectorizeLhs = (!LhsRowMajor) && (LhsFlags & PacketAccessBit) && (RowsAtCompileTime!=1), + + EvalToRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 + : (bool(RhsRowMajor) && !CanVectorizeLhs), + + Flags = ((int(LhsFlags) | int(RhsFlags)) & HereditaryBits & ~RowMajorBit) + | (EvalToRowMajor ? RowMajorBit : 0) + // TODO enable vectorization for mixed types + | (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? PacketAccessBit : 0) + | (XprType::IsVectorAtCompileTime ? LinearAccessBit : 0), + + LhsOuterStrideBytes = int(LhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename LhsNestedCleaned::Scalar)), + RhsOuterStrideBytes = int(RhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename RhsNestedCleaned::Scalar)), + + Alignment = bool(CanVectorizeLhs) ? (LhsOuterStrideBytes<=0 || (int(LhsOuterStrideBytes) % plain_enum_max(1, LhsAlignment))!=0 ? 0 : LhsAlignment) + : bool(CanVectorizeRhs) ? (RhsOuterStrideBytes<=0 || (int(RhsOuterStrideBytes) % plain_enum_max(1, RhsAlignment))!=0 ? 0 : RhsAlignment) + : 0, + + /* CanVectorizeInner deserves special explanation. It does not affect the product flags. It is not used outside + * of Product. If the Product itself is not a packet-access expression, there is still a chance that the inner + * loop of the product might be vectorized. This is the meaning of CanVectorizeInner. Since it doesn't affect + * the Flags, it is safe to make this value depend on ActualPacketAccessBit, that doesn't affect the ABI. + */ + CanVectorizeInner = SameType + && LhsRowMajor + && (!RhsRowMajor) + && (int(LhsFlags) & int(RhsFlags) & ActualPacketAccessBit) + && (int(InnerSize) % packet_traits::size == 0) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const + { + return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum(); + } + + /* Allow index-based non-packet access. It is impossible though to allow index-based packed access, + * which is why we don't set the LinearAccessBit. + * TODO: this seems possible when the result is a vector + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const CoeffReturnType coeff(Index index) const + { + const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? 0 : index; + const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? index : 0; + return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum(); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const PacketType packet(Index row, Index col) const + { + PacketType res; + typedef etor_product_packet_impl PacketImpl; + PacketImpl::run(row, col, m_lhsImpl, m_rhsImpl, m_innerDim, res); + return res; + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const PacketType packet(Index index) const + { + const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? 0 : index; + const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? index : 0; + return packet(row,col); + } + +protected: + add_const_on_value_type_t m_lhs; + add_const_on_value_type_t m_rhs; + + LhsEtorType m_lhsImpl; + RhsEtorType m_rhsImpl; + + // TODO: Get rid of m_innerDim if known at compile time + Index m_innerDim; +}; + +template +struct product_evaluator, LazyCoeffBasedProductMode, DenseShape, DenseShape> + : product_evaluator, CoeffBasedProductMode, DenseShape, DenseShape> +{ + typedef Product XprType; + typedef Product BaseProduct; + typedef product_evaluator Base; + enum { + Flags = Base::Flags | EvalBeforeNestingBit + }; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : Base(BaseProduct(xpr.lhs(),xpr.rhs())) + {} +}; + +/**************************************** +*** Coeff based product, Packet path *** +****************************************/ + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res) + { + etor_product_packet_impl::run(row, col, lhs, rhs, innerDim, res); + res = pmadd(pset1(lhs.coeff(row, Index(UnrollingIndex-1))), rhs.template packet(Index(UnrollingIndex-1), col), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res) + { + etor_product_packet_impl::run(row, col, lhs, rhs, innerDim, res); + res = pmadd(lhs.template packet(row, Index(UnrollingIndex-1)), pset1(rhs.coeff(Index(UnrollingIndex-1), col)), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res) + { + res = pmul(pset1(lhs.coeff(row, Index(0))),rhs.template packet(Index(0), col)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res) + { + res = pmul(lhs.template packet(row, Index(0)), pset1(rhs.coeff(Index(0), col))); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Index /*innerDim*/, Packet &res) + { + res = pset1(typename unpacket_traits::type(0)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Index /*innerDim*/, Packet &res) + { + res = pset1(typename unpacket_traits::type(0)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res) + { + res = pset1(typename unpacket_traits::type(0)); + for(Index i = 0; i < innerDim; ++i) + res = pmadd(pset1(lhs.coeff(row, i)), rhs.template packet(i, col), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res) + { + res = pset1(typename unpacket_traits::type(0)); + for(Index i = 0; i < innerDim; ++i) + res = pmadd(lhs.template packet(row, i), pset1(rhs.coeff(i, col)), res); + } +}; + + +/*************************************************************************** +* Triangular products +***************************************************************************/ +template +struct triangular_product_impl; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + triangular_product_impl + ::run(dst, lhs.nestedExpression(), rhs, alpha); + } +}; + +template +struct generic_product_impl +: generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + triangular_product_impl::run(dst, lhs, rhs.nestedExpression(), alpha); + } +}; + + +/*************************************************************************** +* SelfAdjoint products +***************************************************************************/ +template +struct selfadjoint_product_impl; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_DEVICE_FUNC + void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + selfadjoint_product_impl::run(dst, lhs.nestedExpression(), rhs, alpha); + } +}; + +template +struct generic_product_impl +: generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + selfadjoint_product_impl::run(dst, lhs, rhs.nestedExpression(), alpha); + } +}; + + +/*************************************************************************** +* Diagonal products +***************************************************************************/ + +template +struct diagonal_product_evaluator_base + : evaluator_base +{ + typedef typename ScalarBinaryOpTraits::ReturnType Scalar; +public: + enum { + CoeffReadCost = int(NumTraits::MulCost) + int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost), + + MatrixFlags = evaluator::Flags, + DiagFlags = evaluator::Flags, + + StorageOrder_ = (Derived::MaxRowsAtCompileTime==1 && Derived::MaxColsAtCompileTime!=1) ? RowMajor + : (Derived::MaxColsAtCompileTime==1 && Derived::MaxRowsAtCompileTime!=1) ? ColMajor + : MatrixFlags & RowMajorBit ? RowMajor : ColMajor, + SameStorageOrder_ = StorageOrder_ == (MatrixFlags & RowMajorBit ? RowMajor : ColMajor), + + ScalarAccessOnDiag_ = !((int(StorageOrder_) == ColMajor && int(ProductOrder) == OnTheLeft) + ||(int(StorageOrder_) == RowMajor && int(ProductOrder) == OnTheRight)), + SameTypes_ = is_same::value, + // FIXME currently we need same types, but in the future the next rule should be the one + //Vectorizable_ = bool(int(MatrixFlags)&PacketAccessBit) && ((!_PacketOnDiag) || (SameTypes_ && bool(int(DiagFlags)&PacketAccessBit))), + Vectorizable_ = bool(int(MatrixFlags)&PacketAccessBit) + && SameTypes_ + && (SameStorageOrder_ || (MatrixFlags&LinearAccessBit)==LinearAccessBit) + && (ScalarAccessOnDiag_ || (bool(int(DiagFlags)&PacketAccessBit))), + LinearAccessMask_ = (MatrixType::RowsAtCompileTime==1 || MatrixType::ColsAtCompileTime==1) ? LinearAccessBit : 0, + Flags = ((HereditaryBits|LinearAccessMask_) & (unsigned int)(MatrixFlags)) | (Vectorizable_ ? PacketAccessBit : 0), + Alignment = evaluator::Alignment, + + AsScalarProduct = (DiagonalType::SizeAtCompileTime==1) + || (DiagonalType::SizeAtCompileTime==Dynamic && MatrixType::RowsAtCompileTime==1 && ProductOrder==OnTheLeft) + || (DiagonalType::SizeAtCompileTime==Dynamic && MatrixType::ColsAtCompileTime==1 && ProductOrder==OnTheRight) + }; + + EIGEN_DEVICE_FUNC diagonal_product_evaluator_base(const MatrixType &mat, const DiagonalType &diag) + : m_diagImpl(diag), m_matImpl(mat) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::MulCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const + { + if(AsScalarProduct) + return m_diagImpl.coeff(0) * m_matImpl.coeff(idx); + else + return m_diagImpl.coeff(idx) * m_matImpl.coeff(idx); + } + +protected: + template + EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::true_type) const + { + return internal::pmul(m_matImpl.template packet(row, col), + internal::pset1(m_diagImpl.coeff(id))); + } + + template + EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::false_type) const + { + enum { + InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime, + DiagonalPacketLoadMode = plain_enum_min(LoadMode,((InnerSize%16) == 0) ? int(Aligned16) : int(evaluator::Alignment)) // FIXME hardcoded 16!! + }; + return internal::pmul(m_matImpl.template packet(row, col), + m_diagImpl.template packet(id)); + } + + evaluator m_diagImpl; + evaluator m_matImpl; +}; + +// diagonal * dense +template +struct product_evaluator, ProductTag, DiagonalShape, DenseShape> + : diagonal_product_evaluator_base, OnTheLeft> +{ + typedef diagonal_product_evaluator_base, OnTheLeft> Base; + using Base::m_diagImpl; + using Base::m_matImpl; + using Base::coeff; + typedef typename Base::Scalar Scalar; + + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + typedef typename Lhs::DiagonalVectorType DiagonalType; + + + enum { StorageOrder = Base::StorageOrder_ }; + + EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) + : Base(xpr.rhs(), xpr.lhs().diagonal()) + { + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + { + return m_diagImpl.coeff(row) * m_matImpl.coeff(row, col); + } + +#ifndef EIGEN_GPUCC + template + EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const + { + // FIXME: NVCC used to complain about the template keyword, but we have to check whether this is still the case. + // See also similar calls below. + return this->template packet_impl(row,col, row, + std::conditional_t()); + } + + template + EIGEN_STRONG_INLINE PacketType packet(Index idx) const + { + return packet(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); + } +#endif +}; + +// dense * diagonal +template +struct product_evaluator, ProductTag, DenseShape, DiagonalShape> + : diagonal_product_evaluator_base, OnTheRight> +{ + typedef diagonal_product_evaluator_base, OnTheRight> Base; + using Base::m_diagImpl; + using Base::m_matImpl; + using Base::coeff; + typedef typename Base::Scalar Scalar; + + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + + enum { StorageOrder = Base::StorageOrder_ }; + + EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) + : Base(xpr.lhs(), xpr.rhs().diagonal()) + { + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + { + return m_matImpl.coeff(row, col) * m_diagImpl.coeff(col); + } + +#ifndef EIGEN_GPUCC + template + EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const + { + return this->template packet_impl(row,col, col, + std::conditional_t()); + } + + template + EIGEN_STRONG_INLINE PacketType packet(Index idx) const + { + return packet(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); + } +#endif +}; + +/*************************************************************************** +* Products with permutation matrices +***************************************************************************/ + +/** \internal + * \class permutation_matrix_product + * Internal helper class implementing the product between a permutation matrix and a matrix. + * This class is specialized for DenseShape below and for SparseShape in SparseCore/SparsePermutation.h + */ +template +struct permutation_matrix_product; + +template +struct permutation_matrix_product +{ + typedef typename nested_eval::type MatrixType; + typedef remove_all_t MatrixTypeCleaned; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const PermutationType& perm, const ExpressionType& xpr) + { + MatrixType mat(xpr); + const Index n = Side==OnTheLeft ? mat.rows() : mat.cols(); + // FIXME we need an is_same for expression that is not sensitive to constness. For instance + // is_same_xpr, Block >::value should be true. + //if(is_same::value && extract_data(dst) == extract_data(mat)) + if(is_same_dense(dst, mat)) + { + // apply the permutation inplace + Matrix mask(perm.size()); + mask.fill(false); + Index r = 0; + while(r < perm.size()) + { + // search for the next seed + while(r=perm.size()) + break; + // we got one, let's follow it until we are back to the seed + Index k0 = r++; + Index kPrev = k0; + mask.coeffRef(k0) = true; + for(Index k=perm.indices().coeff(k0); k!=k0; k=perm.indices().coeff(k)) + { + Block(dst, k) + .swap(Block + (dst,((Side==OnTheLeft) ^ Transposed) ? k0 : kPrev)); + + mask.coeffRef(k) = true; + kPrev = k; + } + } + } + else + { + for(Index i = 0; i < n; ++i) + { + Block + (dst, ((Side==OnTheLeft) ^ Transposed) ? perm.indices().coeff(i) : i) + + = + + Block + (mat, ((Side==OnTheRight) ^ Transposed) ? perm.indices().coeff(i) : i); + } + } + } +}; + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, lhs, rhs); + } +}; + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, rhs, lhs); + } +}; + +template +struct generic_product_impl, Rhs, PermutationShape, MatrixShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Inverse& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, lhs.nestedExpression(), rhs); + } +}; + +template +struct generic_product_impl, MatrixShape, PermutationShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Inverse& rhs) + { + permutation_matrix_product::run(dst, rhs.nestedExpression(), lhs); + } +}; + + +/*************************************************************************** +* Products with transpositions matrices +***************************************************************************/ + +// FIXME could we unify Transpositions and Permutation into a single "shape"?? + +/** \internal + * \class transposition_matrix_product + * Internal helper class implementing the product between a permutation matrix and a matrix. + */ +template +struct transposition_matrix_product +{ + typedef typename nested_eval::type MatrixType; + typedef remove_all_t MatrixTypeCleaned; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const TranspositionType& tr, const ExpressionType& xpr) + { + MatrixType mat(xpr); + typedef typename TranspositionType::StorageIndex StorageIndex; + const Index size = tr.size(); + StorageIndex j = 0; + + if(!is_same_dense(dst,mat)) + dst = mat; + + for(Index k=(Transposed?size-1:0) ; Transposed?k>=0:k +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, lhs, rhs); + } +}; + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, rhs, lhs); + } +}; + + +template +struct generic_product_impl, Rhs, TranspositionsShape, MatrixShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Transpose& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, lhs.nestedExpression(), rhs); + } +}; + +template +struct generic_product_impl, MatrixShape, TranspositionsShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Transpose& rhs) + { + transposition_matrix_product::run(dst, rhs.nestedExpression(), lhs); + } +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_PRODUCT_EVALUATORS_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Random.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Random.h index b7d9010..fab6889 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Random.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Random.h @@ -3,34 +3,21 @@ // // Copyright (C) 2008 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_RANDOM_H #define EIGEN_RANDOM_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { template struct scalar_random_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_random_op) - template - inline const Scalar operator() (Index, Index = 0) const { return random(); } + inline const Scalar operator() () const { return random(); } }; template @@ -41,12 +28,18 @@ struct functor_traits > /** \returns a random matrix expression * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * * The parameters \a rows and \a cols are the number of rows and of columns of * the returned matrix. Must be compatible with this MatrixBase type. * + * \not_reentrant + * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, * it is redundant to pass \a rows and \a cols as arguments, so Random() should be used * instead. + * * * Example: \include MatrixBase_random_int_int.cpp * Output: \verbinclude MatrixBase_random_int_int.out @@ -54,22 +47,28 @@ struct functor_traits > * This expression has the "evaluate before nesting" flag so that it will be evaluated into * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected * behavior with expressions involving random matrices. + * + * See DenseBase::NullaryExpr(Index, const CustomNullaryOp&) for an example using C++11 random generators. * - * \sa MatrixBase::setRandom(), MatrixBase::Random(Index), MatrixBase::Random() + * \sa DenseBase::setRandom(), DenseBase::Random(Index), DenseBase::Random() */ template -inline const CwiseNullaryOp::Scalar>, Derived> +inline const typename DenseBase::RandomReturnType DenseBase::Random(Index rows, Index cols) { return NullaryExpr(rows, cols, internal::scalar_random_op()); } /** \returns a random vector expression + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. * * The parameter \a size is the size of the returned vector. * Must be compatible with this MatrixBase type. * * \only_for_vectors + * \not_reentrant * * This variant is meant to be used for dynamic-size vector types. For fixed-size types, * it is redundant to pass \a size as argument, so Random() should be used @@ -82,10 +81,10 @@ DenseBase::Random(Index rows, Index cols) * a temporary vector whenever it is nested in a larger expression. This prevents unexpected * behavior with expressions involving random matrices. * - * \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random() + * \sa DenseBase::setRandom(), DenseBase::Random(Index,Index), DenseBase::Random() */ template -inline const CwiseNullaryOp::Scalar>, Derived> +inline const typename DenseBase::RandomReturnType DenseBase::Random(Index size) { return NullaryExpr(size, internal::scalar_random_op()); @@ -93,6 +92,9 @@ DenseBase::Random(Index size) /** \returns a fixed-size random matrix or vector expression * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you * need to use the variants taking size arguments. * @@ -102,11 +104,13 @@ DenseBase::Random(Index size) * This expression has the "evaluate before nesting" flag so that it will be evaluated into * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected * behavior with expressions involving random matrices. + * + * \not_reentrant * - * \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random(Index) + * \sa DenseBase::setRandom(), DenseBase::Random(Index,Index), DenseBase::Random(Index) */ template -inline const CwiseNullaryOp::Scalar>, Derived> +inline const typename DenseBase::RandomReturnType DenseBase::Random() { return NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_random_op()); @@ -114,43 +118,57 @@ DenseBase::Random() /** Sets all coefficients in this expression to random values. * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * * Example: \include MatrixBase_setRandom.cpp * Output: \verbinclude MatrixBase_setRandom.out * * \sa class CwiseNullaryOp, setRandom(Index), setRandom(Index,Index) */ template -inline Derived& DenseBase::setRandom() +EIGEN_DEVICE_FUNC inline Derived& DenseBase::setRandom() { return *this = Random(rows(), cols()); } -/** Resizes to the given \a size, and sets all coefficients in this expression to random values. +/** Resizes to the given \a newSize, and sets all coefficients in this expression to random values. * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * * \only_for_vectors + * \not_reentrant * * Example: \include Matrix_setRandom_int.cpp * Output: \verbinclude Matrix_setRandom_int.out * - * \sa MatrixBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, MatrixBase::Random() + * \sa DenseBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, DenseBase::Random() */ template EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setRandom(Index size) +PlainObjectBase::setRandom(Index newSize) { - resize(size); + resize(newSize); return setRandom(); } /** Resizes to the given size, and sets all coefficients in this expression to random values. * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * * \param rows the new number of rows * \param cols the new number of columns * * Example: \include Matrix_setRandom_int_int.cpp * Output: \verbinclude Matrix_setRandom_int_int.out * - * \sa MatrixBase::setRandom(), setRandom(Index), class CwiseNullaryOp, MatrixBase::Random() + * \sa DenseBase::setRandom(), setRandom(Index), class CwiseNullaryOp, DenseBase::Random() */ template EIGEN_STRONG_INLINE Derived& @@ -160,4 +178,42 @@ PlainObjectBase::setRandom(Index rows, Index cols) return setRandom(); } +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to random values. For the parameter of type + * NoChange_t, just pass the special value \c NoChange. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \sa DenseBase::setRandom(), setRandom(Index), setRandom(Index, NoChange_t), class CwiseNullaryOp, DenseBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(NoChange_t, Index cols) +{ + return setRandom(rows(), cols); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to random values. For the parameter of type + * NoChange_t, just pass the special value \c NoChange. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \sa DenseBase::setRandom(), setRandom(Index), setRandom(NoChange_t, Index), class CwiseNullaryOp, DenseBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(Index rows, NoChange_t) +{ + return setRandom(rows, cols()); +} + +} // end namespace Eigen + #endif // EIGEN_RANDOM_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Redux.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Redux.h index f9f5a95..d3efad9 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Redux.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Redux.h @@ -4,28 +4,17 @@ // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_REDUX_H #define EIGEN_REDUX_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + namespace internal { // TODO @@ -36,22 +25,29 @@ namespace internal { * Part 1 : the logic deciding a strategy for vectorization and unrolling ***************************************************************************/ -template +template struct redux_traits { public: + typedef typename find_best_packet::type PacketType; enum { - PacketSize = packet_traits::size, - InnerMaxSize = int(Derived::IsRowMajor) - ? Derived::MaxColsAtCompileTime - : Derived::MaxRowsAtCompileTime + PacketSize = unpacket_traits::size, + InnerMaxSize = int(Evaluator::IsRowMajor) + ? Evaluator::MaxColsAtCompileTime + : Evaluator::MaxRowsAtCompileTime, + OuterMaxSize = int(Evaluator::IsRowMajor) + ? Evaluator::MaxRowsAtCompileTime + : Evaluator::MaxColsAtCompileTime, + SliceVectorizedWork = int(InnerMaxSize)==Dynamic ? Dynamic + : int(OuterMaxSize)==Dynamic ? (int(InnerMaxSize)>=int(PacketSize) ? Dynamic : 0) + : (int(InnerMaxSize)/int(PacketSize)) * int(OuterMaxSize) }; enum { - MightVectorize = (int(Derived::Flags)&ActualPacketAccessBit) + MightVectorize = (int(Evaluator::Flags)&ActualPacketAccessBit) && (functor_traits::PacketAccess), - MayLinearVectorize = MightVectorize && (int(Derived::Flags)&LinearAccessBit), - MaySliceVectorize = MightVectorize && int(InnerMaxSize)>=3*PacketSize + MayLinearVectorize = bool(MightVectorize) && (int(Evaluator::Flags)&LinearAccessBit), + MaySliceVectorize = bool(MightVectorize) && (int(SliceVectorizedWork)==Dynamic || int(SliceVectorizedWork)>=3) }; public: @@ -63,21 +59,36 @@ struct redux_traits public: enum { - Cost = ( Derived::SizeAtCompileTime == Dynamic - || Derived::CoeffReadCost == Dynamic - || (Derived::SizeAtCompileTime!=1 && functor_traits::Cost == Dynamic) - ) ? Dynamic - : Derived::SizeAtCompileTime * Derived::CoeffReadCost - + (Derived::SizeAtCompileTime-1) * functor_traits::Cost, + Cost = Evaluator::SizeAtCompileTime == Dynamic ? HugeCost + : int(Evaluator::SizeAtCompileTime) * int(Evaluator::CoeffReadCost) + (Evaluator::SizeAtCompileTime-1) * functor_traits::Cost, UnrollingLimit = EIGEN_UNROLLING_LIMIT * (int(Traversal) == int(DefaultTraversal) ? 1 : int(PacketSize)) }; public: enum { - Unrolling = Cost != Dynamic && Cost <= UnrollingLimit - ? CompleteUnrolling - : NoUnrolling + Unrolling = Cost <= UnrollingLimit ? CompleteUnrolling : NoUnrolling }; + +#ifdef EIGEN_DEBUG_ASSIGN + static void debug() + { + std::cerr << "Xpr: " << typeid(typename Evaluator::XprType).name() << std::endl; + std::cerr.setf(std::ios::hex, std::ios::basefield); + EIGEN_DEBUG_VAR(Evaluator::Flags) + std::cerr.unsetf(std::ios::hex); + EIGEN_DEBUG_VAR(InnerMaxSize) + EIGEN_DEBUG_VAR(OuterMaxSize) + EIGEN_DEBUG_VAR(SliceVectorizedWork) + EIGEN_DEBUG_VAR(PacketSize) + EIGEN_DEBUG_VAR(MightVectorize) + EIGEN_DEBUG_VAR(MayLinearVectorize) + EIGEN_DEBUG_VAR(MaySliceVectorize) + std::cerr << "Traversal" << " = " << Traversal << " (" << demangle_traversal(Traversal) << ")" << std::endl; + EIGEN_DEBUG_VAR(UnrollingLimit) + std::cerr << "Unrolling" << " = " << Unrolling << " (" << demangle_unrolling(Unrolling) << ")" << std::endl; + std::cerr << std::endl; + } +#endif }; /*************************************************************************** @@ -86,85 +97,86 @@ struct redux_traits /*** no vectorization ***/ -template +template struct redux_novec_unroller { enum { HalfLength = Length/2 }; - typedef typename Derived::Scalar Scalar; + typedef typename Evaluator::Scalar Scalar; - EIGEN_STRONG_INLINE static Scalar run(const Derived &mat, const Func& func) + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func& func) { - return func(redux_novec_unroller::run(mat,func), - redux_novec_unroller::run(mat,func)); + return func(redux_novec_unroller::run(eval,func), + redux_novec_unroller::run(eval,func)); } }; -template -struct redux_novec_unroller +template +struct redux_novec_unroller { enum { - outer = Start / Derived::InnerSizeAtCompileTime, - inner = Start % Derived::InnerSizeAtCompileTime + outer = Start / Evaluator::InnerSizeAtCompileTime, + inner = Start % Evaluator::InnerSizeAtCompileTime }; - typedef typename Derived::Scalar Scalar; + typedef typename Evaluator::Scalar Scalar; - EIGEN_STRONG_INLINE static Scalar run(const Derived &mat, const Func&) + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func&) { - return mat.coeffByOuterInner(outer, inner); + return eval.coeffByOuterInner(outer, inner); } }; // This is actually dead code and will never be called. It is required // to prevent false warnings regarding failed inlining though // for 0 length run() will never be called at all. -template -struct redux_novec_unroller +template +struct redux_novec_unroller { - typedef typename Derived::Scalar Scalar; - EIGEN_STRONG_INLINE static Scalar run(const Derived&, const Func&) { return Scalar(); } + typedef typename Evaluator::Scalar Scalar; + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Evaluator&, const Func&) { return Scalar(); } }; /*** vectorization ***/ -template +template struct redux_vec_unroller { - enum { - PacketSize = packet_traits::size, - HalfLength = Length/2 - }; - - typedef typename Derived::Scalar Scalar; - typedef typename packet_traits::type PacketScalar; - - EIGEN_STRONG_INLINE static PacketScalar run(const Derived &mat, const Func& func) + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func& func) { + enum { + PacketSize = unpacket_traits::size, + HalfLength = Length/2 + }; + return func.packetOp( - redux_vec_unroller::run(mat,func), - redux_vec_unroller::run(mat,func) ); + redux_vec_unroller::template run(eval,func), + redux_vec_unroller::template run(eval,func) ); } }; -template -struct redux_vec_unroller +template +struct redux_vec_unroller { - enum { - index = Start * packet_traits::size, - outer = index / int(Derived::InnerSizeAtCompileTime), - inner = index % int(Derived::InnerSizeAtCompileTime), - alignment = (Derived::Flags & AlignedBit) ? Aligned : Unaligned - }; - - typedef typename Derived::Scalar Scalar; - typedef typename packet_traits::type PacketScalar; - - EIGEN_STRONG_INLINE static PacketScalar run(const Derived &mat, const Func&) + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func&) { - return mat.template packetByOuterInner(outer, inner); + enum { + PacketSize = unpacket_traits::size, + index = Start * PacketSize, + outer = index / int(Evaluator::InnerSizeAtCompileTime), + inner = index % int(Evaluator::InnerSizeAtCompileTime), + alignment = Evaluator::Alignment + }; + return eval.template packetByOuterInner(outer, inner); } }; @@ -172,140 +184,211 @@ struct redux_vec_unroller * Part 3 : implementation of all cases ***************************************************************************/ -template::Traversal, - int Unrolling = redux_traits::Unrolling +template::Traversal, + int Unrolling = redux_traits::Unrolling > struct redux_impl; -template -struct redux_impl +template +struct redux_impl { - typedef typename Derived::Scalar Scalar; - typedef typename Derived::Index Index; - static EIGEN_STRONG_INLINE Scalar run(const Derived& mat, const Func& func) + typedef typename Evaluator::Scalar Scalar; + + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + Scalar run(const Evaluator &eval, const Func& func, const XprType& xpr) { - eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); + eigen_assert(xpr.rows()>0 && xpr.cols()>0 && "you are using an empty matrix"); Scalar res; - res = mat.coeffByOuterInner(0, 0); - for(Index i = 1; i < mat.innerSize(); ++i) - res = func(res, mat.coeffByOuterInner(0, i)); - for(Index i = 1; i < mat.outerSize(); ++i) - for(Index j = 0; j < mat.innerSize(); ++j) - res = func(res, mat.coeffByOuterInner(i, j)); + res = eval.coeffByOuterInner(0, 0); + for(Index i = 1; i < xpr.innerSize(); ++i) + res = func(res, eval.coeffByOuterInner(0, i)); + for(Index i = 1; i < xpr.outerSize(); ++i) + for(Index j = 0; j < xpr.innerSize(); ++j) + res = func(res, eval.coeffByOuterInner(i, j)); return res; } }; -template -struct redux_impl - : public redux_novec_unroller -{}; +template +struct redux_impl + : redux_novec_unroller +{ + typedef redux_novec_unroller Base; + typedef typename Evaluator::Scalar Scalar; + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + Scalar run(const Evaluator &eval, const Func& func, const XprType& /*xpr*/) + { + return Base::run(eval,func); + } +}; -template -struct redux_impl +template +struct redux_impl { - typedef typename Derived::Scalar Scalar; - typedef typename packet_traits::type PacketScalar; - typedef typename Derived::Index Index; + typedef typename Evaluator::Scalar Scalar; + typedef typename redux_traits::PacketType PacketScalar; - static Scalar run(const Derived& mat, const Func& func) + template + static Scalar run(const Evaluator &eval, const Func& func, const XprType& xpr) { - const Index size = mat.size(); - eigen_assert(size && "you are using an empty matrix"); - const Index packetSize = packet_traits::size; - const Index alignedStart = first_aligned(mat); + const Index size = xpr.size(); + + const Index packetSize = redux_traits::PacketSize; + const int packetAlignment = unpacket_traits::alignment; enum { - alignment = bool(Derived::Flags & DirectAccessBit) || bool(Derived::Flags & AlignedBit) - ? Aligned : Unaligned + alignment0 = (bool(Evaluator::Flags & DirectAccessBit) && bool(packet_traits::AlignedOnScalar)) ? int(packetAlignment) : int(Unaligned), + alignment = plain_enum_max(alignment0, Evaluator::Alignment) }; - const Index alignedSize = ((size-alignedStart)/packetSize)*packetSize; - const Index alignedEnd = alignedStart + alignedSize; + const Index alignedStart = internal::first_default_aligned(xpr); + const Index alignedSize2 = ((size-alignedStart)/(2*packetSize))*(2*packetSize); + const Index alignedSize = ((size-alignedStart)/(packetSize))*(packetSize); + const Index alignedEnd2 = alignedStart + alignedSize2; + const Index alignedEnd = alignedStart + alignedSize; Scalar res; if(alignedSize) { - PacketScalar packet_res = mat.template packet(alignedStart); - for(Index index = alignedStart + packetSize; index < alignedEnd; index += packetSize) - packet_res = func.packetOp(packet_res, mat.template packet(index)); - res = func.predux(packet_res); + PacketScalar packet_res0 = eval.template packet(alignedStart); + if(alignedSize>packetSize) // we have at least two packets to partly unroll the loop + { + PacketScalar packet_res1 = eval.template packet(alignedStart+packetSize); + for(Index index = alignedStart + 2*packetSize; index < alignedEnd2; index += 2*packetSize) + { + packet_res0 = func.packetOp(packet_res0, eval.template packet(index)); + packet_res1 = func.packetOp(packet_res1, eval.template packet(index+packetSize)); + } + + packet_res0 = func.packetOp(packet_res0,packet_res1); + if(alignedEnd>alignedEnd2) + packet_res0 = func.packetOp(packet_res0, eval.template packet(alignedEnd2)); + } + res = func.predux(packet_res0); for(Index index = 0; index < alignedStart; ++index) - res = func(res,mat.coeff(index)); + res = func(res,eval.coeff(index)); for(Index index = alignedEnd; index < size; ++index) - res = func(res,mat.coeff(index)); + res = func(res,eval.coeff(index)); } else // too small to vectorize anything. // since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize. { - res = mat.coeff(0); + res = eval.coeff(0); for(Index index = 1; index < size; ++index) - res = func(res,mat.coeff(index)); + res = func(res,eval.coeff(index)); } return res; } }; -template -struct redux_impl +// NOTE: for SliceVectorizedTraversal we simply bypass unrolling +template +struct redux_impl { - typedef typename Derived::Scalar Scalar; - typedef typename packet_traits::type PacketScalar; - typedef typename Derived::Index Index; + typedef typename Evaluator::Scalar Scalar; + typedef typename redux_traits::PacketType PacketType; - static Scalar run(const Derived& mat, const Func& func) + template + EIGEN_DEVICE_FUNC static Scalar run(const Evaluator &eval, const Func& func, const XprType& xpr) { - eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); - const Index innerSize = mat.innerSize(); - const Index outerSize = mat.outerSize(); + eigen_assert(xpr.rows()>0 && xpr.cols()>0 && "you are using an empty matrix"); + const Index innerSize = xpr.innerSize(); + const Index outerSize = xpr.outerSize(); enum { - packetSize = packet_traits::size + packetSize = redux_traits::PacketSize }; const Index packetedInnerSize = ((innerSize)/packetSize)*packetSize; Scalar res; if(packetedInnerSize) { - PacketScalar packet_res = mat.template packet(0,0); + PacketType packet_res = eval.template packet(0,0); for(Index j=0; j(j,i)); + packet_res = func.packetOp(packet_res, eval.template packetByOuterInner(j,i)); res = func.predux(packet_res); for(Index j=0; j::run(mat, func); + res = redux_impl::run(eval, func, xpr); } return res; } }; -template -struct redux_impl +template +struct redux_impl { - typedef typename Derived::Scalar Scalar; - typedef typename packet_traits::type PacketScalar; + typedef typename Evaluator::Scalar Scalar; + + typedef typename redux_traits::PacketType PacketType; enum { - PacketSize = packet_traits::size, - Size = Derived::SizeAtCompileTime, - VectorizedSize = (Size / PacketSize) * PacketSize + PacketSize = redux_traits::PacketSize, + Size = Evaluator::SizeAtCompileTime, + VectorizedSize = (int(Size) / int(PacketSize)) * int(PacketSize) }; - EIGEN_STRONG_INLINE static Scalar run(const Derived& mat, const Func& func) + + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + Scalar run(const Evaluator &eval, const Func& func, const XprType &xpr) { - eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); - Scalar res = func.predux(redux_vec_unroller::run(mat,func)); - if (VectorizedSize != Size) - res = func(res,redux_novec_unroller::run(mat,func)); - return res; + EIGEN_ONLY_USED_FOR_DEBUG(xpr) + eigen_assert(xpr.rows()>0 && xpr.cols()>0 && "you are using an empty matrix"); + if (VectorizedSize > 0) { + Scalar res = func.predux(redux_vec_unroller::template run(eval,func)); + if (VectorizedSize != Size) + res = func(res,redux_novec_unroller::run(eval,func)); + return res; + } + else { + return redux_novec_unroller::run(eval,func); + } } }; +// evaluator adaptor +template +class redux_evaluator : public internal::evaluator +{ + typedef internal::evaluator Base; +public: + typedef XprType_ XprType; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit redux_evaluator(const XprType &xpr) : Base(xpr) {} + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + typedef typename XprType::PacketScalar PacketScalar; + + enum { + MaxRowsAtCompileTime = XprType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = XprType::MaxColsAtCompileTime, + // TODO we should not remove DirectAccessBit and rather find an elegant way to query the alignment offset at runtime from the evaluator + Flags = Base::Flags & ~DirectAccessBit, + IsRowMajor = XprType::IsRowMajor, + SizeAtCompileTime = XprType::SizeAtCompileTime, + InnerSizeAtCompileTime = XprType::InnerSizeAtCompileTime + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeffByOuterInner(Index outer, Index inner) const + { return Base::coeff(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + PacketType packetByOuterInner(Index outer, Index inner) const + { return Base::template packet(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); } + +}; + } // end namespace internal /*************************************************************************** @@ -316,49 +399,70 @@ struct redux_impl /** \returns the result of a full redux operation on the whole matrix or vector using \a func * * The template parameter \a BinaryOp is the type of the functor \a func which must be - * an associative operator. Both current STL and TR1 functor styles are handled. + * an associative operator. Both current C++98 and C++11 functor styles are handled. + * + * \warning the matrix must be not empty, otherwise an assertion is triggered. * * \sa DenseBase::sum(), DenseBase::minCoeff(), DenseBase::maxCoeff(), MatrixBase::colwise(), MatrixBase::rowwise() */ template template -EIGEN_STRONG_INLINE typename internal::result_of::Scalar)>::type +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::redux(const Func& func) const { - typedef typename internal::remove_all::type ThisNested; - return internal::redux_impl - ::run(derived(), func); + eigen_assert(this->rows()>0 && this->cols()>0 && "you are using an empty matrix"); + + typedef typename internal::redux_evaluator ThisEvaluator; + ThisEvaluator thisEval(derived()); + + // The initial expression is passed to the reducer as an additional argument instead of + // passing it as a member of redux_evaluator to help + return internal::redux_impl::run(thisEval, func, derived()); } -/** \returns the minimum of all coefficients of *this +/** \returns the minimum of all coefficients of \c *this. + * In case \c *this contains NaN, NaNPropagation determines the behavior: + * NaNPropagation == PropagateFast : undefined + * NaNPropagation == PropagateNaN : result is NaN + * NaNPropagation == PropagateNumbers : result is minimum of elements that are not NaN + * \warning the matrix must be not empty, otherwise an assertion is triggered. */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::minCoeff() const { - return this->redux(Eigen::internal::scalar_min_op()); + return derived().redux(Eigen::internal::scalar_min_op()); } -/** \returns the maximum of all coefficients of *this +/** \returns the maximum of all coefficients of \c *this. + * In case \c *this contains NaN, NaNPropagation determines the behavior: + * NaNPropagation == PropagateFast : undefined + * NaNPropagation == PropagateNaN : result is NaN + * NaNPropagation == PropagateNumbers : result is maximum of elements that are not NaN + * \warning the matrix must be not empty, otherwise an assertion is triggered. */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::maxCoeff() const { - return this->redux(Eigen::internal::scalar_max_op()); + return derived().redux(Eigen::internal::scalar_max_op()); } -/** \returns the sum of all coefficients of *this +/** \returns the sum of all coefficients of \c *this + * + * If \c *this is empty, then the value 0 is returned. * * \sa trace(), prod(), mean() */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::sum() const { if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0)) return Scalar(0); - return this->redux(Eigen::internal::scalar_sum_op()); + return derived().redux(Eigen::internal::scalar_sum_op()); } /** \returns the mean of all coefficients of *this @@ -366,10 +470,17 @@ DenseBase::sum() const * \sa trace(), prod(), sum() */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::mean() const { - return Scalar(this->redux(Eigen::internal::scalar_sum_op())) / Scalar(this->size()); +#ifdef __INTEL_COMPILER + #pragma warning push + #pragma warning ( disable : 2259 ) +#endif + return Scalar(derived().redux(Eigen::internal::scalar_sum_op())) / Scalar(this->size()); +#ifdef __INTEL_COMPILER + #pragma warning pop +#endif } /** \returns the product of all coefficients of *this @@ -380,12 +491,12 @@ DenseBase::mean() const * \sa sum(), mean(), trace() */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::prod() const { if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0)) return Scalar(1); - return this->redux(Eigen::internal::scalar_product_op()); + return derived().redux(Eigen::internal::scalar_product_op()); } /** \returns the trace of \c *this, i.e. the sum of the coefficients on the main diagonal. @@ -395,10 +506,12 @@ DenseBase::prod() const * \sa diagonal(), sum() */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar MatrixBase::trace() const { return derived().diagonal().sum(); } +} // end namespace Eigen + #endif // EIGEN_REDUX_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Ref.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Ref.h new file mode 100644 index 0000000..81de5f9 --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Ref.h @@ -0,0 +1,383 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_REF_H +#define EIGEN_REF_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +namespace internal { + +template +struct traits > + : public traits > +{ + typedef PlainObjectType_ PlainObjectType; + typedef StrideType_ StrideType; + enum { + Options = Options_, + Flags = traits >::Flags | NestByRefBit, + Alignment = traits >::Alignment + }; + + template struct match { + enum { + IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime, + HasDirectAccess = internal::has_direct_access::ret, + StorageOrderMatch = IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)), + InnerStrideMatch = int(StrideType::InnerStrideAtCompileTime)==int(Dynamic) + || int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime) + || (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1), + OuterStrideMatch = IsVectorAtCompileTime + || int(StrideType::OuterStrideAtCompileTime)==int(Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime), + // NOTE, this indirection of evaluator::Alignment is needed + // to workaround a very strange bug in MSVC related to the instantiation + // of has_*ary_operator in evaluator. + // This line is surprisingly very sensitive. For instance, simply adding parenthesis + // as "DerivedAlignment = (int(evaluator::Alignment))," will make MSVC fail... + DerivedAlignment = int(evaluator::Alignment), + AlignmentMatch = (int(traits::Alignment)==int(Unaligned)) || (DerivedAlignment >= int(Alignment)), // FIXME the first condition is not very clear, it should be replaced by the required alignment + ScalarTypeMatch = internal::is_same::value, + MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch && ScalarTypeMatch + }; + typedef std::conditional_t type; + }; + +}; + +template +struct traits > : public traits {}; + +} + +template class RefBase + : public MapBase +{ + typedef typename internal::traits::PlainObjectType PlainObjectType; + typedef typename internal::traits::StrideType StrideType; + +public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(RefBase) + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const + { + return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const + { + return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() + : IsVectorAtCompileTime ? this->size() + : int(Flags)&RowMajorBit ? this->cols() + : this->rows(); + } + + EIGEN_DEVICE_FUNC RefBase() + : Base(0,RowsAtCompileTime==Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==Dynamic?0:ColsAtCompileTime), + // Stride<> does not allow default ctor for Dynamic strides, so let' initialize it with dummy values: + m_stride(StrideType::OuterStrideAtCompileTime==Dynamic?0:StrideType::OuterStrideAtCompileTime, + StrideType::InnerStrideAtCompileTime==Dynamic?0:StrideType::InnerStrideAtCompileTime) + {} + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(RefBase) + +protected: + + typedef Stride StrideBase; + + // Resolves inner stride if default 0. + static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveInnerStride(Index inner) { + return inner == 0 ? 1 : inner; + } + + // Resolves outer stride if default 0. + static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveOuterStride(Index inner, Index outer, Index rows, Index cols, bool isVectorAtCompileTime, bool isRowMajor) { + return outer == 0 ? isVectorAtCompileTime ? inner * rows * cols : isRowMajor ? inner * cols : inner * rows : outer; + } + + // Returns true if construction is valid, false if there is a stride mismatch, + // and fails if there is a size mismatch. + template + EIGEN_DEVICE_FUNC bool construct(Expression& expr) + { + // Check matrix sizes. If this is a compile-time vector, we do allow + // implicitly transposing. + EIGEN_STATIC_ASSERT( + EIGEN_PREDICATE_SAME_MATRIX_SIZE(PlainObjectType, Expression) + // If it is a vector, the transpose sizes might match. + || ( PlainObjectType::IsVectorAtCompileTime + && ((int(PlainObjectType::RowsAtCompileTime)==Eigen::Dynamic + || int(Expression::ColsAtCompileTime)==Eigen::Dynamic + || int(PlainObjectType::RowsAtCompileTime)==int(Expression::ColsAtCompileTime)) + && (int(PlainObjectType::ColsAtCompileTime)==Eigen::Dynamic + || int(Expression::RowsAtCompileTime)==Eigen::Dynamic + || int(PlainObjectType::ColsAtCompileTime)==int(Expression::RowsAtCompileTime)))), + YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES + ) + + // Determine runtime rows and columns. + Index rows = expr.rows(); + Index cols = expr.cols(); + if(PlainObjectType::RowsAtCompileTime==1) + { + eigen_assert(expr.rows()==1 || expr.cols()==1); + rows = 1; + cols = expr.size(); + } + else if(PlainObjectType::ColsAtCompileTime==1) + { + eigen_assert(expr.rows()==1 || expr.cols()==1); + rows = expr.size(); + cols = 1; + } + // Verify that the sizes are valid. + eigen_assert( + (PlainObjectType::RowsAtCompileTime == Dynamic) || (PlainObjectType::RowsAtCompileTime == rows)); + eigen_assert( + (PlainObjectType::ColsAtCompileTime == Dynamic) || (PlainObjectType::ColsAtCompileTime == cols)); + + + // If this is a vector, we might be transposing, which means that stride should swap. + const bool transpose = PlainObjectType::IsVectorAtCompileTime && (rows != expr.rows()); + // If the storage format differs, we also need to swap the stride. + const bool row_major = ((PlainObjectType::Flags)&RowMajorBit) != 0; + const bool expr_row_major = (Expression::Flags&RowMajorBit) != 0; + const bool storage_differs = (row_major != expr_row_major); + + const bool swap_stride = (transpose != storage_differs); + + // Determine expr's actual strides, resolving any defaults if zero. + const Index expr_inner_actual = resolveInnerStride(expr.innerStride()); + const Index expr_outer_actual = resolveOuterStride(expr_inner_actual, + expr.outerStride(), + expr.rows(), + expr.cols(), + Expression::IsVectorAtCompileTime != 0, + expr_row_major); + + // If this is a column-major row vector or row-major column vector, the inner-stride + // is arbitrary, so set it to either the compile-time inner stride or 1. + const bool row_vector = (rows == 1); + const bool col_vector = (cols == 1); + const Index inner_stride = + ( (!row_major && row_vector) || (row_major && col_vector) ) ? + ( StrideType::InnerStrideAtCompileTime > 0 ? Index(StrideType::InnerStrideAtCompileTime) : 1) + : swap_stride ? expr_outer_actual : expr_inner_actual; + + // If this is a column-major column vector or row-major row vector, the outer-stride + // is arbitrary, so set it to either the compile-time outer stride or vector size. + const Index outer_stride = + ( (!row_major && col_vector) || (row_major && row_vector) ) ? + ( StrideType::OuterStrideAtCompileTime > 0 ? Index(StrideType::OuterStrideAtCompileTime) : rows * cols * inner_stride) + : swap_stride ? expr_inner_actual : expr_outer_actual; + + // Check if given inner/outer strides are compatible with compile-time strides. + const bool inner_valid = (StrideType::InnerStrideAtCompileTime == Dynamic) + || (resolveInnerStride(Index(StrideType::InnerStrideAtCompileTime)) == inner_stride); + if (!inner_valid) { + return false; + } + + const bool outer_valid = (StrideType::OuterStrideAtCompileTime == Dynamic) + || (resolveOuterStride( + inner_stride, + Index(StrideType::OuterStrideAtCompileTime), + rows, cols, PlainObjectType::IsVectorAtCompileTime != 0, + row_major) + == outer_stride); + if (!outer_valid) { + return false; + } + + internal::construct_at(this, expr.data(), rows, cols); + internal::construct_at(&m_stride, + (StrideType::OuterStrideAtCompileTime == 0) ? 0 : outer_stride, + (StrideType::InnerStrideAtCompileTime == 0) ? 0 : inner_stride ); + return true; + } + + StrideBase m_stride; +}; + +/** \class Ref + * \ingroup Core_Module + * + * \brief A matrix or vector expression mapping an existing expression + * + * \tparam PlainObjectType the equivalent matrix type of the mapped data + * \tparam Options specifies the pointer alignment in bytes. It can be: \c #Aligned128, , \c #Aligned64, \c #Aligned32, \c #Aligned16, \c #Aligned8 or \c #Unaligned. + * The default is \c #Unaligned. + * \tparam StrideType optionally specifies strides. By default, Ref implies a contiguous storage along the inner dimension (inner stride==1), + * but accepts a variable outer stride (leading dimension). + * This can be overridden by specifying strides. + * The type passed here must be a specialization of the Stride template, see examples below. + * + * This class provides a way to write non-template functions taking Eigen objects as parameters while limiting the number of copies. + * A Ref<> object can represent either a const expression or a l-value: + * \code + * // in-out argument: + * void foo1(Ref x); + * + * // read-only const argument: + * void foo2(const Ref& x); + * \endcode + * + * In the in-out case, the input argument must satisfy the constraints of the actual Ref<> type, otherwise a compilation issue will be triggered. + * By default, a Ref can reference any dense vector expression of float having a contiguous memory layout. + * Likewise, a Ref can reference any column-major dense matrix expression of float whose column's elements are contiguously stored with + * the possibility to have a constant space in-between each column, i.e. the inner stride must be equal to 1, but the outer stride (or leading dimension) + * can be greater than the number of rows. + * + * In the const case, if the input expression does not match the above requirement, then it is evaluated into a temporary before being passed to the function. + * Here are some examples: + * \code + * MatrixXf A; + * VectorXf a; + * foo1(a.head()); // OK + * foo1(A.col()); // OK + * foo1(A.row()); // Compilation error because here innerstride!=1 + * foo2(A.row()); // Compilation error because A.row() is a 1xN object while foo2 is expecting a Nx1 object + * foo2(A.row().transpose()); // The row is copied into a contiguous temporary + * foo2(2*a); // The expression is evaluated into a temporary + * foo2(A.col().segment(2,4)); // No temporary + * \endcode + * + * The range of inputs that can be referenced without temporary can be enlarged using the last two template parameters. + * Here is an example accepting an innerstride!=1: + * \code + * // in-out argument: + * void foo3(Ref > x); + * foo3(A.row()); // OK + * \endcode + * The downside here is that the function foo3 might be significantly slower than foo1 because it won't be able to exploit vectorization, and will involve more + * expensive address computations even if the input is contiguously stored in memory. To overcome this issue, one might propose to overload internally calling a + * template function, e.g.: + * \code + * // in the .h: + * void foo(const Ref& A); + * void foo(const Ref >& A); + * + * // in the .cpp: + * template void foo_impl(const TypeOfA& A) { + * ... // crazy code goes here + * } + * void foo(const Ref& A) { foo_impl(A); } + * void foo(const Ref >& A) { foo_impl(A); } + * \endcode + * + * See also the following stackoverflow questions for further references: + * - Correct usage of the Eigen::Ref<> class + * + * \sa PlainObjectBase::Map(), \ref TopicStorageOrders + */ +template class Ref + : public RefBase > +{ + private: + typedef internal::traits Traits; + template + EIGEN_DEVICE_FUNC inline Ref(const PlainObjectBase& expr, + std::enable_if_t::MatchAtCompileTime),Derived>* = 0); + public: + + typedef RefBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Ref) + + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC inline Ref(PlainObjectBase& expr, + std::enable_if_t::MatchAtCompileTime),Derived>* = 0) + { + EIGEN_STATIC_ASSERT(bool(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); + // Construction must pass since we will not create temporary storage in the non-const case. + const bool success = Base::construct(expr.derived()); + EIGEN_UNUSED_VARIABLE(success) + eigen_assert(success); + } + template + EIGEN_DEVICE_FUNC inline Ref(const DenseBase& expr, + std::enable_if_t::MatchAtCompileTime),Derived>* = 0) + #else + /** Implicit constructor from any dense expression */ + template + inline Ref(DenseBase& expr) + #endif + { + EIGEN_STATIC_ASSERT(bool(internal::is_lvalue::value), THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + EIGEN_STATIC_ASSERT(bool(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); + EIGEN_STATIC_ASSERT(!Derived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + // Construction must pass since we will not create temporary storage in the non-const case. + const bool success = Base::construct(expr.const_cast_derived()); + EIGEN_UNUSED_VARIABLE(success) + eigen_assert(success); + } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Ref) + +}; + +// this is the const ref version +template class Ref + : public RefBase > +{ + typedef internal::traits Traits; + public: + + typedef RefBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Ref) + + template + EIGEN_DEVICE_FUNC inline Ref(const DenseBase& expr, + std::enable_if_t::ScalarTypeMatch),Derived>* = 0) + { +// std::cout << match_helper::HasDirectAccess << "," << match_helper::OuterStrideMatch << "," << match_helper::InnerStrideMatch << "\n"; +// std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n"; +// std::cout << int(StrideType::InnerStrideAtCompileTime) << " - " << int(Derived::InnerStrideAtCompileTime) << "\n"; + construct(expr.derived(), typename Traits::template match::type()); + } + + EIGEN_DEVICE_FUNC inline Ref(const Ref& other) : Base(other) { + // copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy + } + + template + EIGEN_DEVICE_FUNC inline Ref(const RefBase& other) { + construct(other.derived(), typename Traits::template match::type()); + } + + protected: + + template + EIGEN_DEVICE_FUNC void construct(const Expression& expr,internal::true_type) + { + // Check if we can use the underlying expr's storage directly, otherwise call the copy version. + if (!Base::construct(expr)) { + construct(expr, internal::false_type()); + } + } + + template + EIGEN_DEVICE_FUNC void construct(const Expression& expr, internal::false_type) + { + internal::call_assignment_no_alias(m_object,expr,internal::assign_op()); + Base::construct(m_object); + } + + protected: + TPlainObjectType m_object; +}; + +} // end namespace Eigen + +#endif // EIGEN_REF_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Replicate.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Replicate.h index 4c171f8..4f91bbe 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Replicate.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Replicate.h @@ -3,42 +3,16 @@ // // Copyright (C) 2009-2010 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_REPLICATE_H #define EIGEN_REPLICATE_H -/** - * \class Replicate - * \ingroup Core_Module - * - * \brief Expression of the multiple replication of a matrix or vector - * - * \param MatrixType the type of the object we are replicating - * - * This class represents an expression of the multiple replication of a matrix or vector. - * It is the return type of DenseBase::replicate() and most of the time - * this is the only way it is used. - * - * \sa DenseBase::replicate() - */ +#include "./InternalHeaderCheck.h" + +namespace Eigen { namespace internal { template @@ -48,11 +22,8 @@ struct traits > typedef typename MatrixType::Scalar Scalar; typedef typename traits::StorageKind StorageKind; typedef typename traits::XprKind XprKind; - enum { - Factor = (RowFactor==Dynamic || ColFactor==Dynamic) ? Dynamic : RowFactor*ColFactor - }; - typedef typename nested::type MatrixTypeNested; - typedef typename remove_reference::type _MatrixTypeNested; + typedef typename ref_selector::type MatrixTypeNested; + typedef std::remove_reference_t MatrixTypeNested_; enum { RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic ? Dynamic @@ -66,70 +37,72 @@ struct traits > IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1 : MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0 : (MatrixType::Flags & RowMajorBit) ? 1 : 0, - Flags = (_MatrixTypeNested::Flags & HereditaryBits & ~RowMajorBit) | (IsRowMajor ? RowMajorBit : 0), - CoeffReadCost = _MatrixTypeNested::CoeffReadCost + + // FIXME enable DirectAccess with negative strides? + Flags = IsRowMajor ? RowMajorBit : 0 }; }; } +/** + * \class Replicate + * \ingroup Core_Module + * + * \brief Expression of the multiple replication of a matrix or vector + * + * \tparam MatrixType the type of the object we are replicating + * \tparam RowFactor number of repetitions at compile time along the vertical direction, can be Dynamic. + * \tparam ColFactor number of repetitions at compile time along the horizontal direction, can be Dynamic. + * + * This class represents an expression of the multiple replication of a matrix or vector. + * It is the return type of DenseBase::replicate() and most of the time + * this is the only way it is used. + * + * \sa DenseBase::replicate() + */ template class Replicate : public internal::dense_xpr_base< Replicate >::type { typedef typename internal::traits::MatrixTypeNested MatrixTypeNested; - typedef typename internal::traits::_MatrixTypeNested _MatrixTypeNested; + typedef typename internal::traits::MatrixTypeNested_ MatrixTypeNested_; public: typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Replicate) + typedef internal::remove_all_t NestedExpression; template + EIGEN_DEVICE_FUNC inline explicit Replicate(const OriginalMatrixType& matrix) : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) { - EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), + EIGEN_STATIC_ASSERT((internal::is_same,OriginalMatrixType>::value), THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) eigen_assert(RowFactor!=Dynamic && ColFactor!=Dynamic); } template - inline Replicate(const OriginalMatrixType& matrix, int rowFactor, int colFactor) + EIGEN_DEVICE_FUNC + inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor) : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) { - EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), + EIGEN_STATIC_ASSERT((internal::is_same,OriginalMatrixType>::value), THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); } - inline Scalar coeff(Index row, Index col) const - { - // try to avoid using modulo; this is a pure optimization strategy - const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 - : RowFactor==1 ? row - : row%m_matrix.rows(); - const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 - : ColFactor==1 ? col - : col%m_matrix.cols(); - - return m_matrix.coeff(actual_row, actual_col); - } - template - inline PacketScalar packet(Index row, Index col) const + EIGEN_DEVICE_FUNC + const MatrixTypeNested_& nestedExpression() const { - const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 - : RowFactor==1 ? row - : row%m_matrix.rows(); - const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 - : ColFactor==1 ? col - : col%m_matrix.cols(); - - return m_matrix.template packet(actual_row, actual_col); + return m_matrix; } - protected: - const MatrixTypeNested m_matrix; + MatrixTypeNested m_matrix; const internal::variable_if_dynamic m_rowFactor; const internal::variable_if_dynamic m_colFactor; }; @@ -144,27 +117,12 @@ template class Replicate */ template template -inline const Replicate +EIGEN_DEVICE_FUNC const Replicate DenseBase::replicate() const { return Replicate(derived()); } -/** - * \return an expression of the replication of \c *this - * - * Example: \include MatrixBase_replicate_int_int.cpp - * Output: \verbinclude MatrixBase_replicate_int_int.out - * - * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate - */ -template -inline const Replicate -DenseBase::replicate(Index rowFactor,Index colFactor) const -{ - return Replicate(derived(),rowFactor,colFactor); -} - /** * \return an expression of the replication of each column (or row) of \c *this * @@ -174,11 +132,13 @@ DenseBase::replicate(Index rowFactor,Index colFactor) const * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate */ template -const typename VectorwiseOp::ReplicateReturnType +EIGEN_DEVICE_FUNC const typename VectorwiseOp::ReplicateReturnType VectorwiseOp::replicate(Index factor) const { return typename VectorwiseOp::ReplicateReturnType (_expression(),Direction==Vertical?factor:1,Direction==Horizontal?factor:1); } +} // end namespace Eigen + #endif // EIGEN_REPLICATE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Reshaped.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Reshaped.h new file mode 100644 index 0000000..c90e61f --- /dev/null +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Reshaped.h @@ -0,0 +1,455 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2017 Gael Guennebaud +// Copyright (C) 2014 yoco +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_RESHAPED_H +#define EIGEN_RESHAPED_H + +#include "./InternalHeaderCheck.h" + +namespace Eigen { + +/** \class Reshaped + * \ingroup Core_Module + * + * \brief Expression of a fixed-size or dynamic-size reshape + * + * \tparam XprType the type of the expression in which we are taking a reshape + * \tparam Rows the number of rows of the reshape we are taking at compile time (optional) + * \tparam Cols the number of columns of the reshape we are taking at compile time (optional) + * \tparam Order can be ColMajor or RowMajor, default is ColMajor. + * + * This class represents an expression of either a fixed-size or dynamic-size reshape. + * It is the return type of DenseBase::reshaped(NRowsType,NColsType) and + * most of the time this is the only way it is used. + * + * If you want to directly manipulate reshaped expressions, + * for instance if you want to write a function returning such an expression, + * it is advised to use the \em auto keyword for such use cases. + * + * Here is an example illustrating the dynamic case: + * \include class_Reshaped.cpp + * Output: \verbinclude class_Reshaped.out + * + * Here is an example illustrating the fixed-size case: + * \include class_FixedReshaped.cpp + * Output: \verbinclude class_FixedReshaped.out + * + * \sa DenseBase::reshaped(NRowsType,NColsType) + */ + +namespace internal { + +template +struct traits > : traits +{ + typedef typename traits::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + enum{ + MatrixRows = traits::RowsAtCompileTime, + MatrixCols = traits::ColsAtCompileTime, + RowsAtCompileTime = Rows, + ColsAtCompileTime = Cols, + MaxRowsAtCompileTime = Rows, + MaxColsAtCompileTime = Cols, + XpxStorageOrder = ((int(traits::Flags) & RowMajorBit) == RowMajorBit) ? RowMajor : ColMajor, + ReshapedStorageOrder = (RowsAtCompileTime == 1 && ColsAtCompileTime != 1) ? RowMajor + : (ColsAtCompileTime == 1 && RowsAtCompileTime != 1) ? ColMajor + : XpxStorageOrder, + HasSameStorageOrderAsXprType = (ReshapedStorageOrder == XpxStorageOrder), + InnerSize = (ReshapedStorageOrder==int(RowMajor)) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + InnerStrideAtCompileTime = HasSameStorageOrderAsXprType + ? int(inner_stride_at_compile_time::ret) + : Dynamic, + OuterStrideAtCompileTime = Dynamic, + + HasDirectAccess = internal::has_direct_access::ret + && (Order==int(XpxStorageOrder)) + && ((evaluator::Flags&LinearAccessBit)==LinearAccessBit), + + MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits::size) == 0) + && (InnerStrideAtCompileTime == 1) + ? PacketAccessBit : 0, + //MaskAlignedBit = ((OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0, + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0, + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + FlagsRowMajorBit = (ReshapedStorageOrder==int(RowMajor)) ? RowMajorBit : 0, + FlagsDirectAccessBit = HasDirectAccess ? DirectAccessBit : 0, + Flags0 = traits::Flags & ( (HereditaryBits & ~RowMajorBit) | MaskPacketAccessBit), + + Flags = (Flags0 | FlagsLinearAccessBit | FlagsLvalueBit | FlagsRowMajorBit | FlagsDirectAccessBit) + }; +}; + +template class ReshapedImpl_dense; + +} // end namespace internal + +template class ReshapedImpl; + +template class Reshaped + : public ReshapedImpl::StorageKind> +{ + typedef ReshapedImpl::StorageKind> Impl; + public: + //typedef typename Impl::Base Base; + typedef Impl Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Reshaped) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reshaped) + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline Reshaped(XprType& xpr) + : Impl(xpr) + { + EIGEN_STATIC_ASSERT(RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic,THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE) + eigen_assert(Rows * Cols == xpr.rows() * xpr.cols()); + } + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline Reshaped(XprType& xpr, + Index reshapeRows, Index reshapeCols) + : Impl(xpr, reshapeRows, reshapeCols) + { + eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==reshapeRows) + && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==reshapeCols)); + eigen_assert(reshapeRows * reshapeCols == xpr.rows() * xpr.cols()); + } +}; + +// The generic default implementation for dense reshape simply forward to the internal::ReshapedImpl_dense +// that must be specialized for direct and non-direct access... +template +class ReshapedImpl + : public internal::ReshapedImpl_dense >::HasDirectAccess> +{ + typedef internal::ReshapedImpl_dense >::HasDirectAccess> Impl; + public: + typedef Impl Base; + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ReshapedImpl) + EIGEN_DEVICE_FUNC inline ReshapedImpl(XprType& xpr) : Impl(xpr) {} + EIGEN_DEVICE_FUNC inline ReshapedImpl(XprType& xpr, Index reshapeRows, Index reshapeCols) + : Impl(xpr, reshapeRows, reshapeCols) {} +}; + +namespace internal { + +/** \internal Internal implementation of dense Reshaped in the general case. */ +template +class ReshapedImpl_dense + : public internal::dense_xpr_base >::type +{ + typedef Reshaped ReshapedType; + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ReshapedType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ReshapedImpl_dense) + + typedef typename internal::ref_selector::non_const_type MatrixTypeNested; + typedef internal::remove_all_t NestedExpression; + + class InnerIterator; + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr) + : m_xpr(xpr), m_rows(Rows), m_cols(Cols) + {} + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr, Index nRows, Index nCols) + : m_xpr(xpr), m_rows(nRows), m_cols(nCols) + {} + + EIGEN_DEVICE_FUNC Index rows() const { return m_rows; } + EIGEN_DEVICE_FUNC Index cols() const { return m_cols; } + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** \sa MapBase::data() */ + EIGEN_DEVICE_FUNC inline const Scalar* data() const; + EIGEN_DEVICE_FUNC inline Index innerStride() const; + EIGEN_DEVICE_FUNC inline Index outerStride() const; + #endif + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC + const internal::remove_all_t& + nestedExpression() const { return m_xpr; } + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC + std::remove_reference_t& + nestedExpression() { return m_xpr; } + + protected: + + MatrixTypeNested m_xpr; + const internal::variable_if_dynamic m_rows; + const internal::variable_if_dynamic m_cols; +}; + + +/** \internal Internal implementation of dense Reshaped in the direct access case. */ +template +class ReshapedImpl_dense + : public MapBase > +{ + typedef Reshaped ReshapedType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; + public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ReshapedType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ReshapedImpl_dense) + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr) + : Base(xpr.data()), m_xpr(xpr) + {} + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr, Index nRows, Index nCols) + : Base(xpr.data(), nRows, nCols), + m_xpr(xpr) + {} + + EIGEN_DEVICE_FUNC + const internal::remove_all_t& nestedExpression() const + { + return m_xpr; + } + + EIGEN_DEVICE_FUNC + XprType& nestedExpression() { return m_xpr; } + + /** \sa MapBase::innerStride() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const + { + return m_xpr.innerStride(); + } + + /** \sa MapBase::outerStride() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const + { + return ((Flags&RowMajorBit)==RowMajorBit) ? this->cols() : this->rows(); + } + + protected: + + XprTypeNested m_xpr; +}; + +// Evaluators +template struct reshaped_evaluator; + +template +struct evaluator > + : reshaped_evaluator >::HasDirectAccess> +{ + typedef Reshaped XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types + typedef typename packet_traits::type PacketScalar; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + HasDirectAccess = traits::HasDirectAccess, + +// RowsAtCompileTime = traits::RowsAtCompileTime, +// ColsAtCompileTime = traits::ColsAtCompileTime, +// MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, +// MaxColsAtCompileTime = traits::MaxColsAtCompileTime, +// +// InnerStrideAtCompileTime = traits::HasSameStorageOrderAsXprType +// ? int(inner_stride_at_compile_time::ret) +// : Dynamic, +// OuterStrideAtCompileTime = Dynamic, + + FlagsLinearAccessBit = (traits::RowsAtCompileTime == 1 || traits::ColsAtCompileTime == 1 || HasDirectAccess) ? LinearAccessBit : 0, + FlagsRowMajorBit = (traits::ReshapedStorageOrder==int(RowMajor)) ? RowMajorBit : 0, + FlagsDirectAccessBit = HasDirectAccess ? DirectAccessBit : 0, + Flags0 = evaluator::Flags & (HereditaryBits & ~RowMajorBit), + Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit | FlagsDirectAccessBit, + + PacketAlignment = unpacket_traits::alignment, + Alignment = evaluator::Alignment + }; + typedef reshaped_evaluator reshaped_evaluator_type; + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : reshaped_evaluator_type(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } +}; + +template +struct reshaped_evaluator + : evaluator_base > +{ + typedef Reshaped XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost /* TODO + cost of index computations */, + + Flags = (evaluator::Flags & (HereditaryBits /*| LinearAccessBit | DirectAccessBit*/)), + + Alignment = 0 + }; + + EIGEN_DEVICE_FUNC explicit reshaped_evaluator(const XprType& xpr) : m_argImpl(xpr.nestedExpression()), m_xpr(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + typedef std::pair RowCol; + + EIGEN_DEVICE_FUNC inline RowCol index_remap(Index rowId, Index colId) const + { + if(Order==ColMajor) + { + const Index nth_elem_idx = colId * m_xpr.rows() + rowId; + return RowCol(nth_elem_idx % m_xpr.nestedExpression().rows(), + nth_elem_idx / m_xpr.nestedExpression().rows()); + } + else + { + const Index nth_elem_idx = colId + rowId * m_xpr.cols(); + return RowCol(nth_elem_idx / m_xpr.nestedExpression().cols(), + nth_elem_idx % m_xpr.nestedExpression().cols()); + } + } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index rowId, Index colId) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.coeffRef(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.coeffRef(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const + { + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.coeff(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + const RowCol row_col = index_remap(Rows == 1 ? 0 : index, + Rows == 1 ? index : 0); + return m_argImpl.coeffRef(row_col.first, row_col.second); + + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + const RowCol row_col = index_remap(Rows == 1 ? 0 : index, + Rows == 1 ? index : 0); + return m_argImpl.coeffRef(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + inline const CoeffReturnType coeff(Index index) const + { + const RowCol row_col = index_remap(Rows == 1 ? 0 : index, + Rows == 1 ? index : 0); + return m_argImpl.coeff(row_col.first, row_col.second); + } +#if 0 + EIGEN_DEVICE_FUNC + template + inline PacketScalar packet(Index rowId, Index colId) const + { + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.template packet(row_col.first, row_col.second); + + } + + template + EIGEN_DEVICE_FUNC + inline void writePacket(Index rowId, Index colId, const PacketScalar& val) + { + const RowCol row_col = index_remap(rowId, colId); + m_argImpl.const_cast_derived().template writePacket + (row_col.first, row_col.second, val); + } + + template + EIGEN_DEVICE_FUNC + inline PacketScalar packet(Index index) const + { + const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0); + return m_argImpl.template packet(row_col.first, row_col.second); + } + + template + EIGEN_DEVICE_FUNC + inline void writePacket(Index index, const PacketScalar& val) + { + const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0); + return m_argImpl.template packet(row_col.first, row_col.second, val); + } +#endif +protected: + + evaluator m_argImpl; + const XprType& m_xpr; + +}; + +template +struct reshaped_evaluator +: mapbase_evaluator, + typename Reshaped::PlainObject> +{ + typedef Reshaped XprType; + typedef typename XprType::Scalar Scalar; + + EIGEN_DEVICE_FUNC explicit reshaped_evaluator(const XprType& xpr) + : mapbase_evaluator(xpr) + { + // TODO: for the 3.4 release, this should be turned to an internal assertion, but let's keep it as is for the beta lifetime + eigen_assert(((internal::UIntPtr(xpr.data()) % plain_enum_max(1, evaluator::Alignment)) == 0) && "data is not aligned"); + } +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_RESHAPED_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ReturnByValue.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ReturnByValue.h index 24c5a4e..9025282 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ReturnByValue.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/ReturnByValue.h @@ -4,32 +4,16 @@ // Copyright (C) 2009-2010 Gael Guennebaud // Copyright (C) 2009-2010 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_RETURNBYVALUE_H #define EIGEN_RETURNBYVALUE_H -/** \class ReturnByValue - * \ingroup Core_Module - * - */ +#include "./InternalHeaderCheck.h" + +namespace Eigen { namespace internal { @@ -51,17 +35,22 @@ struct traits > * So internal::nested always gives the plain return matrix type. * * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ?? + * Answer: EvalBeforeNestingBit should be deprecated since we have the evaluators */ template -struct nested, n, PlainObject> +struct nested_eval, n, PlainObject> { typedef typename traits::ReturnType type; }; } // end namespace internal +/** \class ReturnByValue + * \ingroup Core_Module + * + */ template class ReturnByValue - : public internal::dense_xpr_base< ReturnByValue >::type + : public internal::dense_xpr_base< ReturnByValue >::type, internal::no_assignment_operator { public: typedef typename internal::traits::ReturnType ReturnType; @@ -70,10 +59,13 @@ template class ReturnByValue EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) template + EIGEN_DEVICE_FUNC inline void evalTo(Dest& dst) const { static_cast(this)->evalTo(dst); } - inline Index rows() const { return static_cast(this)->rows(); } - inline Index cols() const { return static_cast(this)->cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return static_cast(this)->rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return static_cast(this)->cols(); } #ifndef EIGEN_PARSED_BY_DOXYGEN #define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT @@ -85,15 +77,45 @@ template class ReturnByValue const Unusable& coeff(Index,Index) const { return *reinterpret_cast(this); } Unusable& coeffRef(Index) { return *reinterpret_cast(this); } Unusable& coeffRef(Index,Index) { return *reinterpret_cast(this); } +#undef Unusable #endif }; template template -Derived& DenseBase::operator=(const ReturnByValue& other) +EIGEN_DEVICE_FUNC Derived& DenseBase::operator=(const ReturnByValue& other) { other.evalTo(derived()); return derived(); } +namespace internal { + +// Expression is evaluated in a temporary; default implementation of Assignment is bypassed so that +// when a ReturnByValue expression is assigned, the evaluator is not constructed. +// TODO: Finalize port to new regime; ReturnByValue should not exist in the expression world + +template +struct evaluator > + : public evaluator::ReturnType> +{ + typedef ReturnByValue XprType; + typedef typename internal::traits::ReturnType PlainObject; + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) + : m_result(xpr.rows(), xpr.cols()) + { + internal::construct_at(this, m_result); + xpr.evalTo(m_result); + } + +protected: + PlainObject m_result; +}; + +} // end namespace internal + +} // end namespace Eigen + #endif // EIGEN_RETURNBYVALUE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Reverse.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Reverse.h index 600744a..97e1d68 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Reverse.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Reverse.h @@ -5,41 +5,16 @@ // Copyright (C) 2009 Ricard Marxer // Copyright (C) 2009-2010 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_REVERSE_H #define EIGEN_REVERSE_H -/** \class Reverse - * \ingroup Core_Module - * - * \brief Expression of the reverse of a vector or matrix - * - * \param MatrixType the type of the object of which we are taking the reverse - * - * This class represents an expression of the reverse of a vector. - * It is the return type of MatrixBase::reverse() and VectorwiseOp::reverse() - * and most of the time this is the only way it is used. - * - * \sa MatrixBase::reverse(), VectorwiseOp::reverse() - */ +#include "./InternalHeaderCheck.h" + +namespace Eigen { namespace internal { @@ -50,36 +25,43 @@ struct traits > typedef typename MatrixType::Scalar Scalar; typedef typename traits::StorageKind StorageKind; typedef typename traits::XprKind XprKind; - typedef typename nested::type MatrixTypeNested; - typedef typename remove_reference::type _MatrixTypeNested; + typedef typename ref_selector::type MatrixTypeNested; + typedef std::remove_reference_t MatrixTypeNested_; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, - - // let's enable LinearAccess only with vectorization because of the product overhead - LinearAccess = ( (Direction==BothDirections) && (int(_MatrixTypeNested::Flags)&PacketAccessBit) ) - ? LinearAccessBit : 0, - - Flags = int(_MatrixTypeNested::Flags) & (HereditaryBits | LvalueBit | PacketAccessBit | LinearAccess), - - CoeffReadCost = _MatrixTypeNested::CoeffReadCost + Flags = MatrixTypeNested_::Flags & (RowMajorBit | LvalueBit) }; }; -template struct reverse_packet_cond +template struct reverse_packet_cond { - static inline PacketScalar run(const PacketScalar& x) { return preverse(x); } + static inline PacketType run(const PacketType& x) { return preverse(x); } }; -template struct reverse_packet_cond +template struct reverse_packet_cond { - static inline PacketScalar run(const PacketScalar& x) { return x; } + static inline PacketType run(const PacketType& x) { return x; } }; -} // end namespace internal +} // end namespace internal +/** \class Reverse + * \ingroup Core_Module + * + * \brief Expression of the reverse of a vector or matrix + * + * \tparam MatrixType the type of the object of which we are taking the reverse + * \tparam Direction defines the direction of the reverse operation, can be Vertical, Horizontal, or BothDirections + * + * This class represents an expression of the reverse of a vector. + * It is the return type of MatrixBase::reverse() and VectorwiseOp::reverse() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::reverse(), VectorwiseOp::reverse() + */ template class Reverse : public internal::dense_xpr_base< Reverse >::type { @@ -87,12 +69,9 @@ template class Reverse typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Reverse) + typedef internal::remove_all_t NestedExpression; using Base::IsRowMajor; - // next line is necessary because otherwise const version of operator() - // is hidden by non-const version defined in this file - using Base::operator(); - protected: enum { PacketSize = internal::packet_traits::size, @@ -108,83 +87,28 @@ template class Reverse typedef internal::reverse_packet_cond reverse_packet; public: - inline Reverse(const MatrixType& matrix) : m_matrix(matrix) { } + EIGEN_DEVICE_FUNC explicit inline Reverse(const MatrixType& matrix) : m_matrix(matrix) { } EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse) - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } - inline Index innerStride() const + EIGEN_DEVICE_FUNC inline Index innerStride() const { return -m_matrix.innerStride(); } - inline Scalar& operator()(Index row, Index col) - { - eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - return coeffRef(row, col); - } - - inline Scalar& coeffRef(Index row, Index col) - { - return m_matrix.const_cast_derived().coeffRef(ReverseRow ? m_matrix.rows() - row - 1 : row, - ReverseCol ? m_matrix.cols() - col - 1 : col); - } - - inline CoeffReturnType coeff(Index row, Index col) const - { - return m_matrix.coeff(ReverseRow ? m_matrix.rows() - row - 1 : row, - ReverseCol ? m_matrix.cols() - col - 1 : col); - } - - inline CoeffReturnType coeff(Index index) const - { - return m_matrix.coeff(m_matrix.size() - index - 1); - } - - inline Scalar& coeffRef(Index index) + EIGEN_DEVICE_FUNC const internal::remove_all_t& + nestedExpression() const { - return m_matrix.const_cast_derived().coeffRef(m_matrix.size() - index - 1); - } - - inline Scalar& operator()(Index index) - { - eigen_assert(index >= 0 && index < m_matrix.size()); - return coeffRef(index); - } - - template - inline const PacketScalar packet(Index row, Index col) const - { - return reverse_packet::run(m_matrix.template packet( - ReverseRow ? m_matrix.rows() - row - OffsetRow : row, - ReverseCol ? m_matrix.cols() - col - OffsetCol : col)); - } - - template - inline void writePacket(Index row, Index col, const PacketScalar& x) - { - m_matrix.const_cast_derived().template writePacket( - ReverseRow ? m_matrix.rows() - row - OffsetRow : row, - ReverseCol ? m_matrix.cols() - col - OffsetCol : col, - reverse_packet::run(x)); - } - - template - inline const PacketScalar packet(Index index) const - { - return internal::preverse(m_matrix.template packet( m_matrix.size() - index - PacketSize )); - } - - template - inline void writePacket(Index index, const PacketScalar& x) - { - m_matrix.const_cast_derived().template writePacket(m_matrix.size() - index - PacketSize, internal::preverse(x)); + return m_matrix; } protected: - const typename MatrixType::Nested m_matrix; + typename MatrixType::Nested m_matrix; }; /** \returns an expression of the reverse of *this. @@ -194,37 +118,102 @@ template class Reverse * */ template -inline typename DenseBase::ReverseReturnType +EIGEN_DEVICE_FUNC inline typename DenseBase::ReverseReturnType DenseBase::reverse() { - return derived(); + return ReverseReturnType(derived()); } -/** This is the const version of reverse(). */ -template -inline const typename DenseBase::ConstReverseReturnType -DenseBase::reverse() const -{ - return derived(); -} + +//reverse const overload moved DenseBase.h due to a CUDA compiler bug /** This is the "in place" version of reverse: it reverses \c *this. * * In most cases it is probably better to simply use the reversed expression * of a matrix. However, when reversing the matrix data itself is really needed, * then this "in-place" version is probably the right choice because it provides - * the following additional features: + * the following additional benefits: * - less error prone: doing the same operation with .reverse() requires special care: * \code m = m.reverse().eval(); \endcode - * - this API allows to avoid creating a temporary (the current implementation creates a temporary, but that could be avoided using swap) + * - this API enables reverse operations without the need for a temporary * - it allows future optimizations (cache friendliness, etc.) * - * \sa reverse() */ + * \sa VectorwiseOp::reverseInPlace(), reverse() */ template -inline void DenseBase::reverseInPlace() +EIGEN_DEVICE_FUNC inline void DenseBase::reverseInPlace() +{ + if(cols()>rows()) + { + Index half = cols()/2; + leftCols(half).swap(rightCols(half).reverse()); + if((cols()%2)==1) + { + Index half2 = rows()/2; + col(half).head(half2).swap(col(half).tail(half2).reverse()); + } + } + else + { + Index half = rows()/2; + topRows(half).swap(bottomRows(half).reverse()); + if((rows()%2)==1) + { + Index half2 = cols()/2; + row(half).head(half2).swap(row(half).tail(half2).reverse()); + } + } +} + +namespace internal { + +template +struct vectorwise_reverse_inplace_impl; + +template<> +struct vectorwise_reverse_inplace_impl +{ + template + static void run(ExpressionType &xpr) + { + constexpr Index HalfAtCompileTime = ExpressionType::RowsAtCompileTime==Dynamic?Dynamic:ExpressionType::RowsAtCompileTime/2; + Index half = xpr.rows()/2; + xpr.template topRows(half) + .swap(xpr.template bottomRows(half).colwise().reverse()); + } +}; + +template<> +struct vectorwise_reverse_inplace_impl +{ + template + static void run(ExpressionType &xpr) + { + constexpr Index HalfAtCompileTime = ExpressionType::ColsAtCompileTime==Dynamic?Dynamic:ExpressionType::ColsAtCompileTime/2; + Index half = xpr.cols()/2; + xpr.template leftCols(half) + .swap(xpr.template rightCols(half).rowwise().reverse()); + } +}; + +} // end namespace internal + +/** This is the "in place" version of VectorwiseOp::reverse: it reverses each column or row of \c *this. + * + * In most cases it is probably better to simply use the reversed expression + * of a matrix. However, when reversing the matrix data itself is really needed, + * then this "in-place" version is probably the right choice because it provides + * the following additional benefits: + * - less error prone: doing the same operation with .reverse() requires special care: + * \code m = m.reverse().eval(); \endcode + * - this API enables reverse operations without the need for a temporary + * + * \sa DenseBase::reverseInPlace(), reverse() */ +template +EIGEN_DEVICE_FUNC void VectorwiseOp::reverseInPlace() { - derived() = derived().reverse().eval(); + internal::vectorwise_reverse_inplace_impl::run(m_matrix); } +} // end namespace Eigen #endif // EIGEN_REVERSE_H diff --git a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Select.h b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Select.h index d0cd66a..d9ed2b2 100644 --- a/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Select.h +++ b/lib/SRC/KPM/FreakMatcher/Eigen/src/Core/Select.h @@ -3,36 +3,25 @@ // // Copyright (C) 2008-2010 Gael Guennebaud // -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SELECT_H #define EIGEN_SELECT_H +#include "./InternalHeaderCheck.h" + +namespace Eigen { + /** \class Select * \ingroup Core_Module * * \brief Expression of a coefficient wise version of the C++ ternary operator ?: * - * \param ConditionMatrixType the type of the \em condition expression which must be a boolean matrix - * \param ThenMatrixType the type of the \em then expression - * \param ElseMatrixType the type of the \em else expression + * \tparam ConditionMatrixType the type of the \em condition expression which must be a boolean matrix + * \tparam ThenMatrixType the type of the \em then expression + * \tparam ElseMatrixType the type of the \em else expression * * This class represents an expression of a coefficient wise version of the C++ ternary operator ?:. * It is the return type of DenseBase::select() and most of the time this is the only way it is used. @@ -56,35 +45,36 @@ struct traits > ColsAtCompileTime = ConditionMatrixType::ColsAtCompileTime, MaxRowsAtCompileTime = ConditionMatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime, - Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & HereditaryBits, - CoeffReadCost = traits::type>::CoeffReadCost - + EIGEN_SIZE_MAX(traits::type>::CoeffReadCost, - traits::type>::CoeffReadCost) + Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & RowMajorBit }; }; } template -class Select : internal::no_assignment_operator, - public internal::dense_xpr_base< Select >::type +class Select : public internal::dense_xpr_base< Select >::type, + internal::no_assignment_operator { public: typedef typename internal::dense_xpr_base