Updated license to new BSD

Updated license to new BSD

--- test/src/test_convert_endian.cpp
+++ test/src/test_convert_endian.cpp
@@ -1,29 +1,27 @@
-// Copyright (c) 2011, Steinwurf ApS
+// Copyright (c) 2012, Steinwurf ApS
 // All rights reserved.
-//
+//
 // Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. 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.
+// 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 Steinwurf ApS 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
+// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> 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.
-//
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.

 #include <gtest/gtest.h>
 #include <sak/convert_endian.h>
@@ -37,7 +35,7 @@
         char c[4];
     } bint = {0x01020304};

-    return bint.c[0] == 1;
+    return bint.c[0] == 1;
 }

 TEST(ConvertEndian, CheckEndian)
@@ -51,18 +49,18 @@
     {
         uint8_t data[1];
         uint16_t in  = 0x11U;
-
+
         // If the host is big endian the put function
         // should not change the byte order
         sak::big_endian::put8(in, data);
         EXPECT_TRUE(0x11U == data[0]);
-
+
         // Neither should the get
         uint8_t out = sak::big_endian::get8(data);
         EXPECT_TRUE(out == in);

     }
-
+
     {
         if(sak::host_endian::big_endian)
         {
@@ -74,7 +72,7 @@
             sak::big_endian::put16(in, data);
             EXPECT_TRUE(0x11U == data[0]);
             EXPECT_TRUE(0x22U == data[1]);
-
+
             // Neither should the get
             uint16_t out = sak::big_endian::get16(data);
             EXPECT_TRUE(out == in);
@@ -89,20 +87,20 @@
             sak::big_endian::put16(in, data);
             EXPECT_TRUE(0x11U == data[0]);
             EXPECT_TRUE(0x22U == data[1]);
-
+
             // Get should swap the value back
             uint16_t out = sak::big_endian::get16(data);
             EXPECT_TRUE(out == in);
         }
-
-    }
-
+
+    }
+
     {
         if(sak::host_endian::big_endian)
         {
             uint8_t data[4];
             uint32_t in  = 0x11223344U;
-
+
             // If the host is big endian the put function
             // should not change the byte order
             sak::big_endian::put32(in, data);
@@ -110,7 +108,7 @@
             EXPECT_TRUE(0x22U == data[1]);
             EXPECT_TRUE(0x33U == data[2]);
             EXPECT_TRUE(0x44U == data[3]);
-
+
             // Neither should the get
             uint32_t out = sak::big_endian::get32(data);
             EXPECT_TRUE(out == in);
@@ -127,12 +125,12 @@
             EXPECT_TRUE(0x22U == data[1]);
             EXPECT_TRUE(0x33U == data[2]);
             EXPECT_TRUE(0x44U == data[3]);
-
+
             // Get should swap the value back
             uint32_t out = sak::big_endian::get32(data);
             EXPECT_TRUE(out == in);
         }
-
+
     }

@@ -154,7 +152,7 @@
             EXPECT_TRUE(0x77U == data[6]);
             EXPECT_TRUE(0x88U == data[7]);

-
+
             // Neither should the get
             uint64_t out = sak::big_endian::get64(data);
             EXPECT_TRUE(out == in);
@@ -175,12 +173,12 @@
             EXPECT_TRUE(0x66U == data[5]);
             EXPECT_TRUE(0x77U == data[6]);
             EXPECT_TRUE(0x88U == data[7]);
-
+
             // Get should swap the value back
             uint64_t out = sak::big_endian::get64(data);
             EXPECT_TRUE(out == in);
         }
-
+
     }

 }
@@ -199,7 +197,7 @@
             sak::big_endian::put<uint16_t>(in, data);
             EXPECT_TRUE(0x11U == data[0]);
             EXPECT_TRUE(0x22U == data[1]);
-
+
             // Neither should the get
             uint16_t out = sak::big_endian::get<uint16_t>(data);
             EXPECT_TRUE(out == in);
@@ -214,14 +212,14 @@
             sak::big_endian::put<uint16_t>(in, data);
             EXPECT_TRUE(0x11U == data[0]);
             EXPECT_TRUE(0x22U == data[1]);
-
+
             // Get should swap the value back
             uint16_t out = sak::big_endian::get<uint16_t>(data);
             EXPECT_TRUE(out == in);
         }
-
-    }
-}
-
-
-
+
+    }
+}
+
+
+


DEBUG: on_upgrade debug message

DEBUG: on_upgrade debug message

