/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: getBottomDataProperty * Signature: ()Luk/ac/manchester/cs/factplusplus/DataPropertyPointer; */ JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getBottomDataProperty (JNIEnv * env, jobject obj) { TRACE_JNI("getBottomDataProperty"); TJNICache* J = getJ(env,obj); return J->DataProperty(J->getDName("http://www.w3.org/2002/07/owl#bottomDataProperty")); }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: getDataTop * Signature: ()Luk/ac/manchester/cs/factplusplus/DataTypePointer; */ JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getDataTop (JNIEnv * env, jobject obj) { TRACE_JNI("getDataTop"); TJNICache* J = getJ(env,obj); return J->DataType(J->EM->DataTop()); }
bool RigidBody::getAtomVel(Vector3d& vel, unsigned int index) { //velRot = $(A\cdot skew(I^{-1}j))^{T}refCoor$ if (index < atoms_.size()) { Vector3d velRot; Mat3x3d skewMat;; Vector3d ref = refCoords_[index]; Vector3d ji = getJ(); Mat3x3d I = getI(); skewMat(0, 0) =0; skewMat(0, 1) = ji[2] /I(2, 2); skewMat(0, 2) = -ji[1] /I(1, 1); skewMat(1, 0) = -ji[2] /I(2, 2); skewMat(1, 1) = 0; skewMat(1, 2) = ji[0]/I(0, 0); skewMat(2, 0) =ji[1] /I(1, 1); skewMat(2, 1) = -ji[0]/I(0, 0); skewMat(2, 2) = 0; velRot = (getA() * skewMat).transpose() * ref; vel =getVel() + velRot; return true; } else { std::cerr << index << " is an invalid index, current rigid body contains " << atoms_.size() << "atoms" << std::endl; return false; } }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: addArg * Signature: (Luk/ac/manchester/cs/factplusplus/Pointer;)V */ JNIEXPORT void JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_addArg (JNIEnv * env, jobject obj, jobject arg) { TRACE_JNI("addArg"); TRACE_ARG(env,obj,arg); TJNICache* J = getJ(env,obj); J->EM->addArg(getExpr(env,arg)); }
void try_flip_2_edge(int *g, int gsize, int &best_count_2, std::vector<int> &best_K, int best_start, int *nd, bool flip_new){ int i; int j; int k; int l; int cnt; size_t m; size_t n; size_t sz = best_K.size(); best_count_2 = BIGCOUNT; for(m=best_start; m<sz; m++){ for(n=m+1; n<sz; n++){ /* flip */ i = getI(best_K[m]); j = getJ(best_K[m]); k = getI(best_K[n]); l = getJ(best_K[n]); g[ i*gsize + j ] = 1 - g[ i*gsize + j ]; g[ k*gsize + l ] = 1 - g[ k*gsize + l ]; cnt = CliqueCount(g, gsize, flip_new); if( cnt < best_count_2 ){ best_count_2 = cnt; nd[0] = i; nd[1] = j; nd[2] = k; nd[3] = l; } /* unflip */ g[ i*gsize + j ] = 1 - g[ i*gsize + j ]; g[ k*gsize + l ] = 1 - g[ k*gsize + l ]; } } }
void operator()() { id = threadId(); wait(); // ++j; j = getJ()+1; std::cout << "Hello " << "World " << "from " << id // std::this_thread::get_id() << " where j is " << j << " start is " << Hi::start << std::endl; }
void dcfeed::calcTR (nr_double_t) { nr_double_t l = getPropertyDouble ("L"); nr_double_t r, v; nr_double_t i = real (getJ (VSRC_1)); setState (fState, i * l); integrate (fState, l, r, v); setD (VSRC_1, VSRC_1, -r); setE (VSRC_1, v); }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: askEquivalentDataProperties * Signature: (Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;)[Luk/ac/manchester/cs/factplusplus/DataPropertyPointer; */ JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askEquivalentDataProperties (JNIEnv * env, jobject obj, jobject arg) { TRACE_JNI("askEquivalentDataProperties"); TRACE_ARG(env,obj,arg); TJNICache* J = getJ(env,obj); JTaxonomyActor<DataPropertyPolicy> actor(J); PROCESS_QUERY ( J->K->getEquivalentRoles ( getRODRoleExpr(env,arg), actor ) ); return actor.getSynonyms(); }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: askSameAs * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;)[Luk/ac/manchester/cs/factplusplus/IndividualPointer; */ JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askSameAs (JNIEnv * env, jobject obj, jobject arg) { TRACE_JNI("askSameAs"); TRACE_ARG(env,obj,arg); TJNICache* J = getJ(env,obj); JTaxonomyActor<IndividualPolicy</*plain=*/true> > actor(J); PROCESS_QUERY ( J->K->getSameAs ( getROIndividualExpr(env,arg), actor ) ); return actor.getSynonyms(); }
void cccs::calcTR (nr_double_t t) { nr_double_t T = getPropertyDouble ("T"); if (T > 0.0) { T = t - T; nr_double_t g = getPropertyDouble ("G"); nr_double_t i = getJ (VSRC_1, T); setI (NODE_2, -g * i); setI (NODE_3, +g * i); } }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: askDataPropertyDomain * Signature: (Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; */ JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askDataPropertyDomain (JNIEnv * env, jobject obj, jobject arg, jboolean direct) { TRACE_JNI("askDataPropertyDomain"); TRACE_ARG(env,obj,arg); TJNICache* J = getJ(env,obj); JTaxonomyActor<ClassPolicy> actor(J); PROCESS_QUERY ( J->K->getDRoleDomain ( getRODRoleExpr(env,arg), direct, actor ) ); return actor.getElements(); }
void ServiceWalker::onNewTile() { Walker::onNewTile(); std::set<Building*> reachedBuildings = getReachedBuildings(getI(), getJ()); for (std::set<Building*>::iterator itBuilding = reachedBuildings.begin(); itBuilding != reachedBuildings.end(); ++itBuilding) { Building &building = **itBuilding; building.applyService(*this); } }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: askDisjointClasses * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; */ JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askDisjointClasses (JNIEnv * env, jobject obj, jobject arg) { TRACE_JNI("askDisjointClasses"); TRACE_ARG(env,obj,arg); TJNICache* J = getJ(env,obj); JTaxonomyActor<ClassPolicy> actor(J); const TConceptExpr* p = getROConceptExpr(env,arg); PROCESS_QUERY ( J->K->getDisjointConcepts(p,actor) ); return actor.getElements(); }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: askInstancesGrouped * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;Z)[[Luk/ac/manchester/cs/factplusplus/IndividualPointer; */ JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askInstancesGrouped (JNIEnv * env, jobject obj, jobject arg, jboolean direct) { TRACE_JNI("askInstancesGrouped"); TRACE_ARG(env,obj,arg); TJNICache* J = getJ(env,obj); JTaxonomyActor<IndividualPolicy</*plain=*/false> > actor(J); const TConceptExpr* p = getROConceptExpr(env,arg); PROCESS_QUERY ( direct ? J->K->getDirectInstances(p,actor) : J->K->getInstances(p,actor) ); return actor.getElements(); }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: askIndividualTypes * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; */ JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askIndividualTypes (JNIEnv * env, jobject obj, jobject arg, jboolean direct) { TRACE_JNI("askIndividualTypes"); TRACE_ARG(env,obj,arg); TJNICache* J = getJ(env,obj); JTaxonomyActor<ClassPolicy> actor(J); const TIndividualExpr* p = getROIndividualExpr(env,arg); PROCESS_QUERY ( J->K->getTypes(p,direct,actor) ); return actor.getElements(); }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: askSubDataProperties * Signature: (Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;Z)[[Luk/ac/manchester/cs/factplusplus/DataPropertyPointer; */ JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askSubDataProperties (JNIEnv * env, jobject obj, jobject arg, jboolean direct) { TRACE_JNI("askSubDataProperties"); TRACE_ARG(env,obj,arg); TJNICache* J = getJ(env,obj); JTaxonomyActor<DataPropertyPolicy> actor(J); const TDRoleExpr* p = getRODRoleExpr(env,arg); PROCESS_QUERY ( J->K->getSubRoles(p,direct,actor) ); return actor.getElements(); }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: askSuperClasses * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; */ JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askSuperClasses (JNIEnv * env, jobject obj, jobject arg, jboolean direct) { MemoryStatistics MS("getSuperClasses"); TRACE_JNI("askSuperClasses"); TRACE_ARG(env,obj,arg); TJNICache* J = getJ(env,obj); JTaxonomyActor<ClassPolicy> actor(J); const TConceptExpr* p = getROConceptExpr(env,arg); PROCESS_QUERY ( J->K->getSupConcepts(p,direct,actor) ); return actor.getElements(); }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: askDataProperties * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;)[Luk/ac/manchester/cs/factplusplus/DataPropertyPointer; */ JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askDataProperties (JNIEnv * env, jobject obj, jobject arg) { TRACE_JNI("askDataProperties"); TRACE_ARG(env,obj,arg); TJNICache* J = getJ(env,obj); ReasoningKernel::NamesVector Rs; PROCESS_QUERY ( J->K->getRelatedRoles ( getROIndividualExpr(env,arg), Rs, /*data=*/true, /*needI=*/false ) ); std::vector<TExpr*> acc; for ( ReasoningKernel::NamesVector::const_iterator p = Rs.begin(), p_end = Rs.end(); p < p_end; ++p ) acc.push_back(J->getDName((*p)->getName())); return J->buildArray ( acc, J->DataPropertyPointer ); }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: askRelatedIndividuals * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)[Luk/ac/manchester/cs/factplusplus/IndividualPointer; */ JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askRelatedIndividuals (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) { TRACE_JNI("askRelatedIndividuals"); TRACE_ARG(env,obj,arg1); TRACE_ARG(env,obj,arg2); TJNICache* J = getJ(env,obj); ReasoningKernel::NamesVector Js; PROCESS_QUERY ( J->K->getRoleFillers ( getROIndividualExpr(env,arg1), getROORoleExpr(env,arg2), Js ) ); std::vector<TExpr*> acc; for ( ReasoningKernel::NamesVector::const_iterator p = Js.begin(), p_end = Js.end(); p < p_end; ++p ) acc.push_back(J->getIName((*p)->getName())); return J->buildArray ( acc, J->IndividualPointer ); }
void inductor::calcTR (nr_double_t) { nr_double_t l = getPropertyDouble ("L"); nr_double_t r, v; nr_double_t i = real (getJ (VSRC_1)); /* apply initial condition if requested */ if (getMode () == MODE_INIT && isPropertyGiven ("I")) { i = getPropertyDouble ("I"); } setState (fState, i * l); integrate (fState, l, r, v); setD (VSRC_1, VSRC_1, -r); setE (VSRC_1, v); }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: getBuiltInDataType * Signature: (Ljava/lang/String;)Luk/ac/manchester/cs/factplusplus/DataTypePointer; */ JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getBuiltInDataType (JNIEnv * env, jobject obj, jstring str) { TRACE_JNI("getBuiltInDataType"); TRACE_STR(env,str); TJNICache* J = getJ(env,obj); JString name(env,str); std::string DTName(name()); if ( DTName == "http://www.w3.org/2000/01/rdf-schema#Literal" || DTName == "http://www.w3.org/2000/01/rdf-schema#anySimpleType" || DTName == "http://www.w3.org/2001/XMLSchema#anyType" || DTName == "http://www.w3.org/2001/XMLSchema#anySimpleType" ) return J->DataType(J->EM->DataTop()); if ( DTName == "http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral" || DTName == "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral" || DTName == "http://www.w3.org/2001/XMLSchema#string" || DTName == "http://www.w3.org/2001/XMLSchema#anyURI" || DTName == "http://www.w3.org/2001/XMLSchema#ID" ) return J->DataType(J->EM->getStrDataType()); if ( DTName == "http://www.w3.org/2001/XMLSchema#integer" || DTName == "http://www.w3.org/2001/XMLSchema#int" || DTName == "http://www.w3.org/2001/XMLSchema#long" || DTName == "http://www.w3.org/2001/XMLSchema#nonNegativeInteger" || DTName == "http://www.w3.org/2001/XMLSchema#positiveInteger" || DTName == "http://www.w3.org/2001/XMLSchema#negativeInteger" || DTName == "http://www.w3.org/2001/XMLSchema#short" || DTName == "http://www.w3.org/2001/XMLSchema#byte" ) return J->DataType(J->EM->getIntDataType()); if ( DTName == "http://www.w3.org/2001/XMLSchema#float" || DTName == "http://www.w3.org/2001/XMLSchema#double" || DTName == "http://www.w3.org/2001/XMLSchema#real" || DTName == "http://www.w3.org/2001/XMLSchema#decimal" ) return J->DataType(J->EM->getRealDataType()); if ( DTName == "http://www.w3.org/2001/XMLSchema#boolean" ) return J->DataType(J->EM->getBoolDataType()); if ( DTName == "http://www.w3.org/2001/XMLSchema#dateTimeAsLong" ) return J->DataType(J->EM->getTimeDataType()); std::stringstream err; err << "Unsupported datatype '" << DTName.c_str() << "'"; Throw ( env, err.str().c_str() ); return (jobject)0; }
void Well::setRefDepthFromCompletions() const { size_t timeStep = m_creationTimeStep; while (true) { auto completions = getCompletions( timeStep ); if (completions->size() > 0) { auto firstCompletion = completions->get(0); double depth = m_grid->getCellDepth( firstCompletion->getI() , firstCompletion->getJ() , firstCompletion->getK()); m_refDepth.setValue( depth ); break; } else { timeStep++; if (timeStep >= m_timeMap->size()) throw std::invalid_argument("No completions defined for well: " + name() + " can not infer reference depth"); } } }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: getDataValue * Signature: (Ljava/lang/String;Luk/ac/manchester/cs/factplusplus/DataTypePointer;)Luk/ac/manchester/cs/factplusplus/DataValuePointer; */ JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getDataValue__Ljava_lang_String_2Luk_ac_manchester_cs_factplusplus_DataTypePointer_2 (JNIEnv * env, jobject obj, jstring str, jobject type) { TRACE_JNI("getDataValue"); TRACE_STR(env,str); TJNICache* J = getJ(env,obj); JString name(env,str); jobject ret = (jobject)0; try { ret = J->DataValue ( J->EM->DataValue ( name(), getDataTypeExpr(env,type) ) ); } catch (const EFPPCantRegName&) { Throw ( env, "FaCT++ Kernel: Can not register new data value" ); } return ret; }
/* * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus * Method: getNamedClass * Signature: (Ljava/lang/String;)Luk/ac/manchester/cs/factplusplus/ClassPointer; */ JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getNamedClass (JNIEnv * env, jobject obj, jstring str) { TRACE_JNI("getNamedClass"); TRACE_STR(env,str); TJNICache* J = getJ(env,obj); JString name(env,str); jobject ret = (jobject)0; try { ret = J->Class(J->getCName(name())); } catch (const EFPPCantRegName&) { Throw ( env, "FaCT++ Kernel: Can not register new class name" ); } return ret; }
void biastee::calcTR (nr_double_t) { nr_double_t l = getPropertyDouble ("L"); nr_double_t c = getPropertyDouble ("C"); nr_double_t g, r, v; nr_double_t i = real (getJ (VSRC_1)); setState (fState, i * l); integrate (fState, l, r, v); setD (VSRC_1, VSRC_1, -r); setE (VSRC_1, v); v = real (getV (NODE_1) - getV (NODE_2)); setState (qState, c * v); integrate (qState, c, g, i); setY (NODE_1, NODE_1, +g); setY (NODE_2, NODE_2, +g); setY (NODE_1, NODE_2, -g); setY (NODE_2, NODE_1, -g); setI (NODE_1 , -i); setI (NODE_2 , +i); }
void SundialsInterface::init(const Dict& opts) { // Call the base class method Integrator::init(opts); // If sensitivity equations, make sure derivative_of_ is available casadi_assert_message(ns_==0 || !derivative_of_.is_null(), "Not implemented."); // Default options abstol_ = 1e-8; reltol_ = 1e-6; max_num_steps_ = 10000; stop_at_end_ = true; use_precon_ = true; max_krylov_ = 10; linear_solver_ = "csparse"; string newton_scheme = "direct"; quad_err_con_ = false; string interpolation_type = "hermite"; steps_per_checkpoint_ = 20; disable_internal_warnings_ = false; max_multistep_order_ = 5; second_order_correction_ = true; step0_ = 0; max_order_ = 0; nonlin_conv_coeff_ = 0; // Read options for (auto&& op : opts) { if (op.first=="abstol") { abstol_ = op.second; } else if (op.first=="reltol") { reltol_ = op.second; } else if (op.first=="max_num_steps") { max_num_steps_ = op.second; } else if (op.first=="stop_at_end") { stop_at_end_ = op.second; } else if (op.first=="use_preconditioner") { use_precon_ = op.second; } else if (op.first=="max_krylov") { max_krylov_ = op.second; } else if (op.first=="newton_scheme") { newton_scheme = op.second.to_string(); } else if (op.first=="linear_solver") { linear_solver_ = op.second.to_string(); } else if (op.first=="linear_solver_options") { linear_solver_options_ = op.second; } else if (op.first=="quad_err_con") { quad_err_con_ = op.second; } else if (op.first=="interpolation_type") { interpolation_type = op.second.to_string(); } else if (op.first=="steps_per_checkpoint") { steps_per_checkpoint_ = op.second; } else if (op.first=="disable_internal_warnings") { disable_internal_warnings_ = op.second; } else if (op.first=="max_multistep_order") { max_multistep_order_ = op.second; } else if (op.first=="second_order_correction") { second_order_correction_ = op.second; } else if (op.first=="step0") { step0_ = op.second; } else if (op.first=="max_order") { max_order_ = op.second; } else if (op.first=="nonlin_conv_coeff") { nonlin_conv_coeff_ = op.second; } } // Type of Newton scheme if (newton_scheme=="direct") { newton_scheme_ = SD_DIRECT; } else if (newton_scheme=="gmres") { newton_scheme_ = SD_GMRES; } else if (newton_scheme=="bcgstab") { newton_scheme_ = SD_BCGSTAB; } else if (newton_scheme=="tfqmr") { newton_scheme_ = SD_TFQMR; } else { casadi_error("Unknown Newton scheme: " + newton_scheme); } // Interpolation_type if (interpolation_type=="hermite") { interp_ = SD_HERMITE; } else if (interpolation_type=="polynomial") { interp_ = SD_POLYNOMIAL; } else { casadi_error("Unknown interpolation type: " + interpolation_type); } // Get or create Jacobians and linear system solvers for (bool backward : {false, true}) { // Skip backward? if (backward && nrx_==0) continue; // Get Jacobian function Function J; if (ns_==0) { J = getJ(backward); } else { SundialsInterface* d = derivative_of_.get<SundialsInterface>(); casadi_assert(d!=0); if (d->ns_==0) { J = d->get_function(backward ? "jacB" : "jacF"); } else { J = d->getJ(backward); } } set_function(J, J.name(), true); alloc_w(J.nnz_out(0), true); } // Allocate work vectors alloc_w(np_, true); // p alloc_w(nrp_, true); // rp alloc_w(2*max(nx_+nz_, nrx_+nrz_), true); // v1, v2 // Allocate linear solvers linsolF_ = Linsol("linsolF", linear_solver_, linear_solver_options_); if (nrx_>0) { linsolB_ = Linsol("linsolB", linear_solver_, linear_solver_options_); } }
Point Tile::getScreenPos() const { return Point( 30 * ( getI() + getJ()), 15 * (getI() - getJ()) ); }
//! @brief Returns the local reference system. Ref3d3d XC::CrdTransf3d::getLocalReference(void) const { const Vector vI= getI(); const Vector vJ= getJ(); return Ref3d3d(getPosNodeI(),Vector3d(vI[0],vI[1],vI[2]),Vector3d(vJ[0],vJ[1],vJ[2])); }
virtual void init(Voxel& voxel) { b0_index.clear(); for(unsigned int index = 0;index < voxel.bvalues.size();++index) if(voxel.bvalues[index] == 0) b0_index.push_back(index); half_odf_size = voxel.ti.vertices_count/2; float lambda = voxel.param[0]; unsigned int max_l = voxel.param[1]; const unsigned int R = ((max_l+1)*(max_l+2)/2); std::vector<std::pair<int,int> > j_map(R); for (int k = 0; k <= max_l; k += 2) for (int m = -k; m <= k; ++m) j_map[getJ(m,k)] = std::make_pair(m,k); std::vector<float> Bt(R*voxel.bvectors.size()); for (unsigned int j = 0,index = 0; j < R; ++j) for (unsigned int n = 0; n < voxel.bvectors.size(); ++n,++index) { float atan2_xy = std::atan2(voxel.bvectors[n][1],voxel.bvectors[n][0]); if (atan2_xy < 0.0) atan2_xy += 2.0*M_PI; Bt[index] = Yj(j_map[j].second,j_map[j].first,std::acos(voxel.bvectors[n][2]),atan2_xy); } std::vector<float> UP(half_odf_size*R); { std::vector<float> U(half_odf_size*R); for (unsigned int n = 0,index = 0; n < half_odf_size; ++n) for (unsigned int j = 0; j < R; ++j,++index) { float atan2_xy = std::atan2(voxel.ti.vertices[n][1],voxel.ti.vertices[n][0]); if (atan2_xy < 0.0) atan2_xy += 2.0*M_PI; U[index] = Yj(j_map[j].second,j_map[j].first,std::acos(voxel.ti.vertices[n][2]),atan2_xy); } std::vector<float> P(R*R); for (unsigned int i = 0,index = 0; i < R; ++i,index += R+1) P[index] = boost::math::legendre_p(j_map[i].second,0.0)*2.0*M_PI; image::matrix::product(U.begin(),P.begin(),UP.begin(),image::dyndim(half_odf_size,R),image::dyndim(R,R)); } std::vector<float> iB(Bt.size()); { std::vector<float> BtB(R*R); // BtB = Bt * trans(Bt); image::matrix::square(Bt.begin(),BtB.begin(),image::dyndim(R,voxel.bvectors.size())); for (unsigned int i = 0,index = 0; i < R; ++i,index += R+1) { float l = j_map[i].second; BtB[index] += l*l*(l+1.0)*(l+1.0)*lambda; } std::vector<unsigned int> pivot(R); image::matrix::lu_decomposition(BtB.begin(),pivot.begin(),image::dyndim(R,R)); //iB = inv(BtB)*Bt; image::matrix::lu_solve(BtB.begin(),pivot.begin(),Bt.begin(),iB.begin(),image::dyndim(R,R),image::dyndim(R,voxel.bvectors.size())); } UPiB.resize(half_odf_size*voxel.bvectors.size()); image::matrix::product(UP.begin(),iB.begin(),UPiB.begin(),image::dyndim(half_odf_size,R),image::dyndim(R,voxel.bvectors.size())); }
Point Tile::getXY() const { return Point( 30 * ( getI() + getJ()), 15 * (getI() - getJ()) ); }