added corr
This commit is contained in:
+4
-2
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## GLOBAL CONFIGURATION FLAGS
|
## GLOBAL CONFIGURATION FLAGS
|
||||||
|
|
||||||
version_string = '0.7.6a'
|
version_string = '0.7.7a'
|
||||||
add_path_to_ldpath = True
|
add_path_to_ldpath = True
|
||||||
rebuild_backend = False
|
rebuild_backend = False
|
||||||
run_backend = True
|
run_backend = True
|
||||||
@@ -28,7 +28,8 @@ def init_config():
|
|||||||
# os.environ['CXX'] = 'C:/Program Files/LLVM/bin/clang.exe'
|
# os.environ['CXX'] = 'C:/Program Files/LLVM/bin/clang.exe'
|
||||||
os.environ['THREADING'] = '1'
|
os.environ['THREADING'] = '1'
|
||||||
os.environ['AQUERY_ITC_USE_SEMPH'] = '1'
|
os.environ['AQUERY_ITC_USE_SEMPH'] = '1'
|
||||||
|
if 'AQ_DEBUG' not in os.environ:
|
||||||
|
os.environ['AQ_DEBUG'] = '0'
|
||||||
if ('__config_initialized__' not in globals() or
|
if ('__config_initialized__' not in globals() or
|
||||||
not __config_initialized__):
|
not __config_initialized__):
|
||||||
import sys
|
import sys
|
||||||
@@ -50,6 +51,7 @@ def init_config():
|
|||||||
if os_platform == 'win':
|
if os_platform == 'win':
|
||||||
add_dll_dir(cygroot)
|
add_dll_dir(cygroot)
|
||||||
add_dll_dir(os.path.abspath('./msc-plugin'))
|
add_dll_dir(os.path.abspath('./msc-plugin'))
|
||||||
|
add_dll_dir(os.path.abspath('./deps'))
|
||||||
if build_driver == 'Auto':
|
if build_driver == 'Auto':
|
||||||
try:
|
try:
|
||||||
import vswhere
|
import vswhere
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ class build_manager:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def server(self):
|
def server(self):
|
||||||
|
print(self.opt)
|
||||||
loc = os.path.abspath('./msc-plugin/server.vcxproj')
|
loc = os.path.abspath('./msc-plugin/server.vcxproj')
|
||||||
self.get_flags()
|
self.get_flags()
|
||||||
self.build_cmd = [['del', 'server.so'], [aquery_config.msbuildroot, loc, self.opt, self.platform]]
|
self.build_cmd = [['del', 'server.so'], [aquery_config.msbuildroot, loc, self.opt, self.platform]]
|
||||||
@@ -186,7 +187,7 @@ class build_manager:
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.method = 'make'
|
self.method = 'make'
|
||||||
self.cxx = ''
|
self.cxx = ''
|
||||||
self.OptimizationLv = '4' # [O0, O1, O2, O3, Ofast]
|
self.OptimizationLv = '0' # [O0, O1, O2, O3, Ofast]
|
||||||
self.Platform = 'amd64'
|
self.Platform = 'amd64'
|
||||||
self.PCH = os.environ['PCH'] if 'PCH' in os.environ else 1
|
self.PCH = os.environ['PCH'] if 'PCH' in os.environ else 1
|
||||||
self.StaticLib = 1
|
self.StaticLib = 1
|
||||||
|
|||||||
+5
-4
@@ -75,7 +75,8 @@ class projection(ast_node):
|
|||||||
):
|
):
|
||||||
self.force_use_spgb = (
|
self.force_use_spgb = (
|
||||||
force_use_spgb |
|
force_use_spgb |
|
||||||
context.system_state.cfg.backend_type == Backend_Type.BACKEND_AQuery.value
|
(context.system_state.cfg.backend_type ==
|
||||||
|
Backend_Type.BACKEND_AQuery.value)
|
||||||
)
|
)
|
||||||
self.subq_type = subq_type
|
self.subq_type = subq_type
|
||||||
super().__init__(parent, node, context)
|
super().__init__(parent, node, context)
|
||||||
@@ -1444,9 +1445,9 @@ class outfile(ast_node):
|
|||||||
file_pointer = 'fp_' + base62uuid(6)
|
file_pointer = 'fp_' + base62uuid(6)
|
||||||
self.addc(f'FILE* {file_pointer} = fopen("{filename}", "wb");')
|
self.addc(f'FILE* {file_pointer} = fopen("{filename}", "wb");')
|
||||||
self.addc(f'{self.parent.out_table.contextname_cpp}->printall("{sep}", "\\n", nullptr, {file_pointer});')
|
self.addc(f'{self.parent.out_table.contextname_cpp}->printall("{sep}", "\\n", nullptr, {file_pointer});')
|
||||||
if self.context.use_gc:
|
# if self.context.use_gc:
|
||||||
self.addc(f'GC::gc_handle->reg({file_pointer}, 65536, [](void* fp){{fclose((FILE*)fp);}});')
|
# self.addc(f'GC::gc_handle->reg({file_pointer}, 65536, fclose_gc);')
|
||||||
else:
|
# else:
|
||||||
self.addc(f'fclose({file_pointer});')
|
self.addc(f'fclose({file_pointer});')
|
||||||
|
|
||||||
self.context.ccode += self.ccode
|
self.context.ccode += self.ccode
|
||||||
|
|||||||
@@ -11,9 +11,10 @@
|
|||||||
<Name>msvs-py</Name>
|
<Name>msvs-py</Name>
|
||||||
<RootNamespace>msvs-py</RootNamespace>
|
<RootNamespace>msvs-py</RootNamespace>
|
||||||
<IsWindowsApplication>False</IsWindowsApplication>
|
<IsWindowsApplication>False</IsWindowsApplication>
|
||||||
<InterpreterId>Global|PythonCore|3.9</InterpreterId>
|
<InterpreterId>Global|PythonCore|3.10</InterpreterId>
|
||||||
<LaunchProvider>Standard Python launcher</LaunchProvider>
|
<LaunchProvider>Standard Python launcher</LaunchProvider>
|
||||||
<EnableNativeCodeDebugging>True</EnableNativeCodeDebugging>
|
<EnableNativeCodeDebugging>True</EnableNativeCodeDebugging>
|
||||||
|
<Environment>AQ_DEBUG=1</Environment>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -59,6 +60,9 @@
|
|||||||
<Compile Include="..\aquery_config.py" />
|
<Compile Include="..\aquery_config.py" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<InterpreterReference Include="Global|PythonCore|3.10" />
|
||||||
|
<InterpreterReference Include="Global|PythonCore|3.11" />
|
||||||
|
<InterpreterReference Include="Global|PythonCore|3.12" />
|
||||||
<InterpreterReference Include="Global|PythonCore|3.9" />
|
<InterpreterReference Include="Global|PythonCore|3.9" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
|
||||||
|
|||||||
+27
-1
@@ -20,7 +20,7 @@ template<class T, template<typename ...> class VT>
|
|||||||
types::GetLongType<T>
|
types::GetLongType<T>
|
||||||
sum(const VT<T>& v) {
|
sum(const VT<T>& v) {
|
||||||
types::GetLongType<T> ret = 0;
|
types::GetLongType<T> ret = 0;
|
||||||
for (const auto& _v : v)
|
for (auto _v : v)
|
||||||
ret += _v;
|
ret += _v;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -363,6 +363,32 @@ inline decayed_t<VT, types::GetFPType<types::GetLongType<T>>> vars(const VT<T>&
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, template<typename ...> class VT,
|
||||||
|
class T2, template<typename ...> class VT2
|
||||||
|
>
|
||||||
|
auto corr(const VT<T>& x, const VT2<T2>&y) {
|
||||||
|
typedef types::Coercion<decays<T>, decays<T2>> InnerType;
|
||||||
|
typedef types::GetLongType<InnerType> LongType;
|
||||||
|
typedef types::GetFPType<LongType> FPType;
|
||||||
|
// assert(x.size == y.size);
|
||||||
|
const uint32_t& len = x.size;
|
||||||
|
LongType sx{0}, sy{0}, sxy{0}, sx2{0}, sy2{0};
|
||||||
|
for (uint32_t i = 0; i < len; ++i){
|
||||||
|
sx += x[i];
|
||||||
|
sx2 += x[i] * x[i];
|
||||||
|
sy += y[i];
|
||||||
|
sxy += x[i] * y[i];
|
||||||
|
sy2 += y[i] * y[i];
|
||||||
|
}
|
||||||
|
return (sxy - FPType(sx*sy))
|
||||||
|
/
|
||||||
|
(len * sqrt(
|
||||||
|
(sx2 - FPType(sx*sx)/len) * (sy2 - FPType(sy*sy)/len)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, template<typename ...> class VT>
|
template<class T, template<typename ...> class VT>
|
||||||
inline types::GetFPType<types::GetLongType<decays<T>>> stddev(const VT<T>& arr) {
|
inline types::GetFPType<types::GetLongType<decays<T>>> stddev(const VT<T>& arr) {
|
||||||
return sqrt(var(arr));
|
return sqrt(var(arr));
|
||||||
|
|||||||
+1
-2
@@ -36,7 +36,7 @@ public:
|
|||||||
// reset scratch space to initial capacity.
|
// reset scratch space to initial capacity.
|
||||||
void cleanup();
|
void cleanup();
|
||||||
};
|
};
|
||||||
|
void fclose_gc(void*);
|
||||||
|
|
||||||
#ifndef __AQ_USE_THREADEDGC__
|
#ifndef __AQ_USE_THREADEDGC__
|
||||||
class QUERY_DECLSPEC GC {
|
class QUERY_DECLSPEC GC {
|
||||||
@@ -103,7 +103,6 @@ public:
|
|||||||
}
|
}
|
||||||
constexpr static void(*_free) (void*) = free;
|
constexpr static void(*_free) (void*) = free;
|
||||||
};
|
};
|
||||||
|
|
||||||
#else
|
#else
|
||||||
class GC {
|
class GC {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -635,3 +635,4 @@ get_procedure(Context* cxt, const char* name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* CreateNULLServer(Context*) { return nullptr; }
|
void* CreateNULLServer(Context*) { return nullptr; }
|
||||||
|
void fclose_gc(void* fp) { fclose((FILE*)fp); }
|
||||||
@@ -355,7 +355,7 @@ public:
|
|||||||
inline vector_type<_Ty> subvec_deep(uint32_t start = 0) const { return subvec_deep(start, size); }
|
inline vector_type<_Ty> subvec_deep(uint32_t start = 0) const { return subvec_deep(start, size); }
|
||||||
vector_type<_Ty> getRef() { return vector_type<_Ty>(container, size); }
|
vector_type<_Ty> getRef() { return vector_type<_Ty>(container, size); }
|
||||||
~vector_type() {
|
~vector_type() {
|
||||||
if (capacity > 0) GC::gc_handle->reg(container, sizeof(_Ty) * capacity);//free(container);
|
if (capacity > 0) GC::gc_handle->reg(container, sizeof(_Ty) * capacity);//*/free(container);
|
||||||
container = nullptr;
|
container = nullptr;
|
||||||
size = capacity = 0;
|
size = capacity = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user