--- c_src/cpool.cpp
+++ c_src/cpool.cpp
@@ -122,6 +122,7 @@
     }

     static int on_upgrade(ErlNifEnv* env, void** old_priv_data, void** priv_data, ERL_NIF_TERM load_info) {
+        printf("Executing on_upgrade callback.\r\n");
         ErlNifResourceFlags flags = (ErlNifResourceFlags)(ERL_NIF_RT_CREATE | ERL_NIF_RT_TAKEOVER);
         ErlNifResourceType* cpool = enif_open_resource_type(env, NULL, "cpool_resource", &cpool_resource_cleanup, flags, NULL);
         if (cpool == NULL) return -1;


fix pread/3 behavior on large size

fix pread/3 behavior on large size

--- c_src/emmap.cpp
+++ c_src/emmap.cpp
@@ -316,9 +316,12 @@
       && enif_get_ulong(env, argv[2], &bytes)
       && pos >= 0
       && bytes >= 0
-      && (pos + bytes) <= handle->len
+      && pos <= handle->len
       )
     {
+      // Adjust bytes to behave like original file:pread/3
+      if (pos + bytes > handle->len) bytes = handle->len - pos;
+
       ErlNifBinary bin;

       if ((handle->prot & PROT_READ) == 0) {


Use generic Usage.

Use generic Usage.

--- cpp/mysql_table_patcher.cc
+++ cpp/mysql_table_patcher.cc
@@ -31,12 +31,6 @@

 namespace {
-
-
-[[noreturn]] void Usage() {
-    std::cerr << "Usage: " << ::progname << " [--verbose] update_directory_path\n";
-    std::exit(EXIT_FAILURE);
-}

 void SplitIntoDatabaseTableAndVersion(const std::string &update_filename, std::string * const database, std::string * const table,
@@ -117,7 +111,7 @@

 int Main(int argc, char *argv[]) {
     if (argc != 2)
-        Usage();
+        ::Usage("[--verbose] update_directory_path");

     std::vector<std::string> update_filenames;
     LoadAndSortUpdateFilenames(argv[1], &update_filenames);


cppb: More fixes...

cppb: More fixes...

--- cpp/src/monte_carlo_pi.cpp
+++ cpp/src/monte_carlo_pi.cpp
@@ -10,7 +10,9 @@
 double monte_carlo_pi(int samples, int iterations)
 {
     multi_array<double> x, y, m, c, accu(1);        // Operands
+    std::cout << "HMM" << std::endl;
     accu = (double)0.0;                             // Acculumate across iterations
+    std::cout << "HMM2" << std::endl;
     for(int i=0; i<iterations; ++i) {
         x = random<double>(samples);                // Sample random numbers
         y = random<double>(samples);


Fixed a capitalisation problem.

Fixed a capitalisation problem.

--- cpp/update_full_text_db.cc
+++ cpp/update_full_text_db.cc
@@ -224,7 +224,7 @@
         std::string data;
         if (error_message.empty()) {
             url.clear();
-            data = "Content-type: text/plain\r\n\r\n" + combined_text;
+            data = "Content-Type: text/plain\r\n\r\n" + combined_text;
         }
         FullTextCache::InsertIntoCache(&db_connection, full_text_db_path, ppn, url, data, error_message);


Tuned the ncv and tol parameters of the new krylov optimizer, and improved logging of results

Former-commit-id: 91844f2ae14c9cc4334d8aa383b210883052fd80

--- source/tools/finite/opt-internal/arpack_variance.cpp
+++ source/tools/finite/opt-internal/arpack_variance.cpp
@@ -5,11 +5,9 @@
 #include <general/nmspc_tensor_extra.h>
 #include <math/eig.h>
 #include <math/eig/arpack_solver/matrix_product_hamiltonian.h>
-#include <math/linalg/tensor.h>
 #include <tensors/class_tensors_finite.h>
 #include <tensors/model/class_model_finite.h>
 #include <tensors/state/class_state_finite.h>
-#include <tools/common/contraction.h>
 #include <tools/common/log.h>
 #include <tools/common/prof.h>
 #include <tools/finite/measure.h>
@@ -17,81 +15,142 @@
 #include <tools/finite/opt-internal/report.h>
 #include <tools/finite/opt_mps.h>

-void tools::finite::opt::extract_solutions(const opt_mps &initial_mps,const class_tensors_finite &tensors, eig::solver &solver,
-                                           std::vector<tools::finite::opt::opt_mps> &eigvecs_mps,  const std::string & tag ) {
-    if(solver.result.meta.eigvals_found){
+void tools::finite::opt::extract_solutions(const opt_mps &initial_mps, const class_tensors_finite &tensors, eig::solver &solver,
+                                           std::vector<tools::finite::opt::opt_mps> &eigvecs_mps, const std::string &tag) {
+    if(solver.result.meta.eigvals_found) {
         auto dims_mps = initial_mps.get_tensor().dimensions();
-        auto eigvecs = eig::view::get_eigvecs<Scalar>(solver.result,eig::Side::R, false);
-        auto eigvals = eig::view::get_eigvals<double>(solver.result,false);
+        auto eigvecs  = eig::view::get_eigvecs<Scalar>(solver.result, eig::Side::R, true);
+        auto eigvals  = eig::view::get_eigvals<double>(solver.result, true);
         eigvecs_mps.reserve(eigvecs_mps.size() + static_cast<size_t>(eigvals.size()));
-        auto logLevel = tools::log->level();
-        tools::Logger::setLogLevel(tools::log,2);
         for(long idx = 0; idx < eigvals.size(); idx++) {
             auto eigvec_i = Textra::TensorCast(eigvecs.col(idx), dims_mps);
             auto overlap  = std::abs(initial_mps.get_vector().dot(eigvecs.col(idx)));
             auto energy   = tools::finite::measure::energy(eigvec_i, tensors);
             auto eigval   = energy - initial_mps.get_energy_reduced();
             auto variance = tools::finite::measure::energy_variance(eigvec_i, tensors);
-            eigvecs_mps.emplace_back(fmt::format("eigenvector {} {:6<}", idx,tag), eigvec_i, tensors.active_sites, eigval, initial_mps.get_energy_reduced(), variance,
-                                     overlap, tensors.get_length());
-
-            eigvecs_mps.back().set_time(tools::common::profile::get_default_prof()["t_eig"]->get_last_interval());
-            eigvecs_mps.back().set_counter(static_cast<size_t>(solver.result.meta.counter));
-            eigvecs_mps.back().set_iter(static_cast<size_t>(solver.result.meta.iter));
-            eigvecs_mps.back().is_basis_vector = true;
-            eigvecs_mps.back().validate_candidate();
+            eigvecs_mps.emplace_back(fmt::format("{:<8} eigenvector {}", tag,idx), eigvec_i, tensors.active_sites, eigval, initial_mps.get_energy_reduced(),
+                                     variance, overlap, tensors.get_length());
+            auto & mps = eigvecs_mps.back();
+            mps.set_time(solver.result.meta.time_total);
+            mps.set_counter(static_cast<size_t>(solver.result.meta.counter));
+            mps.set_iter(static_cast<size_t>(solver.result.meta.iter));
+            mps.is_basis_vector = true;
+            mps.validate_candidate();
+            mps.set_krylov_nev(solver.result.meta.nev_converged);
+            mps.set_krylov_ncv(solver.result.meta.ncv);
+            mps.set_krylov_tol(solver.result.meta.tol);
+            mps.set_krylov_eigval(eigvals(idx));
+            mps.set_krylov_ritz(solver.result.meta.ritz);
         }
-        tools::Logger::setLogLevel(tools::log,logLevel);
     }
 }
-

 tools::finite::opt::opt_mps tools::finite::opt::internal::arpack_variance_optimization(const class_tensors_finite &tensors, const opt_mps &initial_mps,
                                                                                const class_algorithm_status &status, OptType optType, OptMode optMode,
                                                                                OptSpace optSpace) {
     using namespace internal;
     using namespace settings::precision;
-    auto t_eig  = tools::common::profile::get_default_prof()["t_eig"]->tic_token();
+    if (not tensors.model->is_reduced()) throw std::runtime_error("arpack_variance_optimization requires energy-reduced MPO²");
+    if (tensors.model->is_compressed_mpo_squared()) throw std::runtime_error("arpack_variance_optimization requires non-compressed MPO²");
+
+
+    auto t_eig    = tools::common::profile::get_default_prof()["t_eig"]->tic_token();
     auto dims_mps = initial_mps.get_tensor().dimensions();
     auto size     = initial_mps.get_tensor().size();
-//    auto nev      = std::clamp<eig::size_type>(size / 8, std::min(size, 2l), 4l);
-    auto nev      = 2l;
-//    auto ncv_max  = static_cast<long>(std::pow(size,0.4));
-    auto ncv      = std::min(size, std::max(2l*nev + 1l, 32l));
-
-    tools::log->info("Excited state variance optimization with arpack | dims {} = {}", dims_mps, size);
-
-    tools::log->trace("Defining eigenvalue solver");
+
     // NOTE:
     // We can't use the MPO-shift trick here!
     // The lower-left corner of the MPO is NOT where the energy is subtracted on a double-layer MPO,
     // especially when using MPO compression.
-
-    eig::solver solver_full, solver_part,solver_extr, solver_test, solver_test2;
-    solver_extr.config.eigThreshold = 1e-12;
-    solver_extr.config.eigMaxIter   = 1000;
-    solver_extr.config.eigMaxNev    = 1;
-    solver_extr.config.eigMaxNcv    = 16;
-    solver_extr.setLogLevel(0);
-
-    solver_part.config.eigThreshold = 1e-5;
-    solver_part.config.eigMaxIter   = 200000;
-    solver_part.config.eigMaxNev    = 1;
-    solver_part.config.eigMaxNcv    = 4;
-    solver_part.setLogLevel(0);
-
-    solver_test.config.eigThreshold = 1e-5;
-    solver_test.config.eigMaxIter   = 1000;
-    solver_test.config.eigMaxNev    = 2;
-    solver_test.config.eigMaxNcv    = 32;
-    solver_test.setLogLevel(0);
-
-    solver_test2.config.eigThreshold = 1e-5;
-    solver_test2.config.eigMaxIter   = 1000;
-    solver_test2.config.eigMaxNev    = 2;
-    solver_test2.config.eigMaxNcv    = 32;
-    solver_test2.setLogLevel(0);
-
+    tools::log->debug("Finding excited state: smallest eigenstate of (H-E)² | dims {} = {}", dims_mps, size);
+
+    eig::solver solver_full, solver_shft, solver_max;
+    solver_max.config.eigThreshold = 1e-12;
+    solver_max.config.eigMaxIter   = 1000;
+    solver_max.config.eigMaxNev    = 1;
+    solver_max.config.eigMaxNcv    = 16;
+    solver_max.config.compress     = true;
+    solver_max.setLogLevel(2);
+
+    solver_shft.config.eigThreshold = std::clamp(0.1 * initial_mps.get_variance(), settings::precision::eig_threshold, 1e-10,);
+    solver_shft.config.eigMaxIter   = 1000;
+    solver_shft.config.eigMaxNev    = 1;
+    solver_shft.config.eigMaxNcv    = 128;
+    solver_shft.config.compress     = true;
+    solver_shft.setLogLevel(2);
+
+    eig::solver solver_shft2;
+    solver_shft2.config.eigThreshold = 1e-12;
+    solver_shft2.config.eigMaxIter   = 200;
+    solver_shft2.config.eigMaxNev    = 1;
+    solver_shft2.config.eigMaxNcv    = 512;
+    solver_shft2.config.compress     = true;
+    solver_shft2.setLogLevel(2);
+//
+    eig::solver solver_shft3;
+    solver_shft3.config.eigThreshold = 1e-12;
+    solver_shft3.config.eigMaxIter   = 100;
+    solver_shft3.config.eigMaxNev    = 1;
+    solver_shft3.config.eigMaxNcv    = 1024;
+    solver_shft3.config.compress     = true;
+    solver_shft3.setLogLevel(2);
+//
+//    eig::solver solver_shft4;
+//    solver_shft4.config.eigThreshold = 1e-10;
+//    solver_shft4.config.eigMaxIter   = 100000;
+//    solver_shft4.config.eigMaxNev    = 1;
+//    solver_shft4.config.eigMaxNcv    = 512;
+//    solver_shft4.config.compress     = true;
+//    solver_shft4.setLogLevel(2);
+//
+//    eig::solver solver_shft5;
+//    solver_shft5.config.eigThreshold = 1e-12;
+//    solver_shft5.config.eigMaxIter   = 100000;
+//    solver_shft5.config.eigMaxNev    = 1;
+//    solver_shft5.config.eigMaxNcv    = 128;
+//    solver_shft5.config.compress     = true;
+//    solver_shft5.setLogLevel(2);
+//
+//    eig::solver solver_shft6;
+//    solver_shft6.config.eigThreshold = 1e-12;
+//    solver_shft6.config.eigMaxIter   = 100000;
+//    solver_shft6.config.eigMaxNev    = 1;
+//    solver_shft6.config.eigMaxNcv    = 256;
+//    solver_shft6.config.compress     = true;
+//    solver_shft6.setLogLevel(2);
+//
+//    eig::solver solver_shft7;
+//    solver_shft7.config.eigThreshold = 1e-12;
+//    solver_shft7.config.eigMaxIter   = 100000;
+//    solver_shft7.config.eigMaxNev    = 1;
+//    solver_shft7.config.eigMaxNcv    = 512;
+//    solver_shft7.config.compress     = true;
+//    solver_shft7.setLogLevel(2);
+
+//    eig::solver solver_shft8;
+//    solver_shft8.config.eigThreshold = 1e-12;
+//    solver_shft8.config.eigMaxIter   = 100000;
+//    solver_shft8.config.eigMaxNev    = 1;
+//    solver_shft8.config.eigMaxNcv    = 16;
+//    solver_shft8.config.compress     = true;
+//    solver_shft8.setLogLevel(2);
+//
+//
+//    eig::solver solver_shft9;
+//    solver_shft9.config.eigThreshold = 1e-12;
+//    solver_shft9.config.eigMaxIter   = 100000;
+//    solver_shft9.config.eigMaxNev    = 1;
+//    solver_shft9.config.eigMaxNcv    = 32;
+//    solver_shft9.config.compress     = true;
+//    solver_shft9.setLogLevel(2);
+//
+//    eig::solver solver_shft10;
+//    solver_shft10.config.eigThreshold = 1e-12;
+//    solver_shft10.config.eigMaxIter   = 100000;
+//    solver_shft10.config.eigMaxNev    = 1;
+//    solver_shft10.config.eigMaxNcv    = 64;
+//    solver_shft10.config.compress     = true;
+//    solver_shft10.setLogLevel(2);

     if(optType == OptType::REAL) {
@@ -100,154 +159,197 @@
         Eigen::Tensor<double, 3> env2L     = env2.L.real();
         Eigen::Tensor<double, 3> env2R     = env2.R.real();
         Eigen::Tensor<double, 4> mpo2      = tensors.get_multisite_mpo_squared().real();
+        Eigen::Tensor<double, 3> residual  = initial_mps.get_tensor().real();
         auto                     dims_mpo2 = mpo2.dimensions();
-        Eigen::Tensor<double, 3> residual = initial_mps.get_tensor().real();
-
-
-//        {
-//            MatrixProductHamiltonian<double> matrix_test2(env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
-//
-//
-//            double eigval_target2 = initial_mps.get_eigval()*initial_mps.get_eigval();
-//            tools::log->trace("Finding excited state with squared inverse | residual on ... ");
-//            solver_test2.eigs(matrix_test2, 1, 16, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, eigval_target2, eig::Shinv::ON, eig::Vecs::ON, eig::Dephase::OFF, residual.data());
-//            tools::log->trace("Finding excited state with squared inverse | residual on ... OK: iters {} | counter {} | time {:.3f} | matprod {:.3f}s",
-//                              solver_test2.result.meta.iter, solver_test2.result.meta.counter, solver_test2.result.meta.time_total,solver_test2.result.meta.time_matprod);
-//
-//        }
-
-
-
-        if(size <= settings::precision::max_size_full_diag){
-//        if(size <= 256){
-            tools::log->trace("Finding full spectrum");
-            auto matrix = tools::finite::opt::internal::get_multisite_hamiltonian_squared_matrix<double>(*tensors.model,*tensors.edges);
+
+        if(size <= 128) {
+//        if(size <= settings::precision::max_size_full_diag) {
+            tools::log->trace("Full diagonalization of (H-E)²", dims_mps, size);
+            auto matrix = tools::finite::opt::internal::get_multisite_hamiltonian_squared_matrix<double>(*tensors.model, *tensors.edges);
             solver_full.eig(matrix.data(), matrix.rows());
-        }else{
+        } else {
             tools::log->trace("Defining reduced Hamiltonian-squared matrix-vector product");
-            MatrixProductHamiltonian<double> matrix_extr(env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
-            MatrixProductHamiltonian<double> matrix_part(env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
-
-            if(not tensors.model->is_compressed_mpo_squared()){
-
+            MatrixProductHamiltonian<double> hamiltonian_squared(env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+
+            if(not tensors.model->is_compressed_mpo_squared()) {
                 tools::log->trace("Finding largest-magnitude state");
-                solver_extr.eigs(matrix_extr, 1, 16, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, std::nullopt, eig::Shinv::OFF, eig::Vecs::OFF, eig::Dephase::OFF);
-                auto eigvals_extr = eig::view::get_eigvals<double>(solver_extr.result);
-                auto shift = eigvals_extr.cwiseAbs().maxCoeff() + 1.0; // Add one just to make sure we shift enough
-
-
-                tools::log->trace("Finding excited state with shift {:.16f} | residual on ...",shift );
-                solver_part.eigs(matrix_part, nev, ncv, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, shift, eig::Shinv::OFF, eig::Vecs::ON, eig::Dephase::OFF, residual.data());
-                tools::log->trace("Finding excited state with shift {:.16f} | residual on ... OK: iters {} | counter {} | time {:.3f} | matprod {:.3f}s",
-                                  shift, solver_part.result.meta.iter, solver_part.result.meta.counter,solver_part.result.meta.time_total,solver_part.result.meta.time_matprod);
-
-            }else{
-                tools::log->trace("Finding excited state");
-                solver_part.eigs(matrix_part, nev, ncv, eig::Ritz::SM, eig::Form::SYMM, eig::Side::R, std::nullopt, eig::Shinv::OFF, eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+                solver_max.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, std::nullopt, eig::Shinv::OFF,
+                                    eig::Vecs::OFF, eig::Dephase::OFF);
+                auto eigvals_ham_sq = eig::view::get_eigvals<double>(solver_max.result);
+                auto largest_eigval = eigvals_ham_sq.cwiseAbs().maxCoeff() + 1.0; // Add one just to make sure we shift enough
+
+                // Reset the matrix
+                hamiltonian_squared = MatrixProductHamiltonian<double> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+                tools::log->debug("Finding excited state using shifted operator [(H-E)²-λmax], with λmax = {:.16f} | residual on ...", largest_eigval);
+                solver_shft.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+                                 eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+                tools::log->trace("Finding excited state using shifted operator H²-λmax, with λmax = {:.16f} | residual on ... OK: iters {} | counter {} | "
+                                  "time {:.3f} | matprod {:.3f}s",
+                                  largest_eigval, solver_shft.result.meta.iter, solver_shft.result.meta.counter, solver_shft.result.meta.time_total,
+                                  solver_shft.result.meta.time_matprod);
+
+                // Reset the matrix
+//                tools::log->debug("Finding excited state using shifted operator [(H-E)²-λmax], with λmax = {:.16f} | residual on ...", largest_eigval);
+//                hamiltonian_squared = MatrixProductHamiltonian<double> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+//                residual  = initial_mps.get_tensor().real();
+//                solver_shft2.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+//                                  eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+//                // Reset the matrix
+//                tools::log->debug("Finding excited state using shifted operator [(H-E)²-λmax], with λmax = {:.16f} | residual on ...", largest_eigval);
+//                hamiltonian_squared = MatrixProductHamiltonian<double> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+//                residual  = initial_mps.get_tensor().real();
+//                solver_shft3.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+//                                  eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+//                // Reset the matrix
+//                tools::log->debug("Finding excited state using shifted operator [(H-E)²-λmax], with λmax = {:.16f} | residual on ...", largest_eigval);
+//                hamiltonian_squared = MatrixProductHamiltonian<double> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+//                residual  = initial_mps.get_tensor().real();
+//                solver_shft4.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+//                                  eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+//                // Reset the matrix
+//                tools::log->debug("Finding excited state using shifted operator [(H-E)²-λmax], with λmax = {:.16f} | residual on ...", largest_eigval);
+//                hamiltonian_squared = MatrixProductHamiltonian<double> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+//                residual  = initial_mps.get_tensor().real();
+//                solver_shft5.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+//                                  eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+//                // Reset the matrix
+//                tools::log->debug("Finding excited state using shifted operator [(H-E)²-λmax], with λmax = {:.16f} | residual on ...", largest_eigval);
+//                hamiltonian_squared = MatrixProductHamiltonian<double> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+//                residual  = initial_mps.get_tensor().real();
+//                solver_shft6.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+//                                  eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+//                // Reset the matrix
+//                tools::log->debug("Finding excited state using shifted operator [(H-E)²-λmax], with λmax = {:.16f} | residual on ...", largest_eigval);
+//                hamiltonian_squared = MatrixProductHamiltonian<double> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+//                residual  = initial_mps.get_tensor().real();
+//                solver_shft7.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+//                                  eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+//                // Reset the matrix
+//                tools::log->debug("Finding excited state using shifted operator [(H-E)²-λmax], with λmax = {:.16f} | residual on ...", largest_eigval);
+//                hamiltonian_squared = MatrixProductHamiltonian<double> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+//                residual  = initial_mps.get_tensor().real();
+//                solver_shft8.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+//                                  eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+//                // Reset the matrix
+//                tools::log->debug("Finding excited state using shifted operator [(H-E)²-λmax], with λmax = {:.16f} | residual on ...", largest_eigval);
+//                hamiltonian_squared = MatrixProductHamiltonian<double> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+//                residual  = initial_mps.get_tensor().real();
+//                solver_shft9.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+//                                  eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+//                // Reset the matrix
+//                tools::log->debug("Finding excited state using shifted operator [(H-E)²-λmax], with λmax = {:.16f} | residual on ...", largest_eigval);
+//                hamiltonian_squared = MatrixProductHamiltonian<double> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+//                residual  = initial_mps.get_tensor().real();
+//                solver_shft10.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+//                                  eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+#pragma message "print also the actual H² eigval"
+            } else {
+                tools::log->warn("Finding excited state using H² with ritz SM");
+                solver_shft.eigs(hamiltonian_squared, -1, -1, eig::Ritz::SM, eig::Form::SYMM, eig::Side::R, std::nullopt, eig::Shinv::OFF,
+                                 eig::Vecs::ON, eig::Dephase::OFF, residual.data());
             }
         }
-
-//        {
-//            tools::log->trace("Testing matrix-free solver");
-//            MatrixReplacement<double> matRepl;
-//            matRepl.attachTensors(env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo);
-//
-//            Eigen::VectorXd b(size), x;
-//            b.setZero();
-//
-//            // Solve Ax = b using various iterative solver with matrix-free version:
-//            {
-//                Eigen::ConjugateGradient<MatrixReplacement<double>, Eigen::Lower|Eigen::Upper, Eigen::IdentityPreconditioner> cg;
-//                cg.setMaxIterations(500);
-//                cg.compute(matRepl);
-//                x = cg.solve(b);
-//                std::cout << "CG:       #iterations: " << cg.iterations() << ", estimated error: " << cg.error() << std::endl;
-//            }
-//        }
-
-    }
-    if(optType == OptType::CPLX) {
-        tools::log->trace("- Generating cplx-valued multisite components");
-        const auto &env2     = tensors.get_multisite_var_blk();
-        const auto &env2L    = env2.L;
-        const auto &env2R    = env2.R;
-        const auto &mpo2     = tensors.get_multisite_mpo_squared();
-        const auto  dims_mpo = mpo2.dimensions();
-        tools::log->trace("Defining reduced Hamiltonian-squared matrix-vector product");
-        MatrixProductHamiltonian<Scalar> matrix(env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo);
-
-        // Since we use reduced energy mpo's, we set a sigma shift = 1.0 to move the smallest eigenvalue away from 0, which
-        // would otherwise cause trouble for Arpack. This equates to subtracting sigma * identity from the bottom corner of the mpo.
-        // The resulting eigenvalue will be shifted by the same amount, but the eigenvector will be the same, and that's what we keep.
-        Eigen::Tensor<Scalar, 3> residual = initial_mps.get_tensor();
-        tools::log->trace("Finding excited state");
-        solver_part.eigs(matrix, nev, ncv,  eig::Ritz::SR, eig::Form::SYMM, eig::Side::R, std::nullopt, eig::Shinv::OFF, eig::Vecs::ON, eig::Dephase::OFF,residual.data());
-    }
+    } else if(optType == OptType::CPLX) {
+        tools::log->trace("- Generating complex-valued multisite components");
+        const auto &           env2      = tensors.get_multisite_var_blk();
+        Eigen::Tensor<cplx, 3> env2L     = env2.L;
+        Eigen::Tensor<cplx, 3> env2R     = env2.R;
+        Eigen::Tensor<cplx, 4> mpo2      = tensors.get_multisite_mpo_squared();
+        Eigen::Tensor<cplx, 3> residual  = initial_mps.get_tensor();
+        auto                   dims_mpo2 = mpo2.dimensions();
+
+        if(size <= settings::precision::max_size_full_diag) {
+            tools::log->debug("Finding excited state using full spectrum of H²");
+            auto matrix = tools::finite::opt::internal::get_multisite_hamiltonian_squared_matrix<cplx>(*tensors.model, *tensors.edges);
+            solver_full.eig(matrix.data(), matrix.rows());
+        } else {
+            tools::log->trace("Defining reduced Hamiltonian-squared matrix-vector product");
+            MatrixProductHamiltonian<cplx> hamiltonian_squared(env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+
+            if(not tensors.model->is_compressed_mpo_squared()) {
+                tools::log->trace("Finding largest-magnitude state");
+                solver_max.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, std::nullopt, eig::Shinv::OFF,
+                                    eig::Vecs::OFF, eig::Dephase::OFF);
+                auto eigvals_ham_sq = eig::view::get_eigvals<double>(solver_max.result);
+                auto largest_eigval = eigvals_ham_sq.cwiseAbs().maxCoeff() + 1.0; // Add one just to make sure we shift enough
+
+                // Reset the matrix
+                hamiltonian_squared = MatrixProductHamiltonian<cplx> (env2L.data(), env2R.data(), mpo2.data(), dims_mps, dims_mpo2);
+                tools::log->debug("Finding excited state using shifted operator H²-λmax, with λmax = {:.16f} | residual on ...", largest_eigval);
+                solver_shft.eigs(hamiltonian_squared, -1, -1, eig::Ritz::LM, eig::Form::SYMM, eig::Side::R, largest_eigval, eig::Shinv::OFF,
+                                 eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+                tools::log->trace("Finding excited state using shifted operator H²-λmax, with λmax = {:.16f} | residual on ... OK: iters {} | counter {} | "
+                                  "time {:.3f} | matprod {:.3f}s",
+                                  largest_eigval, solver_shft.result.meta.iter, solver_shft.result.meta.counter, solver_shft.result.meta.time_total,
+                                  solver_shft.result.meta.time_matprod);
+
+            } else {
+                tools::log->warn("Finding excited state using H² with ritz SM");
+                solver_shft.eigs(hamiltonian_squared, -1, -1, eig::Ritz::SM, eig::Form::SYMM, eig::Side::R, std::nullopt, eig::Shinv::OFF,
+                                 eig::Vecs::ON, eig::Dephase::OFF, residual.data());
+            }
+        }
+    }
+
     t_eig.toc();

     std::vector<opt_mps> eigvecs_mps;
-    extract_solutions(initial_mps, tensors, solver_part, eigvecs_mps, "part");
+    eigvecs_mps.emplace_back(initial_mps);
+    extract_solutions(initial_mps, tensors, solver_shft, eigvecs_mps, "shifted");
+    extract_solutions(initial_mps, tensors, solver_shft2, eigvecs_mps, "shifted2");
+    extract_solutions(initial_mps, tensors, solver_shft3, eigvecs_mps, "shifted3");
+//    extract_solutions(initial_mps, tensors, solver_shft4, eigvecs_mps, "shifted4");
+//    extract_solutions(initial_mps, tensors, solver_shft5, eigvecs_mps, "shifted5");
+//    extract_solutions(initial_mps, tensors, solver_shft6, eigvecs_mps, "shifted6");
+//    extract_solutions(initial_mps, tensors, solver_shft7, eigvecs_mps, "shifted7");
+//    extract_solutions(initial_mps, tensors, solver_shft8, eigvecs_mps, "shifted8");
+//    extract_solutions(initial_mps, tensors, solver_shft9, eigvecs_mps, "shifted9");
+//    extract_solutions(initial_mps, tensors, solver_shft10, eigvecs_mps, "shifted10");
     extract_solutions(initial_mps, tensors, solver_full, eigvecs_mps, "full");
-    extract_solutions(initial_mps, tensors, solver_test, eigvecs_mps, "bic1");
-    extract_solutions(initial_mps, tensors, solver_test2, eigvecs_mps,"bic2");
-    if (eigvecs_mps.empty()) return internal::ceres_direct_optimization(tensors, initial_mps, status, optType, OptMode::VARIANCE, OptSpace::DIRECT); // The solver failed
-
-
-    auto comp_variance =  [](const opt_mps &lhs, const opt_mps &rhs){return lhs.get_variance() < rhs.get_variance();};
-    auto comp_overlap  =  [](const opt_mps &lhs, const opt_mps &rhs){return lhs.get_overlap() > rhs.get_overlap();};
-
-    if(eigvecs_mps.size() >= 2){
-        if(optMode == OptMode::VARIANCE)
-            std::sort(eigvecs_mps.begin(), eigvecs_mps.end(), comp_variance);
-        if(optMode == OptMode::OVERLAP)
-            std::sort(eigvecs_mps.begin(), eigvecs_mps.end(), comp_overlap);
-    }
-
-
-    for(const auto & [i,mps] : iter::enumerate(eigvecs_mps)){
-        tools::log->info("{:<24} overlap {:.16f} | E {:>20.16f} | E/L {:>20.16f} | eigval {:>20.16f} {:>20.16f} | Er {:>20.16f} | variance: "
-                         "{:>20.16f} | norm {:.16f} | iters {} | counter {}",
-                         mps.get_name(), mps.get_overlap(), mps.get_energy(), mps.get_energy_per_site(),
-                         mps.get_eigval(), mps.get_eigval(), mps.get_energy_reduced(), std::log10(mps.get_variance()),
-                         mps.get_norm(),mps.get_iter(), mps.get_counter());
-        if(i > 32) break;
-    }
-
-    // Try optimizing the results with l-bfgs
+
+    if(eigvecs_mps.empty())
+        return internal::ceres_direct_optimization(tensors, initial_mps, status, optType, OptMode::VARIANCE, OptSpace::DIRECT); // The solver failed
+
+    auto comp_variance = [](const opt_mps &lhs, const opt_mps &rhs) {
+        return lhs.get_variance() < rhs.get_variance();
+    };
+    auto comp_overlap = [](const opt_mps &lhs, const opt_mps &rhs) {
+        return lhs.get_overlap() > rhs.get_overlap();
+    };
+
+    if(eigvecs_mps.size() >= 2) {
+        if(optMode == OptMode::VARIANCE) std::sort(eigvecs_mps.begin(), eigvecs_mps.end(), comp_variance);
+        if(optMode == OptMode::OVERLAP) std::sort(eigvecs_mps.begin(), eigvecs_mps.end(), comp_overlap);
+    }
+
+    constexpr size_t max_print = settings::debug ? 32 : 20;
+    for(const auto &[num, mps] : iter::enumerate(eigvecs_mps)) {
+        if(num >= max_print) break;
+        internal::reports::krylov_add_entry(mps);
+    }
+    reports::print_krylov_report();
     std::vector<opt_mps> optimized_mps;

     // Try optimizing the first eigenvectors
-    for(const auto & mps : eigvecs_mps){
-        if(&mps != &eigvecs_mps.front()){
+    for(const auto &mps : eigvecs_mps) {
+        if(&mps != &eigvecs_mps.front()) {
             // Break secondary states that are too far away in energy from the first one
             if(std::abs(mps.get_energy() - eigvecs_mps.front().get_energy()) > 1e2 * eigvecs_mps.front().get_variance()) break;
             // Break secondary states that are too far away in overlap from the first one
             if(mps.get_overlap() < 0.7) break;
-
         }
         optimized_mps.emplace_back(internal::ceres_direct_optimization(tensors, mps, status, optType, optMode, optSpace));
     }

-    // If there are multiple solutions, try building a linear combination and optimize that super_mps with l-bfgs
-//    if(eigvecs_mps.size() >= 2){
-//        std::sort(eigvecs_mps.begin(), eigvecs_mps.end(), comp_variance);
-//        auto super_vector = (eigvecs_mps[0].get_vector() + eigvecs_mps[1].get_vector()).normalized();
-//        auto super_tensor = Textra::TensorCast(super_vector, dims_mps);
-//        auto overlap  = std::abs(initial_mps.get_vector().dot(super_vector));
-//        auto energy   = tools::finite::measure::energy(super_tensor, tensors);
-//        auto eigval   = energy - initial_mps.get_energy_reduced();
-//        auto variance = tools::finite::measure::energy_variance(super_tensor, tensors);
-//        auto super_mps = opt_mps(fmt::format("superposition 0+1"), super_tensor, tensors.active_sites, eigval, initial_mps.get_energy_reduced(), variance,
-//                           overlap, tensors.get_length());
-//        optimized_mps.emplace_back(internal::ceres_direct_optimization(tensors, super_mps, status, optType, optMode, optSpace));
-//
-//    }
-
-    if(optimized_mps.size() >= 2) // Sort the results in order of increasing variance (again!)
-        std::sort(optimized_mps.begin(), optimized_mps.end(), comp_variance);
-
-    if(optimized_mps.empty()) return internal::ceres_direct_optimization(tensors, initial_mps, status, optType, OptMode::VARIANCE, OptSpace::DIRECT); // The optimization strategy failed
-    else return optimized_mps.front();
-
-
+    // Append all the optimized mps's
+    for(const auto & mps: optimized_mps) eigvecs_mps.emplace_back(mps);
+
+    if(eigvecs_mps.size() >= 2) // Sort the results in order of increasing variance (again!)
+        std::sort(eigvecs_mps.begin(), eigvecs_mps.end(), comp_variance);
+
+    if(eigvecs_mps.empty())
+        return internal::ceres_direct_optimization(tensors, initial_mps, status, optType, OptMode::VARIANCE,
+                                                   OptSpace::DIRECT); // The optimization strategy failed
+    else
+        return eigvecs_mps.front();
 }


Cosmetic change, have to commit to merge

--- brain/test.cpp
+++ brain/test.cpp
@@ -74,7 +74,7 @@
 }

-//Target is axon, Source is dendrite (?)
+//Target is axon, Source is dendrite
 Neuron* placeTestNeuron(Brain* brain, float locx, float locy, float locz, float sx, float sy, float sz, float range){
 		float random = rand()/(float)RAND_MAX;
 		Genome::Gene gene;//FIXME set source and target regions to match the desired behavior


ResultManager: fix tracker being used outside of mutex lock

--- cputrack/ResultManager.cpp
+++ cputrack/ResultManager.cpp
@@ -127,12 +127,13 @@
 	LocalizationResult resultbuf[NResultBuf];

 	int count = qtrk->PollFinished( resultbuf, NResultBuf );
-	trackerMutex.unlock();

 	resultMutex.lock();
 	for (int i=0;i<count;i++)
 		StoreResult(&resultbuf[i]);
 	resultMutex.unlock();
+
+	trackerMutex.unlock();

 	if (processedFrames - lastSaveFrame >= config.writeInterval) {
 		Write();
@@ -176,10 +177,8 @@

 	int end = endFrame - this->startFrame;

-	if (start < 0) {
-		memset(results, 0, sizeof(LocalizationResult) * -start); // we already deleted this data
-		start = 0;
-	}
+	if (start < 0)
+		return 0;

 	resultMutex.lock();
 	for (int i=start;i<end;i++){


BSE: bsemain.cc: fix stale config values and refuse to change locked config

Signed-off-by: Tim Janik <6ec6ff229c4e1c5bbd5933ee92e6c5832ff023bb@gnu.org>

--- bse/bsemain.cc
+++ bse/bsemain.cc
@@ -545,7 +545,7 @@
   return argv_bse_rcfile.empty() ? Path::join (Path::config_home(), "beast", "bserc.xml") : argv_bse_rcfile;
 }

-static Configuration
+static const Configuration&
 global_config_load ()
 {
   static bool loaded_once = false;
@@ -556,7 +556,7 @@
       String fileconfig = Path::stringread (global_config_beastrc());
       if (!fileconfig.empty())
         {
-          Configuration tmp;
+          Configuration tmp = config;
           SerializeFromXML si (fileconfig);
           if (si.load (tmp))
             config = tmp;
@@ -571,7 +571,8 @@
 void
 GlobalConfig::assign (const Configuration &configuration)
 {
-  if (global_config_rcsettings == configuration)
+  if (global_config_rcsettings == configuration ||
+      GlobalConfig::locked ())
     return;
   global_config_rcsettings = configuration;
   global_config_stamp++;
@@ -616,17 +617,8 @@
 const GlobalConfig*
 GlobalConfigPtr::operator-> () const
 {
-  static Configuration static_config = GlobalConfig::defaults();
-  if (!GlobalConfig::locked())
-    {
-      static size_t last_stamp = 0;
-      if (last_stamp != global_config_stamp)
-        {
-          static_config = global_config_load();
-          last_stamp = global_config_stamp;
-        }
-    }
-  return static_cast<GlobalConfig*> (&static_config);
+  const Configuration &config = global_config_load();
+  return static_cast<const GlobalConfig*> (&config);
 }

 // == loaders ==


update lorina.

update lorina.


SfxItemPool: replace deque with vector for SfxPoolItem array

Yields measurable speedup on load/store of large documents, wonder where
the equivalent patch i committed long time ago to OOo went...


INTEGRATION: CWS aw036 (1.16.46); FILE MERGED 2006/10/26 15:57:14 aw 1.16.46.1: #i61284#: BurnInStyleSheetAttributes for text corrected; #i70852#: Set/GetLayer cleanup and implementation for FmFormObj

--- svx/source/form/fmobj.cxx
+++ svx/source/form/fmobj.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: fmobj.cxx,v $
  *
- *  $Revision: 1.18 $
- *
- *  last change: $Author: ihi $ $Date: 2006-11-14 13:24:29 $
+ *  $Revision: 1.19 $
+ *
+ *  last change: $Author: vg $ $Date: 2006-11-21 16:44:06 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -624,7 +624,36 @@
 {
     return m_nType;
 }
+
 // -----------------------------------------------------------------------------
-
-
-
+// #i70852# overload Layer interface to force to FormColtrol layer
+
+SdrLayerID FmFormObj::GetLayer() const
+{
+    if(GetPage())
+    {
+        // use the SdrLayerAdmin from the page, it's parent is the model one
+        const SdrLayerAdmin& rAdmin(GetPage()->GetLayerAdmin());
+        return rAdmin.GetLayerID(rAdmin.GetControlLayerName(), TRUE);
+    }
+    else if(GetModel())
+    {
+        // use the SdrLayerAdmin from the model. No parents to visit.
+        const SdrLayerAdmin& rAdmin(GetModel()->GetLayerAdmin());
+        return rAdmin.GetLayerID(rAdmin.GetControlLayerName(), FALSE);
+    }
+
+    // return parent's knowledge when no page and no model. Without page and model
+    // there is no SdrLayerAdmin for this object anyways, so return member.
+    return SdrUnoObj::GetLayer();
+}
+
+void FmFormObj::NbcSetLayer(SdrLayerID nLayer)
+{
+    // nothing to do, Layer cannot be changed for FmFormObj. Parents
+    // do not need to be called, SdrUnoObj::NbcSetLayer will not do
+    // it's special handling, but call SdrObject::NbcSetLayer which
+    // will not change since it also uses GetLayer() to test for change
+}
+
+// eof


shared libs can be unloaded

shared libs can be unloaded

--- tests/Core/SharedLibraryTest.cpp
+++ tests/Core/SharedLibraryTest.cpp
@@ -32,6 +32,11 @@
     ASSERT_THAT(tLib.isLoaded(), Eq(true));
 }

+TEST_F(ASharedLibrary, CanBeUnloaded) {
+    testLib_.unload();
+    ASSERT_THAT(testLib_.isLoaded(), Eq(false));
+}
+
 #ifdef _WIN32
 TEST_F(ASharedLibrary, HasNoSuffixDLLOnWin32) {
     ASSERT_THAT(sharedlibrary_.suffic(), StrEq(".dll"));
@@ -56,6 +61,6 @@
 }

 TEST_F(ASharedLibrary, LoadsSymbolByName) {
-    TheAnswerFunc answerFunc = (TheAnswerFunc) testLib_.getSymbol("theAnswer");
+    TheAnswerFunc answerFunc = (TheAnswerFunc) testLib_.getSymbol(aValidSymbol);
     ASSERT_THAT(answerFunc(), Eq(42));
 }


tests: Disable LongFenceChain test

tests: Disable LongFenceChain test

--- tests/layer_validation_tests.cpp
+++ tests/layer_validation_tests.cpp
@@ -3066,7 +3066,7 @@

     m_errorMonitor->VerifyNotFound();
 }
-
+#if 0 // A few devices have issues with this test so disabling for now
 TEST_F(VkLayerTest, LongFenceChain)
 {
     m_errorMonitor->ExpectSuccess();
@@ -3101,7 +3101,7 @@

     m_errorMonitor->VerifyNotFound();
 }
-
+#endif
 TEST_F(VkLayerTest, CommandBufferSimultaneousUseSync)
 {
     m_errorMonitor->ExpectSuccess();


Set different names for each thruster in diagnostics

--- ucf_sub_embedded_ros/ucf_sub/src/sub_apps/sub_thrusters_manager/src/sub_thruster_manager_node.cpp
+++ ucf_sub_embedded_ros/ucf_sub/src/sub_apps/sub_thrusters_manager/src/sub_thruster_manager_node.cpp
@@ -96,8 +96,8 @@
                 thrusterMap.erase(i);
                 //Publish an error message for the diagnostic system to do something about
                 diagnostic_msgs::DiagnosticStatus status;
-                status.name = "Thrusters";
-                status.hardware_id = "Thrusters_"+thrustersJson[i]["Address"].asString();
+                status.name = "Thruster_"+thrustersJson[i]["Address"].asString();
+                status.hardware_id = "Thruster_"+thrustersJson[i]["Address"].asString();
                 status.level = status.ERROR;
                 diag.status.push_back(status);
             }
@@ -134,7 +134,7 @@
                 for(auto& iter:thrusterMap)
                 {
                     diagnostic_msgs::DiagnosticStatus status;
-                    status.name = "Thrusters";
+                    status.name = "Thruster_"+std::to_string(iter.first);
                     status.hardware_id = "Thruster_"+std::to_string(iter.first);

                     try {


Http cache: reorder some functions. No code change.

I'm just making the order of the methods match the
order of declaration again.

BUG=nonde
TEST=none

Review URL: http://codereview.chromium.org/175042

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@25062 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

--- net/http/http_cache.cc
+++ net/http/http_cache.cc
@@ -263,9 +263,6 @@
   // layer (skipping the cache entirely).
   bool ShouldPassThrough();

-  // Returns true if we should force an end-to-end fetch.
-  bool ShouldBypassCache();
-
   // Called to begin reading from the cache.  Returns network error code.
   int BeginCacheRead();

@@ -333,11 +330,11 @@
   // Called to write response_ to the cache entry.
   void WriteResponseInfoToEntry();

+  // Called to append response data to the cache entry.
+  void AppendResponseDataToEntry(IOBuffer* data, int data_len);
+
   // Called to truncate response content in the entry.
   void TruncateResponseData();
-
-  // Called to append response data to the cache entry.
-  void AppendResponseDataToEntry(IOBuffer* data, int data_len);

   // Called when we are done writing to the cache entry.
   void DoneWritingToEntry(bool success);
@@ -1346,6 +1343,77 @@
     partial_.reset(NULL);
 }

+int HttpCache::Transaction::DoNetworkReadCompleted(int result) {
+  DCHECK(mode_ & WRITE || mode_ == NONE);
+
+  if (revoked())
+    return HandleResult(ERR_UNEXPECTED);
+
+  AppendResponseDataToEntry(read_buf_, result);
+
+  if (partial_.get())
+    return DoPartialNetworkReadCompleted(result);
+
+  if (result == 0)  // End of file.
+    DoneWritingToEntry(true);
+
+  return HandleResult(result);
+}
+
+int HttpCache::Transaction::DoPartialNetworkReadCompleted(int result) {
+  partial_->OnNetworkReadCompleted(result);
+
+  if (result == 0) {  // End of file.
+    if (mode_ == READ_WRITE) {
+      // We need to move on to the next range.
+      network_trans_.reset();
+      result = ContinuePartialCacheValidation();
+      if (result != OK)
+        // Any error was already handled.
+        return result;
+    }
+    DoneWritingToEntry(true);
+  }
+  return HandleResult(result);
+}
+
+int HttpCache::Transaction::DoCacheReadCompleted(int result) {
+  DCHECK(cache_);
+  cache_read_callback_->Release();  // Balance the AddRef() from Start().
+
+  if (revoked())
+    return HandleResult(ERR_UNEXPECTED);
+
+  if (partial_.get())
+    return DoPartialCacheReadCompleted(result);
+
+  if (result > 0) {
+    read_offset_ += result;
+  } else if (result == 0) {  // End of file.
+    cache_->DoneReadingFromEntry(entry_, this);
+    entry_ = NULL;
+  }
+  return HandleResult(result);
+}
+
+int HttpCache::Transaction::DoPartialCacheReadCompleted(int result) {
+  partial_->OnCacheReadCompleted(result);
+
+  if (result == 0) {  // End of file.
+    if (partial_.get() && mode_ == READ_WRITE) {
+      // We need to move on to the next range.
+      result = ContinuePartialCacheValidation();
+      if (result != OK)
+        // Any error was already handled.
+        return result;
+      cache_->ConvertWriterToReader(entry_);
+    }
+    cache_->DoneReadingFromEntry(entry_, this);
+    entry_ = NULL;
+  }
+  return HandleResult(result);
+}
+
 void HttpCache::Transaction::OnNetworkInfoAvailable(int result) {
   DCHECK(result != ERR_IO_PENDING);

@@ -1457,79 +1525,8 @@
   DoNetworkReadCompleted(result);
 }

-int HttpCache::Transaction::DoNetworkReadCompleted(int result) {
-  DCHECK(mode_ & WRITE || mode_ == NONE);
-
-  if (revoked())
-    return HandleResult(ERR_UNEXPECTED);
-
-  AppendResponseDataToEntry(read_buf_, result);
-
-  if (partial_.get())
-    return DoPartialNetworkReadCompleted(result);
-
-  if (result == 0)  // End of file.
-    DoneWritingToEntry(true);
-
-  return HandleResult(result);
-}
-
-int HttpCache::Transaction::DoPartialNetworkReadCompleted(int result) {
-  partial_->OnNetworkReadCompleted(result);
-
-  if (result == 0) {  // End of file.
-    if (mode_ == READ_WRITE) {
-      // We need to move on to the next range.
-      network_trans_.reset();
-      result = ContinuePartialCacheValidation();
-      if (result != OK)
-        // Any error was already handled.
-        return result;
-    }
-    DoneWritingToEntry(true);
-  }
-  return HandleResult(result);
-}
-
 void HttpCache::Transaction::OnCacheReadCompleted(int result) {
   DoCacheReadCompleted(result);
-}
-
-int HttpCache::Transaction::DoCacheReadCompleted(int result) {
-  DCHECK(cache_);
-  cache_read_callback_->Release();  // Balance the AddRef() from Start().
-
-  if (revoked())
-    return HandleResult(ERR_UNEXPECTED);
-
-  if (partial_.get())
-    return DoPartialCacheReadCompleted(result);
-
-  if (result > 0) {
-    read_offset_ += result;
-  } else if (result == 0) {  // End of file.
-    cache_->DoneReadingFromEntry(entry_, this);
-    entry_ = NULL;
-  }
-  return HandleResult(result);
-}
-
-int HttpCache::Transaction::DoPartialCacheReadCompleted(int result) {
-  partial_->OnCacheReadCompleted(result);
-
-  if (result == 0) {  // End of file.
-    if (partial_.get() && mode_ == READ_WRITE) {
-      // We need to move on to the next range.
-      result = ContinuePartialCacheValidation();
-      if (result != OK)
-        // Any error was already handled.
-        return result;
-      cache_->ConvertWriterToReader(entry_);
-    }
-    cache_->DoneReadingFromEntry(entry_, this);
-    entry_ = NULL;
-  }
-  return HandleResult(result);
 }

 //-----------------------------------------------------------------------------


remove workaround for #100729

remove workaround for #100729

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@48820 27541ba8-7e3a-0410-8455-c3a389f83636

--- bindings/pyroot/src/Adapters.cxx
+++ bindings/pyroot/src/Adapters.cxx
@@ -94,14 +94,8 @@
    if ( arg ) {

       std::string name = arg->GetTypeNormalizedName();
-      if ( mod & Rflx::QUALIFIED ) {
-      // CLING WORKAROUND -- #100729 get const info from old method
-         const std::string& fname = arg->GetFullTypeName();
-         if ( fname.substr(0, 5) == "const" )
-            return "const " + name;
-      // -- CLING WORKAROUND
+      if ( mod & Rflx::QUALIFIED )
          return name;
-      }

       if ( mod & Rflx::FINAL )
          name = Utility::ResolveTypedef( name );


fix typos in docstrings

fix typos in docstrings

git-svn-id: 5adfda8227e14e59fd47d5bd9925a30df16fed74@1308 d397654b-2ff0-0310-9e29-ba003691a0f9

--- bindings/python/mapnik_color.cpp
+++ bindings/python/mapnik_color.cpp
@@ -77,12 +77,12 @@
   .add_property("b",
         &color::blue,
         &color::set_blue,
-        "Gets or sets the green component.\n"
+        "Gets or sets the blue component.\n"
         "The value is between 0 and 255.\n")
   .add_property("a",
         &color::alpha,
         &color::set_alpha,
-        "Gets or sets the green component.\n"
+        "Gets or sets the alpha component.\n"
         "The value is between 0 and 255.\n")
   .def(self == self)
   .def_pickle(color_pickle_suite())


[sanitizer_common] Declare __sanitizer_on_print in Windows interception.

Speculative fix for Windows bot.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@373532 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/sanitizer_common/sanitizer_win_weak_interception.cpp
+++ lib/sanitizer_common/sanitizer_win_weak_interception.cpp
@@ -38,6 +38,7 @@

 // Declare weak hooks.
 extern "C" {
+void __sanitizer_on_print(const char *str);
 void __sanitizer_weak_hook_memcmp(uptr called_pc, const void *s1,
                                   const void *s2, uptr n, int result);
 void __sanitizer_weak_hook_strcmp(uptr called_pc, const char *s1,


Removing dead code

Removing dead code

--- miniapps/toys/rubik.cpp
+++ miniapps/toys/rubik.cpp
@@ -244,8 +244,7 @@
       socketstream sock(vishost, visport);
       sock.precision(8);
       sock << "solution\n" << mesh << color << "keys Amaa\n"
-           << "palette 25\n"// << "valuerange -1.5 1\n"
-           << "autoscale off\n" << flush;
+           << "palette 25\n" << "autoscale off\n" << flush;

       while (true)
       {


Updated ESD cut

Updated ESD cut

--- PWGLF/RESONANCES/PostProcessing/Xi1530/NanoCheck/AliAnalysisTaskNanoCheck.cxx
+++ PWGLF/RESONANCES/PostProcessing/Xi1530/NanoCheck/AliAnalysisTaskNanoCheck.cxx
@@ -56,30 +56,14 @@
 const Double_t v0Mass = TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass();

 enum {
-    kSigmaStarPCode = 3224,  // Sigma(1385)+
-    kSigmaStarNCode = 3114,  // Sigma(1385)-
-    kLambdaCode = 3122,      // Lambda
-    kProtonCode = 2212,      // Proton+
-    kPionCode = 211,         // Pion+
-};
-enum {
-    kSigmaStarP = 1,
-    kSigmaStarN,
-    kAntiSigmaStarP,
-    kAntiSigmaStarN,
-    kSigmaStarP_MIX,  // 5
-    kSigmaStarN_MIX,
-    kAntiSigmaStarP_MIX,
-    kAntiSigmaStarN_MIX,
-    kSigmaStarP_GEN,  // 9
-    kSigmaStarN_GEN,
-    kAntiSigmaStarP_GEN,
-    kAntiSigmaStarN_GEN,
-    kSigmaStarP_REC,  // 13
-    kSigmaStarN_REC,
-    kAntiSigmaStarP_REC,
-    kAntiSigmaStarN_REC,
-    kAllType
+    kBefore = 1, // 1
+    kTrackCut,
+    kEtaCut,
+    kpTcut,
+    kPIDcut,
+    kPVDCAcut,
+    krDCACut,
+    kAll
 };

 class AliAnalysisTaskNanoCheck;
@@ -108,12 +92,12 @@
 AliAnalysisTaskNanoCheck::~AliAnalysisTaskNanoCheck() {}
 //_____________________________________________________________________________
 void AliAnalysisTaskNanoCheck::UserCreateOutputObjects() {
-    fTrackCuts = new AliESDtrackCuts();
-    fTrackCuts->GetStandardITSTPCTrackCuts2011(kTRUE, kTRUE);
-    fTrackCuts->SetEtaRange(-0.8, 0.8);
-    fTrackCuts->SetPtRange(0.15, 1e20);
-
-    fHistos = new THistManager("Sigma1385hists");
+    fTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
+    //fTrackCuts->GetStandardITSTPCTrackCuts2011();
+    //fTrackCuts->SetEtaRange(-0.8, 0.8);
+    //fTrackCuts->SetPtRange(0.15, 1e20);
+
+    fHistos = new THistManager("NanoCheckhists");

     std::vector<double> centaxisbin = {
         0,  1,  5,  10, 15, 20, 30,
@@ -122,9 +106,12 @@
     auto binPt = AxisFix("Pt", 200, 0, 20);
     auto binMass = AxisFix("Mass", 2000, 1.0, 3.0);
     binZ = AxisVar("Z", {-10, -5, -3, -1, 1, 3, 5, 10});
+    auto hNumofTracks = AxisStr("Type", {"before", "trackCut", "etaCut", "pTcut", "nPIDcut",
+                                    "dPVDCAcut", "rDCACut", "all"});

     fEventCuts.AddQAplotsToList(fHistos->GetListOfHistograms());
     fHistos->CreateTH1("hMultiplicity", "", 100, 0, 100, "s");
+    //fHistos->CreateTH1("QA/hNtracks", "", {hNumofTracks});
     fHistos->CreateTH2("QA/hTPCPIDPion", "", 200, 0, 20, 2000, 0, 200);
     fHistos->CreateTH1("QA/hEtaPion", "", 40, -2, 2);
     fHistos->CreateTH1("QA/hDCADPVPion", "", 300, 0, 3, "s");
@@ -266,7 +253,7 @@
         fHistos->FillTH1("QA/hDCADPVPion", pionZ);
         fHistos->FillTH1("QA/hEtaPion", fEta);
         fHistos->FillTH2("QA/hTPCPIDPion", track->GetTPCmomentum(), track->GetTPCsignal());
-
+
         if (abs(fTPCNSigPion) > fTPCNsigSigmaStarPionCut)
             continue;
         if (fEta > fSigmaStarPionEtaCut)


Point to production poi instance and use versioned API

--- src/Search/EegeoPois/SdkModel/EegeoSearchQuery.cpp
+++ src/Search/EegeoPois/SdkModel/EegeoSearchQuery.cpp
@@ -31,7 +31,7 @@
                     urlEncoder.UrlEncode(query.Query(), encodedQuery);

                     std::stringstream urlstream;
-                    urlstream << "https://poi-staging.eegeo.com";
+                    urlstream << "https://poi.eegeo.com/v1";
                     if (query.IsCategory())
                     {
                         urlstream << "/category?c=";


Introduced init channel as argument

Introduced init channel as argument

--- lidar_odometry/src/lidar_odometry/lidar-odometry-app.cpp
+++ lidar_odometry/src/lidar_odometry/lidar-odometry-app.cpp
@@ -20,6 +20,7 @@
   bool use_velodyne;
   bool init_with_message; // initialize off of a pose or vicon
   std::string output_channel;
+  std::string init_channel;
 };

 class App{
@@ -90,7 +91,7 @@
     pose_initialized_ = true;
   }else{
     lcm_->subscribe("VICON_BODY|VICON_FRONTPLATE",&App::rigidTransformInitHandler,this);
-    lcm_->subscribe("POSE_VICON",&App::poseInitHandler,this);
+    lcm_->subscribe(cl_cfg_.init_channel,&App::poseInitHandler,this);
     std::cout << "Waiting for Init message to LIDAR estimator\n";
   }

@@ -213,6 +214,7 @@
   parser.add(cl_cfg.init_with_message, "g", "init_with_message", "Bootstrap internal estimate using VICON or POSE_INIT");
   parser.add(cl_cfg.output_channel, "o", "output_channel", "Output message e.g POSE_BODY");
   parser.add(cl_cfg.use_velodyne, "v", "use_velodyne", "Use a velodyne instead of the LIDAR");
+  parser.add(cl_cfg.init_channel, "i", "init_channel", "Read the init message from this channel, e.g., POSE_GROUND_TRUTH");
   parser.parse();

   boost::shared_ptr<lcm::LCM> lcm(new lcm::LCM);


Start with h5-tests'

Start with h5-tests'

--- minitests/minitests.cpp
+++ minitests/minitests.cpp
@@ -92,13 +92,7 @@
     return allOk;
 }

-int main(int argc, char *argv[]) {
-    string name="test";
-    cpInitCompute(name);
-    int ret=0;
-    ret=0;
-    //doTests();
-
+void initTest() {
     cerr << "standard init=============" << endl;
     trainTest("standard");
     cerr << "normal init===============" << endl;
@@ -107,9 +101,9 @@
     trainTest("orthonormal");
     cerr << "orthogonal init==========" << endl;
     trainTest("orthogonal");
-    cpExitCompute();
-
+}

+void jsonTest() {
     json j;
     j["test"]=vector<int>{3,4,5};
     j["turbo"]["traffic"]["tangente"]=3.13;
@@ -136,6 +130,40 @@
     cerr << j2["turbo"]<<endl;
     cerr << j.dump(4) << endl;
     cerr << j2.dump(4) << endl;
+}
+
+void hd5Test() {
+    int inputShapeFlat=1024;
+    int hidden=1024;
+    string inittype{"standard"};
+    floatN initfactor=1.0;
+
+    json j1;
+    j1["inputShape"]=vector<int>{inputShapeFlat};
+    j1["hidden"]=hidden;
+    j1["init"]=inittype;
+    j1["initfactor"]=initfactor;
+
+    string filepath{"minitest.h5"};
+    H5::H5File file((H5std_string)filepath, H5F_ACC_TRUNC );
+    // H5File file(FILE_NAME, H5F_ACC_RDWR);
+
+    Affine *af=new Affine(j1);
+    af->saveParameters(&file);
+    file.close();
+
+    H5::H5File fmn((H5std_string)filepath, H5F_ACC_RDONLY);
+
+}
+
+int main(int argc, char *argv[]) {
+    string name="test";
+    cpInitCompute(name);
+    int ret=0;
+
+    hd5Test();
+
+    cpExitCompute();
     return ret;

 }


Write color for Box and Collada when exporting for blender

--- src/blender-geom-writer.cc
+++ src/blender-geom-writer.cc
@@ -58,6 +58,37 @@
       os << "( " << q.w() << ", " << q.x() << ", " << q.y() << ", " << q.z() << ", )";
       return os;
     }
+
+    std::ostream& writeRGB(std::ostream& os, const osgVector4& rgba)
+    {
+      return os << "( " << rgba.r() << ", " << rgba.g() << ", " << rgba.b() << ", )";
+    }
+
+    std::string writeMaterial(std::ostream& os, const std::string& name, const osg::Material* mat,
+        bool diffuse = true, bool ambient = false, bool specular = false) {
+      const std::string var = "material";
+      const osg::Material::Face face = osg::Material::FRONT;
+      os << var << " = bpy.data.materials.new(\"" << name << "\")" << end;
+      if (diffuse)
+        writeRGB (os << var << ".diffuse_color = ", mat->getDiffuse(face)) << end
+          << var << ".diffuse_intensity = " << mat->getDiffuse(face).a() << end;
+      if (ambient)
+        writeRGB (os << var << ".ambient_color = ", mat->getAmbient(face)) << end
+          << var << ".ambient_intensity = " << mat->getAmbient(face).a() << end;
+      if (specular)
+        writeRGB (os << var << ".specular_color = ", mat->getSpecular(face)) << end
+          << var << ".specular_intensity = " << mat->getSpecular(face).a() << end;
+      return var;
+    }
+
+    std::string writeMaterial(std::ostream& os, const std::string& name, const osgVector4& rgbaDiffuse)
+    {
+      const std::string var = "material";
+      os << var << " = bpy.data.materials.new(\"" << name << "\")" << end;
+      writeRGB (os << var << ".diffuse_color = ", rgbaDiffuse) << end
+        << var << ".diffuse_intensity = " << rgbaDiffuse.a() << end;
+      return var;
+    }
   }

   BlenderGeomWriterVisitor::BlenderGeomWriterVisitor (const std::string& filename)
@@ -67,6 +98,16 @@
     const std::string comment = (isNew ? "" : "# ");
     out() << comment << "import bpy" << end << end
       << comment << "## Start convenient functions" << end
+      << comment << "def checkConf():" << end
+      << comment << "  if bpy.app.version[0:2] != (2, 75):" << end
+      << comment << "    print \"Using blender version\", bpy.app.version" << end
+      << comment << "    print \"Developed under version 2.75.0.\"" << end
+      << comment << "    return False" << end
+      << comment << "  if bpy.context.scene.render.engine != 'CYCLES':" << end
+      << comment << "    print \"Cycles renderer is prefered\"" << end
+      << comment << "    return False" << end
+      << comment << "  return True" << end
+      << comment << end
       << comment << "taggedObjects = list()" << end
       << comment << "def tagObjects ():" << end
       << comment << "  global taggedObjects" << end
@@ -81,6 +122,11 @@
       << comment << "def setParent (children, parent):" << end
       << comment << "  for child in children:" << end
       << comment << "    child.parent = parent" << end << end
+      << comment << "" << end
+      << comment << "def setMaterial (children, mat):" << end
+      << comment << "  for child in children:" << end
+      << comment << "    child.data.materials.append(mat)" << end << end
+      << comment << "checkConf()" << end << end
       << comment << "## End of convenient functions" << end;
   }

@@ -130,6 +176,10 @@
       << "bpy.ops.mesh.primitive_cube_add ()" << end
       << "bpy.context.object.dimensions = ";
     writeVectorAsList(out(), node.getHalfAxis()*2) << end;
+
+    const std::string var_mat = writeMaterial(out(), node.getID() + "__mat", node.getColor());
+    out () << "bpy.context.object.data.materials.append(" << var_mat << ')' << end;
+
     standardApply(static_cast<Node&>(node));
   }
   void BlenderGeomWriterVisitor::apply (LeafNodeCapsule& node)
@@ -164,6 +214,14 @@
       << "print(imported_objects)" << end
       << "bpy.ops.object.empty_add ()" << end
       << "setParent (imported_objects, bpy.context.object)" << end;
+
+    osg::Material* mat_ptr = dynamic_cast<osg::Material*> (
+        node.getOsgNode()->getStateSet()->getAttribute(osg::StateAttribute::MATERIAL));
+    if (mat_ptr != NULL) { // Color was set by URDF
+      const std::string var_mat = writeMaterial(out(), node.getID() + "__mat", mat_ptr, true, false, false);
+      out () << "setMaterial (imported_objects, " << var_mat << ')' << end;
+    }
+
     standardApply(node);
   }
   void BlenderGeomWriterVisitor::apply (LeafNodeCone& node)


Less data included.

Less data included.

--- TUSCore/GameServer/Building/Operators/BuildBuilding/BuildBuildingOperator.cpp
+++ TUSCore/GameServer/Building/Operators/BuildBuilding/BuildBuildingOperator.cpp
@@ -26,7 +26,7 @@
 // SUCH DAMAGE.

 #include <GameServer/Building/Operators/BuildBuilding/BuildBuildingOperator.hpp>
-#include <GameServer/Configuration/Configurator/Building/ConfiguratorBuilding.hpp>
+#include <GameServer/Configuration/Configurator/Building/IBuilding.hpp>

 using namespace GameServer::Common;
 using namespace GameServer::Configuration;


ENH: Sampling of points from the fixed image added. The pointSet was empty      before that.

--- Testing/Code/Algorithms/itkNormalizedCorrelationPointSetToImageMetricTest.cxx
+++ Testing/Code/Algorithms/itkNormalizedCorrelationPointSetToImageMetricTest.cxx
@@ -21,6 +21,7 @@
 #include "itkGaussianImageSource.h"
 #include "itkImage.h"
 #include "itkPointSet.h"
+#include "itkImageRegionIterator.h"

 #include <iostream>

@@ -93,14 +94,40 @@
 //-----------------------------------------------------------
   typedef itk::PointSet< float, 2 >   FixedPointSetType;
   FixedPointSetType::Pointer fixedPointSet = FixedPointSetType::New();
-  fixedPointSet->GetPoints()->Reserve( 100 );
-  fixedPointSet->GetPointData()->Reserve( 100 );
-
-  for(unsigned int y=0; y<100; y+=10)
-    {
-    for(unsigned int x=0; x<100; x+=10)
+
+  const unsigned int numberOfPoints = 100;
+
+  fixedPointSet->GetPoints()->Reserve( numberOfPoints );
+  fixedPointSet->GetPointData()->Reserve( numberOfPoints );
+
+  itk::ImageRegionIterator< FixedImageType > it( fixedImage,
+                                            fixedImage->GetBufferedRegion() );
+
+  const unsigned int skip =
+      fixedImage->GetBufferedRegion().GetNumberOfPixels() / numberOfPoints;
+
+  unsigned int counter = skip;
+
+  FixedPointSetType::PointIdentifier pointId = 0;
+  FixedPointSetType::PointType  point;
+
+  it.GoToBegin();
+  while( !it.IsAtEnd() )
+    {
+    if( counter==0 )
       {
+      fixedImage->TransformIndexToPhysicalPoint( it.GetIndex(), point );
+      fixedPointSet->SetPoint( pointId, point );
+      fixedPointSet->SetPointData( pointId, it.Get() );
+      ++pointId;
+      if( pointId == numberOfPoints )
+        {
+        break;
+        }
+      counter = skip;
       }
+    --counter;
+    ++it;
     }


[depthMap] CudaHostMemoryHeap is now actually CUDA pinned memory

--- src/aliceVision/depthMap/cuda/commonStructures.hpp
+++ src/aliceVision/depthMap/cuda/commonStructures.hpp
@@ -138,7 +138,12 @@
     if (Dim >= 1) sx = _size[0];
     if (Dim >= 2) sy = _size[1];
     if (Dim >= 3) sx = _size[2];
-    buffer = (Type*)malloc(sx * sy * sz * sizeof (Type));
+    // buffer = (Type*)malloc(sx * sy * sz * sizeof (Type));
+    cudaError_t err = cudaMallocHost( &buffer, sx * sy * sz * sizeof (Type) );
+    if( err != cudaSuccess )
+    {
+        ALICEVISION_LOG_ERROR( "Could not allocate pinned host memory, " << cudaGetErrorString(err) );
+    }
     memset(buffer, 0, sx * sy * sz * sizeof (Type));
   }
   CudaHostMemoryHeap<Type,Dim>& operator=(const CudaHostMemoryHeap<Type,Dim>& rhs)
@@ -150,13 +155,18 @@
     if (Dim >= 1) sx = rhs.sx;
     if (Dim >= 2) sy = rhs.sy;
     if (Dim >= 3) sx = rhs.sz;
-    buffer = (Type*)malloc(sx * sy * sz * sizeof (Type));
+    // buffer = (Type*)malloc(sx * sy * sz * sizeof (Type));
+    cudaError_t err = cudaMallocHost( &buffer, sx * sy * sz * sizeof (Type) );
+    if( err != cudaSuccess )
+    {
+        ALICEVISION_LOG_ERROR( "Could not allocate pinned host memory, " << cudaGetErrorString(err) );
+    }
     memcpy(buffer, rhs.buffer, sx * sy * sz * sizeof (Type));
     return *this;
   }
   ~CudaHostMemoryHeap()
   {
-    free(buffer);
+    cudaFreeHost(buffer);
   }
   const CudaSize<Dim>& getSize() const
   {
@@ -173,6 +183,10 @@
   const Type *getBuffer() const
   {
     return buffer;
+  }
+  Type& operator()(size_t x)
+  {
+    return buffer[x];
   }
   Type& operator()(size_t x, size_t y)
   {
@@ -301,6 +315,66 @@
     return s;
   }

+};
+
+template <class Type> class CudaDeviceMemory
+{
+  Type* buffer;
+  size_t sx;
+public:
+  explicit CudaDeviceMemory(const size_t size)
+  {
+    cudaError_t err;
+
+    sx = size;
+    err = cudaMalloc(&buffer, sx * sizeof(Type) );
+    if( err != cudaSuccess )
+    {
+        ALICEVISION_LOG_ERROR( "Could not allocate pinned host memory, " << cudaGetErrorString(err) );
+    }
+  }
+
+  ~CudaDeviceMemory()
+  {
+    cudaFree(buffer);
+  }
+
+  explicit inline CudaDeviceMemory(const CudaHostMemoryHeap<Type,1> &rhs)
+  {
+    cudaError_t err;
+
+    sx = rhs.getSize()[0];
+
+    err = cudaMalloc(&buffer, sx * sizeof(Type) );
+    if( err != cudaSuccess )
+    {
+        ALICEVISION_LOG_ERROR( "Could not allocate pinned host memory, " << cudaGetErrorString(err) );
+    }
+
+    copy(*this, rhs);
+  }
+
+  CudaDeviceMemory<Type> & operator=(const CudaDeviceMemory<Type> & rhs)
+  {
+    copy(*this, rhs);
+    return *this;
+  }
+  size_t getSize() const
+  {
+    return sx;
+  }
+  size_t getBytes() const
+  {
+    return sx*sizeof(Type);
+  }
+  Type *getBuffer()
+  {
+    return buffer;
+  }
+  const Type *getBuffer() const
+  {
+    return buffer;
+  }
 };

 template <class Type, unsigned Dim> class CudaArray
@@ -501,6 +575,16 @@
         ALICEVISION_LOG_ERROR( "Failed to copy : " << __FILE__ << " " << __LINE__ << ", " << cudaGetErrorString(err) );
       }
     }
+  }
+}
+
+template<class Type> void copy(CudaHostMemoryHeap<Type,1>& _dst, const CudaDeviceMemory<Type>& _src)
+{
+  cudaMemcpyKind kind = cudaMemcpyDeviceToHost;
+  cudaError_t err = cudaMemcpy(_dst.getBuffer(), _src.getBuffer(), _src.getBytes(), kind);
+  if( err != cudaSuccess )
+  {
+    ALICEVISION_LOG_ERROR( "Failed to copy from CudaHostMemoryHeap to CudaDeviceMemory: " << cudaGetErrorString(err) );
   }
 }

@@ -634,6 +718,16 @@
   }
 }

+template<class Type> void copy(CudaDeviceMemory<Type>& _dst, const CudaHostMemoryHeap<Type,1>& _src)
+{
+  cudaMemcpyKind kind = cudaMemcpyHostToDevice;
+  cudaError_t err = cudaMemcpy(_dst.getBuffer(), _src.getBuffer(), _src.getBytes(), kind);
+  if( err != cudaSuccess )
+  {
+    ALICEVISION_LOG_ERROR( "Failed to copy from CudaHostMemoryHeap to CudaDeviceMemory: " << cudaGetErrorString(err) );
+  }
+}
+
 template<class Type, unsigned Dim> void copy(CudaDeviceMemoryPitched<Type, Dim>& _dst, const CudaArray<Type, Dim>& _src)
 {
   cudaMemcpyKind kind = cudaMemcpyDeviceToDevice;


GridNavigator now prevents units from moving along the y-axis.

--- VajraFramework/ExampleGame/Code/ExampleGame/Components/Grid/GridNavigator.cpp
+++ VajraFramework/ExampleGame/Code/ExampleGame/Components/Grid/GridNavigator.cpp
@@ -216,6 +216,9 @@
 	int count = this->currentPath.size();
 	while ((distToTravel > 0.0f) && (count > 0)) {
 		glm::vec3 targetLocation = this->currentPath.front()->center;
+		// Prevent movement along y-axis.
+		targetLocation.y = tempLocation.y;
+
 		float distToTarget = glm::distance(tempLocation, targetLocation);

 		if (distToTravel >= distToTarget) {


ash: Use correct cursor when dragging out a tab over the omnibox

Dragging a tab out of the tabstrip by dragging it down over the omnibox can
result in an I-beam cursor during the move-drag of the new window. This
happens because RunMoveLoop() from the TabDragController releases mouse
capture for the source browser window, which resets the cursor pointer based
on the last mouse position. This will be an I-beam if the mouse was over the
omnibox.

Since we don't ever want an old/out-of-date cursor during a window drag,
sanitize it to an arrow pointer for mouse-based window moves.

BUG=242118
TEST=manual, slowly drag out a tab downward over the omnibox

Review URL: https://chromiumcodereview.appspot.com/19035002

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@212644 0039d316-1c4b-4281-b951-d872f2087c98

--- ash/wm/toplevel_window_event_handler.cc
+++ ash/wm/toplevel_window_event_handler.cc
@@ -324,11 +324,13 @@
     aura::Window::ConvertPointToTarget(
         root_window, source->parent(), &drag_location);
   }
-  CreateScopedWindowResizer(source, drag_location, HTCAPTION, move_source);
+  // Set the cursor before calling CreateScopedWindowResizer(), as that will
+  // eventually call LockCursor() and prevent the cursor from changing.
   aura::client::CursorClient* cursor_client =
       aura::client::GetCursorClient(root_window);
   if (cursor_client)
     cursor_client->SetCursor(ui::kCursorPointer);
+  CreateScopedWindowResizer(source, drag_location, HTCAPTION, move_source);
   bool destroyed = false;
   destroyed_ = &destroyed;
 #if !defined(OS_MACOSX)


Fixed test app device object creation

Fixed test app device object creation

--- test/lwm2mtestapplication/lwm2mtest.cpp
+++ test/lwm2mtestapplication/lwm2mtest.cpp
@@ -190,7 +190,12 @@
         if(_device->create_resource(resource,value)) {
             success = true;
         } else {
-            success = _device->set_resource_value(resource,value);
+            if (_device->create_resource_instance(resource, value, 0)) {
+                success = true;
+            }
+            else {
+                success = _device->set_resource_value(resource, value);
+            }
         }
     }
     return success;


Add backwards compatibility for cloud_type,fmi_weather_symbol_1,rain_type

--- himan-bin/source/himan.cpp
+++ himan-bin/source/himan.cpp
@@ -121,17 +121,22 @@
 			aTimer->Start();
 		}

-		if (pc->Name() == "precipitation")
-		{
-			aLogger->Warning("Plugin 'precipitation' is deprecated -- use 'split_sum' instead'");
-			pc->Name("split_sum");
-		}
-		else if (pc->Name() == "kindex")
-		{
-			aLogger->Warning("Plugin 'kindex' is deprecated -- use 'stability' instead'");
-			pc->Name("stability");
-		}
-
+		if (pc->Name() == "cloud_type")
+		{
+			aLogger->Warning("Plugin 'cloud_type' is deprecated -- use 'cloud_code' instead'");
+			pc->Name("cloud_code");
+		}
+		else if (pc->Name() == "fmi_weather_symbol_1")
+		{
+			aLogger->Warning("Plugin 'fmi_weather_symbol_1' is deprecated -- use 'weather_code_2' instead'");
+			pc->Name("weather_code_2");
+		}
+		else if (pc->Name() == "rain_type")
+		{
+			aLogger->Warning("Plugin 'rain_type' is deprecated -- use 'weather_code_1' instead'");
+			pc->Name("weather_code_1");
+		}
+
 		auto aPlugin = dynamic_pointer_cast<plugin::compiled_plugin > (plugin_factory::Instance()->Plugin(pc->Name()));

 		if (!aPlugin)


Cover serialized_size_from_first_byte in tests

Signed-off-by: Piotr Jastrzebski <2c0eb4a25a7cde333ff2d0860cb06051925fd74f@scylladb.com>

--- tests/vint_serialization_test.cc
+++ tests/vint_serialization_test.cc
@@ -39,6 +39,15 @@
     return static_cast<bytes::value_type>(value);
 }

+template <class Vint>
+void test_serialized_size_from_first_byte(vint_size_type size, bytes_view bytes) {
+}
+
+template <>
+void test_serialized_size_from_first_byte<unsigned_vint>(vint_size_type size, bytes_view bytes) {
+    BOOST_REQUIRE_EQUAL(size, unsigned_vint::serialized_size_from_first_byte(bytes[0]));
+}
+
 // Check that the encoded value decodes back to the value. Also allows inspecting the encoded bytes.
 template <class Vint, class BytesInspector>
 void check_bytes_and_roundtrip(typename Vint::value_type value, BytesInspector&& f) {
@@ -51,6 +60,7 @@
     const auto deserialized = Vint::deserialize(view);
     BOOST_REQUIRE_EQUAL(deserialized.value, value);
     BOOST_REQUIRE_EQUAL(deserialized.size, size);
+    test_serialized_size_from_first_byte<Vint>(size, view);
 };

 // Check that the encoded value decodes back to the value.


In the help response added begin and end tags called handler to separate the different hander help responses and added a tag called name within the handler tag to say which handler this help is for

--- CDFRequestHandler.cc
+++ CDFRequestHandler.cc
@@ -116,6 +116,8 @@
 CDFRequestHandler::cdf_build_help( BESDataHandlerInterface &dhi )
 {
     BESInfo *info = dynamic_cast<BESInfo *>(dhi.response_handler->get_response_object());
+    info->begin_tag( "Handler" ) ;
+    info->add_tag( "name", PACKAGE_NAME ) ;
     string handles = (string)DAS_RESPONSE
                      + "," + DDS_RESPONSE
                      + "," + DATA_RESPONSE
@@ -123,6 +125,7 @@
                      + "," + VERS_RESPONSE ;
     info->add_tag( "handles", handles ) ;
     info->add_tag( "version", PACKAGE_STRING ) ;
+    info->end_tag( "Handler" ) ;
     return true ;
 }


[AMQCPP-30] Fixed initialization of magic member in OpenwireFormatInfo

git-svn-id: 0fb8a5a922afe2085ae9a967a0cf0864fe09ecff@506129 13f79535-47bb-0310-9956-ffa450edef68

--- activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp
+++ activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp
@@ -31,6 +31,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 WireFormatInfo::WireFormatInfo()
 {
+    // Initialize the static MAGIC buffer.
     if( MAGIC.empty() ) {
         MAGIC.push_back( 'A' );
         MAGIC.push_back( 'c' );
@@ -40,6 +41,12 @@
         MAGIC.push_back( 'e' );
         MAGIC.push_back( 'M' );
         MAGIC.push_back( 'Q' );
+    }
+
+    // Initialize member magic buffer to the static buffer.
+    magic.resize( MAGIC.size() );
+    for( int ix=0; ix<MAGIC.size(); ++ix ){
+        magic[ix] = MAGIC[ix];
     }
 }


INTEGRATION: CWS changefileheader (1.2.22); FILE MERGED 2008/04/01 16:02:46 thb 1.2.22.3: #i85898# Stripping all external header guards 2008/04/01 12:58:45 thb 1.2.22.2: #i85898# Stripping all external header guards 2008/03/31 15:31:30 rt 1.2.22.1: #i87441# Change license header to LPGL v3.

--- ucbhelper/inc/ucbhelper/simplecertificatevalidationrequest.hxx
+++ ucbhelper/inc/ucbhelper/simplecertificatevalidationrequest.hxx
@@ -1,53 +1,40 @@
 /*************************************************************************
  *
- *  OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *  $RCSfile: simplecertificatevalidationrequest.hxx,v $
+ * Copyright 2008 by Sun Microsystems, Inc.
  *
- *  $Revision: 1.2 $
+ * OpenOffice.org - a multi-platform office productivity suite
  *
- *  last change: $Author: rt $ $Date: 2007-11-07 10:08:02 $
+ * $RCSfile: simplecertificatevalidationrequest.hxx,v $
+ * $Revision: 1.3 $
  *
- *  The Contents of this file are made available subject to
- *  the terms of GNU Lesser General Public License Version 2.1.
+ * This file is part of OpenOffice.org.
  *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
  *
- *    GNU Lesser General Public License Version 2.1
- *    =============================================
- *    Copyright 2005 by Sun Microsystems, Inc.
- *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
  *
- *    This library is free software; you can redistribute it and/or
- *    modify it under the terms of the GNU Lesser General Public
- *    License version 2.1, as published by the Free Software Foundation.
- *
- *    This 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 this library; if not, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *    MA  02111-1307  USA
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
  *
  ************************************************************************/

 #ifndef _UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX
 #define _UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX

-#ifndef _RTL_REF_HXX_
 #include <rtl/ref.hxx>
-#endif
-#ifndef _UCBHELPER_INTERATIONREQUEST_HXX
 #include <ucbhelper/interactionrequest.hxx>
-#endif
-#ifndef INCLUDED_UCBHELPERDLLAPI_H
 #include "ucbhelper/ucbhelperdllapi.h"
-#endif
-#ifndef _COM_SUN_STAR_SECURITY_XCERTIFICATE_HPP_
 #include <com/sun/star/security/XCertificate.hpp>
-#endif

 namespace ucbhelper {


Remove unused code.

Remove unused code.

--- OpenGLESApp2/OpenGLESApp2.Android.NativeActivity/Renderer.cpp
+++ OpenGLESApp2/OpenGLESApp2.Android.NativeActivity/Renderer.cpp
@@ -1018,29 +1018,6 @@
 			}
 			glDrawElements(GL_TRIANGLES, obj.Mesh()->iboSize, GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(obj.Mesh()->iboOffset));
 		}
-		// ̉e(Ƃ肠̂őp).
-		if (0) {
-		  Matrix4x3 m = Matrix4x3::Unit();
-		  m.Set(0, 3, eye.x);
-		  m.Set(1, 3, eye.y);
-		  m.Set(2, 3, eye.z);
-		  glUniform4fv(shader.bones, 3, m.f); // sړ܂܂ȂMatrix4x4Matrix4x3̑pɂȂ肤邯ǂsV.
-		  const Mesh& mesh = meshList["Sphere"];
-		  glDrawElements(GL_TRIANGLES, mesh.iboSize, GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(mesh.iboOffset));
-		}
-#if 0
-		{
-		  Matrix4x4 m = Matrix4x4::RotationX(degreeToRadian(90.0f));
-		  // nʂ͗ʂȂ߁A-YɃItZbg邱ƂŗʂƂ.
-		  {
-			glCullFace(GL_BACK);
-			m.Set(1, 3, -0.01f);
-		  }
-		  glUniform4fv(shader.bones, 3, m.f); // sړ܂܂ȂMatrix4x4Matrix4x3̑pɂȂ肤邯ǂsV.
-		  const Mesh& mesh = meshList["ground"];
-		  glDrawElements(GL_TRIANGLES, mesh.iboSize, GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(mesh.iboOffset));
-		}
-#endif
 		if(0){
 		  glCullFace(GL_BACK);
 		  // sqrt(480*480+800*800)/480=1.94365063


fixed assert when receiving invalid piece

git-svn-id: c39a6fcb73c71bf990fd9353909696546eb40440@3400 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- src/bt_peer_connection.cpp
+++ src/bt_peer_connection.cpp
@@ -1178,12 +1178,12 @@
 			// call this once, the first time the entire header
 			// has been received
 			start_receive_piece(p);
+			if (is_disconnecting()) return;
 		}

 		TORRENT_ASSERT(has_disk_receive_buffer() || packet_size() == header_size);

 		incoming_piece_fragment(piece_bytes);
-		if (is_disconnecting()) return;
 		if (!packet_finished()) return;

 		if (merkle && list_size > 0)


Fix possible null pointer dereference.

Fix possible null pointer dereference.

--- mlt/service_manager.cpp
+++ mlt/service_manager.cpp
@@ -248,7 +248,8 @@
 {
     mlt_consumer consumer = static_cast<mlt_consumer>(mlt_properties_get_data(MLT_SERVICE_PROPERTIES(service), "consumer", 0));
     mlt_events_disconnect(MLT_CONSUMER_PROPERTIES(consumer), this);
-    effects->renderComplete(false);
-}
-
-}
+    if (effects)
+        effects->renderComplete(false);
+}
+
+}


fix one more ifdef issue

fix one more ifdef issue

--- src/bt_peer_connection.cpp
+++ src/bt_peer_connection.cpp
@@ -121,7 +121,11 @@
 #ifndef TORRENT_DISABLE_EXTENSIONS
 		, m_upload_only_id(0)
 		, m_holepunch_id(0)
+#endif
+#ifndef TORRENT_DISABLE_ENCRYPTION
 		, m_sync_bytes_read(0)
+#endif
+#ifndef TORRENT_DISABLE_EXTENSIONS
 		, m_dont_have_id(0)
 		, m_share_mode_id(0)
 #endif


fix one more assert (hopefully)

fix one more assert (hopefully)

--- src/bt_peer_connection.cpp
+++ src/bt_peer_connection.cpp
@@ -531,10 +531,7 @@
 		write_pe_vc_cryptofield(send_buf, crypto_provide, pad_size);
 		m_RC4_handler->encrypt(send_buf.end - encrypt_size, encrypt_size);
 #ifdef TORRENT_DEBUG
-		const int packet_size = 20 + 20 + 8 + 4 + 2 + pad_size + 2;
-		TORRENT_ASSERT(send_buffer_size() - packet_size == m_encrypted_bytes);
-		m_encrypted_bytes += packet_size;
-		TORRENT_ASSERT(m_encrypted_bytes == send_buffer_size());
+		m_encrypted_bytes = send_buffer_size();
 #endif

 		TORRENT_ASSERT(send_buf.begin == send_buf.end);


pass the appropriate event number

pass the appropriate event number

--- PWG/CaloTrackCorrBase/AliAnalysisTaskCaloTrackCorrelation.cxx
+++ PWG/CaloTrackCorrBase/AliAnalysisTaskCaloTrackCorrelation.cxx
@@ -184,7 +184,7 @@
 /// Execute analysis for current event.
 //______________________________________________________________________
 void AliAnalysisTaskCaloTrackCorrelation::UserExec(Option_t */*option*/)
-{
+{
   if ( !fAna->IsEventProcessed() ) return;

   Int_t eventN = Entry();
@@ -195,7 +195,7 @@
     if ( (AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler() )
       eventN = ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()->GetReadEntry());
   }
-
+
   if ( (fLastEvent  > 0 && eventN > fLastEvent )  ||
        (fFirstEvent > 0 && eventN < fFirstEvent)     ) return ;

@@ -217,7 +217,7 @@
   fAna->GetReader()->SetInputOutputMCEvent(InputEvent(), AODEvent(), MCEvent());

   // Process event
-  fAna->ProcessEvent((Int_t) Entry(), CurrentFileName());
+  fAna->ProcessEvent(eventN, CurrentFileName());

   PostData(1, fOutputContainer);


Minor comment fix.

Minor comment fix.

--- samples/StereoscopicRendering/src/StereoscopicRenderingApp.cpp
+++ samples/StereoscopicRendering/src/StereoscopicRenderingApp.cpp
@@ -257,7 +257,7 @@
 		}
 		gl::popModelView();

-		// draw animated balls
+		// draw animated notes
 		Rand rnd;
 		for(int i=-100; i<=100; ++i) {
 			rnd.seed(i);


fix merkle torrents assert

fix merkle torrents assert

git-svn-id: c39a6fcb73c71bf990fd9353909696546eb40440@5857 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- src/bt_peer_connection.cpp
+++ src/bt_peer_connection.cpp
@@ -1111,12 +1111,36 @@
 		// classify the received data as protocol chatter
 		// or data payload for the statistics
 		int piece_bytes = 0;
-		if (recv_pos <= 9)
+
+		int header_size = merkle?13:9;
+
+		peer_request p;
+		int list_size = 0;
+
+		if (recv_pos >= header_size)
+		{
+			const char* ptr = recv_buffer.begin + 1;
+			p.piece = detail::read_int32(ptr);
+			p.start = detail::read_int32(ptr);
+
+			if (merkle)
+			{
+				list_size = detail::read_int32(ptr);
+				p.length = packet_size() - list_size - header_size;
+				header_size += list_size;
+			}
+			else
+			{
+				p.length = packet_size() - header_size;
+			}
+		}
+
+		if (recv_pos <= header_size)
 		{
 			// only received protocol data
 			m_statistics.received_bytes(0, received);
 		}
-		else if (recv_pos - received >= 9)
+		else if (recv_pos - received >= header_size)
 		{
 			// only received payload data
 			m_statistics.received_bytes(received, 0);
@@ -1125,35 +1149,16 @@
 		else
 		{
 			// received a bit of both
-			TORRENT_ASSERT(recv_pos - received < 9);
-			TORRENT_ASSERT(recv_pos > 9);
-			TORRENT_ASSERT(9 - (recv_pos - received) <= 9);
+			TORRENT_ASSERT(recv_pos - received < header_size);
+			TORRENT_ASSERT(recv_pos > header_size);
+			TORRENT_ASSERT(header_size - (recv_pos - received) <= header_size);
 			m_statistics.received_bytes(
-				recv_pos - 9
-				, 9 - (recv_pos - received));
-			piece_bytes = recv_pos - 9;
-		}
-
-		const int header_size = merkle?13:9;
+				recv_pos - header_size
+				, header_size - (recv_pos - received));
+			piece_bytes = recv_pos - header_size;
+		}

 		if (recv_pos < header_size) return;
-
-		const char* ptr = recv_buffer.begin + 1;
-		peer_request p;
-		p.piece = detail::read_int32(ptr);
-		p.start = detail::read_int32(ptr);
-
-		int list_size = 0;
-
-		if (merkle)
-		{
-			list_size = detail::read_int32(ptr);
-			p.length = packet_size() - list_size - header_size;
-		}
-		else
-		{
-			p.length = packet_size() - header_size;
-		}

 #ifdef TORRENT_VERBOSE_LOGGING
 //			peer_log("<== PIECE_FRAGMENT p: %d start: %d length: %d"


adding shared cluster cut for dptdpt analysis

- cuts with more than 0 (hardcoded) shared clusters are not used for analysis

--- PWGCF/Correlations/DPhi/AliAnalysisTaskDptDptCorrelations.cxx
+++ PWGCF/Correlations/DPhi/AliAnalysisTaskDptDptCorrelations.cxx
@@ -1209,11 +1209,15 @@
 	  //dcaXY = t->DCA();
 	  //dcaZ  = t->ZAtDCA();
 	  nClus  = t->GetTPCNcls();
-
-	  if ( nClus<_nClusterMin ) continue;
-
+
+	   if ( nClus<_nClusterMin ) continue;
+
 	  _Ncluster1->Fill(nClus);
-
+
+	  if(t->GetTPCnclsS() > 0){
+	  continue;
+	   }
+
 	  //for Global tracks
 	   Double_t nsigmaelectron = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,(AliPID::EParticleType)AliPID::kElectron));
 	  Double_t nsigmapion = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,(AliPID::EParticleType)AliPID::kPion));
@@ -1258,7 +1262,7 @@
 	  //==== QA ===========================
 	  //_dcaz->Fill(DCAZ);
 	  //_dcaxy->Fill(DCAXY);
-	  //_etadis->Fill(eta);
+	  _etadis->Fill(eta);
 	  //_phidis->Fill(phi);
 	  //===================================
 	  //*************************************************


BufferIterator: allow operator{==,!=} for different buffers

--- src/buffer_iterator.inl.hh
+++ src/buffer_iterator.inl.hh
@@ -36,14 +36,12 @@

 inline bool BufferIterator::operator==(const BufferIterator& iterator) const
 {
-    assert(m_buffer == iterator.m_buffer);
-    return (m_coord == iterator.m_coord);
+    return (m_buffer == iterator.m_buffer and m_coord == iterator.m_coord);
 }

 inline bool BufferIterator::operator!=(const BufferIterator& iterator) const
 {
-    assert(m_buffer == iterator.m_buffer);
-    return (m_coord != iterator.m_coord);
+    return (m_buffer != iterator.m_buffer or m_coord != iterator.m_coord);
 }

 inline bool BufferIterator::operator<(const BufferIterator& iterator) const


Bouncy flag fires the jets; not using the bounce sound because it isn't consistent

git-svn-id: 67bf12f30ddf2081c31403e0b02b2123541f1680@8915 08b3d480-bf2c-0410-a26f-811ee3361c24

--- src/bzflag/LocalPlayer.cxx
+++ src/bzflag/LocalPlayer.cxx
@@ -372,7 +372,6 @@
   if (wantJump) {
     doJump();
     if (!wantJump) {
-      fireJumpJets();
       newVelocity[2] = oldVelocity[2];
       if ((lastObstacle != NULL) && !lastObstacle->isFlatTop()
 	  && BZDB.isTrue(StateDatabase::BZDB_NOCLIMB)) {
@@ -814,7 +813,7 @@
   if ((getFlag() == Flags::Bouncy) && ((location == OnGround) || (location == OnBuilding))) {
     if (oldLocation != InAir) {
       if ((TimeKeeper::getCurrent() - bounceTime) > 0) {
-	this->doJump();
+	doJump();
       }
     }
     else {
@@ -1282,6 +1281,10 @@
   setVelocity(newVelocity);
   location = InAir;

+  // setup the graphics
+  fireJumpJets();
+
+  // setup the sound
   if (gettingSound) {
     if (flag == Flags::Wings) {
       playLocalSound(SFX_FLAP);


better safe then sorry

better safe then sorry

--- src/bzflag/defaultBZDB.cxx
+++ src/bzflag/defaultBZDB.cxx
@@ -94,7 +94,7 @@
   { "maxTextureSize",		"512",			true,	StateDatabase::ReadWrite,	NULL },
   { "lodScale",			"1.0",			true,	StateDatabase::ReadWrite,	NULL },
   { "radarLodScale",		"1.0",			true,	StateDatabase::ReadWrite,	NULL },
-  { "maxFlagLOD",		"9",			true,	StateDatabase::ReadWrite,	NULL },
+  { "maxFlagLOD",		"8",			true,	StateDatabase::ReadWrite,	NULL },
   { "stencilShadows",		"0",			true,	StateDatabase::ReadWrite,	NULL },
   { "shadowAlpha",		"0.5",			true,	StateDatabase::ReadWrite,	NULL },
   { "aniso",			"1",			true,	StateDatabase::ReadWrite,	NULL },


make SpawnPosition use playerData->lastState rather than directly accessing the lastState[] array

--- src/bzfs/SpawnPosition.cxx
+++ src/bzfs/SpawnPosition.cxx
@@ -32,7 +32,6 @@
 extern bool areFoes(TeamColor team1, TeamColor team2);
 extern BasesList bases;
 extern WorldInfo *world;
-extern PlayerState lastState[];

 SpawnPosition::SpawnPosition(int playerId, bool onGroundOnly, bool notNearEdges) :
 		curMaxPlayers(getCurMaxPlayers())
@@ -164,9 +163,9 @@
     playerData = GameKeeper::Player::getPlayerByIndex(i);
     if (!playerData)
       continue;
-    if (playerData->player.isAlive()) {
-      float *enemyPos = lastState[i].pos;
-      float enemyAngle = lastState[i].azimuth;
+    if (playerData->player.isAlive()) {
+      float *enemyPos = playerData->lastState->pos;
+      float enemyAngle = playerData->lastState->azimuth;
       if (playerData->player.getFlag() >= 0) {
 	// check for dangerous flags
 	const FlagInfo *finfo = FlagInfo::get(playerData->player.getFlag());
@@ -208,14 +207,14 @@
       continue;
     if (playerData->player.isAlive()
 	&& areFoes(playerData->player.getTeam(), team)) {
-      float *enemyPos = lastState[i].pos;
+      float *enemyPos = playerData->lastState->pos;
       if (fabs(enemyPos[2] - testPos[2]) < 1.0f) {
 	float x = enemyPos[0] - testPos[0];
 	float y = enemyPos[1] - testPos[1];
 	float distSq = x * x + y * y;
 	if (distSq < worstDist) {
 	  worstDist  = distSq;
-	  enemyAngle = lastState[i].azimuth;
+	  enemyAngle = playerData->lastState->azimuth;
 	  noEnemy    = false;
 	}
       }


Add spurious interrupt support.

Add spurious interrupt support.

--- Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp
+++ Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp
@@ -595,8 +595,12 @@
 			if(vpa_) {
 				temporary_value_.b = uint8_t(InstructionSet::M68k::Exception::InterruptAutovectorBase - 1 + captured_interrupt_level_);
 			}
-
-			// TODO: if bus error is set, treat interrupt as spurious.
+			if(berr_) {
+				temporary_value_.b = uint8_t(InstructionSet::M68k::Exception::SpuriousInterrupt);
+			}
+
+			// TODO: check documentation for other potential interrupt outcomes;
+			// and presumably spin here if DTACK isn't implicit.

 			IdleBus(3);							// n- n