Code quality: some renaming here and there
This commit is contained in:
@@ -39,7 +39,7 @@ string(REPLACE ";" " " BLAS_DEF_STR "${BLAS_DEF}")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
foreach(PROG blas)
|
||||
add_executable(${PROG}-bench ${PROG}.cpp)
|
||||
set_target_properties(${PROG}-bench PROPERTIES COMPILE_FLAGS "${BLAS_DEF_STR}")
|
||||
target_link_libraries(${PROG}-bench ${BLAS_LIBS} isaac)
|
||||
add_executable(bench-${PROG} ${PROG}.cpp)
|
||||
set_target_properties(bench-${PROG} PROPERTIES COMPILE_FLAGS "${BLAS_DEF_STR}")
|
||||
target_link_libraries(bench-${PROG} ${BLAS_LIBS} isaac)
|
||||
endforeach(PROG)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
foreach(PROG tie)
|
||||
add_executable(${PROG}-example ${PROG}.cpp)
|
||||
target_link_libraries(${PROG}-example isaac)
|
||||
foreach(PROG simple)
|
||||
add_executable(example-${PROG} ${PROG}.cpp)
|
||||
target_link_libraries(example-${PROG} isaac)
|
||||
endforeach(PROG)
|
||||
|
17
examples/simple.cpp
Normal file
17
examples/simple.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "isaac/array.h"
|
||||
|
||||
namespace sc = isaac;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
std::vector<float> data(70);
|
||||
for(unsigned int i = 0 ; i < data.size(); ++i)
|
||||
data[i] = i;
|
||||
sc::array A = sc::array(10, 7, data);
|
||||
std::cout << A << std::endl;
|
||||
std::cout << sc::diag(A, 1) << std::endl;
|
||||
std::cout << sc::diag(A, -1) << std::endl;
|
||||
std::cout << sc::diag(A, -7) << std::endl;
|
||||
std::cout << sc::row(A, 3) << std::endl;
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
#include "isaac/array.h"
|
||||
|
||||
namespace sc = isaac;
|
||||
|
||||
int main()
|
||||
{
|
||||
sc::array A = sc::array(sc::zeros(10, 10, sc::FLOAT_TYPE));
|
||||
std::cout << A({2,sc::end}, {3, sc::end}) << std::endl;
|
||||
}
|
@@ -83,11 +83,13 @@ public:
|
||||
array& operator/=(array const &);
|
||||
array& operator/=(math_expression const &);
|
||||
|
||||
//Indexing operators
|
||||
//Indexing (1D)
|
||||
math_expression operator[](for_idx_t idx) const;
|
||||
const scalar operator[](int_t) const;
|
||||
scalar operator[](int_t);
|
||||
view operator[](slice const &);
|
||||
|
||||
//Indexing (2D)
|
||||
view operator()(slice const &, slice const &);
|
||||
|
||||
|
||||
|
@@ -661,7 +661,10 @@ isaac::math_expression eye(int_t M, int_t N, isaac::numeric_type dtype, driver::
|
||||
{ return math_expression(value_scalar(1), value_scalar(0), op_element(OPERATOR_UNARY_TYPE_FAMILY, OPERATOR_VDIAG_TYPE), ctx, dtype, size4(M, N)); }
|
||||
|
||||
isaac::math_expression diag(array const & x, int offset)
|
||||
{ return math_expression(x, value_scalar(offset), op_element(OPERATOR_UNARY_TYPE_FAMILY, OPERATOR_MATRIX_DIAG_TYPE), x.context(), x.dtype(), size4(detail::min(x.shape()), 1, 1, 1)); }
|
||||
{
|
||||
int_t shape = std::min(x.shape()[0] + (offset<0)*offset, x.shape()[1] - (offset>0)*offset);
|
||||
return math_expression(x, value_scalar(offset), op_element(OPERATOR_UNARY_TYPE_FAMILY, OPERATOR_MATRIX_DIAG_TYPE), x.context(), x.dtype(), size4(shape, 1, 1, 1));
|
||||
}
|
||||
|
||||
|
||||
isaac::math_expression zeros(int_t M, int_t N, isaac::numeric_type dtype, driver::Context const & ctx)
|
||||
|
@@ -165,7 +165,7 @@ std::string axpy::generate_impl(std::string const & suffix, math_expression cons
|
||||
stream.dec_tab();
|
||||
stream << "}" << std::endl;
|
||||
|
||||
std::cout << stream.str() << std::endl;
|
||||
// std::cout << stream.str() << std::endl;
|
||||
|
||||
return stream.str();
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
add_subdirectory(linalg)
|
||||
add_subdirectory(core)
|
||||
if(ANDROID)
|
||||
add_subdirectory(android)
|
||||
endif()
|
||||
|
@@ -3,11 +3,11 @@ set(CLAPACK_SRC "")
|
||||
foreach(FNAME ${_CLAPACK_SRC})
|
||||
list(APPEND CLAPACK_SRC "${CMAKE_CURRENT_SOURCE_DIR}/external/${FNAME}.c")
|
||||
endforeach()
|
||||
|
||||
add_library(lapack-subset SHARED ${CLAPACK_SRC})
|
||||
add_dependencies(lapack-subset isaac)
|
||||
|
||||
foreach(PROG axpy dot ger gemv gemm gesvd)
|
||||
add_executable(${PROG} ${PROG}.cpp)
|
||||
add_test(${PROG}-test ${PROG})
|
||||
target_link_libraries(${PROG} isaac lapack-subset)
|
||||
add_executable(test-${PROG} ${PROG}.cpp)
|
||||
add_test(test-${PROG} test-${PROG})
|
||||
target_link_libraries(test-${PROG} isaac lapack-subset)
|
||||
endforeach()
|
Reference in New Issue
Block a user