Skip to content

Commit

Permalink
Replace a bunch of tabs with spaces
Browse files Browse the repository at this point in the history
for reference, these were found using grep -n -P '\t' */*.c* */*.h* src/*/*.c* src/*/*.h* */*.jl */*/*.jl */*/*/*.jl
  • Loading branch information
tkelman committed Dec 23, 2014
1 parent 55f37ac commit db7dc0a
Show file tree
Hide file tree
Showing 20 changed files with 378 additions and 378 deletions.
2 changes: 1 addition & 1 deletion base/linalg/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ function pinv{T}(A::StridedMatrix{T}, tol::Real)
B[i,i] = one(T)/A[i,i]
end
end
return B;
return B;
end
end
SVD = svdfact(A, thin=true)
Expand Down
44 changes: 22 additions & 22 deletions contrib/stringreplace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@
#include <string.h>

int main( int argc, char ** argv ) {
if( argc < 5 ) {
printf("Usage:\n");
printf(" %s <hex offset> <string to write> <maxlen> <file>\n", argv[0] );
return -1;
}
if( argc < 5 ) {
printf("Usage:\n");
printf(" %s <hex offset> <string to write> <maxlen> <file>\n", argv[0] );
return -1;
}

unsigned long offset = strtoul(argv[1], NULL, 16);
char * replacement = argv[2];
unsigned long maxlen = strtoul(argv[3], NULL, 10);
unsigned long offset = strtoul(argv[1], NULL, 16);
char * replacement = argv[2];
unsigned long maxlen = strtoul(argv[3], NULL, 10);

FILE * f = fopen( argv[4], "r+" );
if( !f ) {
printf( "ERROR: Could not open %s for writing!\n", argv[4] );
return -1;
}
FILE * f = fopen( argv[4], "r+" );
if( !f ) {
printf( "ERROR: Could not open %s for writing!\n", argv[4] );
return -1;
}

if( strlen(replacement) > maxlen ) {
printf( "ERROR: Replacement string length (%lu) is greater than maxlen! (%lu)\n", strlen(replacement), maxlen );
return -1;
}

fseek( f, offset, SEEK_SET );
fwrite( replacement, strlen(replacement)+1, 1, f );
if( strlen(replacement) > maxlen ) {
printf( "ERROR: Replacement string length (%lu) is greater than maxlen! (%lu)\n", strlen(replacement), maxlen );
return -1;
}

fclose( f );
return 0;
fseek( f, offset, SEEK_SET );
fwrite( replacement, strlen(replacement)+1, 1, f );

fclose( f );
return 0;
}
6 changes: 3 additions & 3 deletions deps/SuiteSparse_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ extern size_t jl_cholmod_sizeof_long(void) {

extern int jl_cholmod_version(int *ver) {
if (ver != (int*) NULL) {
ver[0] = CHOLMOD_MAIN_VERSION;
ver[1] = CHOLMOD_SUB_VERSION;
ver[2] = CHOLMOD_SUBSUB_VERSION;
ver[0] = CHOLMOD_MAIN_VERSION;
ver[1] = CHOLMOD_SUB_VERSION;
ver[2] = CHOLMOD_SUBSUB_VERSION;
}
return CHOLMOD_VERSION;
}
Expand Down
22 changes: 11 additions & 11 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4133,12 +4133,12 @@ static Function *emit_function(jl_lambda_info_t *lam, bool cstyle)
else {
prevlabel = false;
}
if (do_malloc_log && lno != prevlno) {
// Check memory allocation only after finishing a line
if (prevlno != -1)
mallocVisitLine(filename, prevlno);
prevlno = lno;
}
if (do_malloc_log && lno != prevlno) {
// Check memory allocation only after finishing a line
if (prevlno != -1)
mallocVisitLine(filename, prevlno);
prevlno = lno;
}
if (jl_is_expr(stmt) && ((jl_expr_t*)stmt)->head == return_sym) {
jl_expr_t *ex = (jl_expr_t*)stmt;
Value *retval;
Expand All @@ -4159,8 +4159,8 @@ static Function *emit_function(jl_lambda_info_t *lam, bool cstyle)
builder.CreateStore(builder.CreateBitCast(builder.CreateLoad(gcpop, false), jl_ppvalue_llvmt),
prepare_global(jlpgcstack_var));
#endif
if (do_malloc_log && lno != -1)
mallocVisitLine(filename, lno);
if (do_malloc_log && lno != -1)
mallocVisitLine(filename, lno);
if (builder.GetInsertBlock()->getTerminator() == NULL) {
if (retty == T_void)
builder.CreateRetVoid();
Expand Down Expand Up @@ -4716,9 +4716,9 @@ static void init_julia_llvm_env(Module *m)
add_named_global(jlgetnthfieldchecked_func, (void*)*jl_get_nth_field_checked);

diff_gc_total_bytes_func =
Function::Create(FunctionType::get(T_int64, false),
Function::ExternalLinkage,
"diff_gc_total_bytes", m);
Function::Create(FunctionType::get(T_int64, false),
Function::ExternalLinkage,
"diff_gc_total_bytes", m);
add_named_global(diff_gc_total_bytes_func, (void*)*diff_gc_total_bytes);

std::vector<Type *> execpoint_args(0);
Expand Down
2 changes: 1 addition & 1 deletion src/dlload.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ DLLEXPORT int jl_uv_dlopen(const char *filename, jl_uv_libhandle lib_, unsigned
#ifdef RTLD_FIRST
| JL_RTLD(flags, FIRST)
#endif
);
);
if (lib->handle) {
lib->errmsg = NULL;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/flisp/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ static value_t fl_os_setenv(value_t *args, uint32_t nargs)
#if defined (_OS_WINDOWS_)
result = SetEnvironmentVariable(name,val);
#else
result = setenv(name, val, 1);
result = setenv(name, val, 1);
#endif
}
if (result != 0)
Expand Down
4 changes: 2 additions & 2 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,9 @@ void *init_stdio_handle(uv_file fd,int readable)
#if defined(_OS_WINDOWS_)
_dup2(_open("NUL", O_RDWR | O_BINARY, _S_IREAD | _S_IWRITE), fd);
#else
dup2(open("/dev/null", O_RDWR, S_IRUSR | S_IWUSR /* 0600 */ | S_IRGRP | S_IROTH /* 0644 */), fd);
dup2(open("/dev/null", O_RDWR, S_IRUSR | S_IWUSR /* 0600 */ | S_IRGRP | S_IROTH /* 0644 */), fd);
#endif
// ...and continue on as in the UV_FILE case
// ...and continue on as in the UV_FILE case
case UV_FILE:
file = (jl_uv_file_t*)malloc(sizeof(jl_uv_file_t));
file->loop = jl_io_loop;
Expand Down
2 changes: 1 addition & 1 deletion src/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace JL_I {
// functions
abs_float, copysign_float, flipsign_int, select_value,
ceil_llvm, floor_llvm, trunc_llvm, rint_llvm,
sqrt_llvm, powi_llvm,
sqrt_llvm, powi_llvm,
// pointer access
pointerref, pointerset, pointertoref,
// c interface
Expand Down
2 changes: 1 addition & 1 deletion src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ restore_stack(jl_task_t *t, jl_jmp_buf *where, char *p)
p = _x;
if ((char*)&_x > _x) {
p = (char*)alloca((char*)&_x - _x);
}
}
restore_stack(t, where, p);
}
jl_jmp_target = where;
Expand Down
2 changes: 1 addition & 1 deletion src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ jl_value_t *jl_toplevel_eval_flex(jl_value_t *e, int fast)
jl_error("syntax: malformed \"importall\" statement");
m = (jl_module_t*)jl_eval_global_var(m, name);
if (!jl_is_module(m))
jl_errorf("invalid %s statement: name exists but does not refer to a module", ex->head->name);
jl_errorf("invalid %s statement: name exists but does not refer to a module", ex->head->name);
jl_module_importall(jl_current_module, m);
return jl_nothing;
}
Expand Down
30 changes: 15 additions & 15 deletions test/arpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ begin
bsym = b' + b
bpd = b'*b

(d,v) = eigs(a, nev=3)
@test_approx_eq a*v[:,2] d[2]*v[:,2]
(d,v) = eigs(a, nev=3)
@test_approx_eq a*v[:,2] d[2]*v[:,2]
@test norm(v) > testtol # eigenvectors cannot be null vectors
# (d,v) = eigs(a, b, nev=3, tol=1e-8) # not handled yet
# @test_approx_eq_eps a*v[:,2] d[2]*b*v[:,2] testtol
# @test norm(v) > testtol # eigenvectors cannot be null vectors

(d,v) = eigs(asym, nev=3)
@test_approx_eq asym*v[:,1] d[1]*v[:,1]
(d,v) = eigs(asym, nev=3)
@test_approx_eq asym*v[:,1] d[1]*v[:,1]
@test_approx_eq eigs(asym; nev=1, sigma=d[3])[1][1] d[3]
@test norm(v) > testtol # eigenvectors cannot be null vectors

(d,v) = eigs(apd, nev=3)
@test_approx_eq apd*v[:,3] d[3]*v[:,3]
(d,v) = eigs(apd, nev=3)
@test_approx_eq apd*v[:,3] d[3]*v[:,3]
@test_approx_eq eigs(apd; nev=1, sigma=d[3])[1][1] d[3]

(d,v) = eigs(apd, bpd, nev=3, tol=1e-8)
@test_approx_eq_eps apd*v[:,2] d[2]*bpd*v[:,2] testtol
@test_approx_eq_eps apd*v[:,2] d[2]*bpd*v[:,2] testtol
@test norm(v) > testtol # eigenvectors cannot be null vectors

# test (shift-and-)invert mode
Expand Down Expand Up @@ -85,21 +85,21 @@ d, = eigs(A6965,which=:SM,nev=2,ncv=4,tol=eps())
import Base: size, issym, ishermitian

type CPM{T<:Base.LinAlg.BlasFloat}<:AbstractMatrix{T} # completely positive map
kraus::Array{T,3} # kraus operator representation
kraus::Array{T,3} # kraus operator representation
end

size(Phi::CPM)=(size(Phi.kraus,1)^2,size(Phi.kraus,3)^2)
issym(Phi::CPM)=false
ishermitian(Phi::CPM)=false

function *{T<:Base.LinAlg.BlasFloat}(Phi::CPM{T},rho::Vector{T})
rho=reshape(rho,(size(Phi.kraus,3),size(Phi.kraus,3)))
rho2=zeros(T,(size(Phi.kraus,1),size(Phi.kraus,1)))
for s=1:size(Phi.kraus,2)
As=slice(Phi.kraus,:,s,:)
rho2+=As*rho*As'
end
return reshape(rho2,(size(Phi.kraus,1)^2,))
rho=reshape(rho,(size(Phi.kraus,3),size(Phi.kraus,3)))
rho2=zeros(T,(size(Phi.kraus,1),size(Phi.kraus,1)))
for s=1:size(Phi.kraus,2)
As=slice(Phi.kraus,:,s,:)
rho2+=As*rho*As'
end
return reshape(rho2,(size(Phi.kraus,1)^2,))
end
# Generate random isometry
(Q,R)=qr(randn(100,50))
Expand Down
8 changes: 4 additions & 4 deletions test/ccalltest.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
int xs[300] = {0,0,0,1,0};

int __attribute((noinline)) testUcharX(unsigned char x) {
return xs[x];
return xs[x];
}

#define xstr(s) str(s)
Expand All @@ -14,11 +14,11 @@ volatile int b;

int main() {
printf("all of the following should be 1 except xs[259] = 0");
a = 3;
a = 3;
b = 259;
fptr = (volatile int (*)(unsigned char x))&testUcharX;
if ((((long)fptr)&((long)1)<<32) == 1) fptr = NULL;
printf("compiled with: '%s'\nxs[3] = %d\nxs[259] = %d\ntestUcharX(3) = %d\ntestUcharX(%d) = %d\nfptr(3) = %d\nfptr(259) = %d\n",
xstr(CC), xs[a], xs[b], testUcharX(a), b, testUcharX(b), fptr(a), fptr(b));
printf("compiled with: '%s'\nxs[3] = %d\nxs[259] = %d\ntestUcharX(3) = %d\ntestUcharX(%d) = %d\nfptr(3) = %d\nfptr(259) = %d\n",
xstr(CC), xs[a], xs[b], testUcharX(a), b, testUcharX(b), fptr(a), fptr(b));
}

Loading

0 comments on commit db7dc0a

Please sign in to comment.